@buildbase/sdk 0.0.26 → 0.0.27
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/README.md +37 -0
- package/dist/index.d.ts +52 -2
- package/dist/index.esm.js +5 -5
- package/dist/index.js +5 -5
- package/dist/saas-os.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("react-dom");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var a=n(t),s=n(r);function o(e){return Boolean(e?.serverUrl&&e?.version&&e?.orgId)}function i(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=i(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function l(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=i(e))&&(n&&(n+=" "),n+=t);return n}exports.ApiVersion=void 0,(exports.ApiVersion||(exports.ApiVersion={})).V1="v1";const c=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),d="-",u=[],f=e=>{const t=h(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return m(e);const r=e.split(d),n=""===r[0]&&r.length>1?1:0;return p(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=n[e],a=r[e];return t?a?((e,t)=>{const r=new Array(e.length+t.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(a,t):t:a||u}return r[e]||u}}},p=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=p(e,t+1,a);if(r)return r}const s=r.validators;if(null===s)return;const o=0===t?e.join(d):e.slice(t).join(d),i=s.length;for(let e=0;e<i;e++){const t=s[e];if(t.validator(o))return t.classGroupId}},m=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),h=e=>{const{theme:t,classGroups:r}=e;return g(r,t)},g=(e,t)=>{const r=c();for(const n in e){const a=e[n];b(a,r,n,t)}return r},b=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const a=e[s];x(a,t,r,n)}},x=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?w(e,t,r,n):v(e,t,r,n):y(e,t,r)},y=(e,t,r)=>{(""===e?t:S(t,e)).classGroupId=r},v=(e,t,r,n)=>{j(e)?b(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},w=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let e=0;e<s;e++){const[s,o]=a[e];b(o,S(t,s),r,n)}},S=(e,t)=>{let r=e;const n=t.split(d),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=c(),r.nextPart.set(t,a)),r=a}return r},j=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,k=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(a,s)=>{r[a]=s,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},N=[],E=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),C=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,s=0;const o=e.length;for(let i=0;i<o;i++){const o=e[i];if(0===n&&0===a){if(":"===o){t.push(e.slice(s,i)),s=i+1;continue}if("/"===o){r=i;continue}}"["===o?n++:"]"===o?n--:"("===o?a++:")"===o&&a--}const i=0===t.length?e:e.slice(s);let l=i,c=!1;i.endsWith("!")?(l=i.slice(0,-1),c=!0):i.startsWith("!")&&(l=i.slice(1),c=!0);return E(t,c,l,r&&r>s?r-s:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):E(N,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},A=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{const r=[];let n=[];for(let a=0;a<e.length;a++){const s=e[a],o="["===s[0],i=t.has(s);o||i?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(s)):n.push(s)}return n.length>0&&(n.sort(),r.push(...n)),r}},_=/\s+/,T=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=T(e[n]))&&(r&&(r+=" "),r+=t);return r},R=(e,...t)=>{let r,n,a,s;const o=e=>{const t=n(e);if(t)return t;const s=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],i=e.trim().split(_);let l="";for(let e=i.length-1;e>=0;e-=1){const t=i[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]:s(d).join(":"),b=u?g+"!":g,x=b+h;if(o.indexOf(x)>-1)continue;o.push(x);const y=a(h,m);for(let e=0;e<y.length;++e){const t=y[e];o.push(b+t)}l=t+(l.length>0?" "+l:l)}return l})(e,r);return a(e,s),s};return s=i=>{const l=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:k(e.cacheSize),parseClassName:C(e),sortModifiers:A(e),...f(e)}))(l),n=r.cache.get,a=r.cache.set,s=o,o(i)},(...e)=>s(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=T(t))&&(a&&(a+=" "),a+=r);return a})(...e))},P=[],O=e=>{const t=t=>t[e]||P;return t.isThemeGetter=!0,t},I=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,D=/^\((?:(\w[\w-]*):)?(.+)\)$/i,U=/^\d+\/\d+$/,F=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,M=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,z=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,L=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,W=e=>U.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),B=e=>!!e&&Number.isInteger(Number(e)),G=e=>e.endsWith("%")&&V(e.slice(0,-1)),K=e=>F.test(e),H=()=>!0,Z=e=>M.test(e)&&!z.test(e),q=()=>!1,J=e=>L.test(e),Y=e=>$.test(e),X=e=>!ee(e)&&!oe(e),Q=e=>pe(e,be,q),ee=e=>I.test(e),te=e=>pe(e,xe,Z),re=e=>pe(e,ye,V),ne=e=>pe(e,he,q),ae=e=>pe(e,ge,Y),se=e=>pe(e,we,J),oe=e=>D.test(e),ie=e=>me(e,xe),le=e=>me(e,ve),ce=e=>me(e,he),de=e=>me(e,be),ue=e=>me(e,ge),fe=e=>me(e,we,!0),pe=(e,t,r)=>{const n=I.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},me=(e,t,r=!1)=>{const n=D.exec(e);return!!n&&(n[1]?t(n[1]):r)},he=e=>"position"===e||"percentage"===e,ge=e=>"image"===e||"url"===e,be=e=>"length"===e||"size"===e||"bg-size"===e,xe=e=>"length"===e,ye=e=>"number"===e,ve=e=>"family-name"===e,we=e=>"shadow"===e,Se=R(()=>{const e=O("color"),t=O("font"),r=O("text"),n=O("font-weight"),a=O("tracking"),s=O("leading"),o=O("breakpoint"),i=O("container"),l=O("spacing"),c=O("radius"),d=O("shadow"),u=O("inset-shadow"),f=O("text-shadow"),p=O("drop-shadow"),m=O("blur"),h=O("perspective"),g=O("aspect"),b=O("ease"),x=O("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",oe,ee],v=()=>[oe,ee,l],w=()=>[W,"full","auto",...v()],S=()=>[B,"none","subgrid",oe,ee],j=()=>["auto",{span:["full",B,oe,ee]},B,oe,ee],k=()=>[B,"auto",oe,ee],N=()=>["auto","min","max","fr",oe,ee],E=()=>["auto",...v()],C=()=>[W,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...v()],A=()=>[e,oe,ee],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",ce,ne,{position:[oe,ee]}],T=()=>["auto","cover","contain",de,Q,{size:[oe,ee]}],R=()=>[G,ie,te],P=()=>["","none","full",c,oe,ee],I=()=>["",V,ie,te],D=()=>[V,G,ce,ne],U=()=>["","none",m,oe,ee],F=()=>["none",V,oe,ee],M=()=>["none",V,oe,ee],z=()=>[V,oe,ee],L=()=>[W,"full",...v()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[K],breakpoint:[K],color:[H],container:[K],"drop-shadow":[K],ease:["in","out","in-out"],font:[X],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[K],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[K],shadow:[K],spacing:["px",V],text:[K],"text-shadow":[K],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",W,ee,oe,g]}],container:["container"],columns:[{columns:[V,ee,oe,i]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[B,"auto",oe,ee]}],basis:[{basis:[W,"full","auto",i,...v()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[V,W,"auto","initial","none",ee]}],grow:[{grow:["",V,oe,ee]}],shrink:[{shrink:["",V,oe,ee]}],order:[{order:[B,"first","last","none",oe,ee]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":N()}],"auto-rows":[{"auto-rows":N()}],gap:[{gap:v()}],"gap-x":[{"gap-x":v()}],"gap-y":[{"gap-y":v()}],"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:v()}],px:[{px:v()}],py:[{py:v()}],ps:[{ps:v()}],pe:[{pe:v()}],pt:[{pt:v()}],pr:[{pr:v()}],pb:[{pb:v()}],pl:[{pl:v()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":v()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":v()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],w:[{w:[i,"screen",...C()]}],"min-w":[{"min-w":[i,"screen","none",...C()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[o]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",r,ie,te]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,oe,re]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",G,ee]}],"font-family":[{font:[le,ee,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,oe,ee]}],"line-clamp":[{"line-clamp":[V,"none",oe,re]}],leading:[{leading:[s,...v()]}],"list-image":[{"list-image":["none",oe,ee]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",oe,ee]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[V,"from-font","auto",oe,te]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[V,"auto",oe,ee]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:v()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",oe,ee]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",oe,ee]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},B,oe,ee],radial:["",oe,ee],conic:[B,oe,ee]},ue,ae]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[V,oe,ee]}],"outline-w":[{outline:["",V,ie,te]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",d,fe,se]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",u,fe,se]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[V,te]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",f,fe,se]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[V,oe,ee]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[oe,ee]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",oe,ee]}],filter:[{filter:["","none",oe,ee]}],blur:[{blur:U()}],brightness:[{brightness:[V,oe,ee]}],contrast:[{contrast:[V,oe,ee]}],"drop-shadow":[{"drop-shadow":["","none",p,fe,se]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",V,oe,ee]}],"hue-rotate":[{"hue-rotate":[V,oe,ee]}],invert:[{invert:["",V,oe,ee]}],saturate:[{saturate:[V,oe,ee]}],sepia:[{sepia:["",V,oe,ee]}],"backdrop-filter":[{"backdrop-filter":["","none",oe,ee]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[V,oe,ee]}],"backdrop-contrast":[{"backdrop-contrast":[V,oe,ee]}],"backdrop-grayscale":[{"backdrop-grayscale":["",V,oe,ee]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,oe,ee]}],"backdrop-invert":[{"backdrop-invert":["",V,oe,ee]}],"backdrop-opacity":[{"backdrop-opacity":[V,oe,ee]}],"backdrop-saturate":[{"backdrop-saturate":[V,oe,ee]}],"backdrop-sepia":[{"backdrop-sepia":["",V,oe,ee]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":v()}],"border-spacing-x":[{"border-spacing-x":v()}],"border-spacing-y":[{"border-spacing-y":v()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",oe,ee]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[V,"initial",oe,ee]}],ease:[{ease:["linear","initial",b,oe,ee]}],delay:[{delay:[V,oe,ee]}],animate:[{animate:["none",x,oe,ee]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,oe,ee]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:F()}],"rotate-x":[{"rotate-x":F()}],"rotate-y":[{"rotate-y":F()}],"rotate-z":[{"rotate-z":F()}],scale:[{scale:M()}],"scale-x":[{"scale-x":M()}],"scale-y":[{"scale-y":M()}],"scale-z":[{"scale-z":M()}],"scale-3d":["scale-3d"],skew:[{skew:z()}],"skew-x":[{"skew-x":z()}],"skew-y":[{"skew-y":z()}],transform:[{transform:[oe,ee,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:L()}],"translate-x":[{"translate-x":L()}],"translate-y":[{"translate-y":L()}],"translate-z":[{"translate-z":L()}],"translate-none":["translate-none"],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",oe,ee]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":v()}],"scroll-mx":[{"scroll-mx":v()}],"scroll-my":[{"scroll-my":v()}],"scroll-ms":[{"scroll-ms":v()}],"scroll-me":[{"scroll-me":v()}],"scroll-mt":[{"scroll-mt":v()}],"scroll-mr":[{"scroll-mr":v()}],"scroll-mb":[{"scroll-mb":v()}],"scroll-ml":[{"scroll-ml":v()}],"scroll-p":[{"scroll-p":v()}],"scroll-px":[{"scroll-px":v()}],"scroll-py":[{"scroll-py":v()}],"scroll-ps":[{"scroll-ps":v()}],"scroll-pe":[{"scroll-pe":v()}],"scroll-pt":[{"scroll-pt":v()}],"scroll-pr":[{"scroll-pr":v()}],"scroll-pb":[{"scroll-pb":v()}],"scroll-pl":[{"scroll-pl":v()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",oe,ee]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[V,ie,te,re]}],stroke:[{stroke:["none",...A()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function je(){try{const e="undefined"!=typeof globalThis?globalThis:null;return"development"===e?.process?.env?.NODE_ENV}catch{return!1}}function ke(...e){return Se(l(e))}let Ne=!0;function Ee(e,...t){console.error(e,...t)}function Ce(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(Ce);const r={};for(const[n,a]of Object.entries(e))r[n]=t.has(n.toLowerCase())?"[redacted]":Ce(a);return r}function Ae(e){return e instanceof Error&&("AbortError"===e.name||"ERR_CANCELED"===e.code)}async function _e(e,t){try{const r=await fetch(e,t);if(je()){const n=(t?.method??"GET").toUpperCase();let a;if(null!=t?.body)try{a="string"==typeof t.body?JSON.parse(t.body):{body:"(non-JSON)"}}catch{a={body:"(parse failed)"}}const s=r.clone();let o;try{const e=await s.text();if(e)try{o=JSON.parse(e)}catch{o=e.substring(0,200)+(e.length>200?"...":"")}}catch{o="(read failed)"}!function(e,...t){Ne&&je()&&console.log(e,...t)}("[SDK API]",n,e,{request:Ce(a),response:Ce(o),status:r.status})}return r}catch(e){if(Ae(e))throw e;if(e instanceof TypeError&&"Failed to fetch"===e.message)throw new Error("Network error: Please check your internet connection");throw e}}async function Te(e,t){try{const r=await e.json();return r?.message||r?.error||t}catch{return t}}async function Re(e){const t=await e.text();if(!t)throw new Error("Empty response body");try{return JSON.parse(t)}catch(e){throw new Error(`Invalid JSON response: ${t.substring(0,100)}${t.length>100?"...":""}`)}}async function Pe(e,t="Request failed"){if(!e.ok){let r=t;try{const t=await Re(e);r=t.message||t.error||r}catch{r=function(e,t){const r={400:"Bad Request",401:"Unauthorized - Please check your session",403:"Forbidden - You do not have permission",404:"Resource not found",500:"Internal server error",502:"Bad Gateway",503:"Service unavailable"}[e.status]||e.statusText||t;return new Error(`${t} (${e.status}: ${r})`)}(e,t).message}throw new Error(r)}try{return await Re(e)}catch(e){if(e instanceof Error&&e.message.includes("Invalid JSON"))throw e;throw new Error("Failed to parse response as JSON")}}class Oe extends Error{constructor(e,t,r,n){super(e),this.code=t,this.context=r,this.originalError=n,this.name="SDKError","undefined"!=typeof Error&&"captureStackTrace"in Error&&Error.captureStackTrace(this,Oe)}}const Ie=new class{constructor(){this.config={enableConsoleLogging:!0,showUserNotifications:!1}}configure(e){this.config={...this.config,...e},void 0!==e.enableConsoleLogging&&function(e){void 0!==e.enableLogging&&(Ne=e.enableLogging)}({enableLogging:e.enableConsoleLogging})}handleError(e,t={}){if(Ae(e))return;const r=e instanceof Error?e:new Oe("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof Oe?r:new Oe(r.message,"SDK_ERROR",t,r);if(this.config.enableConsoleLogging&&function(e,...t){Ne&&je()&&console.error(e,...t)}(`[SDK Error] ${t.component||"Unknown"}:`,{message:n.message,code:n.code,context:n.context,originalError:n.originalError,stack:n.stack}),this.config.onError)try{this.config.onError(n,t)}catch(e){Ee("[SDK Error Handler] Error in custom error callback:",e)}this.config.showUserNotifications&&this.notifyUser(n,t)}notifyUser(e,t){"undefined"!=typeof window&&window.dispatchEvent&&window.dispatchEvent(new CustomEvent("sdk-error",{detail:{error:e,context:t}}))}wrapAsync(e,t){return(...r)=>e(...r).catch(e=>{throw this.handleError(e,t),e})}wrapSync(e,t){return(...r)=>{try{return e(...r)}catch(e){throw this.handleError(e,t),e}}}};function De(e,t={}){Ie.handleError(e,t)}function Ue(e,t={}){return!Ae(e)&&(Ie.handleError(e,t),!0)}class Fe extends t.Component{constructor(e){super(e),this.resetError=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){if(De(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){Ee("[SDK ErrorBoundary] Error in onError callback:",e)}}componentDidUpdate(e){this.state.hasError&&!1!==this.props.resetOnPropsChange&&e.children!==this.props.children&&this.resetError()}render(){return this.state.hasError&&this.state.error?this.props.fallback?"function"==typeof this.props.fallback?this.props.fallback(this.state.error,this.resetError):this.props.fallback:e.jsxs("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),e.jsx("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),e.jsx("button",{onClick:this.resetError,style:{padding:"0.5rem 1rem",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"0.25rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]}):this.props.children}}const Me=()=>({type:"AUTHENTICATION_STARTED"}),ze=()=>({type:"AUTHENTICATION_PROCESSING"}),Le=()=>({type:"AUTHENTICATION_FAILED"}),$e=e=>({type:"SET_SESSION",payload:e}),We=()=>({type:"REMOVE_SESSION"});function Ve(e,r,n){const a=t.useRef(r),s=t.useRef(n),o=t.useRef(void 0),i=t.useRef(!1);return a.current=r,s.current=n,t.useMemo(()=>{const t=a.current(e);if(i.current){if(s.current?s.current(o.current,t):Object.is(o.current,t))return o.current}return o.current=t,i.current=!0,t},[e])}function Be({name:r,initialState:n,reducer:a,initializer:s}){const o=t.createContext(null),i=t.createContext(null),l=t.createContext(null),c=t.memo(({children:r})=>{const[c,d]=t.useReducer(a,n,s||(e=>e)),u=t.useMemo(()=>({state:c,dispatch:d}),[c,d]);return e.jsx(l.Provider,{value:u,children:e.jsx(o.Provider,{value:c,children:e.jsx(i.Provider,{value:d,children:r})})})});c.displayName=`${r}Provider`;const d=e=>new Error(`use${r}${e} must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`),u=()=>{const e=t.useContext(o);if(null===e)throw d("State");return e};return{Provider:c,useContext:()=>{const e=t.useContext(l);if(!e)throw d("Context");return e},useState:u,useDispatch:()=>{const e=t.useContext(i);if(null===e)throw d("Dispatch");return e},useSelector:(e,t)=>{const r=e||(e=>e);return Ve(u(),r,t)}}}var Ge;function Ke(e){return{isAuthenticated:e===exports.AuthStatus.authenticated,isLoading:e===exports.AuthStatus.loading||e===exports.AuthStatus.redirecting||e===exports.AuthStatus.authenticating,isRedirecting:e===exports.AuthStatus.redirecting}}function He(e,t,r){return{...e,[t]:r}}function Ze(e,t){return{...e,...t}}exports.AuthStatus=void 0,(Ge=exports.AuthStatus||(exports.AuthStatus={})).loading="loading",Ge.redirecting="redirecting",Ge.authenticated="authenticated",Ge.unauthenticated="unauthenticated",Ge.authenticating="authenticating";const qe=()=>({session:null,status:exports.AuthStatus.loading}),{Provider:Je,useState:Ye,useDispatch:Xe}=Be({name:"Auth",initialState:qe(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return He(e,"status",exports.AuthStatus.redirecting);case"AUTHENTICATION_PROCESSING":return He(e,"status",exports.AuthStatus.authenticating);case"AUTHENTICATION_FAILED":case"REMOVE_SESSION":return Ze(e,{session:null,status:exports.AuthStatus.unauthenticated});case"SET_SESSION":return Ze(e,{session:t.payload,status:exports.AuthStatus.authenticated});default:return e}},initializer:qe}),Qe=Je,et=Ye,tt=Xe,rt=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),nt=e=>({type:"SET_SETTINGS",payload:e}),at=()=>({serverUrl:"",version:exports.ApiVersion.V1,orgId:"",settings:null}),{Provider:st,useState:ot,useDispatch:it}=Be({name:"OS",initialState:at(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return Ze(e,t.payload);case"REMOVE_SAAS_OS_CONFIG":return at();case"SET_SETTINGS":return He(e,"settings",t.payload);default:return e}}}),lt=st,ct=ot,dt=it,ut=e=>({type:"SET_WORKSPACES",payload:e}),ft=e=>({type:"ADD_WORKSPACE",payload:e}),pt=e=>({type:"UPDATE_WORKSPACE",payload:e}),mt=e=>({type:"REMOVE_WORKSPACE",payload:e}),ht=e=>({type:"SET_ALL_FEATURES",payload:e}),gt=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),bt=()=>({type:"RESET_CURRENT_WORKSPACE"}),xt=e=>({type:"SET_IS_INITIALIZED",payload:e}),yt=e=>({type:"SET_LOADING",payload:e}),vt=e=>({type:"SET_ERROR",payload:e}),wt=e=>({type:"SET_REFRESHING",payload:e}),St=e=>({type:"SET_SWITCHING_TO_ID",payload:e}),{Provider:jt,useState:kt,useDispatch:Nt}=Be({name:"Workspace",initialState:{workspaces:[],loading:!1,error:null,currentWorkspace:null,refreshing:!1,switchingToId:null,isInitialized:!1,allFeatures:[]},reducer:(e,t)=>{switch(t.type){case"SET_WORKSPACES":return He(e,"workspaces",t.payload);case"ADD_WORKSPACE":return He(e,"workspaces",[...e.workspaces,t.payload]);case"UPDATE_WORKSPACE":return He(e,"workspaces",e.workspaces.map(e=>e._id===t.payload._id?t.payload:e));case"REMOVE_WORKSPACE":return He(e,"workspaces",e.workspaces.filter(e=>e._id!==t.payload));case"SET_ALL_FEATURES":return He(e,"allFeatures",t.payload);case"SET_CURRENT_WORKSPACE":return He(e,"currentWorkspace",t.payload);case"RESET_CURRENT_WORKSPACE":return He(e,"currentWorkspace",null);case"SET_IS_INITIALIZED":return He(e,"isInitialized",t.payload);case"SET_LOADING":return He(e,"loading",t.payload);case"SET_ERROR":return He(e,"error",t.payload);case"SET_REFRESHING":return He(e,"refreshing",t.payload);case"SET_SWITCHING_TO_ID":return He(e,"switchingToId",t.payload);default:return e}}}),Et=jt,Ct=kt,At=Nt,_t=t.memo(({children:t})=>e.jsx(lt,{children:e.jsx(Qe,{children:e.jsx(Et,{children:t})})}));_t.displayName="SDKContextProvider";const Tt=new Set;function Rt(){Tt.forEach(e=>e())}const Pt=new class{constructor(){this.callbacks=null}setCallbacks(e){this.callbacks=e}getCallbacks(){return this.callbacks}async emit(e,t){if(this.callbacks?.handleEvent)try{await this.callbacks.handleEvent(e,t)}catch(t){De(t,{component:"EventEmitter",action:"emit",metadata:{eventType:e}})}}async emitUserCreated(e){await this.emit("user:created",{user:e})}async emitUserUpdated(e,t){await this.emit("user:updated",{user:e,previousUser:t})}async emitWorkspaceChanged(e,t){await this.emit("workspace:changed",{workspace:e,previousWorkspace:t})}async emitWorkspaceUpdated(e){await this.emit("workspace:updated",{workspace:e})}async emitWorkspaceUserAdded(e,t,r){await this.emit("workspace:user-added",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRemoved(e,t,r){await this.emit("workspace:user-removed",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRoleChanged(e,t,r,n){await this.emit("workspace:user-role-changed",{userId:e,workspace:t,previousRole:r,newRole:n})}async emitWorkspaceCreated(e){await this.emit("workspace:created",{workspace:e})}async emitWorkspaceDeleted(e){await this.emit("workspace:deleted",{workspace:e})}};function Ot(e,r,n){t.useEffect(()=>{const t=new AbortController;return e(t.signal).catch(e=>{Ae(e)||(n?.onError?n.onError(e):De(e,{component:"useAsyncEffect",action:"effect",metadata:{note:"Unhandled rejection - consider passing onError"}}))}),()=>t.abort()},r)}function It(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return De(t,{component:"storage",action:"getStorageItem",metadata:{key:e}}),null}}function Dt(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){De(t,{component:"storage",action:"setStorageItem",metadata:{key:e}})}}function Ut(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){De(t,{component:"storage",action:"removeStorageItem",metadata:{key:e}})}}const Ft="code",Mt="saas-session-id",zt="saas-workspace-current";function Lt(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 $t(e){Dt(Mt,e)}function Wt(){Ut(Mt)}function Vt(){if("undefined"==typeof window)return null;try{return It(Mt)}catch(e){return De(e,{component:"auth/utils",action:"getSessionId",metadata:{key:Mt}}),null}}function Bt(){const e=Vt(),t={};return e&&(t["x-session-id"]=e),t}function Gt(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(Ft)}catch(e){return De(e,{component:"auth/utils",action:"getTokenFromUrl",metadata:{param:Ft}}),null}}function Kt(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const Ht="SDK is not ready (missing serverUrl, version, or orgId)";class Zt{constructor(e){this.serverUrl=e.serverUrl,this.version=e.version,this.orgId=e.orgId,this.requireOrgId=e.requireOrgId??!1,this.basePath=e.basePath??"public"}ensureReady(){if(!this.serverUrl?.trim()||!this.version)throw new Error(Ht);if(this.requireOrgId&&!this.orgId?.trim())throw new Error(Ht)}get baseUrl(){return this.ensureReady(),`${this.serverUrl}/api/${this.version}/${this.basePath}`}getAuthHeaders(){return Bt()}url(e){const t=e.startsWith("/")?e.slice(1):e;return`${this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl}/${t}`}async fetchJson(e,t={},r="Request failed"){this.ensureReady();const n={...this.getAuthHeaders()};t.headers&&Object.assign(n,t.headers),null==t.body||n["Content-Type"]||(n["Content-Type"]="application/json");return Pe(await _e(this.url(e),{...t,headers:n}),r)}async fetchResponse(e,t={}){this.ensureReady();const r={...this.getAuthHeaders()};return t.headers&&Object.assign(r,t.headers),null==t.body||r["Content-Type"]||(r["Content-Type"]="application/json"),_e(this.url(e),{...t,headers:r})}}class qt extends Zt{constructor(e){super({...e,requireOrgId:!0})}async getSettings(e){return this.fetchJson(`${this.orgId}/settings`,{signal:e},"Failed to fetch settings")}}function Jt(){return kr(e=>e.os)}function Yt(){const e=Nr(),r=Jt(),{serverUrl:n,version:a,orgId:s,settings:i}=r,l=t.useRef(!1),c=t.useMemo(()=>o(r)?new qt({serverUrl:n,version:a,orgId:s}):null,[n,a,s]),d=t.useCallback(async t=>{if(l.current)return i||null;if(i)return i;if(!c)return null;l.current=!0;try{const r=await c.getSettings(t);return e.os(nt(r)),r}catch(e){return Ue(e,{component:"useSaaSSettings",action:"getSettings",metadata:{serverUrl:n,version:a,orgId:s}}),null}finally{l.current=!1}},[c,i,e]);return Ot(async e=>{!o(r)||i||l.current||await d(e)},[n,a,s,d],{onError:e=>Ue(e,{component:"useSaaSSettings",action:"fetchSettings",metadata:{serverUrl:n,version:a,orgId:s}})}),t.useMemo(()=>({settings:i,getSettings:d}),[i,d])}class Xt extends Zt{constructor(e){super({...e,requireOrgId:!0})}async getWorkspaces(){return this.fetchJson("workspaces",{},"Failed to fetch workspaces")}async createWorkspace(e){return this.fetchJson("workspaces",{method:"POST",body:JSON.stringify(e)},"Failed to create workspace")}async updateWorkspace(e,t){return this.fetchJson(`workspaces/${e}`,{method:"PUT",body:JSON.stringify(t)},"Failed to update workspace")}async deleteWorkspace(e){return this.fetchJson(`workspaces/${e}`,{method:"DELETE"},"Failed to delete workspace")}async getWorkspaceUsers(e){return this.fetchJson(`workspaces/${e}/users`,{},"Failed to fetch workspace users")}async addUser(e,t){return this.fetchJson(`workspaces/${e}/users/add`,{method:"POST",body:JSON.stringify(t)},"Failed to invite member")}async removeUser(e,t){return this.fetchJson(`workspaces/${e}/users/${t}`,{method:"DELETE"},"Failed to remove user")}async updateUser(e,t,r){return this.fetchJson(`workspaces/${e}/users/${t}`,{method:"PATCH",body:JSON.stringify(r)},"Failed to update user")}async getFeatures(){return this.fetchJson("workspaces/features",{},"Failed to fetch features")}async updateFeature(e,t,r){return this.fetchJson(`workspaces/${e}/features`,{method:"PATCH",body:JSON.stringify({features:{[t]:r}})},"Failed to update feature")}async getWorkspace(e){return this.fetchJson(`workspaces/${e}`,{},"Failed to fetch workspace")}async getProfile(){return this.fetchJson("profile",{},"Failed to fetch profile")}async updateUserProfile(e){return this.fetchJson("profile",{method:"PATCH",body:JSON.stringify(e)},"Failed to update user profile")}async getCurrentSubscription(e){const t=await this.fetchResponse(`workspaces/${e}/subscription`);if(!t.ok){let e="Failed to fetch subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Workspace not found or no subscription available":401===t.status?"Unauthorized - Please check your session":`Failed to fetch subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch subscription");return r.data||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 createBillingPortalSession(e,t){return this.fetchJson(`workspaces/${e}/subscription/billing-portal`,{method:"POST",body:JSON.stringify(t?{returnUrl:t}:{})})}async listInvoices(e,t=10,r){const n=new URLSearchParams;n.append("limit",t.toString()),r&&n.append("starting_after",r);const a=await this.fetchResponse(`workspaces/${e}/subscription/invoices?${n.toString()}`,{});if(!a.ok){let e="Failed to fetch invoices";try{e=(await a.json()).message||e}catch{e=404===a.status?"Workspace not found or no invoices available":401===a.status?"Unauthorized - Please check your session":`Failed to fetch invoices (${a.status}: ${a.statusText})`}throw new Error(e)}const s=await a.json();if(void 0!==s.success){if(!s.success)throw new Error(s.message||"Failed to fetch invoices");return s}return s}async getInvoice(e,t){const r=await this.fetchResponse(`workspaces/${e}/subscription/invoices/${t}`,{});if(!r.ok){let e="Failed to fetch invoice";try{e=(await r.json()).message||e}catch{e=404===r.status?"Invoice not found":401===r.status?"Unauthorized - Please check your session":`Failed to fetch invoice (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to fetch invoice");return n}return n}async cancelSubscriptionAtPeriodEnd(e){const t=await this.fetchResponse(`workspaces/${e}/subscription/cancel-at-period-end`,{method:"POST"});if(!t.ok){let e="Failed to cancel subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Subscription not found":401===t.status?"Unauthorized - Please check your session":`Failed to cancel subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to cancel subscription");return r.data||r}return r}async resumeSubscription(e){const t=await this.fetchResponse(`workspaces/${e}/subscription/resume`,{method:"POST"});if(!t.ok){let e="Failed to resume subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Subscription not found":401===t.status?"Unauthorized - Please check your session":`Failed to resume subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to resume subscription");return r.data||r}return r}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}`:""}`,s=await this.fetchResponse(a);if(!s.ok){let e="Failed to fetch usage logs";try{e=(await s.json()).message||e}catch{e=404===s.status?"Workspace not found":401===s.status?"Unauthorized - Please check your session":`Failed to fetch usage logs (${s.status}: ${s.statusText})`}throw new Error(e)}const o=await s.json();if(void 0!==o.success){if(!o.success)throw new Error(o.message||"Failed to fetch usage logs");return o.data||o}return o}}const Qt=e=>{e?Dt(zt,e._id):Ut(zt)},er=()=>It(zt),tr=()=>{Ut(zt)},rr=(e,t)=>!!e&&t.some(t=>t._id===e);function nr(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 ar(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 sr(){const e=Jt(),r=function(e){return t.useMemo(()=>new Xt(e),[e.serverUrl,e.version,e.orgId])}(e);return t.useMemo(()=>({os:e,api:r}),[e,r])}const or=()=>{const e=Nr(),{os:r,api:n}=sr(),a=kr(e=>e.workspaces),s=kr(e=>e.auth.session?.user),o=t.useCallback((t,r)=>{if((!(t._id===a.currentWorkspace?._id)||r?.forceEmit)&&t){const r=a.currentWorkspace;Qt(t),e.workspaces(gt(t)),Pt.emitWorkspaceChanged(t,r).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[a.currentWorkspace,e]),i=t.useCallback(async(t,n)=>{const a=++u.current;e.workspaces(St(t._id));try{const e=r.auth?.callbacks?.onWorkspaceChange;if(e){const r=ar(t,s?.id);try{await e({workspace:t,user:s??null,role:r})}catch(e){throw De(e,{component:"useSaaSWorkspaces",action:"onWorkspaceChange",metadata:{workspaceId:t._id}}),e}if(a!==u.current)return}o(t,n)}finally{a===u.current&&e.workspaces(St(null))}},[e,r.auth?.callbacks?.onWorkspaceChange,o,s]);t.useEffect(()=>{if(!a.isInitialized){const t=er();if(e.workspaces(xt(!0)),t){const e=a.workspaces.find(e=>e._id===t);e&&i(e,{forceEmit:!0}).catch(()=>{})}}},[a.isInitialized,a.workspaces,a.currentWorkspace,e,i]);const l=t.useCallback(()=>{tr(),e.workspaces(bt())},[e]),c=t.useRef(!1),d=t.useRef(!1),u=t.useRef(0),f=t.useCallback(async()=>{if(!a.loading&&!c.current){c.current=!0,e.workspaces(yt(!0)),e.workspaces(vt(null));try{const t=await n.getWorkspaces();if(e.workspaces(ut(t)),t.length>0){const e=er();if(e&&rr(e,t)){const r=t.find(t=>t._id===e);if(r)try{await i(r,{forceEmit:!0})}catch{}}else{const e=t[0];try{await i(e,{forceEmit:!0})}catch{}}}}catch(t){e.workspaces(vt(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(yt(!1)),c.current=!1}}},[n,a.loading,e,i]),p=t.useCallback(async()=>{if(!a.refreshing&&!c.current){c.current=!0,e.workspaces(wt(!0));try{const t=await n.getWorkspaces();e.workspaces(ut(t))}catch(e){}finally{e.workspaces(wt(!1)),c.current=!1}}},[n,a.refreshing,e]),m=t.useCallback(async(t,r)=>{const a=await n.createWorkspace({name:t,image:r});e.workspaces(ft(a)),Pt.emitWorkspaceCreated(a).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:a._id}})})},[n,e]),h=t.useCallback(async(t,r)=>{const a=await n.updateWorkspace(t._id,r);e.workspaces(pt(a)),Pt.emitWorkspaceUpdated(a).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:a._id}})})},[n,e]),g=t.useCallback(async()=>{if(d.current)return a.allFeatures.length>0?a.allFeatures:null;if(a.allFeatures.length>0)return a.allFeatures;d.current=!0;try{const t=await n.getFeatures();return e.workspaces(ht(t)),t}catch(e){return De(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{d.current=!1}},[n,e,a.allFeatures]),b=t.useCallback(async(e,t,r)=>await n.updateFeature(e,t,r),[n]);t.useEffect(()=>{if(!a.currentWorkspace?._id||0===a.workspaces.length)return;const t=a.currentWorkspace._id,r=a.workspaces.find(e=>e._id===t);if(r)r!==a.currentWorkspace&&(Qt(r),e.workspaces(gt(r)));else if(a.workspaces.length>0){const e=a.workspaces[0];e._id!==t&&i(e).catch(()=>{})}},[a.workspaces,a.currentWorkspace,e,i]);const x=t.useCallback(async e=>await n.getWorkspaceUsers(e),[n]),y=t.useCallback(async(e,t,r)=>{const s=await n.addUser(e,{email:t,role:r}),o=a.workspaces.find(t=>t._id===e);return o&&Pt.emitWorkspaceUserAdded(s.userId,o,r).catch(t=>{De(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:s.userId,role:r}})}),p().catch(()=>{}),Rt(),s},[n,a.workspaces,p]),v=t.useCallback(async(e,t)=>{const r=a.workspaces.find(t=>t._id===e);if(r&&nr(r,t))throw new Error("Cannot remove the workspace owner");const s=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),o=await n.removeUser(e,t);if(r&&s){const t=s.role;Pt.emitWorkspaceUserRemoved(o.userId,r,t).catch(r=>{De(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:o.userId,role:t}})})}return p().catch(()=>{}),Rt(),o},[n,a.workspaces,p]),w=t.useCallback(async(e,t,r)=>{if(r.role){const r=a.workspaces.find(t=>t._id===e);if(r&&nr(r,t))throw new Error("Cannot change the role of the workspace owner")}let s;if(r.role){const r=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);s=r?.role}const o=await n.updateUser(e,t,r);return r.role&&s&&s!==r.role&&Pt.emitWorkspaceUserRoleChanged(o.userId,o.workspace,s,r.role).catch(n=>{De(n,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:s,newRole:r.role}})}),o},[n,a.workspaces]),S=t.useCallback(async e=>{const t=await n.getProfile().catch(()=>null),r=await n.updateUserProfile(e);return Pt.emitUserUpdated(r,t||void 0).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:r._id}})}),r},[n]),j=t.useCallback(async()=>await n.getProfile(),[n]),k=t.useCallback(async e=>await n.getWorkspace(e),[n]),N=t.useCallback(async t=>{if(!s)throw new Error("User must be authenticated to delete a workspace");const r=a.workspaces.find(e=>e._id===t);if(!r)throw new Error("Workspace not found");if(!nr(r,s.id))throw new Error("Only the workspace creator can delete the workspace");const o=await n.deleteWorkspace(t);return e.workspaces(mt(t)),a.currentWorkspace?._id===t&&(tr(),e.workspaces(bt())),r&&Pt.emitWorkspaceDeleted(r).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),o},[n,a.workspaces,a.currentWorkspace,e,s]);return{workspaces:a.workspaces,loading:a.loading,error:a.error,fetchWorkspaces:f,refreshWorkspaces:p,refreshing:a.refreshing,currentWorkspace:a.currentWorkspace,setCurrentWorkspace:o,switchToWorkspace:i,resetCurrentWorkspace:l,createWorkspace:m,allFeatures:a.allFeatures,getFeatures:g,updateFeature:b,getWorkspace:k,updateWorkspace:h,getUsers:x,addUser:y,removeUser:v,updateUser:w,getProfile:j,updateUserProfile:S,deleteWorkspace:N,switching:null!==a.switchingToId,switchingToId:a.switchingToId}},ir=new Set;function lr(){ir.forEach(e=>e())}const cr=e=>{const{os:r,api:n}=sr(),a=o(r),[s,i]=t.useState(null),[l,c]=t.useState(!1),[d,u]=t.useState(null),f=t.useCallback(async()=>{if(e&&a){c(!0),u(null);try{const t=await n.getPublicPlans(e);i(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plans";u(r),De(t,{component:"usePublicPlans",action:"fetchPlans",metadata:{slug:e}})}finally{c(!1)}}else i(null)},[n,e,a]);t.useEffect(()=>{f()},[f]);const p=e&&!a||l;return{items:s?.items??[],plans:s?.plans??[],notes:s?.notes,loading:p,error:d,refetch:f}},dr=e=>{const{api:r}=sr(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,l]=t.useState(null),c=t.useCallback(async()=>{if(e){o(!0),l(null);try{const t=await r.getCurrentSubscription(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch subscription";l(r),De(t,{component:"useSubscription",action:"fetchSubscription",metadata:{workspaceId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{c()},[c]),{subscription:n,loading:s,error:i,refetch:c}},ur=(e,r)=>{const{api:n}=sr(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[l,c]=t.useState(null),d=t.useCallback(async()=>{if(e){i(!0),c(null);try{const t=r?await n.getPlanGroupByVersion(e,r):await n.getPlanGroup(e);s(t)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch plan group";c(n),De(t,{component:"usePlanGroup",action:"fetchPlanGroup",metadata:{workspaceId:e,groupVersionId:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{planGroup:a,loading:o,error:l,refetch:d}},fr=e=>{const{api:r}=sr(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,l]=t.useState(null),c=t.useCallback(async()=>{if(e){o(!0),l(null);try{const t=await r.getPlanGroupVersions(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group versions";l(r),De(t,{component:"usePlanGroupVersions",action:"fetchVersions",metadata:{workspaceId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{c()},[c]),{versions:n,loading:s,error:i,refetch:c}},pr=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{createCheckoutSession:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const n=await r.createCheckoutSession(e,t);return"trial_started"===n.type&&(Rt(),lr()),n}catch(r){const n=r instanceof Error?r.message:"Failed to create checkout session";throw o(n),De(r,{component:"useCreateCheckoutSession",action:"createCheckoutSession",metadata:{workspaceId:e,request:t}}),r}finally{a(!1)}},[r,e]),loading:n,error:s}},mr=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null),i=t.useCallback(async(t,n)=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const a={planVersionId:t,...n?.billingInterval&&{billingInterval:n.billingInterval},...n?.successUrl&&{successUrl:n.successUrl},...n?.cancelUrl&&{cancelUrl:n.cancelUrl}},s=await r.updateSubscription(e,a);return Rt(),s}catch(r){const a=r instanceof Error?r.message:"Failed to update subscription";throw o(a),De(r,{component:"useUpdateSubscription",action:"updateSubscription",metadata:{workspaceId:e,planVersionId:t,options:n}}),r}finally{a(!1)}},[r,e]);return{updateSubscription:i,loading:n,error:s}},hr=(e,r)=>{const n=dr(e),a=ur(e,r),s=mr(e),o=t.useCallback(async()=>{await Promise.all([n.refetch(),a.refetch()])},[n.refetch,a.refetch]);return{subscription:n.subscription,planGroup:a.planGroup,loading:n.loading||a.loading||s.loading,error:n.error||a.error||s.error,updateSubscription:s.updateSubscription,refetch:o}},gr=(e,r=10,n)=>{const{api:a}=sr(),[s,o]=t.useState([]),[i,l]=t.useState(!1),[c,d]=t.useState(!1),[u,f]=t.useState(null),p=t.useCallback(async()=>{if(!e)return o([]),void l(!1);d(!0),f(null);try{const t=await a.listInvoices(e,r,n);o(t.invoices||[]),l(t.has_more||!1)}catch(t){const a=t instanceof Error?t.message:"Failed to fetch invoices";f(a),De(t,{component:"useInvoices",action:"fetchInvoices",metadata:{workspaceId:e,limit:r,startingAfter:n}})}finally{d(!1)}},[a,e,r,n]);return t.useEffect(()=>{p()},[p]),{invoices:s,hasMore:i,loading:c,error:u,refetch:p}},br=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{openBillingPortal:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const n=t||window.location.href,a=await r.createBillingPortalSession(e,n);return a.url&&window.open(a.url,"_blank","noopener,noreferrer"),a}catch(t){const r=t instanceof Error?t.message:"Failed to open billing portal";throw o(r),De(t,{component:"useBillingPortal",action:"openBillingPortal",metadata:{workspaceId:e}}),t}finally{a(!1)}},[e,r]),loading:n,error:s}},xr=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{cancelSubscription:t.useCallback(async()=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const t=await r.cancelSubscriptionAtPeriodEnd(e);return Rt(),t}catch(t){const r=t instanceof Error?t.message:"Failed to cancel subscription";throw o(r),De(t,{component:"useCancelSubscription",action:"cancelSubscription",metadata:{workspaceId:e}}),t}finally{a(!1)}},[r,e]),loading:n,error:s}},yr=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{resumeSubscription:t.useCallback(async()=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const t=await r.resumeSubscription(e);return Rt(),t}catch(t){const r=t instanceof Error?t.message:"Failed to resume subscription";throw o(r),De(t,{component:"useResumeSubscription",action:"resumeSubscription",metadata:{workspaceId:e}}),t}finally{a(!1)}},[r,e]),loading:n,error:s}},vr=e=>{const{api:r}=sr(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,l]=t.useState(null),c=t.useCallback(async()=>{if(e){o(!0),l(null);try{const t=await r.getAllQuotaUsage(e);a(t.quotas)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch all quota usage";l(r),De(t,{component:"useAllQuotaUsage",action:"fetchAllUsage",metadata:{workspaceId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{c()},[c]),{quotas:n,loading:s,error:i,refetch:c}},wr=t.createContext(null);wr.displayName="SubscriptionContext";const Sr=t.memo(function({children:r}){const{currentWorkspace:n}=or(),{subscription:a,loading:s,error:o,refetch:i}=dr(n?._id);t.useEffect(()=>{return e=i,Tt.add(e),()=>{Tt.delete(e)};var e},[i]);const l=t.useMemo(()=>({response:a,loading:s,error:o,refetch:i}),[a,s,o,i]);return e.jsx(wr.Provider,{value:l,children:r})});function jr(){const e=t.useContext(wr);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 kr(e,r){const n=ct(),a=et(),s=Ct(),o=e||(e=>e);return Ve(t.useMemo(()=>({os:n,auth:a,workspaces:s}),[n,a,s]),o,r)}function Nr(){const e=tt(),r=dt(),n=At();return t.useMemo(()=>({auth:e,os:r,workspaces:n}),[e,r,n])}Sr.displayName="SubscriptionContextProvider";const Er=t.createContext(null);Er.displayName="QuotaUsageContext";const Cr=t.memo(function({children:r}){const{currentWorkspace:n}=or(),{quotas:a,loading:s,error:o,refetch:i}=vr(n?._id);t.useEffect(()=>{return e=i,ir.add(e),()=>{ir.delete(e)};var e},[i]);const l=t.useMemo(()=>({quotas:a,loading:s,error:o,refetch:i}),[a,s,o,i]);return e.jsx(Er.Provider,{value:l,children:r})});function Ar(){const e=t.useContext(Er);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}Cr.displayName="QuotaUsageContextProvider";class _r extends Zt{constructor(e){super(e)}async getProfile(e,t){return this.fetchJson("profile",{headers:{"x-session-id":e},signal:t},"Failed to fetch user profile")}}function Tr(e,t){return function(){return e.apply(t,arguments)}}const{toString:Rr}=Object.prototype,{getPrototypeOf:Pr}=Object,{iterator:Or,toStringTag:Ir}=Symbol,Dr=(Ur=Object.create(null),e=>{const t=Rr.call(e);return Ur[t]||(Ur[t]=t.slice(8,-1).toLowerCase())});var Ur;const Fr=e=>(e=e.toLowerCase(),t=>Dr(t)===e),Mr=e=>t=>typeof t===e,{isArray:zr}=Array,Lr=Mr("undefined");function $r(e){return null!==e&&!Lr(e)&&null!==e.constructor&&!Lr(e.constructor)&&Br(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Wr=Fr("ArrayBuffer");const Vr=Mr("string"),Br=Mr("function"),Gr=Mr("number"),Kr=e=>null!==e&&"object"==typeof e,Hr=e=>{if("object"!==Dr(e))return!1;const t=Pr(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Ir in e||Or in e)},Zr=Fr("Date"),qr=Fr("File"),Jr=Fr("Blob"),Yr=Fr("FileList"),Xr=Fr("URLSearchParams"),[Qr,en,tn,rn]=["ReadableStream","Request","Response","Headers"].map(Fr);function nn(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),zr(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if($r(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),s=a.length;let o;for(n=0;n<s;n++)o=a[n],t.call(null,e[o],o,e)}}function an(e,t){if($r(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,on=e=>!Lr(e)&&e!==sn;const ln=(cn="undefined"!=typeof Uint8Array&&Pr(Uint8Array),e=>cn&&e instanceof cn);var cn;const dn=Fr("HTMLFormElement"),un=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),fn=Fr("RegExp"),pn=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};nn(r,(r,a)=>{let s;!1!==(s=t(r,a,e))&&(n[a]=s||r)}),Object.defineProperties(e,n)};const mn=Fr("AsyncFunction"),hn=(gn="function"==typeof setImmediate,bn=Br(sn.postMessage),gn?setImmediate:bn?(xn=`axios@${Math.random()}`,yn=[],sn.addEventListener("message",({source:e,data:t})=>{e===sn&&t===xn&&yn.length&&yn.shift()()},!1),e=>{yn.push(e),sn.postMessage(xn,"*")}):e=>setTimeout(e));var gn,bn,xn,yn;const vn="undefined"!=typeof queueMicrotask?queueMicrotask.bind(sn):"undefined"!=typeof process&&process.nextTick||hn;var wn={isArray:zr,isArrayBuffer:Wr,isBuffer:$r,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Br(e.append)&&("formdata"===(t=Dr(e))||"object"===t&&Br(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Wr(e.buffer),t},isString:Vr,isNumber:Gr,isBoolean:e=>!0===e||!1===e,isObject:Kr,isPlainObject:Hr,isEmptyObject:e=>{if(!Kr(e)||$r(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Qr,isRequest:en,isResponse:tn,isHeaders:rn,isUndefined:Lr,isDate:Zr,isFile:qr,isBlob:Jr,isRegExp:fn,isFunction:Br,isStream:e=>Kr(e)&&Br(e.pipe),isURLSearchParams:Xr,isTypedArray:ln,isFileList:Yr,forEach:nn,merge:function e(){const{caseless:t,skipUndefined:r}=on(this)&&this||{},n={},a=(a,s)=>{const o=t&&an(n,s)||s;Hr(n[o])&&Hr(a)?n[o]=e(n[o],a):Hr(a)?n[o]=e({},a):zr(a)?n[o]=a.slice():r&&Lr(a)||(n[o]=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&&Br(t)?Object.defineProperty(e,n,{value:Tr(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,s,o;const i={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),s=a.length;s-- >0;)o=a[s],n&&!n(o,e,t)||i[o]||(t[o]=e[o],i[o]=!0);e=!1!==r&&Pr(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Dr,kindOfTest:Fr,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(zr(e))return e;let t=e.length;if(!Gr(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Or]).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:dn,hasOwnProperty:un,hasOwnProp:un,reduceDescriptors:pn,freezeMethods:e=>{pn(e,(t,r)=>{if(Br(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Br(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 zr(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:an,global:sn,isContextDefined:on,isSpecCompliantForm:function(e){return!!(e&&Br(e.append)&&"FormData"===e[Ir]&&e[Or])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Kr(e)){if(t.indexOf(e)>=0)return;if($r(e))return e;if(!("toJSON"in e)){t[n]=e;const a=zr(e)?[]:{};return nn(e,(e,t)=>{const s=r(e,n+1);!Lr(s)&&(a[t]=s)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:mn,isThenable:e=>e&&(Kr(e)||Br(e))&&Br(e.then)&&Br(e.catch),setImmediate:hn,asap:vn,isIterable:e=>null!=e&&Br(e[Or])};let Sn=class e extends Error{static from(t,r,n,a,s,o){const i=new e(t.message,r||t.code,n,a,s);return i.cause=t,i.name=t.name,o&&Object.assign(i,o),i}constructor(e,t,r,n,a){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:wn.toJSONObject(this.config),code:this.code,status:this.status}}};Sn.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Sn.ERR_BAD_OPTION="ERR_BAD_OPTION",Sn.ECONNABORTED="ECONNABORTED",Sn.ETIMEDOUT="ETIMEDOUT",Sn.ERR_NETWORK="ERR_NETWORK",Sn.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Sn.ERR_DEPRECATED="ERR_DEPRECATED",Sn.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Sn.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Sn.ERR_CANCELED="ERR_CANCELED",Sn.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Sn.ERR_INVALID_URL="ERR_INVALID_URL";function jn(e){return wn.isPlainObject(e)||wn.isArray(e)}function kn(e){return wn.endsWith(e,"[]")?e.slice(0,-2):e}function Nn(e,t,r){return e?e.concat(t).map(function(e,t){return e=kn(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const En=wn.toFlatObject(wn,{},null,function(e){return/^is[A-Z]/.test(e)});function Cn(e,t,r){if(!wn.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=wn.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!wn.isUndefined(t[e])})).metaTokens,a=r.visitor||c,s=r.dots,o=r.indexes,i=(r.Blob||"undefined"!=typeof Blob&&Blob)&&wn.isSpecCompliantForm(t);if(!wn.isFunction(a))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(wn.isDate(e))return e.toISOString();if(wn.isBoolean(e))return e.toString();if(!i&&wn.isBlob(e))throw new Sn("Blob is not supported. Use a Buffer instead.");return wn.isArrayBuffer(e)||wn.isTypedArray(e)?i&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,a){let i=e;if(e&&!a&&"object"==typeof e)if(wn.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(wn.isArray(e)&&function(e){return wn.isArray(e)&&!e.some(jn)}(e)||(wn.isFileList(e)||wn.endsWith(r,"[]"))&&(i=wn.toArray(e)))return r=kn(r),i.forEach(function(e,n){!wn.isUndefined(e)&&null!==e&&t.append(!0===o?Nn([r],n,s):null===o?r:r+"[]",l(e))}),!1;return!!jn(e)||(t.append(Nn(a,r,s),l(e)),!1)}const d=[],u=Object.assign(En,{defaultVisitor:c,convertValue:l,isVisitable:jn});if(!wn.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!wn.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),wn.forEach(r,function(r,s){!0===(!(wn.isUndefined(r)||null===r)&&a.call(t,r,wn.isString(s)?s.trim():s,n,u))&&e(r,n?n.concat(s):[s])}),d.pop()}}(e),t}function An(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function _n(e,t){this._pairs=[],e&&Cn(e,this,t)}const Tn=_n.prototype;function Rn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Pn(e,t,r){if(!t)return e;const n=r&&r.encode||Rn,a=wn.isFunction(r)?{serialize:r}:r,s=a&&a.serialize;let o;if(o=s?s(t,a):wn.isURLSearchParams(t)?t.toString():new _n(t,a).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Tn.append=function(e,t){this._pairs.push([e,t])},Tn.toString=function(e){const t=e?function(t){return e.call(this,t,An)}:An;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class On{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){wn.forEach(this.handlers,function(t){null!==t&&e(t)})}}var In={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Dn={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:_n,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Un="undefined"!=typeof window&&"undefined"!=typeof document,Fn="object"==typeof navigator&&navigator||void 0,Mn=Un&&(!Fn||["ReactNative","NativeScript","NS"].indexOf(Fn.product)<0),zn="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ln=Un&&window.location.href||"http://localhost";var $n={...Object.freeze({__proto__:null,hasBrowserEnv:Un,hasStandardBrowserEnv:Mn,hasStandardBrowserWebWorkerEnv:zn,navigator:Fn,origin:Ln}),...Dn};function Wn(e){function t(e,r,n,a){let s=e[a++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),i=a>=e.length;if(s=!s&&wn.isArray(n)?n.length:s,i)return wn.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&wn.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],a)&&wn.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let s;for(n=0;n<a;n++)s=r[n],t[s]=e[s];return t}(n[s])),!o}if(wn.isFormData(e)&&wn.isFunction(e.entries)){const r={};return wn.forEachEntry(e,(e,n)=>{t(function(e){return wn.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const Vn={transitional:In,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=wn.isObject(e);a&&wn.isHTMLForm(e)&&(e=new FormData(e));if(wn.isFormData(e))return n?JSON.stringify(Wn(e)):e;if(wn.isArrayBuffer(e)||wn.isBuffer(e)||wn.isStream(e)||wn.isFile(e)||wn.isBlob(e)||wn.isReadableStream(e))return e;if(wn.isArrayBufferView(e))return e.buffer;if(wn.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Cn(e,new $n.classes.URLSearchParams,{visitor:function(e,t,r,n){return $n.isNode&&wn.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=wn.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Cn(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(wn.isString(e))try{return(t||JSON.parse)(e),wn.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Vn.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(wn.isResponse(e)||wn.isReadableStream(e))return e;if(e&&wn.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 Sn.from(e,Sn.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:$n.classes.FormData,Blob:$n.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};wn.forEach(["delete","get","head","post","put","patch"],e=>{Vn.headers[e]={}});const Bn=wn.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 Gn=Symbol("internals");function Kn(e){return e&&String(e).trim().toLowerCase()}function Hn(e){return!1===e||null==e?e:wn.isArray(e)?e.map(Hn):String(e)}function Zn(e,t,r,n,a){return wn.isFunction(n)?n.call(this,t,r):(a&&(t=r),wn.isString(t)?wn.isString(n)?-1!==t.indexOf(n):wn.isRegExp(n)?n.test(t):void 0:void 0)}let qn=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=Kn(t);if(!a)throw new Error("header name must be a non-empty string");const s=wn.findKey(n,a);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=Hn(e))}const s=(e,t)=>wn.forEach(e,(e,r)=>a(e,r,t));if(wn.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(wn.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let r,n,a;return e&&e.split("\n").forEach(function(e){a=e.indexOf(":"),r=e.substring(0,a).trim().toLowerCase(),n=e.substring(a+1).trim(),!r||t[r]&&Bn[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(wn.isObject(e)&&wn.isIterable(e)){let r,n,a={};for(const t of e){if(!wn.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?wn.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}s(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=Kn(e)){const r=wn.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(wn.isFunction(t))return t.call(this,e,r);if(wn.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Kn(e)){const r=wn.findKey(this,e);return!(!r||void 0===this[r]||t&&!Zn(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=Kn(e)){const a=wn.findKey(r,e);!a||t&&!Zn(0,r[a],a,t)||(delete r[a],n=!0)}}return wn.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&&!Zn(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return wn.forEach(this,(n,a)=>{const s=wn.findKey(r,a);if(s)return t[s]=Hn(n),void delete t[a];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();o!==a&&delete t[a],t[o]=Hn(n),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return wn.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&wn.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[Gn]=this[Gn]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Kn(e);t[n]||(!function(e,t){const r=wn.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 wn.isArray(e)?e.forEach(n):n(e),this}};function Jn(e,t){const r=this||Vn,n=t||r,a=qn.from(n.headers);let s=n.data;return wn.forEach(e,function(e){s=e.call(r,s,a.normalize(),t?t.status:void 0)}),a.normalize(),s}function Yn(e){return!(!e||!e.__CANCEL__)}qn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),wn.reduceDescriptors(qn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),wn.freezeMethods(qn);let Xn=class extends Sn{constructor(e,t,r){super(null==e?"canceled":e,Sn.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Qn(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Sn("Request failed with status code "+r.status,[Sn.ERR_BAD_REQUEST,Sn.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const ea=(e,t,r=3)=>{let n=0;const a=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a,s=0,o=0;return t=void 0!==t?t:1e3,function(i){const l=Date.now(),c=n[o];a||(a=l),r[s]=i,n[s]=l;let d=o,u=0;for(;d!==s;)u+=r[d++],d%=e;if(s=(s+1)%e,s===o&&(o=(o+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,s=1e3/t;const o=(t,s=Date.now())=>{a=s,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),i=t-a;i>=s?o(e,t):(r=e,n||(n=setTimeout(()=>{n=null,o(r)},s-i)))},()=>r&&o(r)]}(r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,i=s-n,l=a(i);n=s;e({loaded:s,total:o,progress:o?s/o:void 0,bytes:i,rate:l||void 0,estimated:l&&o&&s<=o?(o-s)/l:void 0,event:r,lengthComputable:null!=o,[t?"download":"upload"]:!0})},r)},ta=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},ra=e=>(...t)=>wn.asap(()=>e(...t));var na=$n.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,$n.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL($n.origin),$n.navigator&&/(msie|trident)/i.test($n.navigator.userAgent)):()=>!0,aa=$n.hasStandardBrowserEnv?{write(e,t,r,n,a,s,o){if("undefined"==typeof document)return;const i=[`${e}=${encodeURIComponent(t)}`];wn.isNumber(r)&&i.push(`expires=${new Date(r).toUTCString()}`),wn.isString(n)&&i.push(`path=${n}`),wn.isString(a)&&i.push(`domain=${a}`),!0===s&&i.push("secure"),wn.isString(o)&&i.push(`SameSite=${o}`),document.cookie=i.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function sa(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 oa=e=>e instanceof qn?{...e}:e;function ia(e,t){t=t||{};const r={};function n(e,t,r,n){return wn.isPlainObject(e)&&wn.isPlainObject(t)?wn.merge.call({caseless:n},e,t):wn.isPlainObject(t)?wn.merge({},t):wn.isArray(t)?t.slice():t}function a(e,t,r,a){return wn.isUndefined(t)?wn.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function s(e,t){if(!wn.isUndefined(t))return n(void 0,t)}function o(e,t){return wn.isUndefined(t)?wn.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function i(r,a,s){return s in t?n(r,a):s in e?n(void 0,r):void 0}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:i,headers:(e,t,r)=>a(oa(e),oa(t),0,!0)};return wn.forEach(Object.keys({...e,...t}),function(n){const s=l[n]||a,o=s(e[n],t[n],n);wn.isUndefined(o)&&s!==i||(r[n]=o)}),r}var la=e=>{const t=ia({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:i}=t;if(t.headers=o=qn.from(o),t.url=Pn(sa(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),i&&o.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):""))),wn.isFormData(r))if($n.hasStandardBrowserEnv||$n.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(wn.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&o.set(e,r)})}if($n.hasStandardBrowserEnv&&(n&&wn.isFunction(n)&&(n=n(t)),n||!1!==n&&na(t.url))){const e=a&&s&&aa.read(s);e&&o.set(a,e)}return t};var ca="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=la(e);let a=n.data;const s=qn.from(n.headers).normalize();let o,i,l,c,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){c&&c(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=qn.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());Qn(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 Sn("Request aborted",Sn.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new Sn(n,Sn.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||In;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Sn(t,a.clarifyTimeoutError?Sn.ETIMEDOUT:Sn.ECONNABORTED,e,h)),h=null},void 0===a&&s.setContentType(null),"setRequestHeader"in h&&wn.forEach(s.toJSON(),function(e,t){h.setRequestHeader(t,e)}),wn.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([l,d]=ea(p,!0),h.addEventListener("progress",l)),f&&h.upload&&([i,c]=ea(f),h.upload.addEventListener("progress",i),h.upload.addEventListener("loadend",c)),(n.cancelToken||n.signal)&&(o=t=>{h&&(r(!t||t.type?new Xn(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===$n.protocols.indexOf(b)?r(new Sn("Unsupported protocol "+b+":",Sn.ERR_BAD_REQUEST,e)):h.send(a||null)})};const da=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const a=function(e){if(!r){r=!0,o();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Sn?t:new Xn(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,a(new Sn(`timeout of ${t}ms exceeded`,Sn.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:i}=n;return i.unsubscribe=()=>wn.asap(o),i}},ua=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},fa=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()}},pa=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of fa(e))yield*ua(r,t)}(e,t);let s,o=0,i=e=>{s||(s=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return i(),void e.close();let s=n.byteLength;if(r){let e=o+=s;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw i(e),e}},cancel:e=>(i(e),a.return())},{highWaterMark:2})},{isFunction:ma}=wn,ha=(({Request:e,Response:t})=>({Request:e,Response:t}))(wn.global),{ReadableStream:ga,TextEncoder:ba}=wn.global,xa=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},ya=e=>{e=wn.merge.call({skipUndefined:!0},ha,e);const{fetch:t,Request:r,Response:n}=e,a=t?ma(t):"function"==typeof fetch,s=ma(r),o=ma(n);if(!a)return!1;const i=a&&ma(ga),l=a&&("function"==typeof ba?(c=new ba,e=>c.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var c;const d=s&&i&&xa(()=>{let e=!1;const t=new r($n.origin,{body:new ga,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=o&&i&&xa(()=>wn.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 Sn(`Response type '${e}' is not supported`,Sn.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=wn.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(wn.isBlob(e))return e.size;if(wn.isSpecCompliantForm(e)){const t=new r($n.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return wn.isArrayBufferView(e)||wn.isArrayBuffer(e)?e.byteLength:(wn.isURLSearchParams(e)&&(e+=""),wn.isString(e)?(await l(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:o,data:i,signal:l,cancelToken:c,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:b,headers:x,withCredentials:y="same-origin",fetchOptions:v}=la(e),w=t||fetch;b=b?(b+"").toLowerCase():"text";let S=da([l,c&&c.toAbortSignal()],m),j=null;const k=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let N;try{if(g&&d&&"get"!==o&&"head"!==o&&0!==(N=await p(x,i))){let e,t=new r(a,{method:"POST",body:i,duplex:"half"});if(wn.isFormData(i)&&(e=t.headers.get("content-type"))&&x.setContentType(e),t.body){const[e,r]=ta(N,ea(ra(g)));i=pa(t.body,65536,e,r)}}wn.isString(y)||(y=y?"include":"omit");const t=s&&"credentials"in r.prototype,l={...v,signal:S,method:o.toUpperCase(),headers:x.normalize().toJSON(),body:i,duplex:"half",credentials:t?y:void 0};j=s&&new r(a,l);let c=await(s?w(j,v):w(a,l));const m=u&&("stream"===b||"response"===b);if(u&&(h||m&&k)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=c[t]});const t=wn.toFiniteNumber(c.headers.get("content-length")),[r,a]=h&&ta(t,ea(ra(h),!0))||[];c=new n(pa(c.body,65536,r,()=>{a&&a(),k&&k()}),e)}b=b||"text";let E=await f[wn.findKey(f,b)||"text"](c,e);return!m&&k&&k(),await new Promise((t,r)=>{Qn(t,r,{data:E,headers:qn.from(c.headers),status:c.status,statusText:c.statusText,config:e,request:j})})}catch(t){if(k&&k(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Sn("Network Error",Sn.ERR_NETWORK,e,j),{cause:t.cause||t});throw Sn.from(t,t&&t.code,e,j)}}},va=new Map,wa=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,s=[n,a,r];let o,i,l=s.length,c=va;for(;l--;)o=s[l],i=c.get(o),void 0===i&&c.set(o,i=l?new Map:ya(t)),c=i;return i};wa();const Sa={http:null,xhr:ca,fetch:{get:wa}};wn.forEach(Sa,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const ja=e=>`- ${e}`,ka=e=>wn.isFunction(e)||null===e||!1===e;var Na={getAdapter:function(e,t){e=wn.isArray(e)?e:[e];const{length:r}=e;let n,a;const s={};for(let o=0;o<r;o++){let r;if(n=e[o],a=n,!ka(n)&&(a=Sa[(r=String(n)).toLowerCase()],void 0===a))throw new Sn(`Unknown adapter '${r}'`);if(a&&(wn.isFunction(a)||(a=a.get(t))))break;s[r||"#"+o]=a}if(!a){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=r?e.length>1?"since :\n"+e.map(ja).join("\n"):" "+ja(e[0]):"as no adapter specified";throw new Sn("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:Sa};function Ea(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Xn(null,e)}function Ca(e){Ea(e),e.headers=qn.from(e.headers),e.data=Jn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Na.getAdapter(e.adapter||Vn.adapter,e)(e).then(function(t){return Ea(e),t.data=Jn.call(e,e.transformResponse,t),t.headers=qn.from(t.headers),t},function(t){return Yn(t)||(Ea(e),t&&t.response&&(t.response.data=Jn.call(e,e.transformResponse,t.response),t.response.headers=qn.from(t.response.headers))),Promise.reject(t)})}const Aa="1.13.4",_a={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{_a[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ta={};_a.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Aa+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,s)=>{if(!1===e)throw new Sn(n(a," has been removed"+(t?" in "+t:"")),Sn.ERR_DEPRECATED);return t&&!Ta[a]&&(Ta[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,s)}},_a.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Ra={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Sn("options must be an object",Sn.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const s=n[a],o=t[s];if(o){const t=e[s],r=void 0===t||o(t,s,e);if(!0!==r)throw new Sn("option "+s+" must be "+r,Sn.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Sn("Unknown option "+s,Sn.ERR_BAD_OPTION)}},validators:_a};const Pa=Ra.validators;let Oa=class{constructor(e){this.defaults=e||{},this.interceptors={request:new On,response:new On}}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=ia(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&Ra.assertOptions(r,{silentJSONParsing:Pa.transitional(Pa.boolean),forcedJSONParsing:Pa.transitional(Pa.boolean),clarifyTimeoutError:Pa.transitional(Pa.boolean)},!1),null!=n&&(wn.isFunction(n)?t.paramsSerializer={serialize:n}:Ra.assertOptions(n,{encode:Pa.function,serialize:Pa.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ra.assertOptions(t,{baseUrl:Pa.spelling("baseURL"),withXsrfToken:Pa.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=a&&wn.merge(a.common,a[t.method]);a&&wn.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=qn.concat(s,a);const o=[];let i=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const l=[];let c;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let d,u=0;if(!i){const e=[Ca.bind(this),void 0];for(e.unshift(...o),e.push(...l),d=e.length,c=Promise.resolve(t);u<d;)c=c.then(e[u++],e[u++]);return c}d=o.length;let f=t;for(;u<d;){const e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{c=Ca.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 Pn(sa((e=ia(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};wn.forEach(["delete","get","head","options"],function(e){Oa.prototype[e]=function(t,r){return this.request(ia(r||{},{method:e,url:t,data:(r||{}).data}))}}),wn.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(ia(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Oa.prototype[e]=t(),Oa.prototype[e+"Form"]=t(!0)});const Ia={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(Ia).forEach(([e,t])=>{Ia[t]=e});const Da=function e(t){const r=new Oa(t),n=Tr(Oa.prototype.request,r);return wn.extend(n,Oa.prototype,r,{allOwnKeys:!0}),wn.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(ia(t,r))},n}(Vn);Da.Axios=Oa,Da.CanceledError=Xn,Da.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 Xn(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}}},Da.isCancel=Yn,Da.VERSION=Aa,Da.toFormData=Cn,Da.AxiosError=Sn,Da.Cancel=Da.CanceledError,Da.all=function(e){return Promise.all(e)},Da.spread=function(e){return function(t){return e.apply(null,t)}},Da.isAxiosError=function(e){return wn.isObject(e)&&!0===e.isAxiosError},Da.mergeConfig=ia,Da.AxiosHeaders=qn,Da.formToJSON=e=>Wn(wn.isHTMLForm(e)?new FormData(e):e),Da.getAdapter=Na.getAdapter,Da.HttpStatusCode=Ia,Da.default=Da;const{Axios:Ua,AxiosError:Fa,CanceledError:Ma,isCancel:za,CancelToken:La,VERSION:$a,all:Wa,Cancel:Va,isAxiosError:Ba,spread:Ga,toFormData:Ka,AxiosHeaders:Ha,HttpStatusCode:Za,formToJSON:qa,getAdapter:Ja,mergeConfig:Ya}=Da;const Xa=new class{constructor(e={}){if(e.baseURL)try{new URL(e.baseURL)}catch{throw new Error(`[BuildBase SDK] Invalid baseURL: "${e.baseURL}"`)}this.client=Da.create({baseURL:e.baseURL||"",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json",...e.headers}}),this.client.interceptors.request.use(e=>{const t=Vt();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 Qa=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 es(){return kr(e=>e.auth)}function ts(){const e=Nr(),r=es(),n=Jt(),{serverUrl:a,orgId:s,auth:o}=n,{resetCurrentWorkspace:i,currentWorkspace:l}=or(),c=t.useCallback(async()=>{e.auth(Me());try{const t=await Xa.post(`${a}/api/v1/auth/request`,{orgId:s,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(Le()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(Le()),De(t,{component:"useSaaSAuth",action:"signIn"}),t}},[a,s,o,e]),d=t.useCallback(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut()}catch(e){De(e,{component:"useSaaSAuth",action:"signOut"})}finally{Wt(),e.auth(We()),i()}},[e,i,o?.callbacks?.onSignOut]),u=t.useCallback(e=>{l?Qa.openWorkspaceSettings(e):De(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[l]),f=t.useMemo(()=>Ke(r.status),[r.status]);return t.useMemo(()=>({user:r.session?.user,session:r.session,status:r.status,...f,signIn:c,signOut:d,openWorkspaceSettings:u}),[r.session,r.status,f,c,d,u])}const rs=t.memo(({children:r,callbacks:n})=>{const a=Nr(),s=es(),i=Jt(),l=Ke(s.status).isAuthenticated,c=t.useRef(!1),d=t.useRef(null),u=t.useRef(!1),f=t.useMemo(()=>n,[n]),p=t.useCallback(async e=>{try{if(f?.handleAuthentication){const{sessionId:t}=await f.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=i;if(!o(r))throw new Error("OS configuration is not available");const{serverUrl:n,version:s,orgId:l}=r,c=new _r({serverUrl:n,version:s}),d=await c.getProfile(t),u=Kt(Lt(d,l,r.auth?.clientId||""),t);$t(u.sessionId),a.auth($e(u)),function(){if("undefined"!=typeof window)try{const e=new URL(window.location.href);e.searchParams.delete(Ft),window.history.replaceState({},"",e.toString())}catch(e){De(e,{component:"auth/utils",action:"removeTokenFromUrl",metadata:{param:Ft}})}}()}}catch(t){throw De(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),a.auth(Le()),t}},[a,f,i]);return Ot(async e=>{if("undefined"==typeof window)return;if(l)return;if(u.current)return;if(Gt())return;const t=Vt();if(t){u.current=!0;try{if(!o(i))return u.current=!1,void De(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});const{orgId:r}=i;let n;try{const r=new _r({serverUrl:i.serverUrl,version:i.version});n=await r.getProfile(t,e)}catch(e){if(!Ue(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"fetchProfile"}}))return;return u.current=!1,Wt(),void a.auth(Le())}const s=Kt(Lt(n,r,i.auth?.clientId||""),t);$t(s.sessionId),a.auth($e(s))}catch(e){if(!Ue(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:e instanceof Error&&("User data missing required ID field"===e.message||"User data missing required email field"===e.message)?"validateUserData":"pageLoad"}}))return;Wt(),a.auth(Le())}finally{u.current=!1}}else a.auth(Le())},[l,a,i]),t.useEffect(()=>{const e=Gt();if(!e)return;if(c.current||d.current===e)return;if(!o(i))return;c.current=!0,d.current=e;let t=!1;return a.auth(ze()),p(e).then(()=>{t||(d.current=null)}).catch(e=>{t||(De(e,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{hasCode:!0}}),d.current=null)}).finally(()=>{c.current=!1}),()=>{t=!0}},[p,i.serverUrl,i.version,i.orgId]),e.jsx(e.Fragment,{children:r})});rs.displayName="AuthProviderWrapper";const ns=t.memo(({config:r,auth:n,children:a})=>{const s=Nr(),i=Jt(),l=t.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);t.useEffect(()=>{s.os(rt({...r,auth:l}))},[r,l,s]);const c=t.useMemo(()=>o(i)?new qt(i):null,[i.serverUrl,i.version,i.orgId]);return Ot(async e=>{if(!c||i.settings)return;const t=await c.getSettings(e);s.os(nt(t))},[c,i.settings,s],{onError:e=>De(e,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:i.serverUrl,version:i.version,orgId:i.orgId}})}),e.jsx(e.Fragment,{children:a})});ns.displayName="ContextConfigProvider";const as=t.createContext({container:null,setContainer:()=>{}}),ss=t.memo(({children:r})=>{const[n,a]=t.useState(null),s=t.useMemo(()=>({container:n,setContainer:a}),[n]),o=t.useMemo(()=>r,[r]);return e.jsxs(as.Provider,{value:s,children:[o,e.jsx("div",{ref:a,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});ss.displayName="PortalProvider";class os extends Zt{constructor(e){super(e)}async getAttributes(e){const t=await this.fetchResponse("users/attributes",{signal:e});if(!t.ok)throw new Error(await Te(t,"Failed to fetch user attributes"));const r=await t.json();return r&&"object"==typeof r&&!Array.isArray(r)?r:{}}async updateAttributes(e){return this.fetchJson("users/attributes",{method:"PATCH",body:JSON.stringify({attributes:e})},"Failed to update user attributes")}async updateAttribute(e,t){return this.fetchJson(`users/attributes/${e}`,{method:"PATCH",body:JSON.stringify({value:t})},"Failed to update user attribute")}async getFeatures(e){const t=await this.fetchResponse("users/features",{signal:e});if(!t.ok)throw new Error(await Te(t,"Failed to fetch user features"));const r=await t.json();return"object"==typeof r&&null!==r?r:{}}}const is=t.createContext(void 0),ls=t.memo(({children:r})=>{const n=Jt(),a=function(){const e=Jt();return t.useMemo(()=>new os(e),[e.serverUrl,e.version])}(),{isAuthenticated:s}=ts(),{serverUrl:o,version:i}=n,[l,c]=t.useState({}),[d,u]=t.useState({}),[f,p]=t.useState(!1),[m,h]=t.useState(null),g=t.useCallback(async e=>{if(o&&i&&s)try{const t=await a.getAttributes(e);c(t)}catch(e){if(Ae(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user attributes");h(t),De(e,{component:"UserProvider",action:"fetchAttributes"})}else c({})},[a,o,i,s]),b=t.useCallback(async()=>{if(o&&i&&s){p(!0),h(null);try{await g()}finally{p(!1)}}},[o,i,s,g]),x=t.useCallback(async e=>{p(!0),h(null);try{const t=await a.updateAttributes(e);return await g(),t}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw h(r),De(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),t}finally{p(!1)}},[a,g]),y=t.useCallback(async(e,t)=>{p(!0),h(null);try{const r=await a.updateAttribute(e,t);return await g(),r}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw h(n),De(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),r}finally{p(!1)}},[a,g]),v=t.useCallback(async e=>{if(o&&i&&s)try{const t=await a.getFeatures(e);u(t)}catch(e){if(Ae(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user features");h(t),De(e,{component:"UserProvider",action:"fetchFeatures"})}else u({})},[a,o,i,s]),w=t.useCallback(async()=>{if(o&&i&&s){p(!0),h(null);try{await v()}finally{p(!1)}}},[o,i,s,v]);Ot(async e=>{if(!s||!o||!i)return c({}),void u({});p(!0),h(null);try{await Promise.all([g(e),v(e)])}finally{p(!1)}},[s,o,i,g,v],{onError:e=>De(e,{component:"UserProvider",action:"initialFetch",metadata:{step:"fetchAttributesAndFeatures"}})});const S=t.useMemo(()=>({attributes:l,features:d,isLoading:f,error:m,updateAttributes:x,updateAttribute:y,refreshAttributes:b,refreshFeatures:w}),[l,d,f,m,x,y,b,w]);return e.jsx(is.Provider,{value:S,children:r})});ls.displayName="UserProvider";const cs=t.lazy(()=>Promise.resolve().then(function(){return Kk}).then(e=>({default:e.default}))),ds=({children:r})=>{const{currentWorkspace:n}=or(),[a,s]=t.useState(!1),[o,i]=t.useState("profile");return t.useEffect(()=>{const e=Qa.getState();s(e.open),i(e.section);return Qa.subscribe((e,t)=>{s(e),i(t)})},[]),e.jsxs(e.Fragment,{children:[r,n&&a&&e.jsx(t.Suspense,{fallback:null,children:e.jsx(cs,{workspace:n,open:a,onOpenChange:e=>{e||Qa.closeSettings()},section:o,onSectionChange:e=>{Qa.setSection(e)},showTrigger:!1})})]})},us=(e,t,r)=>{if(t!==exports.ApiVersion.V1)throw new Error(`Invalid version: "${t}". Only "${exports.ApiVersion.V1}" is currently supported.`);if(!e||"string"!=typeof e)throw new Error("serverUrl is required and must be a string");if(!(e=>{try{return new URL(e),!0}catch{return!1}})(e))throw new Error(`Invalid serverUrl: "${e}". Must be a valid URL.`);if(!r||"string"!=typeof r)throw new Error("orgId is required and must be a string");if(!/^[0-9a-fA-F]{24}$/.test(r))throw new Error(`Invalid orgId: "${r}". Must be a valid MongoDB ObjectId (24 hexadecimal characters).`)},fs=t.memo(({serverUrl:r,version:n,orgId:a,auth:s,children:o})=>{us(r,n,a);const i=t.useMemo(()=>({serverUrl:r,version:n,orgId:a}),[r,n,a]),l=t.useMemo(()=>s?.callbacks,[s?.callbacks?.handleAuthentication,s?.callbacks?.onSignOut,s?.callbacks?.handleEvent,s?.callbacks?.onWorkspaceChange]),c=s?.callbacks?.handleEvent;return t.useEffect(()=>(Pt.setCallbacks(c?{handleEvent:c}:null),()=>{Pt.setCallbacks(null)}),[c]),e.jsx(_t,{children:e.jsx(rs,{callbacks:l,children:e.jsx(ss,{children:e.jsx(ns,{config:i,auth:s,children:e.jsx(ls,{children:e.jsx(Sr,{children:e.jsx(Cr,{children:e.jsx(ds,{children:o})})})})})})})})});fs.displayName="SaaSOSProviderInner";const ps=({children:t,...r})=>e.jsx(Fe,{children:e.jsx(fs,{...r,children:t})});ps.displayName="SaaSOSProvider";var ms=e=>"checkbox"===e.type,hs=e=>e instanceof Date,gs=e=>null==e;const bs=e=>"object"==typeof e;var xs=e=>!gs(e)&&!Array.isArray(e)&&bs(e)&&!hs(e),ys=e=>xs(e)&&e.target?ms(e.target)?e.target.checked:e.target.value:e,vs=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),ws="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Ss(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(ws&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||xs(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return xs(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]=Ss(e[t]));return n}var js=e=>/^\w*$/.test(e),ks=e=>void 0===e,Ns=e=>Array.isArray(e)?e.filter(Boolean):[],Es=e=>Ns(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Cs=(e,t,r)=>{if(!t||!xs(e))return r;const n=(js(t)?[t]:Es(t)).reduce((e,t)=>gs(e)?e:e[t],e);return ks(n)||n===e?ks(e[t])?r:e[t]:n},As=e=>"boolean"==typeof e,_s=e=>"function"==typeof e,Ts=(e,t,r)=>{let n=-1;const a=js(t)?[t]:Es(t),s=a.length,o=s-1;for(;++n<s;){const t=a[n];let s=r;if(n!==o){const r=e[t];s=xs(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};const Rs="blur",Ps="focusout",Os="change",Is="onBlur",Ds="onChange",Us="onSubmit",Fs="onTouched",Ms="all",zs="max",Ls="min",$s="maxLength",Ws="minLength",Vs="pattern",Bs="required",Gs="validate",Ks=t.createContext(null);Ks.displayName="HookFormControlContext";const Hs=()=>t.useContext(Ks);var Zs=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const a=s;return t._proxyFormState[a]!==Ms&&(t._proxyFormState[a]=!n||Ms),r&&(r[a]=!0),e[a]}});return a};const qs="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;var Js=e=>"string"==typeof e,Ys=(e,t,r,n,a)=>Js(e)?(n&&t.watch.add(e),Cs(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Cs(r,e))):(n&&(t.watchAll=!0),r),Xs=e=>gs(e)||!bs(e);function Qs(e,t,r=new WeakSet){if(Xs(e)||Xs(t))return Object.is(e,t);if(hs(e)&&hs(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const n=e[s];if(!a.includes(s))return!1;if("ref"!==s){const e=t[s];if(hs(n)&&hs(e)||xs(n)&&xs(e)||Array.isArray(n)&&Array.isArray(e)?!Qs(n,e,r):!Object.is(n,e))return!1}}return!0}function eo(e){const r=Hs(),{name:n,disabled:a,control:s=r,shouldUnregister:o,defaultValue:i,exact:l=!0}=e,c=vs(s._names.array,n),d=t.useMemo(()=>Cs(s._formValues,n,Cs(s._defaultValues,n,i)),[s,n,i]),u=function(e){const r=Hs(),{control:n=r,name:a,defaultValue:s,disabled:o,exact:i,compute:l}=e||{},c=t.useRef(s),d=t.useRef(l),u=t.useRef(void 0),f=t.useRef(n),p=t.useRef(a);d.current=l;const[m,h]=t.useState(()=>{const e=n._getWatch(a,c.current);return d.current?d.current(e):e}),g=t.useCallback(e=>{const t=Ys(a,n._names,e||n._formValues,!1,c.current);return d.current?d.current(t):t},[n._formValues,n._names,a]),b=t.useCallback(e=>{if(!o){const t=Ys(a,n._names,e||n._formValues,!1,c.current);if(d.current){const e=d.current(t);Qs(e,u.current)||(h(e),u.current=e)}else h(t)}},[n._formValues,n._names,o,a]);qs(()=>(f.current===n&&Qs(p.current,a)||(f.current=n,p.current=a,b()),n._subscribe({name:a,formState:{values:!0},exact:i,callback:e=>{b(e.values)}})),[n,i,a,b]),t.useEffect(()=>n._removeUnmounted());const x=f.current!==n,y=p.current,v=t.useMemo(()=>{if(o)return null;const e=!x&&!Qs(y,a);return x||e?g():null},[o,x,a,y,g]);return null!==v?v:m}({control:s,name:n,defaultValue:d,exact:l}),f=function(e){const r=Hs(),{control:n=r,disabled:a,name:s,exact:o}=e||{},[i,l]=t.useState(n._formState),c=t.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return qs(()=>n._subscribe({name:s,formState:c.current,exact:o,callback:e=>{!a&&l({...n._formState,...e})}}),[s,a,o]),t.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),t.useMemo(()=>Zs(i,n,c.current,!1),[i,n])}({control:s,name:n,exact:l}),p=t.useRef(e),m=t.useRef(void 0),h=t.useRef(s.register(n,{...e.rules,value:u,...As(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Cs(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!Cs(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Cs(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Cs(f.validatingFields,n)},error:{enumerable:!0,get:()=>Cs(f.errors,n)}}),[f,n]),b=t.useCallback(e=>h.current.onChange({target:{value:ys(e),name:n},type:Os}),[n]),x=t.useCallback(()=>h.current.onBlur({target:{value:Cs(s._formValues,n),name:n},type:Rs}),[n,s._formValues]),y=t.useCallback(e=>{const t=Cs(s._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>_s(e.focus)&&e.focus(),select:()=>_s(e.select)&&e.select(),setCustomValidity:t=>_s(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>_s(e.reportValidity)&&e.reportValidity()})},[s._fields,n]),v=t.useMemo(()=>({name:n,value:u,...As(a)||f.disabled?{disabled:f.disabled||a}:{},onChange:b,onBlur:x,ref:y}),[n,a,f.disabled,b,x,y,u]);return t.useEffect(()=>{const e=s._options.shouldUnregister||o,t=m.current;t&&t!==n&&!c&&s.unregister(t),s.register(n,{...p.current.rules,...As(p.current.disabled)?{disabled:p.current.disabled}:{}});const r=(e,t)=>{const r=Cs(s._fields,e);r&&r._f&&(r._f.mount=t)};if(r(n,!0),e){const e=Ss(Cs(s._options.defaultValues,n,p.current.defaultValue));Ts(s._defaultValues,n,e),ks(Cs(s._formValues,n))&&Ts(s._formValues,n,e)}return!c&&s.register(n),m.current=n,()=>{(c?e&&!s._state.action:e)?s.unregister(n):r(n,!1)}},[n,s,c,o]),t.useEffect(()=>{s._setDisabledField({disabled:a,name:n})},[a,n,s]),t.useMemo(()=>({field:v,formState:f,fieldState:g}),[v,f,g])}const to=e=>e.render(eo(e)),ro=t.createContext(null);ro.displayName="HookFormContext";const no=e=>{const{children:r,watch:n,getValues:a,getFieldState:s,setError:o,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:b,subscribe:x}=e;return t.createElement(ro.Provider,{value:t.useMemo(()=>({watch:n,getValues:a,getFieldState:s,setError:o,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:b,subscribe:x}),[i,h,d,s,a,p,g,f,u,o,b,l,x,c,m,n])},t.createElement(Ks.Provider,{value:h},r))};var ao=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},so=e=>Array.isArray(e)?e:[e],oo=()=>{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 io(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],s=t[n];if(a&&xs(a)&&s){const e=io(a,s);xs(e)&&(r[n]=e)}else e[n]&&(r[n]=s)}return r}var lo=e=>xs(e)&&!Object.keys(e).length,co=e=>"file"===e.type,uo=e=>{if(!ws)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},fo=e=>"select-multiple"===e.type,po=e=>"radio"===e.type,mo=e=>uo(e)&&e.isConnected;function ho(e,t){const r=Array.isArray(t)?t:js(t)?[t]:Es(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=ks(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,s=r[a];return n&&delete n[s],0!==a&&(xs(n)&&lo(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!ks(e[t]))return!1;return!0}(n))&&ho(e,r.slice(0,-1)),e}function go(e){return Array.isArray(e)||xs(e)&&!(e=>{for(const t in e)if(_s(e[t]))return!0;return!1})(e)}function bo(e,t={}){for(const r in e){const n=e[r];go(n)?(t[r]=Array.isArray(n)?[]:{},bo(n,t[r])):ks(n)||(t[r]=!0)}return t}function xo(e,t,r){r||(r=bo(t));for(const n in e){const a=e[n];if(go(a))ks(t)||Xs(r[n])?r[n]=bo(a,Array.isArray(a)?[]:{}):xo(a,gs(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!Qs(a,e)}}return r}const yo={value:!1,isValid:!1},vo={value:!0,isValid:!0};var wo=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&&!ks(e[0].attributes.value)?ks(e[0].value)||""===e[0].value?vo:{value:e[0].value,isValid:!0}:vo:yo}return yo},So=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>ks(e)?e:t?""===e?NaN:e?+e:e:r&&Js(e)?new Date(e):n?n(e):e;const jo={isValid:!1,value:null};var ko=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,jo):jo;function No(e){const t=e.ref;return co(t)?t.files:po(t)?ko(e.refs).value:fo(t)?[...t.selectedOptions].map(({value:e})=>e):ms(t)?wo(e.refs).value:So(ks(t.value)?e.ref.value:t.value,e)}var Eo=e=>e instanceof RegExp,Co=e=>ks(e)?e:Eo(e)?e.source:xs(e)?Eo(e.value)?e.value.source:e.value:e,Ao=e=>({isOnSubmit:!e||e===Us,isOnBlur:e===Is,isOnChange:e===Ds,isOnAll:e===Ms,isOnTouch:e===Fs});const _o="AsyncFunction";var To=e=>!!e&&!!e.validate&&!!(_s(e.validate)&&e.validate.constructor.name===_o||xs(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===_o)),Ro=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const Po=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=Cs(e,a);if(r){const{_f:e,...s}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(Po(s,t))break}else if(xs(s)&&Po(s,t))break}}};function Oo(e,t,r){const n=Cs(e,r);if(n||js(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),s=Cs(t,n),o=Cs(e,n);if(s&&!Array.isArray(s)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};if(o&&o.root&&o.root.type)return{name:`${n}.root`,error:o.root};a.pop()}return{name:r}}var Io=(e,t,r)=>{const n=so(Cs(e,r));return Ts(n,"root",t[r]),Ts(e,r,n),e};function Do(e,t,r="validate"){if(Js(e)||Array.isArray(e)&&e.every(Js)||As(e)&&!e)return{type:r,message:Js(e)?e:"",ref:t}}var Uo=e=>xs(e)&&!Eo(e)?e:{value:e,message:""},Fo=async(e,t,r,n,a,s)=>{const{ref:o,refs:i,required:l,maxLength:c,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:b}=e._f,x=Cs(r,h);if(!b||t.has(h))return{};const y=i?i[0]:o,v=e=>{a&&y.reportValidity&&(y.setCustomValidity(As(e)?"":e||""),y.reportValidity())},w={},S=po(o),j=ms(o),k=S||j,N=(g||co(o))&&ks(o.value)&&ks(x)||uo(o)&&""===o.value||""===x||Array.isArray(x)&&!x.length,E=ao.bind(null,h,n,w),C=(e,t,r,n=$s,a=Ws)=>{const s=e?t:r;w[h]={type:e?n:a,message:s,ref:o,...E(e?n:a,s)}};if(s?!Array.isArray(x)||!x.length:l&&(!k&&(N||gs(x))||As(x)&&!x||j&&!wo(i).isValid||S&&!ko(i).isValid)){const{value:e,message:t}=Js(l)?{value:!!l,message:l}:Uo(l);if(e&&(w[h]={type:Bs,message:t,ref:y,...E(Bs,t)},!n))return v(t),w}if(!(N||gs(u)&&gs(f))){let e,t;const r=Uo(f),a=Uo(u);if(gs(x)||isNaN(x)){const n=o.valueAsDate||new Date(x),s=e=>new Date((new Date).toDateString()+" "+e),i="time"==o.type,l="week"==o.type;Js(r.value)&&x&&(e=i?s(x)>s(r.value):l?x>r.value:n>new Date(r.value)),Js(a.value)&&x&&(t=i?s(x)<s(a.value):l?x<a.value:n<new Date(a.value))}else{const n=o.valueAsNumber||(x?+x:x);gs(r.value)||(e=n>r.value),gs(a.value)||(t=n<a.value)}if((e||t)&&(C(!!e,r.message,a.message,zs,Ls),!n))return v(w[h].message),w}if((c||d)&&!N&&(Js(x)||s&&Array.isArray(x))){const e=Uo(c),t=Uo(d),r=!gs(e.value)&&x.length>+e.value,a=!gs(t.value)&&x.length<+t.value;if((r||a)&&(C(r,e.message,t.message),!n))return v(w[h].message),w}if(p&&!N&&Js(x)){const{value:e,message:t}=Uo(p);if(Eo(e)&&!x.match(e)&&(w[h]={type:Vs,message:t,ref:o,...E(Vs,t)},!n))return v(t),w}if(m)if(_s(m)){const e=Do(await m(x,r),y);if(e&&(w[h]={...e,...E(Gs,e.message)},!n))return v(e.message),w}else if(xs(m)){let e={};for(const t in m){if(!lo(e)&&!n)break;const a=Do(await m[t](x,r),y,t);a&&(e={...a,...E(t,a.message)},v(a.message),n&&(w[h]=e))}if(!lo(e)&&(w[h]={ref:y,...e},!n))return w}return v(!0),w};const Mo={mode:Us,reValidateMode:Ds,shouldFocusError:!0};function zo(e={}){let t,r={...Mo,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:_s(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},s=(xs(r.defaultValues)||xs(r.values))&&Ss(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:Ss(s),i={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:oo(),state:oo()},m=r.criteriaMode===Ms,h=async e=>{if(!i.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=lo((await v()).errors),g()):e=await w(a,!0),e!==n.isValid&&p.state.next({isValid:e})}},g=(e,t)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(l.mount)).forEach(e=>{e&&(t?Ts(n.validatingFields,e,t):ho(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!lo(n.validatingFields)}))},b=(e,t,r,n)=>{const l=Cs(a,e);if(l){const a=Cs(o,e,ks(r)?Cs(s,e):r);ks(a)||n&&n.defaultChecked||t?Ts(o,e,t?a:No(l._f)):k(e,a),i.mount&&!i.action&&h()}},x=(e,t,a,o,i)=>{let l=!1,c=!1;const d={name:e};if(!r.disabled){if(!a||o){(u.isDirty||f.isDirty)&&(c=n.isDirty,n.isDirty=d.isDirty=S(),l=c!==d.isDirty);const r=Qs(Cs(s,e),t);c=!!Cs(n.dirtyFields,e),r?ho(n.dirtyFields,e):Ts(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||f.dirtyFields)&&c!==!r}if(a){const t=Cs(n.touchedFields,e);t||(Ts(n.touchedFields,e,a),d.touchedFields=n.touchedFields,l=l||(u.touchedFields||f.touchedFields)&&t!==a)}l&&i&&p.state.next(d)}return l?d:{}},y=(e,a,s,o)=>{const i=Cs(n.errors,e),l=(u.isValid||f.isValid)&&As(a)&&n.isValid!==a;var d;if(r.delayError&&s?(d=()=>((e,t)=>{Ts(n.errors,e,t),p.state.next({errors:n.errors})})(e,s),t=e=>{clearTimeout(c),c=setTimeout(d,e)},t(r.delayError)):(clearTimeout(c),t=null,s?Ts(n.errors,e,s):ho(n.errors,e)),(s?!Qs(i,s):i)||!lo(o)||l){const t={...o,...l&&As(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},v=async e=>{g(e,!0);const t=await r.resolver(o,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Cs(t,r);e&&Ts(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||l.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},w=async(t,a,s={valid:!0})=>{for(const i in t){const c=t[i];if(c){const{_f:t,...i}=c;if(t){const i=l.array.has(t.name),d=c._f&&To(c._f);d&&u.validatingFields&&g([t.name],!0);const f=await Fo(c,l.disabled,o,m,r.shouldUseNativeValidation&&!a,i);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(s.valid=!1,a||e.shouldUseNativeValidation))break;!a&&(Cs(f,t.name)?i?Io(n.errors,f,t.name):Ts(n.errors,t.name,f[t.name]):ho(n.errors,t.name))}!lo(i)&&await w(i,a,s)}}return s.valid},S=(e,t)=>!r.disabled&&(e&&t&&Ts(o,e,t),!Qs(T(),s)),j=(e,t,r)=>Ys(e,l,{...i.mount?o:ks(t)?s:Js(e)?{[e]:t}:t},r,t),k=(e,t,r={})=>{const n=Cs(a,e);let s=t;if(n){const r=n._f;r&&(!r.disabled&&Ts(o,e,So(t,r)),s=uo(r.ref)&&gs(t)?"":t,fo(r.ref)?[...r.ref.options].forEach(e=>e.selected=s.includes(e.value)):r.refs?ms(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):r.refs.forEach(e=>e.checked=e.value===s):co(r.ref)?r.ref.value="":(r.ref.value=s,r.ref.type||p.state.next({name:e,values:Ss(o)})))}(r.shouldDirty||r.shouldTouch)&&x(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&_(e)},N=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const s=t[n],o=e+"."+n,i=Cs(a,o);(l.array.has(e)||xs(s)||i&&!i._f)&&!hs(s)?N(o,s,r):k(o,s,r)}},E=(e,t,r={})=>{const c=Cs(a,e),d=l.array.has(e),m=Ss(t);Ts(o,e,m),d?(p.array.next({name:e,values:Ss(o)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:xo(s,o),isDirty:S(e,m)})):!c||c._f||gs(m)?k(e,m,r):N(e,m,r),Ro(e,l)?p.state.next({...n,name:e,values:Ss(o)}):p.state.next({name:i.mount?e:void 0,values:Ss(o)})},C=async e=>{i.mount=!0;const s=e.target;let c=s.name,d=!0;const b=Cs(a,c),S=e=>{d=Number.isNaN(e)||hs(e)&&isNaN(e.getTime())||Qs(e,Cs(o,c,e))},j=Ao(r.mode),k=Ao(r.reValidateMode);if(b){let i,N;const E=s.type?No(b._f):ys(e),C=e.type===Rs||e.type===Ps,A=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(b._f)&&!r.resolver&&!Cs(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))(C,Cs(n.touchedFields,c),n.isSubmitted,k,j),T=Ro(c,l,C);Ts(o,c,E),C?s&&s.readOnly||(b._f.onBlur&&b._f.onBlur(e),t&&t(0)):b._f.onChange&&b._f.onChange(e);const R=x(c,E,C),P=!lo(R)||T;if(!C&&p.state.next({name:c,type:e.type,values:Ss(o)}),A)return(u.isValid||f.isValid)&&("onBlur"===r.mode?C&&h():C||h()),P&&p.state.next({name:c,...T?{}:R});if(!C&&T&&p.state.next({...n}),r.resolver){const{errors:e}=await v([c]);if(g([c]),S(E),d){const t=Oo(n.errors,a,c),r=Oo(e,a,t.name||c);i=r.error,c=r.name,N=lo(e)}}else g([c],!0),i=(await Fo(b,l.disabled,o,m,r.shouldUseNativeValidation))[c],g([c]),S(E),d&&(i?N=!1:(u.isValid||f.isValid)&&(N=await w(a,!0)));d&&(b._f.deps&&(!Array.isArray(b._f.deps)||b._f.deps.length>0)&&_(b._f.deps),y(c,N,i,R))}},A=(e,t)=>{if(Cs(n.errors,t)&&e.focus)return e.focus(),1},_=async(e,t={})=>{let s,o;const i=so(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await v(e);if(g(e),e)for(const r of e){const e=Cs(t,r);e?Ts(n.errors,r,e):ho(n.errors,r)}else n.errors=t;return t})(ks(e)?e:i);s=lo(t),o=e?!i.some(e=>Cs(t,e)):s}else e?(o=(await Promise.all(i.map(async e=>{const t=Cs(a,e);return await w(t&&t._f?{[e]:t}:t)}))).every(Boolean),(o||n.isValid)&&h()):o=s=await w(a);return p.state.next({...!Js(e)||(u.isValid||f.isValid)&&s!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:s}:{},errors:n.errors}),t.shouldFocus&&!o&&Po(a,A,e?i:l.mount),o},T=(e,t)=>{let r={...i.mount?o:s};return t&&(r=io(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),ks(e)?r:Js(e)?Cs(r,e):e.map(e=>Cs(r,e))},R=(e,t)=>({invalid:!!Cs((t||n).errors,e),isDirty:!!Cs((t||n).dirtyFields,e),error:Cs((t||n).errors,e),isValidating:!!Cs(n.validatingFields,e),isTouched:!!Cs((t||n).touchedFields,e)}),P=(e,t,r)=>{const s=(Cs(a,e,{_f:{}})._f||{}).ref,o=Cs(n.errors,e)||{},{ref:i,message:l,type:c,...d}=o;Ts(n.errors,e,{...d,...t,ref:s}),p.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},O=e=>p.state.subscribe({next:t=>{var r,a,i;r=e.name,a=t.name,i=e.exact,r&&a&&r!==a&&!so(r).some(e=>e&&(i?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...s}=e;return lo(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!n||Ms))})(t,e.formState||u,$,e.reRenderRoot)||e.callback({values:{...o},...n,...t,defaultValues:s})}}).unsubscribe,I=(e,t={})=>{for(const i of e?so(e):l.mount)l.mount.delete(i),l.array.delete(i),t.keepValue||(ho(a,i),ho(o,i)),!t.keepError&&ho(n.errors,i),!t.keepDirty&&ho(n.dirtyFields,i),!t.keepTouched&&ho(n.touchedFields,i),!t.keepIsValidating&&ho(n.validatingFields,i),!r.shouldUnregister&&!t.keepDefaultValue&&ho(s,i);p.state.next({values:Ss(o)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},D=({disabled:e,name:t})=>{if(As(e)&&i.mount||e||l.disabled.has(t)){const r=l.disabled.has(t)!==!!e;e?l.disabled.add(t):l.disabled.delete(t),r&&i.mount&&!i.action&&h()}},U=(e,t={})=>{let n=Cs(a,e);const o=As(t.disabled)||As(r.disabled);return Ts(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n?D({disabled:As(t.disabled)?t.disabled:r.disabled,name:e}):b(e,!0,t.value),{...o?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:Co(t.min),max:Co(t.max),minLength:Co(t.minLength),maxLength:Co(t.maxLength),pattern:Co(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:o=>{if(o){U(e,t),n=Cs(a,e);const r=ks(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,i=(e=>po(e)||ms(e))(r),l=n._f.refs||[];if(i?l.find(e=>e===r):r===n._f.ref)return;Ts(a,e,{_f:{...n._f,...i?{refs:[...l.filter(mo),r,...Array.isArray(Cs(s,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),b(e,!1,void 0,r)}else n=Cs(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!vs(l.array,e)||!i.action)&&l.unMount.add(e)}}},F=()=>r.shouldFocusError&&Po(a,A,l.mount),M=(e,t)=>async s=>{let i;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let c=Ss(o);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await v();g(),n.errors=e,c=Ss(t)}else await w(a);if(l.disabled.size)for(const e of l.disabled)ho(c,e);if(ho(n.errors,"root"),lo(n.errors)){p.state.next({errors:{}});try{await e(c,s)}catch(e){i=e}}else t&&await t({...n.errors},s),F(),setTimeout(F);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:lo(n.errors)&&!i,submitCount:n.submitCount+1,errors:n.errors}),i)throw i},z=(e,t={})=>{const c=e?Ss(e):s,d=Ss(c),f=lo(e),m=f?s:d;if(t.keepDefaultValues||(s=c),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(xo(s,o))]);for(const t of Array.from(e)){const e=Cs(n.dirtyFields,t),r=Cs(o,t),a=Cs(m,t);e&&!ks(r)?Ts(m,t,r):e||ks(a)||E(t,a)}}else{if(ws&&ks(e))for(const e of l.mount){const t=Cs(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(uo(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of l.mount)E(e,Cs(m,e));else a={}}o=r.shouldUnregister?t.keepDefaultValues?Ss(s):{}:Ss(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:""},i.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!lo(m),i.watch=!!r.shouldUnregister,i.keepIsValid=!!t.keepIsValid,i.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Qs(e,s))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&o?xo(s,o):n.dirtyFields:t.keepDefaultValues&&e?xo(s,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:s})},L=(e,t)=>z(_s(e)?e(o):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},W={control:{register:U,unregister:I,getFieldState:R,handleSubmit:M,setError:P,_subscribe:O,_runSchema:v,_updateIsValidating:g,_focusError:F,_getWatch:j,_getDirty:S,_setValid:h,_setFieldArray:(e,t=[],l,c,d=!0,m=!0)=>{if(c&&l&&!r.disabled){if(i.action=!0,m&&Array.isArray(Cs(a,e))){const t=l(Cs(a,e),c.argA,c.argB);d&&Ts(a,e,t)}if(m&&Array.isArray(Cs(n.errors,e))){const t=l(Cs(n.errors,e),c.argA,c.argB);d&&Ts(n.errors,e,t),((e,t)=>{!Ns(Cs(e,t)).length&&ho(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(Cs(n.touchedFields,e))){const t=l(Cs(n.touchedFields,e),c.argA,c.argB);d&&Ts(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=xo(s,o)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ts(o,e,t)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Ns(Cs(i.mount?o:s,e,r.shouldUnregister?Cs(s,e,[]):[])),_reset:z,_resetDefaultValues:()=>_s(r.defaultValues)&&r.defaultValues().then(e=>{L(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of l.unMount){const t=Cs(a,e);t&&(t._f.refs?t._f.refs.every(e=>!mo(e)):!mo(t._f.ref))&&I(e)}l.unMount=new Set},_disableForm:e=>{As(e)&&(p.state.next({disabled:e}),Po(a,(t,r)=>{const n=Cs(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return a},get _formValues(){return o},get _state(){return i},set _state(e){i=e},get _defaultValues(){return s},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(i.mount=!0,f={...f,...e.formState},O({...e,formState:{...d,...e.formState}})),trigger:_,register:U,handleSubmit:M,watch:(e,t)=>_s(e)?p.state.subscribe({next:r=>"values"in r&&e(j(void 0,t),r)}):j(e,t,!0),setValue:E,getValues:T,reset:L,resetField:(e,t={})=>{Cs(a,e)&&(ks(t.defaultValue)?E(e,Ss(Cs(s,e))):(E(e,t.defaultValue),Ts(s,e,Ss(t.defaultValue))),t.keepTouched||ho(n.touchedFields,e),t.keepDirty||(ho(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,Ss(Cs(s,e))):S()),t.keepError||(ho(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&so(e).forEach(e=>ho(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:I,setError:P,setFocus:(e,t={})=>{const r=Cs(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&_s(e.select)&&e.select()})}},getFieldState:R};return{...W,formControl:W}}function Lo(e={}){const r=t.useRef(void 0),n=t.useRef(void 0),[a,s]=t.useState({isDirty:!1,isValidating:!1,isLoading:_s(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:_s(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:a},e.defaultValues&&!_s(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:t,...n}=zo(e);r.current={...n,formState:a}}const o=r.current.control;return o._options=e,qs(()=>{const e=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),t.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),t.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),t.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),t.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),t.useEffect(()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==a.isDirty&&o._subjects.state.next({isDirty:e})}},[o,a.isDirty]),t.useEffect(()=>{var t;e.values&&!Qs(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),(null===(t=o._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||o._setValid(),n.current=e.values,s(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),t.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),r.current.formState=t.useMemo(()=>Zs(a,o),[o,a]),r.current}const $o=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Cs(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Wo=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?$o(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>$o(t,r,e))}},Vo=(e,t)=>{t.shouldUseNativeValidation&&Wo(e,t);const r={};for(const n in e){const a=Cs(t.fields,n),s=Object.assign(e[n]||{},{ref:a&&a.ref});if(Bo(t.names||Object.keys(e),n)){const e=Object.assign({},Cs(r,n));Ts(e,"root",s),Ts(r,n,e)}else Ts(r,n,s)}return r},Bo=(e,t)=>{const r=Go(t);return e.some(e=>Go(e).match(`^${r}\\.\\d+`))};function Go(e){return e.replace(/\]|\[/g,"")}function Ko(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=o.prototype,s=Object.keys(a);for(let e=0;e<s.length;e++){const t=s[e];t in r||(r[t]=a[t].bind(r))}}const a=r?.Parent??Object;class s extends a{}function o(e){var t;const a=r?.Parent?new s:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class Ho extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Zo extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const qo={};function Jo(e){return qo}function Yo(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 Xo(e,t){return"bigint"==typeof t?t.toString():t}function Qo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ei(e){return null==e}function ti(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const ri=Symbol("evaluating");function ni(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ri)return void 0===n&&(n=ri,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ai(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function si(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function oi(e){return JSON.stringify(e)}const ii="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function li(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const ci=Qo(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function di(e){if(!1===li(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!==li(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function ui(e){return di(e)?{...e}:Array.isArray(e)?[...e]:e}const fi=new Set(["string","number","symbol"]);function pi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mi(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function hi(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 gi(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 bi(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function xi(e){return"string"==typeof e?e:e?.message}function yi(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=xi(e.inst?._zod.def?.error?.(e))??xi(t?.error?.(e))??xi(r.customError?.(e))??xi(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function vi(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function wi(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Si=(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,Xo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ji=Ko("$ZodError",Si),ki=Ko("$ZodError",Si,{Parent:Error});const Ni=e=>(t,r,n,a)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new Ho;if(o.issues.length){const t=new(a?.Err??e)(o.issues.map(e=>yi(e,s,Jo())));throw ii(t,a?.callee),t}return o.value},Ei=Ni(ki),Ci=e=>async(t,r,n,a)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(a?.Err??e)(o.issues.map(e=>yi(e,s,Jo())));throw ii(t,a?.callee),t}return o.value},Ai=Ci(ki),_i=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new Ho;return s.issues.length?{success:!1,error:new(e??ji)(s.issues.map(e=>yi(e,a,Jo())))}:{success:!0,data:s.value}},Ti=_i(ki),Ri=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>yi(e,a,Jo())))}:{success:!0,data:s.value}},Pi=Ri(ki),Oi=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ni(e)(t,r,a)},Ii=e=>(t,r,n)=>Ni(e)(t,r,n),Di=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ci(e)(t,r,a)},Ui=e=>async(t,r,n)=>Ci(e)(t,r,n),Fi=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return _i(e)(t,r,a)},Mi=e=>(t,r,n)=>_i(e)(t,r,n),zi=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ri(e)(t,r,a)},Li=e=>async(t,r,n)=>Ri(e)(t,r,n),$i=/^[cC][^\s-]{8,}$/,Wi=/^[0-9a-z]+$/,Vi=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Bi=/^[0-9a-vA-V]{20}$/,Gi=/^[A-Za-z0-9]{27}$/,Ki=/^[a-zA-Z0-9_-]{21}$/,Hi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zi=/^([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})$/,qi=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)$/,Ji=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Yi=/^(?:(?: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])$/,Xi=/^(([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}|:))$/,Qi=/^((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])$/,el=/^(([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])$/,tl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rl=/^[A-Za-z0-9_-]*$/,nl=/^\+[1-9]\d{6,14}$/,al="(?:(?:\\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])))",sl=new RegExp(`^${al}$`);function ol(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 il=/^[^A-Z]*$/,ll=/^[^a-z]*$/,cl=Ko("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),dl=Ko("$ZodCheckMaxLength",(e,t)=>{var r;cl.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!ei(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=vi(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ul=Ko("$ZodCheckMinLength",(e,t)=>{var r;cl.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!ei(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=vi(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),fl=Ko("$ZodCheckLengthEquals",(e,t)=>{var r;cl.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!ei(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,a=n.length;if(a===t.length)return;const s=vi(n),o=a>t.length;r.issues.push({origin:s,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),pl=Ko("$ZodCheckStringFormat",(e,t)=>{var r,n;cl.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=()=>{})}),ml=Ko("$ZodCheckRegex",(e,t)=>{pl.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})}}),hl=Ko("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=il),pl.init(e,t)}),gl=Ko("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ll),pl.init(e,t)}),bl=Ko("$ZodCheckIncludes",(e,t)=>{cl.init(e,t);const r=pi(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})}}),xl=Ko("$ZodCheckStartsWith",(e,t)=>{cl.init(e,t);const r=new RegExp(`^${pi(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})}}),yl=Ko("$ZodCheckEndsWith",(e,t)=>{cl.init(e,t);const r=new RegExp(`.*${pi(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})}}),vl=Ko("$ZodCheckOverwrite",(e,t)=>{cl.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class wl{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 Sl={major:4,minor:3,patch:6},jl=Ko("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Sl;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=gi(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,o=s._zod.check(e);if(o instanceof Promise&&!1===r?.async)throw new Ho;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(a||(a=gi(e,t)))});else{if(e.issues.length===t)continue;a||(a=gi(e,t))}}return n?n.then(()=>e):e},r=(r,a,s)=>{if(gi(r))return r.aborted=!0,r;const o=t(a,n,s);if(o instanceof Promise){if(!1===s.async)throw new Ho;return o.then(t=>e._zod.parse(t,s))}return e._zod.parse(o,s)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if("backward"===s.direction){const t=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,s)):r(t,a,s)}const o=e._zod.parse(a,s);if(o instanceof Promise){if(!1===s.async)throw new Ho;return o.then(e=>t(e,n,s))}return t(o,n,s)}}ni(e,"~standard",()=>({validate:t=>{try{const r=Ti(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Pi(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),kl=Ko("$ZodString",(e,t)=>{var r;jl.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}}),Nl=Ko("$ZodStringFormat",(e,t)=>{pl.init(e,t),kl.init(e,t)}),El=Ko("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Zi),Nl.init(e,t)}),Cl=Ko("$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=qi(e))}else t.pattern??(t.pattern=qi());Nl.init(e,t)}),Al=Ko("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ji),Nl.init(e,t)}),_l=Ko("$ZodURL",(e,t)=>{Nl.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})}}}),Tl=Ko("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Nl.init(e,t)}),Rl=Ko("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ki),Nl.init(e,t)}),Pl=Ko("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=$i),Nl.init(e,t)}),Ol=Ko("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Wi),Nl.init(e,t)}),Il=Ko("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Vi),Nl.init(e,t)}),Dl=Ko("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Bi),Nl.init(e,t)}),Ul=Ko("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Gi),Nl.init(e,t)}),Fl=Ko("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ol({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(`^${al}T(?:${n})$`)}(t)),Nl.init(e,t)}),Ml=Ko("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=sl),Nl.init(e,t)}),zl=Ko("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ol(t)}$`)),Nl.init(e,t)}),Ll=Ko("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Hi),Nl.init(e,t)}),$l=Ko("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Yi),Nl.init(e,t),e._zod.bag.format="ipv4"}),Wl=Ko("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Xi),Nl.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})}}}),Vl=Ko("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Qi),Nl.init(e,t)}),Bl=Ko("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=el),Nl.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 Gl(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Kl=Ko("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tl),Nl.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Gl(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const Hl=Ko("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=rl),Nl.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!rl.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Gl(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})}}),Zl=Ko("$ZodE164",(e,t)=>{t.pattern??(t.pattern=nl),Nl.init(e,t)});const ql=Ko("$ZodJWT",(e,t)=>{Nl.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})}}),Jl=Ko("$ZodUnknown",(e,t)=>{jl.init(e,t),e._zod.parse=e=>e}),Yl=Ko("$ZodNever",(e,t)=>{jl.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function Xl(e,t,r){e.issues.length&&t.issues.push(...bi(r,e.issues)),t.value[r]=e.value}const Ql=Ko("$ZodArray",(e,t)=>{jl.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const s=[];for(let e=0;e<a.length;e++){const o=a[e],i=t.element._zod.run({value:o,issues:[]},n);i instanceof Promise?s.push(i.then(t=>Xl(t,r,e))):Xl(i,r,e)}return s.length?Promise.all(s).then(()=>r):r}});function ec(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...bi(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function tc(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 rc(e,t,r,n,a,s){const o=[],i=a.keySet,l=a.catchall._zod,c=l.def.type,d="optional"===l.optout;for(const a in t){if(i.has(a))continue;if("never"===c){o.push(a);continue}const s=l.run({value:t[a],issues:[]},n);s instanceof Promise?e.push(s.then(e=>ec(e,r,a,t,d))):ec(s,r,a,t,d)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const nc=Ko("$ZodObject",(e,t)=>{jl.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=Qo(()=>tc(t));ni(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=li,s=t.catchall;let o;e._zod.parse=(t,r)=>{o??(o=n.value);const i=t.value;if(!a(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value={};const l=[],c=o.shape;for(const e of o.keys){const n=c[e],a="optional"===n._zod.optout,s=n._zod.run({value:i[e],issues:[]},r);s instanceof Promise?l.push(s.then(r=>ec(r,t,e,i,a))):ec(s,t,e,i,a)}return s?rc(l,i,t,r,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),ac=Ko("$ZodObjectJIT",(e,t)=>{nc.init(e,t);const r=e._zod.parse,n=Qo(()=>tc(t));let a;const s=li,o=!qo.jitless,i=o&&ci.value,l=t.catchall;let c;e._zod.parse=(d,u)=>{c??(c=n.value);const f=d.value;return s(f)?o&&i&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new wl(["shape","payload","ctx"]),r=n.value,a=e=>{const t=oi(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let o=0;for(const e of r.keys)s[e]="key_"+o++;t.write("const newResult = {};");for(const n of r.keys){const r=s[n],o=oi(n),i=e[n],l="optional"===i?._zod?.optout;t.write(`const ${r} = ${a(n)};`),l?t.write(`\n if (${r}.issues.length) {\n if (${o} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const i=t.compile();return(t,r)=>i(e,t,r)})(t.shape)),d=a(d,u),l?rc([],f,d,u,c,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function sc(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=>!gi(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=>yi(e,n,Jo())))}),t)}const oc=Ko("$ZodUnion",(e,t)=>{jl.init(e,t),ni(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),ni(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ni(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ni(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=>ti(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,s)=>{if(r)return n(a,s);let o=!1;const i=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},s);if(t instanceof Promise)i.push(t),o=!0;else{if(0===t.issues.length)return t;i.push(t)}}return o?Promise.all(i).then(t=>sc(t,a,e,s)):sc(i,a,e,s)}}),ic=Ko("$ZodIntersection",(e,t)=>{jl.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,a=t.left._zod.run({value:n,issues:[]},r),s=t.right._zod.run({value:n,issues:[]},r);return a instanceof Promise||s instanceof Promise?Promise.all([a,s]).then(([t,r])=>cc(e,t,r)):cc(e,a,s)}});function lc(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(di(e)&&di(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=lc(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=lc(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 cc(e,t,r){const n=new Map;let a;for(const r of t.issues)if("unrecognized_keys"===r.code){a??(a=r);for(const e of r.keys)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(r);for(const t of r.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(t);const s=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length&&a&&e.issues.push({...a,keys:s}),gi(e))return e;const o=lc(t.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const dc=Ko("$ZodEnum",(e,t)=>{jl.init(e,t);const r=Yo(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>fi.has(typeof e)).map(e=>"string"==typeof e?pi(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const s=t.value;return n.has(s)||t.issues.push({code:"invalid_value",values:r,input:s,inst:e}),t}}),uc=Ko("$ZodTransform",(e,t)=>{jl.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Zo(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 Ho;return r.value=a,r}});function fc(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const pc=Ko("$ZodOptional",(e,t)=>{jl.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ni(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ni(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ti(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=>fc(t,e.value)):fc(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),mc=Ko("$ZodExactOptional",(e,t)=>{pc.init(e,t),ni(e._zod,"values",()=>t.innerType._zod.values),ni(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),hc=Ko("$ZodNullable",(e,t)=>{jl.init(e,t),ni(e._zod,"optin",()=>t.innerType._zod.optin),ni(e._zod,"optout",()=>t.innerType._zod.optout),ni(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ti(e.source)}|null)$`):void 0}),ni(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)}),gc=Ko("$ZodDefault",(e,t)=>{jl.init(e,t),e._zod.optin="optional",ni(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=>bc(e,t)):bc(n,t)}});function bc(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const xc=Ko("$ZodPrefault",(e,t)=>{jl.init(e,t),e._zod.optin="optional",ni(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))}),yc=Ko("$ZodNonOptional",(e,t)=>{jl.init(e,t),ni(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=>vc(t,e)):vc(a,e)}});function vc(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 wc=Ko("$ZodCatch",(e,t)=>{jl.init(e,t),ni(e._zod,"optin",()=>t.innerType._zod.optin),ni(e._zod,"optout",()=>t.innerType._zod.optout),ni(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=>yi(e,r,Jo()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>yi(e,r,Jo()))},input:e.value}),e.issues=[]),e)}}),Sc=Ko("$ZodPipe",(e,t)=>{jl.init(e,t),ni(e._zod,"values",()=>t.in._zod.values),ni(e._zod,"optin",()=>t.in._zod.optin),ni(e._zod,"optout",()=>t.out._zod.optout),ni(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=>jc(e,t.in,r)):jc(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>jc(e,t.out,r)):jc(n,t.out,r)}});function jc(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const kc=Ko("$ZodReadonly",(e,t)=>{jl.init(e,t),ni(e._zod,"propValues",()=>t.innerType._zod.propValues),ni(e._zod,"values",()=>t.innerType._zod.values),ni(e._zod,"optin",()=>t.innerType?._zod?.optin),ni(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(Nc):Nc(n)}});function Nc(e){return e.value=Object.freeze(e.value),e}const Ec=Ko("$ZodCustom",(e,t)=>{cl.init(e,t),jl.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=>Cc(t,r,n,e));Cc(a,r,n,e)}});function Cc(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(wi(e))}}var Ac;class _c{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)}}(Ac=globalThis).__zod_globalRegistry??(Ac.__zod_globalRegistry=new _c);const Tc=globalThis.__zod_globalRegistry;function Rc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...hi(t)})}function Pc(e,t){return new dl({check:"max_length",...hi(t),maximum:e})}function Oc(e,t){return new ul({check:"min_length",...hi(t),minimum:e})}function Ic(e,t){return new fl({check:"length_equals",...hi(t),length:e})}function Dc(e){return new vl({check:"overwrite",tx:e})}function Uc(e){const t=function(e,t){const r=new cl({check:"custom",...hi(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(wi(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(wi(n))}},e(r.value,r)));return t}function Fc(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??Tc,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 Mc(e,t,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,s=t.seen.get(e);if(s){s.count++;return r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema}const o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);const i=e._zod.toJSONSchema?.();if(i)o.schema=i;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,n);else{const r=o.schema,s=t.processors[a.type];if(!s)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);s(e,t,r,n)}const s=e._zod.parent;s&&(o.ref||(o.ref=s),Mc(s,t,n),t.seen.get(s).isParent=!0)}const l=t.metadataRegistry.get(e);l&&Object.assign(o.schema,l),"input"===t.io&&$c(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault;return t.seen.get(e).schema}function zc(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const t of e.seen.entries()){const r=e.metadataRegistry.get(t[0])?.id;if(r){const e=n.get(r);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}const a=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:a,defId:s}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const s=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=s,{defId:s,ref:`${a("__shared")}#/${n}/${s}`}}if(t[1]===r)return{ref:"#"};const a=`#/${n}/`,s=t[1].schema.id??"__schema"+e.counter++;return{defId:s,ref:a+s}})(t);n.def={...n.schema},s&&(n.defId=s);const o=n.schema;for(const e in o)delete o[e];o.$ref=a};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const n=r[1];if(t===r[0]){a(r);continue}if(e.external){const n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){a(r);continue}}const s=e.metadataRegistry.get(r[0])?.id;s?a(r):(n.cycle||n.count>1&&"ref"===e.reused)&&a(r)}}function Lc(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const a=r.def??r.schema,s={...a},o=r.ref;if(r.ref=null,o){n(o);const r=e.seen.get(o),i=r.schema;!i.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,i):(a.allOf=a.allOf??[],a.allOf.push(i)),Object.assign(a,s);if(t._zod.parent===o)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in s||delete a[e]);if(i.$ref&&r.def)for(const e in a)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(a[e])===JSON.stringify(r.def[e])&&delete a[e]}const i=t._zod.parent;if(i&&i!==o){n(i);const t=e.seen.get(i);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(const e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:r.path??[]})};for(const t of[...e.seen.entries()].reverse())n(t[0]);const a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(r)}Object.assign(a,r.def??r.schema);const s=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?a.$defs=s:a.definitions=s);try{const r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:Wc(t,"input",e.processors),output:Wc(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function $c(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 $c(n.element,r);if("set"===n.type)return $c(n.valueType,r);if("lazy"===n.type)return $c(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 $c(n.innerType,r);if("intersection"===n.type)return $c(n.left,r)||$c(n.right,r);if("record"===n.type||"map"===n.type)return $c(n.keyType,r)||$c(n.valueType,r);if("pipe"===n.type)return $c(n.in,r)||$c(n.out,r);if("object"===n.type){for(const e in n.shape)if($c(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if($c(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if($c(e,r))return!0;return!(!n.rest||!$c(n.rest,r))}return!1}const Wc=(e,t,r={})=>n=>{const{libraryOptions:a,target:s}=n??{},o=Fc({...a??{},target:s,io:t,processors:r});return Mc(e,o),zc(o,e),Lc(o,e)},Vc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Bc=(e,t,r,n)=>{const a=e._zod.def;Mc(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function Gc(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function Kc(e,t){for(var r={};e.length;){var n=e[0],a=n.code,s=n.message,o=n.path.join(".");if(!r[o])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];r[o]={message:i.message,type:i.code}}else r[o]={message:s,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var l=r[o].types,c=l&&l[n.code];r[o]=ao(o,t,r,a,c?[].concat(c,n.message):n.message)}e.shift()}return r}function Hc(e,t){for(var r={};e.length;){var n=e[0],a=n.code,s=n.message,o=n.path.join(".");if(!r[o])if("invalid_union"===n.code&&n.errors.length>0){var i=n.errors[0][0];r[o]={message:i.message,type:i.code}}else r[o]={message:s,type:a};if("invalid_union"===n.code&&n.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var l=r[o].types,c=l&&l[n.code];r[o]=ao(o,t,r,a,c?[].concat(c,n.message):n.message)}e.shift()}return r}function Zc(e,t,r){if(void 0===r&&(r={}),function(e){return"_def"in e&&"object"==typeof e._def&&"typeName"in e._def}(e))return function(n,a,s){try{return Promise.resolve(Gc(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return s.shouldUseNativeValidation&&Wo({},s),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:Vo(Kc(e.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(n,a,s){try{return Promise.resolve(Gc(function(){return Promise.resolve(("sync"===r.mode?Ei:Ai)(e,n,t)).then(function(e){return s.shouldUseNativeValidation&&Wo({},s),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof ji}(e))return{values:{},errors:Vo(Hc(e.issues,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}function qc(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Jc(...e){return t=>{let r=!1;const n=e.map(e=>{const n=qc(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():qc(e[t],null)}}}}function Yc(...e){return a.useCallback(Jc(...e),e)}var Xc=Symbol.for("react.lazy"),Qc=a[" use ".trim().toString()];function ed(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===Xc&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function td(t){const r=nd(t),n=a.forwardRef((t,n)=>{let{children:s,...o}=t;ed(s)&&"function"==typeof Qc&&(s=Qc(s._payload));const i=a.Children.toArray(s),l=i.find(sd);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}var rd=td("Slot");function nd(e){const t=a.forwardRef((e,t)=>{let{children:r,...n}=e;if(ed(r)&&"function"==typeof Qc&&(r=Qc(r._payload)),a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Jc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ad=Symbol("radix.slottable");function sd(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ad}const od=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,id=l,ld=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return id(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:s}=t,o=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==s?void 0:s[e];if(null===t)return null;const o=od(t)||od(n);return a[e][o]}),i=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),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({...s,...i}[t]):{...s,...i}[t]===r})?[...e,r,n]:e},[]);return id(e,o,l,null==r?void 0:r.class,null==r?void 0:r.className)},cd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dd=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)},ud=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),fd=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("react-dom");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var a=n(t),s=n(r);function o(e){return Boolean(e?.serverUrl&&e?.version&&e?.orgId)}function i(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=i(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function l(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=i(e))&&(n&&(n+=" "),n+=t);return n}exports.ApiVersion=void 0,(exports.ApiVersion||(exports.ApiVersion={})).V1="v1";const c=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),d="-",u=[],f=e=>{const t=h(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return m(e);const r=e.split(d),n=""===r[0]&&r.length>1?1:0;return p(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=n[e],a=r[e];return t?a?((e,t)=>{const r=new Array(e.length+t.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(a,t):t:a||u}return r[e]||u}}},p=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=p(e,t+1,a);if(r)return r}const s=r.validators;if(null===s)return;const o=0===t?e.join(d):e.slice(t).join(d),i=s.length;for(let e=0;e<i;e++){const t=s[e];if(t.validator(o))return t.classGroupId}},m=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),h=e=>{const{theme:t,classGroups:r}=e;return g(r,t)},g=(e,t)=>{const r=c();for(const n in e){const a=e[n];b(a,r,n,t)}return r},b=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const a=e[s];x(a,t,r,n)}},x=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?w(e,t,r,n):v(e,t,r,n):y(e,t,r)},y=(e,t,r)=>{(""===e?t:S(t,e)).classGroupId=r},v=(e,t,r,n)=>{j(e)?b(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},w=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let e=0;e<s;e++){const[s,o]=a[e];b(o,S(t,s),r,n)}},S=(e,t)=>{let r=e;const n=t.split(d),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=c(),r.nextPart.set(t,a)),r=a}return r},j=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,k=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(a,s)=>{r[a]=s,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},N=[],E=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),C=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,s=0;const o=e.length;for(let i=0;i<o;i++){const o=e[i];if(0===n&&0===a){if(":"===o){t.push(e.slice(s,i)),s=i+1;continue}if("/"===o){r=i;continue}}"["===o?n++:"]"===o?n--:"("===o?a++:")"===o&&a--}const i=0===t.length?e:e.slice(s);let l=i,c=!1;i.endsWith("!")?(l=i.slice(0,-1),c=!0):i.startsWith("!")&&(l=i.slice(1),c=!0);return E(t,c,l,r&&r>s?r-s:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):E(N,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},A=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{const r=[];let n=[];for(let a=0;a<e.length;a++){const s=e[a],o="["===s[0],i=t.has(s);o||i?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(s)):n.push(s)}return n.length>0&&(n.sort(),r.push(...n)),r}},_=/\s+/,T=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=T(e[n]))&&(r&&(r+=" "),r+=t);return r},R=(e,...t)=>{let r,n,a,s;const o=e=>{const t=n(e);if(t)return t;const s=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],i=e.trim().split(_);let l="";for(let e=i.length-1;e>=0;e-=1){const t=i[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]:s(d).join(":"),b=u?g+"!":g,x=b+h;if(o.indexOf(x)>-1)continue;o.push(x);const y=a(h,m);for(let e=0;e<y.length;++e){const t=y[e];o.push(b+t)}l=t+(l.length>0?" "+l:l)}return l})(e,r);return a(e,s),s};return s=i=>{const l=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:k(e.cacheSize),parseClassName:C(e),sortModifiers:A(e),...f(e)}))(l),n=r.cache.get,a=r.cache.set,s=o,o(i)},(...e)=>s(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=T(t))&&(a&&(a+=" "),a+=r);return a})(...e))},P=[],O=e=>{const t=t=>t[e]||P;return t.isThemeGetter=!0,t},I=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,D=/^\((?:(\w[\w-]*):)?(.+)\)$/i,U=/^\d+\/\d+$/,M=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,F=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,z=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,L=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,W=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$=e=>U.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),B=e=>!!e&&Number.isInteger(Number(e)),G=e=>e.endsWith("%")&&V(e.slice(0,-1)),K=e=>M.test(e),H=()=>!0,Z=e=>F.test(e)&&!z.test(e),q=()=>!1,J=e=>L.test(e),Y=e=>W.test(e),X=e=>!ee(e)&&!oe(e),Q=e=>pe(e,be,q),ee=e=>I.test(e),te=e=>pe(e,xe,Z),re=e=>pe(e,ye,V),ne=e=>pe(e,he,q),ae=e=>pe(e,ge,Y),se=e=>pe(e,we,J),oe=e=>D.test(e),ie=e=>me(e,xe),le=e=>me(e,ve),ce=e=>me(e,he),de=e=>me(e,be),ue=e=>me(e,ge),fe=e=>me(e,we,!0),pe=(e,t,r)=>{const n=I.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},me=(e,t,r=!1)=>{const n=D.exec(e);return!!n&&(n[1]?t(n[1]):r)},he=e=>"position"===e||"percentage"===e,ge=e=>"image"===e||"url"===e,be=e=>"length"===e||"size"===e||"bg-size"===e,xe=e=>"length"===e,ye=e=>"number"===e,ve=e=>"family-name"===e,we=e=>"shadow"===e,Se=R(()=>{const e=O("color"),t=O("font"),r=O("text"),n=O("font-weight"),a=O("tracking"),s=O("leading"),o=O("breakpoint"),i=O("container"),l=O("spacing"),c=O("radius"),d=O("shadow"),u=O("inset-shadow"),f=O("text-shadow"),p=O("drop-shadow"),m=O("blur"),h=O("perspective"),g=O("aspect"),b=O("ease"),x=O("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",oe,ee],v=()=>[oe,ee,l],w=()=>[$,"full","auto",...v()],S=()=>[B,"none","subgrid",oe,ee],j=()=>["auto",{span:["full",B,oe,ee]},B,oe,ee],k=()=>[B,"auto",oe,ee],N=()=>["auto","min","max","fr",oe,ee],E=()=>["auto",...v()],C=()=>[$,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...v()],A=()=>[e,oe,ee],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",ce,ne,{position:[oe,ee]}],T=()=>["auto","cover","contain",de,Q,{size:[oe,ee]}],R=()=>[G,ie,te],P=()=>["","none","full",c,oe,ee],I=()=>["",V,ie,te],D=()=>[V,G,ce,ne],U=()=>["","none",m,oe,ee],M=()=>["none",V,oe,ee],F=()=>["none",V,oe,ee],z=()=>[V,oe,ee],L=()=>[$,"full",...v()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[K],breakpoint:[K],color:[H],container:[K],"drop-shadow":[K],ease:["in","out","in-out"],font:[X],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[K],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[K],shadow:[K],spacing:["px",V],text:[K],"text-shadow":[K],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$,ee,oe,g]}],container:["container"],columns:[{columns:[V,ee,oe,i]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[B,"auto",oe,ee]}],basis:[{basis:[$,"full","auto",i,...v()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[V,$,"auto","initial","none",ee]}],grow:[{grow:["",V,oe,ee]}],shrink:[{shrink:["",V,oe,ee]}],order:[{order:[B,"first","last","none",oe,ee]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":N()}],"auto-rows":[{"auto-rows":N()}],gap:[{gap:v()}],"gap-x":[{"gap-x":v()}],"gap-y":[{"gap-y":v()}],"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:v()}],px:[{px:v()}],py:[{py:v()}],ps:[{ps:v()}],pe:[{pe:v()}],pt:[{pt:v()}],pr:[{pr:v()}],pb:[{pb:v()}],pl:[{pl:v()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":v()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":v()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],w:[{w:[i,"screen",...C()]}],"min-w":[{"min-w":[i,"screen","none",...C()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[o]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",r,ie,te]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,oe,re]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",G,ee]}],"font-family":[{font:[le,ee,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,oe,ee]}],"line-clamp":[{"line-clamp":[V,"none",oe,re]}],leading:[{leading:[s,...v()]}],"list-image":[{"list-image":["none",oe,ee]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",oe,ee]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[V,"from-font","auto",oe,te]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[V,"auto",oe,ee]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:v()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",oe,ee]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",oe,ee]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},B,oe,ee],radial:["",oe,ee],conic:[B,oe,ee]},ue,ae]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[V,oe,ee]}],"outline-w":[{outline:["",V,ie,te]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",d,fe,se]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",u,fe,se]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[V,te]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",f,fe,se]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[V,oe,ee]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[oe,ee]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",oe,ee]}],filter:[{filter:["","none",oe,ee]}],blur:[{blur:U()}],brightness:[{brightness:[V,oe,ee]}],contrast:[{contrast:[V,oe,ee]}],"drop-shadow":[{"drop-shadow":["","none",p,fe,se]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",V,oe,ee]}],"hue-rotate":[{"hue-rotate":[V,oe,ee]}],invert:[{invert:["",V,oe,ee]}],saturate:[{saturate:[V,oe,ee]}],sepia:[{sepia:["",V,oe,ee]}],"backdrop-filter":[{"backdrop-filter":["","none",oe,ee]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[V,oe,ee]}],"backdrop-contrast":[{"backdrop-contrast":[V,oe,ee]}],"backdrop-grayscale":[{"backdrop-grayscale":["",V,oe,ee]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,oe,ee]}],"backdrop-invert":[{"backdrop-invert":["",V,oe,ee]}],"backdrop-opacity":[{"backdrop-opacity":[V,oe,ee]}],"backdrop-saturate":[{"backdrop-saturate":[V,oe,ee]}],"backdrop-sepia":[{"backdrop-sepia":["",V,oe,ee]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":v()}],"border-spacing-x":[{"border-spacing-x":v()}],"border-spacing-y":[{"border-spacing-y":v()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",oe,ee]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[V,"initial",oe,ee]}],ease:[{ease:["linear","initial",b,oe,ee]}],delay:[{delay:[V,oe,ee]}],animate:[{animate:["none",x,oe,ee]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,oe,ee]}],"perspective-origin":[{"perspective-origin":y()}],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:[oe,ee,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:L()}],"translate-x":[{"translate-x":L()}],"translate-y":[{"translate-y":L()}],"translate-z":[{"translate-z":L()}],"translate-none":["translate-none"],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",oe,ee]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":v()}],"scroll-mx":[{"scroll-mx":v()}],"scroll-my":[{"scroll-my":v()}],"scroll-ms":[{"scroll-ms":v()}],"scroll-me":[{"scroll-me":v()}],"scroll-mt":[{"scroll-mt":v()}],"scroll-mr":[{"scroll-mr":v()}],"scroll-mb":[{"scroll-mb":v()}],"scroll-ml":[{"scroll-ml":v()}],"scroll-p":[{"scroll-p":v()}],"scroll-px":[{"scroll-px":v()}],"scroll-py":[{"scroll-py":v()}],"scroll-ps":[{"scroll-ps":v()}],"scroll-pe":[{"scroll-pe":v()}],"scroll-pt":[{"scroll-pt":v()}],"scroll-pr":[{"scroll-pr":v()}],"scroll-pb":[{"scroll-pb":v()}],"scroll-pl":[{"scroll-pl":v()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",oe,ee]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[V,ie,te,re]}],stroke:[{stroke:["none",...A()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function je(){try{const e="undefined"!=typeof globalThis?globalThis:null;return"development"===e?.process?.env?.NODE_ENV}catch{return!1}}function ke(...e){return Se(l(e))}let Ne=!0;function Ee(e,...t){console.error(e,...t)}function Ce(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(Ce);const r={};for(const[n,a]of Object.entries(e))r[n]=t.has(n.toLowerCase())?"[redacted]":Ce(a);return r}function Ae(e){return e instanceof Error&&("AbortError"===e.name||"ERR_CANCELED"===e.code)}async function _e(e,t){try{const r=await fetch(e,t);if(je()){const n=(t?.method??"GET").toUpperCase();let a;if(null!=t?.body)try{a="string"==typeof t.body?JSON.parse(t.body):{body:"(non-JSON)"}}catch{a={body:"(parse failed)"}}const s=r.clone();let o;try{const e=await s.text();if(e)try{o=JSON.parse(e)}catch{o=e.substring(0,200)+(e.length>200?"...":"")}}catch{o="(read failed)"}!function(e,...t){Ne&&je()&&console.log(e,...t)}("[SDK API]",n,e,{request:Ce(a),response:Ce(o),status:r.status})}return r}catch(e){if(Ae(e))throw e;if(e instanceof TypeError&&"Failed to fetch"===e.message)throw new Error("Network error: Please check your internet connection");throw e}}async function Te(e,t){try{const r=await e.json();return r?.message||r?.error||t}catch{return t}}async function Re(e){const t=await e.text();if(!t)throw new Error("Empty response body");try{return JSON.parse(t)}catch(e){throw new Error(`Invalid JSON response: ${t.substring(0,100)}${t.length>100?"...":""}`)}}async function Pe(e,t="Request failed"){if(!e.ok){let r=t;try{const t=await Re(e);r=t.message||t.error||r}catch{r=function(e,t){const r={400:"Bad Request",401:"Unauthorized - Please check your session",403:"Forbidden - You do not have permission",404:"Resource not found",500:"Internal server error",502:"Bad Gateway",503:"Service unavailable"}[e.status]||e.statusText||t;return new Error(`${t} (${e.status}: ${r})`)}(e,t).message}throw new Error(r)}try{return await Re(e)}catch(e){if(e instanceof Error&&e.message.includes("Invalid JSON"))throw e;throw new Error("Failed to parse response as JSON")}}class Oe extends Error{constructor(e,t,r,n){super(e),this.code=t,this.context=r,this.originalError=n,this.name="SDKError","undefined"!=typeof Error&&"captureStackTrace"in Error&&Error.captureStackTrace(this,Oe)}}const Ie=new class{constructor(){this.config={enableConsoleLogging:!0,showUserNotifications:!1}}configure(e){this.config={...this.config,...e},void 0!==e.enableConsoleLogging&&function(e){void 0!==e.enableLogging&&(Ne=e.enableLogging)}({enableLogging:e.enableConsoleLogging})}handleError(e,t={}){if(Ae(e))return;const r=e instanceof Error?e:new Oe("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof Oe?r:new Oe(r.message,"SDK_ERROR",t,r);if(this.config.enableConsoleLogging&&function(e,...t){Ne&&je()&&console.error(e,...t)}(`[SDK Error] ${t.component||"Unknown"}:`,{message:n.message,code:n.code,context:n.context,originalError:n.originalError,stack:n.stack}),this.config.onError)try{this.config.onError(n,t)}catch(e){Ee("[SDK Error Handler] Error in custom error callback:",e)}this.config.showUserNotifications&&this.notifyUser(n,t)}notifyUser(e,t){"undefined"!=typeof window&&window.dispatchEvent&&window.dispatchEvent(new CustomEvent("sdk-error",{detail:{error:e,context:t}}))}wrapAsync(e,t){return(...r)=>e(...r).catch(e=>{throw this.handleError(e,t),e})}wrapSync(e,t){return(...r)=>{try{return e(...r)}catch(e){throw this.handleError(e,t),e}}}};function De(e,t={}){Ie.handleError(e,t)}function Ue(e,t={}){return!Ae(e)&&(Ie.handleError(e,t),!0)}class Me extends t.Component{constructor(e){super(e),this.resetError=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){if(De(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){Ee("[SDK ErrorBoundary] Error in onError callback:",e)}}componentDidUpdate(e){this.state.hasError&&!1!==this.props.resetOnPropsChange&&e.children!==this.props.children&&this.resetError()}render(){return this.state.hasError&&this.state.error?this.props.fallback?"function"==typeof this.props.fallback?this.props.fallback(this.state.error,this.resetError):this.props.fallback:e.jsxs("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),e.jsx("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),e.jsx("button",{onClick:this.resetError,style:{padding:"0.5rem 1rem",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"0.25rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]}):this.props.children}}const Fe=()=>({type:"AUTHENTICATION_STARTED"}),ze=()=>({type:"AUTHENTICATION_PROCESSING"}),Le=()=>({type:"AUTHENTICATION_FAILED"}),We=e=>({type:"SET_SESSION",payload:e}),$e=()=>({type:"REMOVE_SESSION"});function Ve(e,r,n){const a=t.useRef(r),s=t.useRef(n),o=t.useRef(void 0),i=t.useRef(!1);return a.current=r,s.current=n,t.useMemo(()=>{const t=a.current(e);if(i.current){if(s.current?s.current(o.current,t):Object.is(o.current,t))return o.current}return o.current=t,i.current=!0,t},[e])}function Be({name:r,initialState:n,reducer:a,initializer:s}){const o=t.createContext(null),i=t.createContext(null),l=t.createContext(null),c=t.memo(({children:r})=>{const[c,d]=t.useReducer(a,n,s||(e=>e)),u=t.useMemo(()=>({state:c,dispatch:d}),[c,d]);return e.jsx(l.Provider,{value:u,children:e.jsx(o.Provider,{value:c,children:e.jsx(i.Provider,{value:d,children:r})})})});c.displayName=`${r}Provider`;const d=e=>new Error(`use${r}${e} must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`),u=()=>{const e=t.useContext(o);if(null===e)throw d("State");return e};return{Provider:c,useContext:()=>{const e=t.useContext(l);if(!e)throw d("Context");return e},useState:u,useDispatch:()=>{const e=t.useContext(i);if(null===e)throw d("Dispatch");return e},useSelector:(e,t)=>{const r=e||(e=>e);return Ve(u(),r,t)}}}var Ge;function Ke(e){return{isAuthenticated:e===exports.AuthStatus.authenticated,isLoading:e===exports.AuthStatus.loading||e===exports.AuthStatus.redirecting||e===exports.AuthStatus.authenticating,isRedirecting:e===exports.AuthStatus.redirecting}}function He(e,t,r){return{...e,[t]:r}}function Ze(e,t){return{...e,...t}}exports.AuthStatus=void 0,(Ge=exports.AuthStatus||(exports.AuthStatus={})).loading="loading",Ge.redirecting="redirecting",Ge.authenticated="authenticated",Ge.unauthenticated="unauthenticated",Ge.authenticating="authenticating";const qe=()=>({session:null,status:exports.AuthStatus.loading}),{Provider:Je,useState:Ye,useDispatch:Xe}=Be({name:"Auth",initialState:qe(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return He(e,"status",exports.AuthStatus.redirecting);case"AUTHENTICATION_PROCESSING":return He(e,"status",exports.AuthStatus.authenticating);case"AUTHENTICATION_FAILED":case"REMOVE_SESSION":return Ze(e,{session:null,status:exports.AuthStatus.unauthenticated});case"SET_SESSION":return Ze(e,{session:t.payload,status:exports.AuthStatus.authenticated});default:return e}},initializer:qe}),Qe=Je,et=Ye,tt=Xe,rt=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),nt=e=>({type:"SET_SETTINGS",payload:e}),at=()=>({serverUrl:"",version:exports.ApiVersion.V1,orgId:"",settings:null}),{Provider:st,useState:ot,useDispatch:it}=Be({name:"OS",initialState:at(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return Ze(e,t.payload);case"REMOVE_SAAS_OS_CONFIG":return at();case"SET_SETTINGS":return He(e,"settings",t.payload);default:return e}}}),lt=st,ct=ot,dt=it,ut=e=>({type:"SET_WORKSPACES",payload:e}),ft=e=>({type:"ADD_WORKSPACE",payload:e}),pt=e=>({type:"UPDATE_WORKSPACE",payload:e}),mt=e=>({type:"REMOVE_WORKSPACE",payload:e}),ht=e=>({type:"SET_ALL_FEATURES",payload:e}),gt=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),bt=()=>({type:"RESET_CURRENT_WORKSPACE"}),xt=e=>({type:"SET_IS_INITIALIZED",payload:e}),yt=e=>({type:"SET_LOADING",payload:e}),vt=e=>({type:"SET_ERROR",payload:e}),wt=e=>({type:"SET_REFRESHING",payload:e}),St=e=>({type:"SET_SWITCHING_TO_ID",payload:e}),{Provider:jt,useState:kt,useDispatch:Nt}=Be({name:"Workspace",initialState:{workspaces:[],loading:!1,error:null,currentWorkspace:null,refreshing:!1,switchingToId:null,isInitialized:!1,allFeatures:[]},reducer:(e,t)=>{switch(t.type){case"SET_WORKSPACES":return He(e,"workspaces",t.payload);case"ADD_WORKSPACE":return He(e,"workspaces",[...e.workspaces,t.payload]);case"UPDATE_WORKSPACE":return He(e,"workspaces",e.workspaces.map(e=>e._id===t.payload._id?t.payload:e));case"REMOVE_WORKSPACE":return He(e,"workspaces",e.workspaces.filter(e=>e._id!==t.payload));case"SET_ALL_FEATURES":return He(e,"allFeatures",t.payload);case"SET_CURRENT_WORKSPACE":return He(e,"currentWorkspace",t.payload);case"RESET_CURRENT_WORKSPACE":return He(e,"currentWorkspace",null);case"SET_IS_INITIALIZED":return He(e,"isInitialized",t.payload);case"SET_LOADING":return He(e,"loading",t.payload);case"SET_ERROR":return He(e,"error",t.payload);case"SET_REFRESHING":return He(e,"refreshing",t.payload);case"SET_SWITCHING_TO_ID":return He(e,"switchingToId",t.payload);default:return e}}}),Et=jt,Ct=kt,At=Nt,_t=t.memo(({children:t})=>e.jsx(lt,{children:e.jsx(Qe,{children:e.jsx(Et,{children:t})})}));_t.displayName="SDKContextProvider";const Tt=new Set;function Rt(){Tt.forEach(e=>e())}const Pt=new class{constructor(){this.callbacks=null}setCallbacks(e){this.callbacks=e}getCallbacks(){return this.callbacks}async emit(e,t){if(this.callbacks?.handleEvent)try{await this.callbacks.handleEvent(e,t)}catch(t){De(t,{component:"EventEmitter",action:"emit",metadata:{eventType:e}})}}async emitUserCreated(e){await this.emit("user:created",{user:e})}async emitUserUpdated(e,t){await this.emit("user:updated",{user:e,previousUser:t})}async emitWorkspaceChanged(e,t){await this.emit("workspace:changed",{workspace:e,previousWorkspace:t})}async emitWorkspaceUpdated(e){await this.emit("workspace:updated",{workspace:e})}async emitWorkspaceUserAdded(e,t,r){await this.emit("workspace:user-added",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRemoved(e,t,r){await this.emit("workspace:user-removed",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRoleChanged(e,t,r,n){await this.emit("workspace:user-role-changed",{userId:e,workspace:t,previousRole:r,newRole:n})}async emitWorkspaceCreated(e){await this.emit("workspace:created",{workspace:e})}async emitWorkspaceDeleted(e){await this.emit("workspace:deleted",{workspace:e})}};function Ot(e,r,n){t.useEffect(()=>{const t=new AbortController;return e(t.signal).catch(e=>{Ae(e)||(n?.onError?n.onError(e):De(e,{component:"useAsyncEffect",action:"effect",metadata:{note:"Unhandled rejection - consider passing onError"}}))}),()=>t.abort()},r)}function It(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return De(t,{component:"storage",action:"getStorageItem",metadata:{key:e}}),null}}function Dt(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){De(t,{component:"storage",action:"setStorageItem",metadata:{key:e}})}}function Ut(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){De(t,{component:"storage",action:"removeStorageItem",metadata:{key:e}})}}const Mt="code",Ft="saas-session-id",zt="saas-workspace-current";function Lt(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 Wt(e){Dt(Ft,e)}function $t(){Ut(Ft)}function Vt(){if("undefined"==typeof window)return null;try{return It(Ft)}catch(e){return De(e,{component:"auth/utils",action:"getSessionId",metadata:{key:Ft}}),null}}function Bt(){const e=Vt(),t={};return e&&(t["x-session-id"]=e),t}function Gt(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(Mt)}catch(e){return De(e,{component:"auth/utils",action:"getTokenFromUrl",metadata:{param:Mt}}),null}}function Kt(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const Ht="SDK is not ready (missing serverUrl, version, or orgId)";class Zt{constructor(e){this.serverUrl=e.serverUrl,this.version=e.version,this.orgId=e.orgId,this.requireOrgId=e.requireOrgId??!1,this.basePath=e.basePath??"public"}ensureReady(){if(!this.serverUrl?.trim()||!this.version)throw new Error(Ht);if(this.requireOrgId&&!this.orgId?.trim())throw new Error(Ht)}get baseUrl(){return this.ensureReady(),`${this.serverUrl}/api/${this.version}/${this.basePath}`}getAuthHeaders(){return Bt()}url(e){const t=e.startsWith("/")?e.slice(1):e;return`${this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl}/${t}`}async fetchJson(e,t={},r="Request failed"){this.ensureReady();const n={...this.getAuthHeaders()};t.headers&&Object.assign(n,t.headers),null==t.body||n["Content-Type"]||(n["Content-Type"]="application/json");return Pe(await _e(this.url(e),{...t,headers:n}),r)}async fetchResponse(e,t={}){this.ensureReady();const r={...this.getAuthHeaders()};return t.headers&&Object.assign(r,t.headers),null==t.body||r["Content-Type"]||(r["Content-Type"]="application/json"),_e(this.url(e),{...t,headers:r})}}class qt extends Zt{constructor(e){super({...e,requireOrgId:!0})}async getSettings(e){return this.fetchJson(`${this.orgId}/settings`,{signal:e},"Failed to fetch settings")}}function Jt(){return kr(e=>e.os)}function Yt(){const e=Nr(),r=Jt(),{serverUrl:n,version:a,orgId:s,settings:i}=r,l=t.useRef(!1),c=t.useMemo(()=>o(r)?new qt({serverUrl:n,version:a,orgId:s}):null,[n,a,s]),d=t.useCallback(async t=>{if(l.current)return i||null;if(i)return i;if(!c)return null;l.current=!0;try{const r=await c.getSettings(t);return e.os(nt(r)),r}catch(e){return Ue(e,{component:"useSaaSSettings",action:"getSettings",metadata:{serverUrl:n,version:a,orgId:s}}),null}finally{l.current=!1}},[c,i,e]);return Ot(async e=>{!o(r)||i||l.current||await d(e)},[n,a,s,d],{onError:e=>Ue(e,{component:"useSaaSSettings",action:"fetchSettings",metadata:{serverUrl:n,version:a,orgId:s}})}),t.useMemo(()=>({settings:i,getSettings:d}),[i,d])}class Xt extends Zt{constructor(e){super({...e,requireOrgId:!0})}async getWorkspaces(){return this.fetchJson("workspaces",{},"Failed to fetch workspaces")}async createWorkspace(e){return this.fetchJson("workspaces",{method:"POST",body:JSON.stringify(e)},"Failed to create workspace")}async updateWorkspace(e,t){return this.fetchJson(`workspaces/${e}`,{method:"PUT",body:JSON.stringify(t)},"Failed to update workspace")}async deleteWorkspace(e){return this.fetchJson(`workspaces/${e}`,{method:"DELETE"},"Failed to delete workspace")}async getWorkspaceUsers(e){return this.fetchJson(`workspaces/${e}/users`,{},"Failed to fetch workspace users")}async addUser(e,t){return this.fetchJson(`workspaces/${e}/users/add`,{method:"POST",body:JSON.stringify(t)},"Failed to invite member")}async removeUser(e,t){return this.fetchJson(`workspaces/${e}/users/${t}`,{method:"DELETE"},"Failed to remove user")}async updateUser(e,t,r){return this.fetchJson(`workspaces/${e}/users/${t}`,{method:"PATCH",body:JSON.stringify(r)},"Failed to update user")}async getFeatures(){return this.fetchJson("workspaces/features",{},"Failed to fetch features")}async updateFeature(e,t,r){return this.fetchJson(`workspaces/${e}/features`,{method:"PATCH",body:JSON.stringify({features:{[t]:r}})},"Failed to update feature")}async getWorkspace(e){return this.fetchJson(`workspaces/${e}`,{},"Failed to fetch workspace")}async getProfile(){return this.fetchJson("profile",{},"Failed to fetch profile")}async updateUserProfile(e){return this.fetchJson("profile",{method:"PATCH",body:JSON.stringify(e)},"Failed to update user profile")}async getCurrentSubscription(e){const t=await this.fetchResponse(`workspaces/${e}/subscription`);if(!t.ok){let e="Failed to fetch subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Workspace not found or no subscription available":401===t.status?"Unauthorized - Please check your session":`Failed to fetch subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch subscription");return r.data||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 createBillingPortalSession(e,t){return this.fetchJson(`workspaces/${e}/subscription/billing-portal`,{method:"POST",body:JSON.stringify(t?{returnUrl:t}:{})})}async listInvoices(e,t=10,r){const n=new URLSearchParams;n.append("limit",t.toString()),r&&n.append("starting_after",r);const a=await this.fetchResponse(`workspaces/${e}/subscription/invoices?${n.toString()}`,{});if(!a.ok){let e="Failed to fetch invoices";try{e=(await a.json()).message||e}catch{e=404===a.status?"Workspace not found or no invoices available":401===a.status?"Unauthorized - Please check your session":`Failed to fetch invoices (${a.status}: ${a.statusText})`}throw new Error(e)}const s=await a.json();if(void 0!==s.success){if(!s.success)throw new Error(s.message||"Failed to fetch invoices");return s}return s}async getInvoice(e,t){const r=await this.fetchResponse(`workspaces/${e}/subscription/invoices/${t}`,{});if(!r.ok){let e="Failed to fetch invoice";try{e=(await r.json()).message||e}catch{e=404===r.status?"Invoice not found":401===r.status?"Unauthorized - Please check your session":`Failed to fetch invoice (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to fetch invoice");return n}return n}async cancelSubscriptionAtPeriodEnd(e){const t=await this.fetchResponse(`workspaces/${e}/subscription/cancel-at-period-end`,{method:"POST"});if(!t.ok){let e="Failed to cancel subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Subscription not found":401===t.status?"Unauthorized - Please check your session":`Failed to cancel subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to cancel subscription");return r.data||r}return r}async resumeSubscription(e){const t=await this.fetchResponse(`workspaces/${e}/subscription/resume`,{method:"POST"});if(!t.ok){let e="Failed to resume subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Subscription not found":401===t.status?"Unauthorized - Please check your session":`Failed to resume subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to resume subscription");return r.data||r}return r}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}`:""}`,s=await this.fetchResponse(a);if(!s.ok){let e="Failed to fetch usage logs";try{e=(await s.json()).message||e}catch{e=404===s.status?"Workspace not found":401===s.status?"Unauthorized - Please check your session":`Failed to fetch usage logs (${s.status}: ${s.statusText})`}throw new Error(e)}const o=await s.json();if(void 0!==o.success){if(!o.success)throw new Error(o.message||"Failed to fetch usage logs");return o.data||o}return o}}const Qt=e=>{e?Dt(zt,e._id):Ut(zt)},er=()=>It(zt),tr=()=>{Ut(zt)},rr=(e,t)=>!!e&&t.some(t=>t._id===e);function nr(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 ar(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 sr(){const e=Jt(),r=function(e){return t.useMemo(()=>new Xt(e),[e.serverUrl,e.version,e.orgId])}(e);return t.useMemo(()=>({os:e,api:r}),[e,r])}const or=()=>{const e=Nr(),{os:r,api:n}=sr(),a=kr(e=>e.workspaces),s=kr(e=>e.auth.session?.user),o=t.useCallback((t,r)=>{if((!(t._id===a.currentWorkspace?._id)||r?.forceEmit)&&t){const r=a.currentWorkspace;Qt(t),e.workspaces(gt(t)),Pt.emitWorkspaceChanged(t,r).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[a.currentWorkspace,e]),i=t.useCallback(async(t,n)=>{const a=++u.current;e.workspaces(St(t._id));try{const e=r.auth?.callbacks?.onWorkspaceChange;if(e){const r=ar(t,s?.id);try{await e({workspace:t,user:s??null,role:r})}catch(e){throw De(e,{component:"useSaaSWorkspaces",action:"onWorkspaceChange",metadata:{workspaceId:t._id}}),e}if(a!==u.current)return}o(t,n)}finally{a===u.current&&e.workspaces(St(null))}},[e,r.auth?.callbacks?.onWorkspaceChange,o,s]);t.useEffect(()=>{if(!a.isInitialized){const t=er();if(e.workspaces(xt(!0)),t){const e=a.workspaces.find(e=>e._id===t);e&&i(e,{forceEmit:!0}).catch(()=>{})}}},[a.isInitialized,a.workspaces,a.currentWorkspace,e,i]);const l=t.useCallback(()=>{tr(),e.workspaces(bt())},[e]),c=t.useRef(!1),d=t.useRef(!1),u=t.useRef(0),f=t.useCallback(async()=>{if(!a.loading&&!c.current){c.current=!0,e.workspaces(yt(!0)),e.workspaces(vt(null));try{const t=await n.getWorkspaces();if(e.workspaces(ut(t)),t.length>0){const e=er();if(e&&rr(e,t)){const r=t.find(t=>t._id===e);if(r)try{await i(r,{forceEmit:!0})}catch{}}else{const e=t[0];try{await i(e,{forceEmit:!0})}catch{}}}}catch(t){e.workspaces(vt(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(yt(!1)),c.current=!1}}},[n,a.loading,e,i]),p=t.useCallback(async()=>{if(!a.refreshing&&!c.current){c.current=!0,e.workspaces(wt(!0));try{const t=await n.getWorkspaces();e.workspaces(ut(t))}catch(e){}finally{e.workspaces(wt(!1)),c.current=!1}}},[n,a.refreshing,e]),m=t.useCallback(async(t,r)=>{const a=await n.createWorkspace({name:t,image:r});e.workspaces(ft(a)),Pt.emitWorkspaceCreated(a).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:a._id}})})},[n,e]),h=t.useCallback(async(t,r)=>{const a=await n.updateWorkspace(t._id,r);e.workspaces(pt(a)),Pt.emitWorkspaceUpdated(a).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:a._id}})})},[n,e]),g=t.useCallback(async()=>{if(d.current)return a.allFeatures.length>0?a.allFeatures:null;if(a.allFeatures.length>0)return a.allFeatures;d.current=!0;try{const t=await n.getFeatures();return e.workspaces(ht(t)),t}catch(e){return De(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{d.current=!1}},[n,e,a.allFeatures]),b=t.useCallback(async(e,t,r)=>await n.updateFeature(e,t,r),[n]);t.useEffect(()=>{if(!a.currentWorkspace?._id||0===a.workspaces.length)return;const t=a.currentWorkspace._id,r=a.workspaces.find(e=>e._id===t);if(r)r!==a.currentWorkspace&&(Qt(r),e.workspaces(gt(r)));else if(a.workspaces.length>0){const e=a.workspaces[0];e._id!==t&&i(e).catch(()=>{})}},[a.workspaces,a.currentWorkspace,e,i]);const x=t.useCallback(async e=>await n.getWorkspaceUsers(e),[n]),y=t.useCallback(async(e,t,r)=>{const s=await n.addUser(e,{email:t,role:r}),o=a.workspaces.find(t=>t._id===e);return o&&Pt.emitWorkspaceUserAdded(s.userId,o,r).catch(t=>{De(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:s.userId,role:r}})}),p().catch(()=>{}),Rt(),s},[n,a.workspaces,p]),v=t.useCallback(async(e,t)=>{const r=a.workspaces.find(t=>t._id===e);if(r&&nr(r,t))throw new Error("Cannot remove the workspace owner");const s=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),o=await n.removeUser(e,t);if(r&&s){const t=s.role;Pt.emitWorkspaceUserRemoved(o.userId,r,t).catch(r=>{De(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:o.userId,role:t}})})}return p().catch(()=>{}),Rt(),o},[n,a.workspaces,p]),w=t.useCallback(async(e,t,r)=>{if(r.role){const r=a.workspaces.find(t=>t._id===e);if(r&&nr(r,t))throw new Error("Cannot change the role of the workspace owner")}let s;if(r.role){const r=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);s=r?.role}const o=await n.updateUser(e,t,r);return r.role&&s&&s!==r.role&&Pt.emitWorkspaceUserRoleChanged(o.userId,o.workspace,s,r.role).catch(n=>{De(n,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:s,newRole:r.role}})}),o},[n,a.workspaces]),S=t.useCallback(async e=>{const t=await n.getProfile().catch(()=>null),r=await n.updateUserProfile(e);return Pt.emitUserUpdated(r,t||void 0).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:r._id}})}),r},[n]),j=t.useCallback(async()=>await n.getProfile(),[n]),k=t.useCallback(async e=>await n.getWorkspace(e),[n]),N=t.useCallback(async t=>{if(!s)throw new Error("User must be authenticated to delete a workspace");const r=a.workspaces.find(e=>e._id===t);if(!r)throw new Error("Workspace not found");if(!nr(r,s.id))throw new Error("Only the workspace creator can delete the workspace");const o=await n.deleteWorkspace(t);return e.workspaces(mt(t)),a.currentWorkspace?._id===t&&(tr(),e.workspaces(bt())),r&&Pt.emitWorkspaceDeleted(r).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),o},[n,a.workspaces,a.currentWorkspace,e,s]);return{workspaces:a.workspaces,loading:a.loading,error:a.error,fetchWorkspaces:f,refreshWorkspaces:p,refreshing:a.refreshing,currentWorkspace:a.currentWorkspace,setCurrentWorkspace:o,switchToWorkspace:i,resetCurrentWorkspace:l,createWorkspace:m,allFeatures:a.allFeatures,getFeatures:g,updateFeature:b,getWorkspace:k,updateWorkspace:h,getUsers:x,addUser:y,removeUser:v,updateUser:w,getProfile:j,updateUserProfile:S,deleteWorkspace:N,switching:null!==a.switchingToId,switchingToId:a.switchingToId}},ir=new Set;function lr(){ir.forEach(e=>e())}const cr=e=>{const{os:r,api:n}=sr(),a=o(r),[s,i]=t.useState(null),[l,c]=t.useState(!1),[d,u]=t.useState(null),f=t.useCallback(async()=>{if(e&&a){c(!0),u(null);try{const t=await n.getPublicPlans(e);i(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plans";u(r),De(t,{component:"usePublicPlans",action:"fetchPlans",metadata:{slug:e}})}finally{c(!1)}}else i(null)},[n,e,a]);t.useEffect(()=>{f()},[f]);const p=e&&!a||l;return{items:s?.items??[],plans:s?.plans??[],notes:s?.notes,loading:p,error:d,refetch:f}},dr=e=>{const{api:r}=sr(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,l]=t.useState(null),c=t.useCallback(async()=>{if(e){o(!0),l(null);try{const t=await r.getCurrentSubscription(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch subscription";l(r),De(t,{component:"useSubscription",action:"fetchSubscription",metadata:{workspaceId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{c()},[c]),{subscription:n,loading:s,error:i,refetch:c}},ur=(e,r)=>{const{api:n}=sr(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[l,c]=t.useState(null),d=t.useCallback(async()=>{if(e){i(!0),c(null);try{const t=r?await n.getPlanGroupByVersion(e,r):await n.getPlanGroup(e);s(t)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch plan group";c(n),De(t,{component:"usePlanGroup",action:"fetchPlanGroup",metadata:{workspaceId:e,groupVersionId:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{planGroup:a,loading:o,error:l,refetch:d}},fr=e=>{const{api:r}=sr(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,l]=t.useState(null),c=t.useCallback(async()=>{if(e){o(!0),l(null);try{const t=await r.getPlanGroupVersions(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group versions";l(r),De(t,{component:"usePlanGroupVersions",action:"fetchVersions",metadata:{workspaceId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{c()},[c]),{versions:n,loading:s,error:i,refetch:c}},pr=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{createCheckoutSession:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const n=await r.createCheckoutSession(e,t);return"trial_started"===n.type&&(Rt(),lr()),n}catch(r){const n=r instanceof Error?r.message:"Failed to create checkout session";throw o(n),De(r,{component:"useCreateCheckoutSession",action:"createCheckoutSession",metadata:{workspaceId:e,request:t}}),r}finally{a(!1)}},[r,e]),loading:n,error:s}},mr=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null),i=t.useCallback(async(t,n)=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const a={planVersionId:t,...n?.billingInterval&&{billingInterval:n.billingInterval},...n?.successUrl&&{successUrl:n.successUrl},...n?.cancelUrl&&{cancelUrl:n.cancelUrl}},s=await r.updateSubscription(e,a);return Rt(),s}catch(r){const a=r instanceof Error?r.message:"Failed to update subscription";throw o(a),De(r,{component:"useUpdateSubscription",action:"updateSubscription",metadata:{workspaceId:e,planVersionId:t,options:n}}),r}finally{a(!1)}},[r,e]);return{updateSubscription:i,loading:n,error:s}},hr=(e,r)=>{const n=dr(e),a=ur(e,r),s=mr(e),o=t.useCallback(async()=>{await Promise.all([n.refetch(),a.refetch()])},[n.refetch,a.refetch]);return{subscription:n.subscription,planGroup:a.planGroup,loading:n.loading||a.loading||s.loading,error:n.error||a.error||s.error,updateSubscription:s.updateSubscription,refetch:o}},gr=(e,r=10,n)=>{const{api:a}=sr(),[s,o]=t.useState([]),[i,l]=t.useState(!1),[c,d]=t.useState(!1),[u,f]=t.useState(null),p=t.useCallback(async()=>{if(!e)return o([]),void l(!1);d(!0),f(null);try{const t=await a.listInvoices(e,r,n);o(t.invoices||[]),l(t.has_more||!1)}catch(t){const a=t instanceof Error?t.message:"Failed to fetch invoices";f(a),De(t,{component:"useInvoices",action:"fetchInvoices",metadata:{workspaceId:e,limit:r,startingAfter:n}})}finally{d(!1)}},[a,e,r,n]);return t.useEffect(()=>{p()},[p]),{invoices:s,hasMore:i,loading:c,error:u,refetch:p}},br=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{openBillingPortal:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const n=t||window.location.href,a=await r.createBillingPortalSession(e,n);return a.url&&window.open(a.url,"_blank","noopener,noreferrer"),a}catch(t){const r=t instanceof Error?t.message:"Failed to open billing portal";throw o(r),De(t,{component:"useBillingPortal",action:"openBillingPortal",metadata:{workspaceId:e}}),t}finally{a(!1)}},[e,r]),loading:n,error:s}},xr=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{cancelSubscription:t.useCallback(async()=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const t=await r.cancelSubscriptionAtPeriodEnd(e);return Rt(),t}catch(t){const r=t instanceof Error?t.message:"Failed to cancel subscription";throw o(r),De(t,{component:"useCancelSubscription",action:"cancelSubscription",metadata:{workspaceId:e}}),t}finally{a(!1)}},[r,e]),loading:n,error:s}},yr=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{resumeSubscription:t.useCallback(async()=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const t=await r.resumeSubscription(e);return Rt(),t}catch(t){const r=t instanceof Error?t.message:"Failed to resume subscription";throw o(r),De(t,{component:"useResumeSubscription",action:"resumeSubscription",metadata:{workspaceId:e}}),t}finally{a(!1)}},[r,e]),loading:n,error:s}},vr=e=>{const{api:r}=sr(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,l]=t.useState(null),c=t.useCallback(async()=>{if(e){o(!0),l(null);try{const t=await r.getAllQuotaUsage(e);a(t.quotas)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch all quota usage";l(r),De(t,{component:"useAllQuotaUsage",action:"fetchAllUsage",metadata:{workspaceId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{c()},[c]),{quotas:n,loading:s,error:i,refetch:c}},wr=t.createContext(null);wr.displayName="SubscriptionContext";const Sr=t.memo(function({children:r}){const{currentWorkspace:n}=or(),{subscription:a,loading:s,error:o,refetch:i}=dr(n?._id);t.useEffect(()=>{return e=i,Tt.add(e),()=>{Tt.delete(e)};var e},[i]);const l=t.useMemo(()=>({response:a,loading:s,error:o,refetch:i}),[a,s,o,i]);return e.jsx(wr.Provider,{value:l,children:r})});function jr(){const e=t.useContext(wr);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 kr(e,r){const n=ct(),a=et(),s=Ct(),o=e||(e=>e);return Ve(t.useMemo(()=>({os:n,auth:a,workspaces:s}),[n,a,s]),o,r)}function Nr(){const e=tt(),r=dt(),n=At();return t.useMemo(()=>({auth:e,os:r,workspaces:n}),[e,r,n])}Sr.displayName="SubscriptionContextProvider";const Er=t.createContext(null);Er.displayName="QuotaUsageContext";const Cr=t.memo(function({children:r}){const{currentWorkspace:n}=or(),{quotas:a,loading:s,error:o,refetch:i}=vr(n?._id);t.useEffect(()=>{return e=i,ir.add(e),()=>{ir.delete(e)};var e},[i]);const l=t.useMemo(()=>({quotas:a,loading:s,error:o,refetch:i}),[a,s,o,i]);return e.jsx(Er.Provider,{value:l,children:r})});function Ar(){const e=t.useContext(Er);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}function _r(e,t){return function(){return e.apply(t,arguments)}}Cr.displayName="QuotaUsageContextProvider";const{toString:Tr}=Object.prototype,{getPrototypeOf:Rr}=Object,{iterator:Pr,toStringTag:Or}=Symbol,Ir=(Dr=Object.create(null),e=>{const t=Tr.call(e);return Dr[t]||(Dr[t]=t.slice(8,-1).toLowerCase())});var Dr;const Ur=e=>(e=e.toLowerCase(),t=>Ir(t)===e),Mr=e=>t=>typeof t===e,{isArray:Fr}=Array,zr=Mr("undefined");function Lr(e){return null!==e&&!zr(e)&&null!==e.constructor&&!zr(e.constructor)&&Vr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Wr=Ur("ArrayBuffer");const $r=Mr("string"),Vr=Mr("function"),Br=Mr("number"),Gr=e=>null!==e&&"object"==typeof e,Kr=e=>{if("object"!==Ir(e))return!1;const t=Rr(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Or in e||Pr in e)},Hr=Ur("Date"),Zr=Ur("File"),qr=Ur("Blob"),Jr=Ur("FileList"),Yr=Ur("URLSearchParams"),[Xr,Qr,en,tn]=["ReadableStream","Request","Response","Headers"].map(Ur);function rn(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),Fr(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(Lr(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),s=a.length;let o;for(n=0;n<s;n++)o=a[n],t.call(null,e[o],o,e)}}function nn(e,t){if(Lr(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 an="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,sn=e=>!zr(e)&&e!==an;const on=(ln="undefined"!=typeof Uint8Array&&Rr(Uint8Array),e=>ln&&e instanceof ln);var ln;const cn=Ur("HTMLFormElement"),dn=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),un=Ur("RegExp"),fn=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};rn(r,(r,a)=>{let s;!1!==(s=t(r,a,e))&&(n[a]=s||r)}),Object.defineProperties(e,n)};const pn=Ur("AsyncFunction"),mn=(hn="function"==typeof setImmediate,gn=Vr(an.postMessage),hn?setImmediate:gn?(bn=`axios@${Math.random()}`,xn=[],an.addEventListener("message",({source:e,data:t})=>{e===an&&t===bn&&xn.length&&xn.shift()()},!1),e=>{xn.push(e),an.postMessage(bn,"*")}):e=>setTimeout(e));var hn,gn,bn,xn;const yn="undefined"!=typeof queueMicrotask?queueMicrotask.bind(an):"undefined"!=typeof process&&process.nextTick||mn;var vn={isArray:Fr,isArrayBuffer:Wr,isBuffer:Lr,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Vr(e.append)&&("formdata"===(t=Ir(e))||"object"===t&&Vr(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Wr(e.buffer),t},isString:$r,isNumber:Br,isBoolean:e=>!0===e||!1===e,isObject:Gr,isPlainObject:Kr,isEmptyObject:e=>{if(!Gr(e)||Lr(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Xr,isRequest:Qr,isResponse:en,isHeaders:tn,isUndefined:zr,isDate:Hr,isFile:Zr,isBlob:qr,isRegExp:un,isFunction:Vr,isStream:e=>Gr(e)&&Vr(e.pipe),isURLSearchParams:Yr,isTypedArray:on,isFileList:Jr,forEach:rn,merge:function e(){const{caseless:t,skipUndefined:r}=sn(this)&&this||{},n={},a=(a,s)=>{const o=t&&nn(n,s)||s;Kr(n[o])&&Kr(a)?n[o]=e(n[o],a):Kr(a)?n[o]=e({},a):Fr(a)?n[o]=a.slice():r&&zr(a)||(n[o]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&rn(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(rn(t,(t,n)=>{r&&Vr(t)?Object.defineProperty(e,n,{value:_r(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,s,o;const i={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),s=a.length;s-- >0;)o=a[s],n&&!n(o,e,t)||i[o]||(t[o]=e[o],i[o]=!0);e=!1!==r&&Rr(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Ir,kindOfTest:Ur,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(Fr(e))return e;let t=e.length;if(!Br(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Pr]).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:dn,hasOwnProp:dn,reduceDescriptors:fn,freezeMethods:e=>{fn(e,(t,r)=>{if(Vr(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Vr(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 Fr(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:nn,global:an,isContextDefined:sn,isSpecCompliantForm:function(e){return!!(e&&Vr(e.append)&&"FormData"===e[Or]&&e[Pr])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Gr(e)){if(t.indexOf(e)>=0)return;if(Lr(e))return e;if(!("toJSON"in e)){t[n]=e;const a=Fr(e)?[]:{};return rn(e,(e,t)=>{const s=r(e,n+1);!zr(s)&&(a[t]=s)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:pn,isThenable:e=>e&&(Gr(e)||Vr(e))&&Vr(e.then)&&Vr(e.catch),setImmediate:mn,asap:yn,isIterable:e=>null!=e&&Vr(e[Pr])};let wn=class e extends Error{static from(t,r,n,a,s,o){const i=new e(t.message,r||t.code,n,a,s);return i.cause=t,i.name=t.name,o&&Object.assign(i,o),i}constructor(e,t,r,n,a){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:vn.toJSONObject(this.config),code:this.code,status:this.status}}};wn.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",wn.ERR_BAD_OPTION="ERR_BAD_OPTION",wn.ECONNABORTED="ECONNABORTED",wn.ETIMEDOUT="ETIMEDOUT",wn.ERR_NETWORK="ERR_NETWORK",wn.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",wn.ERR_DEPRECATED="ERR_DEPRECATED",wn.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",wn.ERR_BAD_REQUEST="ERR_BAD_REQUEST",wn.ERR_CANCELED="ERR_CANCELED",wn.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",wn.ERR_INVALID_URL="ERR_INVALID_URL";function Sn(e){return vn.isPlainObject(e)||vn.isArray(e)}function jn(e){return vn.endsWith(e,"[]")?e.slice(0,-2):e}function kn(e,t,r){return e?e.concat(t).map(function(e,t){return e=jn(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Nn=vn.toFlatObject(vn,{},null,function(e){return/^is[A-Z]/.test(e)});function En(e,t,r){if(!vn.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=vn.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!vn.isUndefined(t[e])})).metaTokens,a=r.visitor||c,s=r.dots,o=r.indexes,i=(r.Blob||"undefined"!=typeof Blob&&Blob)&&vn.isSpecCompliantForm(t);if(!vn.isFunction(a))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(vn.isDate(e))return e.toISOString();if(vn.isBoolean(e))return e.toString();if(!i&&vn.isBlob(e))throw new wn("Blob is not supported. Use a Buffer instead.");return vn.isArrayBuffer(e)||vn.isTypedArray(e)?i&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,a){let i=e;if(e&&!a&&"object"==typeof e)if(vn.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(vn.isArray(e)&&function(e){return vn.isArray(e)&&!e.some(Sn)}(e)||(vn.isFileList(e)||vn.endsWith(r,"[]"))&&(i=vn.toArray(e)))return r=jn(r),i.forEach(function(e,n){!vn.isUndefined(e)&&null!==e&&t.append(!0===o?kn([r],n,s):null===o?r:r+"[]",l(e))}),!1;return!!Sn(e)||(t.append(kn(a,r,s),l(e)),!1)}const d=[],u=Object.assign(Nn,{defaultVisitor:c,convertValue:l,isVisitable:Sn});if(!vn.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!vn.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),vn.forEach(r,function(r,s){!0===(!(vn.isUndefined(r)||null===r)&&a.call(t,r,vn.isString(s)?s.trim():s,n,u))&&e(r,n?n.concat(s):[s])}),d.pop()}}(e),t}function Cn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function An(e,t){this._pairs=[],e&&En(e,this,t)}const _n=An.prototype;function Tn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Rn(e,t,r){if(!t)return e;const n=r&&r.encode||Tn,a=vn.isFunction(r)?{serialize:r}:r,s=a&&a.serialize;let o;if(o=s?s(t,a):vn.isURLSearchParams(t)?t.toString():new An(t,a).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}_n.append=function(e,t){this._pairs.push([e,t])},_n.toString=function(e){const t=e?function(t){return e.call(this,t,Cn)}:Cn;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Pn{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){vn.forEach(this.handlers,function(t){null!==t&&e(t)})}}var On={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},In={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:An,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Dn="undefined"!=typeof window&&"undefined"!=typeof document,Un="object"==typeof navigator&&navigator||void 0,Mn=Dn&&(!Un||["ReactNative","NativeScript","NS"].indexOf(Un.product)<0),Fn="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,zn=Dn&&window.location.href||"http://localhost";var Ln={...Object.freeze({__proto__:null,hasBrowserEnv:Dn,hasStandardBrowserEnv:Mn,hasStandardBrowserWebWorkerEnv:Fn,navigator:Un,origin:zn}),...In};function Wn(e){function t(e,r,n,a){let s=e[a++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),i=a>=e.length;if(s=!s&&vn.isArray(n)?n.length:s,i)return vn.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&vn.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],a)&&vn.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let s;for(n=0;n<a;n++)s=r[n],t[s]=e[s];return t}(n[s])),!o}if(vn.isFormData(e)&&vn.isFunction(e.entries)){const r={};return vn.forEachEntry(e,(e,n)=>{t(function(e){return vn.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const $n={transitional:On,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=vn.isObject(e);a&&vn.isHTMLForm(e)&&(e=new FormData(e));if(vn.isFormData(e))return n?JSON.stringify(Wn(e)):e;if(vn.isArrayBuffer(e)||vn.isBuffer(e)||vn.isStream(e)||vn.isFile(e)||vn.isBlob(e)||vn.isReadableStream(e))return e;if(vn.isArrayBufferView(e))return e.buffer;if(vn.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return En(e,new Ln.classes.URLSearchParams,{visitor:function(e,t,r,n){return Ln.isNode&&vn.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=vn.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return En(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(vn.isString(e))try{return(t||JSON.parse)(e),vn.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||$n.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(vn.isResponse(e)||vn.isReadableStream(e))return e;if(e&&vn.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 wn.from(e,wn.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:Ln.classes.FormData,Blob:Ln.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};vn.forEach(["delete","get","head","post","put","patch"],e=>{$n.headers[e]={}});const Vn=vn.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 Bn=Symbol("internals");function Gn(e){return e&&String(e).trim().toLowerCase()}function Kn(e){return!1===e||null==e?e:vn.isArray(e)?e.map(Kn):String(e)}function Hn(e,t,r,n,a){return vn.isFunction(n)?n.call(this,t,r):(a&&(t=r),vn.isString(t)?vn.isString(n)?-1!==t.indexOf(n):vn.isRegExp(n)?n.test(t):void 0:void 0)}let Zn=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=Gn(t);if(!a)throw new Error("header name must be a non-empty string");const s=vn.findKey(n,a);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=Kn(e))}const s=(e,t)=>vn.forEach(e,(e,r)=>a(e,r,t));if(vn.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(vn.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let r,n,a;return e&&e.split("\n").forEach(function(e){a=e.indexOf(":"),r=e.substring(0,a).trim().toLowerCase(),n=e.substring(a+1).trim(),!r||t[r]&&Vn[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(vn.isObject(e)&&vn.isIterable(e)){let r,n,a={};for(const t of e){if(!vn.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?vn.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}s(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=Gn(e)){const r=vn.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(vn.isFunction(t))return t.call(this,e,r);if(vn.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Gn(e)){const r=vn.findKey(this,e);return!(!r||void 0===this[r]||t&&!Hn(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=Gn(e)){const a=vn.findKey(r,e);!a||t&&!Hn(0,r[a],a,t)||(delete r[a],n=!0)}}return vn.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&&!Hn(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return vn.forEach(this,(n,a)=>{const s=vn.findKey(r,a);if(s)return t[s]=Kn(n),void delete t[a];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();o!==a&&delete t[a],t[o]=Kn(n),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return vn.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&vn.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[Bn]=this[Bn]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Gn(e);t[n]||(!function(e,t){const r=vn.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 vn.isArray(e)?e.forEach(n):n(e),this}};function qn(e,t){const r=this||$n,n=t||r,a=Zn.from(n.headers);let s=n.data;return vn.forEach(e,function(e){s=e.call(r,s,a.normalize(),t?t.status:void 0)}),a.normalize(),s}function Jn(e){return!(!e||!e.__CANCEL__)}Zn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),vn.reduceDescriptors(Zn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),vn.freezeMethods(Zn);let Yn=class extends wn{constructor(e,t,r){super(null==e?"canceled":e,wn.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Xn(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new wn("Request failed with status code "+r.status,[wn.ERR_BAD_REQUEST,wn.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const Qn=(e,t,r=3)=>{let n=0;const a=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a,s=0,o=0;return t=void 0!==t?t:1e3,function(i){const l=Date.now(),c=n[o];a||(a=l),r[s]=i,n[s]=l;let d=o,u=0;for(;d!==s;)u+=r[d++],d%=e;if(s=(s+1)%e,s===o&&(o=(o+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,s=1e3/t;const o=(t,s=Date.now())=>{a=s,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),i=t-a;i>=s?o(e,t):(r=e,n||(n=setTimeout(()=>{n=null,o(r)},s-i)))},()=>r&&o(r)]}(r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,i=s-n,l=a(i);n=s;e({loaded:s,total:o,progress:o?s/o:void 0,bytes:i,rate:l||void 0,estimated:l&&o&&s<=o?(o-s)/l:void 0,event:r,lengthComputable:null!=o,[t?"download":"upload"]:!0})},r)},ea=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},ta=e=>(...t)=>vn.asap(()=>e(...t));var ra=Ln.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Ln.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Ln.origin),Ln.navigator&&/(msie|trident)/i.test(Ln.navigator.userAgent)):()=>!0,na=Ln.hasStandardBrowserEnv?{write(e,t,r,n,a,s,o){if("undefined"==typeof document)return;const i=[`${e}=${encodeURIComponent(t)}`];vn.isNumber(r)&&i.push(`expires=${new Date(r).toUTCString()}`),vn.isString(n)&&i.push(`path=${n}`),vn.isString(a)&&i.push(`domain=${a}`),!0===s&&i.push("secure"),vn.isString(o)&&i.push(`SameSite=${o}`),document.cookie=i.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function aa(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 Zn?{...e}:e;function oa(e,t){t=t||{};const r={};function n(e,t,r,n){return vn.isPlainObject(e)&&vn.isPlainObject(t)?vn.merge.call({caseless:n},e,t):vn.isPlainObject(t)?vn.merge({},t):vn.isArray(t)?t.slice():t}function a(e,t,r,a){return vn.isUndefined(t)?vn.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function s(e,t){if(!vn.isUndefined(t))return n(void 0,t)}function o(e,t){return vn.isUndefined(t)?vn.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function i(r,a,s){return s in t?n(r,a):s in e?n(void 0,r):void 0}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:i,headers:(e,t,r)=>a(sa(e),sa(t),0,!0)};return vn.forEach(Object.keys({...e,...t}),function(n){const s=l[n]||a,o=s(e[n],t[n],n);vn.isUndefined(o)&&s!==i||(r[n]=o)}),r}var ia=e=>{const t=oa({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:i}=t;if(t.headers=o=Zn.from(o),t.url=Rn(aa(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),i&&o.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):""))),vn.isFormData(r))if(Ln.hasStandardBrowserEnv||Ln.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(vn.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&o.set(e,r)})}if(Ln.hasStandardBrowserEnv&&(n&&vn.isFunction(n)&&(n=n(t)),n||!1!==n&&ra(t.url))){const e=a&&s&&na.read(s);e&&o.set(a,e)}return t};var la="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=ia(e);let a=n.data;const s=Zn.from(n.headers).normalize();let o,i,l,c,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){c&&c(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=Zn.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());Xn(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 wn("Request aborted",wn.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new wn(n,wn.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||On;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new wn(t,a.clarifyTimeoutError?wn.ETIMEDOUT:wn.ECONNABORTED,e,h)),h=null},void 0===a&&s.setContentType(null),"setRequestHeader"in h&&vn.forEach(s.toJSON(),function(e,t){h.setRequestHeader(t,e)}),vn.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([l,d]=Qn(p,!0),h.addEventListener("progress",l)),f&&h.upload&&([i,c]=Qn(f),h.upload.addEventListener("progress",i),h.upload.addEventListener("loadend",c)),(n.cancelToken||n.signal)&&(o=t=>{h&&(r(!t||t.type?new Yn(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===Ln.protocols.indexOf(b)?r(new wn("Unsupported protocol "+b+":",wn.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,o();const t=e instanceof Error?e:this.reason;n.abort(t instanceof wn?t:new Yn(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,a(new wn(`timeout of ${t}ms exceeded`,wn.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:i}=n;return i.unsubscribe=()=>vn.asap(o),i}},da=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},ua=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()}},fa=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of ua(e))yield*da(r,t)}(e,t);let s,o=0,i=e=>{s||(s=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return i(),void e.close();let s=n.byteLength;if(r){let e=o+=s;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw i(e),e}},cancel:e=>(i(e),a.return())},{highWaterMark:2})},{isFunction:pa}=vn,ma=(({Request:e,Response:t})=>({Request:e,Response:t}))(vn.global),{ReadableStream:ha,TextEncoder:ga}=vn.global,ba=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},xa=e=>{e=vn.merge.call({skipUndefined:!0},ma,e);const{fetch:t,Request:r,Response:n}=e,a=t?pa(t):"function"==typeof fetch,s=pa(r),o=pa(n);if(!a)return!1;const i=a&&pa(ha),l=a&&("function"==typeof ga?(c=new ga,e=>c.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var c;const d=s&&i&&ba(()=>{let e=!1;const t=new r(Ln.origin,{body:new ha,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=o&&i&&ba(()=>vn.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 wn(`Response type '${e}' is not supported`,wn.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=vn.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(vn.isBlob(e))return e.size;if(vn.isSpecCompliantForm(e)){const t=new r(Ln.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return vn.isArrayBufferView(e)||vn.isArrayBuffer(e)?e.byteLength:(vn.isURLSearchParams(e)&&(e+=""),vn.isString(e)?(await l(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:o,data:i,signal:l,cancelToken:c,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:b,headers:x,withCredentials:y="same-origin",fetchOptions:v}=ia(e),w=t||fetch;b=b?(b+"").toLowerCase():"text";let S=ca([l,c&&c.toAbortSignal()],m),j=null;const k=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let N;try{if(g&&d&&"get"!==o&&"head"!==o&&0!==(N=await p(x,i))){let e,t=new r(a,{method:"POST",body:i,duplex:"half"});if(vn.isFormData(i)&&(e=t.headers.get("content-type"))&&x.setContentType(e),t.body){const[e,r]=ea(N,Qn(ta(g)));i=fa(t.body,65536,e,r)}}vn.isString(y)||(y=y?"include":"omit");const t=s&&"credentials"in r.prototype,l={...v,signal:S,method:o.toUpperCase(),headers:x.normalize().toJSON(),body:i,duplex:"half",credentials:t?y:void 0};j=s&&new r(a,l);let c=await(s?w(j,v):w(a,l));const m=u&&("stream"===b||"response"===b);if(u&&(h||m&&k)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=c[t]});const t=vn.toFiniteNumber(c.headers.get("content-length")),[r,a]=h&&ea(t,Qn(ta(h),!0))||[];c=new n(fa(c.body,65536,r,()=>{a&&a(),k&&k()}),e)}b=b||"text";let E=await f[vn.findKey(f,b)||"text"](c,e);return!m&&k&&k(),await new Promise((t,r)=>{Xn(t,r,{data:E,headers:Zn.from(c.headers),status:c.status,statusText:c.statusText,config:e,request:j})})}catch(t){if(k&&k(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new wn("Network Error",wn.ERR_NETWORK,e,j),{cause:t.cause||t});throw wn.from(t,t&&t.code,e,j)}}},ya=new Map,va=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,s=[n,a,r];let o,i,l=s.length,c=ya;for(;l--;)o=s[l],i=c.get(o),void 0===i&&c.set(o,i=l?new Map:xa(t)),c=i;return i};va();const wa={http:null,xhr:la,fetch:{get:va}};vn.forEach(wa,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Sa=e=>`- ${e}`,ja=e=>vn.isFunction(e)||null===e||!1===e;var ka={getAdapter:function(e,t){e=vn.isArray(e)?e:[e];const{length:r}=e;let n,a;const s={};for(let o=0;o<r;o++){let r;if(n=e[o],a=n,!ja(n)&&(a=wa[(r=String(n)).toLowerCase()],void 0===a))throw new wn(`Unknown adapter '${r}'`);if(a&&(vn.isFunction(a)||(a=a.get(t))))break;s[r||"#"+o]=a}if(!a){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=r?e.length>1?"since :\n"+e.map(Sa).join("\n"):" "+Sa(e[0]):"as no adapter specified";throw new wn("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:wa};function Na(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Yn(null,e)}function Ea(e){Na(e),e.headers=Zn.from(e.headers),e.data=qn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ka.getAdapter(e.adapter||$n.adapter,e)(e).then(function(t){return Na(e),t.data=qn.call(e,e.transformResponse,t),t.headers=Zn.from(t.headers),t},function(t){return Jn(t)||(Na(e),t&&t.response&&(t.response.data=qn.call(e,e.transformResponse,t.response),t.response.headers=Zn.from(t.response.headers))),Promise.reject(t)})}const Ca="1.13.4",Aa={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Aa[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const _a={};Aa.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Ca+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,s)=>{if(!1===e)throw new wn(n(a," has been removed"+(t?" in "+t:"")),wn.ERR_DEPRECATED);return t&&!_a[a]&&(_a[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,s)}},Aa.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Ta={assertOptions:function(e,t,r){if("object"!=typeof e)throw new wn("options must be an object",wn.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const s=n[a],o=t[s];if(o){const t=e[s],r=void 0===t||o(t,s,e);if(!0!==r)throw new wn("option "+s+" must be "+r,wn.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new wn("Unknown option "+s,wn.ERR_BAD_OPTION)}},validators:Aa};const Ra=Ta.validators;let Pa=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Pn,response:new Pn}}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=oa(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&Ta.assertOptions(r,{silentJSONParsing:Ra.transitional(Ra.boolean),forcedJSONParsing:Ra.transitional(Ra.boolean),clarifyTimeoutError:Ra.transitional(Ra.boolean)},!1),null!=n&&(vn.isFunction(n)?t.paramsSerializer={serialize:n}:Ta.assertOptions(n,{encode:Ra.function,serialize:Ra.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ta.assertOptions(t,{baseUrl:Ra.spelling("baseURL"),withXsrfToken:Ra.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=a&&vn.merge(a.common,a[t.method]);a&&vn.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=Zn.concat(s,a);const o=[];let i=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const l=[];let c;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let d,u=0;if(!i){const e=[Ea.bind(this),void 0];for(e.unshift(...o),e.push(...l),d=e.length,c=Promise.resolve(t);u<d;)c=c.then(e[u++],e[u++]);return c}d=o.length;let f=t;for(;u<d;){const e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{c=Ea.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 Rn(aa((e=oa(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};vn.forEach(["delete","get","head","options"],function(e){Pa.prototype[e]=function(t,r){return this.request(oa(r||{},{method:e,url:t,data:(r||{}).data}))}}),vn.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(oa(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Pa.prototype[e]=t(),Pa.prototype[e+"Form"]=t(!0)});const Oa={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(Oa).forEach(([e,t])=>{Oa[t]=e});const Ia=function e(t){const r=new Pa(t),n=_r(Pa.prototype.request,r);return vn.extend(n,Pa.prototype,r,{allOwnKeys:!0}),vn.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(oa(t,r))},n}($n);Ia.Axios=Pa,Ia.CanceledError=Yn,Ia.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 Yn(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}}},Ia.isCancel=Jn,Ia.VERSION=Ca,Ia.toFormData=En,Ia.AxiosError=wn,Ia.Cancel=Ia.CanceledError,Ia.all=function(e){return Promise.all(e)},Ia.spread=function(e){return function(t){return e.apply(null,t)}},Ia.isAxiosError=function(e){return vn.isObject(e)&&!0===e.isAxiosError},Ia.mergeConfig=oa,Ia.AxiosHeaders=Zn,Ia.formToJSON=e=>Wn(vn.isHTMLForm(e)?new FormData(e):e),Ia.getAdapter=ka.getAdapter,Ia.HttpStatusCode=Oa,Ia.default=Ia;const{Axios:Da,AxiosError:Ua,CanceledError:Ma,isCancel:Fa,CancelToken:za,VERSION:La,all:Wa,Cancel:$a,isAxiosError:Va,spread:Ba,toFormData:Ga,AxiosHeaders:Ka,HttpStatusCode:Ha,formToJSON:Za,getAdapter:qa,mergeConfig:Ja}=Ia;const Ya=new class{constructor(e={}){if(e.baseURL)try{new URL(e.baseURL)}catch{throw new Error(`[BuildBase SDK] Invalid baseURL: "${e.baseURL}"`)}this.client=Ia.create({baseURL:e.baseURL||"",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json",...e.headers}}),this.client.interceptors.request.use(e=>{const t=Vt();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 Xa=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 Qa(){return kr(e=>e.auth)}function es(){const e=Nr(),r=Qa(),n=Jt(),{serverUrl:a,orgId:s,auth:o}=n,{resetCurrentWorkspace:i,currentWorkspace:l}=or(),c=t.useCallback(async()=>{e.auth(Fe());try{const t=await Ya.post(`${a}/api/v1/auth/request`,{orgId:s,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(Le()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(Le()),De(t,{component:"useSaaSAuth",action:"signIn"}),t}},[a,s,o,e]),d=t.useCallback(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut()}catch(e){De(e,{component:"useSaaSAuth",action:"signOut"})}finally{$t(),e.auth($e()),i()}},[e,i,o?.callbacks?.onSignOut]),u=t.useCallback(e=>{l?Xa.openWorkspaceSettings(e):De(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[l]),f=t.useMemo(()=>Ke(r.status),[r.status]);return t.useMemo(()=>({user:r.session?.user,session:r.session,status:r.status,...f,signIn:c,signOut:d,openWorkspaceSettings:u}),[r.session,r.status,f,c,d,u])}class ts extends Zt{constructor(e){super({...e,requireOrgId:!0})}async getVapidPublicKey(){return this.fetchJson("push/vapid-public-key")}async subscribe(e,t){await this.fetchJson("push/subscribe",{method:"POST",body:JSON.stringify({endpoint:e.endpoint,keys:e.keys,userAgent:t})})}async unsubscribe(e){await this.fetchJson("push/unsubscribe",{method:"DELETE",body:JSON.stringify({endpoint:e})})}}const rs=t.createContext(null);function ns(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),n=new Uint8Array(r.length);for(let e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return n}const as=t.memo(function({children:r,serviceWorkerPath:n="/push-sw.js",autoSubscribe:a=!1}){const s=Jt(),{isAuthenticated:o}=es(),i="undefined"!=typeof window&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window,l=t.useMemo(()=>new ts({serverUrl:s.serverUrl,version:s.version,orgId:s.orgId,requireOrgId:!0}),[s.serverUrl,s.version,s.orgId]),[c,d]=t.useState({permission:i?Notification.permission:"default",isSubscribed:!1,isSupported:i,loading:!1,error:null});t.useEffect(()=>{o&&i&&async function(){try{const e=await navigator.serviceWorker.getRegistration(n);if(!e)return void d(e=>({...e,isSubscribed:!1}));const t=await e.pushManager.getSubscription();d(e=>({...e,isSubscribed:!!t,permission:Notification.permission}))}catch{d(e=>({...e,isSubscribed:!1}))}}()},[o,i]);const u=t.useCallback(async()=>{if(!i)return!1;const e=await Notification.requestPermission();return d(t=>({...t,permission:e})),"granted"===e},[i]),f=t.useCallback(async()=>{if(i&&o){d(e=>({...e,loading:!0,error:null}));try{if(!await u())return void d(e=>({...e,loading:!1,error:"Notification permission denied"}));const{publicKey:e}=await l.getVapidPublicKey(),t=await navigator.serviceWorker.register(n);await navigator.serviceWorker.ready;const r=(await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:ns(e)})).toJSON();await l.subscribe({endpoint:r.endpoint,keys:{p256dh:r.keys.p256dh,auth:r.keys.auth}},navigator.userAgent),d(e=>({...e,isSubscribed:!0,loading:!1}))}catch(e){const t=e instanceof Error?e.message:"Failed to subscribe to push notifications";d(e=>({...e,loading:!1,error:t})),De(e,{component:"PushNotificationProvider",action:"subscribe"})}}},[i,o,l,n,u]),p=t.useCallback(async()=>{if(i){d(e=>({...e,loading:!0,error:null}));try{const e=await navigator.serviceWorker.getRegistration(n);if(e){const t=await e.pushManager.getSubscription();if(t){const e=t.endpoint;await t.unsubscribe(),await l.unsubscribe(e)}}d(e=>({...e,isSubscribed:!1,loading:!1}))}catch(e){const t=e instanceof Error?e.message:"Failed to unsubscribe";d(e=>({...e,loading:!1,error:t})),De(e,{component:"PushNotificationProvider",action:"unsubscribe"})}}},[i,l,n]),m=t.useMemo(()=>({...c,requestPermission:u,subscribe:f,unsubscribe:p}),[c,u,f,p]);return e.jsx(rs.Provider,{value:m,children:r})});function ss(){const e=t.useContext(rs);if(!e)throw new Error("usePushNotifications must be used within PushNotificationProvider");return e}class os extends Zt{constructor(e){super(e)}async getProfile(e,t){return this.fetchJson("profile",{headers:{"x-session-id":e},signal:t},"Failed to fetch user profile")}}const is=t.memo(({children:r,callbacks:n})=>{const a=Nr(),s=Qa(),i=Jt(),l=Ke(s.status).isAuthenticated,c=t.useRef(!1),d=t.useRef(null),u=t.useRef(!1),f=t.useMemo(()=>n,[n]),p=t.useCallback(async e=>{try{if(f?.handleAuthentication){const{sessionId:t}=await f.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=i;if(!o(r))throw new Error("OS configuration is not available");const{serverUrl:n,version:s,orgId:l}=r,c=new os({serverUrl:n,version:s}),d=await c.getProfile(t),u=Kt(Lt(d,l,r.auth?.clientId||""),t);Wt(u.sessionId),a.auth(We(u)),function(){if("undefined"!=typeof window)try{const e=new URL(window.location.href);e.searchParams.delete(Mt),window.history.replaceState({},"",e.toString())}catch(e){De(e,{component:"auth/utils",action:"removeTokenFromUrl",metadata:{param:Mt}})}}()}}catch(t){throw De(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),a.auth(Le()),t}},[a,f,i]);return Ot(async e=>{if("undefined"==typeof window)return;if(l)return;if(u.current)return;if(Gt())return;const t=Vt();if(t){u.current=!0;try{if(!o(i))return u.current=!1,void De(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});const{orgId:r}=i;let n;try{const r=new os({serverUrl:i.serverUrl,version:i.version});n=await r.getProfile(t,e)}catch(e){if(!Ue(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"fetchProfile"}}))return;return u.current=!1,$t(),void a.auth(Le())}const s=Kt(Lt(n,r,i.auth?.clientId||""),t);Wt(s.sessionId),a.auth(We(s))}catch(e){if(!Ue(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:e instanceof Error&&("User data missing required ID field"===e.message||"User data missing required email field"===e.message)?"validateUserData":"pageLoad"}}))return;$t(),a.auth(Le())}finally{u.current=!1}}else a.auth(Le())},[l,a,i]),t.useEffect(()=>{const e=Gt();if(!e)return;if(c.current||d.current===e)return;if(!o(i))return;c.current=!0,d.current=e;let t=!1;return a.auth(ze()),p(e).then(()=>{t||(d.current=null)}).catch(e=>{t||(De(e,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{hasCode:!0}}),d.current=null)}).finally(()=>{c.current=!1}),()=>{t=!0}},[p,i.serverUrl,i.version,i.orgId]),e.jsx(e.Fragment,{children:r})});is.displayName="AuthProviderWrapper";const ls=t.memo(({config:r,auth:n,children:a})=>{const s=Nr(),i=Jt(),l=t.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);t.useEffect(()=>{s.os(rt({...r,auth:l}))},[r,l,s]);const c=t.useMemo(()=>o(i)?new qt(i):null,[i.serverUrl,i.version,i.orgId]);return Ot(async e=>{if(!c||i.settings)return;const t=await c.getSettings(e);s.os(nt(t))},[c,i.settings,s],{onError:e=>De(e,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:i.serverUrl,version:i.version,orgId:i.orgId}})}),e.jsx(e.Fragment,{children:a})});ls.displayName="ContextConfigProvider";const cs=t.createContext({container:null,setContainer:()=>{}}),ds=t.memo(({children:r})=>{const[n,a]=t.useState(null),s=t.useMemo(()=>({container:n,setContainer:a}),[n]),o=t.useMemo(()=>r,[r]);return e.jsxs(cs.Provider,{value:s,children:[o,e.jsx("div",{ref:a,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});ds.displayName="PortalProvider";class us extends Zt{constructor(e){super(e)}async getAttributes(e){const t=await this.fetchResponse("users/attributes",{signal:e});if(!t.ok)throw new Error(await Te(t,"Failed to fetch user attributes"));const r=await t.json();return r&&"object"==typeof r&&!Array.isArray(r)?r:{}}async updateAttributes(e){return this.fetchJson("users/attributes",{method:"PATCH",body:JSON.stringify({attributes:e})},"Failed to update user attributes")}async updateAttribute(e,t){return this.fetchJson(`users/attributes/${e}`,{method:"PATCH",body:JSON.stringify({value:t})},"Failed to update user attribute")}async getFeatures(e){const t=await this.fetchResponse("users/features",{signal:e});if(!t.ok)throw new Error(await Te(t,"Failed to fetch user features"));const r=await t.json();return"object"==typeof r&&null!==r?r:{}}}const fs=t.createContext(void 0),ps=t.memo(({children:r})=>{const n=Jt(),a=function(){const e=Jt();return t.useMemo(()=>new us(e),[e.serverUrl,e.version])}(),{isAuthenticated:s}=es(),{serverUrl:o,version:i}=n,[l,c]=t.useState({}),[d,u]=t.useState({}),[f,p]=t.useState(!1),[m,h]=t.useState(null),g=t.useCallback(async e=>{if(o&&i&&s)try{const t=await a.getAttributes(e);c(t)}catch(e){if(Ae(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user attributes");h(t),De(e,{component:"UserProvider",action:"fetchAttributes"})}else c({})},[a,o,i,s]),b=t.useCallback(async()=>{if(o&&i&&s){p(!0),h(null);try{await g()}finally{p(!1)}}},[o,i,s,g]),x=t.useCallback(async e=>{p(!0),h(null);try{const t=await a.updateAttributes(e);return await g(),t}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw h(r),De(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),t}finally{p(!1)}},[a,g]),y=t.useCallback(async(e,t)=>{p(!0),h(null);try{const r=await a.updateAttribute(e,t);return await g(),r}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw h(n),De(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),r}finally{p(!1)}},[a,g]),v=t.useCallback(async e=>{if(o&&i&&s)try{const t=await a.getFeatures(e);u(t)}catch(e){if(Ae(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user features");h(t),De(e,{component:"UserProvider",action:"fetchFeatures"})}else u({})},[a,o,i,s]),w=t.useCallback(async()=>{if(o&&i&&s){p(!0),h(null);try{await v()}finally{p(!1)}}},[o,i,s,v]);Ot(async e=>{if(!s||!o||!i)return c({}),void u({});p(!0),h(null);try{await Promise.all([g(e),v(e)])}finally{p(!1)}},[s,o,i,g,v],{onError:e=>De(e,{component:"UserProvider",action:"initialFetch",metadata:{step:"fetchAttributesAndFeatures"}})});const S=t.useMemo(()=>({attributes:l,features:d,isLoading:f,error:m,updateAttributes:x,updateAttribute:y,refreshAttributes:b,refreshFeatures:w}),[l,d,f,m,x,y,b,w]);return e.jsx(fs.Provider,{value:S,children:r})});ps.displayName="UserProvider";const ms=t.lazy(()=>Promise.resolve().then(function(){return tN}).then(e=>({default:e.default}))),hs=({children:r})=>{const{currentWorkspace:n}=or(),[a,s]=t.useState(!1),[o,i]=t.useState("profile");return t.useEffect(()=>{const e=Xa.getState();s(e.open),i(e.section);return Xa.subscribe((e,t)=>{s(e),i(t)})},[]),e.jsxs(e.Fragment,{children:[r,n&&a&&e.jsx(t.Suspense,{fallback:null,children:e.jsx(ms,{workspace:n,open:a,onOpenChange:e=>{e||Xa.closeSettings()},section:o,onSectionChange:e=>{Xa.setSection(e)},showTrigger:!1})})]})},gs=(e,t,r)=>{if(t!==exports.ApiVersion.V1)throw new Error(`Invalid version: "${t}". Only "${exports.ApiVersion.V1}" is currently supported.`);if(!e||"string"!=typeof e)throw new Error("serverUrl is required and must be a string");if(!(e=>{try{return new URL(e),!0}catch{return!1}})(e))throw new Error(`Invalid serverUrl: "${e}". Must be a valid URL.`);if(!r||"string"!=typeof r)throw new Error("orgId is required and must be a string");if(!/^[0-9a-fA-F]{24}$/.test(r))throw new Error(`Invalid orgId: "${r}". Must be a valid MongoDB ObjectId (24 hexadecimal characters).`)},bs=t.memo(({serverUrl:r,version:n,orgId:a,auth:s,children:o})=>{gs(r,n,a);const i=t.useMemo(()=>({serverUrl:r,version:n,orgId:a}),[r,n,a]),l=t.useMemo(()=>s?.callbacks,[s?.callbacks?.handleAuthentication,s?.callbacks?.onSignOut,s?.callbacks?.handleEvent,s?.callbacks?.onWorkspaceChange]),c=s?.callbacks?.handleEvent;return t.useEffect(()=>(Pt.setCallbacks(c?{handleEvent:c}:null),()=>{Pt.setCallbacks(null)}),[c]),e.jsx(_t,{children:e.jsx(is,{callbacks:l,children:e.jsx(ds,{children:e.jsx(ls,{config:i,auth:s,children:e.jsx(ps,{children:e.jsx(Sr,{children:e.jsx(Cr,{children:e.jsx(as,{children:e.jsx(hs,{children:o})})})})})})})})})});bs.displayName="SaaSOSProviderInner";const xs=({children:t,...r})=>e.jsx(Me,{children:e.jsx(bs,{...r,children:t})});xs.displayName="SaaSOSProvider";var ys=e=>"checkbox"===e.type,vs=e=>e instanceof Date,ws=e=>null==e;const Ss=e=>"object"==typeof e;var js=e=>!ws(e)&&!Array.isArray(e)&&Ss(e)&&!vs(e),ks=e=>js(e)&&e.target?ys(e.target)?e.target.checked:e.target.value:e,Ns=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Es="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Cs(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(Es&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||js(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return js(t)&&t.hasOwnProperty("isPrototypeOf")})(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=Cs(e[t]));return n}var As=e=>/^\w*$/.test(e),_s=e=>void 0===e,Ts=e=>Array.isArray(e)?e.filter(Boolean):[],Rs=e=>Ts(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ps=(e,t,r)=>{if(!t||!js(e))return r;const n=(As(t)?[t]:Rs(t)).reduce((e,t)=>ws(e)?e:e[t],e);return _s(n)||n===e?_s(e[t])?r:e[t]:n},Os=e=>"boolean"==typeof e,Is=e=>"function"==typeof e,Ds=(e,t,r)=>{let n=-1;const a=As(t)?[t]:Rs(t),s=a.length,o=s-1;for(;++n<s;){const t=a[n];let s=r;if(n!==o){const r=e[t];s=js(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};const Us="blur",Ms="focusout",Fs="change",zs="onBlur",Ls="onChange",Ws="onSubmit",$s="onTouched",Vs="all",Bs="max",Gs="min",Ks="maxLength",Hs="minLength",Zs="pattern",qs="required",Js="validate",Ys=t.createContext(null);Ys.displayName="HookFormControlContext";const Xs=()=>t.useContext(Ys);var Qs=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const a=s;return t._proxyFormState[a]!==Vs&&(t._proxyFormState[a]=!n||Vs),r&&(r[a]=!0),e[a]}});return a};const eo="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;var to=e=>"string"==typeof e,ro=(e,t,r,n,a)=>to(e)?(n&&t.watch.add(e),Ps(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Ps(r,e))):(n&&(t.watchAll=!0),r),no=e=>ws(e)||!Ss(e);function ao(e,t,r=new WeakSet){if(no(e)||no(t))return Object.is(e,t);if(vs(e)&&vs(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const n=e[s];if(!a.includes(s))return!1;if("ref"!==s){const e=t[s];if(vs(n)&&vs(e)||js(n)&&js(e)||Array.isArray(n)&&Array.isArray(e)?!ao(n,e,r):!Object.is(n,e))return!1}}return!0}function so(e){const r=Xs(),{name:n,disabled:a,control:s=r,shouldUnregister:o,defaultValue:i,exact:l=!0}=e,c=Ns(s._names.array,n),d=t.useMemo(()=>Ps(s._formValues,n,Ps(s._defaultValues,n,i)),[s,n,i]),u=function(e){const r=Xs(),{control:n=r,name:a,defaultValue:s,disabled:o,exact:i,compute:l}=e||{},c=t.useRef(s),d=t.useRef(l),u=t.useRef(void 0),f=t.useRef(n),p=t.useRef(a);d.current=l;const[m,h]=t.useState(()=>{const e=n._getWatch(a,c.current);return d.current?d.current(e):e}),g=t.useCallback(e=>{const t=ro(a,n._names,e||n._formValues,!1,c.current);return d.current?d.current(t):t},[n._formValues,n._names,a]),b=t.useCallback(e=>{if(!o){const t=ro(a,n._names,e||n._formValues,!1,c.current);if(d.current){const e=d.current(t);ao(e,u.current)||(h(e),u.current=e)}else h(t)}},[n._formValues,n._names,o,a]);eo(()=>(f.current===n&&ao(p.current,a)||(f.current=n,p.current=a,b()),n._subscribe({name:a,formState:{values:!0},exact:i,callback:e=>{b(e.values)}})),[n,i,a,b]),t.useEffect(()=>n._removeUnmounted());const x=f.current!==n,y=p.current,v=t.useMemo(()=>{if(o)return null;const e=!x&&!ao(y,a);return x||e?g():null},[o,x,a,y,g]);return null!==v?v:m}({control:s,name:n,defaultValue:d,exact:l}),f=function(e){const r=Xs(),{control:n=r,disabled:a,name:s,exact:o}=e||{},[i,l]=t.useState(n._formState),c=t.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return eo(()=>n._subscribe({name:s,formState:c.current,exact:o,callback:e=>{!a&&l({...n._formState,...e})}}),[s,a,o]),t.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),t.useMemo(()=>Qs(i,n,c.current,!1),[i,n])}({control:s,name:n,exact:l}),p=t.useRef(e),m=t.useRef(void 0),h=t.useRef(s.register(n,{...e.rules,value:u,...Os(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ps(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ps(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ps(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ps(f.validatingFields,n)},error:{enumerable:!0,get:()=>Ps(f.errors,n)}}),[f,n]),b=t.useCallback(e=>h.current.onChange({target:{value:ks(e),name:n},type:Fs}),[n]),x=t.useCallback(()=>h.current.onBlur({target:{value:Ps(s._formValues,n),name:n},type:Us}),[n,s._formValues]),y=t.useCallback(e=>{const t=Ps(s._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>Is(e.focus)&&e.focus(),select:()=>Is(e.select)&&e.select(),setCustomValidity:t=>Is(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Is(e.reportValidity)&&e.reportValidity()})},[s._fields,n]),v=t.useMemo(()=>({name:n,value:u,...Os(a)||f.disabled?{disabled:f.disabled||a}:{},onChange:b,onBlur:x,ref:y}),[n,a,f.disabled,b,x,y,u]);return t.useEffect(()=>{const e=s._options.shouldUnregister||o,t=m.current;t&&t!==n&&!c&&s.unregister(t),s.register(n,{...p.current.rules,...Os(p.current.disabled)?{disabled:p.current.disabled}:{}});const r=(e,t)=>{const r=Ps(s._fields,e);r&&r._f&&(r._f.mount=t)};if(r(n,!0),e){const e=Cs(Ps(s._options.defaultValues,n,p.current.defaultValue));Ds(s._defaultValues,n,e),_s(Ps(s._formValues,n))&&Ds(s._formValues,n,e)}return!c&&s.register(n),m.current=n,()=>{(c?e&&!s._state.action:e)?s.unregister(n):r(n,!1)}},[n,s,c,o]),t.useEffect(()=>{s._setDisabledField({disabled:a,name:n})},[a,n,s]),t.useMemo(()=>({field:v,formState:f,fieldState:g}),[v,f,g])}const oo=e=>e.render(so(e)),io=t.createContext(null);io.displayName="HookFormContext";const lo=e=>{const{children:r,watch:n,getValues:a,getFieldState:s,setError:o,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:b,subscribe:x}=e;return t.createElement(io.Provider,{value:t.useMemo(()=>({watch:n,getValues:a,getFieldState:s,setError:o,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:b,subscribe:x}),[i,h,d,s,a,p,g,f,u,o,b,l,x,c,m,n])},t.createElement(Ys.Provider,{value:h},r))};var co=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},uo=e=>Array.isArray(e)?e:[e],fo=()=>{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 po(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],s=t[n];if(a&&js(a)&&s){const e=po(a,s);js(e)&&(r[n]=e)}else e[n]&&(r[n]=s)}return r}var mo=e=>js(e)&&!Object.keys(e).length,ho=e=>"file"===e.type,go=e=>{if(!Es)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},bo=e=>"select-multiple"===e.type,xo=e=>"radio"===e.type,yo=e=>go(e)&&e.isConnected;function vo(e,t){const r=Array.isArray(t)?t:As(t)?[t]:Rs(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=_s(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,s=r[a];return n&&delete n[s],0!==a&&(js(n)&&mo(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!_s(e[t]))return!1;return!0}(n))&&vo(e,r.slice(0,-1)),e}function wo(e){return Array.isArray(e)||js(e)&&!(e=>{for(const t in e)if(Is(e[t]))return!0;return!1})(e)}function So(e,t={}){for(const r in e){const n=e[r];wo(n)?(t[r]=Array.isArray(n)?[]:{},So(n,t[r])):_s(n)||(t[r]=!0)}return t}function jo(e,t,r){r||(r=So(t));for(const n in e){const a=e[n];if(wo(a))_s(t)||no(r[n])?r[n]=So(a,Array.isArray(a)?[]:{}):jo(a,ws(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!ao(a,e)}}return r}const ko={value:!1,isValid:!1},No={value:!0,isValid:!0};var Eo=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&&!_s(e[0].attributes.value)?_s(e[0].value)||""===e[0].value?No:{value:e[0].value,isValid:!0}:No:ko}return ko},Co=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>_s(e)?e:t?""===e?NaN:e?+e:e:r&&to(e)?new Date(e):n?n(e):e;const Ao={isValid:!1,value:null};var _o=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Ao):Ao;function To(e){const t=e.ref;return ho(t)?t.files:xo(t)?_o(e.refs).value:bo(t)?[...t.selectedOptions].map(({value:e})=>e):ys(t)?Eo(e.refs).value:Co(_s(t.value)?e.ref.value:t.value,e)}var Ro=e=>e instanceof RegExp,Po=e=>_s(e)?e:Ro(e)?e.source:js(e)?Ro(e.value)?e.value.source:e.value:e,Oo=e=>({isOnSubmit:!e||e===Ws,isOnBlur:e===zs,isOnChange:e===Ls,isOnAll:e===Vs,isOnTouch:e===$s});const Io="AsyncFunction";var Do=e=>!!e&&!!e.validate&&!!(Is(e.validate)&&e.validate.constructor.name===Io||js(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Io)),Uo=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const Mo=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=Ps(e,a);if(r){const{_f:e,...s}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(Mo(s,t))break}else if(js(s)&&Mo(s,t))break}}};function Fo(e,t,r){const n=Ps(e,r);if(n||As(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),s=Ps(t,n),o=Ps(e,n);if(s&&!Array.isArray(s)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};if(o&&o.root&&o.root.type)return{name:`${n}.root`,error:o.root};a.pop()}return{name:r}}var zo=(e,t,r)=>{const n=uo(Ps(e,r));return Ds(n,"root",t[r]),Ds(e,r,n),e};function Lo(e,t,r="validate"){if(to(e)||Array.isArray(e)&&e.every(to)||Os(e)&&!e)return{type:r,message:to(e)?e:"",ref:t}}var Wo=e=>js(e)&&!Ro(e)?e:{value:e,message:""},$o=async(e,t,r,n,a,s)=>{const{ref:o,refs:i,required:l,maxLength:c,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:b}=e._f,x=Ps(r,h);if(!b||t.has(h))return{};const y=i?i[0]:o,v=e=>{a&&y.reportValidity&&(y.setCustomValidity(Os(e)?"":e||""),y.reportValidity())},w={},S=xo(o),j=ys(o),k=S||j,N=(g||ho(o))&&_s(o.value)&&_s(x)||go(o)&&""===o.value||""===x||Array.isArray(x)&&!x.length,E=co.bind(null,h,n,w),C=(e,t,r,n=Ks,a=Hs)=>{const s=e?t:r;w[h]={type:e?n:a,message:s,ref:o,...E(e?n:a,s)}};if(s?!Array.isArray(x)||!x.length:l&&(!k&&(N||ws(x))||Os(x)&&!x||j&&!Eo(i).isValid||S&&!_o(i).isValid)){const{value:e,message:t}=to(l)?{value:!!l,message:l}:Wo(l);if(e&&(w[h]={type:qs,message:t,ref:y,...E(qs,t)},!n))return v(t),w}if(!(N||ws(u)&&ws(f))){let e,t;const r=Wo(f),a=Wo(u);if(ws(x)||isNaN(x)){const n=o.valueAsDate||new Date(x),s=e=>new Date((new Date).toDateString()+" "+e),i="time"==o.type,l="week"==o.type;to(r.value)&&x&&(e=i?s(x)>s(r.value):l?x>r.value:n>new Date(r.value)),to(a.value)&&x&&(t=i?s(x)<s(a.value):l?x<a.value:n<new Date(a.value))}else{const n=o.valueAsNumber||(x?+x:x);ws(r.value)||(e=n>r.value),ws(a.value)||(t=n<a.value)}if((e||t)&&(C(!!e,r.message,a.message,Bs,Gs),!n))return v(w[h].message),w}if((c||d)&&!N&&(to(x)||s&&Array.isArray(x))){const e=Wo(c),t=Wo(d),r=!ws(e.value)&&x.length>+e.value,a=!ws(t.value)&&x.length<+t.value;if((r||a)&&(C(r,e.message,t.message),!n))return v(w[h].message),w}if(p&&!N&&to(x)){const{value:e,message:t}=Wo(p);if(Ro(e)&&!x.match(e)&&(w[h]={type:Zs,message:t,ref:o,...E(Zs,t)},!n))return v(t),w}if(m)if(Is(m)){const e=Lo(await m(x,r),y);if(e&&(w[h]={...e,...E(Js,e.message)},!n))return v(e.message),w}else if(js(m)){let e={};for(const t in m){if(!mo(e)&&!n)break;const a=Lo(await m[t](x,r),y,t);a&&(e={...a,...E(t,a.message)},v(a.message),n&&(w[h]=e))}if(!mo(e)&&(w[h]={ref:y,...e},!n))return w}return v(!0),w};const Vo={mode:Ws,reValidateMode:Ls,shouldFocusError:!0};function Bo(e={}){let t,r={...Vo,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Is(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},s=(js(r.defaultValues)||js(r.values))&&Cs(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:Cs(s),i={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:fo(),state:fo()},m=r.criteriaMode===Vs,h=async e=>{if(!i.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=mo((await v()).errors),g()):e=await w(a,!0),e!==n.isValid&&p.state.next({isValid:e})}},g=(e,t)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(l.mount)).forEach(e=>{e&&(t?Ds(n.validatingFields,e,t):vo(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!mo(n.validatingFields)}))},b=(e,t,r,n)=>{const l=Ps(a,e);if(l){const a=Ps(o,e,_s(r)?Ps(s,e):r);_s(a)||n&&n.defaultChecked||t?Ds(o,e,t?a:To(l._f)):k(e,a),i.mount&&!i.action&&h()}},x=(e,t,a,o,i)=>{let l=!1,c=!1;const d={name:e};if(!r.disabled){if(!a||o){(u.isDirty||f.isDirty)&&(c=n.isDirty,n.isDirty=d.isDirty=S(),l=c!==d.isDirty);const r=ao(Ps(s,e),t);c=!!Ps(n.dirtyFields,e),r?vo(n.dirtyFields,e):Ds(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||f.dirtyFields)&&c!==!r}if(a){const t=Ps(n.touchedFields,e);t||(Ds(n.touchedFields,e,a),d.touchedFields=n.touchedFields,l=l||(u.touchedFields||f.touchedFields)&&t!==a)}l&&i&&p.state.next(d)}return l?d:{}},y=(e,a,s,o)=>{const i=Ps(n.errors,e),l=(u.isValid||f.isValid)&&Os(a)&&n.isValid!==a;var d;if(r.delayError&&s?(d=()=>((e,t)=>{Ds(n.errors,e,t),p.state.next({errors:n.errors})})(e,s),t=e=>{clearTimeout(c),c=setTimeout(d,e)},t(r.delayError)):(clearTimeout(c),t=null,s?Ds(n.errors,e,s):vo(n.errors,e)),(s?!ao(i,s):i)||!mo(o)||l){const t={...o,...l&&Os(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},v=async e=>{g(e,!0);const t=await r.resolver(o,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Ps(t,r);e&&Ds(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||l.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},w=async(t,a,s={valid:!0})=>{for(const i in t){const c=t[i];if(c){const{_f:t,...i}=c;if(t){const i=l.array.has(t.name),d=c._f&&Do(c._f);d&&u.validatingFields&&g([t.name],!0);const f=await $o(c,l.disabled,o,m,r.shouldUseNativeValidation&&!a,i);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(s.valid=!1,a||e.shouldUseNativeValidation))break;!a&&(Ps(f,t.name)?i?zo(n.errors,f,t.name):Ds(n.errors,t.name,f[t.name]):vo(n.errors,t.name))}!mo(i)&&await w(i,a,s)}}return s.valid},S=(e,t)=>!r.disabled&&(e&&t&&Ds(o,e,t),!ao(T(),s)),j=(e,t,r)=>ro(e,l,{...i.mount?o:_s(t)?s:to(e)?{[e]:t}:t},r,t),k=(e,t,r={})=>{const n=Ps(a,e);let s=t;if(n){const r=n._f;r&&(!r.disabled&&Ds(o,e,Co(t,r)),s=go(r.ref)&&ws(t)?"":t,bo(r.ref)?[...r.ref.options].forEach(e=>e.selected=s.includes(e.value)):r.refs?ys(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):r.refs.forEach(e=>e.checked=e.value===s):ho(r.ref)?r.ref.value="":(r.ref.value=s,r.ref.type||p.state.next({name:e,values:Cs(o)})))}(r.shouldDirty||r.shouldTouch)&&x(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&_(e)},N=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const s=t[n],o=e+"."+n,i=Ps(a,o);(l.array.has(e)||js(s)||i&&!i._f)&&!vs(s)?N(o,s,r):k(o,s,r)}},E=(e,t,r={})=>{const c=Ps(a,e),d=l.array.has(e),m=Cs(t);Ds(o,e,m),d?(p.array.next({name:e,values:Cs(o)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:jo(s,o),isDirty:S(e,m)})):!c||c._f||ws(m)?k(e,m,r):N(e,m,r),Uo(e,l)?p.state.next({...n,name:e,values:Cs(o)}):p.state.next({name:i.mount?e:void 0,values:Cs(o)})},C=async e=>{i.mount=!0;const s=e.target;let c=s.name,d=!0;const b=Ps(a,c),S=e=>{d=Number.isNaN(e)||vs(e)&&isNaN(e.getTime())||ao(e,Ps(o,c,e))},j=Oo(r.mode),k=Oo(r.reValidateMode);if(b){let i,N;const E=s.type?To(b._f):ks(e),C=e.type===Us||e.type===Ms,A=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(b._f)&&!r.resolver&&!Ps(n.errors,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))(C,Ps(n.touchedFields,c),n.isSubmitted,k,j),T=Uo(c,l,C);Ds(o,c,E),C?s&&s.readOnly||(b._f.onBlur&&b._f.onBlur(e),t&&t(0)):b._f.onChange&&b._f.onChange(e);const R=x(c,E,C),P=!mo(R)||T;if(!C&&p.state.next({name:c,type:e.type,values:Cs(o)}),A)return(u.isValid||f.isValid)&&("onBlur"===r.mode?C&&h():C||h()),P&&p.state.next({name:c,...T?{}:R});if(!C&&T&&p.state.next({...n}),r.resolver){const{errors:e}=await v([c]);if(g([c]),S(E),d){const t=Fo(n.errors,a,c),r=Fo(e,a,t.name||c);i=r.error,c=r.name,N=mo(e)}}else g([c],!0),i=(await $o(b,l.disabled,o,m,r.shouldUseNativeValidation))[c],g([c]),S(E),d&&(i?N=!1:(u.isValid||f.isValid)&&(N=await w(a,!0)));d&&(b._f.deps&&(!Array.isArray(b._f.deps)||b._f.deps.length>0)&&_(b._f.deps),y(c,N,i,R))}},A=(e,t)=>{if(Ps(n.errors,t)&&e.focus)return e.focus(),1},_=async(e,t={})=>{let s,o;const i=uo(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await v(e);if(g(e),e)for(const r of e){const e=Ps(t,r);e?Ds(n.errors,r,e):vo(n.errors,r)}else n.errors=t;return t})(_s(e)?e:i);s=mo(t),o=e?!i.some(e=>Ps(t,e)):s}else e?(o=(await Promise.all(i.map(async e=>{const t=Ps(a,e);return await w(t&&t._f?{[e]:t}:t)}))).every(Boolean),(o||n.isValid)&&h()):o=s=await w(a);return p.state.next({...!to(e)||(u.isValid||f.isValid)&&s!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:s}:{},errors:n.errors}),t.shouldFocus&&!o&&Mo(a,A,e?i:l.mount),o},T=(e,t)=>{let r={...i.mount?o:s};return t&&(r=po(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),_s(e)?r:to(e)?Ps(r,e):e.map(e=>Ps(r,e))},R=(e,t)=>({invalid:!!Ps((t||n).errors,e),isDirty:!!Ps((t||n).dirtyFields,e),error:Ps((t||n).errors,e),isValidating:!!Ps(n.validatingFields,e),isTouched:!!Ps((t||n).touchedFields,e)}),P=(e,t,r)=>{const s=(Ps(a,e,{_f:{}})._f||{}).ref,o=Ps(n.errors,e)||{},{ref:i,message:l,type:c,...d}=o;Ds(n.errors,e,{...d,...t,ref:s}),p.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},O=e=>p.state.subscribe({next:t=>{var r,a,i;r=e.name,a=t.name,i=e.exact,r&&a&&r!==a&&!uo(r).some(e=>e&&(i?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...s}=e;return mo(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!n||Vs))})(t,e.formState||u,W,e.reRenderRoot)||e.callback({values:{...o},...n,...t,defaultValues:s})}}).unsubscribe,I=(e,t={})=>{for(const i of e?uo(e):l.mount)l.mount.delete(i),l.array.delete(i),t.keepValue||(vo(a,i),vo(o,i)),!t.keepError&&vo(n.errors,i),!t.keepDirty&&vo(n.dirtyFields,i),!t.keepTouched&&vo(n.touchedFields,i),!t.keepIsValidating&&vo(n.validatingFields,i),!r.shouldUnregister&&!t.keepDefaultValue&&vo(s,i);p.state.next({values:Cs(o)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},D=({disabled:e,name:t})=>{if(Os(e)&&i.mount||e||l.disabled.has(t)){const r=l.disabled.has(t)!==!!e;e?l.disabled.add(t):l.disabled.delete(t),r&&i.mount&&!i.action&&h()}},U=(e,t={})=>{let n=Ps(a,e);const o=Os(t.disabled)||Os(r.disabled);return Ds(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n?D({disabled:Os(t.disabled)?t.disabled:r.disabled,name:e}):b(e,!0,t.value),{...o?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:Po(t.min),max:Po(t.max),minLength:Po(t.minLength),maxLength:Po(t.maxLength),pattern:Po(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:o=>{if(o){U(e,t),n=Ps(a,e);const r=_s(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,i=(e=>xo(e)||ys(e))(r),l=n._f.refs||[];if(i?l.find(e=>e===r):r===n._f.ref)return;Ds(a,e,{_f:{...n._f,...i?{refs:[...l.filter(yo),r,...Array.isArray(Ps(s,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),b(e,!1,void 0,r)}else n=Ps(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!Ns(l.array,e)||!i.action)&&l.unMount.add(e)}}},M=()=>r.shouldFocusError&&Mo(a,A,l.mount),F=(e,t)=>async s=>{let i;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let c=Cs(o);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await v();g(),n.errors=e,c=Cs(t)}else await w(a);if(l.disabled.size)for(const e of l.disabled)vo(c,e);if(vo(n.errors,"root"),mo(n.errors)){p.state.next({errors:{}});try{await e(c,s)}catch(e){i=e}}else t&&await t({...n.errors},s),M(),setTimeout(M);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:mo(n.errors)&&!i,submitCount:n.submitCount+1,errors:n.errors}),i)throw i},z=(e,t={})=>{const c=e?Cs(e):s,d=Cs(c),f=mo(e),m=f?s:d;if(t.keepDefaultValues||(s=c),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(jo(s,o))]);for(const t of Array.from(e)){const e=Ps(n.dirtyFields,t),r=Ps(o,t),a=Ps(m,t);e&&!_s(r)?Ds(m,t,r):e||_s(a)||E(t,a)}}else{if(Es&&_s(e))for(const e of l.mount){const t=Ps(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(go(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of l.mount)E(e,Ps(m,e));else a={}}o=r.shouldUnregister?t.keepDefaultValues?Cs(s):{}:Cs(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!mo(m),i.watch=!!r.shouldUnregister,i.keepIsValid=!!t.keepIsValid,i.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||ao(e,s))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&o?jo(s,o):n.dirtyFields:t.keepDefaultValues&&e?jo(s,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:s})},L=(e,t)=>z(Is(e)?e(o):e,{...r.resetOptions,...t}),W=e=>{n={...n,...e}},$={control:{register:U,unregister:I,getFieldState:R,handleSubmit:F,setError:P,_subscribe:O,_runSchema:v,_updateIsValidating:g,_focusError:M,_getWatch:j,_getDirty:S,_setValid:h,_setFieldArray:(e,t=[],l,c,d=!0,m=!0)=>{if(c&&l&&!r.disabled){if(i.action=!0,m&&Array.isArray(Ps(a,e))){const t=l(Ps(a,e),c.argA,c.argB);d&&Ds(a,e,t)}if(m&&Array.isArray(Ps(n.errors,e))){const t=l(Ps(n.errors,e),c.argA,c.argB);d&&Ds(n.errors,e,t),((e,t)=>{!Ts(Ps(e,t)).length&&vo(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(Ps(n.touchedFields,e))){const t=l(Ps(n.touchedFields,e),c.argA,c.argB);d&&Ds(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=jo(s,o)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ds(o,e,t)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Ts(Ps(i.mount?o:s,e,r.shouldUnregister?Ps(s,e,[]):[])),_reset:z,_resetDefaultValues:()=>Is(r.defaultValues)&&r.defaultValues().then(e=>{L(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of l.unMount){const t=Ps(a,e);t&&(t._f.refs?t._f.refs.every(e=>!yo(e)):!yo(t._f.ref))&&I(e)}l.unMount=new Set},_disableForm:e=>{Os(e)&&(p.state.next({disabled:e}),Mo(a,(t,r)=>{const n=Ps(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return a},get _formValues(){return o},get _state(){return i},set _state(e){i=e},get _defaultValues(){return s},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(i.mount=!0,f={...f,...e.formState},O({...e,formState:{...d,...e.formState}})),trigger:_,register:U,handleSubmit:F,watch:(e,t)=>Is(e)?p.state.subscribe({next:r=>"values"in r&&e(j(void 0,t),r)}):j(e,t,!0),setValue:E,getValues:T,reset:L,resetField:(e,t={})=>{Ps(a,e)&&(_s(t.defaultValue)?E(e,Cs(Ps(s,e))):(E(e,t.defaultValue),Ds(s,e,Cs(t.defaultValue))),t.keepTouched||vo(n.touchedFields,e),t.keepDirty||(vo(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,Cs(Ps(s,e))):S()),t.keepError||(vo(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&uo(e).forEach(e=>vo(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:I,setError:P,setFocus:(e,t={})=>{const r=Ps(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Is(e.select)&&e.select()})}},getFieldState:R};return{...$,formControl:$}}function Go(e={}){const r=t.useRef(void 0),n=t.useRef(void 0),[a,s]=t.useState({isDirty:!1,isValidating:!1,isLoading:Is(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:Is(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:a},e.defaultValues&&!Is(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:t,...n}=Bo(e);r.current={...n,formState:a}}const o=r.current.control;return o._options=e,eo(()=>{const e=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),t.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),t.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),t.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),t.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),t.useEffect(()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==a.isDirty&&o._subjects.state.next({isDirty:e})}},[o,a.isDirty]),t.useEffect(()=>{var t;e.values&&!ao(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),(null===(t=o._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||o._setValid(),n.current=e.values,s(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),t.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),r.current.formState=t.useMemo(()=>Qs(a,o),[o,a]),r.current}const Ko=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Ps(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Ho=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Ko(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>Ko(t,r,e))}},Zo=(e,t)=>{t.shouldUseNativeValidation&&Ho(e,t);const r={};for(const n in e){const a=Ps(t.fields,n),s=Object.assign(e[n]||{},{ref:a&&a.ref});if(qo(t.names||Object.keys(e),n)){const e=Object.assign({},Ps(r,n));Ds(e,"root",s),Ds(r,n,e)}else Ds(r,n,s)}return r},qo=(e,t)=>{const r=Jo(t);return e.some(e=>Jo(e).match(`^${r}\\.\\d+`))};function Jo(e){return e.replace(/\]|\[/g,"")}function Yo(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=o.prototype,s=Object.keys(a);for(let e=0;e<s.length;e++){const t=s[e];t in r||(r[t]=a[t].bind(r))}}const a=r?.Parent??Object;class s extends a{}function o(e){var t;const a=r?.Parent?new s:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class Xo extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Qo extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const ei={};function ti(e){return ei}function ri(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 ni(e,t){return"bigint"==typeof t?t.toString():t}function ai(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function si(e){return null==e}function oi(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const ii=Symbol("evaluating");function li(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ii)return void 0===n&&(n=ii,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ci(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function di(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function ui(e){return JSON.stringify(e)}const fi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pi(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const mi=ai(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function hi(e){if(!1===pi(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!==pi(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function gi(e){return hi(e)?{...e}:Array.isArray(e)?[...e]:e}const bi=new Set(["string","number","symbol"]);function xi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yi(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function vi(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 wi(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 Si(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function ji(e){return"string"==typeof e?e:e?.message}function ki(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=ji(e.inst?._zod.def?.error?.(e))??ji(t?.error?.(e))??ji(r.customError?.(e))??ji(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Ni(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Ei(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Ci=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ni,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ai=Yo("$ZodError",Ci),_i=Yo("$ZodError",Ci,{Parent:Error});const Ti=e=>(t,r,n,a)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new Xo;if(o.issues.length){const t=new(a?.Err??e)(o.issues.map(e=>ki(e,s,ti())));throw fi(t,a?.callee),t}return o.value},Ri=Ti(_i),Pi=e=>async(t,r,n,a)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(a?.Err??e)(o.issues.map(e=>ki(e,s,ti())));throw fi(t,a?.callee),t}return o.value},Oi=Pi(_i),Ii=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new Xo;return s.issues.length?{success:!1,error:new(e??Ai)(s.issues.map(e=>ki(e,a,ti())))}:{success:!0,data:s.value}},Di=Ii(_i),Ui=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>ki(e,a,ti())))}:{success:!0,data:s.value}},Mi=Ui(_i),Fi=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ti(e)(t,r,a)},zi=e=>(t,r,n)=>Ti(e)(t,r,n),Li=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Pi(e)(t,r,a)},Wi=e=>async(t,r,n)=>Pi(e)(t,r,n),$i=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ii(e)(t,r,a)},Vi=e=>(t,r,n)=>Ii(e)(t,r,n),Bi=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ui(e)(t,r,a)},Gi=e=>async(t,r,n)=>Ui(e)(t,r,n),Ki=/^[cC][^\s-]{8,}$/,Hi=/^[0-9a-z]+$/,Zi=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qi=/^[0-9a-vA-V]{20}$/,Ji=/^[A-Za-z0-9]{27}$/,Yi=/^[a-zA-Z0-9_-]{21}$/,Xi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Qi=/^([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})$/,el=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)$/,tl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const rl=/^(?:(?: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])$/,nl=/^(([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}|:))$/,al=/^((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])$/,sl=/^(([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])$/,ol=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,il=/^[A-Za-z0-9_-]*$/,ll=/^\+[1-9]\d{6,14}$/,cl="(?:(?:\\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])))",dl=new RegExp(`^${cl}$`);function ul(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 fl=/^[^A-Z]*$/,pl=/^[^a-z]*$/,ml=Yo("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),hl=Yo("$ZodCheckMaxLength",(e,t)=>{var r;ml.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!si(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=Ni(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),gl=Yo("$ZodCheckMinLength",(e,t)=>{var r;ml.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!si(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=Ni(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),bl=Yo("$ZodCheckLengthEquals",(e,t)=>{var r;ml.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!si(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,a=n.length;if(a===t.length)return;const s=Ni(n),o=a>t.length;r.issues.push({origin:s,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),xl=Yo("$ZodCheckStringFormat",(e,t)=>{var r,n;ml.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=()=>{})}),yl=Yo("$ZodCheckRegex",(e,t)=>{xl.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})}}),vl=Yo("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=fl),xl.init(e,t)}),wl=Yo("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=pl),xl.init(e,t)}),Sl=Yo("$ZodCheckIncludes",(e,t)=>{ml.init(e,t);const r=xi(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})}}),jl=Yo("$ZodCheckStartsWith",(e,t)=>{ml.init(e,t);const r=new RegExp(`^${xi(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})}}),kl=Yo("$ZodCheckEndsWith",(e,t)=>{ml.init(e,t);const r=new RegExp(`.*${xi(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})}}),Nl=Yo("$ZodCheckOverwrite",(e,t)=>{ml.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class El{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 Cl={major:4,minor:3,patch:6},Al=Yo("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Cl;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=wi(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,o=s._zod.check(e);if(o instanceof Promise&&!1===r?.async)throw new Xo;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(a||(a=wi(e,t)))});else{if(e.issues.length===t)continue;a||(a=wi(e,t))}}return n?n.then(()=>e):e},r=(r,a,s)=>{if(wi(r))return r.aborted=!0,r;const o=t(a,n,s);if(o instanceof Promise){if(!1===s.async)throw new Xo;return o.then(t=>e._zod.parse(t,s))}return e._zod.parse(o,s)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if("backward"===s.direction){const t=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,s)):r(t,a,s)}const o=e._zod.parse(a,s);if(o instanceof Promise){if(!1===s.async)throw new Xo;return o.then(e=>t(e,n,s))}return t(o,n,s)}}li(e,"~standard",()=>({validate:t=>{try{const r=Di(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Mi(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),_l=Yo("$ZodString",(e,t)=>{var r;Al.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}}),Tl=Yo("$ZodStringFormat",(e,t)=>{xl.init(e,t),_l.init(e,t)}),Rl=Yo("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Qi),Tl.init(e,t)}),Pl=Yo("$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=el(e))}else t.pattern??(t.pattern=el());Tl.init(e,t)}),Ol=Yo("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tl),Tl.init(e,t)}),Il=Yo("$ZodURL",(e,t)=>{Tl.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})}}}),Dl=Yo("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Tl.init(e,t)}),Ul=Yo("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Yi),Tl.init(e,t)}),Ml=Yo("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ki),Tl.init(e,t)}),Fl=Yo("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Hi),Tl.init(e,t)}),zl=Yo("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Zi),Tl.init(e,t)}),Ll=Yo("$ZodXID",(e,t)=>{t.pattern??(t.pattern=qi),Tl.init(e,t)}),Wl=Yo("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ji),Tl.init(e,t)}),$l=Yo("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ul({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(`^${cl}T(?:${n})$`)}(t)),Tl.init(e,t)}),Vl=Yo("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=dl),Tl.init(e,t)}),Bl=Yo("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ul(t)}$`)),Tl.init(e,t)}),Gl=Yo("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Xi),Tl.init(e,t)}),Kl=Yo("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=rl),Tl.init(e,t),e._zod.bag.format="ipv4"}),Hl=Yo("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=nl),Tl.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})}}}),Zl=Yo("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=al),Tl.init(e,t)}),ql=Yo("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=sl),Tl.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 Jl(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Yl=Yo("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ol),Tl.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Jl(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const Xl=Yo("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=il),Tl.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!il.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Jl(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})}}),Ql=Yo("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ll),Tl.init(e,t)});const ec=Yo("$ZodJWT",(e,t)=>{Tl.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})}}),tc=Yo("$ZodUnknown",(e,t)=>{Al.init(e,t),e._zod.parse=e=>e}),rc=Yo("$ZodNever",(e,t)=>{Al.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function nc(e,t,r){e.issues.length&&t.issues.push(...Si(r,e.issues)),t.value[r]=e.value}const ac=Yo("$ZodArray",(e,t)=>{Al.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const s=[];for(let e=0;e<a.length;e++){const o=a[e],i=t.element._zod.run({value:o,issues:[]},n);i instanceof Promise?s.push(i.then(t=>nc(t,r,e))):nc(i,r,e)}return s.length?Promise.all(s).then(()=>r):r}});function sc(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...Si(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function oc(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 ic(e,t,r,n,a,s){const o=[],i=a.keySet,l=a.catchall._zod,c=l.def.type,d="optional"===l.optout;for(const a in t){if(i.has(a))continue;if("never"===c){o.push(a);continue}const s=l.run({value:t[a],issues:[]},n);s instanceof Promise?e.push(s.then(e=>sc(e,r,a,t,d))):sc(s,r,a,t,d)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const lc=Yo("$ZodObject",(e,t)=>{Al.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=ai(()=>oc(t));li(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=pi,s=t.catchall;let o;e._zod.parse=(t,r)=>{o??(o=n.value);const i=t.value;if(!a(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value={};const l=[],c=o.shape;for(const e of o.keys){const n=c[e],a="optional"===n._zod.optout,s=n._zod.run({value:i[e],issues:[]},r);s instanceof Promise?l.push(s.then(r=>sc(r,t,e,i,a))):sc(s,t,e,i,a)}return s?ic(l,i,t,r,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),cc=Yo("$ZodObjectJIT",(e,t)=>{lc.init(e,t);const r=e._zod.parse,n=ai(()=>oc(t));let a;const s=pi,o=!ei.jitless,i=o&&mi.value,l=t.catchall;let c;e._zod.parse=(d,u)=>{c??(c=n.value);const f=d.value;return s(f)?o&&i&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new El(["shape","payload","ctx"]),r=n.value,a=e=>{const t=ui(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let o=0;for(const e of r.keys)s[e]="key_"+o++;t.write("const newResult = {};");for(const n of r.keys){const r=s[n],o=ui(n),i=e[n],l="optional"===i?._zod?.optout;t.write(`const ${r} = ${a(n)};`),l?t.write(`\n if (${r}.issues.length) {\n if (${o} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const i=t.compile();return(t,r)=>i(e,t,r)})(t.shape)),d=a(d,u),l?ic([],f,d,u,c,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function dc(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=>!wi(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=>ki(e,n,ti())))}),t)}const uc=Yo("$ZodUnion",(e,t)=>{Al.init(e,t),li(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),li(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),li(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),li(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=>oi(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,s)=>{if(r)return n(a,s);let o=!1;const i=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},s);if(t instanceof Promise)i.push(t),o=!0;else{if(0===t.issues.length)return t;i.push(t)}}return o?Promise.all(i).then(t=>dc(t,a,e,s)):dc(i,a,e,s)}}),fc=Yo("$ZodIntersection",(e,t)=>{Al.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,a=t.left._zod.run({value:n,issues:[]},r),s=t.right._zod.run({value:n,issues:[]},r);return a instanceof Promise||s instanceof Promise?Promise.all([a,s]).then(([t,r])=>mc(e,t,r)):mc(e,a,s)}});function pc(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(hi(e)&&hi(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=pc(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=pc(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 mc(e,t,r){const n=new Map;let a;for(const r of t.issues)if("unrecognized_keys"===r.code){a??(a=r);for(const e of r.keys)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(r);for(const t of r.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(t);const s=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length&&a&&e.issues.push({...a,keys:s}),wi(e))return e;const o=pc(t.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const hc=Yo("$ZodEnum",(e,t)=>{Al.init(e,t);const r=ri(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>bi.has(typeof e)).map(e=>"string"==typeof e?xi(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const s=t.value;return n.has(s)||t.issues.push({code:"invalid_value",values:r,input:s,inst:e}),t}}),gc=Yo("$ZodTransform",(e,t)=>{Al.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Qo(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 Xo;return r.value=a,r}});function bc(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const xc=Yo("$ZodOptional",(e,t)=>{Al.init(e,t),e._zod.optin="optional",e._zod.optout="optional",li(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),li(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${oi(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=>bc(t,e.value)):bc(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),yc=Yo("$ZodExactOptional",(e,t)=>{xc.init(e,t),li(e._zod,"values",()=>t.innerType._zod.values),li(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),vc=Yo("$ZodNullable",(e,t)=>{Al.init(e,t),li(e._zod,"optin",()=>t.innerType._zod.optin),li(e._zod,"optout",()=>t.innerType._zod.optout),li(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${oi(e.source)}|null)$`):void 0}),li(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)}),wc=Yo("$ZodDefault",(e,t)=>{Al.init(e,t),e._zod.optin="optional",li(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=>Sc(e,t)):Sc(n,t)}});function Sc(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const jc=Yo("$ZodPrefault",(e,t)=>{Al.init(e,t),e._zod.optin="optional",li(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))}),kc=Yo("$ZodNonOptional",(e,t)=>{Al.init(e,t),li(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=>Nc(t,e)):Nc(a,e)}});function Nc(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 Ec=Yo("$ZodCatch",(e,t)=>{Al.init(e,t),li(e._zod,"optin",()=>t.innerType._zod.optin),li(e._zod,"optout",()=>t.innerType._zod.optout),li(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=>ki(e,r,ti()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>ki(e,r,ti()))},input:e.value}),e.issues=[]),e)}}),Cc=Yo("$ZodPipe",(e,t)=>{Al.init(e,t),li(e._zod,"values",()=>t.in._zod.values),li(e._zod,"optin",()=>t.in._zod.optin),li(e._zod,"optout",()=>t.out._zod.optout),li(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=>Ac(e,t.in,r)):Ac(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Ac(e,t.out,r)):Ac(n,t.out,r)}});function Ac(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const _c=Yo("$ZodReadonly",(e,t)=>{Al.init(e,t),li(e._zod,"propValues",()=>t.innerType._zod.propValues),li(e._zod,"values",()=>t.innerType._zod.values),li(e._zod,"optin",()=>t.innerType?._zod?.optin),li(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(Tc):Tc(n)}});function Tc(e){return e.value=Object.freeze(e.value),e}const Rc=Yo("$ZodCustom",(e,t)=>{ml.init(e,t),Al.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=>Pc(t,r,n,e));Pc(a,r,n,e)}});function Pc(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(Ei(e))}}var Oc;class Ic{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)}}(Oc=globalThis).__zod_globalRegistry??(Oc.__zod_globalRegistry=new Ic);const Dc=globalThis.__zod_globalRegistry;function Uc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...vi(t)})}function Mc(e,t){return new hl({check:"max_length",...vi(t),maximum:e})}function Fc(e,t){return new gl({check:"min_length",...vi(t),minimum:e})}function zc(e,t){return new bl({check:"length_equals",...vi(t),length:e})}function Lc(e){return new Nl({check:"overwrite",tx:e})}function Wc(e){const t=function(e,t){const r=new ml({check:"custom",...vi(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(Ei(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(Ei(n))}},e(r.value,r)));return t}function $c(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??Dc,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 Vc(e,t,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,s=t.seen.get(e);if(s){s.count++;return r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema}const o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);const i=e._zod.toJSONSchema?.();if(i)o.schema=i;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,n);else{const r=o.schema,s=t.processors[a.type];if(!s)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);s(e,t,r,n)}const s=e._zod.parent;s&&(o.ref||(o.ref=s),Vc(s,t,n),t.seen.get(s).isParent=!0)}const l=t.metadataRegistry.get(e);l&&Object.assign(o.schema,l),"input"===t.io&&Kc(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault;return t.seen.get(e).schema}function Bc(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const t of e.seen.entries()){const r=e.metadataRegistry.get(t[0])?.id;if(r){const e=n.get(r);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}const a=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:a,defId:s}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const s=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=s,{defId:s,ref:`${a("__shared")}#/${n}/${s}`}}if(t[1]===r)return{ref:"#"};const a=`#/${n}/`,s=t[1].schema.id??"__schema"+e.counter++;return{defId:s,ref:a+s}})(t);n.def={...n.schema},s&&(n.defId=s);const o=n.schema;for(const e in o)delete o[e];o.$ref=a};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const n=r[1];if(t===r[0]){a(r);continue}if(e.external){const n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){a(r);continue}}const s=e.metadataRegistry.get(r[0])?.id;s?a(r):(n.cycle||n.count>1&&"ref"===e.reused)&&a(r)}}function Gc(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const a=r.def??r.schema,s={...a},o=r.ref;if(r.ref=null,o){n(o);const r=e.seen.get(o),i=r.schema;!i.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,i):(a.allOf=a.allOf??[],a.allOf.push(i)),Object.assign(a,s);if(t._zod.parent===o)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in s||delete a[e]);if(i.$ref&&r.def)for(const e in a)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(a[e])===JSON.stringify(r.def[e])&&delete a[e]}const i=t._zod.parent;if(i&&i!==o){n(i);const t=e.seen.get(i);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(const e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:r.path??[]})};for(const t of[...e.seen.entries()].reverse())n(t[0]);const a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(r)}Object.assign(a,r.def??r.schema);const s=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?a.$defs=s:a.definitions=s);try{const r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:Hc(t,"input",e.processors),output:Hc(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function Kc(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 Kc(n.element,r);if("set"===n.type)return Kc(n.valueType,r);if("lazy"===n.type)return Kc(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 Kc(n.innerType,r);if("intersection"===n.type)return Kc(n.left,r)||Kc(n.right,r);if("record"===n.type||"map"===n.type)return Kc(n.keyType,r)||Kc(n.valueType,r);if("pipe"===n.type)return Kc(n.in,r)||Kc(n.out,r);if("object"===n.type){for(const e in n.shape)if(Kc(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(Kc(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(Kc(e,r))return!0;return!(!n.rest||!Kc(n.rest,r))}return!1}const Hc=(e,t,r={})=>n=>{const{libraryOptions:a,target:s}=n??{},o=$c({...a??{},target:s,io:t,processors:r});return Vc(e,o),Bc(o,e),Gc(o,e)},Zc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},qc=(e,t,r,n)=>{const a=e._zod.def;Vc(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function Jc(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function Yc(e,t){for(var r={};e.length;){var n=e[0],a=n.code,s=n.message,o=n.path.join(".");if(!r[o])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];r[o]={message:i.message,type:i.code}}else r[o]={message:s,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var l=r[o].types,c=l&&l[n.code];r[o]=co(o,t,r,a,c?[].concat(c,n.message):n.message)}e.shift()}return r}function Xc(e,t){for(var r={};e.length;){var n=e[0],a=n.code,s=n.message,o=n.path.join(".");if(!r[o])if("invalid_union"===n.code&&n.errors.length>0){var i=n.errors[0][0];r[o]={message:i.message,type:i.code}}else r[o]={message:s,type:a};if("invalid_union"===n.code&&n.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var l=r[o].types,c=l&&l[n.code];r[o]=co(o,t,r,a,c?[].concat(c,n.message):n.message)}e.shift()}return r}function Qc(e,t,r){if(void 0===r&&(r={}),function(e){return"_def"in e&&"object"==typeof e._def&&"typeName"in e._def}(e))return function(n,a,s){try{return Promise.resolve(Jc(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return s.shouldUseNativeValidation&&Ho({},s),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:Zo(Yc(e.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(n,a,s){try{return Promise.resolve(Jc(function(){return Promise.resolve(("sync"===r.mode?Ri:Oi)(e,n,t)).then(function(e){return s.shouldUseNativeValidation&&Ho({},s),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof Ai}(e))return{values:{},errors:Zo(Xc(e.issues,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}function ed(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function td(...e){return t=>{let r=!1;const n=e.map(e=>{const n=ed(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():ed(e[t],null)}}}}function rd(...e){return a.useCallback(td(...e),e)}var nd=Symbol.for("react.lazy"),ad=a[" use ".trim().toString()];function sd(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===nd&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function od(t){const r=ld(t),n=a.forwardRef((t,n)=>{let{children:s,...o}=t;sd(s)&&"function"==typeof ad&&(s=ad(s._payload));const i=a.Children.toArray(s),l=i.find(dd);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}var id=od("Slot");function ld(e){const t=a.forwardRef((e,t)=>{let{children:r,...n}=e;if(sd(r)&&"function"==typeof ad&&(r=ad(r._payload)),a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?td(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cd=Symbol("radix.slottable");function dd(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cd}const ud=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,fd=l,pd=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return fd(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:s}=t,o=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==s?void 0:s[e];if(null===t)return null;const o=ud(t)||ud(n);return a[e][o]}),i=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),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({...s,...i}[t]):{...s,...i}[t]===r})?[...e,r,n]:e},[]);return fd(e,o,l,null==r?void 0:r.class,null==r?void 0:r.className)},md=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hd=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)},gd=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),bd=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
|
|
8
|
+
var xd={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
|
|
14
|
+
*/const yd=t.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:o,iconNode:i,...l},c)=>t.createElement("svg",{ref:c,...xd,width:r,height:r,stroke:e,strokeWidth:a?24*Number(n)/Number(r):n,className:gd("lucide",s),...!o&&!bd(l)&&{"aria-hidden":"true"},...l},[...i.map(([e,r])=>t.createElement(e,r)),...Array.isArray(o)?o:[o]])),vd=(e,r)=>{const n=t.forwardRef(({className:n,...a},s)=>t.createElement(yd,{ref:s,iconNode:r,className:gd(`lucide-${md(hd(e))}`,`lucide-${e}`,n),...a}));return n.displayName=hd(e),n},wd=vd("bell-off",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]),Sd=vd("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),jd=vd("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"}]]),kd=vd("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"}]]),Nd=vd("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"}]]),Ed=vd("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),Cd=vd("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),Ad=vd("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"}]]),_d=vd("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"}]]),Td=vd("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"}]]),Rd=vd("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"}]]),Pd=vd("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"}]]),Od=vd("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Id=vd("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Dd=vd("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"}]]),Ud=vd("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"}]]),Md=vd("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Fd=vd("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"}]]),zd=vd("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),Ld=vd("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"}]]),Wd=vd("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),$d=vd("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),Vd=vd("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"}]]),Bd=vd("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"}]]),Gd=vd("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"}]]),Kd=vd("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"}]]),Hd=pd("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"}}),Zd=a.forwardRef(({className:t,variant:r,progress:n,size:s,startIcon:o,endIcon:i,asChild:l=!1,...c},d)=>{const u=l?id:"button",f=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(s);return e.jsxs(u,{disabled:n||c.disabled,className:ke(Hd({variant:r,size:s,withIcon:null!=n||null!=o||null!=i,className:t})),ref:d,...c,children:[n&&e.jsx(Od,{size:f,className:"animate-spin"}),o&&a.cloneElement(o,{size:f}),c.children,i&&a.cloneElement(i,{size:f})]})});
|
|
15
15
|
/**
|
|
16
16
|
* @license lucide-react v0.544.0 - ISC
|
|
17
17
|
*
|
|
18
18
|
* This source code is licensed under the ISC license.
|
|
19
19
|
* See the LICENSE file in the root directory of this source tree.
|
|
20
|
-
*/Ld.displayName="Button";var $d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=td(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),Wd=a.forwardRef((t,r)=>e.jsx($d.label,{...t,ref:r,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));Wd.displayName="Label";var Vd=Wd;const Bd=ld("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Gd=a.forwardRef(({className:t,...r},n)=>e.jsx(Vd,{ref:n,className:ke(Bd(),t),...r}));Gd.displayName=Vd.displayName;const Kd=no,Hd=a.createContext({}),Zd=({...t})=>e.jsx(Hd.Provider,{value:{name:t.name},children:e.jsx(to,{...t})}),qd=()=>{const e=a.useContext(Hd),r=a.useContext(Jd),{getFieldState:n,formState:s}=t.useContext(ro),o=n(e.name,s);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=r;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},Jd=a.createContext({}),Yd=a.forwardRef(({className:t,...r},n)=>{const s=a.useId();return e.jsx(Jd.Provider,{value:{id:s},children:e.jsx("div",{ref:n,className:ke("space-y-2",t),...r})})});Yd.displayName="FormItem";const Xd=a.forwardRef(({className:t,...r},n)=>{const{error:a,formItemId:s}=qd();return e.jsx(Gd,{ref:n,className:ke(a&&"text-destructive",t),htmlFor:s,...r})});Xd.displayName="FormLabel";const Qd=a.forwardRef(({...t},r)=>{const{error:n,formItemId:a,formDescriptionId:s,formMessageId:o}=qd();return e.jsx(rd,{ref:r,id:a,"aria-describedby":n?`${s} ${o}`:`${s}`,"aria-invalid":!!n,...t})});Qd.displayName="FormControl";const eu=a.forwardRef(({className:t,...r},n)=>{const{formDescriptionId:a}=qd();return e.jsx("p",{ref:n,id:a,className:ke("text-sm text-muted-foreground",t),...r})});eu.displayName="FormDescription";const tu=a.forwardRef(({className:t,children:r,...n},a)=>{const{error:s,formMessageId:o}=qd(),i=s?String(s?.message):r;return i?e.jsx("p",{ref:a,id:o,className:ke("text-sm font-medium text-destructive",t),...n,children:i}):null});tu.displayName="FormMessage";const ru=a.forwardRef(({className:t,type:r,...n},a)=>e.jsx("input",{type:r,className:ke("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...n}));function nu({className:t,...r}){return e.jsx("div",{className:ke("animate-pulse rounded-md bg-primary/10",t),...r})}ru.displayName="Input";class au extends Zt{constructor(e){super({...e,basePath:"beta",requireOrgId:!0})}getAuthHeaders(){return{}}async fetchConfig(){return this.fetchJson(`config?orgId=${encodeURIComponent(this.orgId)}`,{},"Failed to fetch beta form configuration")}async submitBetaUser(e){return this.fetchJson("submit",{method:"POST",body:JSON.stringify(e)},"Failed to submit beta user request")}}let su=class{constructor(e){this.api=new au(e),this.orgId=e.orgId}async fetchConfig(){return this.api.fetchConfig()}async submitBetaUser(e){const t=e?.context??{},r=t?.country??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[1]:void 0),n=t?.language??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[0]:void 0),a=t?.timezone??("undefined"!=typeof Intl&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),s=t?.currency??("undefined"!=typeof Intl&&Intl.NumberFormat&&Intl.NumberFormat().resolvedOptions().currency?Intl.NumberFormat().resolvedOptions().currency:void 0);return this.api.submitBetaUser({orgId:this.orgId,formData:{...e,country:r,language:n,timezone:a,currency:s}})}};const ou=Ko("ZodISODateTime",(e,t)=>{Fl.init(e,t),Ru.init(e,t)});function iu(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...hi(t)})}(ou,e)}const lu=Ko("ZodISODate",(e,t)=>{Ml.init(e,t),Ru.init(e,t)});function cu(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...hi(t)})}(lu,e)}const du=Ko("ZodISOTime",(e,t)=>{zl.init(e,t),Ru.init(e,t)});function uu(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...hi(t)})}(du,e)}const fu=Ko("ZodISODuration",(e,t)=>{Ll.init(e,t),Ru.init(e,t)});function pu(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...hi(t)})}(fu,e)}const mu=Ko("ZodError",(e,t)=>{ji.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,Xo,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Xo,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),hu=Ni(mu),gu=Ci(mu),bu=_i(mu),xu=Ri(mu),yu=Oi(mu),vu=Ii(mu),wu=Di(mu),Su=Ui(mu),ju=Fi(mu),ku=Mi(mu),Nu=zi(mu),Eu=Li(mu),Cu=Ko("ZodType",(e,t)=>(jl.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Wc(e,"input"),output:Wc(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=Fc({...r,processors:t});return Mc(e,n),zc(n,e),Lc(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(si(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)=>mi(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>hu(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>bu(e,t,r),e.parseAsync=async(t,r)=>gu(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>xu(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>yu(e,t,r),e.decode=(t,r)=>vu(e,t,r),e.encodeAsync=async(t,r)=>wu(e,t,r),e.decodeAsync=async(t,r)=>Su(e,t,r),e.safeEncode=(t,r)=>ju(e,t,r),e.safeDecode=(t,r)=>ku(e,t,r),e.safeEncodeAsync=async(t,r)=>Nu(e,t,r),e.safeDecodeAsync=async(t,r)=>Eu(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,...hi(r)})}(wf,e,t)}(t,r)),e.superRefine=t=>e.check(Uc(t)),e.overwrite=t=>e.check(Dc(t)),e.optional=()=>df(e),e.exactOptional=()=>new uf({type:"optional",innerType:e}),e.nullable=()=>pf(e),e.nullish=()=>df(pf(e)),e.nonoptional=t=>function(e,t){return new gf({type:"nonoptional",innerType:e,...hi(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...hi(r)})}(tf,e,t);var t},e.or=t=>function(e,t){return new af({type:"union",options:e,...hi(t)})}([e,t]),e.and=t=>new sf({type:"intersection",left:e,right:t}),e.transform=t=>yf(e,new lf({type:"transform",transform:t})),e.default=t=>{return r=t,new mf({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():ui(r)}});var r},e.prefault=t=>{return r=t,new hf({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():ui(r)}});var r},e.catch=t=>{return new bf({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>yf(e,t),e.readonly=()=>new vf({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Tc.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Tc.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Tc.get(e);const r=e.clone();return Tc.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Au=Ko("_ZodString",(e,t)=>{kl.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:s,format:o,patterns:i,contentEncoding:l}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof s&&(n.maxLength=s),o&&(n.format=Vc[o]??o,""===n.format&&delete n.format,"time"===o&&delete n.format),l&&(n.contentEncoding=l),i&&i.size>0){const e=[...i];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new ml({check:"string_format",format:"regex",...hi(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new bl({check:"string_format",format:"includes",...hi(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new xl({check:"string_format",format:"starts_with",...hi(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new yl({check:"string_format",format:"ends_with",...hi(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Oc(...t)),e.max=(...t)=>e.check(Pc(...t)),e.length=(...t)=>e.check(Ic(...t)),e.nonempty=(...t)=>e.check(Oc(1,...t)),e.lowercase=t=>e.check(function(e){return new hl({check:"string_format",format:"lowercase",...hi(e)})}(t)),e.uppercase=t=>e.check(function(e){return new gl({check:"string_format",format:"uppercase",...hi(e)})}(t)),e.trim=()=>e.check(Dc(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Dc(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Dc(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Dc(e=>e.toUpperCase())),e.slugify=()=>e.check(Dc(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),_u=Ko("ZodString",(e,t)=>{kl.init(e,t),Au.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...hi(t)})}(Pu,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...hi(t)})}(Du,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...hi(t)})}(Ju,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...hi(t)})}(Uu,t)),e.guid=t=>e.check(Rc(Ou,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...hi(t)})}(Iu,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...hi(t)})}(Iu,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...hi(t)})}(Iu,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...hi(t)})}(Iu,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...hi(t)})}(Fu,t)),e.guid=t=>e.check(Rc(Ou,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...hi(t)})}(Mu,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...hi(t)})}(zu,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...hi(t)})}(Lu,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...hi(t)})}(Hu,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...hi(t)})}(Zu,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...hi(t)})}($u,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...hi(t)})}(Wu,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...hi(t)})}(Vu,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...hi(t)})}(Bu,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...hi(t)})}(Gu,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...hi(t)})}(Ku,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...hi(t)})}(qu,t)),e.datetime=t=>e.check(iu(t)),e.date=t=>e.check(cu(t)),e.time=t=>e.check(uu(t)),e.duration=t=>e.check(pu(t))});function Tu(e){return function(e,t){return new e({type:"string",...hi(t)})}(_u,e)}const Ru=Ko("ZodStringFormat",(e,t)=>{Nl.init(e,t),Au.init(e,t)}),Pu=Ko("ZodEmail",(e,t)=>{Al.init(e,t),Ru.init(e,t)}),Ou=Ko("ZodGUID",(e,t)=>{El.init(e,t),Ru.init(e,t)}),Iu=Ko("ZodUUID",(e,t)=>{Cl.init(e,t),Ru.init(e,t)}),Du=Ko("ZodURL",(e,t)=>{_l.init(e,t),Ru.init(e,t)}),Uu=Ko("ZodEmoji",(e,t)=>{Tl.init(e,t),Ru.init(e,t)}),Fu=Ko("ZodNanoID",(e,t)=>{Rl.init(e,t),Ru.init(e,t)}),Mu=Ko("ZodCUID",(e,t)=>{Pl.init(e,t),Ru.init(e,t)}),zu=Ko("ZodCUID2",(e,t)=>{Ol.init(e,t),Ru.init(e,t)}),Lu=Ko("ZodULID",(e,t)=>{Il.init(e,t),Ru.init(e,t)}),$u=Ko("ZodXID",(e,t)=>{Dl.init(e,t),Ru.init(e,t)}),Wu=Ko("ZodKSUID",(e,t)=>{Ul.init(e,t),Ru.init(e,t)}),Vu=Ko("ZodIPv4",(e,t)=>{$l.init(e,t),Ru.init(e,t)}),Bu=Ko("ZodIPv6",(e,t)=>{Wl.init(e,t),Ru.init(e,t)}),Gu=Ko("ZodCIDRv4",(e,t)=>{Vl.init(e,t),Ru.init(e,t)}),Ku=Ko("ZodCIDRv6",(e,t)=>{Bl.init(e,t),Ru.init(e,t)}),Hu=Ko("ZodBase64",(e,t)=>{Kl.init(e,t),Ru.init(e,t)}),Zu=Ko("ZodBase64URL",(e,t)=>{Hl.init(e,t),Ru.init(e,t)}),qu=Ko("ZodE164",(e,t)=>{Zl.init(e,t),Ru.init(e,t)}),Ju=Ko("ZodJWT",(e,t)=>{ql.init(e,t),Ru.init(e,t)}),Yu=Ko("ZodUnknown",(e,t)=>{Jl.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function Xu(){return new Yu({type:"unknown"})}const Qu=Ko("ZodNever",(e,t)=>{Yl.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function ef(e){return function(e,t){return new e({type:"never",...hi(t)})}(Qu,e)}const tf=Ko("ZodArray",(e,t)=>{Ql.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,s=e._zod.def,{minimum:o,maximum:i}=e._zod.bag;"number"==typeof o&&(a.minItems=o),"number"==typeof i&&(a.maxItems=i),a.type="array",a.items=Mc(s.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(Oc(t,r)),e.nonempty=t=>e.check(Oc(1,t)),e.max=(t,r)=>e.check(Pc(t,r)),e.length=(t,r)=>e.check(Ic(t,r)),e.unwrap=()=>e.element});const rf=Ko("ZodObject",(e,t)=>{ac.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,s=e._zod.def;a.type="object",a.properties={};const o=s.shape;for(const e in o)a.properties[e]=Mc(o[e],t,{...n,path:[...n.path,"properties",e]});const i=new Set(Object.keys(o)),l=new Set([...i].filter(e=>{const r=s.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));l.size>0&&(a.required=Array.from(l)),"never"===s.catchall?._zod.def.type?a.additionalProperties=!1:s.catchall?s.catchall&&(a.additionalProperties=Mc(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),ni(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new of({type:"enum",entries:r,...hi(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:Xu()}),e.loose=()=>e.clone({...e._zod.def,catchall:Xu()}),e.strict=()=>e.clone({...e._zod.def,catchall:ef()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!di(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=si(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return ai(this,"shape",r),r}});return mi(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!di(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=si(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return ai(this,"shape",r),r}});return mi(e,r)}(e,t),e.merge=t=>function(e,t){const r=si(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return ai(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return mi(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 mi(e,si(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 ai(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=si(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 ai(this,"shape",n),n},checks:[]});return mi(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=si(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 ai(this,"shape",a),a},checks:[]});return mi(t,a)}(cf,e,t[0]),e.required=(...t)=>function(e,t,r){const n=si(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 ai(this,"shape",a),a}});return mi(t,n)}(gf,e,t[0])});function nf(e,t){const r={type:"object",shape:e??{},...hi(t)};return new rf(r)}const af=Ko("ZodUnion",(e,t)=>{oc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=!1===a.inclusive,o=a.options.map((e,r)=>Mc(e,t,{...n,path:[...n.path,s?"oneOf":"anyOf",r]}));s?r.oneOf=o:r.anyOf=o})(e,t,r,n),e.options=t.options});const sf=Ko("ZodIntersection",(e,t)=>{ic.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=Mc(a.left,t,{...n,path:[...n.path,"allOf",0]}),o=Mc(a.right,t,{...n,path:[...n.path,"allOf",1]}),i=e=>"allOf"in e&&1===Object.keys(e).length,l=[...i(s)?s.allOf:[s],...i(o)?o.allOf:[o]];r.allOf=l})(e,t,r,n)});const of=Ko("ZodEnum",(e,t)=>{dc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=Yo(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 of({...t,checks:[],...hi(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 of({...t,checks:[],...hi(n),entries:a})}});const lf=Ko("ZodTransform",(e,t)=>{uc.init(e,t),Cu.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 Zo(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(wi(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(wi(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const cf=Ko("ZodOptional",(e,t)=>{pc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Bc(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function df(e){return new cf({type:"optional",innerType:e})}const uf=Ko("ZodExactOptional",(e,t)=>{mc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Bc(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const ff=Ko("ZodNullable",(e,t)=>{hc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=Mc(a.innerType,t,n),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=a.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function pf(e){return new ff({type:"nullable",innerType:e})}const mf=Ko("ZodDefault",(e,t)=>{gc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Mc(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 hf=Ko("ZodPrefault",(e,t)=>{xc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Mc(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 gf=Ko("ZodNonOptional",(e,t)=>{yc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Mc(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const bf=Ko("ZodCatch",(e,t)=>{wc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let s;Mc(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{s=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const xf=Ko("ZodPipe",(e,t)=>{Sc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s="input"===t.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;Mc(s,t,n),t.seen.get(e).ref=s})(e,t,0,n),e.in=t.in,e.out=t.out});function yf(e,t){return new xf({type:"pipe",in:e,out:t})}const vf=Ko("ZodReadonly",(e,t)=>{kc.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Mc(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 wf=Ko("ZodCustom",(e,t)=>{Ec.init(e,t),Cu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});const Sf=nf({name:Tu().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:Tu().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)")}),jf={en:{nameLabel:"Name",emailLabel:"Email",submitText:"Submit",submittingText:"Submitting...",errorMessage:"An error occurred"},es:{nameLabel:"Nombre",emailLabel:"Correo electrónico",submitText:"Enviar",submittingText:"Enviando...",errorMessage:"Ocurrió un error"},fr:{nameLabel:"Nom",emailLabel:"Email",submitText:"Soumettre",submittingText:"Soumission...",errorMessage:"Une erreur est survenue"},de:{nameLabel:"Name",emailLabel:"E-Mail",submitText:"Absenden",submittingText:"Wird gesendet...",errorMessage:"Ein Fehler ist aufgetreten"},zh:{nameLabel:"姓名",emailLabel:"电子邮件",submitText:"提交",submittingText:"提交中...",errorMessage:"发生错误"},ja:{nameLabel:"名前",emailLabel:"メールアドレス",submitText:"送信",submittingText:"送信中...",errorMessage:"エラーが発生しました"},ko:{nameLabel:"이름",emailLabel:"이메일",submitText:"제출",submittingText:"제출 중...",errorMessage:"오류가 발생했습니다"}};function kf({screen:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsx("p",{className:"text-2xl font-bold",children:t?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t?.description})]})}function Nf({logo:t}){return"string"==typeof t?e.jsx("img",{src:t,alt:"Logo",className:"max-h-24"}):e.jsx("img",{src:t.bucket?.url,alt:"Logo",className:"max-h-24"})}const Ef=e=>{const{children:t}=e,{status:r}=ts();return r!==exports.AuthStatus.authenticated?null:t},Cf=e=>{const{children:t}=e,{status:r}=ts();return r!==exports.AuthStatus.unauthenticated?null:t};Ef.displayName="WhenAuthenticated",Cf.displayName="WhenUnauthenticated";const Af=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=ts();return n.includes(a?.role??"")?t:r||null},_f=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=ts(),{currentWorkspace:s}=or(),o=s?.users.find(e=>e._id===a?.id);return o&&n.includes(o?.role??"")?t:r||null};function Tf(){const e=t.useContext(is);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])}}Af.displayName="WhenRoles",_f.displayName="WhenWorkspaceRoles";const Rf=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=or(),a=n?.features?.[r];return a?t:null},Pf=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=or(),a=n?.features?.[r];return a?null:t},Of=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Tf();return n(r)?t:null},If=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Tf();return n(r)?null:t};Rf.displayName="WhenWorkspaceFeatureEnabled",Pf.displayName="WhenWorkspaceFeatureDisabled",Of.displayName="WhenUserFeatureEnabled",If.displayName="WhenUserFeatureDisabled";const Df=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:s}=jr();return s?r??null:a?.subscription?t:n??null},Uf=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:s}=jr();return s?r??null:a?.subscription?n??null:t},Ff=e=>{const{children:t,plans:r,loadingComponent:n,fallbackComponent:a}=e,{response:s,loading:o}=jr();if(o)return n??null;if(!s?.subscription)return a??null;const i=s.plan??s.subscription?.plan;if(!i)return a??null;const l=r.map(e=>e.trim().toLowerCase()),c=(i.slug??"").toLowerCase();return l.includes(c)?t:a??null},Mf=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:s}=jr();return s?r??null:"trialing"!==a?.subscription?.subscriptionStatus?n??null:t},zf=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:s}=jr();return s?r??null:"trialing"===a?.subscription?.subscriptionStatus?n??null:t},Lf=e=>{const{children:t,loadingComponent:r,fallbackComponent:n,daysThreshold:a=3}=e,{response:s,loading:o}=jr();if(o)return r??null;const i=s?.subscription;if(!i||"trialing"!==i.subscriptionStatus)return n??null;const l=i.trialEnd||i.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};Df.displayName="WhenSubscription",Uf.displayName="WhenNoSubscription",Ff.displayName="WhenSubscriptionToPlans",Mf.displayName="WhenTrialing",zf.displayName="WhenNotTrialing",Lf.displayName="WhenTrialEnding";const $f=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:s,loading:o}=Ar();if(o)return n??null;const i=s?.[t];return i?i.available<=0?a??null:r:a??null},Wf=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:s,loading:o}=Ar();if(o)return n??null;const i=s?.[t];return i?i.available>0?a??null:r:a??null},Vf=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:s,loading:o}=Ar();if(o)return n??null;const i=s?.[t];return i&&i.hasOverage?r:a??null},Bf=e=>{const{slug:t,threshold:r,children:n,loadingComponent:a,fallbackComponent:s}=e,{quotas:o,loading:i}=Ar();if(i)return a??null;const l=o?.[t];if(!l)return s??null;return(l.included>0?l.consumed/l.included*100:l.consumed>0?100:0)<r?s??null:n};function Gf(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}function Kf(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}$f.displayName="WhenQuotaAvailable",Wf.displayName="WhenQuotaExhausted",Vf.displayName="WhenQuotaOverage",Bf.displayName="WhenQuotaThreshold";var Hf,Zf=globalThis?.document?a.useLayoutEffect:()=>{},qf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=td(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),Jf={exports:{}},Yf={};function Xf(){if(Hf)return Yf;Hf=1;var e=t;var r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,a=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function i(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),l=n({inst:{value:r,getSnapshot:t}}),c=l[0].inst,d=l[1];return s(function(){c.value=r,c.getSnapshot=t,i(c)&&d({inst:c})},[e,r,t]),a(function(){return i(c)&&d({inst:c}),e(function(){i(c)&&d({inst:c})})},[e]),o(r),r};return Yf.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,Yf}var Qf,ep,tp={};
|
|
20
|
+
*/Zd.displayName="Button";var qd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=od(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),Jd=a.forwardRef((t,r)=>e.jsx(qd.label,{...t,ref:r,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));Jd.displayName="Label";var Yd=Jd;const Xd=pd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Qd=a.forwardRef(({className:t,...r},n)=>e.jsx(Yd,{ref:n,className:ke(Xd(),t),...r}));Qd.displayName=Yd.displayName;const eu=lo,tu=a.createContext({}),ru=({...t})=>e.jsx(tu.Provider,{value:{name:t.name},children:e.jsx(oo,{...t})}),nu=()=>{const e=a.useContext(tu),r=a.useContext(au),{getFieldState:n,formState:s}=t.useContext(io),o=n(e.name,s);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=r;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},au=a.createContext({}),su=a.forwardRef(({className:t,...r},n)=>{const s=a.useId();return e.jsx(au.Provider,{value:{id:s},children:e.jsx("div",{ref:n,className:ke("space-y-2",t),...r})})});su.displayName="FormItem";const ou=a.forwardRef(({className:t,...r},n)=>{const{error:a,formItemId:s}=nu();return e.jsx(Qd,{ref:n,className:ke(a&&"text-destructive",t),htmlFor:s,...r})});ou.displayName="FormLabel";const iu=a.forwardRef(({...t},r)=>{const{error:n,formItemId:a,formDescriptionId:s,formMessageId:o}=nu();return e.jsx(id,{ref:r,id:a,"aria-describedby":n?`${s} ${o}`:`${s}`,"aria-invalid":!!n,...t})});iu.displayName="FormControl";const lu=a.forwardRef(({className:t,...r},n)=>{const{formDescriptionId:a}=nu();return e.jsx("p",{ref:n,id:a,className:ke("text-sm text-muted-foreground",t),...r})});lu.displayName="FormDescription";const cu=a.forwardRef(({className:t,children:r,...n},a)=>{const{error:s,formMessageId:o}=nu(),i=s?String(s?.message):r;return i?e.jsx("p",{ref:a,id:o,className:ke("text-sm font-medium text-destructive",t),...n,children:i}):null});cu.displayName="FormMessage";const du=a.forwardRef(({className:t,type:r,...n},a)=>e.jsx("input",{type:r,className:ke("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...n}));function uu({className:t,...r}){return e.jsx("div",{className:ke("animate-pulse rounded-md bg-primary/10",t),...r})}du.displayName="Input";class fu extends Zt{constructor(e){super({...e,basePath:"beta",requireOrgId:!0})}getAuthHeaders(){return{}}async fetchConfig(){return this.fetchJson(`config?orgId=${encodeURIComponent(this.orgId)}`,{},"Failed to fetch beta form configuration")}async submitBetaUser(e){return this.fetchJson("submit",{method:"POST",body:JSON.stringify(e)},"Failed to submit beta user request")}}let pu=class{constructor(e){this.api=new fu(e),this.orgId=e.orgId}async fetchConfig(){return this.api.fetchConfig()}async submitBetaUser(e){const t=e?.context??{},r=t?.country??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[1]:void 0),n=t?.language??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[0]:void 0),a=t?.timezone??("undefined"!=typeof Intl&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),s=t?.currency??("undefined"!=typeof Intl&&Intl.NumberFormat&&Intl.NumberFormat().resolvedOptions().currency?Intl.NumberFormat().resolvedOptions().currency:void 0);return this.api.submitBetaUser({orgId:this.orgId,formData:{...e,country:r,language:n,timezone:a,currency:s}})}};const mu=Yo("ZodISODateTime",(e,t)=>{$l.init(e,t),zu.init(e,t)});function hu(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...vi(t)})}(mu,e)}const gu=Yo("ZodISODate",(e,t)=>{Vl.init(e,t),zu.init(e,t)});function bu(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...vi(t)})}(gu,e)}const xu=Yo("ZodISOTime",(e,t)=>{Bl.init(e,t),zu.init(e,t)});function yu(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...vi(t)})}(xu,e)}const vu=Yo("ZodISODuration",(e,t)=>{Gl.init(e,t),zu.init(e,t)});function wu(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...vi(t)})}(vu,e)}const Su=Yo("ZodError",(e,t)=>{Ai.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,ni,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ni,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),ju=Ti(Su),ku=Pi(Su),Nu=Ii(Su),Eu=Ui(Su),Cu=Fi(Su),Au=zi(Su),_u=Li(Su),Tu=Wi(Su),Ru=$i(Su),Pu=Vi(Su),Ou=Bi(Su),Iu=Gi(Su),Du=Yo("ZodType",(e,t)=>(Al.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Hc(e,"input"),output:Hc(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=$c({...r,processors:t});return Vc(e,n),Bc(n,e),Gc(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(di(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)=>yi(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>ju(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>Nu(e,t,r),e.parseAsync=async(t,r)=>ku(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Eu(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>Cu(e,t,r),e.decode=(t,r)=>Au(e,t,r),e.encodeAsync=async(t,r)=>_u(e,t,r),e.decodeAsync=async(t,r)=>Tu(e,t,r),e.safeEncode=(t,r)=>Ru(e,t,r),e.safeDecode=(t,r)=>Pu(e,t,r),e.safeEncodeAsync=async(t,r)=>Ou(e,t,r),e.safeDecodeAsync=async(t,r)=>Iu(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,...vi(r)})}(_f,e,t)}(t,r)),e.superRefine=t=>e.check(Wc(t)),e.overwrite=t=>e.check(Lc(t)),e.optional=()=>xf(e),e.exactOptional=()=>new yf({type:"optional",innerType:e}),e.nullable=()=>wf(e),e.nullish=()=>xf(wf(e)),e.nonoptional=t=>function(e,t){return new kf({type:"nonoptional",innerType:e,...vi(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...vi(r)})}(df,e,t);var t},e.or=t=>function(e,t){return new pf({type:"union",options:e,...vi(t)})}([e,t]),e.and=t=>new mf({type:"intersection",left:e,right:t}),e.transform=t=>Cf(e,new gf({type:"transform",transform:t})),e.default=t=>{return r=t,new Sf({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():gi(r)}});var r},e.prefault=t=>{return r=t,new jf({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():gi(r)}});var r},e.catch=t=>{return new Nf({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Cf(e,t),e.readonly=()=>new Af({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Dc.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Dc.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Dc.get(e);const r=e.clone();return Dc.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Uu=Yo("_ZodString",(e,t)=>{_l.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:s,format:o,patterns:i,contentEncoding:l}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof s&&(n.maxLength=s),o&&(n.format=Zc[o]??o,""===n.format&&delete n.format,"time"===o&&delete n.format),l&&(n.contentEncoding=l),i&&i.size>0){const e=[...i];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new yl({check:"string_format",format:"regex",...vi(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Sl({check:"string_format",format:"includes",...vi(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new jl({check:"string_format",format:"starts_with",...vi(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new kl({check:"string_format",format:"ends_with",...vi(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Fc(...t)),e.max=(...t)=>e.check(Mc(...t)),e.length=(...t)=>e.check(zc(...t)),e.nonempty=(...t)=>e.check(Fc(1,...t)),e.lowercase=t=>e.check(function(e){return new vl({check:"string_format",format:"lowercase",...vi(e)})}(t)),e.uppercase=t=>e.check(function(e){return new wl({check:"string_format",format:"uppercase",...vi(e)})}(t)),e.trim=()=>e.check(Lc(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Lc(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Lc(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Lc(e=>e.toUpperCase())),e.slugify=()=>e.check(Lc(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),Mu=Yo("ZodString",(e,t)=>{_l.init(e,t),Uu.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...vi(t)})}(Lu,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...vi(t)})}(Vu,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...vi(t)})}(af,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...vi(t)})}(Bu,t)),e.guid=t=>e.check(Uc(Wu,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...vi(t)})}($u,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...vi(t)})}($u,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...vi(t)})}($u,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...vi(t)})}($u,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...vi(t)})}(Gu,t)),e.guid=t=>e.check(Uc(Wu,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...vi(t)})}(Ku,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...vi(t)})}(Hu,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...vi(t)})}(Zu,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...vi(t)})}(tf,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...vi(t)})}(rf,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...vi(t)})}(qu,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...vi(t)})}(Ju,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...vi(t)})}(Yu,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...vi(t)})}(Xu,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...vi(t)})}(Qu,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...vi(t)})}(ef,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...vi(t)})}(nf,t)),e.datetime=t=>e.check(hu(t)),e.date=t=>e.check(bu(t)),e.time=t=>e.check(yu(t)),e.duration=t=>e.check(wu(t))});function Fu(e){return function(e,t){return new e({type:"string",...vi(t)})}(Mu,e)}const zu=Yo("ZodStringFormat",(e,t)=>{Tl.init(e,t),Uu.init(e,t)}),Lu=Yo("ZodEmail",(e,t)=>{Ol.init(e,t),zu.init(e,t)}),Wu=Yo("ZodGUID",(e,t)=>{Rl.init(e,t),zu.init(e,t)}),$u=Yo("ZodUUID",(e,t)=>{Pl.init(e,t),zu.init(e,t)}),Vu=Yo("ZodURL",(e,t)=>{Il.init(e,t),zu.init(e,t)}),Bu=Yo("ZodEmoji",(e,t)=>{Dl.init(e,t),zu.init(e,t)}),Gu=Yo("ZodNanoID",(e,t)=>{Ul.init(e,t),zu.init(e,t)}),Ku=Yo("ZodCUID",(e,t)=>{Ml.init(e,t),zu.init(e,t)}),Hu=Yo("ZodCUID2",(e,t)=>{Fl.init(e,t),zu.init(e,t)}),Zu=Yo("ZodULID",(e,t)=>{zl.init(e,t),zu.init(e,t)}),qu=Yo("ZodXID",(e,t)=>{Ll.init(e,t),zu.init(e,t)}),Ju=Yo("ZodKSUID",(e,t)=>{Wl.init(e,t),zu.init(e,t)}),Yu=Yo("ZodIPv4",(e,t)=>{Kl.init(e,t),zu.init(e,t)}),Xu=Yo("ZodIPv6",(e,t)=>{Hl.init(e,t),zu.init(e,t)}),Qu=Yo("ZodCIDRv4",(e,t)=>{Zl.init(e,t),zu.init(e,t)}),ef=Yo("ZodCIDRv6",(e,t)=>{ql.init(e,t),zu.init(e,t)}),tf=Yo("ZodBase64",(e,t)=>{Yl.init(e,t),zu.init(e,t)}),rf=Yo("ZodBase64URL",(e,t)=>{Xl.init(e,t),zu.init(e,t)}),nf=Yo("ZodE164",(e,t)=>{Ql.init(e,t),zu.init(e,t)}),af=Yo("ZodJWT",(e,t)=>{ec.init(e,t),zu.init(e,t)}),sf=Yo("ZodUnknown",(e,t)=>{tc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function of(){return new sf({type:"unknown"})}const lf=Yo("ZodNever",(e,t)=>{rc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function cf(e){return function(e,t){return new e({type:"never",...vi(t)})}(lf,e)}const df=Yo("ZodArray",(e,t)=>{ac.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,s=e._zod.def,{minimum:o,maximum:i}=e._zod.bag;"number"==typeof o&&(a.minItems=o),"number"==typeof i&&(a.maxItems=i),a.type="array",a.items=Vc(s.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(Fc(t,r)),e.nonempty=t=>e.check(Fc(1,t)),e.max=(t,r)=>e.check(Mc(t,r)),e.length=(t,r)=>e.check(zc(t,r)),e.unwrap=()=>e.element});const uf=Yo("ZodObject",(e,t)=>{cc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,s=e._zod.def;a.type="object",a.properties={};const o=s.shape;for(const e in o)a.properties[e]=Vc(o[e],t,{...n,path:[...n.path,"properties",e]});const i=new Set(Object.keys(o)),l=new Set([...i].filter(e=>{const r=s.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));l.size>0&&(a.required=Array.from(l)),"never"===s.catchall?._zod.def.type?a.additionalProperties=!1:s.catchall?s.catchall&&(a.additionalProperties=Vc(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),li(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new hf({type:"enum",entries:r,...vi(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:of()}),e.loose=()=>e.clone({...e._zod.def,catchall:of()}),e.strict=()=>e.clone({...e._zod.def,catchall:cf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!hi(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=di(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return ci(this,"shape",r),r}});return yi(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!hi(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=di(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return ci(this,"shape",r),r}});return yi(e,r)}(e,t),e.merge=t=>function(e,t){const r=di(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return ci(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return yi(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 yi(e,di(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 ci(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=di(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 ci(this,"shape",n),n},checks:[]});return yi(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=di(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 ci(this,"shape",a),a},checks:[]});return yi(t,a)}(bf,e,t[0]),e.required=(...t)=>function(e,t,r){const n=di(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 ci(this,"shape",a),a}});return yi(t,n)}(kf,e,t[0])});function ff(e,t){const r={type:"object",shape:e??{},...vi(t)};return new uf(r)}const pf=Yo("ZodUnion",(e,t)=>{uc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=!1===a.inclusive,o=a.options.map((e,r)=>Vc(e,t,{...n,path:[...n.path,s?"oneOf":"anyOf",r]}));s?r.oneOf=o:r.anyOf=o})(e,t,r,n),e.options=t.options});const mf=Yo("ZodIntersection",(e,t)=>{fc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=Vc(a.left,t,{...n,path:[...n.path,"allOf",0]}),o=Vc(a.right,t,{...n,path:[...n.path,"allOf",1]}),i=e=>"allOf"in e&&1===Object.keys(e).length,l=[...i(s)?s.allOf:[s],...i(o)?o.allOf:[o]];r.allOf=l})(e,t,r,n)});const hf=Yo("ZodEnum",(e,t)=>{hc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=ri(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 hf({...t,checks:[],...vi(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 hf({...t,checks:[],...vi(n),entries:a})}});const gf=Yo("ZodTransform",(e,t)=>{gc.init(e,t),Du.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 Qo(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Ei(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(Ei(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const bf=Yo("ZodOptional",(e,t)=>{xc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>qc(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function xf(e){return new bf({type:"optional",innerType:e})}const yf=Yo("ZodExactOptional",(e,t)=>{yc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>qc(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const vf=Yo("ZodNullable",(e,t)=>{vc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=Vc(a.innerType,t,n),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=a.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function wf(e){return new vf({type:"nullable",innerType:e})}const Sf=Yo("ZodDefault",(e,t)=>{wc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Vc(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 jf=Yo("ZodPrefault",(e,t)=>{jc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Vc(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 kf=Yo("ZodNonOptional",(e,t)=>{kc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Vc(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Nf=Yo("ZodCatch",(e,t)=>{Ec.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let s;Vc(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{s=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const Ef=Yo("ZodPipe",(e,t)=>{Cc.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s="input"===t.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;Vc(s,t,n),t.seen.get(e).ref=s})(e,t,0,n),e.in=t.in,e.out=t.out});function Cf(e,t){return new Ef({type:"pipe",in:e,out:t})}const Af=Yo("ZodReadonly",(e,t)=>{_c.init(e,t),Du.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Vc(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=Yo("ZodCustom",(e,t)=>{Rc.init(e,t),Du.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 Tf=ff({name:Fu().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:Fu().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)")}),Rf={en:{nameLabel:"Name",emailLabel:"Email",submitText:"Submit",submittingText:"Submitting...",errorMessage:"An error occurred"},es:{nameLabel:"Nombre",emailLabel:"Correo electrónico",submitText:"Enviar",submittingText:"Enviando...",errorMessage:"Ocurrió un error"},fr:{nameLabel:"Nom",emailLabel:"Email",submitText:"Soumettre",submittingText:"Soumission...",errorMessage:"Une erreur est survenue"},de:{nameLabel:"Name",emailLabel:"E-Mail",submitText:"Absenden",submittingText:"Wird gesendet...",errorMessage:"Ein Fehler ist aufgetreten"},zh:{nameLabel:"姓名",emailLabel:"电子邮件",submitText:"提交",submittingText:"提交中...",errorMessage:"发生错误"},ja:{nameLabel:"名前",emailLabel:"メールアドレス",submitText:"送信",submittingText:"送信中...",errorMessage:"エラーが発生しました"},ko:{nameLabel:"이름",emailLabel:"이메일",submitText:"제출",submittingText:"제출 중...",errorMessage:"오류가 발생했습니다"}};function Pf({screen:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsx("p",{className:"text-2xl font-bold",children:t?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t?.description})]})}function Of({logo:t}){return"string"==typeof t?e.jsx("img",{src:t,alt:"Logo",className:"max-h-24"}):e.jsx("img",{src:t.bucket?.url,alt:"Logo",className:"max-h-24"})}const If=e=>{const{children:t}=e,{status:r}=es();return r!==exports.AuthStatus.authenticated?null:t},Df=e=>{const{children:t}=e,{status:r}=es();return r!==exports.AuthStatus.unauthenticated?null:t};If.displayName="WhenAuthenticated",Df.displayName="WhenUnauthenticated";const Uf=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=es();return n.includes(a?.role??"")?t:r||null},Mf=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=es(),{currentWorkspace:s}=or(),o=s?.users.find(e=>e._id===a?.id);return o&&n.includes(o?.role??"")?t:r||null};function Ff(){const e=t.useContext(fs);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])}}Uf.displayName="WhenRoles",Mf.displayName="WhenWorkspaceRoles";const zf=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=or(),a=n?.features?.[r];return a?t:null},Lf=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=or(),a=n?.features?.[r];return a?null:t},Wf=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Ff();return n(r)?t:null},$f=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Ff();return n(r)?null:t};zf.displayName="WhenWorkspaceFeatureEnabled",Lf.displayName="WhenWorkspaceFeatureDisabled",Wf.displayName="WhenUserFeatureEnabled",$f.displayName="WhenUserFeatureDisabled";const Vf=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:s}=jr();return s?r??null:a?.subscription?t:n??null},Bf=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:s}=jr();return s?r??null:a?.subscription?n??null:t},Gf=e=>{const{children:t,plans:r,loadingComponent:n,fallbackComponent:a}=e,{response:s,loading:o}=jr();if(o)return n??null;if(!s?.subscription)return a??null;const i=s.plan??s.subscription?.plan;if(!i)return a??null;const l=r.map(e=>e.trim().toLowerCase()),c=(i.slug??"").toLowerCase();return l.includes(c)?t:a??null},Kf=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:s}=jr();return s?r??null:"trialing"!==a?.subscription?.subscriptionStatus?n??null:t},Hf=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:s}=jr();return s?r??null:"trialing"===a?.subscription?.subscriptionStatus?n??null:t},Zf=e=>{const{children:t,loadingComponent:r,fallbackComponent:n,daysThreshold:a=3}=e,{response:s,loading:o}=jr();if(o)return r??null;const i=s?.subscription;if(!i||"trialing"!==i.subscriptionStatus)return n??null;const l=i.trialEnd||i.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};Vf.displayName="WhenSubscription",Bf.displayName="WhenNoSubscription",Gf.displayName="WhenSubscriptionToPlans",Kf.displayName="WhenTrialing",Hf.displayName="WhenNotTrialing",Zf.displayName="WhenTrialEnding";const qf=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:s,loading:o}=Ar();if(o)return n??null;const i=s?.[t];return i?i.available<=0?a??null:r:a??null},Jf=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:s,loading:o}=Ar();if(o)return n??null;const i=s?.[t];return i?i.available>0?a??null:r:a??null},Yf=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:s,loading:o}=Ar();if(o)return n??null;const i=s?.[t];return i&&i.hasOverage?r:a??null},Xf=e=>{const{slug:t,threshold:r,children:n,loadingComponent:a,fallbackComponent:s}=e,{quotas:o,loading:i}=Ar();if(i)return a??null;const l=o?.[t];if(!l)return s??null;return(l.included>0?l.consumed/l.included*100:l.consumed>0?100:0)<r?s??null:n};function Qf(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}function ep(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}qf.displayName="WhenQuotaAvailable",Jf.displayName="WhenQuotaExhausted",Yf.displayName="WhenQuotaOverage",Xf.displayName="WhenQuotaThreshold";var tp,rp=globalThis?.document?a.useLayoutEffect:()=>{},np=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=od(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),ap={exports:{}},sp={};function op(){if(tp)return sp;tp=1;var e=t;var r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,a=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function i(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),l=n({inst:{value:r,getSnapshot:t}}),c=l[0].inst,d=l[1];return s(function(){c.value=r,c.getSnapshot=t,i(c)&&d({inst:c})},[e,r,t]),a(function(){return i(c)&&d({inst:c}),e(function(){i(c)&&d({inst:c})})},[e]),o(r),r};return sp.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,sp}var ip,lp,cp={};
|
|
21
21
|
/**
|
|
22
22
|
* @license React
|
|
23
23
|
* use-sync-external-store-shim.development.js
|
|
@@ -26,4 +26,4 @@ var pd={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 rp(){return Qf||(Qf=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=t,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,s=r.useEffect,o=r.useLayoutEffect,i=r.useDebugValue,l=!1,c=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(t,d){l||void 0===r.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();n(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var p=(f=a({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return o(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[t,u,d]),s(function(){return e(p)&&m({inst:p}),t(function(){e(p)&&m({inst:p})})},[t]),i(u),u};tp.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),tp}function np(){return ep||(ep=1,"production"===process.env.NODE_ENV?Jf.exports=Xf():Jf.exports=rp()),Jf.exports}var ap=np();function sp(){return()=>{}}var op="Avatar",[ip]=function(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s);o.displayName=r+"Context";const i=n.length;n=[...n,s];const l=r=>{const{scope:n,children:s,...l}=r,c=n?.[t]?.[i]||o,d=a.useMemo(()=>l,Object.values(l));return e.jsx(c.Provider,{value:d,children:s})};return l.displayName=r+"Provider",[l,function(e,n){const l=n?.[t]?.[i]||o,c=a.useContext(l);if(c)return c;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},Gf(s,...r)]}(op),[lp,cp]=ip(op),dp=a.forwardRef((t,r)=>{const{__scopeAvatar:n,...s}=t,[o,i]=a.useState("idle");return e.jsx(lp,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:e.jsx(qf.span,{...s,ref:r})})});dp.displayName=op;var up="AvatarImage",fp=a.forwardRef((t,r)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:o=()=>{},...i}=t,l=cp(up,n),c=function(e,{referrerPolicy:t,crossOrigin:r}){const n=ap.useSyncExternalStore(sp,()=>!0,()=>!1),s=a.useRef(null),o=n?(s.current||(s.current=new window.Image),s.current):null,[i,l]=a.useState(()=>hp(o,e));return Zf(()=>{l(hp(o,e))},[o,e]),Zf(()=>{const e=e=>()=>{l(e)};if(!o)return;const n=e("loaded"),a=e("error");return o.addEventListener("load",n),o.addEventListener("error",a),t&&(o.referrerPolicy=t),"string"==typeof r&&(o.crossOrigin=r),()=>{o.removeEventListener("load",n),o.removeEventListener("error",a)}},[o,r,t]),i}(s,i),d=Kf(e=>{o(e),l.onImageLoadingStatusChange(e)});return Zf(()=>{"idle"!==c&&d(c)},[c,d]),"loaded"===c?e.jsx(qf.img,{...i,ref:r,src:s}):null});fp.displayName=up;var pp="AvatarFallback",mp=a.forwardRef((t,r)=>{const{__scopeAvatar:n,delayMs:s,...o}=t,i=cp(pp,n),[l,c]=a.useState(void 0===s);return a.useEffect(()=>{if(void 0!==s){const e=window.setTimeout(()=>c(!0),s);return()=>window.clearTimeout(e)}},[s]),l&&"loaded"!==i.imageLoadingStatus?e.jsx(qf.span,{...o,ref:r}):null});function hp(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}mp.displayName=pp;var gp=dp,bp=fp,xp=mp;const yp=a.forwardRef(({className:t,...r},n)=>e.jsx(gp,{ref:n,className:ke("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));yp.displayName=gp.displayName;const vp=a.forwardRef(({className:t,...r},n)=>e.jsx(bp,{ref:n,className:ke("aspect-square h-full w-full",t),...r}));vp.displayName=bp.displayName;const wp=a.forwardRef(({className:t,...r},n)=>e.jsx(xp,{ref:n,className:ke("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));function Sp(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function jp(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s),i=n.length;n=[...n,s];const l=r=>{const{scope:n,children:s,...l}=r,c=n?.[t]?.[i]||o,d=a.useMemo(()=>l,Object.values(l));return e.jsx(c.Provider,{value:d,children:s})};return l.displayName=r+"Provider",[l,function(e,n){const l=n?.[t]?.[i]||o,c=a.useContext(l);if(c)return c;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},kp(s,...r)]}function kp(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}wp.displayName=xp.displayName;var Np=a[" useId ".trim().toString()]||(()=>{}),Ep=0;function Cp(e){const[t,r]=a.useState(Np());return Zf(()=>{r(e=>e??String(Ep++))},[e]),e||(t?`radix-${t}`:"")}var Ap=a[" useInsertionEffect ".trim().toString()]||Zf;function _p({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,i]=function({defaultProp:e,onChange:t}){const[r,n]=a.useState(e),s=a.useRef(r),o=a.useRef(t);return Ap(()=>{o.current=t},[t]),a.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}({defaultProp:t,onChange:r}),l=void 0!==e,c=l?e:s;{const t=a.useRef(void 0!==e);a.useEffect(()=>{const e=t.current;if(e!==l){const t=e?"controlled":"uncontrolled",r=l?"controlled":"uncontrolled";console.warn(`${n} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=l},[l,n])}const d=a.useCallback(t=>{if(l){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&i.current?.(r)}else o(t)},[l,e,o,i]);return[c,d]}function Tp(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Jc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Rp=Symbol("radix.slottable");function Pp(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Rp}var Op=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=function(t){const r=Tp(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(Pp);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{});var Ip,Dp="dismissableLayer.update",Up="dismissableLayer.pointerDownOutside",Fp="dismissableLayer.focusOutside",Mp=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zp=a.forwardRef((t,r)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:l,onDismiss:c,...d}=t,u=a.useContext(Mp),[f,p]=a.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=a.useState({}),g=Yc(r,e=>p(e)),b=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=b.indexOf(x),v=f?b.indexOf(f):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,j=function(e,t=globalThis?.document){const r=Kf(e),n=a.useRef(!1),s=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let n=function(){$p(Up,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",s.current),s.current=n,t.addEventListener("click",s.current,{once:!0})):n()}else t.removeEventListener("click",s.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(o?.(e),l?.(e),e.defaultPrevented||c?.())},m),k=function(e,t=globalThis?.document){const r=Kf(e),n=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){$p(Fp,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(i?.(e),l?.(e),e.defaultPrevented||c?.())},m);return function(e,t=globalThis?.document){const r=Kf(e);a.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{v===u.layers.size-1&&(s?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},m),a.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Ip=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Lp(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=Ip)}},[f,m,n,u]),a.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Lp())},[f,u]),a.useEffect(()=>{const e=()=>h({});return document.addEventListener(Dp,e),()=>document.removeEventListener(Dp,e)},[]),e.jsx(Op.div,{...d,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Sp(t.onFocusCapture,k.onFocusCapture),onBlurCapture:Sp(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Sp(t.onPointerDownCapture,j.onPointerDownCapture)})});zp.displayName="DismissableLayer";function Lp(){const e=new CustomEvent(Dp);document.dispatchEvent(e)}function $p(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&s.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}a.forwardRef((t,r)=>{const n=a.useContext(Mp),s=a.useRef(null),o=Yc(r,s);return a.useEffect(()=>{const e=s.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),e.jsx(Op.div,{...t,ref:o})}).displayName="DismissableLayerBranch";var Wp="focusScope.autoFocusOnMount",Vp="focusScope.autoFocusOnUnmount",Bp={bubbles:!1,cancelable:!0},Gp=a.forwardRef((t,r)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...l}=t,[c,d]=a.useState(null),u=Kf(o),f=Kf(i),p=a.useRef(null),m=Yc(r,e=>d(e)),h=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(s){let e=function(e){if(h.paused||!c)return;const t=e.target;c.contains(t)?p.current=t:qp(p.current,{select:!0})},t=function(e){if(h.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||qp(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&qp(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()}}},[s,c,h.paused]),a.useEffect(()=>{if(c){Jp.add(h);const t=document.activeElement;if(!c.contains(t)){const r=new CustomEvent(Wp,Bp);c.addEventListener(Wp,u),c.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(qp(n,{select:t}),document.activeElement!==r)return}((e=Kp(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&qp(c))}return()=>{c.removeEventListener(Wp,u),setTimeout(()=>{const e=new CustomEvent(Vp,Bp);c.addEventListener(Vp,f),c.dispatchEvent(e),e.defaultPrevented||qp(t??document.body,{select:!0}),c.removeEventListener(Vp,f),Jp.remove(h)},0)}}var e},[c,u,f,h]);const g=a.useCallback(e=>{if(!n&&!s)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[a,s]=function(e){const t=Kp(e),r=Hp(t,e),n=Hp(t.reverse(),e);return[r,n]}(t);a&&s?e.shiftKey||r!==s?e.shiftKey&&r===a&&(e.preventDefault(),n&&qp(s,{select:!0})):(e.preventDefault(),n&&qp(a,{select:!0})):r===t&&e.preventDefault()}},[n,s,h.paused]);return e.jsx(Op.div,{tabIndex:-1,...l,ref:m,onKeyDown:g})});function Kp(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 Hp(e,t){for(const r of e)if(!Zp(r,{upTo:t}))return r}function Zp(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 qp(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()}}Gp.displayName="FocusScope";var Jp=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Yp(e,t),e.unshift(t)},remove(t){e=Yp(e,t),e[0]?.resume()}}}();function Yp(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var Xp=a.forwardRef((t,n)=>{const{container:s,...o}=t,[i,l]=a.useState(!1);Zf(()=>l(!0),[]);const c=s||i&&globalThis?.document?.body;return c?r.createPortal(e.jsx(Op.div,{...o,ref:n}),c):null});Xp.displayName="Portal";var Qp=e=>{const{present:t,children:r}=e,n=function(e){const[t,r]=a.useState(),n=a.useRef(null),s=a.useRef(e),o=a.useRef("none"),i=e?"mounted":"unmounted",[l,c]=function(e,t){return a.useReducer((e,r)=>t[e][r]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const e=em(n.current);o.current="mounted"===l?e:"none"},[l]),Zf(()=>{const t=n.current,r=s.current;if(r!==e){const n=o.current,a=em(t);if(e)c("MOUNT");else if("none"===a||"none"===t?.display)c("UNMOUNT");else{c(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}s.current=e}},[e,c]),Zf(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,a=a=>{const o=em(n.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c("ANIMATION_END"),!s.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},i=e=>{e.target===t&&(o.current=em(n.current))};return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",a),t.removeEventListener("animationend",a)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:a.useCallback(e=>{n.current=e?getComputedStyle(e):null,r(e)},[])}}(t),s="function"==typeof r?r({present:n.isPresent}):a.Children.only(r),o=Yc(n.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(s));return"function"==typeof r||n.isPresent?a.cloneElement(s,{ref:o}):null};function em(e){return e?.animationName||"none"}Qp.displayName="Presence";var tm=0;function rm(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nm()),document.body.insertAdjacentElement("beforeend",e[1]??nm()),tm++,()=>{1===tm&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),tm--}},[])}function nm(){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 sm(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 om="right-scroll-bar-position",im="width-before-scroll-bar";function lm(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var cm="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,dm=new WeakMap;function um(e,r){var n,a,s,o=(n=null,a=function(t){return e.forEach(function(e){return lm(e,t)})},(s=t.useState(function(){return{value:n,callback:a,facade:{get current(){return s.value},set current(e){var t=s.value;t!==e&&(s.value=e,s.callback(e,t))}}}})[0]).callback=a,s.facade);return cm(function(){var t=dm.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||lm(e,null)}),n.forEach(function(e){r.has(e)||lm(e,a)})}dm.set(o,e)},[e]),o}function fm(e){return e}var pm=function(e){var t=e.sideCar,r=sm(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return a.createElement(n,am({},r))};pm.isSideCarExport=!0;var mm=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=fm);var r=[],n=!1;return{read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var s=function(){var r=t;t=[],r.forEach(e)},o=function(){return Promise.resolve().then(s)};o(),r={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=am({async:!0,ssr:!1},e),t}(),hm=function(){},gm=a.forwardRef(function(e,t){var r=a.useRef(null),n=a.useState({onScrollCapture:hm,onWheelCapture:hm,onTouchMoveCapture:hm}),s=n[0],o=n[1],i=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,x=e.as,y=void 0===x?"div":x,v=e.gapMode,w=sm(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,j=um([r,t]),k=am(am({},w),s);return a.createElement(a.Fragment,null,u&&a.createElement(S,{sideCar:mm,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:o,allowPinchZoom:!!b,lockRef:r,gapMode:v}),i?a.cloneElement(a.Children.only(l),am(am({},k),{ref:j})):a.createElement(y,am({},k,{className:c,ref:j}),l))});gm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},gm.classNames={fullWidth:im,zeroRight:om};function bm(){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 xm=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=bm())&&(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)}}},ym=function(){var e,t=(e=xm(),function(t,r){a.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},vm={left:0,top:0,right:0,gap:0},wm=function(e){return parseInt(e||"",10)||0},Sm=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return vm;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[wm(r),wm(n),wm(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])}},jm=ym(),km="data-scroll-locked",Nm=function(e,t,r,n){var a=e.left,s=e.top,o=e.right,i=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(i,"px ").concat(n,";\n }\n body[").concat(km,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(s,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(om," {\n right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(im," {\n margin-right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(om," .").concat(om," {\n right: 0 ").concat(n,";\n }\n \n .").concat(im," .").concat(im," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(km,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},Em=function(){var e=parseInt(document.body.getAttribute(km)||"0",10);return isFinite(e)?e:0},Cm=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=void 0===n?"margin":n;a.useEffect(function(){return document.body.setAttribute(km,(Em()+1).toString()),function(){var e=Em()-1;e<=0?document.body.removeAttribute(km):document.body.setAttribute(km,e.toString())}},[]);var o=a.useMemo(function(){return Sm(s)},[s]);return a.createElement(jm,{styles:Nm(o,!t,s,r?"":"!important")})},Am=!1;if("undefined"!=typeof window)try{var _m=Object.defineProperty({},"passive",{get:function(){return Am=!0,!0}});window.addEventListener("test",_m,_m),window.removeEventListener("test",_m,_m)}catch(e){Am=!1}var Tm=!!Am&&{passive:!1},Rm=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])},Pm=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Om(e,n)){var a=Im(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Om=function(e,t){return"v"===e?function(e){return Rm(e,"overflowY")}(t):function(e){return Rm(e,"overflowX")}(t)},Im=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)},Dm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Um=function(e){return[e.deltaX,e.deltaY]},Fm=function(e){return e&&"current"in e?e.current:e},Mm=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},zm=0,Lm=[];function $m(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Wm,Vm=(Wm=function(e){var t=a.useRef([]),r=a.useRef([0,0]),n=a.useRef(),s=a.useState(zm++)[0],o=a.useState(ym)[0],i=a.useRef(e);a.useEffect(function(){i.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,s=t.length;a<s;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Fm),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=a.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,s=Dm(e),o=r.current,l="deltaX"in e?e.deltaX:o[0]-s[0],c="deltaY"in e?e.deltaY:o[1]-s[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=Pm(u,d);if(!m)return!0;if(m?a=u:(a="v"===u?"h":"v",m=Pm(u,d)),!m)return!1;if(!n.current&&"changedTouches"in e&&(l||c)&&(n.current=a),!a)return!0;var h=n.current||a;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),s=a*n,o=r.target,i=t.contains(o),l=!1,c=s>0,d=0,u=0;do{if(!o)break;var f=Im(e,o),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Om(e,o)&&(d+=m,u+=p);var h=o.parentNode;o=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!i&&o!==document.body||i&&(t.contains(o)||t===o));return(c&&Math.abs(d)<1||!c&&Math.abs(u)<1)&&(l=!0),l}(h,t,e,"h"===h?l:c)},[]),c=a.useCallback(function(e){var r=e;if(Lm.length&&Lm[Lm.length-1]===o){var n="deltaY"in r?Um(r):Dm(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,a=n,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)r.cancelable&&r.preventDefault();else if(!a){var s=(i.current.shards||[]).map(Fm).filter(Boolean).filter(function(e){return e.contains(r.target)});(s.length>0?l(r,s[0]):!i.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=a.useCallback(function(e,r,n,a){var s={name:e,delta:r,target:n,should:a,shadowParent:$m(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),u=a.useCallback(function(e){r.current=Dm(e),n.current=void 0},[]),f=a.useCallback(function(t){d(t.type,Um(t),t.target,l(t,e.lockRef.current))},[]),p=a.useCallback(function(t){d(t.type,Dm(t),t.target,l(t,e.lockRef.current))},[]);a.useEffect(function(){return Lm.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Tm),document.addEventListener("touchmove",c,Tm),document.addEventListener("touchstart",u,Tm),function(){Lm=Lm.filter(function(e){return e!==o}),document.removeEventListener("wheel",c,Tm),document.removeEventListener("touchmove",c,Tm),document.removeEventListener("touchstart",u,Tm)}},[]);var m=e.removeScrollBar,h=e.inert;return a.createElement(a.Fragment,null,h?a.createElement(o,{styles:Mm(s)}):null,m?a.createElement(Cm,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},mm.useMedium(Wm),pm),Bm=a.forwardRef(function(e,t){return a.createElement(gm,am({},e,{ref:t,sideCar:Vm}))});Bm.classNames=gm.classNames;var Gm=new WeakMap,Km=new WeakMap,Hm={},Zm=0,qm=function(e){return e&&(e.host||qm(e.parentNode))},Jm=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=qm(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]);Hm[r]||(Hm[r]=new WeakMap);var s=Hm[r],o=[],i=new Set,l=new Set(a),c=function(e){e&&!i.has(e)&&(i.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(i.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,l=(Gm.get(e)||0)+1,c=(s.get(e)||0)+1;Gm.set(e,l),s.set(e,c),o.push(e),1===l&&a&&Km.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),i.clear(),Zm++,function(){o.forEach(function(e){var t=Gm.get(e)-1,a=s.get(e)-1;Gm.set(e,t),s.set(e,a),t||(Km.has(e)||e.removeAttribute(n),Km.delete(e)),a||e.removeAttribute(r)}),--Zm||(Gm=new WeakMap,Gm=new WeakMap,Km=new WeakMap,Hm={})}},Ym=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"))),Jm(n,a,r,"aria-hidden")):function(){return null}};function Xm(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Jc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Qm=Symbol("radix.slottable");function eh(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Qm}var th="Dialog",[rh,nh]=jp(th),[ah,sh]=rh(th),oh=t=>{const{__scopeDialog:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:l=!0}=t,c=a.useRef(null),d=a.useRef(null),[u,f]=_p({prop:s,defaultProp:o??!1,onChange:i,caller:th});return e.jsx(ah,{scope:r,triggerRef:c,contentRef:d,contentId:Cp(),titleId:Cp(),descriptionId:Cp(),open:u,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:l,children:n})};oh.displayName=th;var ih="DialogTrigger",lh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=sh(ih,n),o=Yc(r,s.triggerRef);return e.jsx(Op.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ah(s.open),...a,ref:o,onClick:Sp(t.onClick,s.onOpenToggle)})});lh.displayName=ih;var ch="DialogPortal",[dh,uh]=rh(ch,{forceMount:void 0}),fh=t=>{const{__scopeDialog:r,forceMount:n,children:s,container:o}=t,i=sh(ch,r);return e.jsx(dh,{scope:r,forceMount:n,children:a.Children.map(s,t=>e.jsx(Qp,{present:n||i.open,children:e.jsx(Xp,{asChild:!0,container:o,children:t})}))})};fh.displayName=ch;var ph="DialogOverlay",mh=a.forwardRef((t,r)=>{const n=uh(ph,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=sh(ph,t.__scopeDialog);return o.modal?e.jsx(Qp,{present:a||o.open,children:e.jsx(gh,{...s,ref:r})}):null});mh.displayName=ph;var hh=function(t){const r=Xm(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(eh);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("DialogOverlay.RemoveScroll"),gh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=sh(ph,n);return e.jsx(Bm,{as:hh,allowPinchZoom:!0,shards:[s.contentRef],children:e.jsx(Op.div,{"data-state":Ah(s.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),bh="DialogContent",xh=a.forwardRef((t,r)=>{const n=uh(bh,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=sh(bh,t.__scopeDialog);return e.jsx(Qp,{present:a||o.open,children:o.modal?e.jsx(yh,{...s,ref:r}):e.jsx(vh,{...s,ref:r})})});xh.displayName=bh;var yh=a.forwardRef((t,r)=>{const n=sh(bh,t.__scopeDialog),s=a.useRef(null),o=Yc(r,n.contentRef,s);return a.useEffect(()=>{const e=s.current;if(e)return Ym(e)},[]),e.jsx(wh,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Sp(t.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Sp(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Sp(t.onFocusOutside,e=>e.preventDefault())})}),vh=a.forwardRef((t,r)=>{const n=sh(bh,t.__scopeDialog),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(wh,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),wh=a.forwardRef((t,r)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...l}=t,c=sh(bh,n),d=a.useRef(null),u=Yc(r,d);return rm(),e.jsxs(e.Fragment,{children:[e.jsx(Gp,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:e.jsx(zp,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Ah(c.open),...l,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(Ph,{titleId:c.titleId}),e.jsx(Oh,{contentRef:d,descriptionId:c.descriptionId})]})]})}),Sh="DialogTitle",jh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=sh(Sh,n);return e.jsx(Op.h2,{id:s.titleId,...a,ref:r})});jh.displayName=Sh;var kh="DialogDescription",Nh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=sh(kh,n);return e.jsx(Op.p,{id:s.descriptionId,...a,ref:r})});Nh.displayName=kh;var Eh="DialogClose",Ch=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=sh(Eh,n);return e.jsx(Op.button,{type:"button",...a,ref:r,onClick:Sp(t.onClick,()=>s.onOpenChange(!1))})});function Ah(e){return e?"open":"closed"}Ch.displayName=Eh;var _h="DialogTitleWarning",[Th,Rh]=function(t,r){const n=a.createContext(r),s=t=>{const{children:r,...s}=t,o=a.useMemo(()=>s,Object.values(s));return e.jsx(n.Provider,{value:o,children:r})};return s.displayName=t+"Provider",[s,function(e){const s=a.useContext(n);if(s)return s;if(void 0!==r)return r;throw new Error(`\`${e}\` must be used within \`${t}\``)}]}(_h,{contentName:bh,titleName:Sh,docsSlug:"dialog"}),Ph=({titleId:e})=>{const t=Rh(_h),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return a.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Oh=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Rh("DialogDescriptionWarning").contentName}}.`;return a.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},Ih=oh,Dh=lh,Uh=fh,Fh=mh,Mh=xh,zh=jh,Lh=Nh,$h=Ch;function Wh(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var Vh=["color"],Bh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Wh(e,Vh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Gh=["color"],Kh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Wh(e,Gh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Hh=["color"],Zh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Wh(e,Hh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),qh=["color"],Jh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Wh(e,qh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))});const Yh=Ih,Xh=Dh,Qh=Uh,eg=a.forwardRef(({className:t,...r},n)=>e.jsx(Fh,{ref:n,className:ke("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));eg.displayName=Fh.displayName;const tg=a.forwardRef(({className:t,children:r,...n},s)=>{const{container:o}=a.useContext(as);return e.jsxs(Qh,{container:o,children:[e.jsx(eg,{}),e.jsxs(Mh,{ref:s,className:ke("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...n,children:[r,e.jsxs($h,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Zh,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});tg.displayName=Mh.displayName;const rg=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});rg.displayName="DialogHeader";const ng=a.forwardRef(({className:t,...r},n)=>e.jsx(zh,{ref:n,className:ke("text-lg font-semibold leading-none tracking-tight",t),...r}));ng.displayName=zh.displayName;const ag=a.forwardRef(({className:t,...r},n)=>e.jsx(Lh,{ref:n,className:ke("text-sm text-muted-foreground",t),...r}));function sg(t){const r=og(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(lg);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}function og(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Jc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}ag.displayName=Lh.displayName;var ig=Symbol("radix.slottable");function lg(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ig}function cg(r){const n=r+"CollectionProvider",[a,s]=jp(n),[o,i]=a(n,{collectionRef:{current:null},itemMap:new Map}),l=r=>{const{scope:n,children:a}=r,s=t.useRef(null),i=t.useRef(new Map).current;return e.jsx(o,{scope:n,itemMap:i,collectionRef:s,children:a})};l.displayName=n;const c=r+"CollectionSlot",d=sg(c),u=t.forwardRef((t,r)=>{const{scope:n,children:a}=t,s=Yc(r,i(c,n).collectionRef);return e.jsx(d,{ref:s,children:a})});u.displayName=c;const f=r+"CollectionItemSlot",p="data-radix-collection-item",m=sg(f),h=t.forwardRef((r,n)=>{const{scope:a,children:s,...o}=r,l=t.useRef(null),c=Yc(n,l),d=i(f,a);return t.useEffect(()=>(d.itemMap.set(l,{ref:l,...o}),()=>{d.itemMap.delete(l)})),e.jsx(m,{[p]:"",ref:c,children:s})});return h.displayName=f,[{Provider:l,Slot:u,ItemSlot:h},function(e){const n=i(r+"CollectionConsumer",e),a=t.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),r=Array.from(n.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return r},[n.collectionRef,n.itemMap]);return a},s]}var dg=a.createContext(void 0);function ug(e){const t=a.useContext(dg);return e||t||"ltr"}var fg="rovingFocusGroup.onEntryFocus",pg={bubbles:!1,cancelable:!0},mg="RovingFocusGroup",[hg,gg,bg]=cg(mg),[xg,yg]=jp(mg,[bg]),[vg,wg]=xg(mg),Sg=a.forwardRef((t,r)=>e.jsx(hg.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(hg.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(jg,{...t,ref:r})})}));Sg.displayName=mg;var jg=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=t,m=a.useRef(null),h=Yc(r,m),g=ug(i),[b,x]=_p({prop:l,defaultProp:c??null,onChange:d,caller:mg}),[y,v]=a.useState(!1),w=Kf(u),S=gg(n),j=a.useRef(!1),[k,N]=a.useState(0);return a.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(fg,w),()=>e.removeEventListener(fg,w)},[w]),e.jsx(vg,{scope:n,orientation:s,dir:g,loop:o,currentTabStopId:b,onItemFocus:a.useCallback(e=>x(e),[x]),onItemShiftTab:a.useCallback(()=>v(!0),[]),onFocusableItemAdd:a.useCallback(()=>N(e=>e+1),[]),onFocusableItemRemove:a.useCallback(()=>N(e=>e-1),[]),children:e.jsx(Op.div,{tabIndex:y||0===k?-1:0,"data-orientation":s,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:Sp(t.onMouseDown,()=>{j.current=!0}),onFocus:Sp(t.onFocus,e=>{const t=!j.current;if(e.target===e.currentTarget&&t&&!y){const t=new CustomEvent(fg,pg);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Cg([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),f)}}j.current=!1}),onBlur:Sp(t.onBlur,()=>v(!1))})})}),kg="RovingFocusGroupItem",Ng=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:l,...c}=t,d=Cp(),u=i||d,f=wg(kg,n),p=f.currentTabStopId===u,m=gg(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:b}=f;return a.useEffect(()=>{if(s)return h(),()=>g()},[s,h,g]),e.jsx(hg.ItemSlot,{scope:n,id:u,focusable:s,active:o,children:e.jsx(Op.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...c,ref:r,onMouseDown:Sp(t.onMouseDown,e=>{s?f.onItemFocus(u):e.preventDefault()}),onFocus:Sp(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:Sp(t.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Eg[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(()=>Cg(r))}}),children:"function"==typeof l?l({isCurrentTabStop:p,hasTabStop:null!=b}):l})})});Ng.displayName=kg;var Eg={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Cg(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 Ag=Sg,_g=Ng;function Tg(e){const[t,r]=a.useState(void 0);return Zf(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let a,s;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,s=t.blockSize}else a=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Rg(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Pg="Radio",[Og,Ig]=jp(Pg),[Dg,Ug]=Og(Pg),Fg=a.forwardRef((t,r)=>{const{__scopeRadio:n,name:s,checked:o=!1,required:i,disabled:l,value:c="on",onCheck:d,form:u,...f}=t,[p,m]=a.useState(null),h=Yc(r,e=>m(e)),g=a.useRef(!1),b=!p||(u||!!p.closest("form"));return e.jsxs(Dg,{scope:n,checked:o,disabled:l,children:[e.jsx(Op.button,{type:"button",role:"radio","aria-checked":o,"data-state":$g(o),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:h,onClick:Sp(t.onClick,e=>{o||d?.(),b&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),b&&e.jsx(Lg,{control:p,bubbles:!g.current,name:s,value:c,checked:o,required:i,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});Fg.displayName=Pg;var Mg="RadioIndicator",zg=a.forwardRef((t,r)=>{const{__scopeRadio:n,forceMount:a,...s}=t,o=Ug(Mg,n);return e.jsx(Qp,{present:a||o.checked,children:e.jsx(Op.span,{"data-state":$g(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})})});zg.displayName=Mg;var Lg=a.forwardRef(({__scopeRadio:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const l=a.useRef(null),c=Yc(l,i),d=Rg(n),u=Tg(r);return a.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx(Op.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:c,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function $g(e){return e?"checked":"unchecked"}Lg.displayName="RadioBubbleInput";var Wg=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Vg="RadioGroup",[Bg]=jp(Vg,[yg,Ig]),Gg=yg(),Kg=Ig(),[Hg,Zg]=Bg(Vg),qg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:s,value:o,required:i=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:f,...p}=t,m=Gg(n),h=ug(d),[g,b]=_p({prop:o,defaultProp:s??null,onChange:f,caller:Vg});return e.jsx(Hg,{scope:n,name:a,required:i,disabled:l,value:g,onValueChange:b,children:e.jsx(Ag,{asChild:!0,...m,orientation:c,dir:h,loop:u,children:e.jsx(Op.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":l?"":void 0,dir:h,...p,ref:r})})})});qg.displayName=Vg;var Jg="RadioGroupItem",Yg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,disabled:s,...o}=t,i=Zg(Jg,n),l=i.disabled||s,c=Gg(n),d=Kg(n),u=a.useRef(null),f=Yc(r,u),p=i.value===o.value,m=a.useRef(!1);return a.useEffect(()=>{const e=e=>{Wg.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),e.jsx(_g,{asChild:!0,...c,focusable:!l,active:p,children:e.jsx(Fg,{disabled:l,required:i.required,checked:p,...d,...o,name:i.name,ref:f,onCheck:()=>i.onValueChange(o.value),onKeyDown:Sp(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:Sp(o.onFocus,()=>{m.current&&u.current?.click()})})})});Yg.displayName=Jg;var Xg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,...a}=t,s=Kg(n);return e.jsx(zg,{...s,...a,ref:r})});Xg.displayName="RadioGroupIndicator";var Qg=qg,eb=Yg,tb=Xg;const rb=a.forwardRef(({className:t,...r},n)=>e.jsx(Qg,{className:ke("grid gap-2",t),...r,ref:n}));rb.displayName=Qg.displayName;const nb=a.forwardRef(({className:t,...r},n)=>e.jsx(eb,{ref:n,className:ke("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:e.jsx(tb,{className:"flex items-center justify-center",children:e.jsx(Kh,{className:"h-3.5 w-3.5 fill-primary"})})}));function ab(e,[t,r]){return Math.min(r,Math.max(t,e))}nb.displayName=eb.displayName;var sb="ScrollArea",[ob]=jp(sb),[ib,lb]=ob(sb),cb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,type:s="hover",dir:o,scrollHideDelay:i=600,...l}=t,[c,d]=a.useState(null),[u,f]=a.useState(null),[p,m]=a.useState(null),[h,g]=a.useState(null),[b,x]=a.useState(null),[y,v]=a.useState(0),[w,S]=a.useState(0),[j,k]=a.useState(!1),[N,E]=a.useState(!1),C=Yc(r,e=>d(e)),A=ug(o);return e.jsx(ib,{scope:n,type:s,dir:A,scrollHideDelay:i,scrollArea:c,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:k,scrollbarY:b,onScrollbarYChange:x,scrollbarYEnabled:N,onScrollbarYEnabledChange:E,onCornerWidthChange:v,onCornerHeightChange:S,children:e.jsx(Op.div,{dir:A,...l,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});cb.displayName=sb;var db="ScrollAreaViewport",ub=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,children:s,nonce:o,...i}=t,l=lb(db,n),c=Yc(r,a.useRef(null),l.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),e.jsx(Op.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});ub.displayName=db;var fb="ScrollAreaScrollbar",pb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=lb(fb,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=o,c="horizontal"===t.orientation;return a.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),"hover"===o.type?e.jsx(mb,{...s,ref:r,forceMount:n}):"scroll"===o.type?e.jsx(hb,{...s,ref:r,forceMount:n}):"auto"===o.type?e.jsx(gb,{...s,ref:r,forceMount:n}):"always"===o.type?e.jsx(bb,{...s,ref:r}):null});pb.displayName=fb;var mb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=lb(fb,t.__scopeScrollArea),[i,l]=a.useState(!1);return a.useEffect(()=>{const e=o.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),l(!0)},n=()=>{t=window.setTimeout(()=>l(!1),o.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[o.scrollArea,o.scrollHideDelay]),e.jsx(Qp,{present:n||i,children:e.jsx(gb,{"data-state":i?"visible":"hidden",...s,ref:r})})}),hb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=lb(fb,t.__scopeScrollArea),i="horizontal"===t.orientation,l=Ub(()=>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"}},a.useReducer((e,t)=>f[e][t]??e,u));var u,f;return a.useEffect(()=>{if("idle"===c){const e=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(e)}},[c,o.scrollHideDelay,d]),a.useEffect(()=>{const e=o.viewport,t=i?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),l()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[o.viewport,i,d,l]),e.jsx(Qp,{present:n||"hidden"!==c,children:e.jsx(bb,{"data-state":"hidden"===c?"hidden":"visible",...s,ref:r,onPointerEnter:Sp(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Sp(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),gb=a.forwardRef((t,r)=>{const n=lb(fb,t.__scopeScrollArea),{forceMount:s,...o}=t,[i,l]=a.useState(!1),c="horizontal"===t.orientation,d=Ub(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;l(c?e:t)}},10);return Fb(n.viewport,d),Fb(n.content,d),e.jsx(Qp,{present:s||i,children:e.jsx(bb,{"data-state":i?"visible":"hidden",...o,ref:r})})}),bb=a.forwardRef((t,r)=>{const{orientation:n="vertical",...s}=t,o=lb(fb,t.__scopeScrollArea),i=a.useRef(null),l=a.useRef(0),[c,d]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Tb(c.viewport,c.content),f={...s,sizes:c,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:e=>l.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Rb(r),s=a/2,o=t||s,i=a-o,l=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-i,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Ob([l,c],u)(e)}(e,l.current,c,t)}return"horizontal"===n?e.jsx(xb,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Pb(o.viewport.scrollLeft,c,o.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=p(e,o.dir))}}):"vertical"===n?e.jsx(yb,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Pb(o.viewport.scrollTop,c);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=p(e))}}):null}),xb=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=lb(fb,t.__scopeScrollArea),[l,c]=a.useState(),d=a.useRef(null),u=Yc(r,d,i.onScrollbarXChange);return a.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),e.jsx(Sb,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Rb(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollLeft+e.deltaX;t.onWheelScroll(n),Ib(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&s({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:_b(l.paddingLeft),paddingEnd:_b(l.paddingRight)}})}})}),yb=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=lb(fb,t.__scopeScrollArea),[l,c]=a.useState(),d=a.useRef(null),u=Yc(r,d,i.onScrollbarYChange);return a.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),e.jsx(Sb,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Rb(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollTop+e.deltaY;t.onWheelScroll(n),Ib(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&s({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:_b(l.paddingTop),paddingEnd:_b(l.paddingBottom)}})}})}),[vb,wb]=ob(fb),Sb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:o,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=t,h=lb(fb,n),[g,b]=a.useState(null),x=Yc(r,e=>b(e)),y=a.useRef(null),v=a.useRef(""),w=h.viewport,S=s.content-s.viewport,j=Kf(f),k=Kf(d),N=Ub(p,10);function E(e){if(y.current){const t=e.clientX-y.current.left,r=e.clientY-y.current.top;u({x:t,y:r})}}return a.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&j(e,S)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,g,S,j]),a.useEffect(k,[s,k]),Fb(g,N),Fb(h.content,N),e.jsx(vb,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:Kf(i),onThumbPointerUp:Kf(l),onThumbPositionChange:k,onThumbPointerDown:Kf(c),children:e.jsx(Op.div,{...m,ref:x,style:{position:"absolute",...m.style},onPointerDown:Sp(t.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),y.current=g.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),E(e)}}),onPointerMove:Sp(t.onPointerMove,E),onPointerUp:Sp(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),jb="ScrollAreaThumb",kb=a.forwardRef((t,r)=>{const{forceMount:n,...a}=t,s=wb(jb,t.__scopeScrollArea);return e.jsx(Qp,{present:n||s.hasThumb,children:e.jsx(Nb,{ref:r,...a})})}),Nb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,style:s,...o}=t,i=lb(jb,n),l=wb(jb,n),{onThumbPositionChange:c}=l,d=Yc(r,e=>l.onThumbChange(e)),u=a.useRef(void 0),f=Ub(()=>{u.current&&(u.current(),u.current=void 0)},100);return a.useEffect(()=>{const e=i.viewport;if(e){const t=()=>{if(f(),!u.current){const t=Db(e,c);u.current=t,c()}};return c(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,c]),e.jsx(Op.div,{"data-state":l.hasThumb?"visible":"hidden",...o,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Sp(t.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;l.onThumbPointerDown({x:r,y:n})}),onPointerUp:Sp(t.onPointerUp,l.onThumbPointerUp)})});kb.displayName=jb;var Eb="ScrollAreaCorner",Cb=a.forwardRef((t,r)=>{const n=lb(Eb,t.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?e.jsx(Ab,{...t,ref:r}):null});Cb.displayName=Eb;var Ab=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,...s}=t,o=lb(Eb,n),[i,l]=a.useState(0),[c,d]=a.useState(0),u=Boolean(i&&c);return Fb(o.scrollbarX,()=>{const e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),d(e)}),Fb(o.scrollbarY,()=>{const e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),l(e)}),u?e.jsx(Op.div,{...s,ref:r,style:{width:i,height:c,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...t.style}}):null});function _b(e){return e?parseInt(e,10):0}function Tb(e,t){const r=e/t;return isNaN(r)?0:r}function Rb(e){const t=Tb(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Pb(e,t,r="ltr"){const n=Rb(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,o=t.content-t.viewport,i=s-n,l=ab(e,"ltr"===r?[0,o]:[-1*o,0]);return Ob([0,o],[0,i])(l)}function Ob(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 Ib(e,t){return e>0&&e<t}var Db=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,i=r.top!==s.top;(o||i)&&t(),r=s,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Ub(e,t){const r=Kf(e),n=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),a.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Fb(e,t){const r=Kf(t);Zf(()=>{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 Mb=cb,zb=ub,Lb=Cb;const $b=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Mb,{ref:a,className:ke("relative overflow-hidden",t),...n,children:[e.jsx(zb,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx(Wb,{}),e.jsx(Lb,{})]}));$b.displayName=Mb.displayName;const Wb=a.forwardRef(({className:t,orientation:r="vertical",...n},a)=>e.jsx(pb,{ref:a,orientation:r,className:ke("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",t),...n,children:e.jsx(kb,{className:ke("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));Wb.displayName=pb.displayName;var Vb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=td(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),Bb="horizontal",Gb=["horizontal","vertical"],Kb=a.forwardRef((t,r)=>{const{decorative:n,orientation:a=Bb,...s}=t,o=function(e){return Gb.includes(e)}(a)?a:Bb,i=n?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"};return e.jsx(Vb.div,{"data-orientation":o,...i,...s,ref:r})});Kb.displayName="Separator";var Hb=Kb;const Zb=a.forwardRef(({className:t,orientation:r="horizontal",decorative:n=!0,...a},s)=>e.jsx(Hb,{ref:s,decorative:n,orientation:r,className:ke("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",t),...a}));Zb.displayName=Hb.displayName;var qb=Symbol("radix.slottable");var Jb="AlertDialog",[Yb]=jp(Jb,[nh]),Xb=nh(),Qb=t=>{const{__scopeAlertDialog:r,...n}=t,a=Xb(r);return e.jsx(Ih,{...a,...n,modal:!0})};Qb.displayName=Jb;var ex=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Xb(n);return e.jsx(Dh,{...s,...a,ref:r})});ex.displayName="AlertDialogTrigger";var tx=t=>{const{__scopeAlertDialog:r,...n}=t,a=Xb(r);return e.jsx(Uh,{...a,...n})};tx.displayName="AlertDialogPortal";var rx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Xb(n);return e.jsx(Fh,{...s,...a,ref:r})});rx.displayName="AlertDialogOverlay";var nx="AlertDialogContent",[ax,sx]=Yb(nx),ox=function(t){const r=({children:t})=>e.jsx(e.Fragment,{children:t});return r.displayName=`${t}.Slottable`,r.__radixId=qb,r}("AlertDialogContent"),ix=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,children:s,...o}=t,i=Xb(n),l=a.useRef(null),c=Yc(r,l),d=a.useRef(null);return e.jsx(Th,{contentName:nx,titleName:lx,docsSlug:"alert-dialog",children:e.jsx(ax,{scope:n,cancelRef:d,children:e.jsxs(Mh,{role:"alertdialog",...i,...o,ref:c,onOpenAutoFocus:Sp(o.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e.jsx(ox,{children:s}),e.jsx(hx,{contentRef:l})]})})})});ix.displayName=nx;var lx="AlertDialogTitle",cx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Xb(n);return e.jsx(zh,{...s,...a,ref:r})});cx.displayName=lx;var dx="AlertDialogDescription",ux=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Xb(n);return e.jsx(Lh,{...s,...a,ref:r})});ux.displayName=dx;var fx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Xb(n);return e.jsx($h,{...s,...a,ref:r})});fx.displayName="AlertDialogAction";var px="AlertDialogCancel",mx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,{cancelRef:s}=sx(px,n),o=Xb(n),i=Yc(r,s);return e.jsx($h,{...o,...a,ref:i})});mx.displayName=px;var hx=({contentRef:e})=>{const t=`\`${nx}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${nx}\` by passing a \`${dx}\` 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 \`${nx}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return a.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},gx=rx,bx=ix,xx=fx,yx=mx,vx=cx,wx=ux;const Sx=Qb,jx=ex,kx=tx,Nx=a.forwardRef(({className:t,...r},n)=>e.jsx(gx,{className:ke("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:n}));Nx.displayName=gx.displayName;const Ex=a.forwardRef(({className:t,...r},n)=>{const{container:s}=a.useContext(as);return e.jsxs(kx,{container:s,children:[e.jsx(Nx,{}),e.jsx(bx,{ref:n,className:ke("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...r})]})});Ex.displayName=bx.displayName;const Cx=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col space-y-2 text-center sm:text-left",t),...r});Cx.displayName="AlertDialogHeader";const Ax=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Ax.displayName="AlertDialogFooter";const _x=a.forwardRef(({className:t,...r},n)=>e.jsx(vx,{ref:n,className:ke("text-lg font-semibold",t),...r}));_x.displayName=vx.displayName;const Tx=a.forwardRef(({className:t,...r},n)=>e.jsx(wx,{ref:n,className:ke("text-sm text-muted-foreground",t),...r}));Tx.displayName=wx.displayName;const Rx=a.forwardRef(({className:t,...r},n)=>e.jsx(xx,{ref:n,className:ke(zd(),t),...r}));Rx.displayName=xx.displayName;const Px=a.forwardRef(({className:t,...r},n)=>e.jsx(yx,{ref:n,className:ke(zd({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));function Ox(){return e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(nu,{className:"h-10 w-full"}),e.jsx(nu,{className:"h-10 w-full"}),e.jsx(nu,{className:"h-10 w-full"})]})}Px.displayName=yx.displayName;const Ix=({workspace:r})=>{const[n,a]=t.useState(!1),{deleteWorkspace:s}=or(),{user:o}=ts();if(!r)return e.jsx(Ox,{});const i=ar(r,o?.id??null);return"admin"===i?.toLowerCase()?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",e.jsx("strong",{children:r.name})," and all of its data, including members, settings, and features."]})]}),e.jsxs(Sx,{children:[e.jsx(jx,{asChild:!0,children:e.jsxs(Ld,{variant:"destructive",disabled:n,progress:n,children:[e.jsx(Id,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e.jsxs(Ex,{children:[e.jsxs(Cx,{children:[e.jsx(_x,{children:"Are you absolutely sure?"}),e.jsxs(Tx,{children:["This action cannot be undone. This will permanently delete the workspace"," ",e.jsx("strong",{children:r.name})," and all of its data."]})]}),e.jsxs(Ax,{children:[e.jsx(Px,{disabled:n,children:"Cancel"}),e.jsx(Rx,{onClick:async()=>{a(!0);try{await s(r._id)}catch(e){De(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:r._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{a(!1)}},disabled:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(Ed,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var Dx="Switch",[Ux]=jp(Dx),[Fx,Mx]=Ux(Dx),zx=a.forwardRef((t,r)=>{const{__scopeSwitch:n,name:s,checked:o,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:u,form:f,...p}=t,[m,h]=a.useState(null),g=Yc(r,e=>h(e)),b=a.useRef(!1),x=!m||(f||!!m.closest("form")),[y,v]=_p({prop:o,defaultProp:i??!1,onChange:u,caller:Dx});return e.jsxs(Fx,{scope:n,checked:y,disabled:c,children:[e.jsx(Op.button,{type:"button",role:"switch","aria-checked":y,"aria-required":l,"data-state":Vx(y),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:g,onClick:Sp(t.onClick,e=>{v(e=>!e),x&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),x&&e.jsx(Wx,{control:m,bubbles:!b.current,name:s,value:d,checked:y,required:l,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});zx.displayName=Dx;var Lx="SwitchThumb",$x=a.forwardRef((t,r)=>{const{__scopeSwitch:n,...a}=t,s=Mx(Lx,n);return e.jsx(Op.span,{"data-state":Vx(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:r})});$x.displayName=Lx;var Wx=a.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const l=a.useRef(null),c=Yc(l,i),d=Rg(n),u=Tg(r);return a.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:c,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Vx(e){return e?"checked":"unchecked"}Wx.displayName="SwitchBubbleInput";var Bx=zx,Gx=$x;const Kx=a.forwardRef(({className:t,...r},n)=>e.jsx(Bx,{className:ke("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...r,ref:n,children:e.jsx(Gx,{className:ke("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Kx.displayName=Bx.displayName;const Hx=({workspaceId:r})=>{const[n,a]=t.useState({}),[s,o]=t.useState(null),i=t.useRef(null),{allFeatures:l,updateFeature:c,getWorkspace:d}=or();t.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const[u,f]=t.useState(null),{user:p}=ts();if(t.useEffect(()=>{d(r).then(f)},[r]),!u)return e.jsx(Ox,{});const m=nr(u,p?.id??null);return e.jsxs("div",{children:[s&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:s})]}),e.jsxs("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!m&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!l.length&&e.jsx("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),l.length>0&&e.jsx("div",{className:"flex flex-col gap-y-3.5",children:l.map(t=>{const r=u?.features?.[t.slug],s=null!==n[t.slug]&&void 0!==n[t.slug],d=n[t.slug],p=!0===d?"Enabling":!1===d?"Disabling":"";return e.jsxs("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e.jsxs("div",{className:"flex gap-x-2 flex-col",children:[e.jsx("h3",{className:"font-medium text-ellipsis",children:t.name}),e.jsx("p",{className:"text-muted-foreground",children:t.description})]}),s?e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsx(Ed,{className:"h-4 w-4 animate-spin text-gray-500"}),e.jsxs("span",{className:"text-sm text-gray-600",children:[p,"..."]})]}):e.jsx(Kx,{disabled:!m,checked:r??t.defaultValue,onCheckedChange:e=>async function(e,t){if(u){a(r=>({...r,[e]:t})),o(null);try{const r=await c(u._id,e,t);f(r);const n=l.find(t=>t.slug===e);o(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{o(null)},5e3)}catch(t){De(t,{component:"WorkspaceSettingsFeatures",action:"updateFeature",metadata:{workspaceId:u._id,featureKey:e}})}finally{a(t=>({...t,[e]:null}))}}}(t.slug,e)})]},t._id)})})]})]})},Zx={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:"฿"},qx={usd:"🇺🇸",eur:"🇪🇺",gbp:"🇬🇧",jpy:"🇯🇵",cad:"🇨🇦",aud:"🇦🇺",chf:"🇨🇭",cny:"🇨🇳",hkd:"🇭🇰",sgd:"🇸🇬",inr:"🇮🇳",mxn:"🇲🇽",brl:"🇧🇷",nzd:"🇳🇿",sek:"🇸🇪",nok:"🇳🇴",dkk:"🇩🇰",pln:"🇵🇱",thb:"🇹🇭"};function Jx(e){return e&&e.trim()?qx[e.trim().toLowerCase()]??"":""}function Yx(e){if(!e||!e.trim())return"";const t=e.trim().toLowerCase();return Zx[t]??t.toUpperCase()}const Xx=["usd","eur","gbp","jpy","cad","aud","chf","cny","hkd","sgd","inr","mxn","brl","nzd","sek","nok","dkk","pln","thb"],Qx=Xx.map(e=>({value:e,label:`${e.toUpperCase()} (${Yx(e)})`}));function ey(e,t){return Yx(t)+(e/100).toFixed(2)}function ty(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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</text></svg>`}const ry=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑💻","👨💻","👩💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨💼","👩💼","👨🏫","👩🏫","👨🔬","👩🔬","👨🎨","👩🎨","👨🔧","👩🔧","👨🚀","👩🚀","👨⚖️","👩⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️🌈","🎟️","🎫"],ny=({workspace:r})=>{const[n,a]=t.useState(!1),[s,o]=t.useState("emoji"),[i,l]=t.useState(),[c,d]=t.useState(null),u=t.useRef(null),{updateWorkspace:f}=or();t.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const{user:p}=ts(),m=Lo({resolver:Zc(nf({name:Tu().min(2,{message:"Workspace name must be at least 2 characters."}),image:Tu().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return e.jsx(Ox,{});const h=nr(r,p?.id??null);return e.jsxs("div",{children:[c&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:c})]}),!h&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),e.jsx(Kd,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(async function(e){a(!0),d(null);try{await f(r,e),d("Workspace settings saved successfully"),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{d(null)},5e3)}catch(e){De(e,{component:"WorkspaceSettingsGeneral",action:"updateWorkspace",metadata:{workspaceId:r._id}})}finally{a(!1)}}),className:"space-y-6",children:[e.jsx(Zd,{control:m.control,name:"name",render:({field:t})=>e.jsxs(Yd,{children:[e.jsx(Xd,{children:"Name"}),e.jsx(Qd,{children:e.jsx(ru,{placeholder:"My Awesome Workspace",...t,disabled:!h})}),e.jsx(tu,{})]})}),r.billingCurrency?.trim()&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Gd,{className:"text-sm font-medium text-muted-foreground",children:"Billing currency"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[Jx(r.billingCurrency)&&e.jsx("span",{className:"text-base",children:Jx(r.billingCurrency)}),e.jsx("span",{children:r.billingCurrency.trim().toUpperCase()})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Gd,{className:"text-sm font-medium",children:"Icon"}),e.jsx(eu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(rb,{value:s,disabled:!h,onValueChange:e=>o(e),className:"flex flex-col space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(nb,{value:"emoji",id:"emoji"}),e.jsxs(Gd,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(Pd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(nb,{value:"url",id:"url"}),e.jsxs(Gd,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(Nd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsxs("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[i&&e.jsx("span",{className:"text-2xl",children:i}),!i&&m.watch("image")?.trim()&&e.jsx("img",{src:m.watch("image")||void 0,alt:"Workspace preview"})]})]}),h&&e.jsx($b,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:ry.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{l(e),m.setValue("image",ty(e))})(t),disabled:!h,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(i===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(Zd,{control:m.control,name:"image",render:({field:t})=>e.jsxs(Yd,{children:[e.jsx(Xd,{children:"Image URL"}),e.jsx(Qd,{children:e.jsx(ru,{placeholder:"https://example.com/image.png",...t,disabled:!h})}),e.jsx(eu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(tu,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:m.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),e.jsx("div",{className:"flex justify-end gap-3 pt-4",children:h&&e.jsx(Ld,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var ay=.999,sy=/[\\\/_+.#"@\[\(\{&]/,oy=/[\\\/_+.#"@\[\(\{&]/g,iy=/[\s-]/,ly=/[\s-]/g;function cy(e,t,r,n,a,s,o){if(s===t.length)return a===e.length?1:.99;var i=`${a},${s}`;if(void 0!==o[i])return o[i];for(var l,c,d,u,f=n.charAt(s),p=r.indexOf(f,a),m=0;p>=0;)(l=cy(e,t,r,n,p+1,s+1,o))>m&&(p===a?l*=1:sy.test(e.charAt(p-1))?(l*=.8,(d=e.slice(a,p-1).match(oy))&&a>0&&(l*=Math.pow(ay,d.length))):iy.test(e.charAt(p-1))?(l*=.9,(u=e.slice(a,p-1).match(ly))&&a>0&&(l*=Math.pow(ay,u.length))):(l*=.17,a>0&&(l*=Math.pow(ay,p-a))),e.charAt(p)!==t.charAt(s)&&(l*=.9999)),(l<.1&&r.charAt(p-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(p-1)!==n.charAt(s))&&(.1*(c=cy(e,t,r,n,p+1,s+2,o))>l&&(l=.1*c)),l>m&&(m=l),p=r.indexOf(f,p+1);return o[i]=m,m}function dy(e){return e.toLowerCase().replace(ly," ")}function uy(e,t,r){return cy(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,dy(e),dy(t),0,0,{})}var fy='[cmdk-group=""]',py='[cmdk-group-items=""]',my='[cmdk-item=""]',hy=`${my}:not([aria-disabled="true"])`,gy="cmdk-item-select",by="data-value",xy=(e,t,r)=>uy(e,t,r),yy=a.createContext(void 0),vy=()=>a.useContext(yy),wy=a.createContext(void 0),Sy=()=>a.useContext(wy),jy=a.createContext(void 0),ky=a.forwardRef((e,t)=>{let r=My(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=My(()=>new Set),s=My(()=>new Map),o=My(()=>new Map),i=My(()=>new Set),l=Uy(e),{label:c,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:b=!0,...x}=e,y=Cp(),v=Cp(),w=Cp(),S=a.useRef(null),j=$y();Fy(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,k.emit()}},[u]),Fy(()=>{j(6,T)},[]);let k=a.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,s,o,i;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)_(),C(),j(1,A);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(a=document.getElementById(y))||a.focus()}if(j(7,()=>{var e;r.current.selectedItemId=null==(e=R())?void 0:e.id,k.emit()}),n||j(5,T),void 0!==(null==(s=l.current)?void 0:s.value)){let e=null!=t?t:"";return void(null==(i=(o=l.current).onValueChange)||i.call(o,e))}}k.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),N=a.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=o.current.get(e))?void 0:a.value)&&(o.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,E(t,n)),j(2,()=>{C(),k.emit()}))},item:(e,t)=>(n.current.add(e),t&&(s.current.has(t)?s.current.get(t).add(e):s.current.set(t,new Set([e]))),j(3,()=>{_(),C(),r.current.value||A(),k.emit()}),()=>{o.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=R();j(4,()=>{_(),(null==t?void 0:t.getAttribute("id"))===e&&A(),k.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{o.current.delete(e),s.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:y,inputId:w,labelId:v,listInnerRef:S}),[]);function E(e,t){var n,a;let s=null!=(a=null==(n=l.current)?void 0:n.filter)?a:xy;return e?s(e,r.current.search,t):0}function C(){if(!r.current.search||!1===l.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=s.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;P().sort((t,r)=>{var n,a;let s=t.getAttribute("id"),o=r.getAttribute("id");return(null!=(n=e.get(o))?n:0)-(null!=(a=e.get(s))?a:0)}).forEach(e=>{let t=e.closest(py);t?t.appendChild(e.parentElement===t?e:e.closest(`${py} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${py} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${fy}[${by}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function A(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(by);k.setState("value",t||void 0)}function _(){var e,t,a,i;if(!r.current.search||!1===l.current.shouldFilter)return void(r.current.filtered.count=n.current.size);r.current.filtered.groups=new Set;let c=0;for(let s of n.current){let n=E(null!=(t=null==(e=o.current.get(s))?void 0:e.value)?t:"",null!=(i=null==(a=o.current.get(s))?void 0:a.keywords)?i:[]);r.current.filtered.items.set(s,n),n>0&&c++}for(let[e,t]of s.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=c}function T(){var e,t,r;let n=R();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(fy))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function R(){var e;return null==(e=S.current)?void 0:e.querySelector(`${my}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(hy))||[])}function O(e){let t=P()[e];t&&k.setState("value",t.getAttribute(by))}function I(e){var t;let r=R(),n=P(),a=n.findIndex(e=>e===r),s=n[a+e];null!=(t=l.current)&&t.loop&&(s=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),s&&k.setState("value",s.getAttribute(by))}function D(e){let t,r=R(),n=null==r?void 0:r.closest(fy);for(;n&&!t;)n=e>0?Iy(n,fy):Dy(n,fy),t=null==n?void 0:n.querySelector(hy);t?k.setState("value",t.getAttribute(by)):I(e)}let U=()=>O(P().length-1),F=e=>{e.preventDefault(),e.metaKey?U():e.altKey?D(1):I(1)},M=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?D(-1):I(-1)};return a.createElement(Op.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=x.onKeyDown)||t.call(x,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":b&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":b&&e.ctrlKey&&M(e);break;case"ArrowUp":M(e);break;case"Home":e.preventDefault(),O(0);break;case"End":e.preventDefault(),U();break;case"Enter":{e.preventDefault();let t=R();if(t){let e=new Event(gy);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:N.inputId,id:N.labelId,style:Vy},c),Wy(e,e=>a.createElement(wy.Provider,{value:k},a.createElement(yy.Provider,{value:N},e))))}),Ny=a.forwardRef((e,t)=>{var r,n;let s=Cp(),o=a.useRef(null),i=a.useContext(jy),l=vy(),c=Uy(e),d=null!=(n=null==(r=c.current)?void 0:r.forceMount)?n:null==i?void 0:i.forceMount;Fy(()=>{if(!d)return l.item(s,null==i?void 0:i.id)},[d]);let u=Ly(s,o,[e.value,e.children,o],e.keywords),f=Sy(),p=zy(e=>e.value&&e.value===u.current),m=zy(e=>!(!d&&!1!==l.filter())||(!e.search||e.filtered.items.get(s)>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(a.useEffect(()=>{let t=o.current;if(t&&!e.disabled)return t.addEventListener(gy,h),()=>t.removeEventListener(gy,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:b,value:x,onSelect:y,forceMount:v,keywords:w,...S}=e;return a.createElement(Op.div,{ref:Jc(o,t),...S,id:s,"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)}),Ey=a.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...o}=e,i=Cp(),l=a.useRef(null),c=a.useRef(null),d=Cp(),u=vy(),f=zy(e=>!(!s&&!1!==u.filter())||(!e.search||e.filtered.groups.has(i)));Fy(()=>u.group(i),[]),Ly(i,l,[e.value,e.heading,c]);let p=a.useMemo(()=>({id:i,forceMount:s}),[s]);return a.createElement(Op.div,{ref:Jc(l,t),...o,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&a.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),Wy(e,e=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},a.createElement(jy.Provider,{value:p},e))))}),Cy=a.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=a.useRef(null),o=zy(e=>!e.search);return r||o?a.createElement(Op.div,{ref:Jc(s,t),...n,"cmdk-separator":"",role:"separator"}):null}),Ay=a.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=null!=e.value,o=Sy(),i=zy(e=>e.search),l=zy(e=>e.selectedItemId),c=vy();return a.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),a.createElement(Op.input,{ref:t,...n,"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:s?e.value:i,onChange:e=>{s||o.setState("search",e.target.value),null==r||r(e.target.value)}})}),_y=a.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,o=a.useRef(null),i=a.useRef(null),l=zy(e=>e.selectedItemId),c=vy();return a.useEffect(()=>{if(i.current&&o.current){let e,t=i.current,r=o.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),a.createElement(Op.div,{ref:Jc(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:c.listId},Wy(e,e=>a.createElement("div",{ref:Jc(i,c.listInnerRef),"cmdk-list-sizer":""},e)))}),Ty=a.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:o,container:i,...l}=e;return a.createElement(Ih,{open:r,onOpenChange:n},a.createElement(Uh,{container:i},a.createElement(Fh,{"cmdk-overlay":"",className:s}),a.createElement(Mh,{"aria-label":e.label,"cmdk-dialog":"",className:o},a.createElement(ky,{ref:t,...l}))))}),Ry=a.forwardRef((e,t)=>zy(e=>0===e.filtered.count)?a.createElement(Op.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Py=a.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...o}=e;return a.createElement(Op.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Wy(e,e=>a.createElement("div",{"aria-hidden":!0},e)))}),Oy=Object.assign(ky,{List:_y,Item:Ny,Input:Ay,Group:Ey,Separator:Cy,Dialog:Ty,Empty:Ry,Loading:Py});function Iy(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Dy(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Uy(e){let t=a.useRef(e);return Fy(()=>{t.current=e}),t}var Fy="undefined"==typeof window?a.useEffect:a.useLayoutEffect;function My(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function zy(e){let t=Sy(),r=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,r,r)}function Ly(e,t,r,n=[]){let s=a.useRef(),o=vy();return Fy(()=>{var a;let i=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():s.current}})(),l=n.map(e=>e.trim());o.value(e,i,l),null==(a=t.current)||a.setAttribute(by,i),s.current=i}),s}var $y=()=>{let[e,t]=a.useState(),r=My(()=>new Map);return Fy(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function Wy({asChild:e,children:t},r){return e&&a.isValidElement(t)?a.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var Vy={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const By=a.forwardRef(({className:t,...r},n)=>e.jsx(Oy,{ref:n,className:ke("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));By.displayName=Oy.displayName;const Gy=a.forwardRef(({className:t,...r},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e.jsx(Jh,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Oy.Input,{ref:n,className:ke("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...r})]}));Gy.displayName=Oy.Input.displayName;const Ky=a.forwardRef(({className:t,...r},n)=>e.jsx(Oy.List,{ref:n,className:ke("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));Ky.displayName=Oy.List.displayName;a.forwardRef((t,r)=>e.jsx(Oy.Empty,{ref:r,className:"py-6 text-center text-sm",...t})).displayName=Oy.Empty.displayName;const Hy=a.forwardRef(({className:t,...r},n)=>e.jsx(Oy.Group,{ref:n,className:ke("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...r}));Hy.displayName=Oy.Group.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Oy.Separator,{ref:n,className:ke("-mx-1 h-px bg-border",t),...r})).displayName=Oy.Separator.displayName;const Zy=a.forwardRef(({className:t,...r},n)=>e.jsx(Oy.Item,{ref:n,className:ke("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r}));Zy.displayName=Oy.Item.displayName;const qy=["top","right","bottom","left"],Jy=Math.min,Yy=Math.max,Xy=Math.round,Qy=Math.floor,ev=e=>({x:e,y:e}),tv={left:"right",right:"left",bottom:"top",top:"bottom"},rv={start:"end",end:"start"};function nv(e,t,r){return Yy(e,Jy(t,r))}function av(e,t){return"function"==typeof e?e(t):e}function sv(e){return e.split("-")[0]}function ov(e){return e.split("-")[1]}function iv(e){return"x"===e?"y":"x"}function lv(e){return"y"===e?"height":"width"}const cv=new Set(["top","bottom"]);function dv(e){return cv.has(sv(e))?"y":"x"}function uv(e){return iv(dv(e))}function fv(e){return e.replace(/start|end/g,e=>rv[e])}const pv=["left","right"],mv=["right","left"],hv=["top","bottom"],gv=["bottom","top"];function bv(e,t,r,n){const a=ov(e);let s=function(e,t,r){switch(e){case"top":case"bottom":return r?t?mv:pv:t?pv:mv;case"left":case"right":return t?hv:gv;default:return[]}}(sv(e),"start"===r,n);return a&&(s=s.map(e=>e+"-"+a),t&&(s=s.concat(s.map(fv)))),s}function xv(e){return e.replace(/left|right|bottom|top/g,e=>tv[e])}function yv(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 vv(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 wv(e,t,r){let{reference:n,floating:a}=e;const s=dv(t),o=uv(t),i=lv(o),l=sv(t),c="y"===s,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[i]/2-a[i]/2;let p;switch(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(ov(t)){case"start":p[o]-=f*(r&&c?-1:1);break;case"end":p[o]+=f*(r&&c?-1:1)}return p}async function Sv(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:s,rects:o,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=av(t,e),m=yv(p),h=i[f?"floating"===u?"reference":"floating":u],g=vv(await s.getClippingRect({element:null==(r=await(null==s.isElement?void 0:s.isElement(h)))||r?h:h.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(i.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===u?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,x=await(null==s.getOffsetParent?void 0:s.getOffsetParent(i.floating)),y=await(null==s.isElement?void 0:s.isElement(x))&&await(null==s.getScale?void 0:s.getScale(x))||{x:1,y:1},v=vv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:b,offsetParent:x,strategy:l}):b);return{top:(g.top-v.top+m.top)/y.y,bottom:(v.bottom-g.bottom+m.bottom)/y.y,left:(g.left-v.left+m.left)/y.x,right:(v.right-g.right+m.right)/y.x}}function jv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kv(e){return qy.some(t=>e[t]>=0)}const Nv=new Set(["left","top"]);function Ev(){return"undefined"!=typeof window}function Cv(e){return Tv(e)?(e.nodeName||"").toLowerCase():"#document"}function Av(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function _v(e){var t;return null==(t=(Tv(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Tv(e){return!!Ev()&&(e instanceof Node||e instanceof Av(e).Node)}function Rv(e){return!!Ev()&&(e instanceof Element||e instanceof Av(e).Element)}function Pv(e){return!!Ev()&&(e instanceof HTMLElement||e instanceof Av(e).HTMLElement)}function Ov(e){return!(!Ev()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Av(e).ShadowRoot)}const Iv=new Set(["inline","contents"]);function Dv(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Hv(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Iv.has(a)}const Uv=new Set(["table","td","th"]);function Fv(e){return Uv.has(Cv(e))}const Mv=[":popover-open",":modal"];function zv(e){return Mv.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Lv=["transform","translate","scale","rotate","perspective"],$v=["transform","translate","scale","rotate","perspective","filter"],Wv=["paint","layout","strict","content"];function Vv(e){const t=Bv(),r=Rv(e)?Hv(e):e;return Lv.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||$v.some(e=>(r.willChange||"").includes(e))||Wv.some(e=>(r.contain||"").includes(e))}function Bv(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Gv=new Set(["html","body","#document"]);function Kv(e){return Gv.has(Cv(e))}function Hv(e){return Av(e).getComputedStyle(e)}function Zv(e){return Rv(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qv(e){if("html"===Cv(e))return e;const t=e.assignedSlot||e.parentNode||Ov(e)&&e.host||_v(e);return Ov(t)?t.host:t}function Jv(e){const t=qv(e);return Kv(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pv(t)&&Dv(t)?t:Jv(t)}function Yv(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=Jv(e),s=a===(null==(n=e.ownerDocument)?void 0:n.body),o=Av(a);if(s){const e=Xv(o);return t.concat(o,o.visualViewport||[],Dv(a)?a:[],e&&r?Yv(e):[])}return t.concat(a,Yv(a,[],r))}function Xv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Qv(e){const t=Hv(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Pv(e),s=a?e.offsetWidth:r,o=a?e.offsetHeight:n,i=Xy(r)!==s||Xy(n)!==o;return i&&(r=s,n=o),{width:r,height:n,$:i}}function ew(e){return Rv(e)?e:e.contextElement}function tw(e){const t=ew(e);if(!Pv(t))return ev(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:s}=Qv(t);let o=(s?Xy(r.width):r.width)/n,i=(s?Xy(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),i&&Number.isFinite(i)||(i=1),{x:o,y:i}}const rw=ev(0);function nw(e){const t=Av(e);return Bv()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:rw}function aw(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),s=ew(e);let o=ev(1);t&&(n?Rv(n)&&(o=tw(n)):o=tw(e));const i=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Av(e))&&t}(s,r,n)?nw(s):ev(0);let l=(a.left+i.x)/o.x,c=(a.top+i.y)/o.y,d=a.width/o.x,u=a.height/o.y;if(s){const e=Av(s),t=n&&Rv(n)?Av(n):n;let r=e,a=Xv(r);for(;a&&n&&t!==r;){const e=tw(a),t=a.getBoundingClientRect(),n=Hv(a),s=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=s,c+=o,r=Av(a),a=Xv(r)}}return vv({width:d,height:u,x:l,y:c})}function sw(e,t){const r=Zv(e).scrollLeft;return t?t.left+r:aw(_v(e)).left+r}function ow(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-sw(e,r),y:r.top+t.scrollTop}}const iw=new Set(["absolute","fixed"]);function lw(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Av(e),n=_v(e),a=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,i=0,l=0;if(a){s=a.width,o=a.height;const e=Bv();(!e||e&&"fixed"===t)&&(i=a.offsetLeft,l=a.offsetTop)}const c=sw(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,o=Math.abs(n.clientWidth-t.clientWidth-a);o<=25&&(s-=o)}else c<=25&&(s+=c);return{width:s,height:o,x:i,y:l}}(e,r);else if("document"===t)n=function(e){const t=_v(e),r=Zv(e),n=e.ownerDocument.body,a=Yy(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Yy(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+sw(e);const i=-r.scrollTop;return"rtl"===Hv(n).direction&&(o+=Yy(t.clientWidth,n.clientWidth)-a),{width:a,height:s,x:o,y:i}}(_v(e));else if(Rv(t))n=function(e,t){const r=aw(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,s=Pv(e)?tw(e):ev(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:a*s.x,y:n*s.y}}(t,r);else{const r=nw(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return vv(n)}function cw(e,t){const r=qv(e);return!(r===t||!Rv(r)||Kv(r))&&("fixed"===Hv(r).position||cw(r,t))}function dw(e,t,r){const n=Pv(t),a=_v(t),s="fixed"===r,o=aw(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const l=ev(0);function c(){l.x=sw(a)}if(n||!n&&!s)if(("body"!==Cv(t)||Dv(a))&&(i=Zv(t)),n){const e=aw(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&c();s&&!n&&a&&c();const d=!a||n||s?ev(0):ow(a,i);return{x:o.left+i.scrollLeft-l.x-d.x,y:o.top+i.scrollTop-l.y-d.y,width:o.width,height:o.height}}function uw(e){return"static"===Hv(e).position}function fw(e,t){if(!Pv(e)||"fixed"===Hv(e).position)return null;if(t)return t(e);let r=e.offsetParent;return _v(e)===r&&(r=r.ownerDocument.body),r}function pw(e,t){const r=Av(e);if(zv(e))return r;if(!Pv(e)){let t=qv(e);for(;t&&!Kv(t);){if(Rv(t)&&!uw(t))return t;t=qv(t)}return r}let n=fw(e,t);for(;n&&Fv(n)&&uw(n);)n=fw(n,t);return n&&Kv(n)&&uw(n)&&!Vv(n)?r:n||function(e){let t=qv(e);for(;Pv(t)&&!Kv(t);){if(Vv(t))return t;if(zv(t))return null;t=qv(t)}return null}(e)||r}const mw={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const s="fixed"===a,o=_v(n),i=!!t&&zv(t.floating);if(n===o||i&&s)return r;let l={scrollLeft:0,scrollTop:0},c=ev(1);const d=ev(0),u=Pv(n);if((u||!u&&!s)&&(("body"!==Cv(n)||Dv(o))&&(l=Zv(n)),Pv(n))){const e=aw(n);c=tw(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!o||u||s?ev(0):ow(o,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:_v,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s="clippingAncestors"===r?zv(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=Yv(e,[],!1).filter(e=>Rv(e)&&"body"!==Cv(e)),a=null;const s="fixed"===Hv(e).position;let o=s?qv(e):e;for(;Rv(o)&&!Kv(o);){const t=Hv(o),r=Vv(o);r||"fixed"!==t.position||(a=null),(s?!r&&!a:!r&&"static"===t.position&&a&&iw.has(a.position)||Dv(o)&&!r&&cw(e,o))?n=n.filter(e=>e!==o):a=t,o=qv(o)}return t.set(e,n),n}(t,this._c):[].concat(r),o=[...s,n],i=o[0],l=o.reduce((e,r)=>{const n=lw(t,r,a);return e.top=Yy(n.top,e.top),e.right=Jy(n.right,e.right),e.bottom=Jy(n.bottom,e.bottom),e.left=Yy(n.left,e.left),e},lw(t,i,a));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:pw,getElementRects:async function(e){const t=this.getOffsetParent||pw,r=this.getDimensions,n=await r(e.floating);return{reference:dw(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}=Qv(e);return{width:t,height:r}},getScale:tw,isElement:Rv,isRTL:function(e){return"rtl"===Hv(e).direction}};function hw(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gw(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=ew(e),d=a||s?[...c?Yv(c):[],...Yv(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),s&&e.addEventListener("resize",r)});const u=c&&i?function(e,t){let r,n=null;const a=_v(e);function s(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function o(i,l){void 0===i&&(i=!1),void 0===l&&(l=1),s();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=c;if(i||t(),!f||!p)return;const m={rootMargin:-Qy(u)+"px "+-Qy(a.clientWidth-(d+f))+"px "+-Qy(a.clientHeight-(u+p))+"px "+-Qy(d)+"px",threshold:Yy(0,Jy(1,l))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==l){if(!h)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||hw(c,e.getBoundingClientRect())||o(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),s}(c,r):null;let f,p=-1,m=null;o&&(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?aw(e):null;return l&&function t(){const n=aw(e);h&&!hw(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),s&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,l&&cancelAnimationFrame(f)}}const bw=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:s,placement:o,middlewareData:i}=t,l=await async function(e,t){const{placement:r,platform:n,elements:a}=e,s=await(null==n.isRTL?void 0:n.isRTL(a.floating)),o=sv(r),i=ov(r),l="y"===dv(r),c=Nv.has(o)?-1:1,d=s&&l?-1:1,u=av(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&"number"==typeof m&&(p="end"===i?-1*m:m),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return o===(null==(r=i.offset)?void 0:r.placement)&&null!=(n=i.arrow)&&n.alignmentOffset?{}:{x:a+l.x,y:s+l.y,data:{...l,placement:o}}}}},xw=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=av(e,t),d={x:r,y:n},u=await s.detectOverflow(t,c),f=dv(sv(a)),p=iv(f);let m=d[p],h=d[f];if(o){const e="y"===p?"bottom":"right";m=nv(m+u["y"===p?"top":"left"],m,m-u[e])}if(i){const e="y"===f?"bottom":"right";h=nv(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]:o,[f]:i}}}}}},yw=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:s,rects:o,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=av(e,t);if(null!=(r=s.arrow)&&r.alignmentOffset)return{};const b=sv(a),x=dv(i),y=sv(i)===i,v=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=f||(y||!h?[xv(i)]:function(e){const t=xv(e);return[fv(e),t,fv(t)]}(i)),S="none"!==m;!f&&S&&w.push(...bv(i,h,m,v));const j=[i,...w],k=await l.detectOverflow(t,g),N=[];let E=(null==(n=s.flip)?void 0:n.overflows)||[];if(d&&N.push(k[b]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=ov(e),a=uv(e),s=lv(a);let o="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=xv(o)),[o,xv(o)]}(a,o,v);N.push(k[e[0]],k[e[1]])}if(E=[...E,{placement:a,overflows:N}],!N.every(e=>e<=0)){var C,A;const e=((null==(C=s.flip)?void 0:C.index)||0)+1,t=j[e];if(t){if(!("alignment"===u&&x!==dv(t))||E.every(e=>dv(e.placement)!==x||e.overflows[0]>0))return{data:{index:e,overflows:E},reset:{placement:t}}}let r=null==(A=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=E.filter(e=>{if(S){const t=dv(e.placement);return t===x||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:_[0];e&&(r=e);break}case"initialPlacement":r=i}if(a!==r)return{reset:{placement:r}}}return{}}}},vw=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:s,platform:o,elements:i}=t,{apply:l=()=>{},...c}=av(e,t),d=await o.detectOverflow(t,c),u=sv(a),f=ov(a),p="y"===dv(a),{width:m,height:h}=s.floating;let g,b;"top"===u||"bottom"===u?(g=u,b=f===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g="end"===f?"top":"bottom");const x=h-d.top-d.bottom,y=m-d.left-d.right,v=Jy(h-d[g],x),w=Jy(m-d[b],y),S=!t.middlewareData.shift;let j=v,k=w;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(k=y),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(j=x),S&&!f){const e=Yy(d.left,0),t=Yy(d.right,0),r=Yy(d.top,0),n=Yy(d.bottom,0);p?k=m-2*(0!==e||0!==t?e+t:Yy(d.left,d.right)):j=h-2*(0!==r||0!==n?r+n:Yy(d.top,d.bottom))}await l({...t,availableWidth:k,availableHeight:j});const N=await o.getDimensions(i.floating);return m!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}},ww=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...s}=av(e,t);switch(a){case"referenceHidden":{const e=jv(await n.detectOverflow(t,{...s,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:kv(e)}}}case"escaped":{const e=jv(await n.detectOverflow(t,{...s,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:kv(e)}}}default:return{}}}}},Sw=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:s,platform:o,elements:i,middlewareData:l}=t,{element:c,padding:d=0}=av(e,t)||{};if(null==c)return{};const u=yv(d),f={x:r,y:n},p=uv(a),m=lv(p),h=await o.getDimensions(c),g="y"===p,b=g?"top":"left",x=g?"bottom":"right",y=g?"clientHeight":"clientWidth",v=s.reference[m]+s.reference[p]-f[p]-s.floating[m],w=f[p]-s.reference[p],S=await(null==o.getOffsetParent?void 0:o.getOffsetParent(c));let j=S?S[y]:0;j&&await(null==o.isElement?void 0:o.isElement(S))||(j=i.floating[y]||s.floating[m]);const k=v/2-w/2,N=j/2-h[m]/2-1,E=Jy(u[b],N),C=Jy(u[x],N),A=E,_=j-h[m]-C,T=j/2-h[m]/2+k,R=nv(A,T,_),P=!l.arrow&&null!=ov(a)&&T!==R&&s.reference[m]/2-(T<A?E:C)-h[m]/2<0,O=P?T<A?T-A:T-_:0;return{[p]:f[p]+O,data:{[p]:R,centerOffset:T-R-O,...P&&{alignmentOffset:O}},reset:P}}}),jw=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:s,middlewareData:o}=t,{offset:i=0,mainAxis:l=!0,crossAxis:c=!0}=av(e,t),d={x:r,y:n},u=dv(a),f=iv(u);let p=d[f],m=d[u];const h=av(i,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const e="y"===f?"height":"width",t=s.reference[f]-s.floating[e]+g.mainAxis,r=s.reference[f]+s.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(c){var b,x;const e="y"===f?"width":"height",t=Nv.has(sv(a)),r=s.reference[u]-s.floating[e]+(t&&(null==(b=o.offset)?void 0:b[u])||0)+(t?0:g.crossAxis),n=s.reference[u]+s.reference[e]+(t?0:(null==(x=o.offset)?void 0:x[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},kw=(e,t,r)=>{const n=new Map,a={platform:mw,...r},s={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:o}=r,i=s.filter(Boolean),l=await(null==o.isRTL?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=wv(c,n,l),f=n,p={},m=0;for(let r=0;r<i.length;r++){var h;const{name:s,fn:g}=i[r],{x:b,y:x,data:y,reset:v}=await g({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:c,platform:{...o,detectOverflow:null!=(h=o.detectOverflow)?h:Sv},elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=x?x:u,p={...p,[s]:{...p[s],...y}},v&&m<=50&&(m++,"object"==typeof v&&(v.placement&&(f=v.placement),v.rects&&(c=!0===v.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):v.rects),({x:d,y:u}=wv(c,f,l))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:s})};var Nw="undefined"!=typeof document?t.useLayoutEffect:function(){};function Ew(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(!Ew(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)&&!Ew(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Cw(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Aw(e,t){const r=Cw(e);return Math.round(t*r)/r}function _w(e){const t=a.useRef(e);return Nw(()=>{t.current=e}),t}const Tw=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?Sw({element:r.current,padding:n}).fn(t):{}:r?Sw({element:r,padding:n}).fn(t):{};var a}}),Rw=(e,t)=>({...bw(e),options:[e,t]}),Pw=(e,t)=>({...xw(e),options:[e,t]}),Ow=(e,t)=>({...jw(e),options:[e,t]}),Iw=(e,t)=>({...yw(e),options:[e,t]}),Dw=(e,t)=>({...vw(e),options:[e,t]}),Uw=(e,t)=>({...ww(e),options:[e,t]}),Fw=(e,t)=>({...Tw(e),options:[e,t]});var Mw=a.forwardRef((t,r)=>{const{children:n,width:a=10,height:s=5,...o}=t;return e.jsx(Op.svg,{...o,ref:r,width:a,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});Mw.displayName="Arrow";var zw=Mw,Lw="Popper",[$w,Ww]=jp(Lw),[Vw,Bw]=$w(Lw),Gw=t=>{const{__scopePopper:r,children:n}=t,[s,o]=a.useState(null);return e.jsx(Vw,{scope:r,anchor:s,onAnchorChange:o,children:n})};Gw.displayName=Lw;var Kw="PopperAnchor",Hw=a.forwardRef((t,r)=>{const{__scopePopper:n,virtualRef:s,...o}=t,i=Bw(Kw,n),l=a.useRef(null),c=Yc(r,l),d=a.useRef(null);return a.useEffect(()=>{const e=d.current;d.current=s?.current||l.current,e!==d.current&&i.onAnchorChange(d.current)}),s?null:e.jsx(Op.div,{...o,ref:c})});Hw.displayName=Kw;var Zw="PopperContent",[qw,Jw]=$w(Zw),Yw=a.forwardRef((t,r)=>{const{__scopePopper:n,side:o="bottom",sideOffset:i=0,align:l="center",alignOffset:c=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:b,...x}=t,y=Bw(Zw,n),[v,w]=a.useState(null),S=Yc(r,e=>w(e)),[j,k]=a.useState(null),N=Tg(j),E=N?.width??0,C=N?.height??0,A=o+("center"!==l?"-"+l:""),_="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},T=Array.isArray(f)?f:[f],R=T.length>0,P={padding:_,boundary:T.filter(tS),altBoundary:R},{refs:O,floatingStyles:I,placement:D,isPositioned:U,middlewareData:F}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:l}={},transform:c=!0,whileElementsMounted:d,open:u}=e,[f,p]=a.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=a.useState(n);Ew(m,n)||h(n);const[g,b]=a.useState(null),[x,y]=a.useState(null),v=a.useCallback(e=>{e!==k.current&&(k.current=e,b(e))},[]),w=a.useCallback(e=>{e!==N.current&&(N.current=e,y(e))},[]),S=i||g,j=l||x,k=a.useRef(null),N=a.useRef(null),E=a.useRef(f),C=null!=d,A=_w(d),_=_w(o),T=_w(u),R=a.useCallback(()=>{if(!k.current||!N.current)return;const e={placement:t,strategy:r,middleware:m};_.current&&(e.platform=_.current),kw(k.current,N.current,e).then(e=>{const t={...e,isPositioned:!1!==T.current};P.current&&!Ew(E.current,t)&&(E.current=t,s.flushSync(()=>{p(t)}))})},[m,t,r,_,T]);Nw(()=>{!1===u&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const P=a.useRef(!1);Nw(()=>(P.current=!0,()=>{P.current=!1}),[]),Nw(()=>{if(S&&(k.current=S),j&&(N.current=j),S&&j){if(A.current)return A.current(S,j,R);R()}},[S,j,R,A,C]);const O=a.useMemo(()=>({reference:k,floating:N,setReference:v,setFloating:w}),[v,w]),I=a.useMemo(()=>({reference:S,floating:j}),[S,j]),D=a.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Aw(I.floating,f.x),n=Aw(I.floating,f.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Cw(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,I.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:R,refs:O,elements:I,floatingStyles:D}),[f,R,O,I,D])}({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>gw(...e,{animationFrame:"always"===g}),elements:{reference:y.anchor},middleware:[Rw({mainAxis:i+C,alignmentAxis:c}),u&&Pw({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?Ow():void 0,...P}),u&&Iw({...P}),Dw({...P,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:s}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${s}px`)}}),j&&Fw({element:j,padding:d}),rS({arrowWidth:E,arrowHeight:C}),h&&Uw({strategy:"referenceHidden",...P})]}),[M,z]=nS(D),L=Kf(b);Zf(()=>{U&&L?.()},[U,L]);const $=F.arrow?.x,W=F.arrow?.y,V=0!==F.arrow?.centerOffset,[B,G]=a.useState();return Zf(()=>{v&&G(window.getComputedStyle(v).zIndex)},[v]),e.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:U?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(qw,{scope:n,placedSide:M,onArrowChange:k,arrowX:$,arrowY:W,shouldHideArrow:V,children:e.jsx(Op.div,{"data-side":M,"data-align":z,...x,ref:S,style:{...x.style,animation:U?void 0:"none"}})})})});Yw.displayName=Zw;var Xw="PopperArrow",Qw={top:"bottom",right:"left",bottom:"top",left:"right"},eS=a.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,s=Jw(Xw,n),o=Qw[s.placedSide];return e.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:e.jsx(zw,{...a,ref:r,style:{...a.style,display:"block"}})})});function tS(e){return null!==e}eS.displayName=Xw;var rS=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,s=0!==a.arrow?.centerOffset,o=s?0:e.arrowWidth,i=s?0:e.arrowHeight,[l,c]=nS(r),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+o/2,f=(a.arrow?.y??0)+i/2;let p="",m="";return"bottom"===l?(p=s?d:`${u}px`,m=-i+"px"):"top"===l?(p=s?d:`${u}px`,m=`${n.floating.height+i}px`):"right"===l?(p=-i+"px",m=s?d:`${f}px`):"left"===l&&(p=`${n.floating.width+i}px`,m=s?d:`${f}px`),{data:{x:p,y:m}}}});function nS(e){const[t,r="center"]=e.split("-");return[t,r]}var aS=Gw,sS=Hw,oS=Yw,iS=eS;function lS(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Jc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cS=Symbol("radix.slottable");function dS(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cS}var uS="Popover",[fS]=jp(uS,[Ww]),pS=Ww(),[mS,hS]=fS(uS),gS=t=>{const{__scopePopover:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:l=!1}=t,c=pS(r),d=a.useRef(null),[u,f]=a.useState(!1),[p,m]=_p({prop:s,defaultProp:o??!1,onChange:i,caller:uS});return e.jsx(aS,{...c,children:e.jsx(mS,{scope:r,contentId:Cp(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:a.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:a.useCallback(()=>f(!0),[]),onCustomAnchorRemove:a.useCallback(()=>f(!1),[]),modal:l,children:n})})};gS.displayName=uS;var bS="PopoverAnchor";a.forwardRef((t,r)=>{const{__scopePopover:n,...s}=t,o=hS(bS,n),i=pS(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=o;return a.useEffect(()=>(l(),()=>c()),[l,c]),e.jsx(sS,{...i,...s,ref:r})}).displayName=bS;var xS="PopoverTrigger",yS=a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=hS(xS,n),o=pS(n),i=Yc(r,s.triggerRef),l=e.jsx(Op.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":RS(s.open),...a,ref:i,onClick:Sp(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:e.jsx(sS,{asChild:!0,...o,children:l})});yS.displayName=xS;var vS="PopoverPortal",[wS,SS]=fS(vS,{forceMount:void 0}),jS=t=>{const{__scopePopover:r,forceMount:n,children:a,container:s}=t,o=hS(vS,r);return e.jsx(wS,{scope:r,forceMount:n,children:e.jsx(Qp,{present:n||o.open,children:e.jsx(Xp,{asChild:!0,container:s,children:a})})})};jS.displayName=vS;var kS="PopoverContent",NS=a.forwardRef((t,r)=>{const n=SS(kS,t.__scopePopover),{forceMount:a=n.forceMount,...s}=t,o=hS(kS,t.__scopePopover);return e.jsx(Qp,{present:a||o.open,children:o.modal?e.jsx(CS,{...s,ref:r}):e.jsx(AS,{...s,ref:r})})});NS.displayName=kS;var ES=function(t){const r=lS(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(dS);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("PopoverContent.RemoveScroll"),CS=a.forwardRef((t,r)=>{const n=hS(kS,t.__scopePopover),s=a.useRef(null),o=Yc(r,s),i=a.useRef(!1);return a.useEffect(()=>{const e=s.current;if(e)return Ym(e)},[]),e.jsx(Bm,{as:ES,allowPinchZoom:!0,children:e.jsx(_S,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Sp(t.onCloseAutoFocus,e=>{e.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Sp(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;i.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:Sp(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),AS=a.forwardRef((t,r)=>{const n=hS(kS,t.__scopePopover),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(_S,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),_S=a.forwardRef((t,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...f}=t,p=hS(kS,n),m=pS(n);return rm(),e.jsx(Gp,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:e.jsx(zp,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(oS,{"data-state":RS(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)"}})})})}),TS="PopoverClose";a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=hS(TS,n);return e.jsx(Op.button,{type:"button",...a,ref:r,onClick:Sp(t.onClick,()=>s.onOpenChange(!1))})}).displayName=TS;function RS(e){return e?"open":"closed"}a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=pS(n);return e.jsx(iS,{...s,...a,ref:r})}).displayName="PopoverArrow";var PS=jS,OS=NS;const IS=gS,DS=yS,US=a.forwardRef(({className:t,align:r="center",sideOffset:n=4,...s},o)=>{const{container:i}=a.useContext(as);return e.jsx(PS,{container:i,children:e.jsx(OS,{ref:o,align:r,sideOffset:n,className:ke("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})})});function FS({options:r,value:n,onChange:a,placeholder:s="Search...",emptyLabel:o="Choose option"}){const[i,l]=t.useState(n??""),[c,d]=t.useState(!1);t.useEffect(()=>{void 0!==n&&l(n)},[n]);const u=r.find(e=>e.value===i);return e.jsxs(IS,{open:c,onOpenChange:d,children:[e.jsx(DS,{asChild:!0,children:e.jsxs(Ld,{variant:"outline",role:"combobox","aria-expanded":c,className:"justify-between overflow-hidden text-ellipsis",children:[u?e.jsxs("div",{children:[String(u.label).trim(),u.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:u.icon})]}):e.jsx("span",{className:"text-muted-foreground",children:o}),e.jsx(vd,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(US,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(By,{children:[e.jsx(Gy,{placeholder:s}),e.jsx(Ky,{children:e.jsx(Hy,{children:r.map(t=>e.jsxs(Zy,{className:ke("whitespace-nowrap text-left",{"text-green-500":i===t.value}),value:t.value,defaultValue:t.value,onSelect:()=>{return e=t.value,l(e),a?.(e),void d(!1);var e},children:[i===t.value&&e.jsx(yd,{className:ke("mr-2 h-4 w-4 text-green-400",i===t.value?"opacity-100":"opacity-0")}),String(t.label).trim(),t.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t.icon})]},t.value))})})]})})]})}US.displayName=OS.displayName;const MS={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"},zS={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"},LS=[{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=zS[e.code]||"USD",r=MS[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 $S({value:t,onChange:r}){const n=LS.map(e=>({value:e.value,label:e.text,icon:e.flag}));return e.jsx(FS,{options:n,value:t,onChange:r,placeholder:"Choose country...",emptyLabel:"Choose country"})}const WS=LS.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),VS=Array.from(new Set(WS.map(e=>e.value))).map(e=>WS.find(t=>t.value===e)).filter(e=>void 0!==e);function BS({value:t,onChange:r}){const n=VS.map(e=>({value:e.value,label:e.text,icon:e.icon??void 0}));return e.jsx(FS,{options:n,value:t,onChange:r,placeholder:"Choose currency...",emptyLabel:"Choose Currency"})}let GS=[{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:"🇮🇱"}];GS=GS.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),GS.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const KS=GS.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 HS({value:t,onChange:r}){const n=KS.map(e=>({value:e.value,label:e.label,icon:e.flag}));return e.jsx(FS,{options:n,value:t,onChange:r,placeholder:"Choose language...",emptyLabel:"Choose language"})}const ZS=[{value:"Dateline Standard Time",abbr:"DST",offset:-12,isdst:!1,text:"(UTC-12:00) International Date Line West",utc:["Etc/GMT+12"]},{value:"UTC-11",abbr:"U",offset:-11,isdst:!1,text:"(UTC-11:00) Coordinated Universal Time-11",utc:["Etc/GMT+11","Pacific/Midway","Pacific/Niue","Pacific/Pago_Pago"]},{value:"Hawaiian Standard Time",abbr:"HST",offset:-10,isdst:!1,text:"(UTC-10:00) Hawaii",utc:["Etc/GMT+10","Pacific/Honolulu","Pacific/Johnston","Pacific/Rarotonga","Pacific/Tahiti"]},{value:"Alaskan Standard Time",abbr:"AKDT",offset:-8,isdst:!0,text:"(UTC-09:00) Alaska",utc:["America/Anchorage","America/Juneau","America/Nome","America/Sitka","America/Yakutat"]},{value:"Pacific Standard Time (Mexico)",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-08:00) Baja California",utc:["America/Santa_Isabel"]},{value:"Pacific Daylight Time",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-07:00) Pacific Daylight Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver"]},{value:"Pacific Standard Time",abbr:"PST",offset:-8,isdst:!1,text:"(UTC-08:00) Pacific Standard Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver","PST8PDT"]},{value:"US Mountain Standard Time",abbr:"UMST",offset:-7,isdst:!1,text:"(UTC-07:00) Arizona",utc:["America/Creston","America/Dawson","America/Dawson_Creek","America/Hermosillo","America/Phoenix","America/Whitehorse","Etc/GMT+7"]},{value:"Mountain Standard Time (Mexico)",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",utc:["America/Chihuahua","America/Mazatlan"]},{value:"Mountain Standard Time",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Mountain Time (US & Canada)",utc:["America/Boise","America/Cambridge_Bay","America/Denver","America/Edmonton","America/Inuvik","America/Ojinaga","America/Yellowknife","MST7MDT"]},{value:"Central America Standard Time",abbr:"CAST",offset:-6,isdst:!1,text:"(UTC-06:00) Central America",utc:["America/Belize","America/Costa_Rica","America/El_Salvador","America/Guatemala","America/Managua","America/Tegucigalpa","Etc/GMT+6","Pacific/Galapagos"]},{value:"Central Standard Time",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Central Time (US & Canada)",utc:["America/Chicago","America/Indiana/Knox","America/Indiana/Tell_City","America/Matamoros","America/Menominee","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Rainy_River","America/Rankin_Inlet","America/Resolute","America/Winnipeg","CST6CDT"]},{value:"Central Standard Time (Mexico)",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",utc:["America/Bahia_Banderas","America/Cancun","America/Merida","America/Mexico_City","America/Monterrey"]},{value:"Canada Central Standard Time",abbr:"CCST",offset:-6,isdst:!1,text:"(UTC-06:00) Saskatchewan",utc:["America/Regina","America/Swift_Current"]},{value:"SA Pacific Standard Time",abbr:"SPST",offset:-5,isdst:!1,text:"(UTC-05:00) Bogota, Lima, Quito",utc:["America/Bogota","America/Cayman","America/Coral_Harbour","America/Eirunepe","America/Guayaquil","America/Jamaica","America/Lima","America/Panama","America/Rio_Branco","Etc/GMT+5"]},{value:"Eastern Standard Time",abbr:"EST",offset:-5,isdst:!1,text:"(UTC-05:00) Eastern Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"Eastern Daylight Time",abbr:"EDT",offset:-4,isdst:!0,text:"(UTC-04:00) Eastern Daylight Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"US Eastern Standard Time",abbr:"UEDT",offset:-5,isdst:!1,text:"(UTC-05:00) Indiana (East)",utc:["America/Indiana/Marengo","America/Indiana/Vevay","America/Indianapolis"]},{value:"Venezuela Standard Time",abbr:"VST",offset:-4.5,isdst:!1,text:"(UTC-04:30) Caracas",utc:["America/Caracas"]},{value:"Paraguay Standard Time",abbr:"PYT",offset:-4,isdst:!1,text:"(UTC-04:00) Asuncion",utc:["America/Asuncion"]},{value:"Atlantic Standard Time",abbr:"ADT",offset:-3,isdst:!0,text:"(UTC-04:00) Atlantic Time (Canada)",utc:["America/Glace_Bay","America/Goose_Bay","America/Halifax","America/Moncton","America/Thule","Atlantic/Bermuda"]},{value:"Central Brazilian Standard Time",abbr:"CBST",offset:-4,isdst:!1,text:"(UTC-04:00) Cuiaba",utc:["America/Campo_Grande","America/Cuiaba"]},{value:"SA Western Standard Time",abbr:"SWST",offset:-4,isdst:!1,text:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",utc:["America/Anguilla","America/Antigua","America/Aruba","America/Barbados","America/Blanc-Sablon","America/Boa_Vista","America/Curacao","America/Dominica","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guyana","America/Kralendijk","America/La_Paz","America/Lower_Princes","America/Manaus","America/Marigot","America/Martinique","America/Montserrat","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Santo_Domingo","America/St_Barthelemy","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Tortola","Etc/GMT+4"]},{value:"Pacific SA Standard Time",abbr:"PSST",offset:-4,isdst:!1,text:"(UTC-04:00) Santiago",utc:["America/Santiago","Antarctica/Palmer"]},{value:"Newfoundland Standard Time",abbr:"NDT",offset:-2.5,isdst:!0,text:"(UTC-03:30) Newfoundland",utc:["America/St_Johns"]},{value:"E. South America Standard Time",abbr:"ESAST",offset:-3,isdst:!1,text:"(UTC-03:00) Brasilia",utc:["America/Sao_Paulo"]},{value:"Argentina Standard Time",abbr:"AST",offset:-3,isdst:!1,text:"(UTC-03:00) Buenos Aires",utc:["America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Buenos_Aires","America/Catamarca","America/Cordoba","America/Jujuy","America/Mendoza"]},{value:"SA Eastern Standard Time",abbr:"SEST",offset:-3,isdst:!1,text:"(UTC-03:00) Cayenne, Fortaleza",utc:["America/Araguaina","America/Belem","America/Cayenne","America/Fortaleza","America/Maceio","America/Paramaribo","America/Recife","America/Santarem","Antarctica/Rothera","Atlantic/Stanley","Etc/GMT+3"]},{value:"Greenland Standard Time",abbr:"GDT",offset:-3,isdst:!0,text:"(UTC-03:00) Greenland",utc:["America/Godthab"]},{value:"Montevideo Standard Time",abbr:"MST",offset:-3,isdst:!1,text:"(UTC-03:00) Montevideo",utc:["America/Montevideo"]},{value:"Bahia Standard Time",abbr:"BST",offset:-3,isdst:!1,text:"(UTC-03:00) Salvador",utc:["America/Bahia"]},{value:"UTC-02",abbr:"U",offset:-2,isdst:!1,text:"(UTC-02:00) Coordinated Universal Time-02",utc:["America/Noronha","Atlantic/South_Georgia","Etc/GMT+2"]},{value:"Mid-Atlantic Standard Time",abbr:"MDT",offset:-1,isdst:!0,text:"(UTC-02:00) Mid-Atlantic - Old",utc:[]},{value:"Azores Standard Time",abbr:"ADT",offset:0,isdst:!0,text:"(UTC-01:00) Azores",utc:["America/Scoresbysund","Atlantic/Azores"]},{value:"Cape Verde Standard Time",abbr:"CVST",offset:-1,isdst:!1,text:"(UTC-01:00) Cape Verde Is.",utc:["Atlantic/Cape_Verde","Etc/GMT+1"]},{value:"Morocco Standard Time",abbr:"MDT",offset:1,isdst:!0,text:"(UTC) Casablanca",utc:["Africa/Casablanca","Africa/El_Aaiun"]},{value:"UTC",abbr:"UTC",offset:0,isdst:!1,text:"(UTC) Coordinated Universal Time",utc:["America/Danmarkshavn","Etc/GMT"]},{value:"GMT Standard Time",abbr:"GMT",offset:0,isdst:!1,text:"(UTC) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"British Summer Time",abbr:"BST",offset:1,isdst:!0,text:"(UTC+01:00) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"GMT Standard Time",abbr:"GDT",offset:1,isdst:!0,text:"(UTC) Dublin, Lisbon",utc:["Atlantic/Canary","Atlantic/Faeroe","Atlantic/Madeira","Europe/Dublin","Europe/Lisbon"]},{value:"Greenwich Standard Time",abbr:"GST",offset:0,isdst:!1,text:"(UTC) Monrovia, Reykjavik",utc:["Africa/Abidjan","Africa/Accra","Africa/Bamako","Africa/Banjul","Africa/Bissau","Africa/Conakry","Africa/Dakar","Africa/Freetown","Africa/Lome","Africa/Monrovia","Africa/Nouakchott","Africa/Ouagadougou","Africa/Sao_Tome","Atlantic/Reykjavik","Atlantic/St_Helena"]},{value:"W. Europe Standard Time",abbr:"WEDT",offset:2,isdst:!0,text:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",utc:["Arctic/Longyearbyen","Europe/Amsterdam","Europe/Andorra","Europe/Berlin","Europe/Busingen","Europe/Gibraltar","Europe/Luxembourg","Europe/Malta","Europe/Monaco","Europe/Oslo","Europe/Rome","Europe/San_Marino","Europe/Stockholm","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Zurich"]},{value:"Central Europe Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",utc:["Europe/Belgrade","Europe/Bratislava","Europe/Budapest","Europe/Ljubljana","Europe/Podgorica","Europe/Prague","Europe/Tirane"]},{value:"Romance Standard Time",abbr:"RDT",offset:2,isdst:!0,text:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",utc:["Africa/Ceuta","Europe/Brussels","Europe/Copenhagen","Europe/Madrid","Europe/Paris"]},{value:"Central European Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",utc:["Europe/Sarajevo","Europe/Skopje","Europe/Warsaw","Europe/Zagreb"]},{value:"W. Central Africa Standard Time",abbr:"WCAST",offset:1,isdst:!1,text:"(UTC+01:00) West Central Africa",utc:["Africa/Algiers","Africa/Bangui","Africa/Brazzaville","Africa/Douala","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Luanda","Africa/Malabo","Africa/Ndjamena","Africa/Niamey","Africa/Porto-Novo","Africa/Tunis","Etc/GMT-1"]},{value:"Namibia Standard Time",abbr:"NST",offset:1,isdst:!1,text:"(UTC+01:00) Windhoek",utc:["Africa/Windhoek"]},{value:"GTB Standard Time",abbr:"GDT",offset:3,isdst:!0,text:"(UTC+02:00) Athens, Bucharest",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau"]},{value:"Middle East Standard Time",abbr:"MEDT",offset:3,isdst:!0,text:"(UTC+02:00) Beirut",utc:["Asia/Beirut"]},{value:"Egypt Standard Time",abbr:"EST",offset:2,isdst:!1,text:"(UTC+02:00) Cairo",utc:["Africa/Cairo"]},{value:"Syria Standard Time",abbr:"SDT",offset:3,isdst:!0,text:"(UTC+02:00) Damascus",utc:["Asia/Damascus"]},{value:"E. Europe Standard Time",abbr:"EEDT",offset:3,isdst:!0,text:"(UTC+02:00) E. Europe",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau","Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Nicosia","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"South Africa Standard Time",abbr:"SAST",offset:2,isdst:!1,text:"(UTC+02:00) Harare, Pretoria",utc:["Africa/Blantyre","Africa/Bujumbura","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Kigali","Africa/Lubumbashi","Africa/Lusaka","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Etc/GMT-2"]},{value:"FLE Standard Time",abbr:"FDT",offset:3,isdst:!0,text:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",utc:["Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"Turkey Standard Time",abbr:"TDT",offset:3,isdst:!1,text:"(UTC+03:00) Istanbul",utc:["Europe/Istanbul"]},{value:"Israel Standard Time",abbr:"JDT",offset:3,isdst:!0,text:"(UTC+02:00) Jerusalem",utc:["Asia/Jerusalem"]},{value:"Libya Standard Time",abbr:"LST",offset:2,isdst:!1,text:"(UTC+02:00) Tripoli",utc:["Africa/Tripoli"]},{value:"Jordan Standard Time",abbr:"JST",offset:3,isdst:!1,text:"(UTC+03:00) Amman",utc:["Asia/Amman"]},{value:"Arabic Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Baghdad",utc:["Asia/Baghdad"]},{value:"Kaliningrad Standard Time",abbr:"KST",offset:3,isdst:!1,text:"(UTC+02:00) Kaliningrad",utc:["Europe/Kaliningrad"]},{value:"Arab Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Kuwait, Riyadh",utc:["Asia/Aden","Asia/Bahrain","Asia/Kuwait","Asia/Qatar","Asia/Riyadh"]},{value:"E. Africa Standard Time",abbr:"EAST",offset:3,isdst:!1,text:"(UTC+03:00) Nairobi",utc:["Africa/Addis_Ababa","Africa/Asmera","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Mogadishu","Africa/Nairobi","Antarctica/Syowa","Etc/GMT-3","Indian/Antananarivo","Indian/Comoro","Indian/Mayotte"]},{value:"Moscow Standard Time",abbr:"MSK",offset:3,isdst:!1,text:"(UTC+03:00) Moscow, St. Petersburg, Volgograd, Minsk",utc:["Europe/Kirov","Europe/Moscow","Europe/Simferopol","Europe/Volgograd","Europe/Minsk"]},{value:"Samara Time",abbr:"SAMT",offset:4,isdst:!1,text:"(UTC+04:00) Samara, Ulyanovsk, Saratov",utc:["Europe/Astrakhan","Europe/Samara","Europe/Ulyanovsk"]},{value:"Iran Standard Time",abbr:"IDT",offset:4.5,isdst:!0,text:"(UTC+03:30) Tehran",utc:["Asia/Tehran"]},{value:"Arabian Standard Time",abbr:"AST",offset:4,isdst:!1,text:"(UTC+04:00) Abu Dhabi, Muscat",utc:["Asia/Dubai","Asia/Muscat","Etc/GMT-4"]},{value:"Azerbaijan Standard Time",abbr:"ADT",offset:5,isdst:!0,text:"(UTC+04:00) Baku",utc:["Asia/Baku"]},{value:"Mauritius Standard Time",abbr:"MST",offset:4,isdst:!1,text:"(UTC+04:00) Port Louis",utc:["Indian/Mahe","Indian/Mauritius","Indian/Reunion"]},{value:"Georgian Standard Time",abbr:"GET",offset:4,isdst:!1,text:"(UTC+04:00) Tbilisi",utc:["Asia/Tbilisi"]},{value:"Caucasus Standard Time",abbr:"CST",offset:4,isdst:!1,text:"(UTC+04:00) Yerevan",utc:["Asia/Yerevan"]},{value:"Afghanistan Standard Time",abbr:"AST",offset:4.5,isdst:!1,text:"(UTC+04:30) Kabul",utc:["Asia/Kabul"]},{value:"West Asia Standard Time",abbr:"WAST",offset:5,isdst:!1,text:"(UTC+05:00) Ashgabat, Tashkent",utc:["Antarctica/Mawson","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Dushanbe","Asia/Oral","Asia/Samarkand","Asia/Tashkent","Etc/GMT-5","Indian/Kerguelen","Indian/Maldives"]},{value:"Yekaterinburg Time",abbr:"YEKT",offset:5,isdst:!1,text:"(UTC+05:00) Yekaterinburg",utc:["Asia/Yekaterinburg"]},{value:"Pakistan Standard Time",abbr:"PKT",offset:5,isdst:!1,text:"(UTC+05:00) Islamabad, Karachi",utc:["Asia/Karachi"]},{value:"India Standard Time",abbr:"IST",offset:5.5,isdst:!1,text:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",utc:["Asia/Kolkata","Asia/Calcutta"]},{value:"Sri Lanka Standard Time",abbr:"SLST",offset:5.5,isdst:!1,text:"(UTC+05:30) Sri Jayawardenepura",utc:["Asia/Colombo"]},{value:"Nepal Standard Time",abbr:"NST",offset:5.75,isdst:!1,text:"(UTC+05:45) Kathmandu",utc:["Asia/Kathmandu"]},{value:"Central Asia Standard Time",abbr:"CAST",offset:6,isdst:!1,text:"(UTC+06:00) Nur-Sultan (Astana)",utc:["Antarctica/Vostok","Asia/Almaty","Asia/Bishkek","Asia/Qyzylorda","Asia/Urumqi","Etc/GMT-6","Indian/Chagos"]},{value:"Bangladesh Standard Time",abbr:"BST",offset:6,isdst:!1,text:"(UTC+06:00) Dhaka",utc:["Asia/Dhaka","Asia/Thimphu"]},{value:"Myanmar Standard Time",abbr:"MST",offset:6.5,isdst:!1,text:"(UTC+06:30) Yangon (Rangoon)",utc:["Asia/Rangoon","Indian/Cocos"]},{value:"SE Asia Standard Time",abbr:"SAST",offset:7,isdst:!1,text:"(UTC+07:00) Bangkok, Hanoi, Jakarta",utc:["Antarctica/Davis","Asia/Bangkok","Asia/Hovd","Asia/Jakarta","Asia/Phnom_Penh","Asia/Pontianak","Asia/Saigon","Asia/Vientiane","Etc/GMT-7","Indian/Christmas"]},{value:"N. Central Asia Standard Time",abbr:"NCAST",offset:7,isdst:!1,text:"(UTC+07:00) Novosibirsk",utc:["Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk"]},{value:"China Standard Time",abbr:"CST",offset:8,isdst:!1,text:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",utc:["Asia/Hong_Kong","Asia/Macau","Asia/Shanghai"]},{value:"North Asia Standard Time",abbr:"NAST",offset:8,isdst:!1,text:"(UTC+08:00) Krasnoyarsk",utc:["Asia/Krasnoyarsk"]},{value:"Singapore Standard Time",abbr:"MPST",offset:8,isdst:!1,text:"(UTC+08:00) Kuala Lumpur, Singapore",utc:["Asia/Brunei","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Makassar","Asia/Manila","Asia/Singapore","Etc/GMT-8"]},{value:"W. Australia Standard Time",abbr:"WAST",offset:8,isdst:!1,text:"(UTC+08:00) Perth",utc:["Antarctica/Casey","Australia/Perth"]},{value:"Taipei Standard Time",abbr:"TST",offset:8,isdst:!1,text:"(UTC+08:00) Taipei",utc:["Asia/Taipei"]},{value:"Ulaanbaatar Standard Time",abbr:"UST",offset:8,isdst:!1,text:"(UTC+08:00) Ulaanbaatar",utc:["Asia/Choibalsan","Asia/Ulaanbaatar"]},{value:"North Asia East Standard Time",abbr:"NAEST",offset:8,isdst:!1,text:"(UTC+08:00) Irkutsk",utc:["Asia/Irkutsk"]},{value:"Japan Standard Time",abbr:"JST",offset:9,isdst:!1,text:"(UTC+09:00) Osaka, Sapporo, Tokyo",utc:["Asia/Dili","Asia/Jayapura","Asia/Tokyo","Etc/GMT-9","Pacific/Palau"]},{value:"Korea Standard Time",abbr:"KST",offset:9,isdst:!1,text:"(UTC+09:00) Seoul",utc:["Asia/Pyongyang","Asia/Seoul"]},{value:"Cen. Australia Standard Time",abbr:"CAST",offset:9.5,isdst:!1,text:"(UTC+09:30) Adelaide",utc:["Australia/Adelaide","Australia/Broken_Hill"]},{value:"AUS Central Standard Time",abbr:"ACST",offset:9.5,isdst:!1,text:"(UTC+09:30) Darwin",utc:["Australia/Darwin"]},{value:"E. Australia Standard Time",abbr:"EAST",offset:10,isdst:!1,text:"(UTC+10:00) Brisbane",utc:["Australia/Brisbane","Australia/Lindeman"]},{value:"AUS Eastern Standard Time",abbr:"AEST",offset:10,isdst:!1,text:"(UTC+10:00) Canberra, Melbourne, Sydney",utc:["Australia/Melbourne","Australia/Sydney"]},{value:"West Pacific Standard Time",abbr:"WPST",offset:10,isdst:!1,text:"(UTC+10:00) Guam, Port Moresby",utc:["Antarctica/DumontDUrville","Etc/GMT-10","Pacific/Guam","Pacific/Port_Moresby","Pacific/Saipan","Pacific/Truk"]},{value:"Tasmania Standard Time",abbr:"TST",offset:10,isdst:!1,text:"(UTC+10:00) Hobart",utc:["Australia/Currie","Australia/Hobart"]},{value:"Yakutsk Standard Time",abbr:"YST",offset:9,isdst:!1,text:"(UTC+09:00) Yakutsk",utc:["Asia/Chita","Asia/Khandyga","Asia/Yakutsk"]},{value:"Central Pacific Standard Time",abbr:"CPST",offset:11,isdst:!1,text:"(UTC+11:00) Solomon Is., New Caledonia",utc:["Antarctica/Macquarie","Etc/GMT-11","Pacific/Efate","Pacific/Guadalcanal","Pacific/Kosrae","Pacific/Noumea","Pacific/Ponape"]},{value:"Vladivostok Standard Time",abbr:"VST",offset:11,isdst:!1,text:"(UTC+11:00) Vladivostok",utc:["Asia/Sakhalin","Asia/Ust-Nera","Asia/Vladivostok"]},{value:"New Zealand Standard Time",abbr:"NZST",offset:12,isdst:!1,text:"(UTC+12:00) Auckland, Wellington",utc:["Antarctica/McMurdo","Pacific/Auckland"]},{value:"UTC+12",abbr:"U",offset:12,isdst:!1,text:"(UTC+12:00) Coordinated Universal Time+12",utc:["Etc/GMT-12","Pacific/Funafuti","Pacific/Kwajalein","Pacific/Majuro","Pacific/Nauru","Pacific/Tarawa","Pacific/Wake","Pacific/Wallis"]},{value:"Fiji Standard Time",abbr:"FST",offset:12,isdst:!1,text:"(UTC+12:00) Fiji",utc:["Pacific/Fiji"]},{value:"Magadan Standard Time",abbr:"MST",offset:12,isdst:!1,text:"(UTC+12:00) Magadan",utc:["Asia/Anadyr","Asia/Kamchatka","Asia/Magadan","Asia/Srednekolymsk"]},{value:"Kamchatka Standard Time",abbr:"KDT",offset:13,isdst:!0,text:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",utc:["Asia/Kamchatka"]},{value:"Tonga Standard Time",abbr:"TST",offset:13,isdst:!1,text:"(UTC+13:00) Nuku'alofa",utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]},{value:"Samoa Standard Time",abbr:"SST",offset:13,isdst:!1,text:"(UTC+13:00) Samoa",utc:["Pacific/Apia"]}].filter(e=>e.utc.length).reduce((e,t)=>{let r=t.utc;for(let n=0;n<r.length;n++){const a=r[n],s=t.text;let o=s.substring(s.indexOf("(")+1,s.indexOf(")"));-1!==o.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${o}) ${a}`,utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]})}return e},[]).filter((e,t,r)=>t===r.findIndex(t=>t.value===e.value));function qS({value:t,onChange:r}){const n=ZS.map(e=>({value:e.value,label:e.text}));return e.jsx(FS,{options:n,value:t,onChange:r,placeholder:"Choose timezone...",emptyLabel:"Choose timezone"})}const JS=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=or(),[s,o]=t.useState(!1),[i,l]=t.useState(),[c,d]=t.useState(0),[u,f]=t.useState(null),p=t.useRef(null);t.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const m=Lo({resolver:Zc(nf({name:Tu().min(2,{message:"Name must be at least 2 characters."}),country:Tu().optional(),timezone:Tu().optional(),language:Tu().optional(),currency:Tu().optional()})),defaultValues:{name:i?.name||"",country:i?.country||"",timezone:i?.timezone||"",language:i?.language||"",currency:i?.currency||""}});return t.useEffect(()=>{a().then(e=>{l(e),m.setValue("name",e.name),m.setValue("country",e.country),m.setValue("timezone",e.timezone),m.setValue("language",e.language),m.setValue("currency",e.currency)})},[c]),i?e.jsxs("div",{children:[u&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:u})]}),e.jsx("div",{className:"space-y-4",children:e.jsx(Kd,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(async function(e){o(!0),f(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),f("Profile saved successfully"),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{f(null)},5e3)}catch(e){De(e,{component:"WorkspaceSettingsProfile",action:"updateUserProfile",metadata:{workspaceId:r._id}})}finally{o(!1)}}),className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Email"}),e.jsx(ru,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:i?.email})]}),e.jsx(Zd,{disabled:s,control:m.control,name:"name",render:({field:t})=>e.jsxs(Yd,{children:[e.jsx(Xd,{children:"Name"}),e.jsx(Qd,{children:e.jsx(ru,{...t})}),e.jsx(tu,{})]})}),e.jsxs("div",{className:"flex gap-y-2 my-4 flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Language"}),e.jsx(HS,{value:m.watch("language"),onChange:e=>{m.setValue("language",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Country"}),e.jsx($S,{value:m.watch("country"),onChange:e=>{m.setValue("country",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Currency"}),e.jsx(BS,{value:m.watch("currency"),onChange:e=>{m.setValue("currency",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Timezone"}),e.jsx(qS,{value:m.watch("timezone"),onChange:e=>{m.setValue("timezone",e)}})]})]}),e.jsxs("div",{className:"flex justify-end gap-x-2",children:[e.jsx(Ld,{type:"submit",progress:s,disabled:s,children:"Save"}),e.jsx(Ld,{type:"button",variant:"outline",onClick:()=>{d(e=>e+1)},disabled:s,children:"Reset"})]})]})})}),i?.image&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),e.jsx("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:e.jsx("img",{src:i.image,alt:i.name,className:"w-full h-full object-cover"})})]})]}):e.jsx(Ox,{})};function YS(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 XS(e,t,r){const n=YS(e,t);if(!n?.basePricing)return null;const a=n.basePricing[r];return null!=a?a:null}function QS(e,t,r){const n=YS(e,t);if(!n?.stripePrices)return null;const a="monthly"===r?"monthlyPriceId":"yearly"===r?"yearlyPriceId":"quarterlyPriceId",s="monthly"===r?"monthly":"yearly"===r?"yearly":void 0;return n.stripePrices[a]??(s?n.stripePrices[s]:void 0)??null}function ej(e,t,r,n){const a=YS(e,t),s=a?.quotaOverages?.[r];if(s)return s[n]}function tj(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 rj(e,t,r,n){const a=e.quotas?.[r];if(null==a)return null;const s=a[n];if(!s)return null;const o=ej(e,t,r,n);return{included:s.included,...void 0!==s.unitSize&&{unitSize:s.unitSize},...void 0!==o&&{overage:o}}}function nj(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 aj(e,t){const r=YS(e,t);return r?.seatPricing?.enabled?r.seatPricing:null}function sj(e,t,r){const n=aj(e,t);return n?.perSeat?n.perSeat[r]??null:null}function oj(e,t){return Math.max(0,e-(t||0))}function ij(e,t,r,n){const a=aj(e,t);if(!a)return null;return oj(n,a.includedSeats)*(sj(e,t,r)??0)}function lj(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 cj(e,t,r={}){const{overageInCents:n=!0,currency:a}=r,s=r.currencySymbol??Yx(a??"");if(null==e)return"—";const{included:o,overage:i}=e,l=`${o} included`;if(null==i)return l;const c=n?i/100:i;return`${l}, then ${s}${"number"==typeof c&&Number.isFinite(c)?c.toFixed(2):String(i)}${t&&"unitSize"in e&&null!=e.unitSize&&e.unitSize>0?` / ${e.unitSize.toLocaleString()} ${t}`:t?` / ${t}`:""}`}const dj=(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)},uj=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"}},fj=({workspaceId:t,hasActiveSubscription:r=!1,onViewPricingPlans:n,limit:a=20})=>{const{invoices:s,loading:o,error:i,refetch:l}=gr(t,a),c=s.length>0;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Billing History"}),e.jsx("p",{className:"text-sm text-gray-600",children:"View and download your invoices"})]}),e.jsx(Ld,{variant:"ghost",size:"sm",progress:o,onClick:l,disabled:o,children:o?"Refreshing...":"Refresh"})]}),i&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading invoices"}),e.jsx("p",{className:"text-sm mt-1",children:i})]}),e.jsx(Ld,{variant:"outline",size:"sm",onClick:l,disabled:o,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:o?"Retrying...":"Retry"})]}),o&&!c?e.jsx("div",{className:"border rounded-lg p-6",children:e.jsx(Ox,{})}):c?e.jsx("div",{className:"space-y-2",children:s.map(t=>{const r=(e=>{switch(e.status){case"draft":case"open":return{text:"Pay",color:"bg-blue-600 hover:bg-blue-700"};case"paid":return{text:"View",color:"bg-green-600 hover:bg-green-700"};case"uncollectible":case"void":return{text:"View Details",color:"bg-gray-600 hover:bg-gray-700"};default:return{text:"View",color:"bg-gray-600 hover:bg-gray-700"}}})(t);return e.jsxs("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 truncate min-w-0",children:t.description||t.number||`Invoice ${t.id.slice(-8)}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium shrink-0 ${uj(t.status)}`,children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5 text-sm text-gray-600 mb-2.5",children:[e.jsx("span",{className:"font-medium text-gray-900",children:dj(t.amount_due,t.currency)}),t.created&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300 hidden sm:inline",children:"·"}),e.jsx("span",{children:(n=t.created,n?new Date(1e3*n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A")})]}),t.amount_paid>0&&t.amount_due>0&&e.jsxs("span",{className:"text-xs text-gray-500",children:["Paid: ",dj(t.amount_paid,t.currency)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ld,{size:"sm",disabled:!t.hosted_invoice_url,onClick:()=>t.hosted_invoice_url&&window.open(t.hosted_invoice_url,"_blank","noopener,noreferrer"),className:r.color,children:[r.text,e.jsx(jd,{className:"h-3 w-3 ml-1.5"})]}),t.invoice_pdf&&e.jsxs(Ld,{size:"sm",variant:"outline",onClick:()=>window.open(t.invoice_pdf,"_blank","noopener,noreferrer"),children:[e.jsx(Sd,{className:"h-3 w-3 mr-1.5"}),"PDF"]})]})]},t.id);var n})}):e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsx(kd,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-sm text-gray-500",children:r?"No invoices with download option found":"No invoices yet. Subscribe to a plan to receive invoices."}),!r&&n&&e.jsx(Ld,{size:"sm",className:"mt-4",onClick:n,children:"View Pricing Plans"})]})]})},pj=t.lazy(()=>Promise.resolve().then(function(){return Qk}).then(e=>({default:e.default}))),mj=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""}},hj=({workspace:r})=>{const n=r._id?.toString(),{subscription:a,loading:s,error:o,updateSubscription:i,refetch:l}=hr(n),{createCheckoutSession:c}=pr(n),{cancelSubscription:d,loading:u}=xr(n),{resumeSubscription:f,loading:p}=yr(n),{openBillingPortal:m,loading:h}=br(n),{versions:g,loading:b,error:x,refetch:y}=fr(n),v=s||b,w=o||x,{currentVersion:S,latestVersion:j,isDeprecated:k,whatsNew:N,plansToShow:E}=t.useMemo(()=>{const e=g?.currentVersion,t=g?.availableVersions||[],r=null!=a?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const s=!!(r&&n&&e)&&n.version>e.version,o=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:s,isDeprecated:s&&r,whatsNew:n?.whatsNew,plansToShow:o}},[g,a?.subscription]),[C,A]=t.useState(!1),[_,T]=t.useState(null),[R,P]=t.useState(null),O=t.useRef(null),[I,D]=t.useState(!1),[U,F]=t.useState(!1);t.useEffect(()=>()=>{O.current&&clearTimeout(O.current)},[]);const[M,z]=t.useState(!1),[L,$]=t.useState("subscription"),W=async()=>{await Promise.all([l(),y()])},V=t.useMemo(()=>nj(a?.subscription?.stripePriceId,E??[]),[a?.subscription?.stripePriceId,E]);if(v&&!a&&!g)return e.jsx(Ox,{});const B=a?.planVersion?._id||null;return n?e.jsxs("div",{className:"space-y-6",children:[w&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading subscription data"}),e.jsx("p",{className:"text-sm mt-1",children:w}),e.jsx("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try again."})]}),e.jsx(Ld,{variant:"outline",size:"sm",onClick:W,disabled:v,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:v?"Retrying...":"Retry"})]}),_&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Update failed"}),e.jsx("p",{className:"text-sm mt-1",children:_})]}),e.jsx(Ld,{variant:"outline",size:"sm",onClick:()=>T(null),className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:"Dismiss"})]}),R&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm mt-1",children:R})]}),e.jsx(Ld,{variant:"outline",size:"sm",onClick:()=>P(null),className:"flex-shrink-0 border-green-200 text-green-700 hover:bg-green-100",children:"Dismiss"})]}),e.jsx("div",{className:"border-b border-gray-200",children:e.jsxs("nav",{className:"-mb-px flex gap-6","aria-label":"Subscription tabs",children:[e.jsx("button",{type:"button",onClick:()=>$("subscription"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("subscription"===L?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Plan"}),e.jsx("button",{type:"button",onClick:()=>$("invoices"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("invoices"===L?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Invoices"})]})}),"subscription"===L&&e.jsxs(e.Fragment,{children:[v&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(Ed,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading subscription and pricing plans..."})]}),k&&a?.subscription&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg px-4 py-3 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Ud,{className:"h-4 w-4 text-amber-600 shrink-0"}),e.jsxs("span",{className:"text-sm text-amber-800",children:[e.jsx("span",{className:"font-medium",children:"Plan update available"}),e.jsxs("span",{className:"text-amber-600",children:[" ","— v",S?.version||"?"," → v",j?.version||"?"]})]})]}),e.jsx(Ld,{size:"sm",variant:"outline",className:"shrink-0 border-amber-300 text-amber-700 hover:bg-amber-100",onClick:()=>D(!0),children:"View Plans"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("p",{className:"text-sm text-gray-600",children:"Manage your plan and billing"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[a?.subscription?.cancelAtPeriodEnd||u?null:a?.subscription?e.jsx(Ld,{variant:"outline",size:"sm",onClick:()=>D(!0),children:"Change Plan"}):!a?.subscription&&E&&E.length>0?e.jsx(Ld,{size:"sm",onClick:()=>D(!0),children:"View Pricing Plans"}):null,e.jsx(Ld,{variant:"ghost",size:"sm",progress:v,onClick:W,disabled:v||C,children:v?"Refreshing...":"Refresh"})]})]}),a?.subscription?(()=>{const t=nj(a.subscription.stripePriceId,E??[]),n=t?.interval??null,s=t?.currency??a.plan?.currency??r?.billingCurrency??"",o=n&&a.planVersion?XS(a.planVersion,s,n):null,i=s,l=a.planVersion?aj(a.planVersion,s):null,c=l&&n?sj(a.planVersion,s,n):null,d=Array.isArray(r?.users)?r.users.length:1,f=l?.includedSeats??0,g=Math.max(0,d-f),b=null!=o?0===o?"Free":ey(o,i):null,x="monthly"===n?"/month":"quarterly"===n?"/quarter":"yearly"===n?"/year":"";return e.jsxs("div",{className:"border rounded-lg overflow-hidden "+(k?"border-amber-300":"border-gray-200"),children:["trialing"===a.subscription.subscriptionStatus&&(()=>{const t=a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd,r=t?new Date(t):null,n=r&&!isNaN(r.getTime())?r:null,s=n?Math.max(0,Math.ceil((n.getTime()-Date.now())/864e5)):null,o=null!==s&&s<=3;return e.jsxs("div",{className:"px-4 py-3 sm:px-5 text-sm flex flex-col sm:flex-row sm:items-center justify-between gap-2 "+(o?"bg-amber-50 text-amber-800 border-b border-amber-200":"bg-blue-50 text-blue-800 border-b border-blue-200"),children:[e.jsxs("span",{children:[null!==s&&s<=0?"Your trial has ended.":null!==s?`Your trial ends in ${s} day${1===s?"":"s"}.`:"You are on a trial."," ","Upgrade to keep access."]}),e.jsx(Ld,{size:"sm",variant:o?"default":"outline",className:"shrink-0 "+(o?"":"border-blue-300 text-blue-700 hover:bg-blue-100"),onClick:()=>D(!0),children:"Upgrade Now"})]})})(),e.jsxs("div",{className:"p-4 sm:p-5 "+(k?"bg-amber-50/50":"bg-gray-50/50"),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:a.plan?.name||"No plan assigned"}),e.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium "+("active"===a.subscription.subscriptionStatus?a.subscription.cancelAtPeriodEnd?"bg-amber-100 text-amber-800":"bg-green-100 text-green-800":"trialing"===a.subscription.subscriptionStatus?"bg-blue-100 text-blue-800":"canceled"===a.subscription.subscriptionStatus?"bg-gray-100 text-gray-800":"bg-red-100 text-red-800"),children:["active"===a.subscription.subscriptionStatus&&(a.subscription.cancelAtPeriodEnd?"Canceling":"Active"),"trialing"===a.subscription.subscriptionStatus&&"Trial","canceled"===a.subscription.subscriptionStatus&&"Canceled","past_due"===a.subscription.subscriptionStatus&&"Past Due"]}),"trialing"===a.subscription.subscriptionStatus&&mj(a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("span",{className:"text-xs text-gray-500",children:["(ends"," ",mj(a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd),")"]}),k&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800",children:[e.jsx(Ud,{className:"h-3 w-3"}),"Deprecated"]})]}),a.plan?.description&&e.jsx("p",{className:"text-sm text-gray-600 mb-3",children:a.plan.description}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-gray-900",children:b||"N/A"}),b&&"Free"!==b&&x&&e.jsx("span",{className:"text-sm text-gray-500",children:x})]}),l&&c&&c>0&&e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["+ ",ey(c,i),"/seat",x]}),l&&c&&c>0&&g>0&&b&&"Free"!==b&&null!=o&&e.jsxs("div",{className:"text-xs text-gray-500 mt-1 pt-1 border-t border-gray-200",children:["Est. total:"," ",e.jsxs("span",{className:"font-medium text-gray-700",children:[ey(o+c*g,i),x]}),e.jsxs("span",{className:"text-gray-400",children:[" ","(",g," extra seat",1!==g?"s":"",")"]})]})]}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus)&&!a.subscription.cancelAtPeriodEnd&&mj(a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[e.jsx(bd,{className:"h-3.5 w-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Next billing:"," ",e.jsx("span",{className:"font-medium text-gray-700",children:mj(a.subscription.stripeCurrentPeriodEnd)})]})]})]}),k&&e.jsxs("p",{className:"text-xs text-amber-600 mt-2",children:["Version ",S?.version||"N/A"," - A newer version is available"]}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus||"past_due"===a.subscription.subscriptionStatus)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3 mt-4 pt-4 border-t border-gray-200",children:[a.subscription&&e.jsx(Ld,{variant:"outline",size:"sm",onClick:()=>m(),disabled:h,progress:h,children:h?"Opening...":"Manage Payment"}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus)&&e.jsx(e.Fragment,{children:"active"===a.subscription.subscriptionStatus&&a.subscription.cancelAtPeriodEnd?e.jsx(Ld,{variant:"outline",size:"sm",onClick:()=>z(!0),disabled:C||u||p,progress:p,children:"Resume Subscription"}):e.jsx(Ld,{variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200",onClick:()=>F(!0),disabled:C||u||p,progress:u||C,children:u||C?"Canceling...":"trialing"===a.subscription.subscriptionStatus?"Cancel Trial":"Cancel Subscription"})})]})]}),"past_due"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ud,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800",children:"Payment past due"}),e.jsx("p",{className:"text-sm text-red-700 mt-0.5",children:"Please update your payment method to avoid service interruption. Check your invoices for details."}),e.jsx(Ld,{variant:"outline",size:"sm",className:"mt-2 border-red-200 text-red-700 hover:bg-red-100",onClick:()=>$("invoices"),children:"View Invoices"})]})]})}),"past_due"===a.subscription.subscriptionStatus&&a.subscription.dunningState&&"none"!==a.subscription.dunningState&&e.jsx("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ud,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800",children:"final"===a.subscription.dunningState?"Final warning: Subscription will be suspended":"suspended"===a.subscription.dunningState?"Subscription suspended":"Payment recovery in progress"}),e.jsx("p",{className:"text-sm text-red-700 mt-0.5",children:"suspended"===a.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"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"px-5 py-3 bg-blue-50 border-t border-blue-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(bd,{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-blue-800",children:"Subscription paused"}),e.jsx("p",{className:"text-sm text-blue-700 mt-0.5",children:"Your subscription is currently paused. Resume to restore full access."})]})]})}),a.subscription.cancelAtPeriodEnd&&e.jsx("div",{className:"px-5 py-3 bg-amber-50 border-t border-amber-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(bd,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-amber-800",children:"Subscription scheduled for cancellation"}),e.jsx("p",{className:"text-sm text-amber-700 mt-0.5",children:mj(a.subscription.stripeCurrentPeriodEnd)?e.jsxs(e.Fragment,{children:["Your subscription will end on"," ",e.jsx("span",{className:"font-medium",children:mj(a.subscription.stripeCurrentPeriodEnd)}),". You'll retain access until then and won't be charged again."]}):"Your subscription will be canceled at the end of the current billing period. You won't be charged again."})]})]})}),a.planVersion&&(()=>{const t=((e,t,r="monthly")=>{if(!e?.subscriptionItems)return{features:[],limits:[],quotas:[]};const n=[],a=[],s=[];return e.subscriptionItems.forEach(o=>{const i=o.slug;if("feature"===o.type){const t=e.features?.[i]??!1;n.push({item:o,enabled:t})}else if("limit"===o.type){const t=e.limits?.[i]??0;a.push({item:o,value:t})}else if("quota"===o.type){const n=t&&e.pricingVariants?.length?rj(e,t,i,r):lj(e.quotas?.[i],r);null!=n&&s.push({item:o,value:n})}}),{features:n,limits:a,quotas:s}})(a.planVersion,s,n??"monthly");return t.features.length>0||t.limits.length>0||t.quotas.length>0?e.jsx("div",{className:"px-4 py-4 sm:px-5 sm:py-5 border-t border-gray-100",children:e.jsxs("div",{className:"space-y-5",children:[t.features.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Features"}),e.jsx("ul",{className:"space-y-1.5",children:t.features.sort(e=>e.enabled?-1:1).map(({item:t,enabled:r})=>e.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"w-4 text-center shrink-0 "+(r?"text-green-500":"text-gray-300"),children:r?"✓":"✕"}),e.jsx("span",{className:r?"text-gray-700":"text-gray-400",children:t.name})]},t._id))})]}),t.limits.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Limits"}),e.jsx("ul",{className:"space-y-1.5",children:t.limits.map(({item:t,value:r})=>e.jsxs("li",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900",children:r})]},t._id))})]}),t.quotas.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Usage Quotas"}),e.jsx("ul",{className:"space-y-1.5",children:t.quotas.map(({item:t,value:r})=>{const n=cj(r,t.name.toLowerCase(),{currency:s});return e.jsx("li",{className:"text-sm",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-0.5",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900 text-xs sm:text-sm",children:n})]})},t._id)})})]}),l&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Seats"}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Members"}),e.jsx("span",{className:"font-semibold text-gray-900",children:d})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Included"}),e.jsx("span",{className:"text-gray-900",children:f})]}),g>0&&e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Billable"}),e.jsxs("span",{className:"font-medium text-amber-600",children:[g," extra"]})]}),c&&c>0&&e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Per extra seat"}),e.jsxs("span",{className:"text-gray-900",children:[ey(c,s),x]})]}),l.maxSeats>0&&e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Limit"}),e.jsx("span",{className:"text-gray-900",children:l.maxSeats})]})]})]})]})}):null})()]})})():r.pendingOnboarding?e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(wd,{className:"h-12 w-12 mx-auto mb-3 text-blue-400"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"Start your free trial"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Try the full plan with no commitment. You can upgrade or cancel anytime."})]}),e.jsx(Ld,{size:"sm",progress:C,onClick:async()=>{try{A(!0);const e=await c({planVersionId:r.pendingOnboarding?.planVersionId??""});e&&"checkoutUrl"in e&&e.checkoutUrl&&(window.location.href=e.checkoutUrl)}catch(e){}finally{A(!1)}},children:"Start Free Trial"}),E&&E.length>0&&e.jsx(Ld,{variant:"ghost",size:"sm",className:"ml-2",onClick:()=>D(!0),children:"View All Plans"})]}):e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(wd,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]}),E&&E.length>0&&e.jsx(Ld,{size:"sm",onClick:()=>D(!0),children:"View Pricing Plans"})]})]}),!g&&!v&&e.jsxs("div",{className:"border rounded-lg p-4 text-center",children:[e.jsxs("div",{className:"text-gray-500 mb-2",children:[e.jsx("p",{className:"font-medium",children:"Unable to load plan information"}),w&&e.jsxs("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",w]}),!w&&e.jsx("p",{className:"text-sm mt-2",children:"No plan groups are available for this workspace. Please contact support if you believe this is an error."})]}),e.jsx(Ld,{variant:"outline",size:"sm",progress:v,onClick:W,disabled:v,className:"mt-4",children:v?"Refreshing...":"Refresh"})]})]}),"invoices"===L&&e.jsxs(e.Fragment,{children:[v&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(Ed,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading invoices..."})]}),e.jsx(fj,{workspaceId:n,hasActiveSubscription:null!==a?.subscription,onViewPricingPlans:()=>$("subscription"),limit:20})]}),E&&E.length>0&&e.jsx(t.Suspense,{fallback:I?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Ed,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading plans..."})]})}):null,children:e.jsx(pj,{open:I,onOpenChange:D,planVersions:E,currentPlanVersionId:B||null,currentStripePriceId:a?.subscription?.stripePriceId,billingCurrency:r.billingCurrency,currentMemberCount:Array.isArray(r?.users)?r.users.length:void 0,onSelectPlan:async(e,t="monthly",s)=>{if(!n)return;const o=E?.find(t=>t._id===e),l=s??V?.currency??a?.plan?.currency??r?.billingCurrency??"",d=o?QS(o,l,t):null,u=a?.subscription?.stripePriceId;if(!d||!u||d!==u){A(!0),T(null),P(null);try{let r,n,s;try{const e=new URL(window.location.href);r=e.toString(),n=e.toString()}catch{const e=window.location.protocol||"https:",t=window.location.host||window.location.hostname||"",a=`${e}//${t}${window.location.pathname||"/"}`;r=a,n=a}if(s=a?.subscription?await i(e,{billingInterval:t,successUrl:r,cancelUrl:n}):await c({planVersionId:e,billingInterval:t,currency:l||void 0,successUrl:r,cancelUrl:n}),s&&"checkoutUrl"in s&&s.checkoutUrl)return void(window.location.href=s.checkoutUrl);P("Subscription updated successfully!"),await W()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";T(t)}finally{A(!1),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{T(null),P(null)},5e3)}}},loading:C||v})}),e.jsx(Sx,{open:M,onOpenChange:z,children:e.jsxs(Ex,{children:[e.jsxs(Cx,{children:[e.jsx(_x,{children:"Resume Subscription"}),e.jsx(Tx,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to resume your subscription?"}),e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ud,{className:"h-4 w-4 text-amber-600 mt-0.5 flex-shrink-0"}),e.jsxs("span",{children:["You will be charged again on"," ",a?.subscription?.stripeCurrentPeriodEnd&&mj(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:mj(a.subscription.stripeCurrentPeriodEnd)}):"the next billing date"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-600 mt-0.5",children:"•"}),e.jsx("span",{children:"Your subscription will continue automatically and you'll be billed according to your plan"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"ℹ"}),e.jsx("span",{children:"You can cancel anytime before the next billing date if you change your mind"})]})]})]})})]}),e.jsxs(Ax,{children:[e.jsx(Px,{disabled:p,children:"Keep Canceled"}),e.jsx(Rx,{onClick:async()=>{if(n){z(!1),A(!0),T(null),P(null);try{await f(),P("Subscription has been resumed."),await W()}catch(e){const t=e instanceof Error?e.message:"Failed to resume subscription";T(t)}finally{A(!1),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{T(null),P(null)},5e3)}}},disabled:p,children:p?"Resuming...":"Yes, Resume Subscription"})]})]})}),e.jsx(Sx,{open:U,onOpenChange:F,children:e.jsxs(Ex,{children:[e.jsxs(Cx,{children:[e.jsx(_x,{children:"Cancel Subscription"}),e.jsx(Tx,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to cancel your subscription?"}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"✓"}),e.jsxs("span",{children:["You'll retain full access to this plan until"," ",a?.subscription?.stripeCurrentPeriodEnd&&mj(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:mj(a.subscription.stripeCurrentPeriodEnd)}):"the end of your current billing period"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"✓"}),e.jsx("span",{children:"You won't be charged again after cancellation"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"ℹ"}),e.jsx("span",{children:"You can resume your subscription anytime before it ends"})]})]})]})})]}),e.jsxs(Ax,{children:[e.jsx(Px,{disabled:u,children:"Keep Subscription"}),e.jsx(Rx,{onClick:async()=>{if(n){F(!1),A(!0),T(null),P(null);try{await d(),P("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";T(t)}finally{A(!1),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{T(null),P(null)},5e3)}}},disabled:u,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:u?"Canceling...":"Yes, Cancel Subscription"})]})]})})]}):e.jsx("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:e.jsx("p",{children:"Invalid workspace ID"})})};function gj(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"K":e.toLocaleString()}function bj(e){return e.replace(/[_-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function xj(e,t){return t+e.toFixed(2)}function yj(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 vj=()=>{const{quotas:r,loading:n,error:a,refetch:s}=Ar(),{response:o}=jr(),[i,l]=t.useState(!1),c=t.useMemo(()=>{const e={};if(!o?.planVersion||!o?.subscription)return e;const t=o.planVersion,n=o.subscription,a=n.billingInterval??"monthly",s=n.plan?.currency??"usd",i=Yx(s);if(!r)return e;for(const n of Object.keys(r)){const o=ej(t,s,n,a);if(null==o||o<=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)*o/100;e[n]={overageCents:o,unitSize:d,currency:s,currencySymbol:i,estimatedCost:f}}return e},[o,r]),d=t.useMemo(()=>{const e=o?.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:yj(e)}:null},[o]),u=async()=>{l(!0);try{await s()}finally{l(!1)}};if(n&&!r)return e.jsx(Ox,{});if(a)return e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Failed to load usage data"}),e.jsx("p",{className:"text-sm mt-1",children:a})]}),e.jsx(Ld,{variant:"outline",size:"sm",onClick:u,disabled:i,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:i?"Retrying...":"Retry"})]});const f=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===f.length)return e.jsxs("div",{className:"border rounded-lg p-8 text-center",children:[e.jsx(xd,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-gray-600",children:"No quota usage data available for this workspace."}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Quotas will appear here once your plan includes metered resources."})]});const p=f.filter(([,e])=>e.hasOverage).length,m=f.length>0?Math.round(f.reduce((e,[,t])=>e+(t.included>0?t.consumed/t.included*100:0),0)/f.length):0,h=Object.values(c).reduce((e,t)=>e+t.estimatedCost,0),g=Object.values(c)[0]?.currencySymbol??"$";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Monitor your resource consumption and quotas"}),e.jsxs(Ld,{variant:"ghost",size:"sm",onClick:u,disabled:i,children:[e.jsx(_d,{className:ke("h-3.5 w-3.5 mr-1.5",i&&"animate-spin")}),i?"Refreshing...":"Refresh"]})]}),d&&e.jsxs("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:[e.jsx(bd,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),e.jsxs("span",{children:["Usage resets on ",e.jsx("span",{className:"font-medium text-gray-900",children:d.endDate}),null!==d.daysRemaining&&d.daysRemaining>0&&e.jsxs("span",{className:"text-gray-500",children:[" (",d.daysRemaining," ",1===d.daysRemaining?"day":"days"," remaining)"]}),null!==d.daysRemaining&&d.daysRemaining<=0&&e.jsx("span",{className:"text-amber-600 font-medium",children:" (renewing soon)"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-3",children:[e.jsxs("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Total Resources"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:f.length})]}),e.jsxs("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Overall Usage"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:m+"%"})]}),e.jsxs("div",{className:ke("border rounded-lg p-3 sm:p-4",p>0?"border-red-200 bg-red-50":"border-gray-200"),children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"In Overage"}),e.jsx("p",{className:ke("text-lg sm:text-xl font-semibold mt-1",p>0?"text-red-600":"text-gray-900"),children:p})]}),p>0&&h>0&&e.jsxs("div",{className:"border border-red-200 bg-red-50 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Est. Overage Cost"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold mt-1 text-red-600",children:xj(h,g)})]})]}),p>0&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ud,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5 hidden sm:block"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Overage Detected"}),e.jsxs("p",{className:"text-sm text-amber-700",children:[p," ",1===p?"resource has":"resources have"," exceeded the included quota. Additional usage will be billed as overage on your next invoice."]}),h>0&&e.jsxs("p",{className:"text-sm text-amber-700 font-medium mt-1",children:["Estimated overage charges this period: ",xj(h,g)]})]})]})}),e.jsx("div",{className:"space-y-3",children:f.map(([t,r])=>{const n=(a=r.consumed,(s=r.included)<=0?a>0?100:0:Math.min(a/s*100,100));var a,s;const o=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),i=c[t];return e.jsx(wj,{slug:t,quota:r,percent:n,colors:o,pricing:i},t)})})]})};function wj({slug:t,quota:r,percent:n,colors:a,pricing:s}){return e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-1 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900 truncate",children:bj(t)}),r.hasOverage&&e.jsx("span",{className:ke("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",a.badge,a.badgeText),children:"Overage"}),!r.hasOverage&&n>=90&&e.jsx("span",{className:ke("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",a.badge,a.badgeText),children:"Almost full"})]}),e.jsxs("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:[gj(r.consumed)," / ",gj(r.included)]})]}),e.jsx("div",{className:ke("h-2 rounded-full w-full",a.bg),children:e.jsx("div",{className:ke("h-2 rounded-full transition-all duration-500",a.bar),style:{width:`${n}%`}})}),e.jsxs("div",{className:"flex items-center justify-between mt-2 text-xs text-gray-500",children:[e.jsxs("span",{children:[Math.round(n),"% used"]}),e.jsx("span",{children:r.available>0?`${gj(r.available)} remaining`:r.hasOverage?`${gj(r.overage)} over limit`:"Fully used"})]}),r.hasOverage&&s&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Overage units"}),e.jsx("span",{className:"font-medium text-gray-900",children:gj(r.overage)})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Rate"}),e.jsxs("span",{className:"font-medium text-gray-900",children:[s.currencySymbol,(s.overageCents/100).toFixed(2),s.unitSize>1?` / ${s.unitSize.toLocaleString()} units`:" / unit"]})]}),s.unitSize>1&&e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Billable blocks"}),e.jsx("span",{className:"font-medium text-gray-900",children:Math.ceil(r.overage/s.unitSize).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs pt-2 border-t border-gray-200",children:[e.jsx("span",{className:"font-medium text-red-600",children:"Estimated charge"}),e.jsx("span",{className:"font-semibold text-red-600",children:xj(s.estimatedCost,s.currencySymbol)})]})]}),!r.hasOverage&&s&&e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:["Overage rate: ",s.currencySymbol,(s.overageCents/100).toFixed(2),s.unitSize>1?` / ${s.unitSize.toLocaleString()} units`:" / unit"]})]})}function Sj(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Jc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jj=Symbol("radix.slottable");function kj(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===jj}var Nj=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});a.forwardRef((t,r)=>e.jsx(Op.span,{...t,ref:r,style:{...Nj,...t.style}})).displayName="VisuallyHidden";var Ej=[" ","Enter","ArrowUp","ArrowDown"],Cj=[" ","Enter"],Aj="Select",[_j,Tj,Rj]=cg(Aj),[Pj]=jp(Aj,[Rj,Ww]),Oj=Ww(),[Ij,Dj]=Pj(Aj),[Uj,Fj]=Pj(Aj),Mj=t=>{const{__scopeSelect:r,children:n,open:s,defaultOpen:o,onOpenChange:i,value:l,defaultValue:c,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:m,required:h,form:g}=t,b=Oj(r),[x,y]=a.useState(null),[v,w]=a.useState(null),[S,j]=a.useState(!1),k=ug(u),[N,E]=_p({prop:s,defaultProp:o??!1,onChange:i,caller:Aj}),[C,A]=_p({prop:l,defaultProp:c,onChange:d,caller:Aj}),_=a.useRef(null),T=!x||(g||!!x.closest("form")),[R,P]=a.useState(new Set),O=Array.from(R).map(e=>e.props.value).join(";");return e.jsx(aS,{...b,children:e.jsxs(Ij,{required:h,scope:r,trigger:x,onTriggerChange:y,valueNode:v,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:j,contentId:Cp(),value:C,onValueChange:A,open:N,onOpenChange:E,dir:k,triggerPointerDownPosRef:_,disabled:m,children:[e.jsx(_j.Provider,{scope:r,children:e.jsx(Uj,{scope:t.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{P(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:n})}),T?e.jsxs(Sk,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:C,onChange:e=>A(e.target.value),disabled:m,form:g,children:[void 0===C?e.jsx("option",{value:""}):null,Array.from(R)]},O):null]})})};Mj.displayName=Aj;var zj="SelectTrigger",Lj=a.forwardRef((t,r)=>{const{__scopeSelect:n,disabled:s=!1,...o}=t,i=Oj(n),l=Dj(zj,n),c=l.disabled||s,d=Yc(r,l.onTriggerChange),u=Tj(n),f=a.useRef("touch"),[p,m,h]=kk(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===l.value),n=Nk(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 e.jsx(sS,{asChild:!0,...i,children:e.jsx(Op.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":jk(l.value)?"":void 0,...o,ref:d,onClick:Sp(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Sp(o.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:Sp(o.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||Ej.includes(e.key)&&(g(),e.preventDefault())})})})});Lj.displayName=zj;var $j="SelectValue",Wj=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:a,style:s,children:o,placeholder:i="",...l}=t,c=Dj($j,n),{onValueNodeHasChildrenChange:d}=c,u=void 0!==o,f=Yc(r,c.onValueNodeChange);return Zf(()=>{d(u)},[d,u]),e.jsx(Op.span,{...l,ref:f,style:{pointerEvents:"none"},children:jk(c.value)?e.jsx(e.Fragment,{children:i}):o})});Wj.displayName=$j;var Vj=a.forwardRef((t,r)=>{const{__scopeSelect:n,children:a,...s}=t;return e.jsx(Op.span,{"aria-hidden":!0,...s,ref:r,children:a||"▼"})});Vj.displayName="SelectIcon";var Bj=t=>e.jsx(Xp,{asChild:!0,...t});Bj.displayName="SelectPortal";var Gj="SelectContent",Kj=a.forwardRef((t,r)=>{const n=Dj(Gj,t.__scopeSelect),[o,i]=a.useState();if(Zf(()=>{i(new DocumentFragment)},[]),!n.open){const r=o;return r?s.createPortal(e.jsx(Zj,{scope:t.__scopeSelect,children:e.jsx(_j.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),r):null}return e.jsx(Yj,{...t,ref:r})});Kj.displayName=Gj;var Hj=10,[Zj,qj]=Pj(Gj),Jj=function(t){const r=Sj(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(kj);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("SelectContent.RemoveScroll"),Yj=a.forwardRef((t,r)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:l,side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:x,...y}=t,v=Dj(Gj,n),[w,S]=a.useState(null),[j,k]=a.useState(null),N=Yc(r,e=>S(e)),[E,C]=a.useState(null),[A,_]=a.useState(null),T=Tj(n),[R,P]=a.useState(!1),O=a.useRef(!1);a.useEffect(()=>{if(w)return Ym(w)},[w]),rm();const I=a.useCallback(e=>{const[t,...r]=T().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&j&&(j.scrollTop=0),r===n&&j&&(j.scrollTop=j.scrollHeight),r?.focus(),document.activeElement!==a)return}},[T,j]),D=a.useCallback(()=>I([E,w]),[I,E,w]);a.useEffect(()=>{R&&D()},[R,D]);const{onOpenChange:U,triggerPointerDownPosRef:F}=v;a.useEffect(()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():w.contains(r.target)||U(!1),document.removeEventListener("pointermove",t),F.current=null};return null!==F.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[w,U,F]),a.useEffect(()=>{const e=()=>U(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[U]);const[M,z]=kk(e=>{const t=T().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=Nk(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),L=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==v.value&&v.value===t||n)&&(C(e),n&&(O.current=!0))},[v.value]),$=a.useCallback(()=>w?.focus(),[w]),W=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==v.value&&v.value===t||n)&&_(e)},[v.value]),V="popper"===s?Qj:Xj,B=V===Qj?{side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:x}:{};return e.jsx(Zj,{scope:n,content:w,viewport:j,onViewportChange:k,itemRefCallback:L,selectedItem:E,onItemLeave:$,itemTextRefCallback:W,focusSelectedItem:D,selectedItemText:A,position:s,isPositioned:R,searchRef:M,children:e.jsx(Bm,{as:Jj,allowPinchZoom:!0,children:e.jsx(Gp,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Sp(o,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e.jsx(zp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:e.jsx(V,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:e=>e.preventDefault(),...y,...B,onPlaced:()=>P(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Sp(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=T().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>I(t)),e.preventDefault()}})})})})})})});Yj.displayName="SelectContentImpl";var Xj=a.forwardRef((t,r)=>{const{__scopeSelect:n,onPlaced:s,...o}=t,i=Dj(Gj,n),l=qj(Gj,n),[c,d]=a.useState(null),[u,f]=a.useState(null),p=Yc(r,e=>f(e)),m=Tj(n),h=a.useRef(!1),g=a.useRef(!0),{viewport:b,selectedItem:x,selectedItemText:y,focusSelectedItem:v}=l,w=a.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&u&&b&&x&&y){const e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),n=y.getBoundingClientRect();if("rtl"!==i.dir){const a=n.left-t.left,s=r.left-a,o=e.left-s,i=e.width+o,l=Math.max(i,t.width),d=window.innerWidth-Hj,u=ab(s,[Hj,Math.max(Hj,d-l)]);c.style.minWidth=i+"px",c.style.left=u+"px"}else{const a=t.right-n.right,s=window.innerWidth-r.right-a,o=window.innerWidth-e.right-s,i=e.width+o,l=Math.max(i,t.width),d=window.innerWidth-Hj,u=ab(s,[Hj,Math.max(Hj,d-l)]);c.style.minWidth=i+"px",c.style.right=u+"px"}const a=m(),o=window.innerHeight-2*Hj,l=b.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),v=f+p+l+parseInt(d.paddingBottom,10)+g,w=Math.min(5*x.offsetHeight,v),S=window.getComputedStyle(b),j=parseInt(S.paddingTop,10),k=parseInt(S.paddingBottom,10),N=e.top+e.height/2-Hj,E=o-N,C=x.offsetHeight/2,A=f+p+(x.offsetTop+C),_=v-A;if(A<=N){const e=a.length>0&&x===a[a.length-1].ref.current;c.style.bottom="0px";const t=u.clientHeight-b.offsetTop-b.offsetHeight,r=A+Math.max(E,C+(e?k:0)+t+g);c.style.height=r+"px"}else{const e=a.length>0&&x===a[0].ref.current;c.style.top="0px";const t=Math.max(N,f+b.offsetTop+(e?j:0)+C)+_;c.style.height=t+"px",b.scrollTop=A-N+b.offsetTop}c.style.margin=`${Hj}px 0`,c.style.minHeight=w+"px",c.style.maxHeight=o+"px",s?.(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,c,u,b,x,y,i.dir,s]);Zf(()=>w(),[w]);const[S,j]=a.useState();Zf(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const k=a.useCallback(e=>{e&&!0===g.current&&(w(),v?.(),g.current=!1)},[w,v]);return e.jsx(ek,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:k,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:e.jsx(Op.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Xj.displayName="SelectItemAlignedPosition";var Qj=a.forwardRef((t,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:s=Hj,...o}=t,i=Oj(n);return e.jsx(oS,{...i,...o,ref:r,align:a,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Qj.displayName="SelectPopperPosition";var[ek,tk]=Pj(Gj,{}),rk="SelectViewport",nk=a.forwardRef((t,r)=>{const{__scopeSelect:n,nonce:s,...o}=t,i=qj(rk,n),l=tk(rk,n),c=Yc(r,i.onViewportChange),d=a.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),e.jsx(_j.Slot,{scope:n,children:e.jsx(Op.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Sp(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=l;if(n?.current&&r){const e=Math.abs(d.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*Hj,a=parseFloat(r.style.minHeight),s=parseFloat(r.style.height),o=Math.max(a,s);if(o<n){const a=o+e,s=Math.min(n,a),i=a-s;r.style.height=s+"px","0px"===r.style.bottom&&(t.scrollTop=i>0?i:0,r.style.justifyContent="flex-end")}}}d.current=t.scrollTop})})})]})});nk.displayName=rk;var ak="SelectGroup",[sk,ok]=Pj(ak);a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=Cp();return e.jsx(sk,{scope:n,id:s,children:e.jsx(Op.div,{role:"group","aria-labelledby":s,...a,ref:r})})}).displayName=ak;var ik="SelectLabel",lk=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=ok(ik,n);return e.jsx(Op.div,{id:s.id,...a,ref:r})});lk.displayName=ik;var ck="SelectItem",[dk,uk]=Pj(ck),fk=a.forwardRef((t,r)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:i,...l}=t,c=Dj(ck,n),d=qj(ck,n),u=c.value===s,[f,p]=a.useState(i??""),[m,h]=a.useState(!1),g=Yc(r,e=>d.itemRefCallback?.(e,s,o)),b=Cp(),x=a.useRef("touch"),y=()=>{o||(c.onValueChange(s),c.onOpenChange(!1))};if(""===s)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(dk,{scope:n,value:s,disabled:o,textId:b,isSelected:u,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:e.jsx(_j.ItemSlot,{scope:n,value:s,disabled:o,textValue:f,children:e.jsx(Op.div,{role:"option","aria-labelledby":b,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:g,onFocus:Sp(l.onFocus,()=>h(!0)),onBlur:Sp(l.onBlur,()=>h(!1)),onClick:Sp(l.onClick,()=>{"mouse"!==x.current&&y()}),onPointerUp:Sp(l.onPointerUp,()=>{"mouse"===x.current&&y()}),onPointerDown:Sp(l.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:Sp(l.onPointerMove,e=>{x.current=e.pointerType,o?d.onItemLeave?.():"mouse"===x.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Sp(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Sp(l.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(Cj.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});fk.displayName=ck;var pk="SelectItemText",mk=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:o,style:i,...l}=t,c=Dj(pk,n),d=qj(pk,n),u=uk(pk,n),f=Fj(pk,n),[p,m]=a.useState(null),h=Yc(r,e=>m(e),u.onItemTextChange,e=>d.itemTextRefCallback?.(e,u.value,u.disabled)),g=p?.textContent,b=a.useMemo(()=>e.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:x,onNativeOptionRemove:y}=f;return Zf(()=>(x(b),()=>y(b)),[x,y,b]),e.jsxs(e.Fragment,{children:[e.jsx(Op.span,{id:u.textId,...l,ref:h}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren?s.createPortal(l.children,c.valueNode):null]})});mk.displayName=pk;var hk="SelectItemIndicator",gk=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return uk(hk,n).isSelected?e.jsx(Op.span,{"aria-hidden":!0,...a,ref:r}):null});gk.displayName=hk;var bk="SelectScrollUpButton";a.forwardRef((t,r)=>{const n=qj(bk,t.__scopeSelect),s=tk(bk,t.__scopeSelect),[o,i]=a.useState(!1),l=Yc(r,s.onScrollButtonChange);return Zf(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(yk,{...t,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=bk;var xk="SelectScrollDownButton";a.forwardRef((t,r)=>{const n=qj(xk,t.__scopeSelect),s=tk(xk,t.__scopeSelect),[o,i]=a.useState(!1),l=Yc(r,s.onScrollButtonChange);return Zf(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;i(r)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(yk,{...t,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=xk;var yk=a.forwardRef((t,r)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=t,i=qj("SelectScrollButton",n),l=a.useRef(null),c=Tj(n),d=a.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return a.useEffect(()=>()=>d(),[d]),Zf(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),e.jsx(Op.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:Sp(o.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(s,50))}),onPointerMove:Sp(o.onPointerMove,()=>{i.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(s,50))}),onPointerLeave:Sp(o.onPointerLeave,()=>{d()})})}),vk=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return e.jsx(Op.div,{"aria-hidden":!0,...a,ref:r})});vk.displayName="SelectSeparator";var wk="SelectArrow";a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=Oj(n),o=Dj(wk,n),i=qj(wk,n);return o.open&&"popper"===i.position?e.jsx(iS,{...s,...a,ref:r}):null}).displayName=wk;var Sk=a.forwardRef(({__scopeSelect:t,value:r,...n},s)=>{const o=a.useRef(null),i=Yc(s,o),l=Rg(r);return a.useEffect(()=>{const e=o.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]),e.jsx(Op.select,{...n,style:{...Nj,...n.style},ref:i,defaultValue:r})});function jk(e){return""===e||void 0===e}function kk(e){const t=Kf(e),r=a.useRef(""),n=a.useRef(0),s=a.useCallback(e=>{const a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),o=a.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function Nk(e,t,r){const n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let s=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(s=s.filter(e=>e!==r));const o=s.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return o!==r?o:void 0}Sk.displayName="SelectBubbleInput";var Ek=Lj,Ck=Vj,Ak=Bj,_k=Kj,Tk=nk,Rk=lk,Pk=fk,Ok=mk,Ik=gk,Dk=vk;const Uk=Mj,Fk=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Ek,{ref:a,className:ke("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:[r,e.jsx(Ck,{asChild:!0,children:e.jsx(Bh,{className:"h-4 w-4 opacity-50"})})]}));Fk.displayName=Ek.displayName;const Mk=a.forwardRef(({className:t,children:r,position:n="popper",...s},o)=>{const{container:i}=a.useContext(as);return e.jsx(Ak,{container:i,children:e.jsx(_k,{ref:o,className:ke("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...s,children:e.jsx(Tk,{className:ke("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});Mk.displayName=_k.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Rk,{ref:n,className:ke("px-2 py-1.5 text-sm font-semibold",t),...r})).displayName=Rk.displayName;const zk=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Pk,{ref:a,className:ke("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ik,{children:e.jsx(Kh,{className:"h-4 w-4"})})}),e.jsx(Ok,{children:r})]}));zk.displayName=Pk.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Dk,{ref:n,className:ke("-mx-1 my-1 h-px bg-muted",t),...r})).displayName=Dk.displayName;const Lk=({workspace:r})=>{const{user:n}=ts(),[a,s]=t.useState(0),[o,i]=t.useState(!1),[l,c]=t.useState([]),[d,u]=t.useState(null),{getUsers:f,removeUser:p,updateUser:m}=or(),{settings:h}=Yt(),{response:g}=jr();t.useEffect(()=>{r&&(i(!0),f(r._id).then(e=>{c(e)}).catch(e=>{De(e,{component:"WorkspaceSettingsUsers",action:"getUsers",metadata:{workspaceId:r._id}})}).finally(()=>{i(!1)}))},[r,a]);const b=()=>{s(e=>e+1)};if(o||!r)return e.jsx(Ox,{});const x=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},y=l.map(e=>({...e,...x(e.user)})),v=l.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,w="admin"===v,S=g?.subscription,j=g?.planVersion,k=S?.seatPricingEnabled,N=r?.billingCurrency||"usd",E=j?aj(j,N):null,C=E?.includedSeats??0,A=E?.maxSeats??0,_=l.length,T=k&&A>0&&_>=A,R=h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE,P=k?!T:R>_,O=S?.billingInterval??"monthly",I=j?sj(j,N,O):null,D=k&&_>=C;return e.jsxs("div",{children:[!w&&e.jsx("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),w&&e.jsx("div",{className:"mb-4",children:P?e.jsxs("div",{children:[e.jsx($k,{onInvite:b,workspaceId:r._id}),D&&I&&I>0&&e.jsx("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.jsxs("span",{children:["Each additional member adds ",e.jsxs("span",{className:"font-medium",children:[ey(I,N),"/","yearly"===O?"yr":"quarterly"===O?"qtr":"mo"]})," to your subscription"]})})]}):e.jsx("div",{className:"flex items-center justify-between p-3 bg-red-50 border border-red-100 rounded-md",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-700",children:T?"Seat limit reached":"Member limit reached"}),e.jsx("p",{className:"text-xs text-red-600 mt-0.5",children:T?`Your plan allows up to ${A} members. Upgrade for more seats.`:"Contact your admin to increase the workspace member limit."})]})})}),k&&E&&e.jsxs("div",{className:"mb-4 rounded-lg border bg-gray-50 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-900",children:"Seats"}),A>0&&e.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full "+(_>=A?"bg-red-100 text-red-700":_>=.8*A?"bg-amber-100 text-amber-700":"bg-emerald-100 text-emerald-700"),children:[_," / ",A]})]}),A>0&&e.jsx("div",{className:"w-full h-1.5 bg-gray-200 rounded-full mb-3",children:e.jsx("div",{className:"h-1.5 rounded-full transition-all "+(_>=A?"bg-red-500":_>=.8*A?"bg-amber-500":"bg-emerald-500"),style:{width:`${Math.min(100,_/A*100)}%`}})}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-900 font-medium",children:C})," included",I&&I>0&&e.jsxs("span",{className:"text-gray-400",children:[" · ",ey(I,N),"/extra seat"]})]}),A>0?e.jsxs("span",{children:[Math.max(0,A-_)," available"]}):e.jsx("span",{className:"text-gray-400",children:"No seat limit"})]})]}),e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("div",{children:e.jsxs("div",{className:"text-sm text-gray-600",children:[_," member",1!==_?"s":""]})}),e.jsx("div",{children:e.jsx(Ld,{variant:"ghost",size:"sm",onClick:b,progress:o,children:o?"Refreshing...":"Refresh"})})]}),e.jsx("ul",{className:"space-y-2",children:y.map((t,a)=>{const s=t.id===n?.id,o=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===t.id;return e.jsxs("li",{className:"border rounded p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium shrink-0",children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500 truncate",children:t.email})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-0.5 rounded",children:"You"}),o&&e.jsx("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-0.5 rounded",children:"Owner"})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-2 mt-2 pt-2 border-t border-gray-100 sm:mt-0 sm:pt-0 sm:border-0",children:[e.jsxs("div",{className:"relative flex-1 sm:flex-initial",children:[e.jsxs(Uk,{disabled:s||!w||o||d===t.id,value:t.role,onValueChange:e=>{return n=r._id,a=t.id,s=e,void(nr(r,a)?De(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}}):(u(a),m(n,a,{role:s}).then(()=>{b()}).catch(e=>{De(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}})}).finally(()=>{u(null)})));var n,a,s},children:[e.jsx(Fk,{children:e.jsx(Wj,{placeholder:"Select a role"})}),e.jsx(Mk,{children:r?.roles.map(t=>e.jsx(zk,{value:t,children:t},t))})]}),d===t.id&&e.jsx("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:e.jsx(Ed,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),!s&&!o&&e.jsx(Ld,{variant:"destructive",size:"sm",startIcon:e.jsx(Dd,{}),onClick:()=>{return e=t.id,void(nr(r,e)?De(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):p(r._id,e).then(()=>{b()}).catch(t=>{De(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})}));var e}})]})]},a)})}),0===l.length&&e.jsx("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function $k({onInvite:r,workspaceId:n}){const[a,s]=t.useState(""),[o,i]=t.useState("admin"),[l,c]=t.useState(!1),[d,u]=t.useState(null),[f,p]=t.useState(null),m=t.useRef(null),{addUser:h,getWorkspace:g}=or();t.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const[b,x]=t.useState(null),{settings:y}=Yt(),v=y?.workspace.roles??b?.roles??[];t.useEffect(()=>{n&&g(n).then(x)},[n]);const w=()=>{u(null),p(null),s(""),i("admin")};return e.jsxs("div",{className:"flex gap-2 flex-col gap-y-2",children:[d&&e.jsx("div",{className:"text-red-500 capitalize",children:d}),f&&e.jsx("div",{className:"text-green-500 capitalize",children:f}),e.jsxs("div",{children:[e.jsx(Gd,{children:"Invite member by email"}),e.jsx(ru,{type:"email",value:a,onChange:e=>s(e.target.value),placeholder:"example@example.com"})]}),e.jsxs("div",{children:[e.jsx(Gd,{children:"Role"}),e.jsxs(Uk,{value:o,onValueChange:i,children:[e.jsx(Fk,{children:e.jsx(Wj,{placeholder:"Select a role"})}),e.jsx(Mk,{children:v.map(t=>e.jsx(zk,{value:t,children:t},t))})]})]}),e.jsx("div",{children:e.jsx(Ld,{progress:l,onClick:async()=>{const e=a.trim();if(!e)return void u("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(c(!0),await h(n,e,o).then(()=>{p("User invited successfully"),r?.()}).catch(t=>{De(t,{component:"InviteMember",action:"addUser",metadata:{workspaceId:n,email:e,role:o}}),u(t instanceof Error?t.message:"Failed to invite member")}).finally(()=>{c(!1),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{w()},6e3)})):u("Invalid email address format")},disabled:l||!a||!o,children:l?"Inviting...":`Invite as ${o}`})})]})}const Wk=({workspace:t,section:r,setSection:n})=>{const{user:a}=ts(),s=("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy._id:t.createdBy)===a?.id,o=ar(t,a?.id??null),i=s||"admin"===o?.toLowerCase();return e.jsxs("div",{className:"w-44 sm:w-56 h-full flex flex-col space-y-4 sm:space-y-6 shrink-0",children:[t&&e.jsx("div",{className:"border-b p-2 py-4",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[t.image&&t.image.trim()&&e.jsx("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:e.jsx("img",{src:t.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:t.name})}),e.jsxs("div",{className:ke("flex-1 min-w-0",t.image?"":"pl-2"),children:[e.jsx("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.workspaceId})]})]})}),e.jsx(Vk,{title:"Account",children:e.jsx(Bk,{activeSection:r,icon:e.jsx(Fd,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>n("profile")})}),e.jsxs(Vk,{title:"Workspace",children:[e.jsx(Bk,{activeSection:r,icon:e.jsx(Rd,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>n("general")}),e.jsx(Bk,{activeSection:r,icon:e.jsx(Md,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>n("users")}),e.jsx(Bk,{activeSection:r,icon:e.jsx(wd,{className:"h-3.5 w-3.5"}),label:"Plan & Billing",section:"subscription",onClick:()=>n("subscription")}),e.jsx(Bk,{activeSection:r,icon:e.jsx(xd,{className:"h-3.5 w-3.5"}),label:"Usage",section:"usage",onClick:()=>n("usage")}),e.jsx(Bk,{activeSection:r,icon:e.jsx(Od,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>n("features")}),i&&e.jsx(Bk,{activeSection:r,icon:e.jsx(Ud,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>n("danger")})]})]})};function Vk({title:t,children:r}){return e.jsxs("div",{className:"px-2 flex flex-col space-y-1",children:[e.jsx("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:t}),r]})}function Bk({icon:t,label:r,section:n,onClick:a,activeSection:s}){return e.jsxs("button",{className:ke("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===s?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const Gk=({workspace:r,onClose:n,open:a,onOpenChange:s,defaultSection:o="profile",section:i,onSectionChange:l,showTrigger:c=!0,trigger:d})=>{const[u,f]=t.useState(!1),[p,m]=t.useState(o),h=void 0!==a?a:u,g=s||f,b=void 0!==i?i:p,x=l||m;if(!r)return null;const y=e.jsx(Ld,{variant:"outline",size:"icon",children:e.jsx(Rd,{className:"h-4 w-4"})});return e.jsxs(Yh,{open:h,onOpenChange:e=>{g(e),!e&&n&&n()},children:[c&&e.jsx(Xh,{asChild:!0,children:d||y}),e.jsxs(tg,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[e.jsx(ag,{className:"sr-only",children:"Workspace settings dialog"}),e.jsx(Wk,{workspace:r,section:b,setSection:x}),e.jsxs("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e.jsxs(ng,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===b&&"Account","general"===b&&"Workspace Settings","users"===b&&"Workspace Members","subscription"===b&&"Plan & Billing","usage"===b&&"Usage","features"===b&&"Workspace Features","danger"===b&&"Danger Zone"]}),e.jsxs("div",{className:"sm:max-h-[500px] overflow-y-auto",children:["profile"===b&&e.jsx(JS,{workspace:r}),"general"===b&&e.jsx(ny,{workspace:r}),"users"===b&&e.jsx(Lk,{workspace:r}),"subscription"===b&&e.jsx(hj,{workspace:r}),"usage"===b&&e.jsx(vj,{}),"features"===b&&e.jsx(Hx,{workspaceId:r._id?.toString()}),"danger"===b&&e.jsx(Ix,{workspace:r})]})]})]})]})};var Kk=Object.freeze({__proto__:null,WorkspaceSettingsDialog:Gk,default:Gk});function Hk(t){const{workspace:r,setCurrentWorkspace:n,setOpen:a,workspacesToUse:s,switchingToId:o}=t,i=t.isCurrentWorkspace??!1,l=o===r._id,c=r.subscription??null,d=null!=c&&"object"==typeof c?c.plan??null:null,u=d?.name??"";return e.jsxs("div",{className:ke("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":i}),children:[e.jsxs(yp,{className:"h-8 w-8 flex items-center justify-center",children:[e.jsx("div",{children:e.jsx(vp,{src:r.image&&r.image.trim()?r.image:void 0})}),e.jsx(wp,{children:(f=r.name,f.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e.jsxs("div",{className:"flex-1 min-w-0 max-w-full",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:r.name})}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(Md,{className:"h-3 w-3"}),e.jsxs("span",{children:[r.users?.length||0," members"]})]}),u&&e.jsx("div",{className:"max-w-fit",children:e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground bg-green-500 text-white rounded-full px-2 py-0.5",children:e.jsx("span",{className:"text-xs",children:u})})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i?null:e.jsx(Ld,{size:"sm",disabled:null!==o||l,progress:l,onClick:()=>{t.switchToWorkspace(r).then(()=>a(!1)).catch(e=>{De(e,{component:"WorkspaceItem",action:"switchToWorkspace",metadata:{workspaceId:r._id}})})},children:"Switch to"}),e.jsx(Gk,{workspace:r,onClose:()=>{if(i){const e=s.findIndex(e=>e._id?.toString()===r._id?.toString());-1!==e&&n(s[e])}}})]})]});var f}function Zk(r){const{switching:n}=or(),[a,s]=t.useState(!1),[o,i]=t.useState("emoji"),[l,c]=t.useState("🏢"),[d,u]=t.useState(!1),{createWorkspace:f}=or(),p=Lo({resolver:Zc(nf({name:Tu().min(2,{message:"Workspace name must be at least 2 characters."}),image:Tu().optional()})),defaultValues:{name:"",image:""}});return e.jsxs(Yh,{open:a,onOpenChange:s,children:[e.jsx(Xh,{asChild:!0,children:e.jsxs(Ld,{className:"w-full rounded-none",disabled:n,children:[e.jsx(Cd,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e.jsxs(tg,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e.jsxs(rg,{children:[e.jsx(ng,{children:"Create New Workspace"}),e.jsx(ag,{children:"Create a new workspace to get started."})]}),e.jsx(Kd,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){let t="";if("emoji"===o)t=ty(l);else if("url"===o&&e.image)try{new URL(e.image),t=e.image}catch{return void p.setError("image",{message:"Please enter a valid URL"})}u(!0);try{await f(e.name,t),s(!1),p.reset(),c("🏢"),i("emoji"),r?.onCreated?.()}catch(t){De(t,{component:"WorkspaceProvider",action:"createWorkspace",metadata:{name:e.name}})}finally{u(!1)}}),children:[e.jsx(Zd,{control:p.control,name:"name",render:({field:t})=>e.jsxs(Yd,{children:[e.jsx(Xd,{children:"Workspace Name"}),e.jsx(Qd,{children:e.jsx(ru,{placeholder:"My Awesome Workspace",...t})}),e.jsx(tu,{})]})}),e.jsxs("div",{className:"flex flex-col gap-y-2 my-2",children:[e.jsxs("div",{children:[e.jsx(Gd,{className:"text-sm font-medium",children:"Workspace Icon"}),e.jsx(eu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(rb,{value:o,onValueChange:e=>i(e),className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(nb,{value:"emoji",id:"emoji"}),e.jsxs(Gd,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(Pd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(nb,{value:"url",id:"url"}),e.jsxs(Gd,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(Nd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:l})]}),e.jsx($b,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:ry.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),p.setValue("image",ty(e))})(t),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(l===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx(Zd,{control:p.control,name:"image",render:({field:t})=>e.jsxs(Yd,{children:[e.jsx(Xd,{children:"Image URL"}),e.jsx(Qd,{children:e.jsx(ru,{placeholder:"https://example.com/image.png",...t})}),e.jsx(eu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(tu,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(Ld,{type:"button",variant:"outline",onClick:()=>{s(!1),p.reset(),c("🏢"),i("emoji")},disabled:d,children:"Cancel"}),e.jsx(Ld,{type:"submit",disabled:d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(Ed,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}function qk(e){if(!e)return null;const t=new Date(e);return isNaN(t.getTime())?null:t}const Jk=(e,t)=>null==e||0===e?"Free":ey(e,t),Yk=e=>{switch(e){case"monthly":default:return"/mo";case"quarterly":return"/qtr";case"yearly":return"/yr"}},Xk=(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};var Qk=Object.freeze({__proto__:null,default:({open:r,onOpenChange:n,planVersions:a,currentPlanVersionId:s,currentStripePriceId:o,billingCurrency:i,currentMemberCount:l,onSelectPlan:c,loading:d=!1})=>{const[u,f]=t.useState(!1),[p,m]=t.useState(null),h=t.useRef(!1),g=t.useMemo(()=>nj(o,a),[o,a]),b=g?.interval??null,x=g?.currency??null,y=t.useMemo(()=>tj(a),[a]),v=t.useMemo(()=>{const e=i?.trim().toLowerCase();return e?y.includes(e)?[e]:[]:y},[i,y]),[w,S]=t.useState(b||"monthly"),[j,k]=t.useState(()=>x&&v.includes(x)?x:v.length>0?v[0]:""),N=i?.trim()||j;t.useEffect(()=>{r&&(S(b||"monthly"),x&&v.includes(x)?k(x):v.length>0&&!v.includes(j)&&k(v[0]))},[r,b,x,v]);const E=t.useMemo(()=>[...a].sort((e,t)=>e.version-t.version),[a]),C=(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())})(E),A=C.filter(e=>"feature"===e.type),_=C.filter(e=>"limit"===e.type),T=C.filter(e=>"quota"===e.type),R=async e=>{if(!(e===s&&b===w||d||u||h.current)){h.current=!0,f(!0),m(e);try{await c(e,w,N),n(!1)}catch(e){}finally{h.current=!1,f(!1),m(null)}}},P=e=>XS(e,N,w),O=e=>!!e.pricingVariants?.some(e=>e.currency?.toLowerCase()===N.toLowerCase()),I=d||u,D=e=>{switch(e){case"monthly":default:return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly"}},U=e=>{const t=e._id===s,r=b===w;if(t&&r)return{label:"Current Plan",variant:"outline",disabled:!0};if(t&&!r)return{label:`Switch to ${D(w)}`,variant:"default",disabled:!1};if(!s)return{label:"Subscribe",variant:"default",disabled:!1};const n=E.findIndex(e=>e._id===s),a=E.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}},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=rj(e,N,t.slug,r);return n||lj(e.quotas?.[t.slug],r)}return null},M=(e,t,r)=>{if("feature"===t.type)return!0===e?"✓":"—";if("limit"===t.type)return null!=e?String(e):"—";if("quota"===t.type){return cj("object"==typeof e&&null!==e&&"included"in e?e:null,t.name.toLowerCase(),{currency:r})}return"—"};return e.jsx(Yh,{open:r,onOpenChange:n,children:e.jsxs(tg,{className:"inset-0 w-screen h-screen max-w-none rounded-none translate-x-0 translate-y-0 p-0 flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 px-4 py-4 sm:px-6 sm:py-6 border-b space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx(ng,{className:"text-xl sm:text-2xl font-bold",children:"Choose Your Plan"}),e.jsx(ag,{className:"mt-1 text-sm",children:"Compare plans and select the one that fits your needs"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[!i?.trim()&&v.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-slate-600",children:"Currency"}),e.jsx("select",{"aria-label":"Select billing currency",value:j,onChange:e=>k(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:v.map(t=>{const r=Jx(t);return e.jsx("option",{value:t,children:r?`${r} ${t.toUpperCase()}`:t.toUpperCase()},t)})})]}),i?.trim()&&e.jsxs("span",{className:"text-xs text-slate-500",children:["Billing in ",i.toUpperCase()]})]}),e.jsx("div",{className:"flex items-center gap-0.5 sm:gap-1 p-1 bg-slate-100 rounded-lg w-full sm:w-auto",role:"group","aria-label":"Billing interval",children:["monthly","quarterly","yearly"].map(t=>{const r=b===t;return e.jsx("button",{onClick:()=>S(t),"aria-pressed":w===t,className:"flex-1 sm:flex-initial px-3 sm:px-4 py-2 text-sm font-medium rounded-md transition-all relative "+(w===t?"bg-white text-slate-900 shadow-sm":"text-slate-600 hover:text-slate-900"),children:e.jsxs("span",{className:"flex items-center justify-center gap-1 sm:gap-1.5",children:["monthly"===t&&"Monthly","quarterly"===t&&"Quarterly","yearly"===t&&"Yearly","yearly"===t&&e.jsx("span",{className:"text-[10px] sm:text-xs px-1 sm:px-1.5 py-0.5 bg-emerald-100 text-emerald-700 rounded-full font-semibold",children:"Save"}),r&&s&&e.jsx("span",{className:"hidden sm:inline text-xs px-1.5 py-0.5 bg-blue-100 text-blue-700 rounded-full font-semibold",children:"Current"})]})},t)})})]})]}),e.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:i?.trim()&&0===v.length?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx("p",{className:"text-slate-600 font-medium",children:"No plans available for your billing currency."}),e.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Something went wrong. Please contact support."})]}):0===E.length?e.jsx("div",{className:"text-center py-12 text-gray-500",children:e.jsx("p",{children:"No plans available"})}):e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden bg-white",children:[e.jsx("div",{className:"md:hidden overflow-auto h-full",style:{maxHeight:"calc(100vh - 13rem)"},children:e.jsx("div",{className:"p-4 space-y-4",children:E.map(t=>{const r=t._id===s,n=U(t),a=I&&t._id===p,o=P(t),i=O(t),c=t.pricingVariants?.length&&t.pricingVariants.some(e=>e.currency?.toLowerCase()===N.toLowerCase())?N:t.plan?.currency??N??"",d=XS(t,N,"monthly")??0,u="monthly"!==w&&null!==o?Xk(d,o,w):null,f=aj(t,N),m=f?sj(t,N,w):null;return e.jsxs("div",{className:"rounded-xl border-2 p-4 "+(r?"border-blue-500 bg-blue-50/30":"border-slate-200 bg-white"),children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-slate-900",children:t.plan.name}),t.plan.description&&e.jsx("p",{className:"text-xs text-slate-500 mt-0.5 line-clamp-2",children:t.plan.description})]}),r&&e.jsx("span",{className:"shrink-0 rounded-md bg-blue-600 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",children:"Current"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-slate-900",children:i&&null!==o||i?Jk(o,c):"—"}),null!==o&&o>0&&i&&e.jsx("span",{className:"text-sm text-slate-500",children:Yk(w)})]}),null!==u&&u>0&&i&&e.jsxs("span",{className:"text-xs text-emerald-600 font-medium",children:["Save ",u,"% vs monthly"]}),f?.enabled&&m&&m>0&&e.jsxs("div",{className:"text-xs text-slate-500 mt-1",children:["+ ",ey(m,c),"/seat",Yk(w),f.includedSeats>0&&e.jsxs("span",{className:"text-slate-400",children:[" (",f.includedSeats," included)"]})]})]}),A.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider mb-1.5",children:"Features"}),e.jsx("div",{className:"space-y-1",children:A.map(r=>{const n=F(t,r,w),a="feature"===r.type&&!0===n;return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:["feature"===r.type?a?e.jsx("span",{className:"text-emerald-500 text-xs",children:"✓"}):e.jsx("span",{className:"text-slate-300 text-xs",children:"✕"}):null,e.jsx("span",{className:a?"text-slate-700":"text-slate-400",children:r.name})]},r._id)})})]}),_.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider mb-1.5",children:"Limits"}),e.jsx("div",{className:"space-y-1",children:_.map(r=>{const n=F(t,r,w);return e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-slate-600",children:r.name}),e.jsx("span",{className:"font-medium text-slate-700",children:"number"==typeof n?n.toLocaleString():"—"})]},r._id)})})]}),f?.enabled&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-xs font-semibold text-emerald-600 uppercase tracking-wider mb-1.5",children:"Seats"}),e.jsxs("div",{className:"space-y-1 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Included"}),e.jsx("span",{className:"font-medium",children:f.includedSeats||0})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Max"}),e.jsx("span",{className:"font-medium",children:f.maxSeats>0?f.maxSeats:"Unlimited"})]}),null!=l&&l>0&&(()=>{const t=Math.max(0,l-(f.includedSeats||0));return e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Your billable"}),e.jsx("span",{className:"font-medium "+(0===t?"text-emerald-600":"text-amber-600"),children:0===t?"All included":`${t} extra`})]})})()]})]}),e.jsx(Ld,{className:"w-full mt-2",variant:n.variant,disabled:n.disabled||I||!i,progress:a,onClick:()=>R(t._id),children:a?"Processing...":i?n.label:"Unavailable"})]},t._id)})})}),e.jsx("div",{className:"hidden md:block overflow-auto h-full",style:{maxHeight:"calc(100vh - 12rem)"},children:e.jsxs("table",{className:"w-full border-separate border-spacing-0",style:{minWidth:280+200*E.length+"px",borderCollapse:"separate"},children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:280,minWidth:280}}),E.map(t=>e.jsx("col",{style:{width:200,minWidth:200}},t._id))]}),e.jsx("thead",{children:e.jsxs("tr",{className:"align-top",children:[e.jsx("th",{className:"sticky top-0 left-0 z-30 p-0 bg-white text-left"}),E.map(t=>{const r=t._id===s,n=U(t),a=I&&t._id===p,o=P(t),i=XS(t,N,"monthly")??0,l="monthly"!==w&&null!==o?Xk(i,o,w):null,c=O(t),d=t.pricingVariants?.length&&t.pricingVariants.some(e=>e.currency?.toLowerCase()===N.toLowerCase())?N:t.plan?.currency??N??"";return e.jsx("th",{className:"sticky top-0 z-20 border-b border-slate-200 p-3 shadow-[0_2px_4px_-2px_rgba(0,0,0,0.06)] "+(t._id===s?"bg-blue-50/80":"bg-white"),children:e.jsxs("div",{className:"flex h-full flex-col gap-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"text-lg font-bold text-slate-900 truncate",children:t.plan.name}),r&&e.jsx("span",{className:"shrink-0 rounded-md bg-blue-600 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",children:"Current"})]}),e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-slate-900",children:c&&null!==o||c?Jk(o,d):"—"}),null!==o&&o>0&&c&&e.jsx("span",{className:"text-sm text-slate-500",children:Yk(w)})]}),null!==l&&l>0&&c&&e.jsxs("span",{className:"text-xs text-emerald-600 font-medium mt-0.5",children:["Save ",l,"% vs monthly"]}),(()=>{const r=aj(t,N);if(!r)return null;const n=sj(t,N,w);return!n||n<=0?null:e.jsxs("div",{className:"text-xs text-slate-500 mt-1 border-t border-slate-100 pt-1",children:[e.jsxs("span",{children:["+ ",ey(n,d),"/seat",Yk(w)]}),r.includedSeats>0&&e.jsxs("span",{className:"text-slate-400",children:[" (",r.includedSeats," included)"]})]})})()]}),t.plan.description&&e.jsx("p",{className:"text-xs text-slate-500 line-clamp-2 leading-relaxed text-left",children:t.plan.description}),e.jsx(Ld,{className:"mt-auto w-full",variant:n.variant,disabled:n.disabled||I||!c,progress:a,onClick:()=>R(t._id),children:a?"Processing...":c?n.label:"Unavailable"})]})},t._id)})]})}),e.jsxs("tbody",{children:[A.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Features"}),e.jsx("td",{colSpan:E.length,className:"border-t border-slate-200 bg-slate-100"})]}),A.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),E.map(r=>{const n=F(r,t,w),a=r.pricingVariants?.length?N:r.plan?.currency??N??"",o=M(n,t,a),i="feature"===t.type&&!0===n;return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+(i?"text-emerald-600":"—"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),_.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Limits"}),e.jsx("td",{colSpan:E.length,className:"border-t border-slate-200 bg-slate-100"})]}),_.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),E.map(r=>{const n=F(r,t,w),a=r.pricingVariants?.length?N:r.plan?.currency??N??"",o=M(n,t,a);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("—"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),T.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Quotas"}),e.jsx("td",{colSpan:E.length,className:"border-t border-slate-200 bg-slate-100"})]}),T.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),E.map(r=>{const n=F(r,t,w),a=r.pricingVariants?.length?N:r.plan?.currency??N??"",o=M(n,t,a);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("—"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),E.some(e=>{const t=aj(e,N);return t?.enabled})&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("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"}),e.jsx("td",{colSpan:E.length,className:"border-t border-emerald-200 bg-emerald-50"})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Included seats"}),e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:"Free with base price"})]}),E.map(t=>{const r=aj(t,N);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r?.enabled?r.includedSeats||0:"—"})},t._id)})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Max seats"})}),E.map(t=>{const r=aj(t,N);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r?.enabled?r.maxSeats>0?r.maxSeats:"Unlimited":"—"})},t._id)})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Per extra seat"})}),E.map(t=>{const r=sj(t,N,w),n=t.pricingVariants?.length?N:t.plan?.currency??N??"";return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r&&r>0?`${ey(r,n)}${Yk(w)}`:"—"})},t._id)})]}),null!=l&&l>0&&e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Your billable seats"}),e.jsxs("div",{className:"text-xs text-slate-500 mt-0.5",children:[l," member",1!==l?"s":""," in workspace"]})]}),E.map(t=>{const r=aj(t,N);if(!r?.enabled)return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm text-slate-400",children:"—"})},t._id);const n=r.includedSeats||0,a=Math.max(0,l-n);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:0===a?e.jsx("span",{className:"text-sm font-medium text-emerald-600",children:"All included"}):e.jsxs("span",{className:"text-sm font-medium text-amber-600",children:[a," extra seat",1!==a?"s":""]})},t._id)})]})]})]})]})})]})})]})})}});exports.BaseApi=Zt,exports.BetaForm=({onSuccess:r,onError:n,className:a="w-full",fieldClassName:s="flex flex-col gap-1.5 w-full",language:o,customTexts:i={},autoFocus:l=!0,showSuccessMessage:c=!0,hideLogo:d=!1,hideTitles:u=!1})=>{const[f,p]=t.useState("en"),[m,h]=t.useState(!1),[g,b]=t.useState(!1),{submitBetaForm:x,isLoading:y,isSubmitting:v,error:w,config:S,success:j,message:k}=(()=>{const e=Jt(),[r,n]=t.useState(null),[a,s]=t.useState(!0),[o,i]=t.useState(!1),[l,c]=t.useState(null),[d,u]=t.useState(!1),[f,p]=t.useState(null);return t.useEffect(()=>{let t=!1;return(async()=>{s(!0),c(null);try{const r=new su(e),a=await r.fetchConfig();t||n(a)}catch(e){t||c(e instanceof Error?e.message:"Failed to load beta form config")}finally{t||s(!1)}})(),()=>{t=!0}},[e]),{isLoading:a,isSubmitting:o,config:r,error:l,success:d,message:f,submitBetaForm:t.useCallback(async t=>{if(!e){const e="SaaS OS context is not initialized";return c(e),{success:!1,message:e}}try{i(!0),c(null),u(!1),p(null);const r=new su(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return u(a),p(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return c(t),u(!1),p(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();t.useEffect(()=>{p((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(jf).indexOf(e)?e:"en"})())},[]),t.useEffect(()=>{j&&c&&(h(!0),b(!0)),w&&b(!0)},[j,c,w]);const N={...jf[o||f],...i},E=Lo({resolver:Zc(Sf),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});t.useEffect(()=>{l&&E.setFocus("name")},[l,E]);const C=E.formState.isValid&&!v;return e.jsx("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:y?e.jsxs("div",{className:ke("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",a),children:[e.jsx(nu,{className:"h-24 w-24 rounded-lg"}),e.jsx(nu,{className:"h-6 w-32"}),e.jsxs("div",{className:"w-full space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(nu,{className:"h-4 w-16"}),e.jsx(nu,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(nu,{className:"h-4 w-16"}),e.jsx(nu,{className:"h-10 w-full"})]}),e.jsx(nu,{className:"h-10 w-full"})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!d&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[S?.logo&&e.jsx(Nf,{logo:S?.logo}),S?.name&&e.jsx("div",{children:S?.name})]}),e.jsx(no,{...E,children:e.jsxs("form",{onSubmit:E.handleSubmit(async e=>{try{const t=await x(e);t.success?(r?.(),E.reset(),c&&h(!0),b(!0)):(n?.(t.message),b(!0))}catch(e){n?.(e instanceof Error?e.message:N.errorMessage),b(!0)}}),className:a,noValidate:!0,"aria-busy":v,children:[!g&&e.jsxs(e.Fragment,{children:[!u&&S?.screen?.register&&e.jsx(kf,{screen:S?.screen?.register}),e.jsx(Zd,{control:E.control,name:"name",render:({field:t})=>e.jsxs(Yd,{className:s,children:[e.jsx(Xd,{children:N.nameLabel}),e.jsx(Qd,{children:e.jsx(ru,{...t})}),e.jsx(eu,{}),e.jsx(tu,{})]})}),e.jsx(Zd,{control:E.control,name:"email",render:({field:t})=>e.jsxs(Yd,{className:s,children:[e.jsx(Xd,{children:N.emailLabel}),e.jsx(Qd,{children:e.jsx(ru,{...t})}),e.jsx(eu,{}),e.jsx(tu,{})]})}),e.jsx(Ld,{type:"submit",disabled:!C,className:s,children:v?N.submittingText:N.submitText})]}),g&&w&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsxs("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[e.jsx("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),w]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(Ld,{type:"button",onClick:()=>{b(!1),E.reset()},className:s,children:"Try Again"})})]}),g&&m&&k&&e.jsx("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:S?.screen?.thankYou&&e.jsx(kf,{screen:S?.screen?.thankYou})})]})}),!g&&e.jsx("div",{children:e.jsxs("div",{children:["By submitting this form, you consent to our"," ",e.jsx("a",{href:S?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",e.jsx("a",{href:S?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})},exports.CURRENCY_DISPLAY=Zx,exports.CURRENCY_FLAG=qx,exports.PLAN_CURRENCY_CODES=Xx,exports.PLAN_CURRENCY_OPTIONS=Qx,exports.PricingPage=function({slug:t,children:r,loadingFallback:n,errorFallback:a}){const{items:s,plans:o,notes:i,loading:l,error:c,refetch:d}=cr(t);return l?void 0!==n?e.jsx(e.Fragment,{children:n}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(nu,{className:"h-8 w-48"}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(t=>e.jsx(nu,{className:"h-64 rounded-lg"},t))})]}):c?a?e.jsx(e.Fragment,{children:a(c)}):e.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:c}):e.jsx(e.Fragment,{children:r({loading:l,error:c,items:s,plans:o,notes:i,refetch:d})})},exports.QuotaUsageContextProvider=Cr,exports.SaaSOSProvider=ps,exports.SettingsApi=qt,exports.SubscriptionContextProvider=Sr,exports.UserApi=os,exports.WhenAuthenticated=Ef,exports.WhenNoSubscription=Uf,exports.WhenNotTrialing=zf,exports.WhenQuotaAvailable=$f,exports.WhenQuotaExhausted=Wf,exports.WhenQuotaOverage=Vf,exports.WhenQuotaThreshold=Bf,exports.WhenRoles=Af,exports.WhenSubscription=Df,exports.WhenSubscriptionToPlans=Ff,exports.WhenTrialEnding=Lf,exports.WhenTrialing=Mf,exports.WhenUnauthenticated=Cf,exports.WhenUserFeatureDisabled=If,exports.WhenUserFeatureEnabled=Of,exports.WhenWorkspaceFeatureDisabled=Pf,exports.WhenWorkspaceFeatureEnabled=Rf,exports.WhenWorkspaceRoles=_f,exports.WorkspaceApi=Xt,exports.WorkspaceSwitcher=function(r){const{isAuthenticated:n,user:a}=ts(),s=o(Jt()),{workspaces:i,currentWorkspace:l,loading:c,refreshing:d,switchingToId:u,fetchWorkspaces:f,getFeatures:p,refreshWorkspaces:m,setCurrentWorkspace:h,switchToWorkspace:g}=or(),{settings:b}=Yt(),[x,y]=t.useState(!1),[v,w]=t.useState(0),[S,j]=t.useState(""),k=c||d;t.useEffect(()=>{n&&s&&(0===i.length?(f(),p()):p())},[n,s]),t.useEffect(()=>{n&&s&&v>0&&m()},[v,n,s]);const N=i,E=N.filter(e=>e._id!==l?._id).filter(e=>e.name.toLowerCase().includes(S.toLowerCase())),C=b?.workspace.maxWorkspaces??Number.MAX_VALUE,A=N?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===a?.id?.toString()).length,_=C>(A??0);return e.jsxs(Yh,{open:x,onOpenChange:y,children:[e.jsx(Xh,{children:r.trigger?.(k,l)}),e.jsxs(tg,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e.jsxs(rg,{children:[e.jsxs(ng,{className:"flex items-center gap-2",children:[e.jsx(gd,{className:"h-5 w-5"}),"Switch Workspace"]}),e.jsx(ag,{children:"Select a workspace to switch to or create a new one."})]}),!a&&e.jsx("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),a&&e.jsxs("div",{className:"flex flex-col gap-4",children:[l&&e.jsx(Hk,{workspace:l,isCurrentWorkspace:!0,switchToWorkspace:g,switchingToId:u,onClose:()=>y(!1),setCurrentWorkspace:h,setOpen:y,workspacesToUse:N}),e.jsx(Zb,{}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",E.length,")"]}),e.jsx("div",{children:e.jsx(Ld,{progress:d,disabled:d,variant:"ghost",onClick:function(){n&&s&&w(e=>e+1)},startIcon:e.jsx(Ad,{}),children:d?"Refreshing...":"Refresh"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Td,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(ru,{placeholder:"Search workspaces...",value:S,onChange:e=>j(e.target.value),className:"pl-10"})]}),c?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(Ed,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===E.length?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(gd,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:S?"No workspaces found":"No workspaces available"})]}):e.jsx($b,{className:"h-64",children:e.jsx("div",{className:"flex flex-col gap-2 my-2.5",children:E.map(t=>{const r=t._id===l?._id;return e.jsx(Hk,{workspace:t,isCurrentWorkspace:r,switchToWorkspace:g,switchingToId:u,onClose:()=>y(!1),setCurrentWorkspace:h,setOpen:y,workspacesToUse:N},t._id)})})})]}),_&&e.jsxs(e.Fragment,{children:[e.jsx(Zb,{}),e.jsx(Zk,{onCreated:()=>{f()}})]})]})]})]})},exports.calculateBillableSeats=oj,exports.calculateSeatOverageCents=ij,exports.calculateTotalSubscriptionCents=function(e,t,r,n){const a=XS(e,t,r);return null===a?null:void 0===n?a:a+(ij(e,t,r,n)??0)},exports.eventEmitter=Pt,exports.formatCents=ey,exports.formatOverageRate=function(e,t,r){if(null==e||e<0)return null;const n=null!=t&&t>=1?t:1,a=Yx(r),s=(e/100).toFixed(2);return 1===n?`${a}${s}/unit`:`${a}${s}/${n.toLocaleString()} units`},exports.formatOverageRateWithLabel=function(e,t,r,n){if(null==e||e<0)return null;const a=null!=t&&t>=1?t:1,s=Yx(n),o=(e/100).toFixed(2);if(r){const e=r.endsWith("s")?r:`${r}s`;return a>=2?`${s}${o}/${a.toLocaleString()} ${e}`:`${s}${o}/${r}`}return 1===a?`${s}${o}/unit`:`${s}${o}/${a.toLocaleString()} units`},exports.formatQuotaIncludedOverage=function(e,t,r,n,a){const s=r.endsWith("s")?r:`${r}s`,o=null!=a&&a>=2?`${a.toLocaleString()} ${s}`:r;return null!=e&&null!=t?`Included: ${e.toLocaleString()}, after that ${ey(t,n)}/${o}`:null!=e?`Included: ${e.toLocaleString()}`:null!=t?`After included: ${ey(t,n)}/${o}`:"—"},exports.formatQuotaWithPrice=cj,exports.getAvailableCurrenciesFromPlans=tj,exports.getBasePriceCents=XS,exports.getBillingIntervalAndCurrencyFromPriceId=nj,exports.getCurrencyFlag=Jx,exports.getCurrencySymbol=Yx,exports.getDisplayCurrency=function(e,t){const r=YS(e,t);return r?r.currency:e.plan?.currency??""},exports.getPerSeatPriceCents=sj,exports.getPricingVariant=YS,exports.getQuotaDisplayValue=lj,exports.getQuotaDisplayWithVariant=rj,exports.getQuotaOverageCents=ej,exports.getQuotaUnitLabelFromName=function(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"},exports.getSeatPricing=aj,exports.getStripePriceIdForInterval=QS,exports.invalidateQuotaUsage=lr,exports.invalidateSubscription=Rt,exports.useAllQuotaUsage=vr,exports.useBillingPortal=br,exports.useCancelSubscription=xr,exports.useCreateCheckoutSession=pr,exports.useInvoice=(e,r)=>{const{api:n}=sr(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[l,c]=t.useState(null),d=t.useCallback(async()=>{if(e&&r){i(!0),c(null);try{const t=await n.getInvoice(e,r);s(t.invoice)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch invoice";c(n),De(t,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{invoice:a,loading:o,error:l,refetch:d}},exports.useInvoices=gr,exports.usePlanGroup=ur,exports.usePlanGroupVersions=fr,exports.usePublicPlanGroupVersion=e=>{const{api:r}=sr(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,l]=t.useState(null),c=t.useCallback(async()=>{if(e){o(!0),l(null);try{const t=await r.getPlanGroupVersion(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group version";l(r),De(t,{component:"usePublicPlanGroupVersion",action:"fetchVersion",metadata:{groupVersionId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{c()},[c]),{planGroupVersion:n,loading:s,error:i,refetch:c}},exports.usePublicPlans=cr,exports.useQuotaUsageContext=Ar,exports.useQuotaUsageStatus=(e,r)=>{const{api:n}=sr(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[l,c]=t.useState(null),d=t.useCallback(async()=>{if(e&&r){i(!0),c(null);try{const t=await n.getQuotaUsageStatus(e,r);s(t)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch quota usage status";c(n),De(t,{component:"useQuotaUsageStatus",action:"fetchStatus",metadata:{workspaceId:e,quotaSlug:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{status:a,loading:o,error:l,refetch:d}},exports.useRecordUsage=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{recordUsage:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const n=await r.recordUsage(e,t);return lr(),n}catch(r){const n=r instanceof Error?r.message:"Failed to record usage";throw o(n),De(r,{component:"useRecordUsage",action:"recordUsage",metadata:{workspaceId:e,request:t}}),r}finally{a(!1)}},[r,e]),loading:n,error:s}},exports.useResumeSubscription=yr,exports.useSaaSAuth=ts,exports.useSaaSOs=Jt,exports.useSaaSSettings=Yt,exports.useSaaSWorkspaces=or,exports.useSeatStatus=function(e){const{response:r}=jr();return t.useMemo(()=>{const t={hasSeatPricing:!1,memberCount:0,includedSeats:0,maxSeats:0,billableSeats:0,availableSeats:1/0,isAtMax:!1,isNearMax:!1,perSeatPriceCents:null,currency:""};if(!r?.subscription||!e)return t;const n=r.subscription;if(!n.seatPricingEnabled)return{...t,memberCount:e.users?.length??0};const a=r.planVersion,s=e.billingCurrency||"usd",o=a?aj(a,s):null;if(!o)return{...t,hasSeatPricing:!0,memberCount:e.users?.length??0};const i=e.users?.length??0,l=o.includedSeats??0,c=o.maxSeats??0,d=Math.max(0,i-l),u=c>0?Math.max(0,c-i):1/0,f=c>0&&i>=c,p=c>0&&i>=.8*c&&!f,m=n.billingInterval??"monthly";return{hasSeatPricing:!0,memberCount:i,includedSeats:l,maxSeats:c,billableSeats:d,availableSeats:u,isAtMax:f,isNearMax:p,perSeatPriceCents:a?sj(a,s,m):null,currency:s}},[r,e])},exports.useSubscription=dr,exports.useSubscriptionContext=jr,exports.useSubscriptionManagement=hr,exports.useTrialStatus=function(){const{response:e}=jr();return t.useMemo(()=>{const t=e?.subscription;if(!t||"trialing"!==t.subscriptionStatus)return{isTrialing:!1,daysRemaining:0,trialEndsAt:null,trialStartedAt:null,isTrialEnding:!1};const r=qk(t.trialEnd)??qk(t.stripeCurrentPeriodEnd),n=qk(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])},exports.useUpdateSubscription=mr,exports.useUsageLogs=(e,r,n)=>{const{api:a}=sr(),[s,o]=t.useState([]),[i,l]=t.useState(0),[c,d]=t.useState(0),[u,f]=t.useState(1),[p,m]=t.useState(!1),[h,g]=t.useState(!1),[b,x]=t.useState(!1),[y,v]=t.useState(null),w=n?.from,S=n?.to,j=n?.source,k=n?.page,N=n?.limit,E=t.useCallback(async()=>{if(!e)return o([]),l(0),d(0),f(1),m(!1),void g(!1);x(!0),v(null);try{const t={...r&&{quotaSlug:r},...w&&{from:w},...S&&{to:S},...j&&{source:j},...k&&{page:k},...N&&{limit:N}},n=await a.getUsageLogs(e,t);o(n.docs||[]),l(n.totalDocs||0),d(n.totalPages||0),f(n.page||1),m(n.hasNextPage||!1),g(n.hasPrevPage||!1)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch usage logs";v(n),De(t,{component:"useUsageLogs",action:"fetchLogs",metadata:{workspaceId:e,quotaSlug:r}})}finally{x(!1)}},[a,e,r,w,S,j,k,N]);return t.useEffect(()=>{E()},[E]),{logs:s,totalDocs:i,totalPages:c,page:u,hasNextPage:p,hasPrevPage:h,loading:b,error:y,refetch:E}},exports.useUserAttributes=function(){const e=t.useContext(is);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e},exports.useUserFeatures=Tf;
|
|
29
|
+
*/function dp(){return ip||(ip=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=t,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,s=r.useEffect,o=r.useLayoutEffect,i=r.useDebugValue,l=!1,c=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(t,d){l||void 0===r.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();n(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var p=(f=a({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return o(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[t,u,d]),s(function(){return e(p)&&m({inst:p}),t(function(){e(p)&&m({inst:p})})},[t]),i(u),u};cp.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),cp}function up(){return lp||(lp=1,"production"===process.env.NODE_ENV?ap.exports=op():ap.exports=dp()),ap.exports}var fp=up();function pp(){return()=>{}}var mp="Avatar",[hp]=function(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s);o.displayName=r+"Context";const i=n.length;n=[...n,s];const l=r=>{const{scope:n,children:s,...l}=r,c=n?.[t]?.[i]||o,d=a.useMemo(()=>l,Object.values(l));return e.jsx(c.Provider,{value:d,children:s})};return l.displayName=r+"Provider",[l,function(e,n){const l=n?.[t]?.[i]||o,c=a.useContext(l);if(c)return c;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},Qf(s,...r)]}(mp),[gp,bp]=hp(mp),xp=a.forwardRef((t,r)=>{const{__scopeAvatar:n,...s}=t,[o,i]=a.useState("idle");return e.jsx(gp,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:e.jsx(np.span,{...s,ref:r})})});xp.displayName=mp;var yp="AvatarImage",vp=a.forwardRef((t,r)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:o=()=>{},...i}=t,l=bp(yp,n),c=function(e,{referrerPolicy:t,crossOrigin:r}){const n=fp.useSyncExternalStore(pp,()=>!0,()=>!1),s=a.useRef(null),o=n?(s.current||(s.current=new window.Image),s.current):null,[i,l]=a.useState(()=>jp(o,e));return rp(()=>{l(jp(o,e))},[o,e]),rp(()=>{const e=e=>()=>{l(e)};if(!o)return;const n=e("loaded"),a=e("error");return o.addEventListener("load",n),o.addEventListener("error",a),t&&(o.referrerPolicy=t),"string"==typeof r&&(o.crossOrigin=r),()=>{o.removeEventListener("load",n),o.removeEventListener("error",a)}},[o,r,t]),i}(s,i),d=ep(e=>{o(e),l.onImageLoadingStatusChange(e)});return rp(()=>{"idle"!==c&&d(c)},[c,d]),"loaded"===c?e.jsx(np.img,{...i,ref:r,src:s}):null});vp.displayName=yp;var wp="AvatarFallback",Sp=a.forwardRef((t,r)=>{const{__scopeAvatar:n,delayMs:s,...o}=t,i=bp(wp,n),[l,c]=a.useState(void 0===s);return a.useEffect(()=>{if(void 0!==s){const e=window.setTimeout(()=>c(!0),s);return()=>window.clearTimeout(e)}},[s]),l&&"loaded"!==i.imageLoadingStatus?e.jsx(np.span,{...o,ref:r}):null});function jp(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}Sp.displayName=wp;var kp=xp,Np=vp,Ep=Sp;const Cp=a.forwardRef(({className:t,...r},n)=>e.jsx(kp,{ref:n,className:ke("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));Cp.displayName=kp.displayName;const Ap=a.forwardRef(({className:t,...r},n)=>e.jsx(Np,{ref:n,className:ke("aspect-square h-full w-full",t),...r}));Ap.displayName=Np.displayName;const _p=a.forwardRef(({className:t,...r},n)=>e.jsx(Ep,{ref:n,className:ke("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));function Tp(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function Rp(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s),i=n.length;n=[...n,s];const l=r=>{const{scope:n,children:s,...l}=r,c=n?.[t]?.[i]||o,d=a.useMemo(()=>l,Object.values(l));return e.jsx(c.Provider,{value:d,children:s})};return l.displayName=r+"Provider",[l,function(e,n){const l=n?.[t]?.[i]||o,c=a.useContext(l);if(c)return c;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},Pp(s,...r)]}function Pp(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}_p.displayName=Ep.displayName;var Op=a[" useId ".trim().toString()]||(()=>{}),Ip=0;function Dp(e){const[t,r]=a.useState(Op());return rp(()=>{r(e=>e??String(Ip++))},[e]),e||(t?`radix-${t}`:"")}var Up=a[" useInsertionEffect ".trim().toString()]||rp;function Mp({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,i]=function({defaultProp:e,onChange:t}){const[r,n]=a.useState(e),s=a.useRef(r),o=a.useRef(t);return Up(()=>{o.current=t},[t]),a.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}({defaultProp:t,onChange:r}),l=void 0!==e,c=l?e:s;{const t=a.useRef(void 0!==e);a.useEffect(()=>{const e=t.current;if(e!==l){const t=e?"controlled":"uncontrolled",r=l?"controlled":"uncontrolled";console.warn(`${n} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=l},[l,n])}const d=a.useCallback(t=>{if(l){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&i.current?.(r)}else o(t)},[l,e,o,i]);return[c,d]}function Fp(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?td(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var zp=Symbol("radix.slottable");function Lp(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===zp}var Wp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=function(t){const r=Fp(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(Lp);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{});var $p,Vp="dismissableLayer.update",Bp="dismissableLayer.pointerDownOutside",Gp="dismissableLayer.focusOutside",Kp=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hp=a.forwardRef((t,r)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:l,onDismiss:c,...d}=t,u=a.useContext(Kp),[f,p]=a.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=a.useState({}),g=rd(r,e=>p(e)),b=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=b.indexOf(x),v=f?b.indexOf(f):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,j=function(e,t=globalThis?.document){const r=ep(e),n=a.useRef(!1),s=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let n=function(){qp(Bp,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",s.current),s.current=n,t.addEventListener("click",s.current,{once:!0})):n()}else t.removeEventListener("click",s.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(o?.(e),l?.(e),e.defaultPrevented||c?.())},m),k=function(e,t=globalThis?.document){const r=ep(e),n=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){qp(Gp,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(i?.(e),l?.(e),e.defaultPrevented||c?.())},m);return function(e,t=globalThis?.document){const r=ep(e);a.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{v===u.layers.size-1&&(s?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},m),a.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&($p=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Zp(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=$p)}},[f,m,n,u]),a.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Zp())},[f,u]),a.useEffect(()=>{const e=()=>h({});return document.addEventListener(Vp,e),()=>document.removeEventListener(Vp,e)},[]),e.jsx(Wp.div,{...d,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Tp(t.onFocusCapture,k.onFocusCapture),onBlurCapture:Tp(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Tp(t.onPointerDownCapture,j.onPointerDownCapture)})});Hp.displayName="DismissableLayer";function Zp(){const e=new CustomEvent(Vp);document.dispatchEvent(e)}function qp(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&s.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}a.forwardRef((t,r)=>{const n=a.useContext(Kp),s=a.useRef(null),o=rd(r,s);return a.useEffect(()=>{const e=s.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),e.jsx(Wp.div,{...t,ref:o})}).displayName="DismissableLayerBranch";var Jp="focusScope.autoFocusOnMount",Yp="focusScope.autoFocusOnUnmount",Xp={bubbles:!1,cancelable:!0},Qp=a.forwardRef((t,r)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...l}=t,[c,d]=a.useState(null),u=ep(o),f=ep(i),p=a.useRef(null),m=rd(r,e=>d(e)),h=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(s){let e=function(e){if(h.paused||!c)return;const t=e.target;c.contains(t)?p.current=t:nm(p.current,{select:!0})},t=function(e){if(h.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||nm(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&nm(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()}}},[s,c,h.paused]),a.useEffect(()=>{if(c){am.add(h);const t=document.activeElement;if(!c.contains(t)){const r=new CustomEvent(Jp,Xp);c.addEventListener(Jp,u),c.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(nm(n,{select:t}),document.activeElement!==r)return}((e=em(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&nm(c))}return()=>{c.removeEventListener(Jp,u),setTimeout(()=>{const e=new CustomEvent(Yp,Xp);c.addEventListener(Yp,f),c.dispatchEvent(e),e.defaultPrevented||nm(t??document.body,{select:!0}),c.removeEventListener(Yp,f),am.remove(h)},0)}}var e},[c,u,f,h]);const g=a.useCallback(e=>{if(!n&&!s)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[a,s]=function(e){const t=em(e),r=tm(t,e),n=tm(t.reverse(),e);return[r,n]}(t);a&&s?e.shiftKey||r!==s?e.shiftKey&&r===a&&(e.preventDefault(),n&&nm(s,{select:!0})):(e.preventDefault(),n&&nm(a,{select:!0})):r===t&&e.preventDefault()}},[n,s,h.paused]);return e.jsx(Wp.div,{tabIndex:-1,...l,ref:m,onKeyDown:g})});function em(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 tm(e,t){for(const r of e)if(!rm(r,{upTo:t}))return r}function rm(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 nm(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()}}Qp.displayName="FocusScope";var am=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=sm(e,t),e.unshift(t)},remove(t){e=sm(e,t),e[0]?.resume()}}}();function sm(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var om=a.forwardRef((t,n)=>{const{container:s,...o}=t,[i,l]=a.useState(!1);rp(()=>l(!0),[]);const c=s||i&&globalThis?.document?.body;return c?r.createPortal(e.jsx(Wp.div,{...o,ref:n}),c):null});om.displayName="Portal";var im=e=>{const{present:t,children:r}=e,n=function(e){const[t,r]=a.useState(),n=a.useRef(null),s=a.useRef(e),o=a.useRef("none"),i=e?"mounted":"unmounted",[l,c]=function(e,t){return a.useReducer((e,r)=>t[e][r]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const e=lm(n.current);o.current="mounted"===l?e:"none"},[l]),rp(()=>{const t=n.current,r=s.current;if(r!==e){const n=o.current,a=lm(t);if(e)c("MOUNT");else if("none"===a||"none"===t?.display)c("UNMOUNT");else{c(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}s.current=e}},[e,c]),rp(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,a=a=>{const o=lm(n.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c("ANIMATION_END"),!s.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},i=e=>{e.target===t&&(o.current=lm(n.current))};return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",a),t.removeEventListener("animationend",a)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:a.useCallback(e=>{n.current=e?getComputedStyle(e):null,r(e)},[])}}(t),s="function"==typeof r?r({present:n.isPresent}):a.Children.only(r),o=rd(n.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(s));return"function"==typeof r||n.isPresent?a.cloneElement(s,{ref:o}):null};function lm(e){return e?.animationName||"none"}im.displayName="Presence";var cm=0;function dm(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??um()),document.body.insertAdjacentElement("beforeend",e[1]??um()),cm++,()=>{1===cm&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),cm--}},[])}function um(){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 fm=function(){return fm=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},fm.apply(this,arguments)};function pm(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 mm="right-scroll-bar-position",hm="width-before-scroll-bar";function gm(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var bm="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,xm=new WeakMap;function ym(e,r){var n,a,s,o=(n=null,a=function(t){return e.forEach(function(e){return gm(e,t)})},(s=t.useState(function(){return{value:n,callback:a,facade:{get current(){return s.value},set current(e){var t=s.value;t!==e&&(s.value=e,s.callback(e,t))}}}})[0]).callback=a,s.facade);return bm(function(){var t=xm.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||gm(e,null)}),n.forEach(function(e){r.has(e)||gm(e,a)})}xm.set(o,e)},[e]),o}function vm(e){return e}var wm=function(e){var t=e.sideCar,r=pm(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return a.createElement(n,fm({},r))};wm.isSideCarExport=!0;var Sm=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=vm);var r=[],n=!1;return{read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var s=function(){var r=t;t=[],r.forEach(e)},o=function(){return Promise.resolve().then(s)};o(),r={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=fm({async:!0,ssr:!1},e),t}(),jm=function(){},km=a.forwardRef(function(e,t){var r=a.useRef(null),n=a.useState({onScrollCapture:jm,onWheelCapture:jm,onTouchMoveCapture:jm}),s=n[0],o=n[1],i=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,x=e.as,y=void 0===x?"div":x,v=e.gapMode,w=pm(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,j=ym([r,t]),k=fm(fm({},w),s);return a.createElement(a.Fragment,null,u&&a.createElement(S,{sideCar:Sm,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:o,allowPinchZoom:!!b,lockRef:r,gapMode:v}),i?a.cloneElement(a.Children.only(l),fm(fm({},k),{ref:j})):a.createElement(y,fm({},k,{className:c,ref:j}),l))});km.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},km.classNames={fullWidth:hm,zeroRight:mm};function Nm(){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 Em=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=Nm())&&(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)}}},Cm=function(){var e,t=(e=Em(),function(t,r){a.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},Am={left:0,top:0,right:0,gap:0},_m=function(e){return parseInt(e||"",10)||0},Tm=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Am;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[_m(r),_m(n),_m(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])}},Rm=Cm(),Pm="data-scroll-locked",Om=function(e,t,r,n){var a=e.left,s=e.top,o=e.right,i=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(i,"px ").concat(n,";\n }\n body[").concat(Pm,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(s,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(mm," {\n right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(hm," {\n margin-right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(mm," .").concat(mm," {\n right: 0 ").concat(n,";\n }\n \n .").concat(hm," .").concat(hm," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(Pm,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},Im=function(){var e=parseInt(document.body.getAttribute(Pm)||"0",10);return isFinite(e)?e:0},Dm=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=void 0===n?"margin":n;a.useEffect(function(){return document.body.setAttribute(Pm,(Im()+1).toString()),function(){var e=Im()-1;e<=0?document.body.removeAttribute(Pm):document.body.setAttribute(Pm,e.toString())}},[]);var o=a.useMemo(function(){return Tm(s)},[s]);return a.createElement(Rm,{styles:Om(o,!t,s,r?"":"!important")})},Um=!1;if("undefined"!=typeof window)try{var Mm=Object.defineProperty({},"passive",{get:function(){return Um=!0,!0}});window.addEventListener("test",Mm,Mm),window.removeEventListener("test",Mm,Mm)}catch(e){Um=!1}var Fm=!!Um&&{passive:!1},zm=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])},Lm=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Wm(e,n)){var a=$m(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Wm=function(e,t){return"v"===e?function(e){return zm(e,"overflowY")}(t):function(e){return zm(e,"overflowX")}(t)},$m=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)},Vm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Bm=function(e){return[e.deltaX,e.deltaY]},Gm=function(e){return e&&"current"in e?e.current:e},Km=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Hm=0,Zm=[];function qm(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Jm,Ym=(Jm=function(e){var t=a.useRef([]),r=a.useRef([0,0]),n=a.useRef(),s=a.useState(Hm++)[0],o=a.useState(Cm)[0],i=a.useRef(e);a.useEffect(function(){i.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,s=t.length;a<s;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Gm),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=a.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,s=Vm(e),o=r.current,l="deltaX"in e?e.deltaX:o[0]-s[0],c="deltaY"in e?e.deltaY:o[1]-s[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=Lm(u,d);if(!m)return!0;if(m?a=u:(a="v"===u?"h":"v",m=Lm(u,d)),!m)return!1;if(!n.current&&"changedTouches"in e&&(l||c)&&(n.current=a),!a)return!0;var h=n.current||a;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),s=a*n,o=r.target,i=t.contains(o),l=!1,c=s>0,d=0,u=0;do{if(!o)break;var f=$m(e,o),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Wm(e,o)&&(d+=m,u+=p);var h=o.parentNode;o=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!i&&o!==document.body||i&&(t.contains(o)||t===o));return(c&&Math.abs(d)<1||!c&&Math.abs(u)<1)&&(l=!0),l}(h,t,e,"h"===h?l:c)},[]),c=a.useCallback(function(e){var r=e;if(Zm.length&&Zm[Zm.length-1]===o){var n="deltaY"in r?Bm(r):Vm(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,a=n,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)r.cancelable&&r.preventDefault();else if(!a){var s=(i.current.shards||[]).map(Gm).filter(Boolean).filter(function(e){return e.contains(r.target)});(s.length>0?l(r,s[0]):!i.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=a.useCallback(function(e,r,n,a){var s={name:e,delta:r,target:n,should:a,shadowParent:qm(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),u=a.useCallback(function(e){r.current=Vm(e),n.current=void 0},[]),f=a.useCallback(function(t){d(t.type,Bm(t),t.target,l(t,e.lockRef.current))},[]),p=a.useCallback(function(t){d(t.type,Vm(t),t.target,l(t,e.lockRef.current))},[]);a.useEffect(function(){return Zm.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Fm),document.addEventListener("touchmove",c,Fm),document.addEventListener("touchstart",u,Fm),function(){Zm=Zm.filter(function(e){return e!==o}),document.removeEventListener("wheel",c,Fm),document.removeEventListener("touchmove",c,Fm),document.removeEventListener("touchstart",u,Fm)}},[]);var m=e.removeScrollBar,h=e.inert;return a.createElement(a.Fragment,null,h?a.createElement(o,{styles:Km(s)}):null,m?a.createElement(Dm,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Sm.useMedium(Jm),wm),Xm=a.forwardRef(function(e,t){return a.createElement(km,fm({},e,{ref:t,sideCar:Ym}))});Xm.classNames=km.classNames;var Qm=new WeakMap,eh=new WeakMap,th={},rh=0,nh=function(e){return e&&(e.host||nh(e.parentNode))},ah=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=nh(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]);th[r]||(th[r]=new WeakMap);var s=th[r],o=[],i=new Set,l=new Set(a),c=function(e){e&&!i.has(e)&&(i.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(i.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,l=(Qm.get(e)||0)+1,c=(s.get(e)||0)+1;Qm.set(e,l),s.set(e,c),o.push(e),1===l&&a&&eh.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),i.clear(),rh++,function(){o.forEach(function(e){var t=Qm.get(e)-1,a=s.get(e)-1;Qm.set(e,t),s.set(e,a),t||(eh.has(e)||e.removeAttribute(n),eh.delete(e)),a||e.removeAttribute(r)}),--rh||(Qm=new WeakMap,Qm=new WeakMap,eh=new WeakMap,th={})}},sh=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"))),ah(n,a,r,"aria-hidden")):function(){return null}};function oh(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?td(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ih=Symbol("radix.slottable");function lh(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ih}var ch="Dialog",[dh,uh]=Rp(ch),[fh,ph]=dh(ch),mh=t=>{const{__scopeDialog:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:l=!0}=t,c=a.useRef(null),d=a.useRef(null),[u,f]=Mp({prop:s,defaultProp:o??!1,onChange:i,caller:ch});return e.jsx(fh,{scope:r,triggerRef:c,contentRef:d,contentId:Dp(),titleId:Dp(),descriptionId:Dp(),open:u,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:l,children:n})};mh.displayName=ch;var hh="DialogTrigger",gh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ph(hh,n),o=rd(r,s.triggerRef);return e.jsx(Wp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Uh(s.open),...a,ref:o,onClick:Tp(t.onClick,s.onOpenToggle)})});gh.displayName=hh;var bh="DialogPortal",[xh,yh]=dh(bh,{forceMount:void 0}),vh=t=>{const{__scopeDialog:r,forceMount:n,children:s,container:o}=t,i=ph(bh,r);return e.jsx(xh,{scope:r,forceMount:n,children:a.Children.map(s,t=>e.jsx(im,{present:n||i.open,children:e.jsx(om,{asChild:!0,container:o,children:t})}))})};vh.displayName=bh;var wh="DialogOverlay",Sh=a.forwardRef((t,r)=>{const n=yh(wh,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=ph(wh,t.__scopeDialog);return o.modal?e.jsx(im,{present:a||o.open,children:e.jsx(kh,{...s,ref:r})}):null});Sh.displayName=wh;var jh=function(t){const r=oh(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(lh);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("DialogOverlay.RemoveScroll"),kh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ph(wh,n);return e.jsx(Xm,{as:jh,allowPinchZoom:!0,shards:[s.contentRef],children:e.jsx(Wp.div,{"data-state":Uh(s.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),Nh="DialogContent",Eh=a.forwardRef((t,r)=>{const n=yh(Nh,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=ph(Nh,t.__scopeDialog);return e.jsx(im,{present:a||o.open,children:o.modal?e.jsx(Ch,{...s,ref:r}):e.jsx(Ah,{...s,ref:r})})});Eh.displayName=Nh;var Ch=a.forwardRef((t,r)=>{const n=ph(Nh,t.__scopeDialog),s=a.useRef(null),o=rd(r,n.contentRef,s);return a.useEffect(()=>{const e=s.current;if(e)return sh(e)},[]),e.jsx(_h,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tp(t.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Tp(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Tp(t.onFocusOutside,e=>e.preventDefault())})}),Ah=a.forwardRef((t,r)=>{const n=ph(Nh,t.__scopeDialog),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(_h,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),_h=a.forwardRef((t,r)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...l}=t,c=ph(Nh,n),d=a.useRef(null),u=rd(r,d);return dm(),e.jsxs(e.Fragment,{children:[e.jsx(Qp,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:e.jsx(Hp,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Uh(c.open),...l,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(Lh,{titleId:c.titleId}),e.jsx(Wh,{contentRef:d,descriptionId:c.descriptionId})]})]})}),Th="DialogTitle",Rh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ph(Th,n);return e.jsx(Wp.h2,{id:s.titleId,...a,ref:r})});Rh.displayName=Th;var Ph="DialogDescription",Oh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ph(Ph,n);return e.jsx(Wp.p,{id:s.descriptionId,...a,ref:r})});Oh.displayName=Ph;var Ih="DialogClose",Dh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ph(Ih,n);return e.jsx(Wp.button,{type:"button",...a,ref:r,onClick:Tp(t.onClick,()=>s.onOpenChange(!1))})});function Uh(e){return e?"open":"closed"}Dh.displayName=Ih;var Mh="DialogTitleWarning",[Fh,zh]=function(t,r){const n=a.createContext(r),s=t=>{const{children:r,...s}=t,o=a.useMemo(()=>s,Object.values(s));return e.jsx(n.Provider,{value:o,children:r})};return s.displayName=t+"Provider",[s,function(e){const s=a.useContext(n);if(s)return s;if(void 0!==r)return r;throw new Error(`\`${e}\` must be used within \`${t}\``)}]}(Mh,{contentName:Nh,titleName:Th,docsSlug:"dialog"}),Lh=({titleId:e})=>{const t=zh(Mh),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return a.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Wh=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zh("DialogDescriptionWarning").contentName}}.`;return a.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},$h=mh,Vh=gh,Bh=vh,Gh=Sh,Kh=Eh,Hh=Rh,Zh=Oh,qh=Dh;function Jh(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var Yh=["color"],Xh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Jh(e,Yh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Qh=["color"],eg=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Jh(e,Qh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),tg=["color"],rg=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Jh(e,tg);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),ng=["color"],ag=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Jh(e,ng);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))});const sg=$h,og=Vh,ig=Bh,lg=a.forwardRef(({className:t,...r},n)=>e.jsx(Gh,{ref:n,className:ke("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));lg.displayName=Gh.displayName;const cg=a.forwardRef(({className:t,children:r,...n},s)=>{const{container:o}=a.useContext(cs);return e.jsxs(ig,{container:o,children:[e.jsx(lg,{}),e.jsxs(Kh,{ref:s,className:ke("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...n,children:[r,e.jsxs(qh,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(rg,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});cg.displayName=Kh.displayName;const dg=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});dg.displayName="DialogHeader";const ug=a.forwardRef(({className:t,...r},n)=>e.jsx(Hh,{ref:n,className:ke("text-lg font-semibold leading-none tracking-tight",t),...r}));ug.displayName=Hh.displayName;const fg=a.forwardRef(({className:t,...r},n)=>e.jsx(Zh,{ref:n,className:ke("text-sm text-muted-foreground",t),...r}));function pg(t){const r=mg(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(gg);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}function mg(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?td(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}fg.displayName=Zh.displayName;var hg=Symbol("radix.slottable");function gg(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===hg}function bg(r){const n=r+"CollectionProvider",[a,s]=Rp(n),[o,i]=a(n,{collectionRef:{current:null},itemMap:new Map}),l=r=>{const{scope:n,children:a}=r,s=t.useRef(null),i=t.useRef(new Map).current;return e.jsx(o,{scope:n,itemMap:i,collectionRef:s,children:a})};l.displayName=n;const c=r+"CollectionSlot",d=pg(c),u=t.forwardRef((t,r)=>{const{scope:n,children:a}=t,s=rd(r,i(c,n).collectionRef);return e.jsx(d,{ref:s,children:a})});u.displayName=c;const f=r+"CollectionItemSlot",p="data-radix-collection-item",m=pg(f),h=t.forwardRef((r,n)=>{const{scope:a,children:s,...o}=r,l=t.useRef(null),c=rd(n,l),d=i(f,a);return t.useEffect(()=>(d.itemMap.set(l,{ref:l,...o}),()=>{d.itemMap.delete(l)})),e.jsx(m,{[p]:"",ref:c,children:s})});return h.displayName=f,[{Provider:l,Slot:u,ItemSlot:h},function(e){const n=i(r+"CollectionConsumer",e),a=t.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),r=Array.from(n.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return r},[n.collectionRef,n.itemMap]);return a},s]}var xg=a.createContext(void 0);function yg(e){const t=a.useContext(xg);return e||t||"ltr"}var vg="rovingFocusGroup.onEntryFocus",wg={bubbles:!1,cancelable:!0},Sg="RovingFocusGroup",[jg,kg,Ng]=bg(Sg),[Eg,Cg]=Rp(Sg,[Ng]),[Ag,_g]=Eg(Sg),Tg=a.forwardRef((t,r)=>e.jsx(jg.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(jg.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Rg,{...t,ref:r})})}));Tg.displayName=Sg;var Rg=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=t,m=a.useRef(null),h=rd(r,m),g=yg(i),[b,x]=Mp({prop:l,defaultProp:c??null,onChange:d,caller:Sg}),[y,v]=a.useState(!1),w=ep(u),S=kg(n),j=a.useRef(!1),[k,N]=a.useState(0);return a.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(vg,w),()=>e.removeEventListener(vg,w)},[w]),e.jsx(Ag,{scope:n,orientation:s,dir:g,loop:o,currentTabStopId:b,onItemFocus:a.useCallback(e=>x(e),[x]),onItemShiftTab:a.useCallback(()=>v(!0),[]),onFocusableItemAdd:a.useCallback(()=>N(e=>e+1),[]),onFocusableItemRemove:a.useCallback(()=>N(e=>e-1),[]),children:e.jsx(Wp.div,{tabIndex:y||0===k?-1:0,"data-orientation":s,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:Tp(t.onMouseDown,()=>{j.current=!0}),onFocus:Tp(t.onFocus,e=>{const t=!j.current;if(e.target===e.currentTarget&&t&&!y){const t=new CustomEvent(vg,wg);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Dg([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),f)}}j.current=!1}),onBlur:Tp(t.onBlur,()=>v(!1))})})}),Pg="RovingFocusGroupItem",Og=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:l,...c}=t,d=Dp(),u=i||d,f=_g(Pg,n),p=f.currentTabStopId===u,m=kg(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:b}=f;return a.useEffect(()=>{if(s)return h(),()=>g()},[s,h,g]),e.jsx(jg.ItemSlot,{scope:n,id:u,focusable:s,active:o,children:e.jsx(Wp.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...c,ref:r,onMouseDown:Tp(t.onMouseDown,e=>{s?f.onItemFocus(u):e.preventDefault()}),onFocus:Tp(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:Tp(t.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Ig[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(()=>Dg(r))}}),children:"function"==typeof l?l({isCurrentTabStop:p,hasTabStop:null!=b}):l})})});Og.displayName=Pg;var Ig={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dg(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 Ug=Tg,Mg=Og;function Fg(e){const[t,r]=a.useState(void 0);return rp(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let a,s;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,s=t.blockSize}else a=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function zg(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Lg="Radio",[Wg,$g]=Rp(Lg),[Vg,Bg]=Wg(Lg),Gg=a.forwardRef((t,r)=>{const{__scopeRadio:n,name:s,checked:o=!1,required:i,disabled:l,value:c="on",onCheck:d,form:u,...f}=t,[p,m]=a.useState(null),h=rd(r,e=>m(e)),g=a.useRef(!1),b=!p||(u||!!p.closest("form"));return e.jsxs(Vg,{scope:n,checked:o,disabled:l,children:[e.jsx(Wp.button,{type:"button",role:"radio","aria-checked":o,"data-state":qg(o),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:h,onClick:Tp(t.onClick,e=>{o||d?.(),b&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),b&&e.jsx(Zg,{control:p,bubbles:!g.current,name:s,value:c,checked:o,required:i,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});Gg.displayName=Lg;var Kg="RadioIndicator",Hg=a.forwardRef((t,r)=>{const{__scopeRadio:n,forceMount:a,...s}=t,o=Bg(Kg,n);return e.jsx(im,{present:a||o.checked,children:e.jsx(Wp.span,{"data-state":qg(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})})});Hg.displayName=Kg;var Zg=a.forwardRef(({__scopeRadio:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const l=a.useRef(null),c=rd(l,i),d=zg(n),u=Fg(r);return a.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx(Wp.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:c,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function qg(e){return e?"checked":"unchecked"}Zg.displayName="RadioBubbleInput";var Jg=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Yg="RadioGroup",[Xg]=Rp(Yg,[Cg,$g]),Qg=Cg(),eb=$g(),[tb,rb]=Xg(Yg),nb=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:s,value:o,required:i=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:f,...p}=t,m=Qg(n),h=yg(d),[g,b]=Mp({prop:o,defaultProp:s??null,onChange:f,caller:Yg});return e.jsx(tb,{scope:n,name:a,required:i,disabled:l,value:g,onValueChange:b,children:e.jsx(Ug,{asChild:!0,...m,orientation:c,dir:h,loop:u,children:e.jsx(Wp.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":l?"":void 0,dir:h,...p,ref:r})})})});nb.displayName=Yg;var ab="RadioGroupItem",sb=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,disabled:s,...o}=t,i=rb(ab,n),l=i.disabled||s,c=Qg(n),d=eb(n),u=a.useRef(null),f=rd(r,u),p=i.value===o.value,m=a.useRef(!1);return a.useEffect(()=>{const e=e=>{Jg.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),e.jsx(Mg,{asChild:!0,...c,focusable:!l,active:p,children:e.jsx(Gg,{disabled:l,required:i.required,checked:p,...d,...o,name:i.name,ref:f,onCheck:()=>i.onValueChange(o.value),onKeyDown:Tp(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:Tp(o.onFocus,()=>{m.current&&u.current?.click()})})})});sb.displayName=ab;var ob=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,...a}=t,s=eb(n);return e.jsx(Hg,{...s,...a,ref:r})});ob.displayName="RadioGroupIndicator";var ib=nb,lb=sb,cb=ob;const db=a.forwardRef(({className:t,...r},n)=>e.jsx(ib,{className:ke("grid gap-2",t),...r,ref:n}));db.displayName=ib.displayName;const ub=a.forwardRef(({className:t,...r},n)=>e.jsx(lb,{ref:n,className:ke("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:e.jsx(cb,{className:"flex items-center justify-center",children:e.jsx(eg,{className:"h-3.5 w-3.5 fill-primary"})})}));function fb(e,[t,r]){return Math.min(r,Math.max(t,e))}ub.displayName=lb.displayName;var pb="ScrollArea",[mb]=Rp(pb),[hb,gb]=mb(pb),bb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,type:s="hover",dir:o,scrollHideDelay:i=600,...l}=t,[c,d]=a.useState(null),[u,f]=a.useState(null),[p,m]=a.useState(null),[h,g]=a.useState(null),[b,x]=a.useState(null),[y,v]=a.useState(0),[w,S]=a.useState(0),[j,k]=a.useState(!1),[N,E]=a.useState(!1),C=rd(r,e=>d(e)),A=yg(o);return e.jsx(hb,{scope:n,type:s,dir:A,scrollHideDelay:i,scrollArea:c,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:k,scrollbarY:b,onScrollbarYChange:x,scrollbarYEnabled:N,onScrollbarYEnabledChange:E,onCornerWidthChange:v,onCornerHeightChange:S,children:e.jsx(Wp.div,{dir:A,...l,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});bb.displayName=pb;var xb="ScrollAreaViewport",yb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,children:s,nonce:o,...i}=t,l=gb(xb,n),c=rd(r,a.useRef(null),l.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),e.jsx(Wp.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});yb.displayName=xb;var vb="ScrollAreaScrollbar",wb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=gb(vb,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=o,c="horizontal"===t.orientation;return a.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),"hover"===o.type?e.jsx(Sb,{...s,ref:r,forceMount:n}):"scroll"===o.type?e.jsx(jb,{...s,ref:r,forceMount:n}):"auto"===o.type?e.jsx(kb,{...s,ref:r,forceMount:n}):"always"===o.type?e.jsx(Nb,{...s,ref:r}):null});wb.displayName=vb;var Sb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=gb(vb,t.__scopeScrollArea),[i,l]=a.useState(!1);return a.useEffect(()=>{const e=o.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),l(!0)},n=()=>{t=window.setTimeout(()=>l(!1),o.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[o.scrollArea,o.scrollHideDelay]),e.jsx(im,{present:n||i,children:e.jsx(kb,{"data-state":i?"visible":"hidden",...s,ref:r})})}),jb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=gb(vb,t.__scopeScrollArea),i="horizontal"===t.orientation,l=Bb(()=>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"}},a.useReducer((e,t)=>f[e][t]??e,u));var u,f;return a.useEffect(()=>{if("idle"===c){const e=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(e)}},[c,o.scrollHideDelay,d]),a.useEffect(()=>{const e=o.viewport,t=i?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),l()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[o.viewport,i,d,l]),e.jsx(im,{present:n||"hidden"!==c,children:e.jsx(Nb,{"data-state":"hidden"===c?"hidden":"visible",...s,ref:r,onPointerEnter:Tp(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Tp(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),kb=a.forwardRef((t,r)=>{const n=gb(vb,t.__scopeScrollArea),{forceMount:s,...o}=t,[i,l]=a.useState(!1),c="horizontal"===t.orientation,d=Bb(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;l(c?e:t)}},10);return Gb(n.viewport,d),Gb(n.content,d),e.jsx(im,{present:s||i,children:e.jsx(Nb,{"data-state":i?"visible":"hidden",...o,ref:r})})}),Nb=a.forwardRef((t,r)=>{const{orientation:n="vertical",...s}=t,o=gb(vb,t.__scopeScrollArea),i=a.useRef(null),l=a.useRef(0),[c,d]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Fb(c.viewport,c.content),f={...s,sizes:c,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:e=>l.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=zb(r),s=a/2,o=t||s,i=a-o,l=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-i,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Wb([l,c],u)(e)}(e,l.current,c,t)}return"horizontal"===n?e.jsx(Eb,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Lb(o.viewport.scrollLeft,c,o.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=p(e,o.dir))}}):"vertical"===n?e.jsx(Cb,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Lb(o.viewport.scrollTop,c);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=p(e))}}):null}),Eb=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=gb(vb,t.__scopeScrollArea),[l,c]=a.useState(),d=a.useRef(null),u=rd(r,d,i.onScrollbarXChange);return a.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),e.jsx(Tb,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":zb(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollLeft+e.deltaX;t.onWheelScroll(n),$b(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&s({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Mb(l.paddingLeft),paddingEnd:Mb(l.paddingRight)}})}})}),Cb=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=gb(vb,t.__scopeScrollArea),[l,c]=a.useState(),d=a.useRef(null),u=rd(r,d,i.onScrollbarYChange);return a.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),e.jsx(Tb,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":zb(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollTop+e.deltaY;t.onWheelScroll(n),$b(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&s({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Mb(l.paddingTop),paddingEnd:Mb(l.paddingBottom)}})}})}),[Ab,_b]=mb(vb),Tb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:o,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=t,h=gb(vb,n),[g,b]=a.useState(null),x=rd(r,e=>b(e)),y=a.useRef(null),v=a.useRef(""),w=h.viewport,S=s.content-s.viewport,j=ep(f),k=ep(d),N=Bb(p,10);function E(e){if(y.current){const t=e.clientX-y.current.left,r=e.clientY-y.current.top;u({x:t,y:r})}}return a.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&j(e,S)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,g,S,j]),a.useEffect(k,[s,k]),Gb(g,N),Gb(h.content,N),e.jsx(Ab,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:ep(i),onThumbPointerUp:ep(l),onThumbPositionChange:k,onThumbPointerDown:ep(c),children:e.jsx(Wp.div,{...m,ref:x,style:{position:"absolute",...m.style},onPointerDown:Tp(t.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),y.current=g.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),E(e)}}),onPointerMove:Tp(t.onPointerMove,E),onPointerUp:Tp(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),Rb="ScrollAreaThumb",Pb=a.forwardRef((t,r)=>{const{forceMount:n,...a}=t,s=_b(Rb,t.__scopeScrollArea);return e.jsx(im,{present:n||s.hasThumb,children:e.jsx(Ob,{ref:r,...a})})}),Ob=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,style:s,...o}=t,i=gb(Rb,n),l=_b(Rb,n),{onThumbPositionChange:c}=l,d=rd(r,e=>l.onThumbChange(e)),u=a.useRef(void 0),f=Bb(()=>{u.current&&(u.current(),u.current=void 0)},100);return a.useEffect(()=>{const e=i.viewport;if(e){const t=()=>{if(f(),!u.current){const t=Vb(e,c);u.current=t,c()}};return c(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,c]),e.jsx(Wp.div,{"data-state":l.hasThumb?"visible":"hidden",...o,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Tp(t.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;l.onThumbPointerDown({x:r,y:n})}),onPointerUp:Tp(t.onPointerUp,l.onThumbPointerUp)})});Pb.displayName=Rb;var Ib="ScrollAreaCorner",Db=a.forwardRef((t,r)=>{const n=gb(Ib,t.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?e.jsx(Ub,{...t,ref:r}):null});Db.displayName=Ib;var Ub=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,...s}=t,o=gb(Ib,n),[i,l]=a.useState(0),[c,d]=a.useState(0),u=Boolean(i&&c);return Gb(o.scrollbarX,()=>{const e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),d(e)}),Gb(o.scrollbarY,()=>{const e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),l(e)}),u?e.jsx(Wp.div,{...s,ref:r,style:{width:i,height:c,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...t.style}}):null});function Mb(e){return e?parseInt(e,10):0}function Fb(e,t){const r=e/t;return isNaN(r)?0:r}function zb(e){const t=Fb(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Lb(e,t,r="ltr"){const n=zb(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,o=t.content-t.viewport,i=s-n,l=fb(e,"ltr"===r?[0,o]:[-1*o,0]);return Wb([0,o],[0,i])(l)}function Wb(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 $b(e,t){return e>0&&e<t}var Vb=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,i=r.top!==s.top;(o||i)&&t(),r=s,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Bb(e,t){const r=ep(e),n=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),a.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Gb(e,t){const r=ep(t);rp(()=>{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 Kb=bb,Hb=yb,Zb=Db;const qb=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Kb,{ref:a,className:ke("relative overflow-hidden",t),...n,children:[e.jsx(Hb,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx(Jb,{}),e.jsx(Zb,{})]}));qb.displayName=Kb.displayName;const Jb=a.forwardRef(({className:t,orientation:r="vertical",...n},a)=>e.jsx(wb,{ref:a,orientation:r,className:ke("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",t),...n,children:e.jsx(Pb,{className:ke("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));Jb.displayName=wb.displayName;var Yb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=od(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),Xb="horizontal",Qb=["horizontal","vertical"],ex=a.forwardRef((t,r)=>{const{decorative:n,orientation:a=Xb,...s}=t,o=function(e){return Qb.includes(e)}(a)?a:Xb,i=n?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"};return e.jsx(Yb.div,{"data-orientation":o,...i,...s,ref:r})});ex.displayName="Separator";var tx=ex;const rx=a.forwardRef(({className:t,orientation:r="horizontal",decorative:n=!0,...a},s)=>e.jsx(tx,{ref:s,decorative:n,orientation:r,className:ke("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",t),...a}));rx.displayName=tx.displayName;var nx=Symbol("radix.slottable");var ax="AlertDialog",[sx]=Rp(ax,[uh]),ox=uh(),ix=t=>{const{__scopeAlertDialog:r,...n}=t,a=ox(r);return e.jsx($h,{...a,...n,modal:!0})};ix.displayName=ax;var lx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=ox(n);return e.jsx(Vh,{...s,...a,ref:r})});lx.displayName="AlertDialogTrigger";var cx=t=>{const{__scopeAlertDialog:r,...n}=t,a=ox(r);return e.jsx(Bh,{...a,...n})};cx.displayName="AlertDialogPortal";var dx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=ox(n);return e.jsx(Gh,{...s,...a,ref:r})});dx.displayName="AlertDialogOverlay";var ux="AlertDialogContent",[fx,px]=sx(ux),mx=function(t){const r=({children:t})=>e.jsx(e.Fragment,{children:t});return r.displayName=`${t}.Slottable`,r.__radixId=nx,r}("AlertDialogContent"),hx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,children:s,...o}=t,i=ox(n),l=a.useRef(null),c=rd(r,l),d=a.useRef(null);return e.jsx(Fh,{contentName:ux,titleName:gx,docsSlug:"alert-dialog",children:e.jsx(fx,{scope:n,cancelRef:d,children:e.jsxs(Kh,{role:"alertdialog",...i,...o,ref:c,onOpenAutoFocus:Tp(o.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e.jsx(mx,{children:s}),e.jsx(jx,{contentRef:l})]})})})});hx.displayName=ux;var gx="AlertDialogTitle",bx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=ox(n);return e.jsx(Hh,{...s,...a,ref:r})});bx.displayName=gx;var xx="AlertDialogDescription",yx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=ox(n);return e.jsx(Zh,{...s,...a,ref:r})});yx.displayName=xx;var vx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=ox(n);return e.jsx(qh,{...s,...a,ref:r})});vx.displayName="AlertDialogAction";var wx="AlertDialogCancel",Sx=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,{cancelRef:s}=px(wx,n),o=ox(n),i=rd(r,s);return e.jsx(qh,{...o,...a,ref:i})});Sx.displayName=wx;var jx=({contentRef:e})=>{const t=`\`${ux}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${ux}\` by passing a \`${xx}\` 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 \`${ux}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return a.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},kx=dx,Nx=hx,Ex=vx,Cx=Sx,Ax=bx,_x=yx;const Tx=ix,Rx=lx,Px=cx,Ox=a.forwardRef(({className:t,...r},n)=>e.jsx(kx,{className:ke("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:n}));Ox.displayName=kx.displayName;const Ix=a.forwardRef(({className:t,...r},n)=>{const{container:s}=a.useContext(cs);return e.jsxs(Px,{container:s,children:[e.jsx(Ox,{}),e.jsx(Nx,{ref:n,className:ke("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...r})]})});Ix.displayName=Nx.displayName;const Dx=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col space-y-2 text-center sm:text-left",t),...r});Dx.displayName="AlertDialogHeader";const Ux=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Ux.displayName="AlertDialogFooter";const Mx=a.forwardRef(({className:t,...r},n)=>e.jsx(Ax,{ref:n,className:ke("text-lg font-semibold",t),...r}));Mx.displayName=Ax.displayName;const Fx=a.forwardRef(({className:t,...r},n)=>e.jsx(_x,{ref:n,className:ke("text-sm text-muted-foreground",t),...r}));Fx.displayName=_x.displayName;const zx=a.forwardRef(({className:t,...r},n)=>e.jsx(Ex,{ref:n,className:ke(Hd(),t),...r}));zx.displayName=Ex.displayName;const Lx=a.forwardRef(({className:t,...r},n)=>e.jsx(Cx,{ref:n,className:ke(Hd({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));function Wx(){return e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(uu,{className:"h-10 w-full"}),e.jsx(uu,{className:"h-10 w-full"}),e.jsx(uu,{className:"h-10 w-full"})]})}Lx.displayName=Cx.displayName;const $x=({workspace:r})=>{const[n,a]=t.useState(!1),{deleteWorkspace:s}=or(),{user:o}=es();if(!r)return e.jsx(Wx,{});const i=ar(r,o?.id??null);return"admin"===i?.toLowerCase()?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",e.jsx("strong",{children:r.name})," and all of its data, including members, settings, and features."]})]}),e.jsxs(Tx,{children:[e.jsx(Rx,{asChild:!0,children:e.jsxs(Zd,{variant:"destructive",disabled:n,progress:n,children:[e.jsx($d,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e.jsxs(Ix,{children:[e.jsxs(Dx,{children:[e.jsx(Mx,{children:"Are you absolutely sure?"}),e.jsxs(Fx,{children:["This action cannot be undone. This will permanently delete the workspace"," ",e.jsx("strong",{children:r.name})," and all of its data."]})]}),e.jsxs(Ux,{children:[e.jsx(Lx,{disabled:n,children:"Cancel"}),e.jsx(zx,{onClick:async()=>{a(!0);try{await s(r._id)}catch(e){De(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:r._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{a(!1)}},disabled:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(Od,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var Vx="Switch",[Bx]=Rp(Vx),[Gx,Kx]=Bx(Vx),Hx=a.forwardRef((t,r)=>{const{__scopeSwitch:n,name:s,checked:o,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:u,form:f,...p}=t,[m,h]=a.useState(null),g=rd(r,e=>h(e)),b=a.useRef(!1),x=!m||(f||!!m.closest("form")),[y,v]=Mp({prop:o,defaultProp:i??!1,onChange:u,caller:Vx});return e.jsxs(Gx,{scope:n,checked:y,disabled:c,children:[e.jsx(Wp.button,{type:"button",role:"switch","aria-checked":y,"aria-required":l,"data-state":Yx(y),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:g,onClick:Tp(t.onClick,e=>{v(e=>!e),x&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),x&&e.jsx(Jx,{control:m,bubbles:!b.current,name:s,value:d,checked:y,required:l,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});Hx.displayName=Vx;var Zx="SwitchThumb",qx=a.forwardRef((t,r)=>{const{__scopeSwitch:n,...a}=t,s=Kx(Zx,n);return e.jsx(Wp.span,{"data-state":Yx(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:r})});qx.displayName=Zx;var Jx=a.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const l=a.useRef(null),c=rd(l,i),d=zg(n),u=Fg(r);return a.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:c,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Yx(e){return e?"checked":"unchecked"}Jx.displayName="SwitchBubbleInput";var Xx=Hx,Qx=qx;const ey=a.forwardRef(({className:t,...r},n)=>e.jsx(Xx,{className:ke("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...r,ref:n,children:e.jsx(Qx,{className:ke("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));ey.displayName=Xx.displayName;const ty=({workspaceId:r})=>{const[n,a]=t.useState({}),[s,o]=t.useState(null),i=t.useRef(null),{allFeatures:l,updateFeature:c,getWorkspace:d}=or();t.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const[u,f]=t.useState(null),{user:p}=es();if(t.useEffect(()=>{d(r).then(f)},[r]),!u)return e.jsx(Wx,{});const m=nr(u,p?.id??null);return e.jsxs("div",{children:[s&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:s})]}),e.jsxs("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!m&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!l.length&&e.jsx("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),l.length>0&&e.jsx("div",{className:"flex flex-col gap-y-3.5",children:l.map(t=>{const r=u?.features?.[t.slug],s=null!==n[t.slug]&&void 0!==n[t.slug],d=n[t.slug],p=!0===d?"Enabling":!1===d?"Disabling":"";return e.jsxs("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e.jsxs("div",{className:"flex gap-x-2 flex-col",children:[e.jsx("h3",{className:"font-medium text-ellipsis",children:t.name}),e.jsx("p",{className:"text-muted-foreground",children:t.description})]}),s?e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsx(Od,{className:"h-4 w-4 animate-spin text-gray-500"}),e.jsxs("span",{className:"text-sm text-gray-600",children:[p,"..."]})]}):e.jsx(ey,{disabled:!m,checked:r??t.defaultValue,onCheckedChange:e=>async function(e,t){if(u){a(r=>({...r,[e]:t})),o(null);try{const r=await c(u._id,e,t);f(r);const n=l.find(t=>t.slug===e);o(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{o(null)},5e3)}catch(t){De(t,{component:"WorkspaceSettingsFeatures",action:"updateFeature",metadata:{workspaceId:u._id,featureKey:e}})}finally{a(t=>({...t,[e]:null}))}}}(t.slug,e)})]},t._id)})})]})]})},ry={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:"฿"},ny={usd:"🇺🇸",eur:"🇪🇺",gbp:"🇬🇧",jpy:"🇯🇵",cad:"🇨🇦",aud:"🇦🇺",chf:"🇨🇭",cny:"🇨🇳",hkd:"🇭🇰",sgd:"🇸🇬",inr:"🇮🇳",mxn:"🇲🇽",brl:"🇧🇷",nzd:"🇳🇿",sek:"🇸🇪",nok:"🇳🇴",dkk:"🇩🇰",pln:"🇵🇱",thb:"🇹🇭"};function ay(e){return e&&e.trim()?ny[e.trim().toLowerCase()]??"":""}function sy(e){if(!e||!e.trim())return"";const t=e.trim().toLowerCase();return ry[t]??t.toUpperCase()}const oy=["usd","eur","gbp","jpy","cad","aud","chf","cny","hkd","sgd","inr","mxn","brl","nzd","sek","nok","dkk","pln","thb"],iy=oy.map(e=>({value:e,label:`${e.toUpperCase()} (${sy(e)})`}));function ly(e,t){return sy(t)+(e/100).toFixed(2)}function cy(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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</text></svg>`}const dy=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑💻","👨💻","👩💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨💼","👩💼","👨🏫","👩🏫","👨🔬","👩🔬","👨🎨","👩🎨","👨🔧","👩🔧","👨🚀","👩🚀","👨⚖️","👩⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️🌈","🎟️","🎫"],uy=({workspace:r})=>{const[n,a]=t.useState(!1),[s,o]=t.useState("emoji"),[i,l]=t.useState(),[c,d]=t.useState(null),u=t.useRef(null),{updateWorkspace:f}=or();t.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const{user:p}=es(),m=Go({resolver:Qc(ff({name:Fu().min(2,{message:"Workspace name must be at least 2 characters."}),image:Fu().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return e.jsx(Wx,{});const h=nr(r,p?.id??null);return e.jsxs("div",{children:[c&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:c})]}),!h&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),e.jsx(eu,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(async function(e){a(!0),d(null);try{await f(r,e),d("Workspace settings saved successfully"),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{d(null)},5e3)}catch(e){De(e,{component:"WorkspaceSettingsGeneral",action:"updateWorkspace",metadata:{workspaceId:r._id}})}finally{a(!1)}}),className:"space-y-6",children:[e.jsx(ru,{control:m.control,name:"name",render:({field:t})=>e.jsxs(su,{children:[e.jsx(ou,{children:"Name"}),e.jsx(iu,{children:e.jsx(du,{placeholder:"My Awesome Workspace",...t,disabled:!h})}),e.jsx(cu,{})]})}),r.billingCurrency?.trim()&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Qd,{className:"text-sm font-medium text-muted-foreground",children:"Billing currency"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[ay(r.billingCurrency)&&e.jsx("span",{className:"text-base",children:ay(r.billingCurrency)}),e.jsx("span",{children:r.billingCurrency.trim().toUpperCase()})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Qd,{className:"text-sm font-medium",children:"Icon"}),e.jsx(lu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(db,{value:s,disabled:!h,onValueChange:e=>o(e),className:"flex flex-col space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ub,{value:"emoji",id:"emoji"}),e.jsxs(Qd,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(Ld,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ub,{value:"url",id:"url"}),e.jsxs(Qd,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(Pd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsxs("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[i&&e.jsx("span",{className:"text-2xl",children:i}),!i&&m.watch("image")?.trim()&&e.jsx("img",{src:m.watch("image")||void 0,alt:"Workspace preview"})]})]}),h&&e.jsx(qb,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:dy.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{l(e),m.setValue("image",cy(e))})(t),disabled:!h,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(i===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(ru,{control:m.control,name:"image",render:({field:t})=>e.jsxs(su,{children:[e.jsx(ou,{children:"Image URL"}),e.jsx(iu,{children:e.jsx(du,{placeholder:"https://example.com/image.png",...t,disabled:!h})}),e.jsx(lu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(cu,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:m.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),e.jsx("div",{className:"flex justify-end gap-3 pt-4",children:h&&e.jsx(Zd,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var fy=.999,py=/[\\\/_+.#"@\[\(\{&]/,my=/[\\\/_+.#"@\[\(\{&]/g,hy=/[\s-]/,gy=/[\s-]/g;function by(e,t,r,n,a,s,o){if(s===t.length)return a===e.length?1:.99;var i=`${a},${s}`;if(void 0!==o[i])return o[i];for(var l,c,d,u,f=n.charAt(s),p=r.indexOf(f,a),m=0;p>=0;)(l=by(e,t,r,n,p+1,s+1,o))>m&&(p===a?l*=1:py.test(e.charAt(p-1))?(l*=.8,(d=e.slice(a,p-1).match(my))&&a>0&&(l*=Math.pow(fy,d.length))):hy.test(e.charAt(p-1))?(l*=.9,(u=e.slice(a,p-1).match(gy))&&a>0&&(l*=Math.pow(fy,u.length))):(l*=.17,a>0&&(l*=Math.pow(fy,p-a))),e.charAt(p)!==t.charAt(s)&&(l*=.9999)),(l<.1&&r.charAt(p-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(p-1)!==n.charAt(s))&&(.1*(c=by(e,t,r,n,p+1,s+2,o))>l&&(l=.1*c)),l>m&&(m=l),p=r.indexOf(f,p+1);return o[i]=m,m}function xy(e){return e.toLowerCase().replace(gy," ")}function yy(e,t,r){return by(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,xy(e),xy(t),0,0,{})}var vy='[cmdk-group=""]',wy='[cmdk-group-items=""]',Sy='[cmdk-item=""]',jy=`${Sy}:not([aria-disabled="true"])`,ky="cmdk-item-select",Ny="data-value",Ey=(e,t,r)=>yy(e,t,r),Cy=a.createContext(void 0),Ay=()=>a.useContext(Cy),_y=a.createContext(void 0),Ty=()=>a.useContext(_y),Ry=a.createContext(void 0),Py=a.forwardRef((e,t)=>{let r=Ky(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Ky(()=>new Set),s=Ky(()=>new Map),o=Ky(()=>new Map),i=Ky(()=>new Set),l=By(e),{label:c,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:b=!0,...x}=e,y=Dp(),v=Dp(),w=Dp(),S=a.useRef(null),j=qy();Gy(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,k.emit()}},[u]),Gy(()=>{j(6,T)},[]);let k=a.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,s,o,i;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)_(),C(),j(1,A);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(a=document.getElementById(y))||a.focus()}if(j(7,()=>{var e;r.current.selectedItemId=null==(e=R())?void 0:e.id,k.emit()}),n||j(5,T),void 0!==(null==(s=l.current)?void 0:s.value)){let e=null!=t?t:"";return void(null==(i=(o=l.current).onValueChange)||i.call(o,e))}}k.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),N=a.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=o.current.get(e))?void 0:a.value)&&(o.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,E(t,n)),j(2,()=>{C(),k.emit()}))},item:(e,t)=>(n.current.add(e),t&&(s.current.has(t)?s.current.get(t).add(e):s.current.set(t,new Set([e]))),j(3,()=>{_(),C(),r.current.value||A(),k.emit()}),()=>{o.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=R();j(4,()=>{_(),(null==t?void 0:t.getAttribute("id"))===e&&A(),k.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{o.current.delete(e),s.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:y,inputId:w,labelId:v,listInnerRef:S}),[]);function E(e,t){var n,a;let s=null!=(a=null==(n=l.current)?void 0:n.filter)?a:Ey;return e?s(e,r.current.search,t):0}function C(){if(!r.current.search||!1===l.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=s.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;P().sort((t,r)=>{var n,a;let s=t.getAttribute("id"),o=r.getAttribute("id");return(null!=(n=e.get(o))?n:0)-(null!=(a=e.get(s))?a:0)}).forEach(e=>{let t=e.closest(wy);t?t.appendChild(e.parentElement===t?e:e.closest(`${wy} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${wy} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${vy}[${Ny}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function A(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Ny);k.setState("value",t||void 0)}function _(){var e,t,a,i;if(!r.current.search||!1===l.current.shouldFilter)return void(r.current.filtered.count=n.current.size);r.current.filtered.groups=new Set;let c=0;for(let s of n.current){let n=E(null!=(t=null==(e=o.current.get(s))?void 0:e.value)?t:"",null!=(i=null==(a=o.current.get(s))?void 0:a.keywords)?i:[]);r.current.filtered.items.set(s,n),n>0&&c++}for(let[e,t]of s.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=c}function T(){var e,t,r;let n=R();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(vy))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function R(){var e;return null==(e=S.current)?void 0:e.querySelector(`${Sy}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(jy))||[])}function O(e){let t=P()[e];t&&k.setState("value",t.getAttribute(Ny))}function I(e){var t;let r=R(),n=P(),a=n.findIndex(e=>e===r),s=n[a+e];null!=(t=l.current)&&t.loop&&(s=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),s&&k.setState("value",s.getAttribute(Ny))}function D(e){let t,r=R(),n=null==r?void 0:r.closest(vy);for(;n&&!t;)n=e>0?$y(n,vy):Vy(n,vy),t=null==n?void 0:n.querySelector(jy);t?k.setState("value",t.getAttribute(Ny)):I(e)}let U=()=>O(P().length-1),M=e=>{e.preventDefault(),e.metaKey?U():e.altKey?D(1):I(1)},F=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?D(-1):I(-1)};return a.createElement(Wp.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=x.onKeyDown)||t.call(x,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":b&&e.ctrlKey&&M(e);break;case"ArrowDown":M(e);break;case"p":case"k":b&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),O(0);break;case"End":e.preventDefault(),U();break;case"Enter":{e.preventDefault();let t=R();if(t){let e=new Event(ky);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:N.inputId,id:N.labelId,style:Yy},c),Jy(e,e=>a.createElement(_y.Provider,{value:k},a.createElement(Cy.Provider,{value:N},e))))}),Oy=a.forwardRef((e,t)=>{var r,n;let s=Dp(),o=a.useRef(null),i=a.useContext(Ry),l=Ay(),c=By(e),d=null!=(n=null==(r=c.current)?void 0:r.forceMount)?n:null==i?void 0:i.forceMount;Gy(()=>{if(!d)return l.item(s,null==i?void 0:i.id)},[d]);let u=Zy(s,o,[e.value,e.children,o],e.keywords),f=Ty(),p=Hy(e=>e.value&&e.value===u.current),m=Hy(e=>!(!d&&!1!==l.filter())||(!e.search||e.filtered.items.get(s)>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(a.useEffect(()=>{let t=o.current;if(t&&!e.disabled)return t.addEventListener(ky,h),()=>t.removeEventListener(ky,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:b,value:x,onSelect:y,forceMount:v,keywords:w,...S}=e;return a.createElement(Wp.div,{ref:td(o,t),...S,id:s,"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)}),Iy=a.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...o}=e,i=Dp(),l=a.useRef(null),c=a.useRef(null),d=Dp(),u=Ay(),f=Hy(e=>!(!s&&!1!==u.filter())||(!e.search||e.filtered.groups.has(i)));Gy(()=>u.group(i),[]),Zy(i,l,[e.value,e.heading,c]);let p=a.useMemo(()=>({id:i,forceMount:s}),[s]);return a.createElement(Wp.div,{ref:td(l,t),...o,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&a.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),Jy(e,e=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},a.createElement(Ry.Provider,{value:p},e))))}),Dy=a.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=a.useRef(null),o=Hy(e=>!e.search);return r||o?a.createElement(Wp.div,{ref:td(s,t),...n,"cmdk-separator":"",role:"separator"}):null}),Uy=a.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=null!=e.value,o=Ty(),i=Hy(e=>e.search),l=Hy(e=>e.selectedItemId),c=Ay();return a.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),a.createElement(Wp.input,{ref:t,...n,"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:s?e.value:i,onChange:e=>{s||o.setState("search",e.target.value),null==r||r(e.target.value)}})}),My=a.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,o=a.useRef(null),i=a.useRef(null),l=Hy(e=>e.selectedItemId),c=Ay();return a.useEffect(()=>{if(i.current&&o.current){let e,t=i.current,r=o.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),a.createElement(Wp.div,{ref:td(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:c.listId},Jy(e,e=>a.createElement("div",{ref:td(i,c.listInnerRef),"cmdk-list-sizer":""},e)))}),Fy=a.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:o,container:i,...l}=e;return a.createElement($h,{open:r,onOpenChange:n},a.createElement(Bh,{container:i},a.createElement(Gh,{"cmdk-overlay":"",className:s}),a.createElement(Kh,{"aria-label":e.label,"cmdk-dialog":"",className:o},a.createElement(Py,{ref:t,...l}))))}),zy=a.forwardRef((e,t)=>Hy(e=>0===e.filtered.count)?a.createElement(Wp.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Ly=a.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...o}=e;return a.createElement(Wp.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Jy(e,e=>a.createElement("div",{"aria-hidden":!0},e)))}),Wy=Object.assign(Py,{List:My,Item:Oy,Input:Uy,Group:Iy,Separator:Dy,Dialog:Fy,Empty:zy,Loading:Ly});function $y(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Vy(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function By(e){let t=a.useRef(e);return Gy(()=>{t.current=e}),t}var Gy="undefined"==typeof window?a.useEffect:a.useLayoutEffect;function Ky(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function Hy(e){let t=Ty(),r=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,r,r)}function Zy(e,t,r,n=[]){let s=a.useRef(),o=Ay();return Gy(()=>{var a;let i=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():s.current}})(),l=n.map(e=>e.trim());o.value(e,i,l),null==(a=t.current)||a.setAttribute(Ny,i),s.current=i}),s}var qy=()=>{let[e,t]=a.useState(),r=Ky(()=>new Map);return Gy(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function Jy({asChild:e,children:t},r){return e&&a.isValidElement(t)?a.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var Yy={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Xy=a.forwardRef(({className:t,...r},n)=>e.jsx(Wy,{ref:n,className:ke("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));Xy.displayName=Wy.displayName;const Qy=a.forwardRef(({className:t,...r},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e.jsx(ag,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Wy.Input,{ref:n,className:ke("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...r})]}));Qy.displayName=Wy.Input.displayName;const ev=a.forwardRef(({className:t,...r},n)=>e.jsx(Wy.List,{ref:n,className:ke("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));ev.displayName=Wy.List.displayName;a.forwardRef((t,r)=>e.jsx(Wy.Empty,{ref:r,className:"py-6 text-center text-sm",...t})).displayName=Wy.Empty.displayName;const tv=a.forwardRef(({className:t,...r},n)=>e.jsx(Wy.Group,{ref:n,className:ke("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...r}));tv.displayName=Wy.Group.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Wy.Separator,{ref:n,className:ke("-mx-1 h-px bg-border",t),...r})).displayName=Wy.Separator.displayName;const rv=a.forwardRef(({className:t,...r},n)=>e.jsx(Wy.Item,{ref:n,className:ke("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r}));rv.displayName=Wy.Item.displayName;const nv=["top","right","bottom","left"],av=Math.min,sv=Math.max,ov=Math.round,iv=Math.floor,lv=e=>({x:e,y:e}),cv={left:"right",right:"left",bottom:"top",top:"bottom"},dv={start:"end",end:"start"};function uv(e,t,r){return sv(e,av(t,r))}function fv(e,t){return"function"==typeof e?e(t):e}function pv(e){return e.split("-")[0]}function mv(e){return e.split("-")[1]}function hv(e){return"x"===e?"y":"x"}function gv(e){return"y"===e?"height":"width"}const bv=new Set(["top","bottom"]);function xv(e){return bv.has(pv(e))?"y":"x"}function yv(e){return hv(xv(e))}function vv(e){return e.replace(/start|end/g,e=>dv[e])}const wv=["left","right"],Sv=["right","left"],jv=["top","bottom"],kv=["bottom","top"];function Nv(e,t,r,n){const a=mv(e);let s=function(e,t,r){switch(e){case"top":case"bottom":return r?t?Sv:wv:t?wv:Sv;case"left":case"right":return t?jv:kv;default:return[]}}(pv(e),"start"===r,n);return a&&(s=s.map(e=>e+"-"+a),t&&(s=s.concat(s.map(vv)))),s}function Ev(e){return e.replace(/left|right|bottom|top/g,e=>cv[e])}function Cv(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 Av(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 _v(e,t,r){let{reference:n,floating:a}=e;const s=xv(t),o=yv(t),i=gv(o),l=pv(t),c="y"===s,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[i]/2-a[i]/2;let p;switch(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(mv(t)){case"start":p[o]-=f*(r&&c?-1:1);break;case"end":p[o]+=f*(r&&c?-1:1)}return p}async function Tv(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:s,rects:o,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=fv(t,e),m=Cv(p),h=i[f?"floating"===u?"reference":"floating":u],g=Av(await s.getClippingRect({element:null==(r=await(null==s.isElement?void 0:s.isElement(h)))||r?h:h.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(i.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===u?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,x=await(null==s.getOffsetParent?void 0:s.getOffsetParent(i.floating)),y=await(null==s.isElement?void 0:s.isElement(x))&&await(null==s.getScale?void 0:s.getScale(x))||{x:1,y:1},v=Av(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:b,offsetParent:x,strategy:l}):b);return{top:(g.top-v.top+m.top)/y.y,bottom:(v.bottom-g.bottom+m.bottom)/y.y,left:(g.left-v.left+m.left)/y.x,right:(v.right-g.right+m.right)/y.x}}function Rv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pv(e){return nv.some(t=>e[t]>=0)}const Ov=new Set(["left","top"]);function Iv(){return"undefined"!=typeof window}function Dv(e){return Fv(e)?(e.nodeName||"").toLowerCase():"#document"}function Uv(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Mv(e){var t;return null==(t=(Fv(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Fv(e){return!!Iv()&&(e instanceof Node||e instanceof Uv(e).Node)}function zv(e){return!!Iv()&&(e instanceof Element||e instanceof Uv(e).Element)}function Lv(e){return!!Iv()&&(e instanceof HTMLElement||e instanceof Uv(e).HTMLElement)}function Wv(e){return!(!Iv()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Uv(e).ShadowRoot)}const $v=new Set(["inline","contents"]);function Vv(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=tw(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!$v.has(a)}const Bv=new Set(["table","td","th"]);function Gv(e){return Bv.has(Dv(e))}const Kv=[":popover-open",":modal"];function Hv(e){return Kv.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Zv=["transform","translate","scale","rotate","perspective"],qv=["transform","translate","scale","rotate","perspective","filter"],Jv=["paint","layout","strict","content"];function Yv(e){const t=Xv(),r=zv(e)?tw(e):e;return Zv.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||qv.some(e=>(r.willChange||"").includes(e))||Jv.some(e=>(r.contain||"").includes(e))}function Xv(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Qv=new Set(["html","body","#document"]);function ew(e){return Qv.has(Dv(e))}function tw(e){return Uv(e).getComputedStyle(e)}function rw(e){return zv(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nw(e){if("html"===Dv(e))return e;const t=e.assignedSlot||e.parentNode||Wv(e)&&e.host||Mv(e);return Wv(t)?t.host:t}function aw(e){const t=nw(e);return ew(t)?e.ownerDocument?e.ownerDocument.body:e.body:Lv(t)&&Vv(t)?t:aw(t)}function sw(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=aw(e),s=a===(null==(n=e.ownerDocument)?void 0:n.body),o=Uv(a);if(s){const e=ow(o);return t.concat(o,o.visualViewport||[],Vv(a)?a:[],e&&r?sw(e):[])}return t.concat(a,sw(a,[],r))}function ow(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function iw(e){const t=tw(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Lv(e),s=a?e.offsetWidth:r,o=a?e.offsetHeight:n,i=ov(r)!==s||ov(n)!==o;return i&&(r=s,n=o),{width:r,height:n,$:i}}function lw(e){return zv(e)?e:e.contextElement}function cw(e){const t=lw(e);if(!Lv(t))return lv(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:s}=iw(t);let o=(s?ov(r.width):r.width)/n,i=(s?ov(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),i&&Number.isFinite(i)||(i=1),{x:o,y:i}}const dw=lv(0);function uw(e){const t=Uv(e);return Xv()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:dw}function fw(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),s=lw(e);let o=lv(1);t&&(n?zv(n)&&(o=cw(n)):o=cw(e));const i=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Uv(e))&&t}(s,r,n)?uw(s):lv(0);let l=(a.left+i.x)/o.x,c=(a.top+i.y)/o.y,d=a.width/o.x,u=a.height/o.y;if(s){const e=Uv(s),t=n&&zv(n)?Uv(n):n;let r=e,a=ow(r);for(;a&&n&&t!==r;){const e=cw(a),t=a.getBoundingClientRect(),n=tw(a),s=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=s,c+=o,r=Uv(a),a=ow(r)}}return Av({width:d,height:u,x:l,y:c})}function pw(e,t){const r=rw(e).scrollLeft;return t?t.left+r:fw(Mv(e)).left+r}function mw(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-pw(e,r),y:r.top+t.scrollTop}}const hw=new Set(["absolute","fixed"]);function gw(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Uv(e),n=Mv(e),a=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,i=0,l=0;if(a){s=a.width,o=a.height;const e=Xv();(!e||e&&"fixed"===t)&&(i=a.offsetLeft,l=a.offsetTop)}const c=pw(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,o=Math.abs(n.clientWidth-t.clientWidth-a);o<=25&&(s-=o)}else c<=25&&(s+=c);return{width:s,height:o,x:i,y:l}}(e,r);else if("document"===t)n=function(e){const t=Mv(e),r=rw(e),n=e.ownerDocument.body,a=sv(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=sv(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+pw(e);const i=-r.scrollTop;return"rtl"===tw(n).direction&&(o+=sv(t.clientWidth,n.clientWidth)-a),{width:a,height:s,x:o,y:i}}(Mv(e));else if(zv(t))n=function(e,t){const r=fw(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,s=Lv(e)?cw(e):lv(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:a*s.x,y:n*s.y}}(t,r);else{const r=uw(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Av(n)}function bw(e,t){const r=nw(e);return!(r===t||!zv(r)||ew(r))&&("fixed"===tw(r).position||bw(r,t))}function xw(e,t,r){const n=Lv(t),a=Mv(t),s="fixed"===r,o=fw(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const l=lv(0);function c(){l.x=pw(a)}if(n||!n&&!s)if(("body"!==Dv(t)||Vv(a))&&(i=rw(t)),n){const e=fw(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&c();s&&!n&&a&&c();const d=!a||n||s?lv(0):mw(a,i);return{x:o.left+i.scrollLeft-l.x-d.x,y:o.top+i.scrollTop-l.y-d.y,width:o.width,height:o.height}}function yw(e){return"static"===tw(e).position}function vw(e,t){if(!Lv(e)||"fixed"===tw(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Mv(e)===r&&(r=r.ownerDocument.body),r}function ww(e,t){const r=Uv(e);if(Hv(e))return r;if(!Lv(e)){let t=nw(e);for(;t&&!ew(t);){if(zv(t)&&!yw(t))return t;t=nw(t)}return r}let n=vw(e,t);for(;n&&Gv(n)&&yw(n);)n=vw(n,t);return n&&ew(n)&&yw(n)&&!Yv(n)?r:n||function(e){let t=nw(e);for(;Lv(t)&&!ew(t);){if(Yv(t))return t;if(Hv(t))return null;t=nw(t)}return null}(e)||r}const Sw={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const s="fixed"===a,o=Mv(n),i=!!t&&Hv(t.floating);if(n===o||i&&s)return r;let l={scrollLeft:0,scrollTop:0},c=lv(1);const d=lv(0),u=Lv(n);if((u||!u&&!s)&&(("body"!==Dv(n)||Vv(o))&&(l=rw(n)),Lv(n))){const e=fw(n);c=cw(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!o||u||s?lv(0):mw(o,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:Mv,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s="clippingAncestors"===r?Hv(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=sw(e,[],!1).filter(e=>zv(e)&&"body"!==Dv(e)),a=null;const s="fixed"===tw(e).position;let o=s?nw(e):e;for(;zv(o)&&!ew(o);){const t=tw(o),r=Yv(o);r||"fixed"!==t.position||(a=null),(s?!r&&!a:!r&&"static"===t.position&&a&&hw.has(a.position)||Vv(o)&&!r&&bw(e,o))?n=n.filter(e=>e!==o):a=t,o=nw(o)}return t.set(e,n),n}(t,this._c):[].concat(r),o=[...s,n],i=o[0],l=o.reduce((e,r)=>{const n=gw(t,r,a);return e.top=sv(n.top,e.top),e.right=av(n.right,e.right),e.bottom=av(n.bottom,e.bottom),e.left=sv(n.left,e.left),e},gw(t,i,a));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:ww,getElementRects:async function(e){const t=this.getOffsetParent||ww,r=this.getDimensions,n=await r(e.floating);return{reference:xw(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}=iw(e);return{width:t,height:r}},getScale:cw,isElement:zv,isRTL:function(e){return"rtl"===tw(e).direction}};function jw(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kw(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=lw(e),d=a||s?[...c?sw(c):[],...sw(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),s&&e.addEventListener("resize",r)});const u=c&&i?function(e,t){let r,n=null;const a=Mv(e);function s(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function o(i,l){void 0===i&&(i=!1),void 0===l&&(l=1),s();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=c;if(i||t(),!f||!p)return;const m={rootMargin:-iv(u)+"px "+-iv(a.clientWidth-(d+f))+"px "+-iv(a.clientHeight-(u+p))+"px "+-iv(d)+"px",threshold:sv(0,av(1,l))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==l){if(!h)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||jw(c,e.getBoundingClientRect())||o(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),s}(c,r):null;let f,p=-1,m=null;o&&(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?fw(e):null;return l&&function t(){const n=fw(e);h&&!jw(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),s&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,l&&cancelAnimationFrame(f)}}const Nw=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:s,placement:o,middlewareData:i}=t,l=await async function(e,t){const{placement:r,platform:n,elements:a}=e,s=await(null==n.isRTL?void 0:n.isRTL(a.floating)),o=pv(r),i=mv(r),l="y"===xv(r),c=Ov.has(o)?-1:1,d=s&&l?-1:1,u=fv(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&"number"==typeof m&&(p="end"===i?-1*m:m),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return o===(null==(r=i.offset)?void 0:r.placement)&&null!=(n=i.arrow)&&n.alignmentOffset?{}:{x:a+l.x,y:s+l.y,data:{...l,placement:o}}}}},Ew=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=fv(e,t),d={x:r,y:n},u=await s.detectOverflow(t,c),f=xv(pv(a)),p=hv(f);let m=d[p],h=d[f];if(o){const e="y"===p?"bottom":"right";m=uv(m+u["y"===p?"top":"left"],m,m-u[e])}if(i){const e="y"===f?"bottom":"right";h=uv(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]:o,[f]:i}}}}}},Cw=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:s,rects:o,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=fv(e,t);if(null!=(r=s.arrow)&&r.alignmentOffset)return{};const b=pv(a),x=xv(i),y=pv(i)===i,v=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=f||(y||!h?[Ev(i)]:function(e){const t=Ev(e);return[vv(e),t,vv(t)]}(i)),S="none"!==m;!f&&S&&w.push(...Nv(i,h,m,v));const j=[i,...w],k=await l.detectOverflow(t,g),N=[];let E=(null==(n=s.flip)?void 0:n.overflows)||[];if(d&&N.push(k[b]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=mv(e),a=yv(e),s=gv(a);let o="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Ev(o)),[o,Ev(o)]}(a,o,v);N.push(k[e[0]],k[e[1]])}if(E=[...E,{placement:a,overflows:N}],!N.every(e=>e<=0)){var C,A;const e=((null==(C=s.flip)?void 0:C.index)||0)+1,t=j[e];if(t){if(!("alignment"===u&&x!==xv(t))||E.every(e=>xv(e.placement)!==x||e.overflows[0]>0))return{data:{index:e,overflows:E},reset:{placement:t}}}let r=null==(A=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=E.filter(e=>{if(S){const t=xv(e.placement);return t===x||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:_[0];e&&(r=e);break}case"initialPlacement":r=i}if(a!==r)return{reset:{placement:r}}}return{}}}},Aw=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:s,platform:o,elements:i}=t,{apply:l=()=>{},...c}=fv(e,t),d=await o.detectOverflow(t,c),u=pv(a),f=mv(a),p="y"===xv(a),{width:m,height:h}=s.floating;let g,b;"top"===u||"bottom"===u?(g=u,b=f===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g="end"===f?"top":"bottom");const x=h-d.top-d.bottom,y=m-d.left-d.right,v=av(h-d[g],x),w=av(m-d[b],y),S=!t.middlewareData.shift;let j=v,k=w;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(k=y),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(j=x),S&&!f){const e=sv(d.left,0),t=sv(d.right,0),r=sv(d.top,0),n=sv(d.bottom,0);p?k=m-2*(0!==e||0!==t?e+t:sv(d.left,d.right)):j=h-2*(0!==r||0!==n?r+n:sv(d.top,d.bottom))}await l({...t,availableWidth:k,availableHeight:j});const N=await o.getDimensions(i.floating);return m!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}},_w=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...s}=fv(e,t);switch(a){case"referenceHidden":{const e=Rv(await n.detectOverflow(t,{...s,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Pv(e)}}}case"escaped":{const e=Rv(await n.detectOverflow(t,{...s,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Pv(e)}}}default:return{}}}}},Tw=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:s,platform:o,elements:i,middlewareData:l}=t,{element:c,padding:d=0}=fv(e,t)||{};if(null==c)return{};const u=Cv(d),f={x:r,y:n},p=yv(a),m=gv(p),h=await o.getDimensions(c),g="y"===p,b=g?"top":"left",x=g?"bottom":"right",y=g?"clientHeight":"clientWidth",v=s.reference[m]+s.reference[p]-f[p]-s.floating[m],w=f[p]-s.reference[p],S=await(null==o.getOffsetParent?void 0:o.getOffsetParent(c));let j=S?S[y]:0;j&&await(null==o.isElement?void 0:o.isElement(S))||(j=i.floating[y]||s.floating[m]);const k=v/2-w/2,N=j/2-h[m]/2-1,E=av(u[b],N),C=av(u[x],N),A=E,_=j-h[m]-C,T=j/2-h[m]/2+k,R=uv(A,T,_),P=!l.arrow&&null!=mv(a)&&T!==R&&s.reference[m]/2-(T<A?E:C)-h[m]/2<0,O=P?T<A?T-A:T-_:0;return{[p]:f[p]+O,data:{[p]:R,centerOffset:T-R-O,...P&&{alignmentOffset:O}},reset:P}}}),Rw=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:s,middlewareData:o}=t,{offset:i=0,mainAxis:l=!0,crossAxis:c=!0}=fv(e,t),d={x:r,y:n},u=xv(a),f=hv(u);let p=d[f],m=d[u];const h=fv(i,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const e="y"===f?"height":"width",t=s.reference[f]-s.floating[e]+g.mainAxis,r=s.reference[f]+s.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(c){var b,x;const e="y"===f?"width":"height",t=Ov.has(pv(a)),r=s.reference[u]-s.floating[e]+(t&&(null==(b=o.offset)?void 0:b[u])||0)+(t?0:g.crossAxis),n=s.reference[u]+s.reference[e]+(t?0:(null==(x=o.offset)?void 0:x[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},Pw=(e,t,r)=>{const n=new Map,a={platform:Sw,...r},s={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:o}=r,i=s.filter(Boolean),l=await(null==o.isRTL?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=_v(c,n,l),f=n,p={},m=0;for(let r=0;r<i.length;r++){var h;const{name:s,fn:g}=i[r],{x:b,y:x,data:y,reset:v}=await g({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:c,platform:{...o,detectOverflow:null!=(h=o.detectOverflow)?h:Tv},elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=x?x:u,p={...p,[s]:{...p[s],...y}},v&&m<=50&&(m++,"object"==typeof v&&(v.placement&&(f=v.placement),v.rects&&(c=!0===v.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):v.rects),({x:d,y:u}=_v(c,f,l))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:s})};var Ow="undefined"!=typeof document?t.useLayoutEffect:function(){};function Iw(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(!Iw(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)&&!Iw(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Dw(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Uw(e,t){const r=Dw(e);return Math.round(t*r)/r}function Mw(e){const t=a.useRef(e);return Ow(()=>{t.current=e}),t}const Fw=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?Tw({element:r.current,padding:n}).fn(t):{}:r?Tw({element:r,padding:n}).fn(t):{};var a}}),zw=(e,t)=>({...Nw(e),options:[e,t]}),Lw=(e,t)=>({...Ew(e),options:[e,t]}),Ww=(e,t)=>({...Rw(e),options:[e,t]}),$w=(e,t)=>({...Cw(e),options:[e,t]}),Vw=(e,t)=>({...Aw(e),options:[e,t]}),Bw=(e,t)=>({..._w(e),options:[e,t]}),Gw=(e,t)=>({...Fw(e),options:[e,t]});var Kw=a.forwardRef((t,r)=>{const{children:n,width:a=10,height:s=5,...o}=t;return e.jsx(Wp.svg,{...o,ref:r,width:a,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});Kw.displayName="Arrow";var Hw=Kw,Zw="Popper",[qw,Jw]=Rp(Zw),[Yw,Xw]=qw(Zw),Qw=t=>{const{__scopePopper:r,children:n}=t,[s,o]=a.useState(null);return e.jsx(Yw,{scope:r,anchor:s,onAnchorChange:o,children:n})};Qw.displayName=Zw;var eS="PopperAnchor",tS=a.forwardRef((t,r)=>{const{__scopePopper:n,virtualRef:s,...o}=t,i=Xw(eS,n),l=a.useRef(null),c=rd(r,l),d=a.useRef(null);return a.useEffect(()=>{const e=d.current;d.current=s?.current||l.current,e!==d.current&&i.onAnchorChange(d.current)}),s?null:e.jsx(Wp.div,{...o,ref:c})});tS.displayName=eS;var rS="PopperContent",[nS,aS]=qw(rS),sS=a.forwardRef((t,r)=>{const{__scopePopper:n,side:o="bottom",sideOffset:i=0,align:l="center",alignOffset:c=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:b,...x}=t,y=Xw(rS,n),[v,w]=a.useState(null),S=rd(r,e=>w(e)),[j,k]=a.useState(null),N=Fg(j),E=N?.width??0,C=N?.height??0,A=o+("center"!==l?"-"+l:""),_="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},T=Array.isArray(f)?f:[f],R=T.length>0,P={padding:_,boundary:T.filter(cS),altBoundary:R},{refs:O,floatingStyles:I,placement:D,isPositioned:U,middlewareData:M}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:l}={},transform:c=!0,whileElementsMounted:d,open:u}=e,[f,p]=a.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=a.useState(n);Iw(m,n)||h(n);const[g,b]=a.useState(null),[x,y]=a.useState(null),v=a.useCallback(e=>{e!==k.current&&(k.current=e,b(e))},[]),w=a.useCallback(e=>{e!==N.current&&(N.current=e,y(e))},[]),S=i||g,j=l||x,k=a.useRef(null),N=a.useRef(null),E=a.useRef(f),C=null!=d,A=Mw(d),_=Mw(o),T=Mw(u),R=a.useCallback(()=>{if(!k.current||!N.current)return;const e={placement:t,strategy:r,middleware:m};_.current&&(e.platform=_.current),Pw(k.current,N.current,e).then(e=>{const t={...e,isPositioned:!1!==T.current};P.current&&!Iw(E.current,t)&&(E.current=t,s.flushSync(()=>{p(t)}))})},[m,t,r,_,T]);Ow(()=>{!1===u&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const P=a.useRef(!1);Ow(()=>(P.current=!0,()=>{P.current=!1}),[]),Ow(()=>{if(S&&(k.current=S),j&&(N.current=j),S&&j){if(A.current)return A.current(S,j,R);R()}},[S,j,R,A,C]);const O=a.useMemo(()=>({reference:k,floating:N,setReference:v,setFloating:w}),[v,w]),I=a.useMemo(()=>({reference:S,floating:j}),[S,j]),D=a.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Uw(I.floating,f.x),n=Uw(I.floating,f.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Dw(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,I.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:R,refs:O,elements:I,floatingStyles:D}),[f,R,O,I,D])}({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>kw(...e,{animationFrame:"always"===g}),elements:{reference:y.anchor},middleware:[zw({mainAxis:i+C,alignmentAxis:c}),u&&Lw({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?Ww():void 0,...P}),u&&$w({...P}),Vw({...P,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:s}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${s}px`)}}),j&&Gw({element:j,padding:d}),dS({arrowWidth:E,arrowHeight:C}),h&&Bw({strategy:"referenceHidden",...P})]}),[F,z]=uS(D),L=ep(b);rp(()=>{U&&L?.()},[U,L]);const W=M.arrow?.x,$=M.arrow?.y,V=0!==M.arrow?.centerOffset,[B,G]=a.useState();return rp(()=>{v&&G(window.getComputedStyle(v).zIndex)},[v]),e.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:U?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(" "),...M.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(nS,{scope:n,placedSide:F,onArrowChange:k,arrowX:W,arrowY:$,shouldHideArrow:V,children:e.jsx(Wp.div,{"data-side":F,"data-align":z,...x,ref:S,style:{...x.style,animation:U?void 0:"none"}})})})});sS.displayName=rS;var oS="PopperArrow",iS={top:"bottom",right:"left",bottom:"top",left:"right"},lS=a.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,s=aS(oS,n),o=iS[s.placedSide];return e.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:e.jsx(Hw,{...a,ref:r,style:{...a.style,display:"block"}})})});function cS(e){return null!==e}lS.displayName=oS;var dS=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,s=0!==a.arrow?.centerOffset,o=s?0:e.arrowWidth,i=s?0:e.arrowHeight,[l,c]=uS(r),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+o/2,f=(a.arrow?.y??0)+i/2;let p="",m="";return"bottom"===l?(p=s?d:`${u}px`,m=-i+"px"):"top"===l?(p=s?d:`${u}px`,m=`${n.floating.height+i}px`):"right"===l?(p=-i+"px",m=s?d:`${f}px`):"left"===l&&(p=`${n.floating.width+i}px`,m=s?d:`${f}px`),{data:{x:p,y:m}}}});function uS(e){const[t,r="center"]=e.split("-");return[t,r]}var fS=Qw,pS=tS,mS=sS,hS=lS;function gS(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?td(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bS=Symbol("radix.slottable");function xS(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===bS}var yS="Popover",[vS]=Rp(yS,[Jw]),wS=Jw(),[SS,jS]=vS(yS),kS=t=>{const{__scopePopover:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:l=!1}=t,c=wS(r),d=a.useRef(null),[u,f]=a.useState(!1),[p,m]=Mp({prop:s,defaultProp:o??!1,onChange:i,caller:yS});return e.jsx(fS,{...c,children:e.jsx(SS,{scope:r,contentId:Dp(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:a.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:a.useCallback(()=>f(!0),[]),onCustomAnchorRemove:a.useCallback(()=>f(!1),[]),modal:l,children:n})})};kS.displayName=yS;var NS="PopoverAnchor";a.forwardRef((t,r)=>{const{__scopePopover:n,...s}=t,o=jS(NS,n),i=wS(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=o;return a.useEffect(()=>(l(),()=>c()),[l,c]),e.jsx(pS,{...i,...s,ref:r})}).displayName=NS;var ES="PopoverTrigger",CS=a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=jS(ES,n),o=wS(n),i=rd(r,s.triggerRef),l=e.jsx(Wp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":zS(s.open),...a,ref:i,onClick:Tp(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:e.jsx(pS,{asChild:!0,...o,children:l})});CS.displayName=ES;var AS="PopoverPortal",[_S,TS]=vS(AS,{forceMount:void 0}),RS=t=>{const{__scopePopover:r,forceMount:n,children:a,container:s}=t,o=jS(AS,r);return e.jsx(_S,{scope:r,forceMount:n,children:e.jsx(im,{present:n||o.open,children:e.jsx(om,{asChild:!0,container:s,children:a})})})};RS.displayName=AS;var PS="PopoverContent",OS=a.forwardRef((t,r)=>{const n=TS(PS,t.__scopePopover),{forceMount:a=n.forceMount,...s}=t,o=jS(PS,t.__scopePopover);return e.jsx(im,{present:a||o.open,children:o.modal?e.jsx(DS,{...s,ref:r}):e.jsx(US,{...s,ref:r})})});OS.displayName=PS;var IS=function(t){const r=gS(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(xS);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("PopoverContent.RemoveScroll"),DS=a.forwardRef((t,r)=>{const n=jS(PS,t.__scopePopover),s=a.useRef(null),o=rd(r,s),i=a.useRef(!1);return a.useEffect(()=>{const e=s.current;if(e)return sh(e)},[]),e.jsx(Xm,{as:IS,allowPinchZoom:!0,children:e.jsx(MS,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tp(t.onCloseAutoFocus,e=>{e.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Tp(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;i.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:Tp(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),US=a.forwardRef((t,r)=>{const n=jS(PS,t.__scopePopover),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(MS,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),MS=a.forwardRef((t,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...f}=t,p=jS(PS,n),m=wS(n);return dm(),e.jsx(Qp,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:e.jsx(Hp,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(mS,{"data-state":zS(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)"}})})})}),FS="PopoverClose";a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=jS(FS,n);return e.jsx(Wp.button,{type:"button",...a,ref:r,onClick:Tp(t.onClick,()=>s.onOpenChange(!1))})}).displayName=FS;function zS(e){return e?"open":"closed"}a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=wS(n);return e.jsx(hS,{...s,...a,ref:r})}).displayName="PopoverArrow";var LS=RS,WS=OS;const $S=kS,VS=CS,BS=a.forwardRef(({className:t,align:r="center",sideOffset:n=4,...s},o)=>{const{container:i}=a.useContext(cs);return e.jsx(LS,{container:i,children:e.jsx(WS,{ref:o,align:r,sideOffset:n,className:ke("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})})});function GS({options:r,value:n,onChange:a,placeholder:s="Search...",emptyLabel:o="Choose option"}){const[i,l]=t.useState(n??""),[c,d]=t.useState(!1);t.useEffect(()=>{void 0!==n&&l(n)},[n]);const u=r.find(e=>e.value===i);return e.jsxs($S,{open:c,onOpenChange:d,children:[e.jsx(VS,{asChild:!0,children:e.jsxs(Zd,{variant:"outline",role:"combobox","aria-expanded":c,className:"justify-between overflow-hidden text-ellipsis",children:[u?e.jsxs("div",{children:[String(u.label).trim(),u.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:u.icon})]}):e.jsx("span",{className:"text-muted-foreground",children:o}),e.jsx(Cd,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(BS,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Xy,{children:[e.jsx(Qy,{placeholder:s}),e.jsx(ev,{children:e.jsx(tv,{children:r.map(t=>e.jsxs(rv,{className:ke("whitespace-nowrap text-left",{"text-green-500":i===t.value}),value:t.value,defaultValue:t.value,onSelect:()=>{return e=t.value,l(e),a?.(e),void d(!1);var e},children:[i===t.value&&e.jsx(Ed,{className:ke("mr-2 h-4 w-4 text-green-400",i===t.value?"opacity-100":"opacity-0")}),String(t.label).trim(),t.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t.icon})]},t.value))})})]})})]})}BS.displayName=WS.displayName;const KS={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"},HS={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"},ZS=[{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=HS[e.code]||"USD",r=KS[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 qS({value:t,onChange:r}){const n=ZS.map(e=>({value:e.value,label:e.text,icon:e.flag}));return e.jsx(GS,{options:n,value:t,onChange:r,placeholder:"Choose country...",emptyLabel:"Choose country"})}const JS=ZS.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),YS=Array.from(new Set(JS.map(e=>e.value))).map(e=>JS.find(t=>t.value===e)).filter(e=>void 0!==e);function XS({value:t,onChange:r}){const n=YS.map(e=>({value:e.value,label:e.text,icon:e.icon??void 0}));return e.jsx(GS,{options:n,value:t,onChange:r,placeholder:"Choose currency...",emptyLabel:"Choose Currency"})}let QS=[{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:"🇮🇱"}];QS=QS.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),QS.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const ej=QS.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 tj({value:t,onChange:r}){const n=ej.map(e=>({value:e.value,label:e.label,icon:e.flag}));return e.jsx(GS,{options:n,value:t,onChange:r,placeholder:"Choose language...",emptyLabel:"Choose language"})}const rj=[{value:"Dateline Standard Time",abbr:"DST",offset:-12,isdst:!1,text:"(UTC-12:00) International Date Line West",utc:["Etc/GMT+12"]},{value:"UTC-11",abbr:"U",offset:-11,isdst:!1,text:"(UTC-11:00) Coordinated Universal Time-11",utc:["Etc/GMT+11","Pacific/Midway","Pacific/Niue","Pacific/Pago_Pago"]},{value:"Hawaiian Standard Time",abbr:"HST",offset:-10,isdst:!1,text:"(UTC-10:00) Hawaii",utc:["Etc/GMT+10","Pacific/Honolulu","Pacific/Johnston","Pacific/Rarotonga","Pacific/Tahiti"]},{value:"Alaskan Standard Time",abbr:"AKDT",offset:-8,isdst:!0,text:"(UTC-09:00) Alaska",utc:["America/Anchorage","America/Juneau","America/Nome","America/Sitka","America/Yakutat"]},{value:"Pacific Standard Time (Mexico)",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-08:00) Baja California",utc:["America/Santa_Isabel"]},{value:"Pacific Daylight Time",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-07:00) Pacific Daylight Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver"]},{value:"Pacific Standard Time",abbr:"PST",offset:-8,isdst:!1,text:"(UTC-08:00) Pacific Standard Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver","PST8PDT"]},{value:"US Mountain Standard Time",abbr:"UMST",offset:-7,isdst:!1,text:"(UTC-07:00) Arizona",utc:["America/Creston","America/Dawson","America/Dawson_Creek","America/Hermosillo","America/Phoenix","America/Whitehorse","Etc/GMT+7"]},{value:"Mountain Standard Time (Mexico)",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",utc:["America/Chihuahua","America/Mazatlan"]},{value:"Mountain Standard Time",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Mountain Time (US & Canada)",utc:["America/Boise","America/Cambridge_Bay","America/Denver","America/Edmonton","America/Inuvik","America/Ojinaga","America/Yellowknife","MST7MDT"]},{value:"Central America Standard Time",abbr:"CAST",offset:-6,isdst:!1,text:"(UTC-06:00) Central America",utc:["America/Belize","America/Costa_Rica","America/El_Salvador","America/Guatemala","America/Managua","America/Tegucigalpa","Etc/GMT+6","Pacific/Galapagos"]},{value:"Central Standard Time",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Central Time (US & Canada)",utc:["America/Chicago","America/Indiana/Knox","America/Indiana/Tell_City","America/Matamoros","America/Menominee","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Rainy_River","America/Rankin_Inlet","America/Resolute","America/Winnipeg","CST6CDT"]},{value:"Central Standard Time (Mexico)",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",utc:["America/Bahia_Banderas","America/Cancun","America/Merida","America/Mexico_City","America/Monterrey"]},{value:"Canada Central Standard Time",abbr:"CCST",offset:-6,isdst:!1,text:"(UTC-06:00) Saskatchewan",utc:["America/Regina","America/Swift_Current"]},{value:"SA Pacific Standard Time",abbr:"SPST",offset:-5,isdst:!1,text:"(UTC-05:00) Bogota, Lima, Quito",utc:["America/Bogota","America/Cayman","America/Coral_Harbour","America/Eirunepe","America/Guayaquil","America/Jamaica","America/Lima","America/Panama","America/Rio_Branco","Etc/GMT+5"]},{value:"Eastern Standard Time",abbr:"EST",offset:-5,isdst:!1,text:"(UTC-05:00) Eastern Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"Eastern Daylight Time",abbr:"EDT",offset:-4,isdst:!0,text:"(UTC-04:00) Eastern Daylight Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"US Eastern Standard Time",abbr:"UEDT",offset:-5,isdst:!1,text:"(UTC-05:00) Indiana (East)",utc:["America/Indiana/Marengo","America/Indiana/Vevay","America/Indianapolis"]},{value:"Venezuela Standard Time",abbr:"VST",offset:-4.5,isdst:!1,text:"(UTC-04:30) Caracas",utc:["America/Caracas"]},{value:"Paraguay Standard Time",abbr:"PYT",offset:-4,isdst:!1,text:"(UTC-04:00) Asuncion",utc:["America/Asuncion"]},{value:"Atlantic Standard Time",abbr:"ADT",offset:-3,isdst:!0,text:"(UTC-04:00) Atlantic Time (Canada)",utc:["America/Glace_Bay","America/Goose_Bay","America/Halifax","America/Moncton","America/Thule","Atlantic/Bermuda"]},{value:"Central Brazilian Standard Time",abbr:"CBST",offset:-4,isdst:!1,text:"(UTC-04:00) Cuiaba",utc:["America/Campo_Grande","America/Cuiaba"]},{value:"SA Western Standard Time",abbr:"SWST",offset:-4,isdst:!1,text:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",utc:["America/Anguilla","America/Antigua","America/Aruba","America/Barbados","America/Blanc-Sablon","America/Boa_Vista","America/Curacao","America/Dominica","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guyana","America/Kralendijk","America/La_Paz","America/Lower_Princes","America/Manaus","America/Marigot","America/Martinique","America/Montserrat","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Santo_Domingo","America/St_Barthelemy","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Tortola","Etc/GMT+4"]},{value:"Pacific SA Standard Time",abbr:"PSST",offset:-4,isdst:!1,text:"(UTC-04:00) Santiago",utc:["America/Santiago","Antarctica/Palmer"]},{value:"Newfoundland Standard Time",abbr:"NDT",offset:-2.5,isdst:!0,text:"(UTC-03:30) Newfoundland",utc:["America/St_Johns"]},{value:"E. South America Standard Time",abbr:"ESAST",offset:-3,isdst:!1,text:"(UTC-03:00) Brasilia",utc:["America/Sao_Paulo"]},{value:"Argentina Standard Time",abbr:"AST",offset:-3,isdst:!1,text:"(UTC-03:00) Buenos Aires",utc:["America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Buenos_Aires","America/Catamarca","America/Cordoba","America/Jujuy","America/Mendoza"]},{value:"SA Eastern Standard Time",abbr:"SEST",offset:-3,isdst:!1,text:"(UTC-03:00) Cayenne, Fortaleza",utc:["America/Araguaina","America/Belem","America/Cayenne","America/Fortaleza","America/Maceio","America/Paramaribo","America/Recife","America/Santarem","Antarctica/Rothera","Atlantic/Stanley","Etc/GMT+3"]},{value:"Greenland Standard Time",abbr:"GDT",offset:-3,isdst:!0,text:"(UTC-03:00) Greenland",utc:["America/Godthab"]},{value:"Montevideo Standard Time",abbr:"MST",offset:-3,isdst:!1,text:"(UTC-03:00) Montevideo",utc:["America/Montevideo"]},{value:"Bahia Standard Time",abbr:"BST",offset:-3,isdst:!1,text:"(UTC-03:00) Salvador",utc:["America/Bahia"]},{value:"UTC-02",abbr:"U",offset:-2,isdst:!1,text:"(UTC-02:00) Coordinated Universal Time-02",utc:["America/Noronha","Atlantic/South_Georgia","Etc/GMT+2"]},{value:"Mid-Atlantic Standard Time",abbr:"MDT",offset:-1,isdst:!0,text:"(UTC-02:00) Mid-Atlantic - Old",utc:[]},{value:"Azores Standard Time",abbr:"ADT",offset:0,isdst:!0,text:"(UTC-01:00) Azores",utc:["America/Scoresbysund","Atlantic/Azores"]},{value:"Cape Verde Standard Time",abbr:"CVST",offset:-1,isdst:!1,text:"(UTC-01:00) Cape Verde Is.",utc:["Atlantic/Cape_Verde","Etc/GMT+1"]},{value:"Morocco Standard Time",abbr:"MDT",offset:1,isdst:!0,text:"(UTC) Casablanca",utc:["Africa/Casablanca","Africa/El_Aaiun"]},{value:"UTC",abbr:"UTC",offset:0,isdst:!1,text:"(UTC) Coordinated Universal Time",utc:["America/Danmarkshavn","Etc/GMT"]},{value:"GMT Standard Time",abbr:"GMT",offset:0,isdst:!1,text:"(UTC) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"British Summer Time",abbr:"BST",offset:1,isdst:!0,text:"(UTC+01:00) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"GMT Standard Time",abbr:"GDT",offset:1,isdst:!0,text:"(UTC) Dublin, Lisbon",utc:["Atlantic/Canary","Atlantic/Faeroe","Atlantic/Madeira","Europe/Dublin","Europe/Lisbon"]},{value:"Greenwich Standard Time",abbr:"GST",offset:0,isdst:!1,text:"(UTC) Monrovia, Reykjavik",utc:["Africa/Abidjan","Africa/Accra","Africa/Bamako","Africa/Banjul","Africa/Bissau","Africa/Conakry","Africa/Dakar","Africa/Freetown","Africa/Lome","Africa/Monrovia","Africa/Nouakchott","Africa/Ouagadougou","Africa/Sao_Tome","Atlantic/Reykjavik","Atlantic/St_Helena"]},{value:"W. Europe Standard Time",abbr:"WEDT",offset:2,isdst:!0,text:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",utc:["Arctic/Longyearbyen","Europe/Amsterdam","Europe/Andorra","Europe/Berlin","Europe/Busingen","Europe/Gibraltar","Europe/Luxembourg","Europe/Malta","Europe/Monaco","Europe/Oslo","Europe/Rome","Europe/San_Marino","Europe/Stockholm","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Zurich"]},{value:"Central Europe Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",utc:["Europe/Belgrade","Europe/Bratislava","Europe/Budapest","Europe/Ljubljana","Europe/Podgorica","Europe/Prague","Europe/Tirane"]},{value:"Romance Standard Time",abbr:"RDT",offset:2,isdst:!0,text:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",utc:["Africa/Ceuta","Europe/Brussels","Europe/Copenhagen","Europe/Madrid","Europe/Paris"]},{value:"Central European Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",utc:["Europe/Sarajevo","Europe/Skopje","Europe/Warsaw","Europe/Zagreb"]},{value:"W. Central Africa Standard Time",abbr:"WCAST",offset:1,isdst:!1,text:"(UTC+01:00) West Central Africa",utc:["Africa/Algiers","Africa/Bangui","Africa/Brazzaville","Africa/Douala","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Luanda","Africa/Malabo","Africa/Ndjamena","Africa/Niamey","Africa/Porto-Novo","Africa/Tunis","Etc/GMT-1"]},{value:"Namibia Standard Time",abbr:"NST",offset:1,isdst:!1,text:"(UTC+01:00) Windhoek",utc:["Africa/Windhoek"]},{value:"GTB Standard Time",abbr:"GDT",offset:3,isdst:!0,text:"(UTC+02:00) Athens, Bucharest",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau"]},{value:"Middle East Standard Time",abbr:"MEDT",offset:3,isdst:!0,text:"(UTC+02:00) Beirut",utc:["Asia/Beirut"]},{value:"Egypt Standard Time",abbr:"EST",offset:2,isdst:!1,text:"(UTC+02:00) Cairo",utc:["Africa/Cairo"]},{value:"Syria Standard Time",abbr:"SDT",offset:3,isdst:!0,text:"(UTC+02:00) Damascus",utc:["Asia/Damascus"]},{value:"E. Europe Standard Time",abbr:"EEDT",offset:3,isdst:!0,text:"(UTC+02:00) E. Europe",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau","Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Nicosia","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"South Africa Standard Time",abbr:"SAST",offset:2,isdst:!1,text:"(UTC+02:00) Harare, Pretoria",utc:["Africa/Blantyre","Africa/Bujumbura","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Kigali","Africa/Lubumbashi","Africa/Lusaka","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Etc/GMT-2"]},{value:"FLE Standard Time",abbr:"FDT",offset:3,isdst:!0,text:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",utc:["Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"Turkey Standard Time",abbr:"TDT",offset:3,isdst:!1,text:"(UTC+03:00) Istanbul",utc:["Europe/Istanbul"]},{value:"Israel Standard Time",abbr:"JDT",offset:3,isdst:!0,text:"(UTC+02:00) Jerusalem",utc:["Asia/Jerusalem"]},{value:"Libya Standard Time",abbr:"LST",offset:2,isdst:!1,text:"(UTC+02:00) Tripoli",utc:["Africa/Tripoli"]},{value:"Jordan Standard Time",abbr:"JST",offset:3,isdst:!1,text:"(UTC+03:00) Amman",utc:["Asia/Amman"]},{value:"Arabic Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Baghdad",utc:["Asia/Baghdad"]},{value:"Kaliningrad Standard Time",abbr:"KST",offset:3,isdst:!1,text:"(UTC+02:00) Kaliningrad",utc:["Europe/Kaliningrad"]},{value:"Arab Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Kuwait, Riyadh",utc:["Asia/Aden","Asia/Bahrain","Asia/Kuwait","Asia/Qatar","Asia/Riyadh"]},{value:"E. Africa Standard Time",abbr:"EAST",offset:3,isdst:!1,text:"(UTC+03:00) Nairobi",utc:["Africa/Addis_Ababa","Africa/Asmera","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Mogadishu","Africa/Nairobi","Antarctica/Syowa","Etc/GMT-3","Indian/Antananarivo","Indian/Comoro","Indian/Mayotte"]},{value:"Moscow Standard Time",abbr:"MSK",offset:3,isdst:!1,text:"(UTC+03:00) Moscow, St. Petersburg, Volgograd, Minsk",utc:["Europe/Kirov","Europe/Moscow","Europe/Simferopol","Europe/Volgograd","Europe/Minsk"]},{value:"Samara Time",abbr:"SAMT",offset:4,isdst:!1,text:"(UTC+04:00) Samara, Ulyanovsk, Saratov",utc:["Europe/Astrakhan","Europe/Samara","Europe/Ulyanovsk"]},{value:"Iran Standard Time",abbr:"IDT",offset:4.5,isdst:!0,text:"(UTC+03:30) Tehran",utc:["Asia/Tehran"]},{value:"Arabian Standard Time",abbr:"AST",offset:4,isdst:!1,text:"(UTC+04:00) Abu Dhabi, Muscat",utc:["Asia/Dubai","Asia/Muscat","Etc/GMT-4"]},{value:"Azerbaijan Standard Time",abbr:"ADT",offset:5,isdst:!0,text:"(UTC+04:00) Baku",utc:["Asia/Baku"]},{value:"Mauritius Standard Time",abbr:"MST",offset:4,isdst:!1,text:"(UTC+04:00) Port Louis",utc:["Indian/Mahe","Indian/Mauritius","Indian/Reunion"]},{value:"Georgian Standard Time",abbr:"GET",offset:4,isdst:!1,text:"(UTC+04:00) Tbilisi",utc:["Asia/Tbilisi"]},{value:"Caucasus Standard Time",abbr:"CST",offset:4,isdst:!1,text:"(UTC+04:00) Yerevan",utc:["Asia/Yerevan"]},{value:"Afghanistan Standard Time",abbr:"AST",offset:4.5,isdst:!1,text:"(UTC+04:30) Kabul",utc:["Asia/Kabul"]},{value:"West Asia Standard Time",abbr:"WAST",offset:5,isdst:!1,text:"(UTC+05:00) Ashgabat, Tashkent",utc:["Antarctica/Mawson","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Dushanbe","Asia/Oral","Asia/Samarkand","Asia/Tashkent","Etc/GMT-5","Indian/Kerguelen","Indian/Maldives"]},{value:"Yekaterinburg Time",abbr:"YEKT",offset:5,isdst:!1,text:"(UTC+05:00) Yekaterinburg",utc:["Asia/Yekaterinburg"]},{value:"Pakistan Standard Time",abbr:"PKT",offset:5,isdst:!1,text:"(UTC+05:00) Islamabad, Karachi",utc:["Asia/Karachi"]},{value:"India Standard Time",abbr:"IST",offset:5.5,isdst:!1,text:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",utc:["Asia/Kolkata","Asia/Calcutta"]},{value:"Sri Lanka Standard Time",abbr:"SLST",offset:5.5,isdst:!1,text:"(UTC+05:30) Sri Jayawardenepura",utc:["Asia/Colombo"]},{value:"Nepal Standard Time",abbr:"NST",offset:5.75,isdst:!1,text:"(UTC+05:45) Kathmandu",utc:["Asia/Kathmandu"]},{value:"Central Asia Standard Time",abbr:"CAST",offset:6,isdst:!1,text:"(UTC+06:00) Nur-Sultan (Astana)",utc:["Antarctica/Vostok","Asia/Almaty","Asia/Bishkek","Asia/Qyzylorda","Asia/Urumqi","Etc/GMT-6","Indian/Chagos"]},{value:"Bangladesh Standard Time",abbr:"BST",offset:6,isdst:!1,text:"(UTC+06:00) Dhaka",utc:["Asia/Dhaka","Asia/Thimphu"]},{value:"Myanmar Standard Time",abbr:"MST",offset:6.5,isdst:!1,text:"(UTC+06:30) Yangon (Rangoon)",utc:["Asia/Rangoon","Indian/Cocos"]},{value:"SE Asia Standard Time",abbr:"SAST",offset:7,isdst:!1,text:"(UTC+07:00) Bangkok, Hanoi, Jakarta",utc:["Antarctica/Davis","Asia/Bangkok","Asia/Hovd","Asia/Jakarta","Asia/Phnom_Penh","Asia/Pontianak","Asia/Saigon","Asia/Vientiane","Etc/GMT-7","Indian/Christmas"]},{value:"N. Central Asia Standard Time",abbr:"NCAST",offset:7,isdst:!1,text:"(UTC+07:00) Novosibirsk",utc:["Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk"]},{value:"China Standard Time",abbr:"CST",offset:8,isdst:!1,text:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",utc:["Asia/Hong_Kong","Asia/Macau","Asia/Shanghai"]},{value:"North Asia Standard Time",abbr:"NAST",offset:8,isdst:!1,text:"(UTC+08:00) Krasnoyarsk",utc:["Asia/Krasnoyarsk"]},{value:"Singapore Standard Time",abbr:"MPST",offset:8,isdst:!1,text:"(UTC+08:00) Kuala Lumpur, Singapore",utc:["Asia/Brunei","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Makassar","Asia/Manila","Asia/Singapore","Etc/GMT-8"]},{value:"W. Australia Standard Time",abbr:"WAST",offset:8,isdst:!1,text:"(UTC+08:00) Perth",utc:["Antarctica/Casey","Australia/Perth"]},{value:"Taipei Standard Time",abbr:"TST",offset:8,isdst:!1,text:"(UTC+08:00) Taipei",utc:["Asia/Taipei"]},{value:"Ulaanbaatar Standard Time",abbr:"UST",offset:8,isdst:!1,text:"(UTC+08:00) Ulaanbaatar",utc:["Asia/Choibalsan","Asia/Ulaanbaatar"]},{value:"North Asia East Standard Time",abbr:"NAEST",offset:8,isdst:!1,text:"(UTC+08:00) Irkutsk",utc:["Asia/Irkutsk"]},{value:"Japan Standard Time",abbr:"JST",offset:9,isdst:!1,text:"(UTC+09:00) Osaka, Sapporo, Tokyo",utc:["Asia/Dili","Asia/Jayapura","Asia/Tokyo","Etc/GMT-9","Pacific/Palau"]},{value:"Korea Standard Time",abbr:"KST",offset:9,isdst:!1,text:"(UTC+09:00) Seoul",utc:["Asia/Pyongyang","Asia/Seoul"]},{value:"Cen. Australia Standard Time",abbr:"CAST",offset:9.5,isdst:!1,text:"(UTC+09:30) Adelaide",utc:["Australia/Adelaide","Australia/Broken_Hill"]},{value:"AUS Central Standard Time",abbr:"ACST",offset:9.5,isdst:!1,text:"(UTC+09:30) Darwin",utc:["Australia/Darwin"]},{value:"E. Australia Standard Time",abbr:"EAST",offset:10,isdst:!1,text:"(UTC+10:00) Brisbane",utc:["Australia/Brisbane","Australia/Lindeman"]},{value:"AUS Eastern Standard Time",abbr:"AEST",offset:10,isdst:!1,text:"(UTC+10:00) Canberra, Melbourne, Sydney",utc:["Australia/Melbourne","Australia/Sydney"]},{value:"West Pacific Standard Time",abbr:"WPST",offset:10,isdst:!1,text:"(UTC+10:00) Guam, Port Moresby",utc:["Antarctica/DumontDUrville","Etc/GMT-10","Pacific/Guam","Pacific/Port_Moresby","Pacific/Saipan","Pacific/Truk"]},{value:"Tasmania Standard Time",abbr:"TST",offset:10,isdst:!1,text:"(UTC+10:00) Hobart",utc:["Australia/Currie","Australia/Hobart"]},{value:"Yakutsk Standard Time",abbr:"YST",offset:9,isdst:!1,text:"(UTC+09:00) Yakutsk",utc:["Asia/Chita","Asia/Khandyga","Asia/Yakutsk"]},{value:"Central Pacific Standard Time",abbr:"CPST",offset:11,isdst:!1,text:"(UTC+11:00) Solomon Is., New Caledonia",utc:["Antarctica/Macquarie","Etc/GMT-11","Pacific/Efate","Pacific/Guadalcanal","Pacific/Kosrae","Pacific/Noumea","Pacific/Ponape"]},{value:"Vladivostok Standard Time",abbr:"VST",offset:11,isdst:!1,text:"(UTC+11:00) Vladivostok",utc:["Asia/Sakhalin","Asia/Ust-Nera","Asia/Vladivostok"]},{value:"New Zealand Standard Time",abbr:"NZST",offset:12,isdst:!1,text:"(UTC+12:00) Auckland, Wellington",utc:["Antarctica/McMurdo","Pacific/Auckland"]},{value:"UTC+12",abbr:"U",offset:12,isdst:!1,text:"(UTC+12:00) Coordinated Universal Time+12",utc:["Etc/GMT-12","Pacific/Funafuti","Pacific/Kwajalein","Pacific/Majuro","Pacific/Nauru","Pacific/Tarawa","Pacific/Wake","Pacific/Wallis"]},{value:"Fiji Standard Time",abbr:"FST",offset:12,isdst:!1,text:"(UTC+12:00) Fiji",utc:["Pacific/Fiji"]},{value:"Magadan Standard Time",abbr:"MST",offset:12,isdst:!1,text:"(UTC+12:00) Magadan",utc:["Asia/Anadyr","Asia/Kamchatka","Asia/Magadan","Asia/Srednekolymsk"]},{value:"Kamchatka Standard Time",abbr:"KDT",offset:13,isdst:!0,text:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",utc:["Asia/Kamchatka"]},{value:"Tonga Standard Time",abbr:"TST",offset:13,isdst:!1,text:"(UTC+13:00) Nuku'alofa",utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]},{value:"Samoa Standard Time",abbr:"SST",offset:13,isdst:!1,text:"(UTC+13:00) Samoa",utc:["Pacific/Apia"]}].filter(e=>e.utc.length).reduce((e,t)=>{let r=t.utc;for(let n=0;n<r.length;n++){const a=r[n],s=t.text;let o=s.substring(s.indexOf("(")+1,s.indexOf(")"));-1!==o.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${o}) ${a}`,utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]})}return e},[]).filter((e,t,r)=>t===r.findIndex(t=>t.value===e.value));function nj({value:t,onChange:r}){const n=rj.map(e=>({value:e.value,label:e.text}));return e.jsx(GS,{options:n,value:t,onChange:r,placeholder:"Choose timezone...",emptyLabel:"Choose timezone"})}const aj=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=or(),[s,o]=t.useState(!1),[i,l]=t.useState(),[c,d]=t.useState(0),[u,f]=t.useState(null),p=t.useRef(null);t.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const m=Go({resolver:Qc(ff({name:Fu().min(2,{message:"Name must be at least 2 characters."}),country:Fu().optional(),timezone:Fu().optional(),language:Fu().optional(),currency:Fu().optional()})),defaultValues:{name:i?.name||"",country:i?.country||"",timezone:i?.timezone||"",language:i?.language||"",currency:i?.currency||""}});return t.useEffect(()=>{a().then(e=>{l(e),m.setValue("name",e.name),m.setValue("country",e.country),m.setValue("timezone",e.timezone),m.setValue("language",e.language),m.setValue("currency",e.currency)})},[c]),i?e.jsxs("div",{children:[u&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:u})]}),e.jsx("div",{className:"space-y-4",children:e.jsx(eu,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(async function(e){o(!0),f(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),f("Profile saved successfully"),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{f(null)},5e3)}catch(e){De(e,{component:"WorkspaceSettingsProfile",action:"updateUserProfile",metadata:{workspaceId:r._id}})}finally{o(!1)}}),className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Email"}),e.jsx(du,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:i?.email})]}),e.jsx(ru,{disabled:s,control:m.control,name:"name",render:({field:t})=>e.jsxs(su,{children:[e.jsx(ou,{children:"Name"}),e.jsx(iu,{children:e.jsx(du,{...t})}),e.jsx(cu,{})]})}),e.jsxs("div",{className:"flex gap-y-2 my-4 flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Language"}),e.jsx(tj,{value:m.watch("language"),onChange:e=>{m.setValue("language",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Country"}),e.jsx(qS,{value:m.watch("country"),onChange:e=>{m.setValue("country",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Currency"}),e.jsx(XS,{value:m.watch("currency"),onChange:e=>{m.setValue("currency",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Timezone"}),e.jsx(nj,{value:m.watch("timezone"),onChange:e=>{m.setValue("timezone",e)}})]})]}),e.jsxs("div",{className:"flex justify-end gap-x-2",children:[e.jsx(Zd,{type:"submit",progress:s,disabled:s,children:"Save"}),e.jsx(Zd,{type:"button",variant:"outline",onClick:()=>{d(e=>e+1)},disabled:s,children:"Reset"})]})]})})}),i?.image&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),e.jsx("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:e.jsx("img",{src:i.image,alt:i.name,className:"w-full h-full object-cover"})})]})]}):e.jsx(Wx,{})};function sj(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 oj(e,t,r){const n=sj(e,t);if(!n?.basePricing)return null;const a=n.basePricing[r];return null!=a?a:null}function ij(e,t,r){const n=sj(e,t);if(!n?.stripePrices)return null;const a="monthly"===r?"monthlyPriceId":"yearly"===r?"yearlyPriceId":"quarterlyPriceId",s="monthly"===r?"monthly":"yearly"===r?"yearly":void 0;return n.stripePrices[a]??(s?n.stripePrices[s]:void 0)??null}function lj(e,t,r,n){const a=sj(e,t),s=a?.quotaOverages?.[r];if(s)return s[n]}function cj(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 dj(e,t,r,n){const a=e.quotas?.[r];if(null==a)return null;const s=a[n];if(!s)return null;const o=lj(e,t,r,n);return{included:s.included,...void 0!==s.unitSize&&{unitSize:s.unitSize},...void 0!==o&&{overage:o}}}function uj(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 fj(e,t){const r=sj(e,t);return r?.seatPricing?.enabled?r.seatPricing:null}function pj(e,t,r){const n=fj(e,t);return n?.perSeat?n.perSeat[r]??null:null}function mj(e,t){return Math.max(0,e-(t||0))}function hj(e,t,r,n){const a=fj(e,t);if(!a)return null;return mj(n,a.includedSeats)*(pj(e,t,r)??0)}function gj(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 bj(e,t,r={}){const{overageInCents:n=!0,currency:a}=r,s=r.currencySymbol??sy(a??"");if(null==e)return"—";const{included:o,overage:i}=e,l=`${o} included`;if(null==i)return l;const c=n?i/100:i;return`${l}, then ${s}${"number"==typeof c&&Number.isFinite(c)?c.toFixed(2):String(i)}${t&&"unitSize"in e&&null!=e.unitSize&&e.unitSize>0?` / ${e.unitSize.toLocaleString()} ${t}`:t?` / ${t}`:""}`}const xj=(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)},yj=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"}},vj=({workspaceId:t,hasActiveSubscription:r=!1,onViewPricingPlans:n,limit:a=20})=>{const{invoices:s,loading:o,error:i,refetch:l}=gr(t,a),c=s.length>0;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Billing History"}),e.jsx("p",{className:"text-sm text-gray-600",children:"View and download your invoices"})]}),e.jsx(Zd,{variant:"ghost",size:"sm",progress:o,onClick:l,disabled:o,children:o?"Refreshing...":"Refresh"})]}),i&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading invoices"}),e.jsx("p",{className:"text-sm mt-1",children:i})]}),e.jsx(Zd,{variant:"outline",size:"sm",onClick:l,disabled:o,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:o?"Retrying...":"Retry"})]}),o&&!c?e.jsx("div",{className:"border rounded-lg p-6",children:e.jsx(Wx,{})}):c?e.jsx("div",{className:"space-y-2",children:s.map(t=>{const r=(e=>{switch(e.status){case"draft":case"open":return{text:"Pay",color:"bg-blue-600 hover:bg-blue-700"};case"paid":return{text:"View",color:"bg-green-600 hover:bg-green-700"};case"uncollectible":case"void":return{text:"View Details",color:"bg-gray-600 hover:bg-gray-700"};default:return{text:"View",color:"bg-gray-600 hover:bg-gray-700"}}})(t);return e.jsxs("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 truncate min-w-0",children:t.description||t.number||`Invoice ${t.id.slice(-8)}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium shrink-0 ${yj(t.status)}`,children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5 text-sm text-gray-600 mb-2.5",children:[e.jsx("span",{className:"font-medium text-gray-900",children:xj(t.amount_due,t.currency)}),t.created&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300 hidden sm:inline",children:"·"}),e.jsx("span",{children:(n=t.created,n?new Date(1e3*n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A")})]}),t.amount_paid>0&&t.amount_due>0&&e.jsxs("span",{className:"text-xs text-gray-500",children:["Paid: ",xj(t.amount_paid,t.currency)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Zd,{size:"sm",disabled:!t.hosted_invoice_url,onClick:()=>t.hosted_invoice_url&&window.open(t.hosted_invoice_url,"_blank","noopener,noreferrer"),className:r.color,children:[r.text,e.jsx(Td,{className:"h-3 w-3 ml-1.5"})]}),t.invoice_pdf&&e.jsxs(Zd,{size:"sm",variant:"outline",onClick:()=>window.open(t.invoice_pdf,"_blank","noopener,noreferrer"),children:[e.jsx(_d,{className:"h-3 w-3 mr-1.5"}),"PDF"]})]})]},t.id);var n})}):e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsx(Rd,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-sm text-gray-500",children:r?"No invoices with download option found":"No invoices yet. Subscribe to a plan to receive invoices."}),!r&&n&&e.jsx(Zd,{size:"sm",className:"mt-4",onClick:n,children:"View Pricing Plans"})]})]})},wj=t.lazy(()=>Promise.resolve().then(function(){return lN}).then(e=>({default:e.default}))),Sj=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""}},jj=({workspace:r})=>{const n=r._id?.toString(),{subscription:a,loading:s,error:o,updateSubscription:i,refetch:l}=hr(n),{createCheckoutSession:c}=pr(n),{cancelSubscription:d,loading:u}=xr(n),{resumeSubscription:f,loading:p}=yr(n),{openBillingPortal:m,loading:h}=br(n),{versions:g,loading:b,error:x,refetch:y}=fr(n),v=s||b,w=o||x,{currentVersion:S,latestVersion:j,isDeprecated:k,whatsNew:N,plansToShow:E}=t.useMemo(()=>{const e=g?.currentVersion,t=g?.availableVersions||[],r=null!=a?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const s=!!(r&&n&&e)&&n.version>e.version,o=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:s,isDeprecated:s&&r,whatsNew:n?.whatsNew,plansToShow:o}},[g,a?.subscription]),[C,A]=t.useState(!1),[_,T]=t.useState(null),[R,P]=t.useState(null),O=t.useRef(null),[I,D]=t.useState(!1),[U,M]=t.useState(!1);t.useEffect(()=>()=>{O.current&&clearTimeout(O.current)},[]);const[F,z]=t.useState(!1),[L,W]=t.useState("subscription"),$=async()=>{await Promise.all([l(),y()])},V=t.useMemo(()=>uj(a?.subscription?.stripePriceId,E??[]),[a?.subscription?.stripePriceId,E]);if(v&&!a&&!g)return e.jsx(Wx,{});const B=a?.planVersion?._id||null;return n?e.jsxs("div",{className:"space-y-6",children:[w&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading subscription data"}),e.jsx("p",{className:"text-sm mt-1",children:w}),e.jsx("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try again."})]}),e.jsx(Zd,{variant:"outline",size:"sm",onClick:$,disabled:v,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:v?"Retrying...":"Retry"})]}),_&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Update failed"}),e.jsx("p",{className:"text-sm mt-1",children:_})]}),e.jsx(Zd,{variant:"outline",size:"sm",onClick:()=>T(null),className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:"Dismiss"})]}),R&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm mt-1",children:R})]}),e.jsx(Zd,{variant:"outline",size:"sm",onClick:()=>P(null),className:"flex-shrink-0 border-green-200 text-green-700 hover:bg-green-100",children:"Dismiss"})]}),e.jsx("div",{className:"border-b border-gray-200",children:e.jsxs("nav",{className:"-mb-px flex gap-6","aria-label":"Subscription tabs",children:[e.jsx("button",{type:"button",onClick:()=>W("subscription"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("subscription"===L?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Plan"}),e.jsx("button",{type:"button",onClick:()=>W("invoices"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("invoices"===L?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Invoices"})]})}),"subscription"===L&&e.jsxs(e.Fragment,{children:[v&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(Od,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading subscription and pricing plans..."})]}),k&&a?.subscription&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg px-4 py-3 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Bd,{className:"h-4 w-4 text-amber-600 shrink-0"}),e.jsxs("span",{className:"text-sm text-amber-800",children:[e.jsx("span",{className:"font-medium",children:"Plan update available"}),e.jsxs("span",{className:"text-amber-600",children:[" ","— v",S?.version||"?"," → v",j?.version||"?"]})]})]}),e.jsx(Zd,{size:"sm",variant:"outline",className:"shrink-0 border-amber-300 text-amber-700 hover:bg-amber-100",onClick:()=>D(!0),children:"View Plans"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("p",{className:"text-sm text-gray-600",children:"Manage your plan and billing"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[a?.subscription?.cancelAtPeriodEnd||u?null:a?.subscription?e.jsx(Zd,{variant:"outline",size:"sm",onClick:()=>D(!0),children:"Change Plan"}):!a?.subscription&&E&&E.length>0?e.jsx(Zd,{size:"sm",onClick:()=>D(!0),children:"View Pricing Plans"}):null,e.jsx(Zd,{variant:"ghost",size:"sm",progress:v,onClick:$,disabled:v||C,children:v?"Refreshing...":"Refresh"})]})]}),a?.subscription?(()=>{const t=uj(a.subscription.stripePriceId,E??[]),n=t?.interval??null,s=t?.currency??a.plan?.currency??r?.billingCurrency??"",o=n&&a.planVersion?oj(a.planVersion,s,n):null,i=s,l=a.planVersion?fj(a.planVersion,s):null,c=l&&n?pj(a.planVersion,s,n):null,d=Array.isArray(r?.users)?r.users.length:1,f=l?.includedSeats??0,g=Math.max(0,d-f),b=null!=o?0===o?"Free":ly(o,i):null,x="monthly"===n?"/month":"quarterly"===n?"/quarter":"yearly"===n?"/year":"";return e.jsxs("div",{className:"border rounded-lg overflow-hidden "+(k?"border-amber-300":"border-gray-200"),children:["trialing"===a.subscription.subscriptionStatus&&(()=>{const t=a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd,r=t?new Date(t):null,n=r&&!isNaN(r.getTime())?r:null,s=n?Math.max(0,Math.ceil((n.getTime()-Date.now())/864e5)):null,o=null!==s&&s<=3;return e.jsxs("div",{className:"px-4 py-3 sm:px-5 text-sm flex flex-col sm:flex-row sm:items-center justify-between gap-2 "+(o?"bg-amber-50 text-amber-800 border-b border-amber-200":"bg-blue-50 text-blue-800 border-b border-blue-200"),children:[e.jsxs("span",{children:[null!==s&&s<=0?"Your trial has ended.":null!==s?`Your trial ends in ${s} day${1===s?"":"s"}.`:"You are on a trial."," ","Upgrade to keep access."]}),e.jsx(Zd,{size:"sm",variant:o?"default":"outline",className:"shrink-0 "+(o?"":"border-blue-300 text-blue-700 hover:bg-blue-100"),onClick:()=>D(!0),children:"Upgrade Now"})]})})(),e.jsxs("div",{className:"p-4 sm:p-5 "+(k?"bg-amber-50/50":"bg-gray-50/50"),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:a.plan?.name||"No plan assigned"}),e.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium "+("active"===a.subscription.subscriptionStatus?a.subscription.cancelAtPeriodEnd?"bg-amber-100 text-amber-800":"bg-green-100 text-green-800":"trialing"===a.subscription.subscriptionStatus?"bg-blue-100 text-blue-800":"canceled"===a.subscription.subscriptionStatus?"bg-gray-100 text-gray-800":"bg-red-100 text-red-800"),children:["active"===a.subscription.subscriptionStatus&&(a.subscription.cancelAtPeriodEnd?"Canceling":"Active"),"trialing"===a.subscription.subscriptionStatus&&"Trial","canceled"===a.subscription.subscriptionStatus&&"Canceled","past_due"===a.subscription.subscriptionStatus&&"Past Due"]}),"trialing"===a.subscription.subscriptionStatus&&Sj(a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("span",{className:"text-xs text-gray-500",children:["(ends"," ",Sj(a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd),")"]}),k&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800",children:[e.jsx(Bd,{className:"h-3 w-3"}),"Deprecated"]})]}),a.plan?.description&&e.jsx("p",{className:"text-sm text-gray-600 mb-3",children:a.plan.description}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-gray-900",children:b||"N/A"}),b&&"Free"!==b&&x&&e.jsx("span",{className:"text-sm text-gray-500",children:x})]}),l&&c&&c>0&&e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["+ ",ly(c,i),"/seat",x]}),l&&c&&c>0&&g>0&&b&&"Free"!==b&&null!=o&&e.jsxs("div",{className:"text-xs text-gray-500 mt-1 pt-1 border-t border-gray-200",children:["Est. total:"," ",e.jsxs("span",{className:"font-medium text-gray-700",children:[ly(o+c*g,i),x]}),e.jsxs("span",{className:"text-gray-400",children:[" ","(",g," extra seat",1!==g?"s":"",")"]})]})]}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus)&&!a.subscription.cancelAtPeriodEnd&&Sj(a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[e.jsx(kd,{className:"h-3.5 w-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Next billing:"," ",e.jsx("span",{className:"font-medium text-gray-700",children:Sj(a.subscription.stripeCurrentPeriodEnd)})]})]})]}),k&&e.jsxs("p",{className:"text-xs text-amber-600 mt-2",children:["Version ",S?.version||"N/A"," - A newer version is available"]}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus||"past_due"===a.subscription.subscriptionStatus)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3 mt-4 pt-4 border-t border-gray-200",children:[a.subscription&&e.jsx(Zd,{variant:"outline",size:"sm",onClick:()=>m(),disabled:h,progress:h,children:h?"Opening...":"Manage Payment"}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus)&&e.jsx(e.Fragment,{children:"active"===a.subscription.subscriptionStatus&&a.subscription.cancelAtPeriodEnd?e.jsx(Zd,{variant:"outline",size:"sm",onClick:()=>z(!0),disabled:C||u||p,progress:p,children:"Resume Subscription"}):e.jsx(Zd,{variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200",onClick:()=>M(!0),disabled:C||u||p,progress:u||C,children:u||C?"Canceling...":"trialing"===a.subscription.subscriptionStatus?"Cancel Trial":"Cancel Subscription"})})]})]}),"past_due"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Bd,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800",children:"Payment past due"}),e.jsx("p",{className:"text-sm text-red-700 mt-0.5",children:"Please update your payment method to avoid service interruption. Check your invoices for details."}),e.jsx(Zd,{variant:"outline",size:"sm",className:"mt-2 border-red-200 text-red-700 hover:bg-red-100",onClick:()=>W("invoices"),children:"View Invoices"})]})]})}),"past_due"===a.subscription.subscriptionStatus&&a.subscription.dunningState&&"none"!==a.subscription.dunningState&&e.jsx("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Bd,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800",children:"final"===a.subscription.dunningState?"Final warning: Subscription will be suspended":"suspended"===a.subscription.dunningState?"Subscription suspended":"Payment recovery in progress"}),e.jsx("p",{className:"text-sm text-red-700 mt-0.5",children:"suspended"===a.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"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"px-5 py-3 bg-blue-50 border-t border-blue-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(kd,{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-blue-800",children:"Subscription paused"}),e.jsx("p",{className:"text-sm text-blue-700 mt-0.5",children:"Your subscription is currently paused. Resume to restore full access."})]})]})}),a.subscription.cancelAtPeriodEnd&&e.jsx("div",{className:"px-5 py-3 bg-amber-50 border-t border-amber-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(kd,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-amber-800",children:"Subscription scheduled for cancellation"}),e.jsx("p",{className:"text-sm text-amber-700 mt-0.5",children:Sj(a.subscription.stripeCurrentPeriodEnd)?e.jsxs(e.Fragment,{children:["Your subscription will end on"," ",e.jsx("span",{className:"font-medium",children:Sj(a.subscription.stripeCurrentPeriodEnd)}),". You'll retain access until then and won't be charged again."]}):"Your subscription will be canceled at the end of the current billing period. You won't be charged again."})]})]})}),a.planVersion&&(()=>{const t=((e,t,r="monthly")=>{if(!e?.subscriptionItems)return{features:[],limits:[],quotas:[]};const n=[],a=[],s=[];return e.subscriptionItems.forEach(o=>{const i=o.slug;if("feature"===o.type){const t=e.features?.[i]??!1;n.push({item:o,enabled:t})}else if("limit"===o.type){const t=e.limits?.[i]??0;a.push({item:o,value:t})}else if("quota"===o.type){const n=t&&e.pricingVariants?.length?dj(e,t,i,r):gj(e.quotas?.[i],r);null!=n&&s.push({item:o,value:n})}}),{features:n,limits:a,quotas:s}})(a.planVersion,s,n??"monthly");return t.features.length>0||t.limits.length>0||t.quotas.length>0?e.jsx("div",{className:"px-4 py-4 sm:px-5 sm:py-5 border-t border-gray-100",children:e.jsxs("div",{className:"space-y-5",children:[t.features.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Features"}),e.jsx("ul",{className:"space-y-1.5",children:t.features.sort(e=>e.enabled?-1:1).map(({item:t,enabled:r})=>e.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"w-4 text-center shrink-0 "+(r?"text-green-500":"text-gray-300"),children:r?"✓":"✕"}),e.jsx("span",{className:r?"text-gray-700":"text-gray-400",children:t.name})]},t._id))})]}),t.limits.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Limits"}),e.jsx("ul",{className:"space-y-1.5",children:t.limits.map(({item:t,value:r})=>e.jsxs("li",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900",children:r})]},t._id))})]}),t.quotas.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Usage Quotas"}),e.jsx("ul",{className:"space-y-1.5",children:t.quotas.map(({item:t,value:r})=>{const n=bj(r,t.name.toLowerCase(),{currency:s});return e.jsx("li",{className:"text-sm",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-0.5",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900 text-xs sm:text-sm",children:n})]})},t._id)})})]}),l&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Seats"}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Members"}),e.jsx("span",{className:"font-semibold text-gray-900",children:d})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Included"}),e.jsx("span",{className:"text-gray-900",children:f})]}),g>0&&e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Billable"}),e.jsxs("span",{className:"font-medium text-amber-600",children:[g," extra"]})]}),c&&c>0&&e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Per extra seat"}),e.jsxs("span",{className:"text-gray-900",children:[ly(c,s),x]})]}),l.maxSeats>0&&e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Limit"}),e.jsx("span",{className:"text-gray-900",children:l.maxSeats})]})]})]})]})}):null})()]})})():r.pendingOnboarding?e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(Ad,{className:"h-12 w-12 mx-auto mb-3 text-blue-400"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"Start your free trial"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Try the full plan with no commitment. You can upgrade or cancel anytime."})]}),e.jsx(Zd,{size:"sm",progress:C,onClick:async()=>{try{A(!0);const e=await c({planVersionId:r.pendingOnboarding?.planVersionId??""});e&&"checkoutUrl"in e&&e.checkoutUrl&&(window.location.href=e.checkoutUrl)}catch(e){}finally{A(!1)}},children:"Start Free Trial"}),E&&E.length>0&&e.jsx(Zd,{variant:"ghost",size:"sm",className:"ml-2",onClick:()=>D(!0),children:"View All Plans"})]}):e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(Ad,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]}),E&&E.length>0&&e.jsx(Zd,{size:"sm",onClick:()=>D(!0),children:"View Pricing Plans"})]})]}),!g&&!v&&e.jsxs("div",{className:"border rounded-lg p-4 text-center",children:[e.jsxs("div",{className:"text-gray-500 mb-2",children:[e.jsx("p",{className:"font-medium",children:"Unable to load plan information"}),w&&e.jsxs("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",w]}),!w&&e.jsx("p",{className:"text-sm mt-2",children:"No plan groups are available for this workspace. Please contact support if you believe this is an error."})]}),e.jsx(Zd,{variant:"outline",size:"sm",progress:v,onClick:$,disabled:v,className:"mt-4",children:v?"Refreshing...":"Refresh"})]})]}),"invoices"===L&&e.jsxs(e.Fragment,{children:[v&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(Od,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading invoices..."})]}),e.jsx(vj,{workspaceId:n,hasActiveSubscription:null!==a?.subscription,onViewPricingPlans:()=>W("subscription"),limit:20})]}),E&&E.length>0&&e.jsx(t.Suspense,{fallback:I?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Od,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading plans..."})]})}):null,children:e.jsx(wj,{open:I,onOpenChange:D,planVersions:E,currentPlanVersionId:B||null,currentStripePriceId:a?.subscription?.stripePriceId,billingCurrency:r.billingCurrency,currentMemberCount:Array.isArray(r?.users)?r.users.length:void 0,onSelectPlan:async(e,t="monthly",s)=>{if(!n)return;const o=E?.find(t=>t._id===e),l=s??V?.currency??a?.plan?.currency??r?.billingCurrency??"",d=o?ij(o,l,t):null,u=a?.subscription?.stripePriceId;if(!d||!u||d!==u){A(!0),T(null),P(null);try{let r,n,s;try{const e=new URL(window.location.href);r=e.toString(),n=e.toString()}catch{const e=window.location.protocol||"https:",t=window.location.host||window.location.hostname||"",a=`${e}//${t}${window.location.pathname||"/"}`;r=a,n=a}if(s=a?.subscription?await i(e,{billingInterval:t,successUrl:r,cancelUrl:n}):await c({planVersionId:e,billingInterval:t,currency:l||void 0,successUrl:r,cancelUrl:n}),s&&"checkoutUrl"in s&&s.checkoutUrl)return void(window.location.href=s.checkoutUrl);P("Subscription updated successfully!"),await $()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";T(t)}finally{A(!1),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{T(null),P(null)},5e3)}}},loading:C||v})}),e.jsx(Tx,{open:F,onOpenChange:z,children:e.jsxs(Ix,{children:[e.jsxs(Dx,{children:[e.jsx(Mx,{children:"Resume Subscription"}),e.jsx(Fx,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to resume your subscription?"}),e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Bd,{className:"h-4 w-4 text-amber-600 mt-0.5 flex-shrink-0"}),e.jsxs("span",{children:["You will be charged again on"," ",a?.subscription?.stripeCurrentPeriodEnd&&Sj(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:Sj(a.subscription.stripeCurrentPeriodEnd)}):"the next billing date"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-600 mt-0.5",children:"•"}),e.jsx("span",{children:"Your subscription will continue automatically and you'll be billed according to your plan"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"ℹ"}),e.jsx("span",{children:"You can cancel anytime before the next billing date if you change your mind"})]})]})]})})]}),e.jsxs(Ux,{children:[e.jsx(Lx,{disabled:p,children:"Keep Canceled"}),e.jsx(zx,{onClick:async()=>{if(n){z(!1),A(!0),T(null),P(null);try{await f(),P("Subscription has been resumed."),await $()}catch(e){const t=e instanceof Error?e.message:"Failed to resume subscription";T(t)}finally{A(!1),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{T(null),P(null)},5e3)}}},disabled:p,children:p?"Resuming...":"Yes, Resume Subscription"})]})]})}),e.jsx(Tx,{open:U,onOpenChange:M,children:e.jsxs(Ix,{children:[e.jsxs(Dx,{children:[e.jsx(Mx,{children:"Cancel Subscription"}),e.jsx(Fx,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to cancel your subscription?"}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"✓"}),e.jsxs("span",{children:["You'll retain full access to this plan until"," ",a?.subscription?.stripeCurrentPeriodEnd&&Sj(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:Sj(a.subscription.stripeCurrentPeriodEnd)}):"the end of your current billing period"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"✓"}),e.jsx("span",{children:"You won't be charged again after cancellation"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"ℹ"}),e.jsx("span",{children:"You can resume your subscription anytime before it ends"})]})]})]})})]}),e.jsxs(Ux,{children:[e.jsx(Lx,{disabled:u,children:"Keep Subscription"}),e.jsx(zx,{onClick:async()=>{if(n){M(!1),A(!0),T(null),P(null);try{await d(),P("Subscription will be canceled at the end of the billing period."),await $()}catch(e){const t=e instanceof Error?e.message:"Failed to cancel subscription";T(t)}finally{A(!1),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{T(null),P(null)},5e3)}}},disabled:u,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:u?"Canceling...":"Yes, Cancel Subscription"})]})]})})]}):e.jsx("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:e.jsx("p",{children:"Invalid workspace ID"})})};function kj(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"K":e.toLocaleString()}function Nj(e){return e.replace(/[_-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function Ej(e,t){return t+e.toFixed(2)}function Cj(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 Aj=()=>{const{quotas:r,loading:n,error:a,refetch:s}=Ar(),{response:o}=jr(),[i,l]=t.useState(!1),c=t.useMemo(()=>{const e={};if(!o?.planVersion||!o?.subscription)return e;const t=o.planVersion,n=o.subscription,a=n.billingInterval??"monthly",s=n.plan?.currency??"usd",i=sy(s);if(!r)return e;for(const n of Object.keys(r)){const o=lj(t,s,n,a);if(null==o||o<=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)*o/100;e[n]={overageCents:o,unitSize:d,currency:s,currencySymbol:i,estimatedCost:f}}return e},[o,r]),d=t.useMemo(()=>{const e=o?.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:Cj(e)}:null},[o]),u=async()=>{l(!0);try{await s()}finally{l(!1)}};if(n&&!r)return e.jsx(Wx,{});if(a)return e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Failed to load usage data"}),e.jsx("p",{className:"text-sm mt-1",children:a})]}),e.jsx(Zd,{variant:"outline",size:"sm",onClick:u,disabled:i,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:i?"Retrying...":"Retry"})]});const f=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===f.length)return e.jsxs("div",{className:"border rounded-lg p-8 text-center",children:[e.jsx(Nd,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-gray-600",children:"No quota usage data available for this workspace."}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Quotas will appear here once your plan includes metered resources."})]});const p=f.filter(([,e])=>e.hasOverage).length,m=f.length>0?Math.round(f.reduce((e,[,t])=>e+(t.included>0?t.consumed/t.included*100:0),0)/f.length):0,h=Object.values(c).reduce((e,t)=>e+t.estimatedCost,0),g=Object.values(c)[0]?.currencySymbol??"$";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Monitor your resource consumption and quotas"}),e.jsxs(Zd,{variant:"ghost",size:"sm",onClick:u,disabled:i,children:[e.jsx(Ud,{className:ke("h-3.5 w-3.5 mr-1.5",i&&"animate-spin")}),i?"Refreshing...":"Refresh"]})]}),d&&e.jsxs("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:[e.jsx(kd,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),e.jsxs("span",{children:["Usage resets on ",e.jsx("span",{className:"font-medium text-gray-900",children:d.endDate}),null!==d.daysRemaining&&d.daysRemaining>0&&e.jsxs("span",{className:"text-gray-500",children:[" (",d.daysRemaining," ",1===d.daysRemaining?"day":"days"," remaining)"]}),null!==d.daysRemaining&&d.daysRemaining<=0&&e.jsx("span",{className:"text-amber-600 font-medium",children:" (renewing soon)"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-3",children:[e.jsxs("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Total Resources"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:f.length})]}),e.jsxs("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Overall Usage"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:m+"%"})]}),e.jsxs("div",{className:ke("border rounded-lg p-3 sm:p-4",p>0?"border-red-200 bg-red-50":"border-gray-200"),children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"In Overage"}),e.jsx("p",{className:ke("text-lg sm:text-xl font-semibold mt-1",p>0?"text-red-600":"text-gray-900"),children:p})]}),p>0&&h>0&&e.jsxs("div",{className:"border border-red-200 bg-red-50 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Est. Overage Cost"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold mt-1 text-red-600",children:Ej(h,g)})]})]}),p>0&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Bd,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5 hidden sm:block"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Overage Detected"}),e.jsxs("p",{className:"text-sm text-amber-700",children:[p," ",1===p?"resource has":"resources have"," exceeded the included quota. Additional usage will be billed as overage on your next invoice."]}),h>0&&e.jsxs("p",{className:"text-sm text-amber-700 font-medium mt-1",children:["Estimated overage charges this period: ",Ej(h,g)]})]})]})}),e.jsx("div",{className:"space-y-3",children:f.map(([t,r])=>{const n=(a=r.consumed,(s=r.included)<=0?a>0?100:0:Math.min(a/s*100,100));var a,s;const o=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),i=c[t];return e.jsx(_j,{slug:t,quota:r,percent:n,colors:o,pricing:i},t)})})]})};function _j({slug:t,quota:r,percent:n,colors:a,pricing:s}){return e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-1 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900 truncate",children:Nj(t)}),r.hasOverage&&e.jsx("span",{className:ke("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",a.badge,a.badgeText),children:"Overage"}),!r.hasOverage&&n>=90&&e.jsx("span",{className:ke("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",a.badge,a.badgeText),children:"Almost full"})]}),e.jsxs("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:[kj(r.consumed)," / ",kj(r.included)]})]}),e.jsx("div",{className:ke("h-2 rounded-full w-full",a.bg),children:e.jsx("div",{className:ke("h-2 rounded-full transition-all duration-500",a.bar),style:{width:`${n}%`}})}),e.jsxs("div",{className:"flex items-center justify-between mt-2 text-xs text-gray-500",children:[e.jsxs("span",{children:[Math.round(n),"% used"]}),e.jsx("span",{children:r.available>0?`${kj(r.available)} remaining`:r.hasOverage?`${kj(r.overage)} over limit`:"Fully used"})]}),r.hasOverage&&s&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Overage units"}),e.jsx("span",{className:"font-medium text-gray-900",children:kj(r.overage)})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Rate"}),e.jsxs("span",{className:"font-medium text-gray-900",children:[s.currencySymbol,(s.overageCents/100).toFixed(2),s.unitSize>1?` / ${s.unitSize.toLocaleString()} units`:" / unit"]})]}),s.unitSize>1&&e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Billable blocks"}),e.jsx("span",{className:"font-medium text-gray-900",children:Math.ceil(r.overage/s.unitSize).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs pt-2 border-t border-gray-200",children:[e.jsx("span",{className:"font-medium text-red-600",children:"Estimated charge"}),e.jsx("span",{className:"font-semibold text-red-600",children:Ej(s.estimatedCost,s.currencySymbol)})]})]}),!r.hasOverage&&s&&e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:["Overage rate: ",s.currencySymbol,(s.overageCents/100).toFixed(2),s.unitSize>1?` / ${s.unitSize.toLocaleString()} units`:" / unit"]})]})}function Tj(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?td(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Rj=Symbol("radix.slottable");function Pj(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Rj}var Oj=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});a.forwardRef((t,r)=>e.jsx(Wp.span,{...t,ref:r,style:{...Oj,...t.style}})).displayName="VisuallyHidden";var Ij=[" ","Enter","ArrowUp","ArrowDown"],Dj=[" ","Enter"],Uj="Select",[Mj,Fj,zj]=bg(Uj),[Lj]=Rp(Uj,[zj,Jw]),Wj=Jw(),[$j,Vj]=Lj(Uj),[Bj,Gj]=Lj(Uj),Kj=t=>{const{__scopeSelect:r,children:n,open:s,defaultOpen:o,onOpenChange:i,value:l,defaultValue:c,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:m,required:h,form:g}=t,b=Wj(r),[x,y]=a.useState(null),[v,w]=a.useState(null),[S,j]=a.useState(!1),k=yg(u),[N,E]=Mp({prop:s,defaultProp:o??!1,onChange:i,caller:Uj}),[C,A]=Mp({prop:l,defaultProp:c,onChange:d,caller:Uj}),_=a.useRef(null),T=!x||(g||!!x.closest("form")),[R,P]=a.useState(new Set),O=Array.from(R).map(e=>e.props.value).join(";");return e.jsx(fS,{...b,children:e.jsxs($j,{required:h,scope:r,trigger:x,onTriggerChange:y,valueNode:v,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:j,contentId:Dp(),value:C,onValueChange:A,open:N,onOpenChange:E,dir:k,triggerPointerDownPosRef:_,disabled:m,children:[e.jsx(Mj.Provider,{scope:r,children:e.jsx(Bj,{scope:t.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{P(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:n})}),T?e.jsxs(Tk,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:C,onChange:e=>A(e.target.value),disabled:m,form:g,children:[void 0===C?e.jsx("option",{value:""}):null,Array.from(R)]},O):null]})})};Kj.displayName=Uj;var Hj="SelectTrigger",Zj=a.forwardRef((t,r)=>{const{__scopeSelect:n,disabled:s=!1,...o}=t,i=Wj(n),l=Vj(Hj,n),c=l.disabled||s,d=rd(r,l.onTriggerChange),u=Fj(n),f=a.useRef("touch"),[p,m,h]=Pk(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===l.value),n=Ok(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 e.jsx(pS,{asChild:!0,...i,children:e.jsx(Wp.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":Rk(l.value)?"":void 0,...o,ref:d,onClick:Tp(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Tp(o.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:Tp(o.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||Ij.includes(e.key)&&(g(),e.preventDefault())})})})});Zj.displayName=Hj;var qj="SelectValue",Jj=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:a,style:s,children:o,placeholder:i="",...l}=t,c=Vj(qj,n),{onValueNodeHasChildrenChange:d}=c,u=void 0!==o,f=rd(r,c.onValueNodeChange);return rp(()=>{d(u)},[d,u]),e.jsx(Wp.span,{...l,ref:f,style:{pointerEvents:"none"},children:Rk(c.value)?e.jsx(e.Fragment,{children:i}):o})});Jj.displayName=qj;var Yj=a.forwardRef((t,r)=>{const{__scopeSelect:n,children:a,...s}=t;return e.jsx(Wp.span,{"aria-hidden":!0,...s,ref:r,children:a||"▼"})});Yj.displayName="SelectIcon";var Xj=t=>e.jsx(om,{asChild:!0,...t});Xj.displayName="SelectPortal";var Qj="SelectContent",ek=a.forwardRef((t,r)=>{const n=Vj(Qj,t.__scopeSelect),[o,i]=a.useState();if(rp(()=>{i(new DocumentFragment)},[]),!n.open){const r=o;return r?s.createPortal(e.jsx(rk,{scope:t.__scopeSelect,children:e.jsx(Mj.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),r):null}return e.jsx(sk,{...t,ref:r})});ek.displayName=Qj;var tk=10,[rk,nk]=Lj(Qj),ak=function(t){const r=Tj(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(Pj);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("SelectContent.RemoveScroll"),sk=a.forwardRef((t,r)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:l,side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:x,...y}=t,v=Vj(Qj,n),[w,S]=a.useState(null),[j,k]=a.useState(null),N=rd(r,e=>S(e)),[E,C]=a.useState(null),[A,_]=a.useState(null),T=Fj(n),[R,P]=a.useState(!1),O=a.useRef(!1);a.useEffect(()=>{if(w)return sh(w)},[w]),dm();const I=a.useCallback(e=>{const[t,...r]=T().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&j&&(j.scrollTop=0),r===n&&j&&(j.scrollTop=j.scrollHeight),r?.focus(),document.activeElement!==a)return}},[T,j]),D=a.useCallback(()=>I([E,w]),[I,E,w]);a.useEffect(()=>{R&&D()},[R,D]);const{onOpenChange:U,triggerPointerDownPosRef:M}=v;a.useEffect(()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(M.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(M.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():w.contains(r.target)||U(!1),document.removeEventListener("pointermove",t),M.current=null};return null!==M.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[w,U,M]),a.useEffect(()=>{const e=()=>U(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[U]);const[F,z]=Pk(e=>{const t=T().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=Ok(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),L=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==v.value&&v.value===t||n)&&(C(e),n&&(O.current=!0))},[v.value]),W=a.useCallback(()=>w?.focus(),[w]),$=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==v.value&&v.value===t||n)&&_(e)},[v.value]),V="popper"===s?ik:ok,B=V===ik?{side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:x}:{};return e.jsx(rk,{scope:n,content:w,viewport:j,onViewportChange:k,itemRefCallback:L,selectedItem:E,onItemLeave:W,itemTextRefCallback:$,focusSelectedItem:D,selectedItemText:A,position:s,isPositioned:R,searchRef:F,children:e.jsx(Xm,{as:ak,allowPinchZoom:!0,children:e.jsx(Qp,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Tp(o,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e.jsx(Hp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:e.jsx(V,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:e=>e.preventDefault(),...y,...B,onPlaced:()=>P(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Tp(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=T().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>I(t)),e.preventDefault()}})})})})})})});sk.displayName="SelectContentImpl";var ok=a.forwardRef((t,r)=>{const{__scopeSelect:n,onPlaced:s,...o}=t,i=Vj(Qj,n),l=nk(Qj,n),[c,d]=a.useState(null),[u,f]=a.useState(null),p=rd(r,e=>f(e)),m=Fj(n),h=a.useRef(!1),g=a.useRef(!0),{viewport:b,selectedItem:x,selectedItemText:y,focusSelectedItem:v}=l,w=a.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&u&&b&&x&&y){const e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),n=y.getBoundingClientRect();if("rtl"!==i.dir){const a=n.left-t.left,s=r.left-a,o=e.left-s,i=e.width+o,l=Math.max(i,t.width),d=window.innerWidth-tk,u=fb(s,[tk,Math.max(tk,d-l)]);c.style.minWidth=i+"px",c.style.left=u+"px"}else{const a=t.right-n.right,s=window.innerWidth-r.right-a,o=window.innerWidth-e.right-s,i=e.width+o,l=Math.max(i,t.width),d=window.innerWidth-tk,u=fb(s,[tk,Math.max(tk,d-l)]);c.style.minWidth=i+"px",c.style.right=u+"px"}const a=m(),o=window.innerHeight-2*tk,l=b.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),v=f+p+l+parseInt(d.paddingBottom,10)+g,w=Math.min(5*x.offsetHeight,v),S=window.getComputedStyle(b),j=parseInt(S.paddingTop,10),k=parseInt(S.paddingBottom,10),N=e.top+e.height/2-tk,E=o-N,C=x.offsetHeight/2,A=f+p+(x.offsetTop+C),_=v-A;if(A<=N){const e=a.length>0&&x===a[a.length-1].ref.current;c.style.bottom="0px";const t=u.clientHeight-b.offsetTop-b.offsetHeight,r=A+Math.max(E,C+(e?k:0)+t+g);c.style.height=r+"px"}else{const e=a.length>0&&x===a[0].ref.current;c.style.top="0px";const t=Math.max(N,f+b.offsetTop+(e?j:0)+C)+_;c.style.height=t+"px",b.scrollTop=A-N+b.offsetTop}c.style.margin=`${tk}px 0`,c.style.minHeight=w+"px",c.style.maxHeight=o+"px",s?.(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,c,u,b,x,y,i.dir,s]);rp(()=>w(),[w]);const[S,j]=a.useState();rp(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const k=a.useCallback(e=>{e&&!0===g.current&&(w(),v?.(),g.current=!1)},[w,v]);return e.jsx(lk,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:k,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:e.jsx(Wp.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});ok.displayName="SelectItemAlignedPosition";var ik=a.forwardRef((t,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:s=tk,...o}=t,i=Wj(n);return e.jsx(mS,{...i,...o,ref:r,align:a,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});ik.displayName="SelectPopperPosition";var[lk,ck]=Lj(Qj,{}),dk="SelectViewport",uk=a.forwardRef((t,r)=>{const{__scopeSelect:n,nonce:s,...o}=t,i=nk(dk,n),l=ck(dk,n),c=rd(r,i.onViewportChange),d=a.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),e.jsx(Mj.Slot,{scope:n,children:e.jsx(Wp.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Tp(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=l;if(n?.current&&r){const e=Math.abs(d.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*tk,a=parseFloat(r.style.minHeight),s=parseFloat(r.style.height),o=Math.max(a,s);if(o<n){const a=o+e,s=Math.min(n,a),i=a-s;r.style.height=s+"px","0px"===r.style.bottom&&(t.scrollTop=i>0?i:0,r.style.justifyContent="flex-end")}}}d.current=t.scrollTop})})})]})});uk.displayName=dk;var fk="SelectGroup",[pk,mk]=Lj(fk);a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=Dp();return e.jsx(pk,{scope:n,id:s,children:e.jsx(Wp.div,{role:"group","aria-labelledby":s,...a,ref:r})})}).displayName=fk;var hk="SelectLabel",gk=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=mk(hk,n);return e.jsx(Wp.div,{id:s.id,...a,ref:r})});gk.displayName=hk;var bk="SelectItem",[xk,yk]=Lj(bk),vk=a.forwardRef((t,r)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:i,...l}=t,c=Vj(bk,n),d=nk(bk,n),u=c.value===s,[f,p]=a.useState(i??""),[m,h]=a.useState(!1),g=rd(r,e=>d.itemRefCallback?.(e,s,o)),b=Dp(),x=a.useRef("touch"),y=()=>{o||(c.onValueChange(s),c.onOpenChange(!1))};if(""===s)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(xk,{scope:n,value:s,disabled:o,textId:b,isSelected:u,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:e.jsx(Mj.ItemSlot,{scope:n,value:s,disabled:o,textValue:f,children:e.jsx(Wp.div,{role:"option","aria-labelledby":b,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:g,onFocus:Tp(l.onFocus,()=>h(!0)),onBlur:Tp(l.onBlur,()=>h(!1)),onClick:Tp(l.onClick,()=>{"mouse"!==x.current&&y()}),onPointerUp:Tp(l.onPointerUp,()=>{"mouse"===x.current&&y()}),onPointerDown:Tp(l.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:Tp(l.onPointerMove,e=>{x.current=e.pointerType,o?d.onItemLeave?.():"mouse"===x.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Tp(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Tp(l.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(Dj.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});vk.displayName=bk;var wk="SelectItemText",Sk=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:o,style:i,...l}=t,c=Vj(wk,n),d=nk(wk,n),u=yk(wk,n),f=Gj(wk,n),[p,m]=a.useState(null),h=rd(r,e=>m(e),u.onItemTextChange,e=>d.itemTextRefCallback?.(e,u.value,u.disabled)),g=p?.textContent,b=a.useMemo(()=>e.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:x,onNativeOptionRemove:y}=f;return rp(()=>(x(b),()=>y(b)),[x,y,b]),e.jsxs(e.Fragment,{children:[e.jsx(Wp.span,{id:u.textId,...l,ref:h}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren?s.createPortal(l.children,c.valueNode):null]})});Sk.displayName=wk;var jk="SelectItemIndicator",kk=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return yk(jk,n).isSelected?e.jsx(Wp.span,{"aria-hidden":!0,...a,ref:r}):null});kk.displayName=jk;var Nk="SelectScrollUpButton";a.forwardRef((t,r)=>{const n=nk(Nk,t.__scopeSelect),s=ck(Nk,t.__scopeSelect),[o,i]=a.useState(!1),l=rd(r,s.onScrollButtonChange);return rp(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(Ck,{...t,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=Nk;var Ek="SelectScrollDownButton";a.forwardRef((t,r)=>{const n=nk(Ek,t.__scopeSelect),s=ck(Ek,t.__scopeSelect),[o,i]=a.useState(!1),l=rd(r,s.onScrollButtonChange);return rp(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;i(r)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(Ck,{...t,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=Ek;var Ck=a.forwardRef((t,r)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=t,i=nk("SelectScrollButton",n),l=a.useRef(null),c=Fj(n),d=a.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return a.useEffect(()=>()=>d(),[d]),rp(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),e.jsx(Wp.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:Tp(o.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(s,50))}),onPointerMove:Tp(o.onPointerMove,()=>{i.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(s,50))}),onPointerLeave:Tp(o.onPointerLeave,()=>{d()})})}),Ak=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return e.jsx(Wp.div,{"aria-hidden":!0,...a,ref:r})});Ak.displayName="SelectSeparator";var _k="SelectArrow";a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=Wj(n),o=Vj(_k,n),i=nk(_k,n);return o.open&&"popper"===i.position?e.jsx(hS,{...s,...a,ref:r}):null}).displayName=_k;var Tk=a.forwardRef(({__scopeSelect:t,value:r,...n},s)=>{const o=a.useRef(null),i=rd(s,o),l=zg(r);return a.useEffect(()=>{const e=o.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]),e.jsx(Wp.select,{...n,style:{...Oj,...n.style},ref:i,defaultValue:r})});function Rk(e){return""===e||void 0===e}function Pk(e){const t=ep(e),r=a.useRef(""),n=a.useRef(0),s=a.useCallback(e=>{const a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),o=a.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function Ok(e,t,r){const n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let s=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(s=s.filter(e=>e!==r));const o=s.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return o!==r?o:void 0}Tk.displayName="SelectBubbleInput";var Ik=Zj,Dk=Yj,Uk=Xj,Mk=ek,Fk=uk,zk=gk,Lk=vk,Wk=Sk,$k=kk,Vk=Ak;const Bk=Kj,Gk=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Ik,{ref:a,className:ke("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:[r,e.jsx(Dk,{asChild:!0,children:e.jsx(Xh,{className:"h-4 w-4 opacity-50"})})]}));Gk.displayName=Ik.displayName;const Kk=a.forwardRef(({className:t,children:r,position:n="popper",...s},o)=>{const{container:i}=a.useContext(cs);return e.jsx(Uk,{container:i,children:e.jsx(Mk,{ref:o,className:ke("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...s,children:e.jsx(Fk,{className:ke("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});Kk.displayName=Mk.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(zk,{ref:n,className:ke("px-2 py-1.5 text-sm font-semibold",t),...r})).displayName=zk.displayName;const Hk=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Lk,{ref:a,className:ke("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx($k,{children:e.jsx(eg,{className:"h-4 w-4"})})}),e.jsx(Wk,{children:r})]}));Hk.displayName=Lk.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Vk,{ref:n,className:ke("-mx-1 my-1 h-px bg-muted",t),...r})).displayName=Vk.displayName;const Zk=({workspace:r})=>{const{user:n}=es(),[a,s]=t.useState(0),[o,i]=t.useState(!1),[l,c]=t.useState([]),[d,u]=t.useState(null),{getUsers:f,removeUser:p,updateUser:m}=or(),{settings:h}=Yt(),{response:g}=jr();t.useEffect(()=>{r&&(i(!0),f(r._id).then(e=>{c(e)}).catch(e=>{De(e,{component:"WorkspaceSettingsUsers",action:"getUsers",metadata:{workspaceId:r._id}})}).finally(()=>{i(!1)}))},[r,a]);const b=()=>{s(e=>e+1)};if(o||!r)return e.jsx(Wx,{});const x=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},y=l.map(e=>({...e,...x(e.user)})),v=l.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,w="admin"===v,S=g?.subscription,j=g?.planVersion,k=S?.seatPricingEnabled,N=r?.billingCurrency||"usd",E=j?fj(j,N):null,C=E?.includedSeats??0,A=E?.maxSeats??0,_=l.length,T=k&&A>0&&_>=A,R=h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE,P=k?!T:R>_,O=S?.billingInterval??"monthly",I=j?pj(j,N,O):null,D=k&&_>=C;return e.jsxs("div",{children:[!w&&e.jsx("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),w&&e.jsx("div",{className:"mb-4",children:P?e.jsxs("div",{children:[e.jsx(qk,{onInvite:b,workspaceId:r._id}),D&&I&&I>0&&e.jsx("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.jsxs("span",{children:["Each additional member adds ",e.jsxs("span",{className:"font-medium",children:[ly(I,N),"/","yearly"===O?"yr":"quarterly"===O?"qtr":"mo"]})," to your subscription"]})})]}):e.jsx("div",{className:"flex items-center justify-between p-3 bg-red-50 border border-red-100 rounded-md",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-700",children:T?"Seat limit reached":"Member limit reached"}),e.jsx("p",{className:"text-xs text-red-600 mt-0.5",children:T?`Your plan allows up to ${A} members. Upgrade for more seats.`:"Contact your admin to increase the workspace member limit."})]})})}),k&&E&&e.jsxs("div",{className:"mb-4 rounded-lg border bg-gray-50 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-900",children:"Seats"}),A>0&&e.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full "+(_>=A?"bg-red-100 text-red-700":_>=.8*A?"bg-amber-100 text-amber-700":"bg-emerald-100 text-emerald-700"),children:[_," / ",A]})]}),A>0&&e.jsx("div",{className:"w-full h-1.5 bg-gray-200 rounded-full mb-3",children:e.jsx("div",{className:"h-1.5 rounded-full transition-all "+(_>=A?"bg-red-500":_>=.8*A?"bg-amber-500":"bg-emerald-500"),style:{width:`${Math.min(100,_/A*100)}%`}})}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-900 font-medium",children:C})," included",I&&I>0&&e.jsxs("span",{className:"text-gray-400",children:[" · ",ly(I,N),"/extra seat"]})]}),A>0?e.jsxs("span",{children:[Math.max(0,A-_)," available"]}):e.jsx("span",{className:"text-gray-400",children:"No seat limit"})]})]}),e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("div",{children:e.jsxs("div",{className:"text-sm text-gray-600",children:[_," member",1!==_?"s":""]})}),e.jsx("div",{children:e.jsx(Zd,{variant:"ghost",size:"sm",onClick:b,progress:o,children:o?"Refreshing...":"Refresh"})})]}),e.jsx("ul",{className:"space-y-2",children:y.map((t,a)=>{const s=t.id===n?.id,o=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===t.id;return e.jsxs("li",{className:"border rounded p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium shrink-0",children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500 truncate",children:t.email})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-0.5 rounded",children:"You"}),o&&e.jsx("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-0.5 rounded",children:"Owner"})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-2 mt-2 pt-2 border-t border-gray-100 sm:mt-0 sm:pt-0 sm:border-0",children:[e.jsxs("div",{className:"relative flex-1 sm:flex-initial",children:[e.jsxs(Bk,{disabled:s||!w||o||d===t.id,value:t.role,onValueChange:e=>{return n=r._id,a=t.id,s=e,void(nr(r,a)?De(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}}):(u(a),m(n,a,{role:s}).then(()=>{b()}).catch(e=>{De(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}})}).finally(()=>{u(null)})));var n,a,s},children:[e.jsx(Gk,{children:e.jsx(Jj,{placeholder:"Select a role"})}),e.jsx(Kk,{children:r?.roles.map(t=>e.jsx(Hk,{value:t,children:t},t))})]}),d===t.id&&e.jsx("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:e.jsx(Od,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),!s&&!o&&e.jsx(Zd,{variant:"destructive",size:"sm",startIcon:e.jsx(Vd,{}),onClick:()=>{return e=t.id,void(nr(r,e)?De(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):p(r._id,e).then(()=>{b()}).catch(t=>{De(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})}));var e}})]})]},a)})}),0===l.length&&e.jsx("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function qk({onInvite:r,workspaceId:n}){const[a,s]=t.useState(""),[o,i]=t.useState("admin"),[l,c]=t.useState(!1),[d,u]=t.useState(null),[f,p]=t.useState(null),m=t.useRef(null),{addUser:h,getWorkspace:g}=or();t.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const[b,x]=t.useState(null),{settings:y}=Yt(),v=y?.workspace.roles??b?.roles??[];t.useEffect(()=>{n&&g(n).then(x)},[n]);const w=()=>{u(null),p(null),s(""),i("admin")};return e.jsxs("div",{className:"flex gap-2 flex-col gap-y-2",children:[d&&e.jsx("div",{className:"text-red-500 capitalize",children:d}),f&&e.jsx("div",{className:"text-green-500 capitalize",children:f}),e.jsxs("div",{children:[e.jsx(Qd,{children:"Invite member by email"}),e.jsx(du,{type:"email",value:a,onChange:e=>s(e.target.value),placeholder:"example@example.com"})]}),e.jsxs("div",{children:[e.jsx(Qd,{children:"Role"}),e.jsxs(Bk,{value:o,onValueChange:i,children:[e.jsx(Gk,{children:e.jsx(Jj,{placeholder:"Select a role"})}),e.jsx(Kk,{children:v.map(t=>e.jsx(Hk,{value:t,children:t},t))})]})]}),e.jsx("div",{children:e.jsx(Zd,{progress:l,onClick:async()=>{const e=a.trim();if(!e)return void u("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(c(!0),await h(n,e,o).then(()=>{p("User invited successfully"),r?.()}).catch(t=>{De(t,{component:"InviteMember",action:"addUser",metadata:{workspaceId:n,email:e,role:o}}),u(t instanceof Error?t.message:"Failed to invite member")}).finally(()=>{c(!1),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{w()},6e3)})):u("Invalid email address format")},disabled:l||!a||!o,children:l?"Inviting...":`Invite as ${o}`})})]})}const Jk=()=>{const{isSupported:r,permission:n,isSubscribed:a,loading:s,error:o,subscribe:i,unsubscribe:l}=ss(),c=t.useMemo(()=>function(){const e="undefined"!=typeof navigator?navigator.userAgent:"";return e.includes("Firefox")?{browser:"Firefox",steps:["Click the lock icon (or shield icon) in the address bar",'Find "Notifications" in the permissions list','Change from "Blocked" to "Allow"',"Reload this page"]}:e.includes("Safari")&&!e.includes("Chrome")?{browser:"Safari",steps:["Open Safari → Settings → Websites → Notifications","Find this website in the list",'Change from "Deny" to "Allow"',"Reload this page"]}:e.includes("Edg")?{browser:"Edge",steps:["Click the lock icon in the address bar",'Click "Permissions for this site"','Set "Notifications" to "Allow"',"Reload this page"]}:{browser:"Chrome",steps:["Click the lock icon (or tune icon) in the address bar",'Click "Site settings"','Set "Notifications" to "Allow"',"Reload this page"]}}(),[]);return r?e.jsxs("div",{className:"space-y-6",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Manage how you receive notifications from this workspace."}),o&&"denied"!==n&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg text-sm",children:o}),"denied"===n&&e.jsx("div",{className:"border border-amber-200 bg-amber-50 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(zd,{className:"h-5 w-5 text-amber-600 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-amber-800",children:"Notifications Blocked"}),e.jsxs("p",{className:"text-xs text-amber-700 mt-1",children:["You previously blocked notifications for this site. To enable them, update your ",c.browser," settings:"]}),e.jsx("ol",{className:"text-xs text-amber-700 mt-2 space-y-1 list-decimal list-inside",children:c.steps.map((t,r)=>e.jsx("li",{children:t},r))})]})]})}),"denied"!==n&&e.jsxs("div",{className:"border rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 p-2 rounded-lg "+(a?"bg-green-100":"bg-gray-100"),children:a?e.jsx(Sd,{className:"h-4 w-4 text-green-600"}):e.jsx(wd,{className:"h-4 w-4 text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Push Notifications"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:a?"You will receive browser notifications for important updates.":"Get notified about payment issues, trial expiry, and other important updates."})]})]}),e.jsx(Zd,{variant:a?"outline":"default",size:"sm",className:"shrink-0",onClick:a?l:i,disabled:s,progress:s,children:s?a?"Disabling...":"Enabling...":a?"Disable":"Enable"})]}),a&&e.jsx("div",{className:"mt-3 pt-3 border-t border-gray-100 text-xs text-gray-500",children:"Notifications are sent to this device. Enable on other devices separately."})]})]}):e.jsx("div",{className:"text-sm text-gray-500",children:"Push notifications are not supported in this browser."})},Yk=({workspace:t,section:r,setSection:n})=>{const{user:a}=es(),s=("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy._id:t.createdBy)===a?.id,o=ar(t,a?.id??null),i=s||"admin"===o?.toLowerCase();return e.jsxs("div",{className:"w-44 sm:w-56 h-full flex flex-col space-y-4 sm:space-y-6 shrink-0",children:[t&&e.jsx("div",{className:"border-b p-2 py-4",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[t.image&&t.image.trim()&&e.jsx("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:e.jsx("img",{src:t.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:t.name})}),e.jsxs("div",{className:ke("flex-1 min-w-0",t.image?"":"pl-2"),children:[e.jsx("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.workspaceId})]})]})}),e.jsx(Xk,{title:"Account",children:e.jsx(Qk,{activeSection:r,icon:e.jsx(Gd,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>n("profile")})}),e.jsxs(Xk,{title:"Workspace",children:[e.jsx(Qk,{activeSection:r,icon:e.jsx(Fd,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>n("general")}),e.jsx(Qk,{activeSection:r,icon:e.jsx(Kd,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>n("users")}),e.jsx(Qk,{activeSection:r,icon:e.jsx(Ad,{className:"h-3.5 w-3.5"}),label:"Plan & Billing",section:"subscription",onClick:()=>n("subscription")}),e.jsx(Qk,{activeSection:r,icon:e.jsx(Nd,{className:"h-3.5 w-3.5"}),label:"Usage",section:"usage",onClick:()=>n("usage")}),e.jsx(Qk,{activeSection:r,icon:e.jsx(Wd,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>n("features")}),e.jsx(Qk,{activeSection:r,icon:e.jsx(Sd,{className:"h-3.5 w-3.5"}),label:"Notifications",section:"notifications",onClick:()=>n("notifications")}),i&&e.jsx(Qk,{activeSection:r,icon:e.jsx(Bd,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>n("danger")})]})]})};function Xk({title:t,children:r}){return e.jsxs("div",{className:"px-2 flex flex-col space-y-1",children:[e.jsx("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:t}),r]})}function Qk({icon:t,label:r,section:n,onClick:a,activeSection:s}){return e.jsxs("button",{className:ke("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===s?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const eN=({workspace:r,onClose:n,open:a,onOpenChange:s,defaultSection:o="profile",section:i,onSectionChange:l,showTrigger:c=!0,trigger:d})=>{const[u,f]=t.useState(!1),[p,m]=t.useState(o),h=void 0!==a?a:u,g=s||f,b=void 0!==i?i:p,x=l||m;if(!r)return null;const y=e.jsx(Zd,{variant:"outline",size:"icon",children:e.jsx(Fd,{className:"h-4 w-4"})});return e.jsxs(sg,{open:h,onOpenChange:e=>{g(e),!e&&n&&n()},children:[c&&e.jsx(og,{asChild:!0,children:d||y}),e.jsxs(cg,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[e.jsx(fg,{className:"sr-only",children:"Workspace settings dialog"}),e.jsx(Yk,{workspace:r,section:b,setSection:x}),e.jsxs("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e.jsxs(ug,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===b&&"Account","general"===b&&"Workspace Settings","users"===b&&"Workspace Members","subscription"===b&&"Plan & Billing","usage"===b&&"Usage","features"===b&&"Workspace Features","notifications"===b&&"Notifications","danger"===b&&"Danger Zone"]}),e.jsxs("div",{className:"sm:max-h-[500px] overflow-y-auto",children:["profile"===b&&e.jsx(aj,{workspace:r}),"general"===b&&e.jsx(uy,{workspace:r}),"users"===b&&e.jsx(Zk,{workspace:r}),"subscription"===b&&e.jsx(jj,{workspace:r}),"usage"===b&&e.jsx(Aj,{}),"features"===b&&e.jsx(ty,{workspaceId:r._id?.toString()}),"notifications"===b&&e.jsx(Jk,{}),"danger"===b&&e.jsx($x,{workspace:r})]})]})]})]})};var tN=Object.freeze({__proto__:null,WorkspaceSettingsDialog:eN,default:eN});function rN(t){const{workspace:r,setCurrentWorkspace:n,setOpen:a,workspacesToUse:s,switchingToId:o}=t,i=t.isCurrentWorkspace??!1,l=o===r._id,c=r.subscription??null,d=null!=c&&"object"==typeof c?c.plan??null:null,u=d?.name??"";return e.jsxs("div",{className:ke("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":i}),children:[e.jsxs(Cp,{className:"h-8 w-8 flex items-center justify-center",children:[e.jsx("div",{children:e.jsx(Ap,{src:r.image&&r.image.trim()?r.image:void 0})}),e.jsx(_p,{children:(f=r.name,f.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e.jsxs("div",{className:"flex-1 min-w-0 max-w-full",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:r.name})}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(Kd,{className:"h-3 w-3"}),e.jsxs("span",{children:[r.users?.length||0," members"]})]}),u&&e.jsx("div",{className:"max-w-fit",children:e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground bg-green-500 text-white rounded-full px-2 py-0.5",children:e.jsx("span",{className:"text-xs",children:u})})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i?null:e.jsx(Zd,{size:"sm",disabled:null!==o||l,progress:l,onClick:()=>{t.switchToWorkspace(r).then(()=>a(!1)).catch(e=>{De(e,{component:"WorkspaceItem",action:"switchToWorkspace",metadata:{workspaceId:r._id}})})},children:"Switch to"}),e.jsx(eN,{workspace:r,onClose:()=>{if(i){const e=s.findIndex(e=>e._id?.toString()===r._id?.toString());-1!==e&&n(s[e])}}})]})]});var f}function nN(r){const{switching:n}=or(),[a,s]=t.useState(!1),[o,i]=t.useState("emoji"),[l,c]=t.useState("🏢"),[d,u]=t.useState(!1),{createWorkspace:f}=or(),p=Go({resolver:Qc(ff({name:Fu().min(2,{message:"Workspace name must be at least 2 characters."}),image:Fu().optional()})),defaultValues:{name:"",image:""}});return e.jsxs(sg,{open:a,onOpenChange:s,children:[e.jsx(og,{asChild:!0,children:e.jsxs(Zd,{className:"w-full rounded-none",disabled:n,children:[e.jsx(Id,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e.jsxs(cg,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e.jsxs(dg,{children:[e.jsx(ug,{children:"Create New Workspace"}),e.jsx(fg,{children:"Create a new workspace to get started."})]}),e.jsx(eu,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){let t="";if("emoji"===o)t=cy(l);else if("url"===o&&e.image)try{new URL(e.image),t=e.image}catch{return void p.setError("image",{message:"Please enter a valid URL"})}u(!0);try{await f(e.name,t),s(!1),p.reset(),c("🏢"),i("emoji"),r?.onCreated?.()}catch(t){De(t,{component:"WorkspaceProvider",action:"createWorkspace",metadata:{name:e.name}})}finally{u(!1)}}),children:[e.jsx(ru,{control:p.control,name:"name",render:({field:t})=>e.jsxs(su,{children:[e.jsx(ou,{children:"Workspace Name"}),e.jsx(iu,{children:e.jsx(du,{placeholder:"My Awesome Workspace",...t})}),e.jsx(cu,{})]})}),e.jsxs("div",{className:"flex flex-col gap-y-2 my-2",children:[e.jsxs("div",{children:[e.jsx(Qd,{className:"text-sm font-medium",children:"Workspace Icon"}),e.jsx(lu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(db,{value:o,onValueChange:e=>i(e),className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(ub,{value:"emoji",id:"emoji"}),e.jsxs(Qd,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(Ld,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(ub,{value:"url",id:"url"}),e.jsxs(Qd,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(Pd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:l})]}),e.jsx(qb,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:dy.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),p.setValue("image",cy(e))})(t),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(l===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx(ru,{control:p.control,name:"image",render:({field:t})=>e.jsxs(su,{children:[e.jsx(ou,{children:"Image URL"}),e.jsx(iu,{children:e.jsx(du,{placeholder:"https://example.com/image.png",...t})}),e.jsx(lu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(cu,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(Zd,{type:"button",variant:"outline",onClick:()=>{s(!1),p.reset(),c("🏢"),i("emoji")},disabled:d,children:"Cancel"}),e.jsx(Zd,{type:"submit",disabled:d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(Od,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}function aN(e){if(!e)return null;const t=new Date(e);return isNaN(t.getTime())?null:t}const sN=(e,t)=>null==e||0===e?"Free":ly(e,t),oN=e=>{switch(e){case"monthly":default:return"/mo";case"quarterly":return"/qtr";case"yearly":return"/yr"}},iN=(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};var lN=Object.freeze({__proto__:null,default:({open:r,onOpenChange:n,planVersions:a,currentPlanVersionId:s,currentStripePriceId:o,billingCurrency:i,currentMemberCount:l,onSelectPlan:c,loading:d=!1})=>{const[u,f]=t.useState(!1),[p,m]=t.useState(null),h=t.useRef(!1),g=t.useMemo(()=>uj(o,a),[o,a]),b=g?.interval??null,x=g?.currency??null,y=t.useMemo(()=>cj(a),[a]),v=t.useMemo(()=>{const e=i?.trim().toLowerCase();return e?y.includes(e)?[e]:[]:y},[i,y]),[w,S]=t.useState(b||"monthly"),[j,k]=t.useState(()=>x&&v.includes(x)?x:v.length>0?v[0]:""),N=i?.trim()||j;t.useEffect(()=>{r&&(S(b||"monthly"),x&&v.includes(x)?k(x):v.length>0&&!v.includes(j)&&k(v[0]))},[r,b,x,v]);const E=t.useMemo(()=>[...a].sort((e,t)=>e.version-t.version),[a]),C=(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())})(E),A=C.filter(e=>"feature"===e.type),_=C.filter(e=>"limit"===e.type),T=C.filter(e=>"quota"===e.type),R=async e=>{if(!(e===s&&b===w||d||u||h.current)){h.current=!0,f(!0),m(e);try{await c(e,w,N),n(!1)}catch(e){}finally{h.current=!1,f(!1),m(null)}}},P=e=>oj(e,N,w),O=e=>!!e.pricingVariants?.some(e=>e.currency?.toLowerCase()===N.toLowerCase()),I=d||u,D=e=>{switch(e){case"monthly":default:return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly"}},U=e=>{const t=e._id===s,r=b===w;if(t&&r)return{label:"Current Plan",variant:"outline",disabled:!0};if(t&&!r)return{label:`Switch to ${D(w)}`,variant:"default",disabled:!1};if(!s)return{label:"Subscribe",variant:"default",disabled:!1};const n=E.findIndex(e=>e._id===s),a=E.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}},M=(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=dj(e,N,t.slug,r);return n||gj(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 bj("object"==typeof e&&null!==e&&"included"in e?e:null,t.name.toLowerCase(),{currency:r})}return"—"};return e.jsx(sg,{open:r,onOpenChange:n,children:e.jsxs(cg,{className:"inset-0 w-screen h-screen max-w-none rounded-none translate-x-0 translate-y-0 p-0 flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 px-4 py-4 sm:px-6 sm:py-6 border-b space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx(ug,{className:"text-xl sm:text-2xl font-bold",children:"Choose Your Plan"}),e.jsx(fg,{className:"mt-1 text-sm",children:"Compare plans and select the one that fits your needs"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[!i?.trim()&&v.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-slate-600",children:"Currency"}),e.jsx("select",{"aria-label":"Select billing currency",value:j,onChange:e=>k(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:v.map(t=>{const r=ay(t);return e.jsx("option",{value:t,children:r?`${r} ${t.toUpperCase()}`:t.toUpperCase()},t)})})]}),i?.trim()&&e.jsxs("span",{className:"text-xs text-slate-500",children:["Billing in ",i.toUpperCase()]})]}),e.jsx("div",{className:"flex items-center gap-0.5 sm:gap-1 p-1 bg-slate-100 rounded-lg w-full sm:w-auto",role:"group","aria-label":"Billing interval",children:["monthly","quarterly","yearly"].map(t=>{const r=b===t;return e.jsx("button",{onClick:()=>S(t),"aria-pressed":w===t,className:"flex-1 sm:flex-initial px-3 sm:px-4 py-2 text-sm font-medium rounded-md transition-all relative "+(w===t?"bg-white text-slate-900 shadow-sm":"text-slate-600 hover:text-slate-900"),children:e.jsxs("span",{className:"flex items-center justify-center gap-1 sm:gap-1.5",children:["monthly"===t&&"Monthly","quarterly"===t&&"Quarterly","yearly"===t&&"Yearly","yearly"===t&&e.jsx("span",{className:"text-[10px] sm:text-xs px-1 sm:px-1.5 py-0.5 bg-emerald-100 text-emerald-700 rounded-full font-semibold",children:"Save"}),r&&s&&e.jsx("span",{className:"hidden sm:inline text-xs px-1.5 py-0.5 bg-blue-100 text-blue-700 rounded-full font-semibold",children:"Current"})]})},t)})})]})]}),e.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:i?.trim()&&0===v.length?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx("p",{className:"text-slate-600 font-medium",children:"No plans available for your billing currency."}),e.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Something went wrong. Please contact support."})]}):0===E.length?e.jsx("div",{className:"text-center py-12 text-gray-500",children:e.jsx("p",{children:"No plans available"})}):e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden bg-white",children:[e.jsx("div",{className:"md:hidden overflow-auto h-full",style:{maxHeight:"calc(100vh - 13rem)"},children:e.jsx("div",{className:"p-4 space-y-4",children:E.map(t=>{const r=t._id===s,n=U(t),a=I&&t._id===p,o=P(t),i=O(t),c=t.pricingVariants?.length&&t.pricingVariants.some(e=>e.currency?.toLowerCase()===N.toLowerCase())?N:t.plan?.currency??N??"",d=oj(t,N,"monthly")??0,u="monthly"!==w&&null!==o?iN(d,o,w):null,f=fj(t,N),m=f?pj(t,N,w):null;return e.jsxs("div",{className:"rounded-xl border-2 p-4 "+(r?"border-blue-500 bg-blue-50/30":"border-slate-200 bg-white"),children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-slate-900",children:t.plan.name}),t.plan.description&&e.jsx("p",{className:"text-xs text-slate-500 mt-0.5 line-clamp-2",children:t.plan.description})]}),r&&e.jsx("span",{className:"shrink-0 rounded-md bg-blue-600 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",children:"Current"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-slate-900",children:i&&null!==o||i?sN(o,c):"—"}),null!==o&&o>0&&i&&e.jsx("span",{className:"text-sm text-slate-500",children:oN(w)})]}),null!==u&&u>0&&i&&e.jsxs("span",{className:"text-xs text-emerald-600 font-medium",children:["Save ",u,"% vs monthly"]}),f?.enabled&&m&&m>0&&e.jsxs("div",{className:"text-xs text-slate-500 mt-1",children:["+ ",ly(m,c),"/seat",oN(w),f.includedSeats>0&&e.jsxs("span",{className:"text-slate-400",children:[" (",f.includedSeats," included)"]})]})]}),A.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider mb-1.5",children:"Features"}),e.jsx("div",{className:"space-y-1",children:A.map(r=>{const n=M(t,r,w),a="feature"===r.type&&!0===n;return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:["feature"===r.type?a?e.jsx("span",{className:"text-emerald-500 text-xs",children:"✓"}):e.jsx("span",{className:"text-slate-300 text-xs",children:"✕"}):null,e.jsx("span",{className:a?"text-slate-700":"text-slate-400",children:r.name})]},r._id)})})]}),_.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider mb-1.5",children:"Limits"}),e.jsx("div",{className:"space-y-1",children:_.map(r=>{const n=M(t,r,w);return e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-slate-600",children:r.name}),e.jsx("span",{className:"font-medium text-slate-700",children:"number"==typeof n?n.toLocaleString():"—"})]},r._id)})})]}),f?.enabled&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-xs font-semibold text-emerald-600 uppercase tracking-wider mb-1.5",children:"Seats"}),e.jsxs("div",{className:"space-y-1 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Included"}),e.jsx("span",{className:"font-medium",children:f.includedSeats||0})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Max"}),e.jsx("span",{className:"font-medium",children:f.maxSeats>0?f.maxSeats:"Unlimited"})]}),null!=l&&l>0&&(()=>{const t=Math.max(0,l-(f.includedSeats||0));return e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Your billable"}),e.jsx("span",{className:"font-medium "+(0===t?"text-emerald-600":"text-amber-600"),children:0===t?"All included":`${t} extra`})]})})()]})]}),e.jsx(Zd,{className:"w-full mt-2",variant:n.variant,disabled:n.disabled||I||!i,progress:a,onClick:()=>R(t._id),children:a?"Processing...":i?n.label:"Unavailable"})]},t._id)})})}),e.jsx("div",{className:"hidden md:block overflow-auto h-full",style:{maxHeight:"calc(100vh - 12rem)"},children:e.jsxs("table",{className:"w-full border-separate border-spacing-0",style:{minWidth:280+200*E.length+"px",borderCollapse:"separate"},children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:280,minWidth:280}}),E.map(t=>e.jsx("col",{style:{width:200,minWidth:200}},t._id))]}),e.jsx("thead",{children:e.jsxs("tr",{className:"align-top",children:[e.jsx("th",{className:"sticky top-0 left-0 z-30 p-0 bg-white text-left"}),E.map(t=>{const r=t._id===s,n=U(t),a=I&&t._id===p,o=P(t),i=oj(t,N,"monthly")??0,l="monthly"!==w&&null!==o?iN(i,o,w):null,c=O(t),d=t.pricingVariants?.length&&t.pricingVariants.some(e=>e.currency?.toLowerCase()===N.toLowerCase())?N:t.plan?.currency??N??"";return e.jsx("th",{className:"sticky top-0 z-20 border-b border-slate-200 p-3 shadow-[0_2px_4px_-2px_rgba(0,0,0,0.06)] "+(t._id===s?"bg-blue-50/80":"bg-white"),children:e.jsxs("div",{className:"flex h-full flex-col gap-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"text-lg font-bold text-slate-900 truncate",children:t.plan.name}),r&&e.jsx("span",{className:"shrink-0 rounded-md bg-blue-600 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",children:"Current"})]}),e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-slate-900",children:c&&null!==o||c?sN(o,d):"—"}),null!==o&&o>0&&c&&e.jsx("span",{className:"text-sm text-slate-500",children:oN(w)})]}),null!==l&&l>0&&c&&e.jsxs("span",{className:"text-xs text-emerald-600 font-medium mt-0.5",children:["Save ",l,"% vs monthly"]}),(()=>{const r=fj(t,N);if(!r)return null;const n=pj(t,N,w);return!n||n<=0?null:e.jsxs("div",{className:"text-xs text-slate-500 mt-1 border-t border-slate-100 pt-1",children:[e.jsxs("span",{children:["+ ",ly(n,d),"/seat",oN(w)]}),r.includedSeats>0&&e.jsxs("span",{className:"text-slate-400",children:[" (",r.includedSeats," included)"]})]})})()]}),t.plan.description&&e.jsx("p",{className:"text-xs text-slate-500 line-clamp-2 leading-relaxed text-left",children:t.plan.description}),e.jsx(Zd,{className:"mt-auto w-full",variant:n.variant,disabled:n.disabled||I||!c,progress:a,onClick:()=>R(t._id),children:a?"Processing...":c?n.label:"Unavailable"})]})},t._id)})]})}),e.jsxs("tbody",{children:[A.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Features"}),e.jsx("td",{colSpan:E.length,className:"border-t border-slate-200 bg-slate-100"})]}),A.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),E.map(r=>{const n=M(r,t,w),a=r.pricingVariants?.length?N:r.plan?.currency??N??"",o=F(n,t,a),i="feature"===t.type&&!0===n;return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+(i?"text-emerald-600":"—"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),_.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Limits"}),e.jsx("td",{colSpan:E.length,className:"border-t border-slate-200 bg-slate-100"})]}),_.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),E.map(r=>{const n=M(r,t,w),a=r.pricingVariants?.length?N:r.plan?.currency??N??"",o=F(n,t,a);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("—"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),T.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Quotas"}),e.jsx("td",{colSpan:E.length,className:"border-t border-slate-200 bg-slate-100"})]}),T.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),E.map(r=>{const n=M(r,t,w),a=r.pricingVariants?.length?N:r.plan?.currency??N??"",o=F(n,t,a);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("—"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),E.some(e=>{const t=fj(e,N);return t?.enabled})&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("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"}),e.jsx("td",{colSpan:E.length,className:"border-t border-emerald-200 bg-emerald-50"})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Included seats"}),e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:"Free with base price"})]}),E.map(t=>{const r=fj(t,N);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r?.enabled?r.includedSeats||0:"—"})},t._id)})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Max seats"})}),E.map(t=>{const r=fj(t,N);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r?.enabled?r.maxSeats>0?r.maxSeats:"Unlimited":"—"})},t._id)})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Per extra seat"})}),E.map(t=>{const r=pj(t,N,w),n=t.pricingVariants?.length?N:t.plan?.currency??N??"";return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r&&r>0?`${ly(r,n)}${oN(w)}`:"—"})},t._id)})]}),null!=l&&l>0&&e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Your billable seats"}),e.jsxs("div",{className:"text-xs text-slate-500 mt-0.5",children:[l," member",1!==l?"s":""," in workspace"]})]}),E.map(t=>{const r=fj(t,N);if(!r?.enabled)return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm text-slate-400",children:"—"})},t._id);const n=r.includedSeats||0,a=Math.max(0,l-n);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:0===a?e.jsx("span",{className:"text-sm font-medium text-emerald-600",children:"All included"}):e.jsxs("span",{className:"text-sm font-medium text-amber-600",children:[a," extra seat",1!==a?"s":""]})},t._id)})]})]})]})]})})]})})]})})}});exports.BaseApi=Zt,exports.BetaForm=({onSuccess:r,onError:n,className:a="w-full",fieldClassName:s="flex flex-col gap-1.5 w-full",language:o,customTexts:i={},autoFocus:l=!0,showSuccessMessage:c=!0,hideLogo:d=!1,hideTitles:u=!1})=>{const[f,p]=t.useState("en"),[m,h]=t.useState(!1),[g,b]=t.useState(!1),{submitBetaForm:x,isLoading:y,isSubmitting:v,error:w,config:S,success:j,message:k}=(()=>{const e=Jt(),[r,n]=t.useState(null),[a,s]=t.useState(!0),[o,i]=t.useState(!1),[l,c]=t.useState(null),[d,u]=t.useState(!1),[f,p]=t.useState(null);return t.useEffect(()=>{let t=!1;return(async()=>{s(!0),c(null);try{const r=new pu(e),a=await r.fetchConfig();t||n(a)}catch(e){t||c(e instanceof Error?e.message:"Failed to load beta form config")}finally{t||s(!1)}})(),()=>{t=!0}},[e]),{isLoading:a,isSubmitting:o,config:r,error:l,success:d,message:f,submitBetaForm:t.useCallback(async t=>{if(!e){const e="SaaS OS context is not initialized";return c(e),{success:!1,message:e}}try{i(!0),c(null),u(!1),p(null);const r=new pu(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return u(a),p(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return c(t),u(!1),p(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();t.useEffect(()=>{p((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Rf).indexOf(e)?e:"en"})())},[]),t.useEffect(()=>{j&&c&&(h(!0),b(!0)),w&&b(!0)},[j,c,w]);const N={...Rf[o||f],...i},E=Go({resolver:Qc(Tf),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});t.useEffect(()=>{l&&E.setFocus("name")},[l,E]);const C=E.formState.isValid&&!v;return e.jsx("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:y?e.jsxs("div",{className:ke("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",a),children:[e.jsx(uu,{className:"h-24 w-24 rounded-lg"}),e.jsx(uu,{className:"h-6 w-32"}),e.jsxs("div",{className:"w-full space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(uu,{className:"h-4 w-16"}),e.jsx(uu,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(uu,{className:"h-4 w-16"}),e.jsx(uu,{className:"h-10 w-full"})]}),e.jsx(uu,{className:"h-10 w-full"})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!d&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[S?.logo&&e.jsx(Of,{logo:S?.logo}),S?.name&&e.jsx("div",{children:S?.name})]}),e.jsx(lo,{...E,children:e.jsxs("form",{onSubmit:E.handleSubmit(async e=>{try{const t=await x(e);t.success?(r?.(),E.reset(),c&&h(!0),b(!0)):(n?.(t.message),b(!0))}catch(e){n?.(e instanceof Error?e.message:N.errorMessage),b(!0)}}),className:a,noValidate:!0,"aria-busy":v,children:[!g&&e.jsxs(e.Fragment,{children:[!u&&S?.screen?.register&&e.jsx(Pf,{screen:S?.screen?.register}),e.jsx(ru,{control:E.control,name:"name",render:({field:t})=>e.jsxs(su,{className:s,children:[e.jsx(ou,{children:N.nameLabel}),e.jsx(iu,{children:e.jsx(du,{...t})}),e.jsx(lu,{}),e.jsx(cu,{})]})}),e.jsx(ru,{control:E.control,name:"email",render:({field:t})=>e.jsxs(su,{className:s,children:[e.jsx(ou,{children:N.emailLabel}),e.jsx(iu,{children:e.jsx(du,{...t})}),e.jsx(lu,{}),e.jsx(cu,{})]})}),e.jsx(Zd,{type:"submit",disabled:!C,className:s,children:v?N.submittingText:N.submitText})]}),g&&w&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsxs("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[e.jsx("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),w]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(Zd,{type:"button",onClick:()=>{b(!1),E.reset()},className:s,children:"Try Again"})})]}),g&&m&&k&&e.jsx("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:S?.screen?.thankYou&&e.jsx(Pf,{screen:S?.screen?.thankYou})})]})}),!g&&e.jsx("div",{children:e.jsxs("div",{children:["By submitting this form, you consent to our"," ",e.jsx("a",{href:S?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",e.jsx("a",{href:S?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})},exports.CURRENCY_DISPLAY=ry,exports.CURRENCY_FLAG=ny,exports.PLAN_CURRENCY_CODES=oy,exports.PLAN_CURRENCY_OPTIONS=iy,exports.PUSH_SERVICE_WORKER_SCRIPT="\n// BuildBase Push Notification Service Worker\n// Place this file in your app's public directory (e.g. public/push-sw.js)\n\nself.addEventListener('push', function(event) {\n if (!event.data) return;\n\n try {\n var payload = event.data.json();\n var title = payload.title || 'Notification';\n var options = {\n body: payload.body || '',\n icon: payload.icon || undefined,\n badge: payload.icon || undefined,\n data: { url: payload.url, ...(payload.data || {}) },\n tag: 'buildbase-push-' + Date.now(),\n };\n\n event.waitUntil(\n self.registration.showNotification(title, options)\n );\n } catch (e) {\n console.error('[PushSW] Failed to show notification:', e);\n }\n});\n\nself.addEventListener('notificationclick', function(event) {\n event.notification.close();\n\n var url = event.notification.data && event.notification.data.url;\n if (url) {\n event.waitUntil(\n clients.matchAll({ type: 'window', includeUncontrolled: true }).then(function(clientList) {\n for (var i = 0; i < clientList.length; i++) {\n var client = clientList[i];\n if (client.url === url && 'focus' in client) {\n return client.focus();\n }\n }\n if (clients.openWindow) {\n return clients.openWindow(url);\n }\n })\n );\n }\n});\n",exports.PricingPage=function({slug:t,children:r,loadingFallback:n,errorFallback:a}){const{items:s,plans:o,notes:i,loading:l,error:c,refetch:d}=cr(t);return l?void 0!==n?e.jsx(e.Fragment,{children:n}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(uu,{className:"h-8 w-48"}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(t=>e.jsx(uu,{className:"h-64 rounded-lg"},t))})]}):c?a?e.jsx(e.Fragment,{children:a(c)}):e.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:c}):e.jsx(e.Fragment,{children:r({loading:l,error:c,items:s,plans:o,notes:i,refetch:d})})},exports.PushNotificationProvider=as,exports.QuotaUsageContextProvider=Cr,exports.SaaSOSProvider=xs,exports.SettingsApi=qt,exports.SubscriptionContextProvider=Sr,exports.UserApi=us,exports.WhenAuthenticated=If,exports.WhenNoSubscription=Bf,exports.WhenNotTrialing=Hf,exports.WhenQuotaAvailable=qf,exports.WhenQuotaExhausted=Jf,exports.WhenQuotaOverage=Yf,exports.WhenQuotaThreshold=Xf,exports.WhenRoles=Uf,exports.WhenSubscription=Vf,exports.WhenSubscriptionToPlans=Gf,exports.WhenTrialEnding=Zf,exports.WhenTrialing=Kf,exports.WhenUnauthenticated=Df,exports.WhenUserFeatureDisabled=$f,exports.WhenUserFeatureEnabled=Wf,exports.WhenWorkspaceFeatureDisabled=Lf,exports.WhenWorkspaceFeatureEnabled=zf,exports.WhenWorkspaceRoles=Mf,exports.WorkspaceApi=Xt,exports.WorkspaceSwitcher=function(r){const{isAuthenticated:n,user:a}=es(),s=o(Jt()),{workspaces:i,currentWorkspace:l,loading:c,refreshing:d,switchingToId:u,fetchWorkspaces:f,getFeatures:p,refreshWorkspaces:m,setCurrentWorkspace:h,switchToWorkspace:g}=or(),{settings:b}=Yt(),[x,y]=t.useState(!1),[v,w]=t.useState(0),[S,j]=t.useState(""),k=c||d;t.useEffect(()=>{n&&s&&(0===i.length?(f(),p()):p())},[n,s]),t.useEffect(()=>{n&&s&&v>0&&m()},[v,n,s]);const N=i,E=N.filter(e=>e._id!==l?._id).filter(e=>e.name.toLowerCase().includes(S.toLowerCase())),C=b?.workspace.maxWorkspaces??Number.MAX_VALUE,A=N?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===a?.id?.toString()).length,_=C>(A??0);return e.jsxs(sg,{open:x,onOpenChange:y,children:[e.jsx(og,{children:r.trigger?.(k,l)}),e.jsxs(cg,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e.jsxs(dg,{children:[e.jsxs(ug,{className:"flex items-center gap-2",children:[e.jsx(jd,{className:"h-5 w-5"}),"Switch Workspace"]}),e.jsx(fg,{children:"Select a workspace to switch to or create a new one."})]}),!a&&e.jsx("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),a&&e.jsxs("div",{className:"flex flex-col gap-4",children:[l&&e.jsx(rN,{workspace:l,isCurrentWorkspace:!0,switchToWorkspace:g,switchingToId:u,onClose:()=>y(!1),setCurrentWorkspace:h,setOpen:y,workspacesToUse:N}),e.jsx(rx,{}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",E.length,")"]}),e.jsx("div",{children:e.jsx(Zd,{progress:d,disabled:d,variant:"ghost",onClick:function(){n&&s&&w(e=>e+1)},startIcon:e.jsx(Dd,{}),children:d?"Refreshing...":"Refresh"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Md,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(du,{placeholder:"Search workspaces...",value:S,onChange:e=>j(e.target.value),className:"pl-10"})]}),c?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(Od,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===E.length?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(jd,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:S?"No workspaces found":"No workspaces available"})]}):e.jsx(qb,{className:"h-64",children:e.jsx("div",{className:"flex flex-col gap-2 my-2.5",children:E.map(t=>{const r=t._id===l?._id;return e.jsx(rN,{workspace:t,isCurrentWorkspace:r,switchToWorkspace:g,switchingToId:u,onClose:()=>y(!1),setCurrentWorkspace:h,setOpen:y,workspacesToUse:N},t._id)})})})]}),_&&e.jsxs(e.Fragment,{children:[e.jsx(rx,{}),e.jsx(nN,{onCreated:()=>{f()}})]})]})]})]})},exports.calculateBillableSeats=mj,exports.calculateSeatOverageCents=hj,exports.calculateTotalSubscriptionCents=function(e,t,r,n){const a=oj(e,t,r);return null===a?null:void 0===n?a:a+(hj(e,t,r,n)??0)},exports.eventEmitter=Pt,exports.formatCents=ly,exports.formatOverageRate=function(e,t,r){if(null==e||e<0)return null;const n=null!=t&&t>=1?t:1,a=sy(r),s=(e/100).toFixed(2);return 1===n?`${a}${s}/unit`:`${a}${s}/${n.toLocaleString()} units`},exports.formatOverageRateWithLabel=function(e,t,r,n){if(null==e||e<0)return null;const a=null!=t&&t>=1?t:1,s=sy(n),o=(e/100).toFixed(2);if(r){const e=r.endsWith("s")?r:`${r}s`;return a>=2?`${s}${o}/${a.toLocaleString()} ${e}`:`${s}${o}/${r}`}return 1===a?`${s}${o}/unit`:`${s}${o}/${a.toLocaleString()} units`},exports.formatQuotaIncludedOverage=function(e,t,r,n,a){const s=r.endsWith("s")?r:`${r}s`,o=null!=a&&a>=2?`${a.toLocaleString()} ${s}`:r;return null!=e&&null!=t?`Included: ${e.toLocaleString()}, after that ${ly(t,n)}/${o}`:null!=e?`Included: ${e.toLocaleString()}`:null!=t?`After included: ${ly(t,n)}/${o}`:"—"},exports.formatQuotaWithPrice=bj,exports.getAvailableCurrenciesFromPlans=cj,exports.getBasePriceCents=oj,exports.getBillingIntervalAndCurrencyFromPriceId=uj,exports.getCurrencyFlag=ay,exports.getCurrencySymbol=sy,exports.getDisplayCurrency=function(e,t){const r=sj(e,t);return r?r.currency:e.plan?.currency??""},exports.getPerSeatPriceCents=pj,exports.getPricingVariant=sj,exports.getQuotaDisplayValue=gj,exports.getQuotaDisplayWithVariant=dj,exports.getQuotaOverageCents=lj,exports.getQuotaUnitLabelFromName=function(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"},exports.getSeatPricing=fj,exports.getStripePriceIdForInterval=ij,exports.invalidateQuotaUsage=lr,exports.invalidateSubscription=Rt,exports.useAllQuotaUsage=vr,exports.useBillingPortal=br,exports.useCancelSubscription=xr,exports.useCreateCheckoutSession=pr,exports.useInvoice=(e,r)=>{const{api:n}=sr(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[l,c]=t.useState(null),d=t.useCallback(async()=>{if(e&&r){i(!0),c(null);try{const t=await n.getInvoice(e,r);s(t.invoice)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch invoice";c(n),De(t,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{invoice:a,loading:o,error:l,refetch:d}},exports.useInvoices=gr,exports.usePlanGroup=ur,exports.usePlanGroupVersions=fr,exports.usePublicPlanGroupVersion=e=>{const{api:r}=sr(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,l]=t.useState(null),c=t.useCallback(async()=>{if(e){o(!0),l(null);try{const t=await r.getPlanGroupVersion(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group version";l(r),De(t,{component:"usePublicPlanGroupVersion",action:"fetchVersion",metadata:{groupVersionId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{c()},[c]),{planGroupVersion:n,loading:s,error:i,refetch:c}},exports.usePublicPlans=cr,exports.usePushNotifications=ss,exports.useQuotaUsageContext=Ar,exports.useQuotaUsageStatus=(e,r)=>{const{api:n}=sr(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[l,c]=t.useState(null),d=t.useCallback(async()=>{if(e&&r){i(!0),c(null);try{const t=await n.getQuotaUsageStatus(e,r);s(t)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch quota usage status";c(n),De(t,{component:"useQuotaUsageStatus",action:"fetchStatus",metadata:{workspaceId:e,quotaSlug:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{status:a,loading:o,error:l,refetch:d}},exports.useRecordUsage=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{recordUsage:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const n=await r.recordUsage(e,t);return lr(),n}catch(r){const n=r instanceof Error?r.message:"Failed to record usage";throw o(n),De(r,{component:"useRecordUsage",action:"recordUsage",metadata:{workspaceId:e,request:t}}),r}finally{a(!1)}},[r,e]),loading:n,error:s}},exports.useResumeSubscription=yr,exports.useSaaSAuth=es,exports.useSaaSOs=Jt,exports.useSaaSSettings=Yt,exports.useSaaSWorkspaces=or,exports.useSeatStatus=function(e){const{response:r}=jr();return t.useMemo(()=>{const t={hasSeatPricing:!1,memberCount:0,includedSeats:0,maxSeats:0,billableSeats:0,availableSeats:1/0,isAtMax:!1,isNearMax:!1,perSeatPriceCents:null,currency:""};if(!r?.subscription||!e)return t;const n=r.subscription;if(!n.seatPricingEnabled)return{...t,memberCount:e.users?.length??0};const a=r.planVersion,s=e.billingCurrency||"usd",o=a?fj(a,s):null;if(!o)return{...t,hasSeatPricing:!0,memberCount:e.users?.length??0};const i=e.users?.length??0,l=o.includedSeats??0,c=o.maxSeats??0,d=Math.max(0,i-l),u=c>0?Math.max(0,c-i):1/0,f=c>0&&i>=c,p=c>0&&i>=.8*c&&!f,m=n.billingInterval??"monthly";return{hasSeatPricing:!0,memberCount:i,includedSeats:l,maxSeats:c,billableSeats:d,availableSeats:u,isAtMax:f,isNearMax:p,perSeatPriceCents:a?pj(a,s,m):null,currency:s}},[r,e])},exports.useSubscription=dr,exports.useSubscriptionContext=jr,exports.useSubscriptionManagement=hr,exports.useTrialStatus=function(){const{response:e}=jr();return t.useMemo(()=>{const t=e?.subscription;if(!t||"trialing"!==t.subscriptionStatus)return{isTrialing:!1,daysRemaining:0,trialEndsAt:null,trialStartedAt:null,isTrialEnding:!1};const r=aN(t.trialEnd)??aN(t.stripeCurrentPeriodEnd),n=aN(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])},exports.useUpdateSubscription=mr,exports.useUsageLogs=(e,r,n)=>{const{api:a}=sr(),[s,o]=t.useState([]),[i,l]=t.useState(0),[c,d]=t.useState(0),[u,f]=t.useState(1),[p,m]=t.useState(!1),[h,g]=t.useState(!1),[b,x]=t.useState(!1),[y,v]=t.useState(null),w=n?.from,S=n?.to,j=n?.source,k=n?.page,N=n?.limit,E=t.useCallback(async()=>{if(!e)return o([]),l(0),d(0),f(1),m(!1),void g(!1);x(!0),v(null);try{const t={...r&&{quotaSlug:r},...w&&{from:w},...S&&{to:S},...j&&{source:j},...k&&{page:k},...N&&{limit:N}},n=await a.getUsageLogs(e,t);o(n.docs||[]),l(n.totalDocs||0),d(n.totalPages||0),f(n.page||1),m(n.hasNextPage||!1),g(n.hasPrevPage||!1)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch usage logs";v(n),De(t,{component:"useUsageLogs",action:"fetchLogs",metadata:{workspaceId:e,quotaSlug:r}})}finally{x(!1)}},[a,e,r,w,S,j,k,N]);return t.useEffect(()=>{E()},[E]),{logs:s,totalDocs:i,totalPages:c,page:u,hasNextPage:p,hasPrevPage:h,loading:b,error:y,refetch:E}},exports.useUserAttributes=function(){const e=t.useContext(fs);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e},exports.useUserFeatures=Ff;
|