extended-dynamic-forms 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conditionals/utils.d.ts +4 -0
- package/dist/index.es.js +1976 -1957
- package/dist/index.umd.js +19 -19
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
(function(Y,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react/jsx-runtime"),require("react"),require("react-dom"),require("@rjsf/utils"),require("@rjsf/validator-ajv8"),require("@rjsf/shadcn"),require("@rjsf/core")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom","@rjsf/utils","@rjsf/validator-ajv8","@rjsf/shadcn","@rjsf/core"],w):(Y=typeof globalThis<"u"?globalThis:Y||self,w(Y.ExtendedDynamicForms={},Y.React.jsxRuntime,Y.React,Y.ReactDOM,Y.RJSFUtils,Y.RJSFValidatorAjv8,Y.RJSFShadcn,Y.RJSFCore))})(this,function(Y,w,D,Ho,Er,Uo,vl,yl){"use strict";var Qb=Object.defineProperty;var Zb=(Y,w,D)=>w in Y?Qb(Y,w,{enumerable:!0,configurable:!0,writable:!0,value:D}):Y[w]=D;var wt=(Y,w,D)=>Zb(Y,typeof w!="symbol"?w+"":w,D);function Yo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const E=Yo(D),Cr=Yo(Ho);function zo(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=zo(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function qo(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=zo(e))&&(n&&(n+=" "),n+=t);return n}const ln="-",bl=e=>{const t=xl(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{const s=a.split(ln);return s[0]===""&&s.length!==1&&s.shift(),Ko(s,t)||wl(a)},getConflictingClassGroupIds:(a,s)=>{const c=r[a]||[];return s&&n[a]?[...c,...n[a]]:c}}},Ko=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),o=n?Ko(e.slice(1),n):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(ln);return(a=t.validators.find(({validator:s})=>s(i)))==null?void 0:a.classGroupId},Go=/^\[(.+)\]$/,wl=e=>{if(Go.test(e)){const t=Go.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},xl=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return Cl(Object.entries(e.classGroups),r).forEach(([i,a])=>{un(a,n,i,t)}),n},un=(e,t,r,n)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:Xo(t,o);i.classGroupId=r;return}if(typeof o=="function"){if(El(o)){un(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{un(a,Xo(t,i),r,n)})})},Xo=(e,t)=>{let r=e;return t.split(ln).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},El=e=>e.isThemeGetter,Cl=(e,t)=>t?e.map(([r,n])=>{const o=n.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,s])=>[t+a,s])):i);return[r,o]}):e,Sl=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const o=(i,a)=>{r.set(i,a),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let a=r.get(i);if(a!==void 0)return a;if((a=n.get(i))!==void 0)return o(i,a),a},set(i,a){r.has(i)?r.set(i,a):o(i,a)}}},Qo="!",Ol=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,o=t[0],i=t.length,a=s=>{const c=[];let l=0,d=0,u;for(let v=0;v<s.length;v++){let g=s[v];if(l===0){if(g===o&&(n||s.slice(v,v+i)===t)){c.push(s.slice(d,v)),d=v+i;continue}if(g==="/"){u=v;continue}}g==="["?l++:g==="]"&&l--}const h=c.length===0?s:s.substring(d),p=h.startsWith(Qo),x=p?h.substring(1):h,f=u&&u>d?u-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:x,maybePostfixModifierPosition:f}};return r?s=>r({className:s,parseClassName:a}):a},_l=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},kl=e=>({cache:Sl(e.cacheSize),parseClassName:Ol(e),...bl(e)}),Pl=/\s+/,Ml=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=t,i=[],a=e.trim().split(Pl);let s="";for(let c=a.length-1;c>=0;c-=1){const l=a[c],{modifiers:d,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:p}=r(l);let x=!!p,f=n(x?h.substring(0,p):h);if(!f){if(!x){s=l+(s.length>0?" "+s:s);continue}if(f=n(h),!f){s=l+(s.length>0?" "+s:s);continue}x=!1}const v=_l(d).join(":"),g=u?v+Qo:v,y=g+f;if(i.includes(y))continue;i.push(y);const b=o(f,x);for(let O=0;O<b.length;++O){const S=b[O];i.push(g+S)}s=l+(s.length>0?" "+s:s)}return s};function Al(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Zo(t))&&(n&&(n+=" "),n+=r);return n}const Zo=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Zo(e[n]))&&(r&&(r+=" "),r+=t);return r};function Nl(e,...t){let r,n,o,i=a;function a(c){const l=t.reduce((d,u)=>u(d),e());return r=kl(l),n=r.cache.get,o=r.cache.set,i=s,s(c)}function s(c){const l=n(c);if(l)return l;const d=Ml(c,r);return o(c,d),d}return function(){return i(Al.apply(null,arguments))}}const pe=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},Jo=/^\[(?:([a-z-]+):)?(.+)\]$/i,Dl=/^\d+\/\d+$/,Tl=new Set(["px","full","screen"]),Fl=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Il=/\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$/,Wl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,jl=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ll=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qe=e=>Mt(e)||Tl.has(e)||Dl.test(e),ct=e=>At(e,"length",zl),Mt=e=>!!e&&!Number.isNaN(Number(e)),dn=e=>At(e,"number",Mt),Jt=e=>!!e&&Number.isInteger(Number(e)),Bl=e=>e.endsWith("%")&&Mt(e.slice(0,-1)),te=e=>Jo.test(e),lt=e=>Fl.test(e),$l=new Set(["length","size","percentage"]),Rl=e=>At(e,$l,ei),Vl=e=>At(e,"position",ei),Hl=new Set(["image","url"]),Ul=e=>At(e,Hl,Kl),Yl=e=>At(e,"",ql),er=()=>!0,At=(e,t,r)=>{const n=Jo.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},zl=e=>Il.test(e)&&!Wl.test(e),ei=()=>!1,ql=e=>jl.test(e),Kl=e=>Ll.test(e),Gl=Nl(()=>{const e=pe("colors"),t=pe("spacing"),r=pe("blur"),n=pe("brightness"),o=pe("borderColor"),i=pe("borderRadius"),a=pe("borderSpacing"),s=pe("borderWidth"),c=pe("contrast"),l=pe("grayscale"),d=pe("hueRotate"),u=pe("invert"),h=pe("gap"),p=pe("gradientColorStops"),x=pe("gradientColorStopPositions"),f=pe("inset"),v=pe("margin"),g=pe("opacity"),y=pe("padding"),b=pe("saturate"),O=pe("scale"),S=pe("sepia"),T=pe("skew"),P=pe("space"),L=pe("translate"),H=()=>["auto","contain","none"],B=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",te,t],$=()=>[te,t],K=()=>["",Qe,ct],ee=()=>["auto",Mt,te],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],X=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],m=()=>["start","end","center","between","around","evenly","stretch"],C=()=>["","0",te],_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>[Mt,te];return{cacheSize:500,separator:":",theme:{colors:[er],spacing:[Qe,ct],blur:["none","",lt,te],brightness:k(),borderColor:[e],borderRadius:["none","","full",lt,te],borderSpacing:$(),borderWidth:K(),contrast:k(),grayscale:C(),hueRotate:k(),invert:C(),gap:$(),gradientColorStops:[e],gradientColorStopPositions:[Bl,ct],inset:U(),margin:U(),opacity:k(),padding:$(),saturate:k(),scale:k(),sepia:C(),skew:k(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",te]}],container:["container"],columns:[{columns:[lt]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"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"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...V(),te]}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[f]}],"inset-x":[{"inset-x":[f]}],"inset-y":[{"inset-y":[f]}],start:[{start:[f]}],end:[{end:[f]}],top:[{top:[f]}],right:[{right:[f]}],bottom:[{bottom:[f]}],left:[{left:[f]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Jt,te]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",te]}],grow:[{grow:C()}],shrink:[{shrink:C()}],order:[{order:["first","last","none",Jt,te]}],"grid-cols":[{"grid-cols":[er]}],"col-start-end":[{col:["auto",{span:["full",Jt,te]},te]}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":[er]}],"row-start-end":[{row:["auto",{span:[Jt,te]},te]}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",te]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",te]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...m()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...m(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...m(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",te,t]}],"min-w":[{"min-w":[te,t,"min","max","fit"]}],"max-w":[{"max-w":[te,t,"none","full","min","max","fit","prose",{screen:[lt]},lt]}],h:[{h:[te,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[te,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[te,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[te,t,"auto","min","max","fit"]}],"font-size":[{text:["base",lt,ct]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",dn]}],"font-family":[{font:[er]}],"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:["tighter","tight","normal","wide","wider","widest",te]}],"line-clamp":[{"line-clamp":["none",Mt,dn]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Qe,te]}],"list-image":[{"list-image":["none",te]}],"list-style-type":[{list:["none","disc","decimal",te]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Qe,ct]}],"underline-offset":[{"underline-offset":["auto",Qe,te]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...V(),Vl]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Rl]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Ul]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...X(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:X()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...X()]}],"outline-offset":[{"outline-offset":[Qe,te]}],"outline-w":[{outline:[Qe,ct]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[Qe,ct]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",lt,Yl]}],"shadow-color":[{shadow:[er]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",lt,te]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[u]}],saturate:[{saturate:[b]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",te]}],duration:[{duration:k()}],ease:[{ease:["linear","in","out","in-out",te]}],delay:[{delay:k()}],animate:[{animate:["none","spin","ping","pulse","bounce",te]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[O]}],"scale-x":[{"scale-x":[O]}],"scale-y":[{"scale-y":[O]}],rotate:[{rotate:[Jt,te]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",te]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",te]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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",te]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Qe,ct,dn]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"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-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-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"],"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"]}}});function J(...e){return Gl(qo(e))}const be=E.forwardRef(({className:e,type:t,...r},n)=>w.jsx("input",{type:t,className:J("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));be.displayName="Input";function ti(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ri(...e){return t=>{let r=!1;const n=e.map(o=>{const i=ti(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){const i=n[o];typeof i=="function"?i():ti(e[o],null)}}}}function ue(...e){return E.useCallback(ri(...e),e)}function Nt(e){const t=Ql(e),r=E.forwardRef((n,o)=>{const{children:i,...a}=n,s=E.Children.toArray(i),c=s.find(Jl);if(c){const l=c.props.children,d=s.map(u=>u===c?E.Children.count(l)>1?E.Children.only(null):E.isValidElement(l)?l.props.children:null:u);return w.jsx(t,{...a,ref:o,children:E.isValidElement(l)?E.cloneElement(l,void 0,d):null})}return w.jsx(t,{...a,ref:o,children:i})});return r.displayName=`${e}.Slot`,r}var Xl=Nt("Slot");function Ql(e){const t=E.forwardRef((r,n)=>{const{children:o,...i}=r;if(E.isValidElement(o)){const a=tu(o),s=eu(i,o.props);return o.type!==E.Fragment&&(s.ref=n?ri(n,a):a),E.cloneElement(o,s)}return E.Children.count(o)>1?E.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zl=Symbol("radix.slottable");function Jl(e){return E.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Zl}function eu(e,t){const r={...t};for(const n in t){const o=e[n],i=t[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{const c=i(...s);return o(...s),c}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...e,...r}}function tu(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var ru=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ie=ru.reduce((e,t)=>{const r=Nt(`Primitive.${t}`),n=E.forwardRef((o,i)=>{const{asChild:a,...s}=o,c=a?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(c,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function nu(e,t){e&&Cr.flushSync(()=>e.dispatchEvent(t))}var ou="Label",ni=E.forwardRef((e,t)=>w.jsx(ie.label,{...e,ref:t,onMouseDown:r=>{var o;r.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));ni.displayName=ou;var oi=ni;const ii=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ai=qo,fn=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return ai(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:o,defaultVariants:i}=t,a=Object.keys(o).map(l=>{const d=r==null?void 0:r[l],u=i==null?void 0:i[l];if(d===null)return null;const h=ii(d)||ii(u);return o[l][h]}),s=r&&Object.entries(r).reduce((l,d)=>{let[u,h]=d;return h===void 0||(l[u]=h),l},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((l,d)=>{let{class:u,className:h,...p}=d;return Object.entries(p).every(x=>{let[f,v]=x;return Array.isArray(v)?v.includes({...i,...s}[f]):{...i,...s}[f]===v})?[...l,u,h]:l},[]);return ai(e,a,c,r==null?void 0:r.class,r==null?void 0:r.className)},iu=fn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ke=E.forwardRef(({className:e,...t},r)=>w.jsx(oi,{ref:r,className:J(iu(),e),...t}));ke.displayName=oi.displayName;const Sr=E.forwardRef(({className:e,...t},r)=>w.jsx("div",{ref:r,className:J("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Sr.displayName="Card";const hn=E.forwardRef(({className:e,...t},r)=>w.jsx("div",{ref:r,className:J("flex flex-col space-y-1.5 p-6",e),...t}));hn.displayName="CardHeader";const si=E.forwardRef(({className:e,...t},r)=>w.jsx("h3",{ref:r,className:J("text-2xl font-semibold leading-none tracking-tight",e),...t}));si.displayName="CardTitle";const au=E.forwardRef(({className:e,...t},r)=>w.jsx("p",{ref:r,className:J("text-sm text-muted-foreground",e),...t}));au.displayName="CardDescription";const Or=E.forwardRef(({className:e,...t},r)=>w.jsx("div",{ref:r,className:J("p-6 pt-0",e),...t}));Or.displayName="CardContent";const su=E.forwardRef(({className:e,...t},r)=>w.jsx("div",{ref:r,className:J("flex items-center p-6 pt-0",e),...t}));su.displayName="CardFooter";const ci=({formData:e,onChange:t,required:r,disabled:n,readonly:o,schema:i,idSchema:a})=>{const s=c=>l=>{t({...e,[c]:l.target.value})};return w.jsxs(Sr,{children:[w.jsx(hn,{className:"pb-4",children:w.jsx(si,{className:"text-lg",children:i.title||"Address"})}),w.jsxs(Or,{className:"space-y-4",children:[w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:`${a.$id}_street`,children:["Street Address",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:`${a.$id}_street`,type:"text",value:(e==null?void 0:e.street)||"",onChange:s("street"),disabled:n||o,placeholder:"123 Main St"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:`${a.$id}_city`,children:["City",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:`${a.$id}_city`,type:"text",value:(e==null?void 0:e.city)||"",onChange:s("city"),disabled:n||o,placeholder:"New York"})]}),w.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:`${a.$id}_state`,children:["State/Province",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:`${a.$id}_state`,type:"text",value:(e==null?void 0:e.state)||"",onChange:s("state"),disabled:n||o,placeholder:"NY"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:`${a.$id}_zip`,children:["ZIP/Postal Code",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:`${a.$id}_zip`,type:"text",value:(e==null?void 0:e.zip)||"",onChange:s("zip"),disabled:n||o,placeholder:"10001"})]})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx(ke,{htmlFor:`${a.$id}_country`,children:"Country"}),w.jsx(be,{id:`${a.$id}_country`,type:"text",value:(e==null?void 0:e.country)||"",onChange:s("country"),disabled:n||o,placeholder:"United States"})]})]})]})},li=D.createContext(null),ui=({eventHub:e,formData:t,children:r})=>w.jsx(li.Provider,{value:{eventHub:e,formData:t},children:r}),di=()=>{const e=D.useContext(li);if(!e)throw new Error("useFormEventHub must be used within a FormEventProvider");return e},ve=(e,t,r)=>{const{eventHub:n,formData:o}=di();return D.useMemo(()=>n.createFieldEventHandlers(e,t,o,r),[n,e,t,o,r])},fi=({formData:e,onChange:t,required:r,disabled:n,readonly:o,schema:i,idSchema:a})=>{const s=ve(a.$id,i),c=d=>{const u=d.replace(/\D/g,""),h=u.length;return h<4?u:h<7?`(${u.slice(0,3)}) ${u.slice(3)}`:`(${u.slice(0,3)}) ${u.slice(3,6)}-${u.slice(6,10)}`},l=async d=>{const u=c(d.target.value);t(u),await s.onChange(u)};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:a.$id,children:[i.title||"Phone Number",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:a.$id,type:"tel",value:e||"",onChange:l,disabled:n||o,placeholder:"(555) 123-4567",maxLength:14})]})},hi=({formData:e,onChange:t,required:r,disabled:n,readonly:o,schema:i,uiSchema:a,idSchema:s})=>{var x,f;const c=((x=a==null?void 0:a["ui:options"])==null?void 0:x.currency)||"USD",l=((f=a==null?void 0:a["ui:options"])==null?void 0:f.symbol)||"$",d=ve(s.$id,i),u=v=>{const g=parseFloat(v.replace(/[^0-9.-]+/g,""));return isNaN(g)?"":g.toFixed(2)},h=async v=>{const g=v.target.value.replace(/[^0-9.-]+/g,""),y=g?parseFloat(g):void 0;t(y),await d.onChange(y)},p=async v=>{const g=u(v.target.value),y=g?parseFloat(g):void 0;t(y),await d.onBlur(y)};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:s.$id,children:[i.title||"Amount",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsxs("div",{className:"relative",children:[w.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:String(l)}),w.jsx(be,{id:s.$id,type:"text",inputMode:"decimal",value:e||"",onChange:h,onBlur:p,disabled:n||o,placeholder:"0.00",className:"pl-8 pr-12"}),w.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:String(c)})]})]})},pn=fn("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{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 bg-background 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:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ze=E.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},i)=>{const a=n?Xl:"button";return w.jsx(a,{className:J(pn({variant:t,size:r,className:e})),ref:i,...o})});Ze.displayName="Button";/**
|
|
1
|
+
(function(Y,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react/jsx-runtime"),require("react"),require("react-dom"),require("@rjsf/utils"),require("@rjsf/validator-ajv8"),require("@rjsf/shadcn"),require("@rjsf/core")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom","@rjsf/utils","@rjsf/validator-ajv8","@rjsf/shadcn","@rjsf/core"],w):(Y=typeof globalThis<"u"?globalThis:Y||self,w(Y.ExtendedDynamicForms={},Y.React.jsxRuntime,Y.React,Y.ReactDOM,Y.RJSFUtils,Y.RJSFValidatorAjv8,Y.RJSFShadcn,Y.RJSFCore))})(this,function(Y,w,D,Uo,Er,Yo,yl,bl){"use strict";var Zb=Object.defineProperty;var Jb=(Y,w,D)=>w in Y?Zb(Y,w,{enumerable:!0,configurable:!0,writable:!0,value:D}):Y[w]=D;var wt=(Y,w,D)=>Jb(Y,typeof w!="symbol"?w+"":w,D);function zo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const E=zo(D),Cr=zo(Uo);function qo(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=qo(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ko(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=qo(e))&&(n&&(n+=" "),n+=t);return n}const ln="-",wl=e=>{const t=El(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{const s=a.split(ln);return s[0]===""&&s.length!==1&&s.shift(),Go(s,t)||xl(a)},getConflictingClassGroupIds:(a,s)=>{const c=r[a]||[];return s&&n[a]?[...c,...n[a]]:c}}},Go=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),o=n?Go(e.slice(1),n):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(ln);return(a=t.validators.find(({validator:s})=>s(i)))==null?void 0:a.classGroupId},Xo=/^\[(.+)\]$/,xl=e=>{if(Xo.test(e)){const t=Xo.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},El=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return Sl(Object.entries(e.classGroups),r).forEach(([i,a])=>{un(a,n,i,t)}),n},un=(e,t,r,n)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:Qo(t,o);i.classGroupId=r;return}if(typeof o=="function"){if(Cl(o)){un(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{un(a,Qo(t,i),r,n)})})},Qo=(e,t)=>{let r=e;return t.split(ln).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Cl=e=>e.isThemeGetter,Sl=(e,t)=>t?e.map(([r,n])=>{const o=n.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,s])=>[t+a,s])):i);return[r,o]}):e,Ol=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const o=(i,a)=>{r.set(i,a),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let a=r.get(i);if(a!==void 0)return a;if((a=n.get(i))!==void 0)return o(i,a),a},set(i,a){r.has(i)?r.set(i,a):o(i,a)}}},Zo="!",_l=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,o=t[0],i=t.length,a=s=>{const c=[];let l=0,d=0,u;for(let v=0;v<s.length;v++){let g=s[v];if(l===0){if(g===o&&(n||s.slice(v,v+i)===t)){c.push(s.slice(d,v)),d=v+i;continue}if(g==="/"){u=v;continue}}g==="["?l++:g==="]"&&l--}const h=c.length===0?s:s.substring(d),p=h.startsWith(Zo),x=p?h.substring(1):h,f=u&&u>d?u-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:x,maybePostfixModifierPosition:f}};return r?s=>r({className:s,parseClassName:a}):a},kl=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},Pl=e=>({cache:Ol(e.cacheSize),parseClassName:_l(e),...wl(e)}),Ml=/\s+/,Al=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=t,i=[],a=e.trim().split(Ml);let s="";for(let c=a.length-1;c>=0;c-=1){const l=a[c],{modifiers:d,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:p}=r(l);let x=!!p,f=n(x?h.substring(0,p):h);if(!f){if(!x){s=l+(s.length>0?" "+s:s);continue}if(f=n(h),!f){s=l+(s.length>0?" "+s:s);continue}x=!1}const v=kl(d).join(":"),g=u?v+Zo:v,y=g+f;if(i.includes(y))continue;i.push(y);const b=o(f,x);for(let O=0;O<b.length;++O){const S=b[O];i.push(g+S)}s=l+(s.length>0?" "+s:s)}return s};function Nl(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Jo(t))&&(n&&(n+=" "),n+=r);return n}const Jo=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Jo(e[n]))&&(r&&(r+=" "),r+=t);return r};function Dl(e,...t){let r,n,o,i=a;function a(c){const l=t.reduce((d,u)=>u(d),e());return r=Pl(l),n=r.cache.get,o=r.cache.set,i=s,s(c)}function s(c){const l=n(c);if(l)return l;const d=Al(c,r);return o(c,d),d}return function(){return i(Nl.apply(null,arguments))}}const pe=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},ei=/^\[(?:([a-z-]+):)?(.+)\]$/i,Tl=/^\d+\/\d+$/,Fl=new Set(["px","full","screen"]),Il=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Wl=/\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$/,jl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Ll=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bl=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qe=e=>Mt(e)||Fl.has(e)||Tl.test(e),ct=e=>At(e,"length",ql),Mt=e=>!!e&&!Number.isNaN(Number(e)),dn=e=>At(e,"number",Mt),Jt=e=>!!e&&Number.isInteger(Number(e)),$l=e=>e.endsWith("%")&&Mt(e.slice(0,-1)),te=e=>ei.test(e),lt=e=>Il.test(e),Rl=new Set(["length","size","percentage"]),Vl=e=>At(e,Rl,ti),Hl=e=>At(e,"position",ti),Ul=new Set(["image","url"]),Yl=e=>At(e,Ul,Gl),zl=e=>At(e,"",Kl),er=()=>!0,At=(e,t,r)=>{const n=ei.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},ql=e=>Wl.test(e)&&!jl.test(e),ti=()=>!1,Kl=e=>Ll.test(e),Gl=e=>Bl.test(e),Xl=Dl(()=>{const e=pe("colors"),t=pe("spacing"),r=pe("blur"),n=pe("brightness"),o=pe("borderColor"),i=pe("borderRadius"),a=pe("borderSpacing"),s=pe("borderWidth"),c=pe("contrast"),l=pe("grayscale"),d=pe("hueRotate"),u=pe("invert"),h=pe("gap"),p=pe("gradientColorStops"),x=pe("gradientColorStopPositions"),f=pe("inset"),v=pe("margin"),g=pe("opacity"),y=pe("padding"),b=pe("saturate"),O=pe("scale"),S=pe("sepia"),T=pe("skew"),P=pe("space"),L=pe("translate"),$=()=>["auto","contain","none"],B=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",te,t],R=()=>[te,t],K=()=>["",Qe,ct],ee=()=>["auto",Mt,te],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],X=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],m=()=>["start","end","center","between","around","evenly","stretch"],C=()=>["","0",te],_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>[Mt,te];return{cacheSize:500,separator:":",theme:{colors:[er],spacing:[Qe,ct],blur:["none","",lt,te],brightness:k(),borderColor:[e],borderRadius:["none","","full",lt,te],borderSpacing:R(),borderWidth:K(),contrast:k(),grayscale:C(),hueRotate:k(),invert:C(),gap:R(),gradientColorStops:[e],gradientColorStopPositions:[$l,ct],inset:U(),margin:U(),opacity:k(),padding:R(),saturate:k(),scale:k(),sepia:C(),skew:k(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",te]}],container:["container"],columns:[{columns:[lt]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"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"],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:[...H(),te]}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[f]}],"inset-x":[{"inset-x":[f]}],"inset-y":[{"inset-y":[f]}],start:[{start:[f]}],end:[{end:[f]}],top:[{top:[f]}],right:[{right:[f]}],bottom:[{bottom:[f]}],left:[{left:[f]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Jt,te]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",te]}],grow:[{grow:C()}],shrink:[{shrink:C()}],order:[{order:["first","last","none",Jt,te]}],"grid-cols":[{"grid-cols":[er]}],"col-start-end":[{col:["auto",{span:["full",Jt,te]},te]}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":[er]}],"row-start-end":[{row:["auto",{span:[Jt,te]},te]}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",te]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",te]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...m()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...m(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...m(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",te,t]}],"min-w":[{"min-w":[te,t,"min","max","fit"]}],"max-w":[{"max-w":[te,t,"none","full","min","max","fit","prose",{screen:[lt]},lt]}],h:[{h:[te,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[te,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[te,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[te,t,"auto","min","max","fit"]}],"font-size":[{text:["base",lt,ct]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",dn]}],"font-family":[{font:[er]}],"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:["tighter","tight","normal","wide","wider","widest",te]}],"line-clamp":[{"line-clamp":["none",Mt,dn]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Qe,te]}],"list-image":[{"list-image":["none",te]}],"list-style-type":[{list:["none","disc","decimal",te]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Qe,ct]}],"underline-offset":[{"underline-offset":["auto",Qe,te]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),Hl]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Vl]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Yl]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...X(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:X()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...X()]}],"outline-offset":[{"outline-offset":[Qe,te]}],"outline-w":[{outline:[Qe,ct]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[Qe,ct]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",lt,zl]}],"shadow-color":[{shadow:[er]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",lt,te]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[u]}],saturate:[{saturate:[b]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",te]}],duration:[{duration:k()}],ease:[{ease:["linear","in","out","in-out",te]}],delay:[{delay:k()}],animate:[{animate:["none","spin","ping","pulse","bounce",te]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[O]}],"scale-x":[{"scale-x":[O]}],"scale-y":[{"scale-y":[O]}],rotate:[{rotate:[Jt,te]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",te]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",te]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",te]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Qe,ct,dn]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"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-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-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"],"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"]}}});function J(...e){return Xl(Ko(e))}const be=E.forwardRef(({className:e,type:t,...r},n)=>w.jsx("input",{type:t,className:J("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));be.displayName="Input";function ri(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ni(...e){return t=>{let r=!1;const n=e.map(o=>{const i=ri(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){const i=n[o];typeof i=="function"?i():ri(e[o],null)}}}}function ue(...e){return E.useCallback(ni(...e),e)}function Nt(e){const t=Zl(e),r=E.forwardRef((n,o)=>{const{children:i,...a}=n,s=E.Children.toArray(i),c=s.find(eu);if(c){const l=c.props.children,d=s.map(u=>u===c?E.Children.count(l)>1?E.Children.only(null):E.isValidElement(l)?l.props.children:null:u);return w.jsx(t,{...a,ref:o,children:E.isValidElement(l)?E.cloneElement(l,void 0,d):null})}return w.jsx(t,{...a,ref:o,children:i})});return r.displayName=`${e}.Slot`,r}var Ql=Nt("Slot");function Zl(e){const t=E.forwardRef((r,n)=>{const{children:o,...i}=r;if(E.isValidElement(o)){const a=ru(o),s=tu(i,o.props);return o.type!==E.Fragment&&(s.ref=n?ni(n,a):a),E.cloneElement(o,s)}return E.Children.count(o)>1?E.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Jl=Symbol("radix.slottable");function eu(e){return E.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Jl}function tu(e,t){const r={...t};for(const n in t){const o=e[n],i=t[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{const c=i(...s);return o(...s),c}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...e,...r}}function ru(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var nu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ie=nu.reduce((e,t)=>{const r=Nt(`Primitive.${t}`),n=E.forwardRef((o,i)=>{const{asChild:a,...s}=o,c=a?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(c,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ou(e,t){e&&Cr.flushSync(()=>e.dispatchEvent(t))}var iu="Label",oi=E.forwardRef((e,t)=>w.jsx(ie.label,{...e,ref:t,onMouseDown:r=>{var o;r.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));oi.displayName=iu;var ii=oi;const ai=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,si=Ko,fn=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return si(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:o,defaultVariants:i}=t,a=Object.keys(o).map(l=>{const d=r==null?void 0:r[l],u=i==null?void 0:i[l];if(d===null)return null;const h=ai(d)||ai(u);return o[l][h]}),s=r&&Object.entries(r).reduce((l,d)=>{let[u,h]=d;return h===void 0||(l[u]=h),l},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((l,d)=>{let{class:u,className:h,...p}=d;return Object.entries(p).every(x=>{let[f,v]=x;return Array.isArray(v)?v.includes({...i,...s}[f]):{...i,...s}[f]===v})?[...l,u,h]:l},[]);return si(e,a,c,r==null?void 0:r.class,r==null?void 0:r.className)},au=fn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ke=E.forwardRef(({className:e,...t},r)=>w.jsx(ii,{ref:r,className:J(au(),e),...t}));ke.displayName=ii.displayName;const Sr=E.forwardRef(({className:e,...t},r)=>w.jsx("div",{ref:r,className:J("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Sr.displayName="Card";const hn=E.forwardRef(({className:e,...t},r)=>w.jsx("div",{ref:r,className:J("flex flex-col space-y-1.5 p-6",e),...t}));hn.displayName="CardHeader";const ci=E.forwardRef(({className:e,...t},r)=>w.jsx("h3",{ref:r,className:J("text-2xl font-semibold leading-none tracking-tight",e),...t}));ci.displayName="CardTitle";const su=E.forwardRef(({className:e,...t},r)=>w.jsx("p",{ref:r,className:J("text-sm text-muted-foreground",e),...t}));su.displayName="CardDescription";const Or=E.forwardRef(({className:e,...t},r)=>w.jsx("div",{ref:r,className:J("p-6 pt-0",e),...t}));Or.displayName="CardContent";const cu=E.forwardRef(({className:e,...t},r)=>w.jsx("div",{ref:r,className:J("flex items-center p-6 pt-0",e),...t}));cu.displayName="CardFooter";const li=({formData:e,onChange:t,required:r,disabled:n,readonly:o,schema:i,idSchema:a})=>{const s=c=>l=>{t({...e,[c]:l.target.value})};return w.jsxs(Sr,{children:[w.jsx(hn,{className:"pb-4",children:w.jsx(ci,{className:"text-lg",children:i.title||"Address"})}),w.jsxs(Or,{className:"space-y-4",children:[w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:`${a.$id}_street`,children:["Street Address",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:`${a.$id}_street`,type:"text",value:(e==null?void 0:e.street)||"",onChange:s("street"),disabled:n||o,placeholder:"123 Main St"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:`${a.$id}_city`,children:["City",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:`${a.$id}_city`,type:"text",value:(e==null?void 0:e.city)||"",onChange:s("city"),disabled:n||o,placeholder:"New York"})]}),w.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:`${a.$id}_state`,children:["State/Province",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:`${a.$id}_state`,type:"text",value:(e==null?void 0:e.state)||"",onChange:s("state"),disabled:n||o,placeholder:"NY"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:`${a.$id}_zip`,children:["ZIP/Postal Code",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:`${a.$id}_zip`,type:"text",value:(e==null?void 0:e.zip)||"",onChange:s("zip"),disabled:n||o,placeholder:"10001"})]})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx(ke,{htmlFor:`${a.$id}_country`,children:"Country"}),w.jsx(be,{id:`${a.$id}_country`,type:"text",value:(e==null?void 0:e.country)||"",onChange:s("country"),disabled:n||o,placeholder:"United States"})]})]})]})},ui=D.createContext(null),di=({eventHub:e,formData:t,children:r})=>w.jsx(ui.Provider,{value:{eventHub:e,formData:t},children:r}),fi=()=>{const e=D.useContext(ui);if(!e)throw new Error("useFormEventHub must be used within a FormEventProvider");return e},ve=(e,t,r)=>{const{eventHub:n,formData:o}=fi();return D.useMemo(()=>n.createFieldEventHandlers(e,t,o,r),[n,e,t,o,r])},hi=({formData:e,onChange:t,required:r,disabled:n,readonly:o,schema:i,idSchema:a})=>{const s=ve(a.$id,i),c=d=>{const u=d.replace(/\D/g,""),h=u.length;return h<4?u:h<7?`(${u.slice(0,3)}) ${u.slice(3)}`:`(${u.slice(0,3)}) ${u.slice(3,6)}-${u.slice(6,10)}`},l=async d=>{const u=c(d.target.value);t(u),await s.onChange(u)};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:a.$id,children:[i.title||"Phone Number",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:a.$id,type:"tel",value:e||"",onChange:l,disabled:n||o,placeholder:"(555) 123-4567",maxLength:14})]})},pi=({formData:e,onChange:t,required:r,disabled:n,readonly:o,schema:i,uiSchema:a,idSchema:s})=>{var x,f;const c=((x=a==null?void 0:a["ui:options"])==null?void 0:x.currency)||"USD",l=((f=a==null?void 0:a["ui:options"])==null?void 0:f.symbol)||"$",d=ve(s.$id,i),u=v=>{const g=parseFloat(v.replace(/[^0-9.-]+/g,""));return isNaN(g)?"":g.toFixed(2)},h=async v=>{const g=v.target.value.replace(/[^0-9.-]+/g,""),y=g?parseFloat(g):void 0;t(y),await d.onChange(y)},p=async v=>{const g=u(v.target.value),y=g?parseFloat(g):void 0;t(y),await d.onBlur(y)};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:s.$id,children:[i.title||"Amount",r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsxs("div",{className:"relative",children:[w.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:String(l)}),w.jsx(be,{id:s.$id,type:"text",inputMode:"decimal",value:e||"",onChange:h,onBlur:p,disabled:n||o,placeholder:"0.00",className:"pl-8 pr-12"}),w.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:String(c)})]})]})},pn=fn("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{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 bg-background 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:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ze=E.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},i)=>{const a=n?Ql:"button";return w.jsx(a,{className:J(pn({variant:t,size:r,className:e})),ref:i,...o})});Ze.displayName="Button";/**
|
|
2
2
|
* @license lucide-react v0.303.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/var
|
|
6
|
+
*/var lu={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"};/**
|
|
7
7
|
* @license lucide-react v0.303.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const uu=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Re=(e,t)=>{const r=D.forwardRef(({color:n="currentColor",size:o=24,strokeWidth:i=2,absoluteStrokeWidth:a,className:s="",children:c,...l},d)=>D.createElement("svg",{ref:d,...lu,width:o,height:o,stroke:n,strokeWidth:a?Number(i)*24/Number(o):i,className:["lucide",`lucide-${uu(e)}`,s].join(" "),...l},[...t.map(([u,h])=>D.createElement(u,h)),...Array.isArray(c)?c:[c]]));return r.displayName=`${e}`,r};/**
|
|
12
12
|
* @license lucide-react v0.303.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const du=Re("Calendar",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",ry:"2",key:"eu3xkr"}],["line",{x1:"16",x2:"16",y1:"2",y2:"6",key:"m3sa8f"}],["line",{x1:"8",x2:"8",y1:"2",y2:"6",key:"18kwsl"}],["line",{x1:"3",x2:"21",y1:"10",y2:"10",key:"xt86sb"}]]);/**
|
|
17
17
|
* @license lucide-react v0.303.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const mi=Re("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
22
22
|
* @license lucide-react v0.303.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
@@ -28,38 +28,38 @@
|
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const
|
|
31
|
+
*/const fu=Re("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
32
32
|
* @license lucide-react v0.303.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const
|
|
36
|
+
*/const hu=Re("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
37
37
|
* @license lucide-react v0.303.0 - ISC
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const
|
|
41
|
+
*/const gi=Re("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
42
42
|
* @license lucide-react v0.303.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const
|
|
46
|
+
*/const pu=Re("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
47
47
|
* @license lucide-react v0.303.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const
|
|
51
|
+
*/const mu=Re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
52
52
|
* @license lucide-react v0.303.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const
|
|
56
|
+
*/const gu=Re("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
|
|
57
57
|
* @license lucide-react v0.303.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const gn=Re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),gi=e=>{const{canAdd:t,disabled:r,idSchema:n,uiSchema:o,items:i,onAddClick:a,readonly:s,registry:c,required:l,schema:d,title:u}=e,h=Er.getUiOptions(o),p=Er.getTemplate("ArrayFieldDescriptionTemplate",c,h),x=Er.getTemplate("ArrayFieldItemTemplate",c,h),f=Er.getTemplate("ArrayFieldTitleTemplate",c,h);return w.jsx("div",{className:J("rjsf-array-field",h.classNames),children:w.jsxs(Sr,{className:"border-slate-200",children:[(u||h.title)&&w.jsxs(hn,{className:"pb-3",children:[w.jsx(f,{idSchema:n,title:h.title||u,required:l,schema:d,uiSchema:o,registry:c}),(h.description||d.description)&&w.jsx(p,{idSchema:n,description:h.description||d.description,schema:d,uiSchema:o,registry:c})]}),w.jsxs(Or,{className:"space-y-3",children:[i&&i.map(({key:v,...g})=>w.jsx(x,{...g},v)),t&&w.jsxs(Ze,{type:"button",onClick:a,disabled:r||s,size:"sm",variant:"outline",className:"w-full border-dashed",children:[w.jsx(pu,{className:"h-4 w-4 mr-2"}),"Add ",u||"Item"]})]})]})})},vi=e=>{const{children:t,disabled:r,hasToolbar:n,buttonsProps:o,readonly:i}=e,{hasMoveDown:a,hasMoveUp:s,hasRemove:c,index:l,onDropIndexClick:d,onReorderClick:u}=o;return w.jsx(Sr,{className:"relative border-slate-200",children:w.jsxs(Or,{className:"p-4",children:[n&&w.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-1",children:[(s||a)&&w.jsx("div",{className:"flex items-center mr-2",children:w.jsx(hu,{className:"h-4 w-4 text-slate-400"})}),s&&w.jsx(Ze,{type:"button",size:"sm",variant:"ghost",disabled:r||i,onClick:u(l,l-1),className:"h-8 w-8 p-0",title:"Move up",children:w.jsx(mi,{className:"h-4 w-4"})}),a&&w.jsx(Ze,{type:"button",size:"sm",variant:"ghost",disabled:r||i,onClick:u(l,l+1),className:"h-8 w-8 p-0",title:"Move down",children:w.jsx(mn,{className:"h-4 w-4"})}),c&&w.jsx(Ze,{type:"button",size:"sm",variant:"ghost",disabled:r||i,onClick:d(l),className:"h-8 w-8 p-0 text-destructive hover:text-destructive",title:"Remove",children:w.jsx(gn,{className:"h-4 w-4"})})]}),w.jsx("div",{className:J(n&&"pr-24"),children:t})]})})},yi={address:ci,phone:fi,currency:hi},bi={ArrayFieldTemplate:gi,ArrayFieldItemTemplate:vi},wi=({id:e,value:t,required:r,disabled:n,readonly:o,label:i,onChange:a,onBlur:s,onFocus:c,schema:l})=>{const d=ve(e,l),u=async x=>{const f=x.target.value;a(f),await d.onChange(f)},h=async x=>{const f=x.target.value;s&&s(e,f),await d.onBlur(f)},p=async x=>{const f=x.target.value;c&&c(e,f),await d.onFocus(f)};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:e,children:[i||l.title,r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:e,type:"color",value:t||"#000000",required:r,disabled:n||o,onChange:u,onBlur:h,onFocus:p,className:"h-10 w-full cursor-pointer"})]})},gu=({id:e,value:t,required:r,disabled:n,readonly:o,label:i,onChange:a,onBlur:s,onFocus:c,options:l,schema:d})=>{const u=l.inputType||"date",h=ve(e,d),p=async v=>{const g=v.target.value;a(g),await h.onChange(g)},x=async v=>{const g=v.target.value;s&&s(e,g),await h.onBlur(g)},f=async v=>{const g=v.target.value;c&&c(e,g),await h.onFocus(g)};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:e,children:[i||d.title,r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:e,type:u,value:t||"",required:r,disabled:n||o,onChange:p,onBlur:x,onFocus:f,min:typeof l.minDate=="string"||typeof l.minDate=="number"?l.minDate:void 0,max:typeof l.maxDate=="string"||typeof l.maxDate=="number"?l.maxDate:void 0,className:"w-full"})]})},vu=fn("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function xi({className:e,variant:t,...r}){return w.jsx("div",{className:J(vu({variant:t}),e),...r})}const Ei=({id:e,value:t,required:r,disabled:n,readonly:o,label:i,onChange:a,options:s,schema:c})=>{const l=D.useRef(null),d=s.accept||"*/*",u=s.multiple||!1,h=ve(e,c),p=async v=>{const g=v.target.files;if(!g)return;let y;if(u){const b=Array.from(g).map(O=>({name:O.name,size:O.size,type:O.type,lastModified:O.lastModified}));y=b,a(b)}else{const b=g[0];b&&(y={name:b.name,size:b.size,type:b.type,lastModified:b.lastModified},a(y))}y&&await h.onChange(y)},x=async()=>{l.current&&(l.current.value=""),a(null),await h.onChange(null)},f=v=>v<1024?v+" B":v<1024*1024?(v/1024).toFixed(1)+" KB":(v/(1024*1024)).toFixed(1)+" MB";return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:e,children:[i||c.title,r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{ref:l,id:e,type:"file",accept:d,multiple:u,required:r,disabled:n||o,onChange:p,className:"cursor-pointer"}),t&&w.jsx("div",{className:"space-y-2",children:u&&Array.isArray(t)?w.jsx("div",{className:"flex flex-wrap gap-2",children:t.map((v,g)=>w.jsxs(xi,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[w.jsxs("span",{className:"text-xs",children:[v.name," (",f(v.size),")"]}),!n&&!o&&w.jsx(Ze,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-transparent",onClick:x,children:w.jsx(gn,{className:"h-3 w-3"})})]},g))}):t&&typeof t=="object"&&"name"in t?w.jsxs(xi,{variant:"secondary",className:"inline-flex items-center gap-1 pr-1",children:[w.jsxs("span",{className:"text-xs",children:[t.name," (",f(t.size),")"]}),!n&&!o&&w.jsx(Ze,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-transparent",onClick:x,children:w.jsx(gn,{className:"h-3 w-3"})})]}):null})]})};function _r(e,[t,r]){return Math.min(r,Math.max(t,e))}function oe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e==null||e(o),r===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Dt(e,t=[]){let r=[];function n(i,a){const s=E.createContext(a),c=r.length;r=[...r,a];const l=u=>{var g;const{scope:h,children:p,...x}=u,f=((g=h==null?void 0:h[e])==null?void 0:g[c])||s,v=E.useMemo(()=>x,Object.values(x));return w.jsx(f.Provider,{value:v,children:p})};l.displayName=i+"Provider";function d(u,h){var f;const p=((f=h==null?void 0:h[e])==null?void 0:f[c])||s,x=E.useContext(p);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${i}\``)}return[l,d]}const o=()=>{const i=r.map(a=>E.createContext(a));return function(s){const c=(s==null?void 0:s[e])||i;return E.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return o.scopeName=e,[n,yu(o,...t)]}function yu(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const a=n.reduce((s,{useScope:c,scopeName:l})=>{const u=c(i)[`__scope${l}`];return{...s,...u}},{});return E.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}var Ce=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},bu=E[" useInsertionEffect ".trim().toString()]||Ce;function tr({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[o,i,a]=wu({defaultProp:t,onChange:r}),s=e!==void 0,c=s?e:o;{const d=E.useRef(e!==void 0);E.useEffect(()=>{const u=d.current;u!==s&&console.warn(`${n} is changing from ${u?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. 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.`),d.current=s},[s,n])}const l=E.useCallback(d=>{var u;if(s){const h=xu(d)?d(e):d;h!==e&&((u=a.current)==null||u.call(a,h))}else i(d)},[s,e,i,a]);return[c,l]}function wu({defaultProp:e,onChange:t}){const[r,n]=E.useState(e),o=E.useRef(r),i=E.useRef(t);return bu(()=>{i.current=t},[t]),E.useEffect(()=>{var a;o.current!==r&&((a=i.current)==null||a.call(i,r),o.current=r)},[r,o]),[r,n,i]}function xu(e){return typeof e=="function"}var Eu=E.createContext(void 0);function Ci(e){const t=E.useContext(Eu);return e||t||"ltr"}function vn(e){const t=E.useRef({value:e,previous:e});return E.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function yn(e){const[t,r]=E.useState(void 0);return Ce(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let a,s;if("borderBoxSize"in i){const c=i.borderBoxSize,l=Array.isArray(c)?c[0]:c;a=l.inlineSize,s=l.blockSize}else a=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}function Si(e){const t=e+"CollectionProvider",[r,n]=Dt(t),[o,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=f=>{const{scope:v,children:g}=f,y=D.useRef(null),b=D.useRef(new Map).current;return w.jsx(o,{scope:v,itemMap:b,collectionRef:y,children:g})};a.displayName=t;const s=e+"CollectionSlot",c=Nt(s),l=D.forwardRef((f,v)=>{const{scope:g,children:y}=f,b=i(s,g),O=ue(v,b.collectionRef);return w.jsx(c,{ref:O,children:y})});l.displayName=s;const d=e+"CollectionItemSlot",u="data-radix-collection-item",h=Nt(d),p=D.forwardRef((f,v)=>{const{scope:g,children:y,...b}=f,O=D.useRef(null),S=ue(v,O),T=i(d,g);return D.useEffect(()=>(T.itemMap.set(O,{ref:O,...b}),()=>void T.itemMap.delete(O))),w.jsx(h,{[u]:"",ref:S,children:y})});p.displayName=d;function x(f){const v=i(e+"CollectionConsumer",f);return D.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((T,P)=>b.indexOf(T.ref.current)-b.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},x,n]}var Oi=["PageUp","PageDown"],_i=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ki={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Tt="Slider",[bn,Cu,Su]=Si(Tt),[Pi,ew]=Dt(Tt,[Su]),[Ou,kr]=Pi(Tt),Mi=E.forwardRef((e,t)=>{const{name:r,min:n=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:c=0,defaultValue:l=[n],value:d,onValueChange:u=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:x,...f}=e,v=E.useRef(new Set),g=E.useRef(0),b=a==="horizontal"?_u:ku,[O=[],S]=tr({prop:d,defaultProp:l,onChange:U=>{var K;(K=[...v.current][g.current])==null||K.focus(),u(U)}}),T=E.useRef(O);function P(U){const $=Du(O,U);B(U,$)}function L(U){B(U,g.current)}function H(){const U=T.current[g.current];O[g.current]!==U&&h(O)}function B(U,$,{commit:K}={commit:!1}){const ee=Wu(i),V=ju(Math.round((U-n)/i)*i+n,ee),X=_r(V,[n,o]);S((Z=[])=>{const m=Au(Z,X,$);if(Iu(m,c*i)){g.current=m.indexOf(X);const C=String(m)!==String(Z);return C&&K&&h(m),C?m:Z}else return Z})}return w.jsx(Ou,{scope:e.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:v.current,values:O,orientation:a,form:x,children:w.jsx(bn.Provider,{scope:e.__scopeSlider,children:w.jsx(bn.Slot,{scope:e.__scopeSlider,children:w.jsx(b,{"aria-disabled":s,"data-disabled":s?"":void 0,...f,ref:t,onPointerDown:oe(f.onPointerDown,()=>{s||(T.current=O)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:P,onSlideMove:s?void 0:L,onSlideEnd:s?void 0:H,onHomeKeyDown:()=>!s&&B(n,0,{commit:!0}),onEndKeyDown:()=>!s&&B(o,O.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:$})=>{if(!s){const V=Oi.includes(U.key)||U.shiftKey&&_i.includes(U.key)?10:1,X=g.current,Z=O[X],m=i*V*$;B(Z+m,X,{commit:!0})}}})})})})});Mi.displayName=Tt;var[Ai,Ni]=Pi(Tt,{startEdge:"left",endEdge:"right",size:"width",direction:1}),_u=E.forwardRef((e,t)=>{const{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...d}=e,[u,h]=E.useState(null),p=ue(t,b=>h(b)),x=E.useRef(void 0),f=Ci(o),v=f==="ltr",g=v&&!i||!v&&i;function y(b){const O=x.current||u.getBoundingClientRect(),S=[0,O.width],P=En(S,g?[r,n]:[n,r]);return x.current=O,P(b-O.left)}return w.jsx(Ai,{scope:e.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:w.jsx(Di,{dir:f,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const O=y(b.clientX);a==null||a(O)},onSlideMove:b=>{const O=y(b.clientX);s==null||s(O)},onSlideEnd:()=>{x.current=void 0,c==null||c()},onStepKeyDown:b=>{const S=ki[g?"from-left":"from-right"].includes(b.key);l==null||l({event:b,direction:S?-1:1})}})})}),ku=E.forwardRef((e,t)=>{const{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:c,...l}=e,d=E.useRef(null),u=ue(t,d),h=E.useRef(void 0),p=!o;function x(f){const v=h.current||d.current.getBoundingClientRect(),g=[0,v.height],b=En(g,p?[n,r]:[r,n]);return h.current=v,b(f-v.top)}return w.jsx(Ai,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:w.jsx(Di,{"data-orientation":"vertical",...l,ref:u,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:f=>{const v=x(f.clientY);i==null||i(v)},onSlideMove:f=>{const v=x(f.clientY);a==null||a(v)},onSlideEnd:()=>{h.current=void 0,s==null||s()},onStepKeyDown:f=>{const g=ki[p?"from-bottom":"from-top"].includes(f.key);c==null||c({event:f,direction:g?-1:1})}})})}),Di=E.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:c,...l}=e,d=kr(Tt,r);return w.jsx(ie.span,{...l,ref:t,onKeyDown:oe(e.onKeyDown,u=>{u.key==="Home"?(a(u),u.preventDefault()):u.key==="End"?(s(u),u.preventDefault()):Oi.concat(_i).includes(u.key)&&(c(u),u.preventDefault())}),onPointerDown:oe(e.onPointerDown,u=>{const h=u.target;h.setPointerCapture(u.pointerId),u.preventDefault(),d.thumbs.has(h)?h.focus():n(u)}),onPointerMove:oe(e.onPointerMove,u=>{u.target.hasPointerCapture(u.pointerId)&&o(u)}),onPointerUp:oe(e.onPointerUp,u=>{const h=u.target;h.hasPointerCapture(u.pointerId)&&(h.releasePointerCapture(u.pointerId),i(u))})})}),Ti="SliderTrack",Fi=E.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,o=kr(Ti,r);return w.jsx(ie.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:t})});Fi.displayName=Ti;var wn="SliderRange",Ii=E.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,o=kr(wn,r),i=Ni(wn,r),a=E.useRef(null),s=ue(t,a),c=o.values.length,l=o.values.map(h=>Li(h,o.min,o.max)),d=c>1?Math.min(...l):0,u=100-Math.max(...l);return w.jsx(ie.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...e.style,[i.startEdge]:d+"%",[i.endEdge]:u+"%"}})});Ii.displayName=wn;var xn="SliderThumb",Wi=E.forwardRef((e,t)=>{const r=Cu(e.__scopeSlider),[n,o]=E.useState(null),i=ue(t,s=>o(s)),a=E.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return w.jsx(Pu,{...e,ref:i,index:a})}),Pu=E.forwardRef((e,t)=>{const{__scopeSlider:r,index:n,name:o,...i}=e,a=kr(xn,r),s=Ni(xn,r),[c,l]=E.useState(null),d=ue(t,y=>l(y)),u=c?a.form||!!c.closest("form"):!0,h=yn(c),p=a.values[n],x=p===void 0?0:Li(p,a.min,a.max),f=Nu(n,a.values.length),v=h==null?void 0:h[s.size],g=v?Tu(v,x,s.direction):0;return E.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),w.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${x}% + ${g}px)`},children:[w.jsx(bn.ItemSlot,{scope:e.__scopeSlider,children:w.jsx(ie.span,{role:"slider","aria-label":e["aria-label"]||f,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:d,style:p===void 0?{display:"none"}:e.style,onFocus:oe(e.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),u&&w.jsx(ji,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});Wi.displayName=xn;var Mu="RadioBubbleInput",ji=E.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{const o=E.useRef(null),i=ue(o,n),a=vn(t);return E.useEffect(()=>{const s=o.current;if(!s)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&d){const u=new Event("input",{bubbles:!0});d.call(s,t),s.dispatchEvent(u)}},[a,t]),w.jsx(ie.input,{style:{display:"none"},...r,ref:i,defaultValue:t})});ji.displayName=Mu;function Au(e=[],t,r){const n=[...e];return n[r]=t,n.sort((o,i)=>o-i)}function Li(e,t,r){const i=100/(r-t)*(e-t);return _r(i,[0,100])}function Nu(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Du(e,t){if(e.length===1)return 0;const r=e.map(o=>Math.abs(o-t)),n=Math.min(...r);return r.indexOf(n)}function Tu(e,t,r){const n=e/2,i=En([0,50],[0,n]);return(n-i(t)*r)*r}function Fu(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function Iu(e,t){if(t>0){const r=Fu(e);return Math.min(...r)>=t}return!0}function En(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 Wu(e){return(String(e).split(".")[1]||"").length}function ju(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var Bi=Mi,Lu=Fi,Bu=Ii,$u=Wi;const $i=E.forwardRef(({className:e,...t},r)=>w.jsxs(Bi,{ref:r,className:J("relative flex w-full touch-none select-none items-center",e),...t,children:[w.jsx(Lu,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:w.jsx(Bu,{className:"absolute h-full bg-primary"})}),w.jsx($u,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));$i.displayName=Bi.displayName;const Ri=({id:e,value:t,required:r,disabled:n,readonly:o,label:i,onChange:a,onBlur:s,schema:c})=>{const l=c.minimum||0,d=c.maximum||100,u=c.multipleOf||1,h=ve(e,c),p=async x=>{const f=x[0];a(f),s&&s(e,f),await h.onChange(f)};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsxs(ke,{htmlFor:e,children:[i||c.title,r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx("span",{className:"text-sm font-medium tabular-nums",children:t||l})]}),w.jsx($i,{id:e,min:l,max:d,step:u,value:[t||l],onValueChange:p,disabled:n||o,className:"w-full"})]})},Vi=({id:e,value:t,required:r,disabled:n,readonly:o,label:i,onChange:a,options:s,schema:c})=>{const l=Number(s.max||c.maximum||5),d=Array.from({length:l},(p,x)=>x+1),u=ve(e,c),h=async p=>{!n&&!o&&(a(p),await u.onChange(p))};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:e,children:[i||c.title,r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx("div",{className:"flex items-center gap-1",role:"radiogroup","aria-labelledby":e,children:d.map(p=>w.jsx(Ze,{type:"button",variant:"ghost",size:"icon",className:J("h-8 w-8 p-0 hover:bg-transparent",n||o?"cursor-not-allowed opacity-50":"cursor-pointer"),onClick:()=>h(p),disabled:n||o,"aria-label":`Rate ${p} out of ${l}`,role:"radio","aria-checked":p===t,children:w.jsx(mu,{className:J("h-5 w-5 transition-colors",p<=(t||0)?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},p))})]})},Hi=E.forwardRef(({className:e,...t},r)=>w.jsx("textarea",{className:J("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));Hi.displayName="Textarea";function xt(e){const t=E.useRef(e);return E.useEffect(()=>{t.current=e}),E.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function Ru(e,t=globalThis==null?void 0:globalThis.document){const r=xt(e);E.useEffect(()=>{const n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Vu="DismissableLayer",Cn="dismissableLayer.update",Hu="dismissableLayer.pointerDownOutside",Uu="dismissableLayer.focusOutside",Ui,Yi=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sn=E.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...c}=e,l=E.useContext(Yi),[d,u]=E.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=E.useState({}),x=ue(t,P=>u(P)),f=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=f.indexOf(v),y=d?f.indexOf(d):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,O=y>=g,S=qu(P=>{const L=P.target,H=[...l.branches].some(B=>B.contains(L));!O||H||(o==null||o(P),a==null||a(P),P.defaultPrevented||s==null||s())},h),T=Ku(P=>{const L=P.target;[...l.branches].some(B=>B.contains(L))||(i==null||i(P),a==null||a(P),P.defaultPrevented||s==null||s())},h);return Ru(P=>{y===l.layers.size-1&&(n==null||n(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},h),E.useEffect(()=>{if(d)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Ui=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(d)),l.layers.add(d),zi(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ui)}},[d,h,r,l]),E.useEffect(()=>()=>{d&&(l.layers.delete(d),l.layersWithOutsidePointerEventsDisabled.delete(d),zi())},[d,l]),E.useEffect(()=>{const P=()=>p({});return document.addEventListener(Cn,P),()=>document.removeEventListener(Cn,P)},[]),w.jsx(ie.div,{...c,ref:x,style:{pointerEvents:b?O?"auto":"none":void 0,...e.style},onFocusCapture:oe(e.onFocusCapture,T.onFocusCapture),onBlurCapture:oe(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:oe(e.onPointerDownCapture,S.onPointerDownCapture)})});Sn.displayName=Vu;var Yu="DismissableLayerBranch",zu=E.forwardRef((e,t)=>{const r=E.useContext(Yi),n=E.useRef(null),o=ue(t,n);return E.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),w.jsx(ie.div,{...e,ref:o})});zu.displayName=Yu;function qu(e,t=globalThis==null?void 0:globalThis.document){const r=xt(e),n=E.useRef(!1),o=E.useRef(()=>{});return E.useEffect(()=>{const i=s=>{if(s.target&&!n.current){let c=function(){qi(Hu,r,l,{discrete:!0})};const l={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Ku(e,t=globalThis==null?void 0:globalThis.document){const r=xt(e),n=E.useRef(!1);return E.useEffect(()=>{const o=i=>{i.target&&!n.current&&qi(Uu,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function zi(){const e=new CustomEvent(Cn);document.dispatchEvent(e)}function qi(e,t,r,{discrete:n}){const o=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?nu(o,i):o.dispatchEvent(i)}var On=0;function Ki(){E.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Gi()),document.body.insertAdjacentElement("beforeend",e[1]??Gi()),On++,()=>{On===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),On--}},[])}function Gi(){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 _n="focusScope.autoFocusOnMount",kn="focusScope.autoFocusOnUnmount",Xi={bubbles:!1,cancelable:!0},Gu="FocusScope",Pn=E.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[s,c]=E.useState(null),l=xt(o),d=xt(i),u=E.useRef(null),h=ue(t,f=>c(f)),p=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(n){let f=function(b){if(p.paused||!s)return;const O=b.target;s.contains(O)?u.current=O:ut(u.current,{select:!0})},v=function(b){if(p.paused||!s)return;const O=b.relatedTarget;O!==null&&(s.contains(O)||ut(u.current,{select:!0}))},g=function(b){if(document.activeElement===document.body)for(const S of b)S.removedNodes.length>0&&ut(s)};document.addEventListener("focusin",f),document.addEventListener("focusout",v);const y=new MutationObserver(g);return s&&y.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",v),y.disconnect()}}},[n,s,p.paused]),E.useEffect(()=>{if(s){Ji.add(p);const f=document.activeElement;if(!s.contains(f)){const g=new CustomEvent(_n,Xi);s.addEventListener(_n,l),s.dispatchEvent(g),g.defaultPrevented||(Xu(td(Qi(s)),{select:!0}),document.activeElement===f&&ut(s))}return()=>{s.removeEventListener(_n,l),setTimeout(()=>{const g=new CustomEvent(kn,Xi);s.addEventListener(kn,d),s.dispatchEvent(g),g.defaultPrevented||ut(f??document.body,{select:!0}),s.removeEventListener(kn,d),Ji.remove(p)},0)}}},[s,l,d,p]);const x=E.useCallback(f=>{if(!r&&!n||p.paused)return;const v=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,g=document.activeElement;if(v&&g){const y=f.currentTarget,[b,O]=Qu(y);b&&O?!f.shiftKey&&g===O?(f.preventDefault(),r&&ut(b,{select:!0})):f.shiftKey&&g===b&&(f.preventDefault(),r&&ut(O,{select:!0})):g===y&&f.preventDefault()}},[r,n,p.paused]);return w.jsx(ie.div,{tabIndex:-1,...a,ref:h,onKeyDown:x})});Pn.displayName=Gu;function Xu(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ut(n,{select:t}),document.activeElement!==r)return}function Qu(e){const t=Qi(e),r=Zi(t,e),n=Zi(t.reverse(),e);return[r,n]}function Qi(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Zi(e,t){for(const r of e)if(!Zu(r,{upTo:t}))return r}function Zu(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Ju(e){return e instanceof HTMLInputElement&&"select"in e}function ut(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Ju(e)&&t&&e.select()}}var Ji=ed();function ed(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=ea(e,t),e.unshift(t)},remove(t){var r;e=ea(e,t),(r=e[0])==null||r.resume()}}}function ea(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function td(e){return e.filter(t=>t.tagName!=="A")}var rd=E[" useId ".trim().toString()]||(()=>{}),nd=0;function Pr(e){const[t,r]=E.useState(rd());return Ce(()=>{r(n=>n??String(nd++))},[e]),t?`radix-${t}`:""}const od=["top","right","bottom","left"],dt=Math.min,Pe=Math.max,Mr=Math.round,Ar=Math.floor,Ve=e=>({x:e,y:e}),id={left:"right",right:"left",bottom:"top",top:"bottom"},ad={start:"end",end:"start"};function Mn(e,t,r){return Pe(e,dt(t,r))}function Je(e,t){return typeof e=="function"?e(t):e}function et(e){return e.split("-")[0]}function Ft(e){return e.split("-")[1]}function An(e){return e==="x"?"y":"x"}function Nn(e){return e==="y"?"height":"width"}function tt(e){return["top","bottom"].includes(et(e))?"y":"x"}function Dn(e){return An(tt(e))}function sd(e,t,r){r===void 0&&(r=!1);const n=Ft(e),o=Dn(e),i=Nn(o);let a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Nr(a)),[a,Nr(a)]}function cd(e){const t=Nr(e);return[Tn(e),t,Tn(t)]}function Tn(e){return e.replace(/start|end/g,t=>ad[t])}function ld(e,t,r){const n=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return r?t?o:n:t?n:o;case"left":case"right":return t?i:a;default:return[]}}function ud(e,t,r,n){const o=Ft(e);let i=ld(et(e),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Tn)))),i}function Nr(e){return e.replace(/left|right|bottom|top/g,t=>id[t])}function dd(e){return{top:0,right:0,bottom:0,left:0,...e}}function ta(e){return typeof e!="number"?dd(e):{top:e,right:e,bottom:e,left:e}}function Dr(e){const{x:t,y:r,width:n,height:o}=e;return{width:n,height:o,top:r,left:t,right:t+n,bottom:r+o,x:t,y:r}}function ra(e,t,r){let{reference:n,floating:o}=e;const i=tt(t),a=Dn(t),s=Nn(a),c=et(t),l=i==="y",d=n.x+n.width/2-o.width/2,u=n.y+n.height/2-o.height/2,h=n[s]/2-o[s]/2;let p;switch(c){case"top":p={x:d,y:n.y-o.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-o.width,y:u};break;default:p={x:n.x,y:n.y}}switch(Ft(t)){case"start":p[a]-=h*(r&&l?-1:1);break;case"end":p[a]+=h*(r&&l?-1:1);break}return p}const fd=async(e,t,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:a}=r,s=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=ra(l,n,c),h=n,p={},x=0;for(let f=0;f<s.length;f++){const{name:v,fn:g}=s[f],{x:y,y:b,data:O,reset:S}=await g({x:d,y:u,initialPlacement:n,placement:h,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:e,floating:t}});d=y??d,u=b??u,p={...p,[v]:{...p[v],...O}},S&&x<=50&&(x++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(l=S.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:d,y:u}=ra(l,h,c)),f=-1)}return{x:d,y:u,placement:h,strategy:o,middlewareData:p}};async function rr(e,t){var r;t===void 0&&(t={});const{x:n,y:o,platform:i,rects:a,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:p=0}=Je(t,e),x=ta(p),v=s[h?u==="floating"?"reference":"floating":u],g=Dr(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(v)))==null||r?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:d,strategy:c})),y=u==="floating"?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),O=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},S=Dr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:b,strategy:c}):y);return{top:(g.top-S.top+x.top)/O.y,bottom:(S.bottom-g.bottom+x.bottom)/O.y,left:(g.left-S.left+x.left)/O.x,right:(S.right-g.right+x.right)/O.x}}const hd=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:o,rects:i,platform:a,elements:s,middlewareData:c}=t,{element:l,padding:d=0}=Je(e,t)||{};if(l==null)return{};const u=ta(d),h={x:r,y:n},p=Dn(o),x=Nn(p),f=await a.getDimensions(l),v=p==="y",g=v?"top":"left",y=v?"bottom":"right",b=v?"clientHeight":"clientWidth",O=i.reference[x]+i.reference[p]-h[p]-i.floating[x],S=h[p]-i.reference[p],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l));let P=T?T[b]:0;(!P||!await(a.isElement==null?void 0:a.isElement(T)))&&(P=s.floating[b]||i.floating[x]);const L=O/2-S/2,H=P/2-f[x]/2-1,B=dt(u[g],H),U=dt(u[y],H),$=B,K=P-f[x]-U,ee=P/2-f[x]/2+L,V=Mn($,ee,K),X=!c.arrow&&Ft(o)!=null&&ee!==V&&i.reference[x]/2-(ee<$?B:U)-f[x]/2<0,Z=X?ee<$?ee-$:ee-K:0;return{[p]:h[p]+Z,data:{[p]:V,centerOffset:ee-V-Z,...X&&{alignmentOffset:Z}},reset:X}}}),pd=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:f=!0,...v}=Je(e,t);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const g=et(o),y=tt(s),b=et(s)===s,O=await(c.isRTL==null?void 0:c.isRTL(l.floating)),S=h||(b||!f?[Nr(s)]:cd(s)),T=x!=="none";!h&&T&&S.push(...ud(s,f,x,O));const P=[s,...S],L=await rr(t,v),H=[];let B=((n=i.flip)==null?void 0:n.overflows)||[];if(d&&H.push(L[g]),u){const V=sd(o,a,O);H.push(L[V[0]],L[V[1]])}if(B=[...B,{placement:o,overflows:H}],!H.every(V=>V<=0)){var U,$;const V=(((U=i.flip)==null?void 0:U.index)||0)+1,X=P[V];if(X){var K;const m=u==="alignment"?y!==tt(X):!1,C=((K=B[0])==null?void 0:K.overflows[0])>0;if(!m||C)return{data:{index:V,overflows:B},reset:{placement:X}}}let Z=($=B.filter(m=>m.overflows[0]<=0).sort((m,C)=>m.overflows[1]-C.overflows[1])[0])==null?void 0:$.placement;if(!Z)switch(p){case"bestFit":{var ee;const m=(ee=B.filter(C=>{if(T){const _=tt(C.placement);return _===y||_==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(_=>_>0).reduce((_,k)=>_+k,0)]).sort((C,_)=>C[1]-_[1])[0])==null?void 0:ee[0];m&&(Z=m);break}case"initialPlacement":Z=s;break}if(o!==Z)return{reset:{placement:Z}}}return{}}}};function na(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function oa(e){return od.some(t=>e[t]>=0)}const md=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...o}=Je(e,t);switch(n){case"referenceHidden":{const i=await rr(t,{...o,elementContext:"reference"}),a=na(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:oa(a)}}}case"escaped":{const i=await rr(t,{...o,altBoundary:!0}),a=na(i,r.floating);return{data:{escapedOffsets:a,escaped:oa(a)}}}default:return{}}}}};async function gd(e,t){const{placement:r,platform:n,elements:o}=e,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=et(r),s=Ft(r),c=tt(r)==="y",l=["left","top"].includes(a)?-1:1,d=i&&c?-1:1,u=Je(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:x}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof x=="number"&&(p=s==="end"?x*-1:x),c?{x:p*d,y:h*l}:{x:h*l,y:p*d}}const vd=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:o,y:i,placement:a,middlewareData:s}=t,c=await gd(t,e);return a===((r=s.offset)==null?void 0:r.placement)&&(n=s.arrow)!=null&&n.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:a}}}}},yd=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:v=>{let{x:g,y}=v;return{x:g,y}}},...c}=Je(e,t),l={x:r,y:n},d=await rr(t,c),u=tt(et(o)),h=An(u);let p=l[h],x=l[u];if(i){const v=h==="y"?"top":"left",g=h==="y"?"bottom":"right",y=p+d[v],b=p-d[g];p=Mn(y,p,b)}if(a){const v=u==="y"?"top":"left",g=u==="y"?"bottom":"right",y=x+d[v],b=x-d[g];x=Mn(y,x,b)}const f=s.fn({...t,[h]:p,[u]:x});return{...f,data:{x:f.x-r,y:f.y-n,enabled:{[h]:i,[u]:a}}}}}},bd=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:o,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Je(e,t),d={x:r,y:n},u=tt(o),h=An(u);let p=d[h],x=d[u];const f=Je(s,t),v=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const b=h==="y"?"height":"width",O=i.reference[h]-i.floating[b]+v.mainAxis,S=i.reference[h]+i.reference[b]-v.mainAxis;p<O?p=O:p>S&&(p=S)}if(l){var g,y;const b=h==="y"?"width":"height",O=["top","left"].includes(et(o)),S=i.reference[u]-i.floating[b]+(O&&((g=a.offset)==null?void 0:g[u])||0)+(O?0:v.crossAxis),T=i.reference[u]+i.reference[b]+(O?0:((y=a.offset)==null?void 0:y[u])||0)-(O?v.crossAxis:0);x<S?x=S:x>T&&(x=T)}return{[h]:p,[u]:x}}}},wd=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:o,rects:i,platform:a,elements:s}=t,{apply:c=()=>{},...l}=Je(e,t),d=await rr(t,l),u=et(o),h=Ft(o),p=tt(o)==="y",{width:x,height:f}=i.floating;let v,g;u==="top"||u==="bottom"?(v=u,g=h===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=u,v=h==="end"?"top":"bottom");const y=f-d.top-d.bottom,b=x-d.left-d.right,O=dt(f-d[v],y),S=dt(x-d[g],b),T=!t.middlewareData.shift;let P=O,L=S;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(L=b),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(P=y),T&&!h){const B=Pe(d.left,0),U=Pe(d.right,0),$=Pe(d.top,0),K=Pe(d.bottom,0);p?L=x-2*(B!==0||U!==0?B+U:Pe(d.left,d.right)):P=f-2*($!==0||K!==0?$+K:Pe(d.top,d.bottom))}await c({...t,availableWidth:L,availableHeight:P});const H=await a.getDimensions(s.floating);return x!==H.width||f!==H.height?{reset:{rects:!0}}:{}}}};function Tr(){return typeof window<"u"}function It(e){return ia(e)?(e.nodeName||"").toLowerCase():"#document"}function Me(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function He(e){var t;return(t=(ia(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ia(e){return Tr()?e instanceof Node||e instanceof Me(e).Node:!1}function Te(e){return Tr()?e instanceof Element||e instanceof Me(e).Element:!1}function Ue(e){return Tr()?e instanceof HTMLElement||e instanceof Me(e).HTMLElement:!1}function aa(e){return!Tr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Me(e).ShadowRoot}function nr(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=Fe(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(o)}function xd(e){return["table","td","th"].includes(It(e))}function Fr(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Fn(e){const t=In(),r=Te(e)?Fe(e):e;return["transform","translate","scale","rotate","perspective"].some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function Ed(e){let t=ft(e);for(;Ue(t)&&!Wt(t);){if(Fn(t))return t;if(Fr(t))return null;t=ft(t)}return null}function In(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Wt(e){return["html","body","#document"].includes(It(e))}function Fe(e){return Me(e).getComputedStyle(e)}function Ir(e){return Te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(It(e)==="html")return e;const t=e.assignedSlot||e.parentNode||aa(e)&&e.host||He(e);return aa(t)?t.host:t}function sa(e){const t=ft(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ue(t)&&nr(t)?t:sa(t)}function or(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=sa(e),i=o===((n=e.ownerDocument)==null?void 0:n.body),a=Me(o);if(i){const s=Wn(a);return t.concat(a,a.visualViewport||[],nr(o)?o:[],s&&r?or(s):[])}return t.concat(o,or(o,[],r))}function Wn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ca(e){const t=Fe(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=Ue(e),i=o?e.offsetWidth:r,a=o?e.offsetHeight:n,s=Mr(r)!==i||Mr(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function jn(e){return Te(e)?e:e.contextElement}function jt(e){const t=jn(e);if(!Ue(t))return Ve(1);const r=t.getBoundingClientRect(),{width:n,height:o,$:i}=ca(t);let a=(i?Mr(r.width):r.width)/n,s=(i?Mr(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const Cd=Ve(0);function la(e){const t=Me(e);return!In()||!t.visualViewport?Cd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Sd(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Me(e)?!1:t}function Et(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),i=jn(e);let a=Ve(1);t&&(n?Te(n)&&(a=jt(n)):a=jt(e));const s=Sd(i,r,n)?la(i):Ve(0);let c=(o.left+s.x)/a.x,l=(o.top+s.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(i){const h=Me(i),p=n&&Te(n)?Me(n):n;let x=h,f=Wn(x);for(;f&&n&&p!==x;){const v=jt(f),g=f.getBoundingClientRect(),y=Fe(f),b=g.left+(f.clientLeft+parseFloat(y.paddingLeft))*v.x,O=g.top+(f.clientTop+parseFloat(y.paddingTop))*v.y;c*=v.x,l*=v.y,d*=v.x,u*=v.y,c+=b,l+=O,x=Me(f),f=Wn(x)}}return Dr({width:d,height:u,x:c,y:l})}function Ln(e,t){const r=Ir(e).scrollLeft;return t?t.left+r:Et(He(e)).left+r}function ua(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-(r?0:Ln(e,n)),i=n.top+t.scrollTop;return{x:o,y:i}}function Od(e){let{elements:t,rect:r,offsetParent:n,strategy:o}=e;const i=o==="fixed",a=He(n),s=t?Fr(t.floating):!1;if(n===a||s&&i)return r;let c={scrollLeft:0,scrollTop:0},l=Ve(1);const d=Ve(0),u=Ue(n);if((u||!u&&!i)&&((It(n)!=="body"||nr(a))&&(c=Ir(n)),Ue(n))){const p=Et(n);l=jt(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}const h=a&&!u&&!i?ua(a,c,!0):Ve(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+d.x+h.x,y:r.y*l.y-c.scrollTop*l.y+d.y+h.y}}function _d(e){return Array.from(e.getClientRects())}function kd(e){const t=He(e),r=Ir(e),n=e.ownerDocument.body,o=Pe(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=Pe(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+Ln(e);const s=-r.scrollTop;return Fe(n).direction==="rtl"&&(a+=Pe(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function Pd(e,t){const r=Me(e),n=He(e),o=r.visualViewport;let i=n.clientWidth,a=n.clientHeight,s=0,c=0;if(o){i=o.width,a=o.height;const l=In();(!l||l&&t==="fixed")&&(s=o.offsetLeft,c=o.offsetTop)}return{width:i,height:a,x:s,y:c}}function Md(e,t){const r=Et(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,i=Ue(e)?jt(e):Ve(1),a=e.clientWidth*i.x,s=e.clientHeight*i.y,c=o*i.x,l=n*i.y;return{width:a,height:s,x:c,y:l}}function da(e,t,r){let n;if(t==="viewport")n=Pd(e,r);else if(t==="document")n=kd(He(e));else if(Te(t))n=Md(t,r);else{const o=la(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Dr(n)}function fa(e,t){const r=ft(e);return r===t||!Te(r)||Wt(r)?!1:Fe(r).position==="fixed"||fa(r,t)}function Ad(e,t){const r=t.get(e);if(r)return r;let n=or(e,[],!1).filter(s=>Te(s)&&It(s)!=="body"),o=null;const i=Fe(e).position==="fixed";let a=i?ft(e):e;for(;Te(a)&&!Wt(a);){const s=Fe(a),c=Fn(a);!c&&s.position==="fixed"&&(o=null),(i?!c&&!o:!c&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||nr(a)&&!c&&fa(e,a))?n=n.filter(d=>d!==a):o=s,a=ft(a)}return t.set(e,n),n}function Nd(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const a=[...r==="clippingAncestors"?Fr(t)?[]:Ad(t,this._c):[].concat(r),n],s=a[0],c=a.reduce((l,d)=>{const u=da(t,d,o);return l.top=Pe(u.top,l.top),l.right=dt(u.right,l.right),l.bottom=dt(u.bottom,l.bottom),l.left=Pe(u.left,l.left),l},da(t,s,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Dd(e){const{width:t,height:r}=ca(e);return{width:t,height:r}}function Td(e,t,r){const n=Ue(t),o=He(t),i=r==="fixed",a=Et(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const c=Ve(0);function l(){c.x=Ln(o)}if(n||!n&&!i)if((It(t)!=="body"||nr(o))&&(s=Ir(t)),n){const p=Et(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&l();i&&!n&&o&&l();const d=o&&!n&&!i?ua(o,s):Ve(0),u=a.left+s.scrollLeft-c.x-d.x,h=a.top+s.scrollTop-c.y-d.y;return{x:u,y:h,width:a.width,height:a.height}}function Bn(e){return Fe(e).position==="static"}function ha(e,t){if(!Ue(e)||Fe(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return He(e)===r&&(r=r.ownerDocument.body),r}function pa(e,t){const r=Me(e);if(Fr(e))return r;if(!Ue(e)){let o=ft(e);for(;o&&!Wt(o);){if(Te(o)&&!Bn(o))return o;o=ft(o)}return r}let n=ha(e,t);for(;n&&xd(n)&&Bn(n);)n=ha(n,t);return n&&Wt(n)&&Bn(n)&&!Fn(n)?r:n||Ed(e)||r}const Fd=async function(e){const t=this.getOffsetParent||pa,r=this.getDimensions,n=await r(e.floating);return{reference:Td(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Id(e){return Fe(e).direction==="rtl"}const Wd={convertOffsetParentRelativeRectToViewportRelativeRect:Od,getDocumentElement:He,getClippingRect:Nd,getOffsetParent:pa,getElementRects:Fd,getClientRects:_d,getDimensions:Dd,getScale:jt,isElement:Te,isRTL:Id};function ma(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jd(e,t){let r=null,n;const o=He(e);function i(){var s;clearTimeout(n),(s=r)==null||s.disconnect(),r=null}function a(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),i();const l=e.getBoundingClientRect(),{left:d,top:u,width:h,height:p}=l;if(s||t(),!h||!p)return;const x=Ar(u),f=Ar(o.clientWidth-(d+h)),v=Ar(o.clientHeight-(u+p)),g=Ar(d),b={rootMargin:-x+"px "+-f+"px "+-v+"px "+-g+"px",threshold:Pe(0,dt(1,c))||1};let O=!0;function S(T){const P=T[0].intersectionRatio;if(P!==c){if(!O)return a();P?a(!1,P):n=setTimeout(()=>{a(!1,1e-7)},1e3)}P===1&&!ma(l,e.getBoundingClientRect())&&a(),O=!1}try{r=new IntersectionObserver(S,{...b,root:o.ownerDocument})}catch{r=new IntersectionObserver(S,b)}r.observe(e)}return a(!0),i}function Ld(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,l=jn(e),d=o||i?[...l?or(l):[],...or(t)]:[];d.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});const u=l&&s?jd(l,r):null;let h=-1,p=null;a&&(p=new ResizeObserver(g=>{let[y]=g;y&&y.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(t)})),r()}),l&&!c&&p.observe(l),p.observe(t));let x,f=c?Et(e):null;c&&v();function v(){const g=Et(e);f&&!ma(f,g)&&r(),f=g,x=requestAnimationFrame(v)}return r(),()=>{var g;d.forEach(y=>{o&&y.removeEventListener("scroll",r),i&&y.removeEventListener("resize",r)}),u==null||u(),(g=p)==null||g.disconnect(),p=null,c&&cancelAnimationFrame(x)}}const Bd=vd,$d=yd,Rd=pd,Vd=wd,Hd=md,ga=hd,Ud=bd,Yd=(e,t,r)=>{const n=new Map,o={platform:Wd,...r},i={...o.platform,_c:n};return fd(e,t,{...o,platform:i})};var Wr=typeof document<"u"?D.useLayoutEffect:D.useEffect;function jr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!jr(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){const i=o[n];if(!(i==="_owner"&&e.$$typeof)&&!jr(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function va(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ya(e,t){const r=va(e);return Math.round(t*r)/r}function $n(e){const t=E.useRef(e);return Wr(()=>{t.current=e}),t}function zd(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[d,u]=E.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=E.useState(n);jr(h,n)||p(n);const[x,f]=E.useState(null),[v,g]=E.useState(null),y=E.useCallback(m=>{m!==T.current&&(T.current=m,f(m))},[]),b=E.useCallback(m=>{m!==P.current&&(P.current=m,g(m))},[]),O=i||x,S=a||v,T=E.useRef(null),P=E.useRef(null),L=E.useRef(d),H=c!=null,B=$n(c),U=$n(o),$=$n(l),K=E.useCallback(()=>{if(!T.current||!P.current)return;const m={placement:t,strategy:r,middleware:h};U.current&&(m.platform=U.current),Yd(T.current,P.current,m).then(C=>{const _={...C,isPositioned:$.current!==!1};ee.current&&!jr(L.current,_)&&(L.current=_,Cr.flushSync(()=>{u(_)}))})},[h,t,r,U,$]);Wr(()=>{l===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,u(m=>({...m,isPositioned:!1})))},[l]);const ee=E.useRef(!1);Wr(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Wr(()=>{if(O&&(T.current=O),S&&(P.current=S),O&&S){if(B.current)return B.current(O,S,K);K()}},[O,S,K,B,H]);const V=E.useMemo(()=>({reference:T,floating:P,setReference:y,setFloating:b}),[y,b]),X=E.useMemo(()=>({reference:O,floating:S}),[O,S]),Z=E.useMemo(()=>{const m={position:r,left:0,top:0};if(!X.floating)return m;const C=ya(X.floating,d.x),_=ya(X.floating,d.y);return s?{...m,transform:"translate("+C+"px, "+_+"px)",...va(X.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:C,top:_}},[r,s,X.floating,d.x,d.y]);return E.useMemo(()=>({...d,update:K,refs:V,elements:X,floatingStyles:Z}),[d,K,V,X,Z])}const qd=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:o}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?ga({element:n.current,padding:o}).fn(r):{}:n?ga({element:n,padding:o}).fn(r):{}}}},Kd=(e,t)=>({...Bd(e),options:[e,t]}),Gd=(e,t)=>({...$d(e),options:[e,t]}),Xd=(e,t)=>({...Ud(e),options:[e,t]}),Qd=(e,t)=>({...Rd(e),options:[e,t]}),Zd=(e,t)=>({...Vd(e),options:[e,t]}),Jd=(e,t)=>({...Hd(e),options:[e,t]}),ef=(e,t)=>({...qd(e),options:[e,t]});var tf="Arrow",ba=E.forwardRef((e,t)=>{const{children:r,width:n=10,height:o=5,...i}=e;return w.jsx(ie.svg,{...i,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});ba.displayName=tf;var rf=ba,Rn="Popper",[wa,Lr]=Dt(Rn),[nf,xa]=wa(Rn),Ea=e=>{const{__scopePopper:t,children:r}=e,[n,o]=E.useState(null);return w.jsx(nf,{scope:t,anchor:n,onAnchorChange:o,children:r})};Ea.displayName=Rn;var Ca="PopperAnchor",Sa=E.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...o}=e,i=xa(Ca,r),a=E.useRef(null),s=ue(t,a);return E.useEffect(()=>{i.onAnchorChange((n==null?void 0:n.current)||a.current)}),n?null:w.jsx(ie.div,{...o,ref:s})});Sa.displayName=Ca;var Vn="PopperContent",[of,af]=wa(Vn),Oa=E.forwardRef((e,t)=>{var A,R,re,q,z,Q;const{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:x,...f}=e,v=xa(Vn,r),[g,y]=E.useState(null),b=ue(t,se=>y(se)),[O,S]=E.useState(null),T=yn(O),P=(T==null?void 0:T.width)??0,L=(T==null?void 0:T.height)??0,H=n+(i!=="center"?"-"+i:""),B=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},U=Array.isArray(l)?l:[l],$=U.length>0,K={padding:B,boundary:U.filter(cf),altBoundary:$},{refs:ee,floatingStyles:V,placement:X,isPositioned:Z,middlewareData:m}=zd({strategy:"fixed",placement:H,whileElementsMounted:(...se)=>Ld(...se,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[Kd({mainAxis:o+L,alignmentAxis:a}),c&&Gd({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Xd():void 0,...K}),c&&Qd({...K}),Zd({...K,apply:({elements:se,rects:Ee,availableWidth:Le,availableHeight:Ne})=>{const{width:Be,height:De}=Ee.reference,ye=se.floating.style;ye.setProperty("--radix-popper-available-width",`${Le}px`),ye.setProperty("--radix-popper-available-height",`${Ne}px`),ye.setProperty("--radix-popper-anchor-width",`${Be}px`),ye.setProperty("--radix-popper-anchor-height",`${De}px`)}}),O&&ef({element:O,padding:s}),lf({arrowWidth:P,arrowHeight:L}),h&&Jd({strategy:"referenceHidden",...K})]}),[C,_]=Pa(X),k=xt(x);Ce(()=>{Z&&(k==null||k())},[Z,k]);const M=(A=m.arrow)==null?void 0:A.x,F=(R=m.arrow)==null?void 0:R.y,I=((re=m.arrow)==null?void 0:re.centerOffset)!==0,[j,W]=E.useState();return Ce(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),w.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:Z?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:j,"--radix-popper-transform-origin":[(q=m.transformOrigin)==null?void 0:q.x,(z=m.transformOrigin)==null?void 0:z.y].join(" "),...((Q=m.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:w.jsx(of,{scope:r,placedSide:C,onArrowChange:S,arrowX:M,arrowY:F,shouldHideArrow:I,children:w.jsx(ie.div,{"data-side":C,"data-align":_,...f,ref:b,style:{...f.style,animation:Z?void 0:"none"}})})})});Oa.displayName=Vn;var _a="PopperArrow",sf={top:"bottom",right:"left",bottom:"top",left:"right"},ka=E.forwardRef(function(t,r){const{__scopePopper:n,...o}=t,i=af(_a,n),a=sf[i.placedSide];return w.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:w.jsx(rf,{...o,ref:r,style:{...o.style,display:"block"}})})});ka.displayName=_a;function cf(e){return e!==null}var lf=e=>({name:"transformOrigin",options:e,fn(t){var v,g,y;const{placement:r,rects:n,middlewareData:o}=t,a=((v=o.arrow)==null?void 0:v.centerOffset)!==0,s=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[l,d]=Pa(r),u={start:"0%",center:"50%",end:"100%"}[d],h=(((g=o.arrow)==null?void 0:g.x)??0)+s/2,p=(((y=o.arrow)==null?void 0:y.y)??0)+c/2;let x="",f="";return l==="bottom"?(x=a?u:`${h}px`,f=`${-c}px`):l==="top"?(x=a?u:`${h}px`,f=`${n.floating.height+c}px`):l==="right"?(x=`${-c}px`,f=a?u:`${p}px`):l==="left"&&(x=`${n.floating.width+c}px`,f=a?u:`${p}px`),{data:{x,y:f}}}});function Pa(e){const[t,r="center"]=e.split("-");return[t,r]}var Ma=Ea,Hn=Sa,Aa=Oa,Na=ka,uf="Portal",Un=E.forwardRef((e,t)=>{var s;const{container:r,...n}=e,[o,i]=E.useState(!1);Ce(()=>i(!0),[]);const a=r||o&&((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body);return a?Ho.createPortal(w.jsx(ie.div,{...n,ref:t}),a):null});Un.displayName=uf;var Da=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"}),df="VisuallyHidden",ff=E.forwardRef((e,t)=>w.jsx(ie.span,{...e,ref:t,style:{...Da,...e.style}}));ff.displayName=df;var hf=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Lt=new WeakMap,Br=new WeakMap,$r={},Yn=0,Ta=function(e){return e&&(e.host||Ta(e.parentNode))},pf=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Ta(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},mf=function(e,t,r,n){var o=pf(t,Array.isArray(e)?e:[e]);$r[r]||($r[r]=new WeakMap);var i=$r[r],a=[],s=new Set,c=new Set(o),l=function(u){!u||s.has(u)||(s.add(u),l(u.parentNode))};o.forEach(l);var d=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(s.has(h))d(h);else try{var p=h.getAttribute(n),x=p!==null&&p!=="false",f=(Lt.get(h)||0)+1,v=(i.get(h)||0)+1;Lt.set(h,f),i.set(h,v),a.push(h),f===1&&x&&Br.set(h,!0),v===1&&h.setAttribute(r,"true"),x||h.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",h,g)}})};return d(t),s.clear(),Yn++,function(){a.forEach(function(u){var h=Lt.get(u)-1,p=i.get(u)-1;Lt.set(u,h),i.set(u,p),h||(Br.has(u)||u.removeAttribute(n),Br.delete(u)),p||u.removeAttribute(r)}),Yn--,Yn||(Lt=new WeakMap,Lt=new WeakMap,Br=new WeakMap,$r={})}},Fa=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=hf(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live], script"))),mf(n,o,r,"aria-hidden")):function(){return null}},Ye=function(){return Ye=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Ye.apply(this,arguments)};function Ia(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function gf(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Rr="right-scroll-bar-position",Vr="width-before-scroll-bar",vf="with-scroll-bars-hidden",yf="--removed-body-scroll-bar-size";function zn(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function bf(e,t){var r=D.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=t,r.facade}var wf=typeof window<"u"?E.useLayoutEffect:E.useEffect,Wa=new WeakMap;function xf(e,t){var r=bf(null,function(n){return e.forEach(function(o){return zn(o,n)})});return wf(function(){var n=Wa.get(r);if(n){var o=new Set(n),i=new Set(e),a=r.current;o.forEach(function(s){i.has(s)||zn(s,null)}),i.forEach(function(s){o.has(s)||zn(s,a)})}Wa.set(r,e)},[e]),r}function Ef(e){return e}function Cf(e,t){t===void 0&&(t=Ef);var r=[],n=!1,o={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(i){var a=t(i,n);return r.push(a),function(){r=r.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(n=!0;r.length;){var a=r;r=[],a.forEach(i)}r={push:function(s){return i(s)},filter:function(){return r}}},assignMedium:function(i){n=!0;var a=[];if(r.length){var s=r;r=[],s.forEach(i),a=r}var c=function(){var d=a;a=[],d.forEach(i)},l=function(){return Promise.resolve().then(c)};l(),r={push:function(d){a.push(d),l()},filter:function(d){return a=a.filter(d),r}}}};return o}function Sf(e){e===void 0&&(e={});var t=Cf(null);return t.options=Ye({async:!0,ssr:!1},e),t}var ja=function(e){var t=e.sideCar,r=Ia(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 E.createElement(n,Ye({},r))};ja.isSideCarExport=!0;function Of(e,t){return e.useMedium(t),ja}var La=Sf(),qn=function(){},Hr=E.forwardRef(function(e,t){var r=E.useRef(null),n=E.useState({onScrollCapture:qn,onWheelCapture:qn,onTouchMoveCapture:qn}),o=n[0],i=n[1],a=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,u=e.shards,h=e.sideCar,p=e.noRelative,x=e.noIsolation,f=e.inert,v=e.allowPinchZoom,g=e.as,y=g===void 0?"div":g,b=e.gapMode,O=Ia(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,T=xf([r,t]),P=Ye(Ye({},O),o);return E.createElement(E.Fragment,null,d&&E.createElement(S,{sideCar:La,removeScrollBar:l,shards:u,noRelative:p,noIsolation:x,inert:f,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:b}),a?E.cloneElement(E.Children.only(s),Ye(Ye({},P),{ref:T})):E.createElement(y,Ye({},P,{className:c,ref:T}),s))});Hr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Hr.classNames={fullWidth:Vr,zeroRight:Rr};var _f=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function kf(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=_f();return t&&e.setAttribute("nonce",t),e}function Pf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Mf(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Af=function(){var e=0,t=null;return{add:function(r){e==0&&(t=kf())&&(Pf(t,r),Mf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Nf=function(){var e=Af();return function(t,r){E.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Ba=function(){var e=Nf(),t=function(r){var n=r.styles,o=r.dynamic;return e(n,o),null};return t},Df={left:0,top:0,right:0,gap:0},Kn=function(e){return parseInt(e||"",10)||0},Tf=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Kn(r),Kn(n),Kn(o)]},Ff=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Df;var t=Tf(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])}},If=Ba(),Bt="data-scroll-locked",Wf=function(e,t,r,n){var o=e.left,i=e.top,a=e.right,s=e.gap;return r===void 0&&(r="margin"),`
|
|
62
|
-
.`.concat(
|
|
61
|
+
*/const gn=Re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),vi=e=>{const{canAdd:t,disabled:r,idSchema:n,uiSchema:o,items:i,onAddClick:a,readonly:s,registry:c,required:l,schema:d,title:u}=e,h=Er.getUiOptions(o),p=Er.getTemplate("ArrayFieldDescriptionTemplate",c,h),x=Er.getTemplate("ArrayFieldItemTemplate",c,h),f=Er.getTemplate("ArrayFieldTitleTemplate",c,h);return w.jsx("div",{className:J("rjsf-array-field",h.classNames),children:w.jsxs(Sr,{className:"border-slate-200",children:[(u||h.title)&&w.jsxs(hn,{className:"pb-3",children:[w.jsx(f,{idSchema:n,title:h.title||u,required:l,schema:d,uiSchema:o,registry:c}),(h.description||d.description)&&w.jsx(p,{idSchema:n,description:h.description||d.description,schema:d,uiSchema:o,registry:c})]}),w.jsxs(Or,{className:"space-y-3",children:[i&&i.map(({key:v,...g})=>w.jsx(x,{...g},v)),t&&w.jsxs(Ze,{type:"button",onClick:a,disabled:r||s,size:"sm",variant:"outline",className:"w-full border-dashed",children:[w.jsx(mu,{className:"h-4 w-4 mr-2"}),"Add ",u||"Item"]})]})]})})},yi=e=>{const{children:t,disabled:r,hasToolbar:n,buttonsProps:o,readonly:i}=e,{hasMoveDown:a,hasMoveUp:s,hasRemove:c,index:l,onDropIndexClick:d,onReorderClick:u}=o;return w.jsx(Sr,{className:"relative border-slate-200",children:w.jsxs(Or,{className:"p-4",children:[n&&w.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-1",children:[(s||a)&&w.jsx("div",{className:"flex items-center mr-2",children:w.jsx(pu,{className:"h-4 w-4 text-slate-400"})}),s&&w.jsx(Ze,{type:"button",size:"sm",variant:"ghost",disabled:r||i,onClick:u(l,l-1),className:"h-8 w-8 p-0",title:"Move up",children:w.jsx(gi,{className:"h-4 w-4"})}),a&&w.jsx(Ze,{type:"button",size:"sm",variant:"ghost",disabled:r||i,onClick:u(l,l+1),className:"h-8 w-8 p-0",title:"Move down",children:w.jsx(mn,{className:"h-4 w-4"})}),c&&w.jsx(Ze,{type:"button",size:"sm",variant:"ghost",disabled:r||i,onClick:d(l),className:"h-8 w-8 p-0 text-destructive hover:text-destructive",title:"Remove",children:w.jsx(gn,{className:"h-4 w-4"})})]}),w.jsx("div",{className:J(n&&"pr-24"),children:t})]})})},bi={address:li,phone:hi,currency:pi},wi={ArrayFieldTemplate:vi,ArrayFieldItemTemplate:yi},xi=({id:e,value:t,required:r,disabled:n,readonly:o,label:i,onChange:a,onBlur:s,onFocus:c,schema:l})=>{const d=ve(e,l),u=async x=>{const f=x.target.value;a(f),await d.onChange(f)},h=async x=>{const f=x.target.value;s&&s(e,f),await d.onBlur(f)},p=async x=>{const f=x.target.value;c&&c(e,f),await d.onFocus(f)};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:e,children:[i||l.title,r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:e,type:"color",value:t||"#000000",required:r,disabled:n||o,onChange:u,onBlur:h,onFocus:p,className:"h-10 w-full cursor-pointer"})]})},vu=({id:e,value:t,required:r,disabled:n,readonly:o,label:i,onChange:a,onBlur:s,onFocus:c,options:l,schema:d})=>{const u=l.inputType||"date",h=ve(e,d),p=async v=>{const g=v.target.value;a(g),await h.onChange(g)},x=async v=>{const g=v.target.value;s&&s(e,g),await h.onBlur(g)},f=async v=>{const g=v.target.value;c&&c(e,g),await h.onFocus(g)};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:e,children:[i||d.title,r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{id:e,type:u,value:t||"",required:r,disabled:n||o,onChange:p,onBlur:x,onFocus:f,min:typeof l.minDate=="string"||typeof l.minDate=="number"?l.minDate:void 0,max:typeof l.maxDate=="string"||typeof l.maxDate=="number"?l.maxDate:void 0,className:"w-full"})]})},yu=fn("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ei({className:e,variant:t,...r}){return w.jsx("div",{className:J(yu({variant:t}),e),...r})}const Ci=({id:e,value:t,required:r,disabled:n,readonly:o,label:i,onChange:a,options:s,schema:c})=>{const l=D.useRef(null),d=s.accept||"*/*",u=s.multiple||!1,h=ve(e,c),p=async v=>{const g=v.target.files;if(!g)return;let y;if(u){const b=Array.from(g).map(O=>({name:O.name,size:O.size,type:O.type,lastModified:O.lastModified}));y=b,a(b)}else{const b=g[0];b&&(y={name:b.name,size:b.size,type:b.type,lastModified:b.lastModified},a(y))}y&&await h.onChange(y)},x=async()=>{l.current&&(l.current.value=""),a(null),await h.onChange(null)},f=v=>v<1024?v+" B":v<1024*1024?(v/1024).toFixed(1)+" KB":(v/(1024*1024)).toFixed(1)+" MB";return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:e,children:[i||c.title,r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx(be,{ref:l,id:e,type:"file",accept:d,multiple:u,required:r,disabled:n||o,onChange:p,className:"cursor-pointer"}),t&&w.jsx("div",{className:"space-y-2",children:u&&Array.isArray(t)?w.jsx("div",{className:"flex flex-wrap gap-2",children:t.map((v,g)=>w.jsxs(Ei,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[w.jsxs("span",{className:"text-xs",children:[v.name," (",f(v.size),")"]}),!n&&!o&&w.jsx(Ze,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-transparent",onClick:x,children:w.jsx(gn,{className:"h-3 w-3"})})]},g))}):t&&typeof t=="object"&&"name"in t?w.jsxs(Ei,{variant:"secondary",className:"inline-flex items-center gap-1 pr-1",children:[w.jsxs("span",{className:"text-xs",children:[t.name," (",f(t.size),")"]}),!n&&!o&&w.jsx(Ze,{type:"button",variant:"ghost",size:"icon",className:"h-4 w-4 p-0 hover:bg-transparent",onClick:x,children:w.jsx(gn,{className:"h-3 w-3"})})]}):null})]})};function _r(e,[t,r]){return Math.min(r,Math.max(t,e))}function oe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e==null||e(o),r===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Dt(e,t=[]){let r=[];function n(i,a){const s=E.createContext(a),c=r.length;r=[...r,a];const l=u=>{var g;const{scope:h,children:p,...x}=u,f=((g=h==null?void 0:h[e])==null?void 0:g[c])||s,v=E.useMemo(()=>x,Object.values(x));return w.jsx(f.Provider,{value:v,children:p})};l.displayName=i+"Provider";function d(u,h){var f;const p=((f=h==null?void 0:h[e])==null?void 0:f[c])||s,x=E.useContext(p);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${i}\``)}return[l,d]}const o=()=>{const i=r.map(a=>E.createContext(a));return function(s){const c=(s==null?void 0:s[e])||i;return E.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return o.scopeName=e,[n,bu(o,...t)]}function bu(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const a=n.reduce((s,{useScope:c,scopeName:l})=>{const u=c(i)[`__scope${l}`];return{...s,...u}},{});return E.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}var Ce=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},wu=E[" useInsertionEffect ".trim().toString()]||Ce;function tr({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[o,i,a]=xu({defaultProp:t,onChange:r}),s=e!==void 0,c=s?e:o;{const d=E.useRef(e!==void 0);E.useEffect(()=>{const u=d.current;u!==s&&console.warn(`${n} is changing from ${u?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. 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.`),d.current=s},[s,n])}const l=E.useCallback(d=>{var u;if(s){const h=Eu(d)?d(e):d;h!==e&&((u=a.current)==null||u.call(a,h))}else i(d)},[s,e,i,a]);return[c,l]}function xu({defaultProp:e,onChange:t}){const[r,n]=E.useState(e),o=E.useRef(r),i=E.useRef(t);return wu(()=>{i.current=t},[t]),E.useEffect(()=>{var a;o.current!==r&&((a=i.current)==null||a.call(i,r),o.current=r)},[r,o]),[r,n,i]}function Eu(e){return typeof e=="function"}var Cu=E.createContext(void 0);function Si(e){const t=E.useContext(Cu);return e||t||"ltr"}function vn(e){const t=E.useRef({value:e,previous:e});return E.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function yn(e){const[t,r]=E.useState(void 0);return Ce(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let a,s;if("borderBoxSize"in i){const c=i.borderBoxSize,l=Array.isArray(c)?c[0]:c;a=l.inlineSize,s=l.blockSize}else a=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}function Oi(e){const t=e+"CollectionProvider",[r,n]=Dt(t),[o,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=f=>{const{scope:v,children:g}=f,y=D.useRef(null),b=D.useRef(new Map).current;return w.jsx(o,{scope:v,itemMap:b,collectionRef:y,children:g})};a.displayName=t;const s=e+"CollectionSlot",c=Nt(s),l=D.forwardRef((f,v)=>{const{scope:g,children:y}=f,b=i(s,g),O=ue(v,b.collectionRef);return w.jsx(c,{ref:O,children:y})});l.displayName=s;const d=e+"CollectionItemSlot",u="data-radix-collection-item",h=Nt(d),p=D.forwardRef((f,v)=>{const{scope:g,children:y,...b}=f,O=D.useRef(null),S=ue(v,O),T=i(d,g);return D.useEffect(()=>(T.itemMap.set(O,{ref:O,...b}),()=>void T.itemMap.delete(O))),w.jsx(h,{[u]:"",ref:S,children:y})});p.displayName=d;function x(f){const v=i(e+"CollectionConsumer",f);return D.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((T,P)=>b.indexOf(T.ref.current)-b.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},x,n]}var _i=["PageUp","PageDown"],ki=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Pi={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Tt="Slider",[bn,Su,Ou]=Oi(Tt),[Mi,tw]=Dt(Tt,[Ou]),[_u,kr]=Mi(Tt),Ai=E.forwardRef((e,t)=>{const{name:r,min:n=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:c=0,defaultValue:l=[n],value:d,onValueChange:u=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:x,...f}=e,v=E.useRef(new Set),g=E.useRef(0),b=a==="horizontal"?ku:Pu,[O=[],S]=tr({prop:d,defaultProp:l,onChange:U=>{var K;(K=[...v.current][g.current])==null||K.focus(),u(U)}}),T=E.useRef(O);function P(U){const R=Tu(O,U);B(U,R)}function L(U){B(U,g.current)}function $(){const U=T.current[g.current];O[g.current]!==U&&h(O)}function B(U,R,{commit:K}={commit:!1}){const ee=ju(i),H=Lu(Math.round((U-n)/i)*i+n,ee),X=_r(H,[n,o]);S((Z=[])=>{const m=Nu(Z,X,R);if(Wu(m,c*i)){g.current=m.indexOf(X);const C=String(m)!==String(Z);return C&&K&&h(m),C?m:Z}else return Z})}return w.jsx(_u,{scope:e.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:v.current,values:O,orientation:a,form:x,children:w.jsx(bn.Provider,{scope:e.__scopeSlider,children:w.jsx(bn.Slot,{scope:e.__scopeSlider,children:w.jsx(b,{"aria-disabled":s,"data-disabled":s?"":void 0,...f,ref:t,onPointerDown:oe(f.onPointerDown,()=>{s||(T.current=O)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:P,onSlideMove:s?void 0:L,onSlideEnd:s?void 0:$,onHomeKeyDown:()=>!s&&B(n,0,{commit:!0}),onEndKeyDown:()=>!s&&B(o,O.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:R})=>{if(!s){const H=_i.includes(U.key)||U.shiftKey&&ki.includes(U.key)?10:1,X=g.current,Z=O[X],m=i*H*R;B(Z+m,X,{commit:!0})}}})})})})});Ai.displayName=Tt;var[Ni,Di]=Mi(Tt,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ku=E.forwardRef((e,t)=>{const{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...d}=e,[u,h]=E.useState(null),p=ue(t,b=>h(b)),x=E.useRef(void 0),f=Si(o),v=f==="ltr",g=v&&!i||!v&&i;function y(b){const O=x.current||u.getBoundingClientRect(),S=[0,O.width],P=En(S,g?[r,n]:[n,r]);return x.current=O,P(b-O.left)}return w.jsx(Ni,{scope:e.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:w.jsx(Ti,{dir:f,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const O=y(b.clientX);a==null||a(O)},onSlideMove:b=>{const O=y(b.clientX);s==null||s(O)},onSlideEnd:()=>{x.current=void 0,c==null||c()},onStepKeyDown:b=>{const S=Pi[g?"from-left":"from-right"].includes(b.key);l==null||l({event:b,direction:S?-1:1})}})})}),Pu=E.forwardRef((e,t)=>{const{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:c,...l}=e,d=E.useRef(null),u=ue(t,d),h=E.useRef(void 0),p=!o;function x(f){const v=h.current||d.current.getBoundingClientRect(),g=[0,v.height],b=En(g,p?[n,r]:[r,n]);return h.current=v,b(f-v.top)}return w.jsx(Ni,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:w.jsx(Ti,{"data-orientation":"vertical",...l,ref:u,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:f=>{const v=x(f.clientY);i==null||i(v)},onSlideMove:f=>{const v=x(f.clientY);a==null||a(v)},onSlideEnd:()=>{h.current=void 0,s==null||s()},onStepKeyDown:f=>{const g=Pi[p?"from-bottom":"from-top"].includes(f.key);c==null||c({event:f,direction:g?-1:1})}})})}),Ti=E.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:c,...l}=e,d=kr(Tt,r);return w.jsx(ie.span,{...l,ref:t,onKeyDown:oe(e.onKeyDown,u=>{u.key==="Home"?(a(u),u.preventDefault()):u.key==="End"?(s(u),u.preventDefault()):_i.concat(ki).includes(u.key)&&(c(u),u.preventDefault())}),onPointerDown:oe(e.onPointerDown,u=>{const h=u.target;h.setPointerCapture(u.pointerId),u.preventDefault(),d.thumbs.has(h)?h.focus():n(u)}),onPointerMove:oe(e.onPointerMove,u=>{u.target.hasPointerCapture(u.pointerId)&&o(u)}),onPointerUp:oe(e.onPointerUp,u=>{const h=u.target;h.hasPointerCapture(u.pointerId)&&(h.releasePointerCapture(u.pointerId),i(u))})})}),Fi="SliderTrack",Ii=E.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,o=kr(Fi,r);return w.jsx(ie.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:t})});Ii.displayName=Fi;var wn="SliderRange",Wi=E.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,o=kr(wn,r),i=Di(wn,r),a=E.useRef(null),s=ue(t,a),c=o.values.length,l=o.values.map(h=>Bi(h,o.min,o.max)),d=c>1?Math.min(...l):0,u=100-Math.max(...l);return w.jsx(ie.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...e.style,[i.startEdge]:d+"%",[i.endEdge]:u+"%"}})});Wi.displayName=wn;var xn="SliderThumb",ji=E.forwardRef((e,t)=>{const r=Su(e.__scopeSlider),[n,o]=E.useState(null),i=ue(t,s=>o(s)),a=E.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return w.jsx(Mu,{...e,ref:i,index:a})}),Mu=E.forwardRef((e,t)=>{const{__scopeSlider:r,index:n,name:o,...i}=e,a=kr(xn,r),s=Di(xn,r),[c,l]=E.useState(null),d=ue(t,y=>l(y)),u=c?a.form||!!c.closest("form"):!0,h=yn(c),p=a.values[n],x=p===void 0?0:Bi(p,a.min,a.max),f=Du(n,a.values.length),v=h==null?void 0:h[s.size],g=v?Fu(v,x,s.direction):0;return E.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),w.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${x}% + ${g}px)`},children:[w.jsx(bn.ItemSlot,{scope:e.__scopeSlider,children:w.jsx(ie.span,{role:"slider","aria-label":e["aria-label"]||f,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:d,style:p===void 0?{display:"none"}:e.style,onFocus:oe(e.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),u&&w.jsx(Li,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});ji.displayName=xn;var Au="RadioBubbleInput",Li=E.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{const o=E.useRef(null),i=ue(o,n),a=vn(t);return E.useEffect(()=>{const s=o.current;if(!s)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&d){const u=new Event("input",{bubbles:!0});d.call(s,t),s.dispatchEvent(u)}},[a,t]),w.jsx(ie.input,{style:{display:"none"},...r,ref:i,defaultValue:t})});Li.displayName=Au;function Nu(e=[],t,r){const n=[...e];return n[r]=t,n.sort((o,i)=>o-i)}function Bi(e,t,r){const i=100/(r-t)*(e-t);return _r(i,[0,100])}function Du(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Tu(e,t){if(e.length===1)return 0;const r=e.map(o=>Math.abs(o-t)),n=Math.min(...r);return r.indexOf(n)}function Fu(e,t,r){const n=e/2,i=En([0,50],[0,n]);return(n-i(t)*r)*r}function Iu(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function Wu(e,t){if(t>0){const r=Iu(e);return Math.min(...r)>=t}return!0}function En(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 ju(e){return(String(e).split(".")[1]||"").length}function Lu(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var $i=Ai,Bu=Ii,$u=Wi,Ru=ji;const Ri=E.forwardRef(({className:e,...t},r)=>w.jsxs($i,{ref:r,className:J("relative flex w-full touch-none select-none items-center",e),...t,children:[w.jsx(Bu,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:w.jsx($u,{className:"absolute h-full bg-primary"})}),w.jsx(Ru,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Ri.displayName=$i.displayName;const Vi=({id:e,value:t,required:r,disabled:n,readonly:o,label:i,onChange:a,onBlur:s,schema:c})=>{const l=c.minimum||0,d=c.maximum||100,u=c.multipleOf||1,h=ve(e,c),p=async x=>{const f=x[0];a(f),s&&s(e,f),await h.onChange(f)};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsxs(ke,{htmlFor:e,children:[i||c.title,r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx("span",{className:"text-sm font-medium tabular-nums",children:t||l})]}),w.jsx(Ri,{id:e,min:l,max:d,step:u,value:[t||l],onValueChange:p,disabled:n||o,className:"w-full"})]})},Hi=({id:e,value:t,required:r,disabled:n,readonly:o,label:i,onChange:a,options:s,schema:c})=>{const l=Number(s.max||c.maximum||5),d=Array.from({length:l},(p,x)=>x+1),u=ve(e,c),h=async p=>{!n&&!o&&(a(p),await u.onChange(p))};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(ke,{htmlFor:e,children:[i||c.title,r&&w.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w.jsx("div",{className:"flex items-center gap-1",role:"radiogroup","aria-labelledby":e,children:d.map(p=>w.jsx(Ze,{type:"button",variant:"ghost",size:"icon",className:J("h-8 w-8 p-0 hover:bg-transparent",n||o?"cursor-not-allowed opacity-50":"cursor-pointer"),onClick:()=>h(p),disabled:n||o,"aria-label":`Rate ${p} out of ${l}`,role:"radio","aria-checked":p===t,children:w.jsx(gu,{className:J("h-5 w-5 transition-colors",p<=(t||0)?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},p))})]})},Ui=E.forwardRef(({className:e,...t},r)=>w.jsx("textarea",{className:J("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));Ui.displayName="Textarea";function xt(e){const t=E.useRef(e);return E.useEffect(()=>{t.current=e}),E.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function Vu(e,t=globalThis==null?void 0:globalThis.document){const r=xt(e);E.useEffect(()=>{const n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Hu="DismissableLayer",Cn="dismissableLayer.update",Uu="dismissableLayer.pointerDownOutside",Yu="dismissableLayer.focusOutside",Yi,zi=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sn=E.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...c}=e,l=E.useContext(zi),[d,u]=E.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=E.useState({}),x=ue(t,P=>u(P)),f=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=f.indexOf(v),y=d?f.indexOf(d):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,O=y>=g,S=Ku(P=>{const L=P.target,$=[...l.branches].some(B=>B.contains(L));!O||$||(o==null||o(P),a==null||a(P),P.defaultPrevented||s==null||s())},h),T=Gu(P=>{const L=P.target;[...l.branches].some(B=>B.contains(L))||(i==null||i(P),a==null||a(P),P.defaultPrevented||s==null||s())},h);return Vu(P=>{y===l.layers.size-1&&(n==null||n(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},h),E.useEffect(()=>{if(d)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Yi=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(d)),l.layers.add(d),qi(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Yi)}},[d,h,r,l]),E.useEffect(()=>()=>{d&&(l.layers.delete(d),l.layersWithOutsidePointerEventsDisabled.delete(d),qi())},[d,l]),E.useEffect(()=>{const P=()=>p({});return document.addEventListener(Cn,P),()=>document.removeEventListener(Cn,P)},[]),w.jsx(ie.div,{...c,ref:x,style:{pointerEvents:b?O?"auto":"none":void 0,...e.style},onFocusCapture:oe(e.onFocusCapture,T.onFocusCapture),onBlurCapture:oe(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:oe(e.onPointerDownCapture,S.onPointerDownCapture)})});Sn.displayName=Hu;var zu="DismissableLayerBranch",qu=E.forwardRef((e,t)=>{const r=E.useContext(zi),n=E.useRef(null),o=ue(t,n);return E.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),w.jsx(ie.div,{...e,ref:o})});qu.displayName=zu;function Ku(e,t=globalThis==null?void 0:globalThis.document){const r=xt(e),n=E.useRef(!1),o=E.useRef(()=>{});return E.useEffect(()=>{const i=s=>{if(s.target&&!n.current){let c=function(){Ki(Uu,r,l,{discrete:!0})};const l={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Gu(e,t=globalThis==null?void 0:globalThis.document){const r=xt(e),n=E.useRef(!1);return E.useEffect(()=>{const o=i=>{i.target&&!n.current&&Ki(Yu,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function qi(){const e=new CustomEvent(Cn);document.dispatchEvent(e)}function Ki(e,t,r,{discrete:n}){const o=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?ou(o,i):o.dispatchEvent(i)}var On=0;function Gi(){E.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Xi()),document.body.insertAdjacentElement("beforeend",e[1]??Xi()),On++,()=>{On===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),On--}},[])}function Xi(){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 _n="focusScope.autoFocusOnMount",kn="focusScope.autoFocusOnUnmount",Qi={bubbles:!1,cancelable:!0},Xu="FocusScope",Pn=E.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[s,c]=E.useState(null),l=xt(o),d=xt(i),u=E.useRef(null),h=ue(t,f=>c(f)),p=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(n){let f=function(b){if(p.paused||!s)return;const O=b.target;s.contains(O)?u.current=O:ut(u.current,{select:!0})},v=function(b){if(p.paused||!s)return;const O=b.relatedTarget;O!==null&&(s.contains(O)||ut(u.current,{select:!0}))},g=function(b){if(document.activeElement===document.body)for(const S of b)S.removedNodes.length>0&&ut(s)};document.addEventListener("focusin",f),document.addEventListener("focusout",v);const y=new MutationObserver(g);return s&&y.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",v),y.disconnect()}}},[n,s,p.paused]),E.useEffect(()=>{if(s){ea.add(p);const f=document.activeElement;if(!s.contains(f)){const g=new CustomEvent(_n,Qi);s.addEventListener(_n,l),s.dispatchEvent(g),g.defaultPrevented||(Qu(rd(Zi(s)),{select:!0}),document.activeElement===f&&ut(s))}return()=>{s.removeEventListener(_n,l),setTimeout(()=>{const g=new CustomEvent(kn,Qi);s.addEventListener(kn,d),s.dispatchEvent(g),g.defaultPrevented||ut(f??document.body,{select:!0}),s.removeEventListener(kn,d),ea.remove(p)},0)}}},[s,l,d,p]);const x=E.useCallback(f=>{if(!r&&!n||p.paused)return;const v=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,g=document.activeElement;if(v&&g){const y=f.currentTarget,[b,O]=Zu(y);b&&O?!f.shiftKey&&g===O?(f.preventDefault(),r&&ut(b,{select:!0})):f.shiftKey&&g===b&&(f.preventDefault(),r&&ut(O,{select:!0})):g===y&&f.preventDefault()}},[r,n,p.paused]);return w.jsx(ie.div,{tabIndex:-1,...a,ref:h,onKeyDown:x})});Pn.displayName=Xu;function Qu(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ut(n,{select:t}),document.activeElement!==r)return}function Zu(e){const t=Zi(e),r=Ji(t,e),n=Ji(t.reverse(),e);return[r,n]}function Zi(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Ji(e,t){for(const r of e)if(!Ju(r,{upTo:t}))return r}function Ju(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ed(e){return e instanceof HTMLInputElement&&"select"in e}function ut(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&ed(e)&&t&&e.select()}}var ea=td();function td(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=ta(e,t),e.unshift(t)},remove(t){var r;e=ta(e,t),(r=e[0])==null||r.resume()}}}function ta(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function rd(e){return e.filter(t=>t.tagName!=="A")}var nd=E[" useId ".trim().toString()]||(()=>{}),od=0;function Pr(e){const[t,r]=E.useState(nd());return Ce(()=>{r(n=>n??String(od++))},[e]),t?`radix-${t}`:""}const id=["top","right","bottom","left"],dt=Math.min,Pe=Math.max,Mr=Math.round,Ar=Math.floor,Ve=e=>({x:e,y:e}),ad={left:"right",right:"left",bottom:"top",top:"bottom"},sd={start:"end",end:"start"};function Mn(e,t,r){return Pe(e,dt(t,r))}function Je(e,t){return typeof e=="function"?e(t):e}function et(e){return e.split("-")[0]}function Ft(e){return e.split("-")[1]}function An(e){return e==="x"?"y":"x"}function Nn(e){return e==="y"?"height":"width"}function tt(e){return["top","bottom"].includes(et(e))?"y":"x"}function Dn(e){return An(tt(e))}function cd(e,t,r){r===void 0&&(r=!1);const n=Ft(e),o=Dn(e),i=Nn(o);let a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Nr(a)),[a,Nr(a)]}function ld(e){const t=Nr(e);return[Tn(e),t,Tn(t)]}function Tn(e){return e.replace(/start|end/g,t=>sd[t])}function ud(e,t,r){const n=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return r?t?o:n:t?n:o;case"left":case"right":return t?i:a;default:return[]}}function dd(e,t,r,n){const o=Ft(e);let i=ud(et(e),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Tn)))),i}function Nr(e){return e.replace(/left|right|bottom|top/g,t=>ad[t])}function fd(e){return{top:0,right:0,bottom:0,left:0,...e}}function ra(e){return typeof e!="number"?fd(e):{top:e,right:e,bottom:e,left:e}}function Dr(e){const{x:t,y:r,width:n,height:o}=e;return{width:n,height:o,top:r,left:t,right:t+n,bottom:r+o,x:t,y:r}}function na(e,t,r){let{reference:n,floating:o}=e;const i=tt(t),a=Dn(t),s=Nn(a),c=et(t),l=i==="y",d=n.x+n.width/2-o.width/2,u=n.y+n.height/2-o.height/2,h=n[s]/2-o[s]/2;let p;switch(c){case"top":p={x:d,y:n.y-o.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-o.width,y:u};break;default:p={x:n.x,y:n.y}}switch(Ft(t)){case"start":p[a]-=h*(r&&l?-1:1);break;case"end":p[a]+=h*(r&&l?-1:1);break}return p}const hd=async(e,t,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:a}=r,s=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=na(l,n,c),h=n,p={},x=0;for(let f=0;f<s.length;f++){const{name:v,fn:g}=s[f],{x:y,y:b,data:O,reset:S}=await g({x:d,y:u,initialPlacement:n,placement:h,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:e,floating:t}});d=y??d,u=b??u,p={...p,[v]:{...p[v],...O}},S&&x<=50&&(x++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(l=S.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:d,y:u}=na(l,h,c)),f=-1)}return{x:d,y:u,placement:h,strategy:o,middlewareData:p}};async function rr(e,t){var r;t===void 0&&(t={});const{x:n,y:o,platform:i,rects:a,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:p=0}=Je(t,e),x=ra(p),v=s[h?u==="floating"?"reference":"floating":u],g=Dr(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(v)))==null||r?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:d,strategy:c})),y=u==="floating"?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),O=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},S=Dr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:b,strategy:c}):y);return{top:(g.top-S.top+x.top)/O.y,bottom:(S.bottom-g.bottom+x.bottom)/O.y,left:(g.left-S.left+x.left)/O.x,right:(S.right-g.right+x.right)/O.x}}const pd=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:o,rects:i,platform:a,elements:s,middlewareData:c}=t,{element:l,padding:d=0}=Je(e,t)||{};if(l==null)return{};const u=ra(d),h={x:r,y:n},p=Dn(o),x=Nn(p),f=await a.getDimensions(l),v=p==="y",g=v?"top":"left",y=v?"bottom":"right",b=v?"clientHeight":"clientWidth",O=i.reference[x]+i.reference[p]-h[p]-i.floating[x],S=h[p]-i.reference[p],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l));let P=T?T[b]:0;(!P||!await(a.isElement==null?void 0:a.isElement(T)))&&(P=s.floating[b]||i.floating[x]);const L=O/2-S/2,$=P/2-f[x]/2-1,B=dt(u[g],$),U=dt(u[y],$),R=B,K=P-f[x]-U,ee=P/2-f[x]/2+L,H=Mn(R,ee,K),X=!c.arrow&&Ft(o)!=null&&ee!==H&&i.reference[x]/2-(ee<R?B:U)-f[x]/2<0,Z=X?ee<R?ee-R:ee-K:0;return{[p]:h[p]+Z,data:{[p]:H,centerOffset:ee-H-Z,...X&&{alignmentOffset:Z}},reset:X}}}),md=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:f=!0,...v}=Je(e,t);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const g=et(o),y=tt(s),b=et(s)===s,O=await(c.isRTL==null?void 0:c.isRTL(l.floating)),S=h||(b||!f?[Nr(s)]:ld(s)),T=x!=="none";!h&&T&&S.push(...dd(s,f,x,O));const P=[s,...S],L=await rr(t,v),$=[];let B=((n=i.flip)==null?void 0:n.overflows)||[];if(d&&$.push(L[g]),u){const H=cd(o,a,O);$.push(L[H[0]],L[H[1]])}if(B=[...B,{placement:o,overflows:$}],!$.every(H=>H<=0)){var U,R;const H=(((U=i.flip)==null?void 0:U.index)||0)+1,X=P[H];if(X){var K;const m=u==="alignment"?y!==tt(X):!1,C=((K=B[0])==null?void 0:K.overflows[0])>0;if(!m||C)return{data:{index:H,overflows:B},reset:{placement:X}}}let Z=(R=B.filter(m=>m.overflows[0]<=0).sort((m,C)=>m.overflows[1]-C.overflows[1])[0])==null?void 0:R.placement;if(!Z)switch(p){case"bestFit":{var ee;const m=(ee=B.filter(C=>{if(T){const _=tt(C.placement);return _===y||_==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(_=>_>0).reduce((_,k)=>_+k,0)]).sort((C,_)=>C[1]-_[1])[0])==null?void 0:ee[0];m&&(Z=m);break}case"initialPlacement":Z=s;break}if(o!==Z)return{reset:{placement:Z}}}return{}}}};function oa(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ia(e){return id.some(t=>e[t]>=0)}const gd=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...o}=Je(e,t);switch(n){case"referenceHidden":{const i=await rr(t,{...o,elementContext:"reference"}),a=oa(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ia(a)}}}case"escaped":{const i=await rr(t,{...o,altBoundary:!0}),a=oa(i,r.floating);return{data:{escapedOffsets:a,escaped:ia(a)}}}default:return{}}}}};async function vd(e,t){const{placement:r,platform:n,elements:o}=e,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=et(r),s=Ft(r),c=tt(r)==="y",l=["left","top"].includes(a)?-1:1,d=i&&c?-1:1,u=Je(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:x}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof x=="number"&&(p=s==="end"?x*-1:x),c?{x:p*d,y:h*l}:{x:h*l,y:p*d}}const yd=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:o,y:i,placement:a,middlewareData:s}=t,c=await vd(t,e);return a===((r=s.offset)==null?void 0:r.placement)&&(n=s.arrow)!=null&&n.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:a}}}}},bd=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:v=>{let{x:g,y}=v;return{x:g,y}}},...c}=Je(e,t),l={x:r,y:n},d=await rr(t,c),u=tt(et(o)),h=An(u);let p=l[h],x=l[u];if(i){const v=h==="y"?"top":"left",g=h==="y"?"bottom":"right",y=p+d[v],b=p-d[g];p=Mn(y,p,b)}if(a){const v=u==="y"?"top":"left",g=u==="y"?"bottom":"right",y=x+d[v],b=x-d[g];x=Mn(y,x,b)}const f=s.fn({...t,[h]:p,[u]:x});return{...f,data:{x:f.x-r,y:f.y-n,enabled:{[h]:i,[u]:a}}}}}},wd=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:o,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Je(e,t),d={x:r,y:n},u=tt(o),h=An(u);let p=d[h],x=d[u];const f=Je(s,t),v=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const b=h==="y"?"height":"width",O=i.reference[h]-i.floating[b]+v.mainAxis,S=i.reference[h]+i.reference[b]-v.mainAxis;p<O?p=O:p>S&&(p=S)}if(l){var g,y;const b=h==="y"?"width":"height",O=["top","left"].includes(et(o)),S=i.reference[u]-i.floating[b]+(O&&((g=a.offset)==null?void 0:g[u])||0)+(O?0:v.crossAxis),T=i.reference[u]+i.reference[b]+(O?0:((y=a.offset)==null?void 0:y[u])||0)-(O?v.crossAxis:0);x<S?x=S:x>T&&(x=T)}return{[h]:p,[u]:x}}}},xd=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:o,rects:i,platform:a,elements:s}=t,{apply:c=()=>{},...l}=Je(e,t),d=await rr(t,l),u=et(o),h=Ft(o),p=tt(o)==="y",{width:x,height:f}=i.floating;let v,g;u==="top"||u==="bottom"?(v=u,g=h===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=u,v=h==="end"?"top":"bottom");const y=f-d.top-d.bottom,b=x-d.left-d.right,O=dt(f-d[v],y),S=dt(x-d[g],b),T=!t.middlewareData.shift;let P=O,L=S;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(L=b),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(P=y),T&&!h){const B=Pe(d.left,0),U=Pe(d.right,0),R=Pe(d.top,0),K=Pe(d.bottom,0);p?L=x-2*(B!==0||U!==0?B+U:Pe(d.left,d.right)):P=f-2*(R!==0||K!==0?R+K:Pe(d.top,d.bottom))}await c({...t,availableWidth:L,availableHeight:P});const $=await a.getDimensions(s.floating);return x!==$.width||f!==$.height?{reset:{rects:!0}}:{}}}};function Tr(){return typeof window<"u"}function It(e){return aa(e)?(e.nodeName||"").toLowerCase():"#document"}function Me(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function He(e){var t;return(t=(aa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function aa(e){return Tr()?e instanceof Node||e instanceof Me(e).Node:!1}function Te(e){return Tr()?e instanceof Element||e instanceof Me(e).Element:!1}function Ue(e){return Tr()?e instanceof HTMLElement||e instanceof Me(e).HTMLElement:!1}function sa(e){return!Tr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Me(e).ShadowRoot}function nr(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=Fe(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(o)}function Ed(e){return["table","td","th"].includes(It(e))}function Fr(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Fn(e){const t=In(),r=Te(e)?Fe(e):e;return["transform","translate","scale","rotate","perspective"].some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function Cd(e){let t=ft(e);for(;Ue(t)&&!Wt(t);){if(Fn(t))return t;if(Fr(t))return null;t=ft(t)}return null}function In(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Wt(e){return["html","body","#document"].includes(It(e))}function Fe(e){return Me(e).getComputedStyle(e)}function Ir(e){return Te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(It(e)==="html")return e;const t=e.assignedSlot||e.parentNode||sa(e)&&e.host||He(e);return sa(t)?t.host:t}function ca(e){const t=ft(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ue(t)&&nr(t)?t:ca(t)}function or(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=ca(e),i=o===((n=e.ownerDocument)==null?void 0:n.body),a=Me(o);if(i){const s=Wn(a);return t.concat(a,a.visualViewport||[],nr(o)?o:[],s&&r?or(s):[])}return t.concat(o,or(o,[],r))}function Wn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function la(e){const t=Fe(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=Ue(e),i=o?e.offsetWidth:r,a=o?e.offsetHeight:n,s=Mr(r)!==i||Mr(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function jn(e){return Te(e)?e:e.contextElement}function jt(e){const t=jn(e);if(!Ue(t))return Ve(1);const r=t.getBoundingClientRect(),{width:n,height:o,$:i}=la(t);let a=(i?Mr(r.width):r.width)/n,s=(i?Mr(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const Sd=Ve(0);function ua(e){const t=Me(e);return!In()||!t.visualViewport?Sd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Od(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Me(e)?!1:t}function Et(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),i=jn(e);let a=Ve(1);t&&(n?Te(n)&&(a=jt(n)):a=jt(e));const s=Od(i,r,n)?ua(i):Ve(0);let c=(o.left+s.x)/a.x,l=(o.top+s.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(i){const h=Me(i),p=n&&Te(n)?Me(n):n;let x=h,f=Wn(x);for(;f&&n&&p!==x;){const v=jt(f),g=f.getBoundingClientRect(),y=Fe(f),b=g.left+(f.clientLeft+parseFloat(y.paddingLeft))*v.x,O=g.top+(f.clientTop+parseFloat(y.paddingTop))*v.y;c*=v.x,l*=v.y,d*=v.x,u*=v.y,c+=b,l+=O,x=Me(f),f=Wn(x)}}return Dr({width:d,height:u,x:c,y:l})}function Ln(e,t){const r=Ir(e).scrollLeft;return t?t.left+r:Et(He(e)).left+r}function da(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-(r?0:Ln(e,n)),i=n.top+t.scrollTop;return{x:o,y:i}}function _d(e){let{elements:t,rect:r,offsetParent:n,strategy:o}=e;const i=o==="fixed",a=He(n),s=t?Fr(t.floating):!1;if(n===a||s&&i)return r;let c={scrollLeft:0,scrollTop:0},l=Ve(1);const d=Ve(0),u=Ue(n);if((u||!u&&!i)&&((It(n)!=="body"||nr(a))&&(c=Ir(n)),Ue(n))){const p=Et(n);l=jt(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}const h=a&&!u&&!i?da(a,c,!0):Ve(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+d.x+h.x,y:r.y*l.y-c.scrollTop*l.y+d.y+h.y}}function kd(e){return Array.from(e.getClientRects())}function Pd(e){const t=He(e),r=Ir(e),n=e.ownerDocument.body,o=Pe(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=Pe(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+Ln(e);const s=-r.scrollTop;return Fe(n).direction==="rtl"&&(a+=Pe(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function Md(e,t){const r=Me(e),n=He(e),o=r.visualViewport;let i=n.clientWidth,a=n.clientHeight,s=0,c=0;if(o){i=o.width,a=o.height;const l=In();(!l||l&&t==="fixed")&&(s=o.offsetLeft,c=o.offsetTop)}return{width:i,height:a,x:s,y:c}}function Ad(e,t){const r=Et(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,i=Ue(e)?jt(e):Ve(1),a=e.clientWidth*i.x,s=e.clientHeight*i.y,c=o*i.x,l=n*i.y;return{width:a,height:s,x:c,y:l}}function fa(e,t,r){let n;if(t==="viewport")n=Md(e,r);else if(t==="document")n=Pd(He(e));else if(Te(t))n=Ad(t,r);else{const o=ua(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Dr(n)}function ha(e,t){const r=ft(e);return r===t||!Te(r)||Wt(r)?!1:Fe(r).position==="fixed"||ha(r,t)}function Nd(e,t){const r=t.get(e);if(r)return r;let n=or(e,[],!1).filter(s=>Te(s)&&It(s)!=="body"),o=null;const i=Fe(e).position==="fixed";let a=i?ft(e):e;for(;Te(a)&&!Wt(a);){const s=Fe(a),c=Fn(a);!c&&s.position==="fixed"&&(o=null),(i?!c&&!o:!c&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||nr(a)&&!c&&ha(e,a))?n=n.filter(d=>d!==a):o=s,a=ft(a)}return t.set(e,n),n}function Dd(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const a=[...r==="clippingAncestors"?Fr(t)?[]:Nd(t,this._c):[].concat(r),n],s=a[0],c=a.reduce((l,d)=>{const u=fa(t,d,o);return l.top=Pe(u.top,l.top),l.right=dt(u.right,l.right),l.bottom=dt(u.bottom,l.bottom),l.left=Pe(u.left,l.left),l},fa(t,s,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Td(e){const{width:t,height:r}=la(e);return{width:t,height:r}}function Fd(e,t,r){const n=Ue(t),o=He(t),i=r==="fixed",a=Et(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const c=Ve(0);function l(){c.x=Ln(o)}if(n||!n&&!i)if((It(t)!=="body"||nr(o))&&(s=Ir(t)),n){const p=Et(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&l();i&&!n&&o&&l();const d=o&&!n&&!i?da(o,s):Ve(0),u=a.left+s.scrollLeft-c.x-d.x,h=a.top+s.scrollTop-c.y-d.y;return{x:u,y:h,width:a.width,height:a.height}}function Bn(e){return Fe(e).position==="static"}function pa(e,t){if(!Ue(e)||Fe(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return He(e)===r&&(r=r.ownerDocument.body),r}function ma(e,t){const r=Me(e);if(Fr(e))return r;if(!Ue(e)){let o=ft(e);for(;o&&!Wt(o);){if(Te(o)&&!Bn(o))return o;o=ft(o)}return r}let n=pa(e,t);for(;n&&Ed(n)&&Bn(n);)n=pa(n,t);return n&&Wt(n)&&Bn(n)&&!Fn(n)?r:n||Cd(e)||r}const Id=async function(e){const t=this.getOffsetParent||ma,r=this.getDimensions,n=await r(e.floating);return{reference:Fd(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Wd(e){return Fe(e).direction==="rtl"}const jd={convertOffsetParentRelativeRectToViewportRelativeRect:_d,getDocumentElement:He,getClippingRect:Dd,getOffsetParent:ma,getElementRects:Id,getClientRects:kd,getDimensions:Td,getScale:jt,isElement:Te,isRTL:Wd};function ga(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ld(e,t){let r=null,n;const o=He(e);function i(){var s;clearTimeout(n),(s=r)==null||s.disconnect(),r=null}function a(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),i();const l=e.getBoundingClientRect(),{left:d,top:u,width:h,height:p}=l;if(s||t(),!h||!p)return;const x=Ar(u),f=Ar(o.clientWidth-(d+h)),v=Ar(o.clientHeight-(u+p)),g=Ar(d),b={rootMargin:-x+"px "+-f+"px "+-v+"px "+-g+"px",threshold:Pe(0,dt(1,c))||1};let O=!0;function S(T){const P=T[0].intersectionRatio;if(P!==c){if(!O)return a();P?a(!1,P):n=setTimeout(()=>{a(!1,1e-7)},1e3)}P===1&&!ga(l,e.getBoundingClientRect())&&a(),O=!1}try{r=new IntersectionObserver(S,{...b,root:o.ownerDocument})}catch{r=new IntersectionObserver(S,b)}r.observe(e)}return a(!0),i}function Bd(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,l=jn(e),d=o||i?[...l?or(l):[],...or(t)]:[];d.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});const u=l&&s?Ld(l,r):null;let h=-1,p=null;a&&(p=new ResizeObserver(g=>{let[y]=g;y&&y.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(t)})),r()}),l&&!c&&p.observe(l),p.observe(t));let x,f=c?Et(e):null;c&&v();function v(){const g=Et(e);f&&!ga(f,g)&&r(),f=g,x=requestAnimationFrame(v)}return r(),()=>{var g;d.forEach(y=>{o&&y.removeEventListener("scroll",r),i&&y.removeEventListener("resize",r)}),u==null||u(),(g=p)==null||g.disconnect(),p=null,c&&cancelAnimationFrame(x)}}const $d=yd,Rd=bd,Vd=md,Hd=xd,Ud=gd,va=pd,Yd=wd,zd=(e,t,r)=>{const n=new Map,o={platform:jd,...r},i={...o.platform,_c:n};return hd(e,t,{...o,platform:i})};var Wr=typeof document<"u"?D.useLayoutEffect:D.useEffect;function jr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!jr(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){const i=o[n];if(!(i==="_owner"&&e.$$typeof)&&!jr(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function ya(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ba(e,t){const r=ya(e);return Math.round(t*r)/r}function $n(e){const t=E.useRef(e);return Wr(()=>{t.current=e}),t}function qd(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[d,u]=E.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=E.useState(n);jr(h,n)||p(n);const[x,f]=E.useState(null),[v,g]=E.useState(null),y=E.useCallback(m=>{m!==T.current&&(T.current=m,f(m))},[]),b=E.useCallback(m=>{m!==P.current&&(P.current=m,g(m))},[]),O=i||x,S=a||v,T=E.useRef(null),P=E.useRef(null),L=E.useRef(d),$=c!=null,B=$n(c),U=$n(o),R=$n(l),K=E.useCallback(()=>{if(!T.current||!P.current)return;const m={placement:t,strategy:r,middleware:h};U.current&&(m.platform=U.current),zd(T.current,P.current,m).then(C=>{const _={...C,isPositioned:R.current!==!1};ee.current&&!jr(L.current,_)&&(L.current=_,Cr.flushSync(()=>{u(_)}))})},[h,t,r,U,R]);Wr(()=>{l===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,u(m=>({...m,isPositioned:!1})))},[l]);const ee=E.useRef(!1);Wr(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Wr(()=>{if(O&&(T.current=O),S&&(P.current=S),O&&S){if(B.current)return B.current(O,S,K);K()}},[O,S,K,B,$]);const H=E.useMemo(()=>({reference:T,floating:P,setReference:y,setFloating:b}),[y,b]),X=E.useMemo(()=>({reference:O,floating:S}),[O,S]),Z=E.useMemo(()=>{const m={position:r,left:0,top:0};if(!X.floating)return m;const C=ba(X.floating,d.x),_=ba(X.floating,d.y);return s?{...m,transform:"translate("+C+"px, "+_+"px)",...ya(X.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:C,top:_}},[r,s,X.floating,d.x,d.y]);return E.useMemo(()=>({...d,update:K,refs:H,elements:X,floatingStyles:Z}),[d,K,H,X,Z])}const Kd=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:o}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?va({element:n.current,padding:o}).fn(r):{}:n?va({element:n,padding:o}).fn(r):{}}}},Gd=(e,t)=>({...$d(e),options:[e,t]}),Xd=(e,t)=>({...Rd(e),options:[e,t]}),Qd=(e,t)=>({...Yd(e),options:[e,t]}),Zd=(e,t)=>({...Vd(e),options:[e,t]}),Jd=(e,t)=>({...Hd(e),options:[e,t]}),ef=(e,t)=>({...Ud(e),options:[e,t]}),tf=(e,t)=>({...Kd(e),options:[e,t]});var rf="Arrow",wa=E.forwardRef((e,t)=>{const{children:r,width:n=10,height:o=5,...i}=e;return w.jsx(ie.svg,{...i,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});wa.displayName=rf;var nf=wa,Rn="Popper",[xa,Lr]=Dt(Rn),[of,Ea]=xa(Rn),Ca=e=>{const{__scopePopper:t,children:r}=e,[n,o]=E.useState(null);return w.jsx(of,{scope:t,anchor:n,onAnchorChange:o,children:r})};Ca.displayName=Rn;var Sa="PopperAnchor",Oa=E.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...o}=e,i=Ea(Sa,r),a=E.useRef(null),s=ue(t,a);return E.useEffect(()=>{i.onAnchorChange((n==null?void 0:n.current)||a.current)}),n?null:w.jsx(ie.div,{...o,ref:s})});Oa.displayName=Sa;var Vn="PopperContent",[af,sf]=xa(Vn),_a=E.forwardRef((e,t)=>{var A,V,re,q,z,Q;const{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:x,...f}=e,v=Ea(Vn,r),[g,y]=E.useState(null),b=ue(t,se=>y(se)),[O,S]=E.useState(null),T=yn(O),P=(T==null?void 0:T.width)??0,L=(T==null?void 0:T.height)??0,$=n+(i!=="center"?"-"+i:""),B=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},U=Array.isArray(l)?l:[l],R=U.length>0,K={padding:B,boundary:U.filter(lf),altBoundary:R},{refs:ee,floatingStyles:H,placement:X,isPositioned:Z,middlewareData:m}=qd({strategy:"fixed",placement:$,whileElementsMounted:(...se)=>Bd(...se,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[Gd({mainAxis:o+L,alignmentAxis:a}),c&&Xd({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Qd():void 0,...K}),c&&Zd({...K}),Jd({...K,apply:({elements:se,rects:Ee,availableWidth:Le,availableHeight:Ne})=>{const{width:Be,height:De}=Ee.reference,ye=se.floating.style;ye.setProperty("--radix-popper-available-width",`${Le}px`),ye.setProperty("--radix-popper-available-height",`${Ne}px`),ye.setProperty("--radix-popper-anchor-width",`${Be}px`),ye.setProperty("--radix-popper-anchor-height",`${De}px`)}}),O&&tf({element:O,padding:s}),uf({arrowWidth:P,arrowHeight:L}),h&&ef({strategy:"referenceHidden",...K})]}),[C,_]=Ma(X),k=xt(x);Ce(()=>{Z&&(k==null||k())},[Z,k]);const M=(A=m.arrow)==null?void 0:A.x,F=(V=m.arrow)==null?void 0:V.y,I=((re=m.arrow)==null?void 0:re.centerOffset)!==0,[j,W]=E.useState();return Ce(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),w.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:Z?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:j,"--radix-popper-transform-origin":[(q=m.transformOrigin)==null?void 0:q.x,(z=m.transformOrigin)==null?void 0:z.y].join(" "),...((Q=m.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:w.jsx(af,{scope:r,placedSide:C,onArrowChange:S,arrowX:M,arrowY:F,shouldHideArrow:I,children:w.jsx(ie.div,{"data-side":C,"data-align":_,...f,ref:b,style:{...f.style,animation:Z?void 0:"none"}})})})});_a.displayName=Vn;var ka="PopperArrow",cf={top:"bottom",right:"left",bottom:"top",left:"right"},Pa=E.forwardRef(function(t,r){const{__scopePopper:n,...o}=t,i=sf(ka,n),a=cf[i.placedSide];return w.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:w.jsx(nf,{...o,ref:r,style:{...o.style,display:"block"}})})});Pa.displayName=ka;function lf(e){return e!==null}var uf=e=>({name:"transformOrigin",options:e,fn(t){var v,g,y;const{placement:r,rects:n,middlewareData:o}=t,a=((v=o.arrow)==null?void 0:v.centerOffset)!==0,s=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[l,d]=Ma(r),u={start:"0%",center:"50%",end:"100%"}[d],h=(((g=o.arrow)==null?void 0:g.x)??0)+s/2,p=(((y=o.arrow)==null?void 0:y.y)??0)+c/2;let x="",f="";return l==="bottom"?(x=a?u:`${h}px`,f=`${-c}px`):l==="top"?(x=a?u:`${h}px`,f=`${n.floating.height+c}px`):l==="right"?(x=`${-c}px`,f=a?u:`${p}px`):l==="left"&&(x=`${n.floating.width+c}px`,f=a?u:`${p}px`),{data:{x,y:f}}}});function Ma(e){const[t,r="center"]=e.split("-");return[t,r]}var Aa=Ca,Hn=Oa,Na=_a,Da=Pa,df="Portal",Un=E.forwardRef((e,t)=>{var s;const{container:r,...n}=e,[o,i]=E.useState(!1);Ce(()=>i(!0),[]);const a=r||o&&((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body);return a?Uo.createPortal(w.jsx(ie.div,{...n,ref:t}),a):null});Un.displayName=df;var Ta=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"}),ff="VisuallyHidden",hf=E.forwardRef((e,t)=>w.jsx(ie.span,{...e,ref:t,style:{...Ta,...e.style}}));hf.displayName=ff;var pf=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Lt=new WeakMap,Br=new WeakMap,$r={},Yn=0,Fa=function(e){return e&&(e.host||Fa(e.parentNode))},mf=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Fa(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},gf=function(e,t,r,n){var o=mf(t,Array.isArray(e)?e:[e]);$r[r]||($r[r]=new WeakMap);var i=$r[r],a=[],s=new Set,c=new Set(o),l=function(u){!u||s.has(u)||(s.add(u),l(u.parentNode))};o.forEach(l);var d=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(s.has(h))d(h);else try{var p=h.getAttribute(n),x=p!==null&&p!=="false",f=(Lt.get(h)||0)+1,v=(i.get(h)||0)+1;Lt.set(h,f),i.set(h,v),a.push(h),f===1&&x&&Br.set(h,!0),v===1&&h.setAttribute(r,"true"),x||h.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",h,g)}})};return d(t),s.clear(),Yn++,function(){a.forEach(function(u){var h=Lt.get(u)-1,p=i.get(u)-1;Lt.set(u,h),i.set(u,p),h||(Br.has(u)||u.removeAttribute(n),Br.delete(u)),p||u.removeAttribute(r)}),Yn--,Yn||(Lt=new WeakMap,Lt=new WeakMap,Br=new WeakMap,$r={})}},Ia=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=pf(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live], script"))),gf(n,o,r,"aria-hidden")):function(){return null}},Ye=function(){return Ye=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Ye.apply(this,arguments)};function Wa(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function vf(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Rr="right-scroll-bar-position",Vr="width-before-scroll-bar",yf="with-scroll-bars-hidden",bf="--removed-body-scroll-bar-size";function zn(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function wf(e,t){var r=D.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=t,r.facade}var xf=typeof window<"u"?E.useLayoutEffect:E.useEffect,ja=new WeakMap;function Ef(e,t){var r=wf(null,function(n){return e.forEach(function(o){return zn(o,n)})});return xf(function(){var n=ja.get(r);if(n){var o=new Set(n),i=new Set(e),a=r.current;o.forEach(function(s){i.has(s)||zn(s,null)}),i.forEach(function(s){o.has(s)||zn(s,a)})}ja.set(r,e)},[e]),r}function Cf(e){return e}function Sf(e,t){t===void 0&&(t=Cf);var r=[],n=!1,o={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(i){var a=t(i,n);return r.push(a),function(){r=r.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(n=!0;r.length;){var a=r;r=[],a.forEach(i)}r={push:function(s){return i(s)},filter:function(){return r}}},assignMedium:function(i){n=!0;var a=[];if(r.length){var s=r;r=[],s.forEach(i),a=r}var c=function(){var d=a;a=[],d.forEach(i)},l=function(){return Promise.resolve().then(c)};l(),r={push:function(d){a.push(d),l()},filter:function(d){return a=a.filter(d),r}}}};return o}function Of(e){e===void 0&&(e={});var t=Sf(null);return t.options=Ye({async:!0,ssr:!1},e),t}var La=function(e){var t=e.sideCar,r=Wa(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 E.createElement(n,Ye({},r))};La.isSideCarExport=!0;function _f(e,t){return e.useMedium(t),La}var Ba=Of(),qn=function(){},Hr=E.forwardRef(function(e,t){var r=E.useRef(null),n=E.useState({onScrollCapture:qn,onWheelCapture:qn,onTouchMoveCapture:qn}),o=n[0],i=n[1],a=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,u=e.shards,h=e.sideCar,p=e.noRelative,x=e.noIsolation,f=e.inert,v=e.allowPinchZoom,g=e.as,y=g===void 0?"div":g,b=e.gapMode,O=Wa(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,T=Ef([r,t]),P=Ye(Ye({},O),o);return E.createElement(E.Fragment,null,d&&E.createElement(S,{sideCar:Ba,removeScrollBar:l,shards:u,noRelative:p,noIsolation:x,inert:f,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:b}),a?E.cloneElement(E.Children.only(s),Ye(Ye({},P),{ref:T})):E.createElement(y,Ye({},P,{className:c,ref:T}),s))});Hr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Hr.classNames={fullWidth:Vr,zeroRight:Rr};var kf=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Pf(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=kf();return t&&e.setAttribute("nonce",t),e}function Mf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Af(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Nf=function(){var e=0,t=null;return{add:function(r){e==0&&(t=Pf())&&(Mf(t,r),Af(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Df=function(){var e=Nf();return function(t,r){E.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},$a=function(){var e=Df(),t=function(r){var n=r.styles,o=r.dynamic;return e(n,o),null};return t},Tf={left:0,top:0,right:0,gap:0},Kn=function(e){return parseInt(e||"",10)||0},Ff=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Kn(r),Kn(n),Kn(o)]},If=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Tf;var t=Ff(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])}},Wf=$a(),Bt="data-scroll-locked",jf=function(e,t,r,n){var o=e.left,i=e.top,a=e.right,s=e.gap;return r===void 0&&(r="margin"),`
|
|
62
|
+
.`.concat(yf,` {
|
|
63
63
|
overflow: hidden `).concat(n,`;
|
|
64
64
|
padding-right: `).concat(s,"px ").concat(n,`;
|
|
65
65
|
}
|
|
@@ -93,21 +93,21 @@
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
body[`).concat(Bt,`] {
|
|
96
|
-
`).concat(
|
|
96
|
+
`).concat(bf,": ").concat(s,`px;
|
|
97
97
|
}
|
|
98
|
-
`)}
|
|
98
|
+
`)},Ra=function(){var e=parseInt(document.body.getAttribute(Bt)||"0",10);return isFinite(e)?e:0},Lf=function(){E.useEffect(function(){return document.body.setAttribute(Bt,(Ra()+1).toString()),function(){var e=Ra()-1;e<=0?document.body.removeAttribute(Bt):document.body.setAttribute(Bt,e.toString())}},[])},Bf=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,o=n===void 0?"margin":n;Lf();var i=E.useMemo(function(){return If(o)},[o]);return E.createElement(Wf,{styles:jf(i,!t,o,r?"":"!important")})},Gn=!1;if(typeof window<"u")try{var Ur=Object.defineProperty({},"passive",{get:function(){return Gn=!0,!0}});window.addEventListener("test",Ur,Ur),window.removeEventListener("test",Ur,Ur)}catch{Gn=!1}var $t=Gn?{passive:!1}:!1,$f=function(e){return e.tagName==="TEXTAREA"},Va=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!$f(e)&&r[t]==="visible")},Rf=function(e){return Va(e,"overflowY")},Vf=function(e){return Va(e,"overflowX")},Ha=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=Ua(e,n);if(o){var i=Ya(e,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Hf=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},Uf=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Ua=function(e,t){return e==="v"?Rf(t):Vf(t)},Ya=function(e,t){return e==="v"?Hf(t):Uf(t)},Yf=function(e,t){return e==="h"&&t==="rtl"?-1:1},zf=function(e,t,r,n,o){var i=Yf(e,window.getComputedStyle(t).direction),a=i*n,s=r.target,c=t.contains(s),l=!1,d=a>0,u=0,h=0;do{if(!s)break;var p=Ya(e,s),x=p[0],f=p[1],v=p[2],g=f-v-i*x;(x||g)&&Ua(e,s)&&(u+=g,h+=x);var y=s.parentNode;s=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(d&&Math.abs(u)<1||!d&&Math.abs(h)<1)&&(l=!0),l},Yr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},za=function(e){return[e.deltaX,e.deltaY]},qa=function(e){return e&&"current"in e?e.current:e},qf=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Kf=function(e){return`
|
|
99
99
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
100
100
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
101
|
-
`)},Kf=0,Rt=[];function Gf(e){var t=E.useRef([]),r=E.useRef([0,0]),n=E.useRef(),o=E.useState(Kf++)[0],i=E.useState(Ba)[0],a=E.useRef(e);E.useEffect(function(){a.current=e},[e]),E.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var f=gf([e.lockRef.current],(e.shards||[]).map(za),!0).filter(Boolean);return f.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),f.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=E.useCallback(function(f,v){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!a.current.allowPinchZoom;var g=Yr(f),y=r.current,b="deltaX"in f?f.deltaX:y[0]-g[0],O="deltaY"in f?f.deltaY:y[1]-g[1],S,T=f.target,P=Math.abs(b)>Math.abs(O)?"h":"v";if("touches"in f&&P==="h"&&T.type==="range")return!1;var L=Va(P,T);if(!L)return!0;if(L?S=P:(S=P==="v"?"h":"v",L=Va(P,T)),!L)return!1;if(!n.current&&"changedTouches"in f&&(b||O)&&(n.current=S),!S)return!0;var H=n.current||S;return Yf(H,v,f,H==="h"?b:O)},[]),c=E.useCallback(function(f){var v=f;if(!(!Rt.length||Rt[Rt.length-1]!==i)){var g="deltaY"in v?Ya(v):Yr(v),y=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&zf(S.delta,g)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var b=(a.current.shards||[]).map(za).filter(Boolean).filter(function(S){return S.contains(v.target)}),O=b.length>0?s(v,b[0]):!a.current.noIsolation;O&&v.cancelable&&v.preventDefault()}}},[]),l=E.useCallback(function(f,v,g,y){var b={name:f,delta:v,target:g,should:y,shadowParent:Xf(g)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(O){return O!==b})},1)},[]),d=E.useCallback(function(f){r.current=Yr(f),n.current=void 0},[]),u=E.useCallback(function(f){l(f.type,Ya(f),f.target,s(f,e.lockRef.current))},[]),h=E.useCallback(function(f){l(f.type,Yr(f),f.target,s(f,e.lockRef.current))},[]);E.useEffect(function(){return Rt.push(i),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,$t),document.addEventListener("touchmove",c,$t),document.addEventListener("touchstart",d,$t),function(){Rt=Rt.filter(function(f){return f!==i}),document.removeEventListener("wheel",c,$t),document.removeEventListener("touchmove",c,$t),document.removeEventListener("touchstart",d,$t)}},[]);var p=e.removeScrollBar,x=e.inert;return E.createElement(E.Fragment,null,x?E.createElement(i,{styles:qf(o)}):null,p?E.createElement(Lf,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Xf(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Qf=Of(La,Gf);var Xn=E.forwardRef(function(e,t){return E.createElement(Hr,Ye({},e,{ref:t,sideCar:Qf}))});Xn.classNames=Hr.classNames;var Zf=[" ","Enter","ArrowUp","ArrowDown"],Jf=[" ","Enter"],Ct="Select",[zr,qr,eh]=Si(Ct),[Vt,tw]=Dt(Ct,[eh,Lr]),Kr=Lr(),[th,ht]=Vt(Ct),[rh,nh]=Vt(Ct),qa=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:o,onOpenChange:i,value:a,defaultValue:s,onValueChange:c,dir:l,name:d,autoComplete:u,disabled:h,required:p,form:x}=e,f=Kr(t),[v,g]=E.useState(null),[y,b]=E.useState(null),[O,S]=E.useState(!1),T=Ci(l),[P,L]=tr({prop:n,defaultProp:o??!1,onChange:i,caller:Ct}),[H,B]=tr({prop:a,defaultProp:s,onChange:c,caller:Ct}),U=E.useRef(null),$=v?x||!!v.closest("form"):!0,[K,ee]=E.useState(new Set),V=Array.from(K).map(X=>X.props.value).join(";");return w.jsx(Ma,{...f,children:w.jsxs(th,{required:p,scope:t,trigger:v,onTriggerChange:g,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:O,onValueNodeHasChildrenChange:S,contentId:Pr(),value:H,onValueChange:B,open:P,onOpenChange:L,dir:T,triggerPointerDownPosRef:U,disabled:h,children:[w.jsx(zr.Provider,{scope:t,children:w.jsx(rh,{scope:e.__scopeSelect,onNativeOptionAdd:E.useCallback(X=>{ee(Z=>new Set(Z).add(X))},[]),onNativeOptionRemove:E.useCallback(X=>{ee(Z=>{const m=new Set(Z);return m.delete(X),m})},[]),children:r})}),$?w.jsxs(vs,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:u,value:H,onChange:X=>B(X.target.value),disabled:h,form:x,children:[H===void 0?w.jsx("option",{value:""}):null,Array.from(K)]},V):null]})})};qa.displayName=Ct;var Ka="SelectTrigger",Ga=E.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...o}=e,i=Kr(r),a=ht(Ka,r),s=a.disabled||n,c=ue(t,a.onTriggerChange),l=qr(r),d=E.useRef("touch"),[u,h,p]=bs(f=>{const v=l().filter(b=>!b.disabled),g=v.find(b=>b.value===a.value),y=ws(v,f,g);y!==void 0&&a.onValueChange(y.value)}),x=f=>{s||(a.onOpenChange(!0),p()),f&&(a.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return w.jsx(Hn,{asChild:!0,...i,children:w.jsx(ie.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":ys(a.value)?"":void 0,...o,ref:c,onClick:oe(o.onClick,f=>{f.currentTarget.focus(),d.current!=="mouse"&&x(f)}),onPointerDown:oe(o.onPointerDown,f=>{d.current=f.pointerType;const v=f.target;v.hasPointerCapture(f.pointerId)&&v.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(x(f),f.preventDefault())}),onKeyDown:oe(o.onKeyDown,f=>{const v=u.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&h(f.key),!(v&&f.key===" ")&&Zf.includes(f.key)&&(x(),f.preventDefault())})})})});Ga.displayName=Ka;var Xa="SelectValue",Qa=E.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=e,c=ht(Xa,r),{onValueNodeHasChildrenChange:l}=c,d=i!==void 0,u=ue(t,c.onValueNodeChange);return Ce(()=>{l(d)},[l,d]),w.jsx(ie.span,{...s,ref:u,style:{pointerEvents:"none"},children:ys(c.value)?w.jsx(w.Fragment,{children:a}):i})});Qa.displayName=Xa;var oh="SelectIcon",Za=E.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...o}=e;return w.jsx(ie.span,{"aria-hidden":!0,...o,ref:t,children:n||"▼"})});Za.displayName=oh;var ih="SelectPortal",Ja=e=>w.jsx(Un,{asChild:!0,...e});Ja.displayName=ih;var St="SelectContent",es=E.forwardRef((e,t)=>{const r=ht(St,e.__scopeSelect),[n,o]=E.useState();if(Ce(()=>{o(new DocumentFragment)},[]),!r.open){const i=n;return i?Cr.createPortal(w.jsx(ts,{scope:e.__scopeSelect,children:w.jsx(zr.Slot,{scope:e.__scopeSelect,children:w.jsx("div",{children:e.children})})}),i):null}return w.jsx(rs,{...e,ref:t})});es.displayName=St;var Ie=10,[ts,pt]=Vt(St),ah="SelectContentImpl",sh=Nt("SelectContent.RemoveScroll"),rs=E.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:c,align:l,alignOffset:d,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:x,hideWhenDetached:f,avoidCollisions:v,...g}=e,y=ht(St,r),[b,O]=E.useState(null),[S,T]=E.useState(null),P=ue(t,A=>O(A)),[L,H]=E.useState(null),[B,U]=E.useState(null),$=qr(r),[K,ee]=E.useState(!1),V=E.useRef(!1);E.useEffect(()=>{if(b)return Fa(b)},[b]),Ki();const X=E.useCallback(A=>{const[R,...re]=$().map(Q=>Q.ref.current),[q]=re.slice(-1),z=document.activeElement;for(const Q of A)if(Q===z||(Q==null||Q.scrollIntoView({block:"nearest"}),Q===R&&S&&(S.scrollTop=0),Q===q&&S&&(S.scrollTop=S.scrollHeight),Q==null||Q.focus(),document.activeElement!==z))return},[$,S]),Z=E.useCallback(()=>X([L,b]),[X,L,b]);E.useEffect(()=>{K&&Z()},[K,Z]);const{onOpenChange:m,triggerPointerDownPosRef:C}=y;E.useEffect(()=>{if(b){let A={x:0,y:0};const R=q=>{var z,Q;A={x:Math.abs(Math.round(q.pageX)-(((z=C.current)==null?void 0:z.x)??0)),y:Math.abs(Math.round(q.pageY)-(((Q=C.current)==null?void 0:Q.y)??0))}},re=q=>{A.x<=10&&A.y<=10?q.preventDefault():b.contains(q.target)||m(!1),document.removeEventListener("pointermove",R),C.current=null};return C.current!==null&&(document.addEventListener("pointermove",R),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",R),document.removeEventListener("pointerup",re,{capture:!0})}}},[b,m,C]),E.useEffect(()=>{const A=()=>m(!1);return window.addEventListener("blur",A),window.addEventListener("resize",A),()=>{window.removeEventListener("blur",A),window.removeEventListener("resize",A)}},[m]);const[_,k]=bs(A=>{const R=$().filter(z=>!z.disabled),re=R.find(z=>z.ref.current===document.activeElement),q=ws(R,A,re);q&&setTimeout(()=>q.ref.current.focus())}),M=E.useCallback((A,R,re)=>{const q=!V.current&&!re;(y.value!==void 0&&y.value===R||q)&&(H(A),q&&(V.current=!0))},[y.value]),F=E.useCallback(()=>b==null?void 0:b.focus(),[b]),I=E.useCallback((A,R,re)=>{const q=!V.current&&!re;(y.value!==void 0&&y.value===R||q)&&U(A)},[y.value]),j=n==="popper"?Qn:ns,W=j===Qn?{side:s,sideOffset:c,align:l,alignOffset:d,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:x,hideWhenDetached:f,avoidCollisions:v}:{};return w.jsx(ts,{scope:r,content:b,viewport:S,onViewportChange:T,itemRefCallback:M,selectedItem:L,onItemLeave:F,itemTextRefCallback:I,focusSelectedItem:Z,selectedItemText:B,position:n,isPositioned:K,searchRef:_,children:w.jsx(Xn,{as:sh,allowPinchZoom:!0,children:w.jsx(Pn,{asChild:!0,trapped:y.open,onMountAutoFocus:A=>{A.preventDefault()},onUnmountAutoFocus:oe(o,A=>{var R;(R=y.trigger)==null||R.focus({preventScroll:!0}),A.preventDefault()}),children:w.jsx(Sn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:A=>A.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:w.jsx(j,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:A=>A.preventDefault(),...g,...W,onPlaced:()=>ee(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:oe(g.onKeyDown,A=>{const R=A.ctrlKey||A.altKey||A.metaKey;if(A.key==="Tab"&&A.preventDefault(),!R&&A.key.length===1&&k(A.key),["ArrowUp","ArrowDown","Home","End"].includes(A.key)){let q=$().filter(z=>!z.disabled).map(z=>z.ref.current);if(["ArrowUp","End"].includes(A.key)&&(q=q.slice().reverse()),["ArrowUp","ArrowDown"].includes(A.key)){const z=A.target,Q=q.indexOf(z);q=q.slice(Q+1)}setTimeout(()=>X(q)),A.preventDefault()}})})})})})})});rs.displayName=ah;var ch="SelectItemAlignedPosition",ns=E.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...o}=e,i=ht(St,r),a=pt(St,r),[s,c]=E.useState(null),[l,d]=E.useState(null),u=ue(t,P=>d(P)),h=qr(r),p=E.useRef(!1),x=E.useRef(!0),{viewport:f,selectedItem:v,selectedItemText:g,focusSelectedItem:y}=a,b=E.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&f&&v&&g){const P=i.trigger.getBoundingClientRect(),L=l.getBoundingClientRect(),H=i.valueNode.getBoundingClientRect(),B=g.getBoundingClientRect();if(i.dir!=="rtl"){const z=B.left-L.left,Q=H.left-z,se=P.left-Q,Ee=P.width+se,Le=Math.max(Ee,L.width),Ne=window.innerWidth-Ie,Be=_r(Q,[Ie,Math.max(Ie,Ne-Le)]);s.style.minWidth=Ee+"px",s.style.left=Be+"px"}else{const z=L.right-B.right,Q=window.innerWidth-H.right-z,se=window.innerWidth-P.right-Q,Ee=P.width+se,Le=Math.max(Ee,L.width),Ne=window.innerWidth-Ie,Be=_r(Q,[Ie,Math.max(Ie,Ne-Le)]);s.style.minWidth=Ee+"px",s.style.right=Be+"px"}const U=h(),$=window.innerHeight-Ie*2,K=f.scrollHeight,ee=window.getComputedStyle(l),V=parseInt(ee.borderTopWidth,10),X=parseInt(ee.paddingTop,10),Z=parseInt(ee.borderBottomWidth,10),m=parseInt(ee.paddingBottom,10),C=V+X+K+m+Z,_=Math.min(v.offsetHeight*5,C),k=window.getComputedStyle(f),M=parseInt(k.paddingTop,10),F=parseInt(k.paddingBottom,10),I=P.top+P.height/2-Ie,j=$-I,W=v.offsetHeight/2,A=v.offsetTop+W,R=V+X+A,re=C-R;if(R<=I){const z=U.length>0&&v===U[U.length-1].ref.current;s.style.bottom="0px";const Q=l.clientHeight-f.offsetTop-f.offsetHeight,se=Math.max(j,W+(z?F:0)+Q+Z),Ee=R+se;s.style.height=Ee+"px"}else{const z=U.length>0&&v===U[0].ref.current;s.style.top="0px";const se=Math.max(I,V+f.offsetTop+(z?M:0)+W)+re;s.style.height=se+"px",f.scrollTop=R-I+f.offsetTop}s.style.margin=`${Ie}px 0`,s.style.minHeight=_+"px",s.style.maxHeight=$+"px",n==null||n(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,s,l,f,v,g,i.dir,n]);Ce(()=>b(),[b]);const[O,S]=E.useState();Ce(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]);const T=E.useCallback(P=>{P&&x.current===!0&&(b(),y==null||y(),x.current=!1)},[b,y]);return w.jsx(uh,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:w.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:O},children:w.jsx(ie.div,{...o,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});ns.displayName=ch;var lh="SelectPopperPosition",Qn=E.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:o=Ie,...i}=e,a=Kr(r);return w.jsx(Aa,{...a,...i,ref:t,align:n,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Qn.displayName=lh;var[uh,Zn]=Vt(St,{}),Jn="SelectViewport",os=E.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...o}=e,i=pt(Jn,r),a=Zn(Jn,r),s=ue(t,i.onViewportChange),c=E.useRef(0);return w.jsxs(w.Fragment,{children:[w.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:n}),w.jsx(zr.Slot,{scope:r,children:w.jsx(ie.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:oe(o.onScroll,l=>{const d=l.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:h}=a;if(h!=null&&h.current&&u){const p=Math.abs(c.current-d.scrollTop);if(p>0){const x=window.innerHeight-Ie*2,f=parseFloat(u.style.minHeight),v=parseFloat(u.style.height),g=Math.max(f,v);if(g<x){const y=g+p,b=Math.min(x,y),O=y-b;u.style.height=b+"px",u.style.bottom==="0px"&&(d.scrollTop=O>0?O:0,u.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});os.displayName=Jn;var is="SelectGroup",[dh,fh]=Vt(is),hh=E.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,o=Pr();return w.jsx(dh,{scope:r,id:o,children:w.jsx(ie.div,{role:"group","aria-labelledby":o,...n,ref:t})})});hh.displayName=is;var as="SelectLabel",ss=E.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,o=fh(as,r);return w.jsx(ie.div,{id:o.id,...n,ref:t})});ss.displayName=as;var Gr="SelectItem",[ph,cs]=Vt(Gr),ls=E.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=e,s=ht(Gr,r),c=pt(Gr,r),l=s.value===n,[d,u]=E.useState(i??""),[h,p]=E.useState(!1),x=ue(t,y=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,y,n,o)}),f=Pr(),v=E.useRef("touch"),g=()=>{o||(s.onValueChange(n),s.onOpenChange(!1))};if(n==="")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 w.jsx(ph,{scope:r,value:n,disabled:o,textId:f,isSelected:l,onItemTextChange:E.useCallback(y=>{u(b=>b||((y==null?void 0:y.textContent)??"").trim())},[]),children:w.jsx(zr.ItemSlot,{scope:r,value:n,disabled:o,textValue:d,children:w.jsx(ie.div,{role:"option","aria-labelledby":f,"data-highlighted":h?"":void 0,"aria-selected":l&&h,"data-state":l?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:x,onFocus:oe(a.onFocus,()=>p(!0)),onBlur:oe(a.onBlur,()=>p(!1)),onClick:oe(a.onClick,()=>{v.current!=="mouse"&&g()}),onPointerUp:oe(a.onPointerUp,()=>{v.current==="mouse"&&g()}),onPointerDown:oe(a.onPointerDown,y=>{v.current=y.pointerType}),onPointerMove:oe(a.onPointerMove,y=>{var b;v.current=y.pointerType,o?(b=c.onItemLeave)==null||b.call(c):v.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:oe(a.onPointerLeave,y=>{var b;y.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:oe(a.onKeyDown,y=>{var O;((O=c.searchRef)==null?void 0:O.current)!==""&&y.key===" "||(Jf.includes(y.key)&&g(),y.key===" "&&y.preventDefault())})})})})});ls.displayName=Gr;var ir="SelectItemText",us=E.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:o,...i}=e,a=ht(ir,r),s=pt(ir,r),c=cs(ir,r),l=nh(ir,r),[d,u]=E.useState(null),h=ue(t,g=>u(g),c.onItemTextChange,g=>{var y;return(y=s.itemTextRefCallback)==null?void 0:y.call(s,g,c.value,c.disabled)}),p=d==null?void 0:d.textContent,x=E.useMemo(()=>w.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:f,onNativeOptionRemove:v}=l;return Ce(()=>(f(x),()=>v(x)),[f,v,x]),w.jsxs(w.Fragment,{children:[w.jsx(ie.span,{id:c.textId,...i,ref:h}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Cr.createPortal(i.children,a.valueNode):null]})});us.displayName=ir;var ds="SelectItemIndicator",fs=E.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return cs(ds,r).isSelected?w.jsx(ie.span,{"aria-hidden":!0,...n,ref:t}):null});fs.displayName=ds;var eo="SelectScrollUpButton",hs=E.forwardRef((e,t)=>{const r=pt(eo,e.__scopeSelect),n=Zn(eo,e.__scopeSelect),[o,i]=E.useState(!1),a=ue(t,n.onScrollButtonChange);return Ce(()=>{if(r.viewport&&r.isPositioned){let s=function(){const l=c.scrollTop>0;i(l)};const c=r.viewport;return s(),c.addEventListener("scroll",s),()=>c.removeEventListener("scroll",s)}},[r.viewport,r.isPositioned]),o?w.jsx(ms,{...e,ref:a,onAutoScroll:()=>{const{viewport:s,selectedItem:c}=r;s&&c&&(s.scrollTop=s.scrollTop-c.offsetHeight)}}):null});hs.displayName=eo;var to="SelectScrollDownButton",ps=E.forwardRef((e,t)=>{const r=pt(to,e.__scopeSelect),n=Zn(to,e.__scopeSelect),[o,i]=E.useState(!1),a=ue(t,n.onScrollButtonChange);return Ce(()=>{if(r.viewport&&r.isPositioned){let s=function(){const l=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<l;i(d)};const c=r.viewport;return s(),c.addEventListener("scroll",s),()=>c.removeEventListener("scroll",s)}},[r.viewport,r.isPositioned]),o?w.jsx(ms,{...e,ref:a,onAutoScroll:()=>{const{viewport:s,selectedItem:c}=r;s&&c&&(s.scrollTop=s.scrollTop+c.offsetHeight)}}):null});ps.displayName=to;var ms=E.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...o}=e,i=pt("SelectScrollButton",r),a=E.useRef(null),s=qr(r),c=E.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return E.useEffect(()=>()=>c(),[c]),Ce(()=>{var d;const l=s().find(u=>u.ref.current===document.activeElement);(d=l==null?void 0:l.ref.current)==null||d.scrollIntoView({block:"nearest"})},[s]),w.jsx(ie.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:oe(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:oe(o.onPointerMove,()=>{var l;(l=i.onItemLeave)==null||l.call(i),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:oe(o.onPointerLeave,()=>{c()})})}),mh="SelectSeparator",gs=E.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return w.jsx(ie.div,{"aria-hidden":!0,...n,ref:t})});gs.displayName=mh;var ro="SelectArrow",gh=E.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,o=Kr(r),i=ht(ro,r),a=pt(ro,r);return i.open&&a.position==="popper"?w.jsx(Na,{...o,...n,ref:t}):null});gh.displayName=ro;var vh="SelectBubbleInput",vs=E.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const o=E.useRef(null),i=ue(n,o),a=vn(t);return E.useEffect(()=>{const s=o.current;if(!s)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&d){const u=new Event("change",{bubbles:!0});d.call(s,t),s.dispatchEvent(u)}},[a,t]),w.jsx(ie.select,{...r,style:{...Da,...r.style},ref:i,defaultValue:t})});vs.displayName=vh;function ys(e){return e===""||e===void 0}function bs(e){const t=xt(e),r=E.useRef(""),n=E.useRef(0),o=E.useCallback(a=>{const s=r.current+a;t(s),function c(l){r.current=l,window.clearTimeout(n.current),l!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(s)},[t]),i=E.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function ws(e,t,r){const o=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,i=r?e.indexOf(r):-1;let a=yh(e,Math.max(i,0));o.length===1&&(a=a.filter(l=>l!==r));const c=a.find(l=>l.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==r?c:void 0}function yh(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var bh=qa,xs=Ga,wh=Qa,xh=Za,Eh=Ja,Es=es,Ch=os,Cs=ss,Ss=ls,Sh=us,Oh=fs,Os=hs,_s=ps,ks=gs;const _h=bh,kh=wh,Ps=E.forwardRef(({className:e,children:t,...r},n)=>w.jsxs(xs,{ref:n,className:J("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,w.jsx(xh,{asChild:!0,children:w.jsx(mn,{className:"h-4 w-4 opacity-50"})})]}));Ps.displayName=xs.displayName;const Ms=E.forwardRef(({className:e,...t},r)=>w.jsx(Os,{ref:r,className:J("flex cursor-default items-center justify-center py-1",e),...t,children:w.jsx(mi,{className:"h-4 w-4"})}));Ms.displayName=Os.displayName;const As=E.forwardRef(({className:e,...t},r)=>w.jsx(_s,{ref:r,className:J("flex cursor-default items-center justify-center py-1",e),...t,children:w.jsx(mn,{className:"h-4 w-4"})}));As.displayName=_s.displayName;const Ns=E.forwardRef(({className:e,children:t,position:r="popper",...n},o)=>w.jsx(Eh,{children:w.jsxs(Es,{ref:o,className:J("relative z-50 max-h-96 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",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[w.jsx(Ms,{}),w.jsx(Ch,{className:J("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),w.jsx(As,{})]})}));Ns.displayName=Es.displayName;const Ph=E.forwardRef(({className:e,...t},r)=>w.jsx(Cs,{ref:r,className:J("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Ph.displayName=Cs.displayName;const Ds=E.forwardRef(({className:e,children:t,...r},n)=>w.jsxs(Ss,{ref:n,className:J("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[w.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(Oh,{children:w.jsx(pi,{className:"h-4 w-4"})})}),w.jsx(Sh,{children:t})]}));Ds.displayName=Ss.displayName;const Mh=E.forwardRef(({className:e,...t},r)=>w.jsx(ks,{ref:r,className:J("-mx-1 my-1 h-px bg-muted",e),...t}));Mh.displayName=ks.displayName;function Ah(e,t){return E.useReducer((r,n)=>t[r][n]??r,e)}var Xr=e=>{const{present:t,children:r}=e,n=Nh(t),o=typeof r=="function"?r({present:n.isPresent}):E.Children.only(r),i=ue(n.ref,Dh(o));return typeof r=="function"||n.isPresent?E.cloneElement(o,{ref:i}):null};Xr.displayName="Presence";function Nh(e){const[t,r]=E.useState(),n=E.useRef(null),o=E.useRef(e),i=E.useRef("none"),a=e?"mounted":"unmounted",[s,c]=Ah(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const l=Qr(n.current);i.current=s==="mounted"?l:"none"},[s]),Ce(()=>{const l=n.current,d=o.current;if(d!==e){const h=i.current,p=Qr(l);e?c("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Ce(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,u=p=>{const f=Qr(n.current).includes(p.animationName);if(p.target===t&&f&&(c("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",l=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},h=p=>{p.target===t&&(i.current=Qr(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{d.clearTimeout(l),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:E.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Qr(e){return(e==null?void 0:e.animationName)||"none"}function Dh(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Zr="Checkbox",[Th,rw]=Dt(Zr),[Fh,no]=Th(Zr);function Ih(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:o,disabled:i,form:a,name:s,onCheckedChange:c,required:l,value:d="on",internal_do_not_use_render:u}=e,[h,p]=tr({prop:r,defaultProp:o??!1,onChange:c,caller:Zr}),[x,f]=E.useState(null),[v,g]=E.useState(null),y=E.useRef(!1),b=x?!!a||!!x.closest("form"):!0,O={checked:h,disabled:i,setChecked:p,control:x,setControl:f,name:s,form:a,value:d,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:mt(o)?!1:o,isFormControl:b,bubbleInput:v,setBubbleInput:g};return w.jsx(Fh,{scope:t,...O,children:Wh(u)?u(O):n})}var Ts="CheckboxTrigger",Fs=E.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},o)=>{const{control:i,value:a,disabled:s,checked:c,required:l,setControl:d,setChecked:u,hasConsumerStoppedPropagationRef:h,isFormControl:p,bubbleInput:x}=no(Ts,e),f=ue(o,d),v=E.useRef(c);return E.useEffect(()=>{const g=i==null?void 0:i.form;if(g){const y=()=>u(v.current);return g.addEventListener("reset",y),()=>g.removeEventListener("reset",y)}},[i,u]),w.jsx(ie.button,{type:"button",role:"checkbox","aria-checked":mt(c)?"mixed":c,"aria-required":l,"data-state":Bs(c),"data-disabled":s?"":void 0,disabled:s,value:a,...n,ref:f,onKeyDown:oe(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:oe(r,g=>{u(y=>mt(y)?!0:!y),x&&p&&(h.current=g.isPropagationStopped(),h.current||g.stopPropagation())})})});Fs.displayName=Ts;var oo=E.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:c,onCheckedChange:l,form:d,...u}=e;return w.jsx(Ih,{__scopeCheckbox:r,checked:o,defaultChecked:i,disabled:s,required:a,onCheckedChange:l,name:n,form:d,value:c,internal_do_not_use_render:({isFormControl:h})=>w.jsxs(w.Fragment,{children:[w.jsx(Fs,{...u,ref:t,__scopeCheckbox:r}),h&&w.jsx(Ls,{__scopeCheckbox:r})]})})});oo.displayName=Zr;var Is="CheckboxIndicator",Ws=E.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...o}=e,i=no(Is,r);return w.jsx(Xr,{present:n||mt(i.checked)||i.checked===!0,children:w.jsx(ie.span,{"data-state":Bs(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ws.displayName=Is;var js="CheckboxBubbleInput",Ls=E.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:a,required:s,disabled:c,name:l,value:d,form:u,bubbleInput:h,setBubbleInput:p}=no(js,e),x=ue(r,p),f=vn(i),v=yn(n);E.useEffect(()=>{const y=h;if(!y)return;const b=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(b,"checked").set,T=!o.current;if(f!==i&&S){const P=new Event("click",{bubbles:T});y.indeterminate=mt(i),S.call(y,mt(i)?!1:i),y.dispatchEvent(P)}},[h,f,i,o]);const g=E.useRef(mt(i)?!1:i);return w.jsx(ie.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??g.current,required:s,disabled:c,name:l,value:d,form:u,...t,tabIndex:-1,ref:x,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Ls.displayName=js;function Wh(e){return typeof e=="function"}function mt(e){return e==="indeterminate"}function Bs(e){return mt(e)?"indeterminate":e?"checked":"unchecked"}const $s=E.forwardRef(({className:e,...t},r)=>w.jsx(oo,{ref:r,className:J("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:w.jsx(Ws,{className:J("flex items-center justify-center text-current"),children:w.jsx(pi,{className:"h-4 w-4"})})}));$s.displayName=oo.displayName;const Rs=6048e5,jh=864e5,Vs=Symbol.for("constructDateFrom");function we(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Vs in e?e[Vs](t):e instanceof Date?new e.constructor(t):new Date(t)}function de(e,t){return we(t||e,e)}function Hs(e,t,r){const n=de(e,r==null?void 0:r.in);return isNaN(t)?we(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function Us(e,t,r){const n=de(e,r==null?void 0:r.in);if(isNaN(t))return we(e,NaN);if(!t)return n;const o=n.getDate(),i=we(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const a=i.getDate();return o>=a?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}let Lh={};function ar(){return Lh}function Ht(e,t){var s,c,l,d;const r=ar(),n=(t==null?void 0:t.weekStartsOn)??((c=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(l=r.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??0,o=de(e,t==null?void 0:t.in),i=o.getDay(),a=(i<n?7:0)+i-n;return o.setDate(o.getDate()-a),o.setHours(0,0,0,0),o}function sr(e,t){return Ht(e,{...t,weekStartsOn:1})}function Ys(e,t){const r=de(e,t==null?void 0:t.in),n=r.getFullYear(),o=we(r,0);o.setFullYear(n+1,0,4),o.setHours(0,0,0,0);const i=sr(o),a=we(r,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const s=sr(a);return r.getTime()>=i.getTime()?n+1:r.getTime()>=s.getTime()?n:n-1}function zs(e){const t=de(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function Ut(e,...t){const r=we.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function cr(e,t){const r=de(e,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function qs(e,t,r){const[n,o]=Ut(r==null?void 0:r.in,e,t),i=cr(n),a=cr(o),s=+i-zs(i),c=+a-zs(a);return Math.round((s-c)/jh)}function Bh(e,t){const r=Ys(e,t),n=we(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),sr(n)}function $h(e,t,r){return Hs(e,t*7,r)}function Rh(e,t,r){return Us(e,t*12,r)}function Vh(e,t){let r,n=t==null?void 0:t.in;return e.forEach(o=>{!n&&typeof o=="object"&&(n=we.bind(null,o));const i=de(o,n);(!r||r<i||isNaN(+i))&&(r=i)}),we(n,r||NaN)}function Hh(e,t){let r,n=t==null?void 0:t.in;return e.forEach(o=>{!n&&typeof o=="object"&&(n=we.bind(null,o));const i=de(o,n);(!r||r>i||isNaN(+i))&&(r=i)}),we(n,r||NaN)}function Uh(e,t,r){const[n,o]=Ut(r==null?void 0:r.in,e,t);return+cr(n)==+cr(o)}function Ks(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Yh(e){return!(!Ks(e)&&typeof e!="number"||isNaN(+de(e)))}function zh(e,t,r){const[n,o]=Ut(r==null?void 0:r.in,e,t),i=n.getFullYear()-o.getFullYear(),a=n.getMonth()-o.getMonth();return i*12+a}function qh(e,t){const r=de(e,t==null?void 0:t.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function Kh(e,t){const[r,n]=Ut(e,t.start,t.end);return{start:r,end:n}}function Gh(e,t){const{start:r,end:n}=Kh(t==null?void 0:t.in,e);let o=+r>+n;const i=o?+r:+n,a=o?n:r;a.setHours(0,0,0,0),a.setDate(1);let s=1;const c=[];for(;+a<=i;)c.push(we(r,a)),a.setMonth(a.getMonth()+s);return o?c.reverse():c}function Xh(e,t){const r=de(e,t==null?void 0:t.in);return r.setDate(1),r.setHours(0,0,0,0),r}function Qh(e,t){const r=de(e,t==null?void 0:t.in),n=r.getFullYear();return r.setFullYear(n+1,0,0),r.setHours(23,59,59,999),r}function Gs(e,t){const r=de(e,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function Xs(e,t){var s,c,l,d;const r=ar(),n=(t==null?void 0:t.weekStartsOn)??((c=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(l=r.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??0,o=de(e,t==null?void 0:t.in),i=o.getDay(),a=(i<n?-7:0)+6-(i-n);return o.setDate(o.getDate()+a),o.setHours(23,59,59,999),o}function Zh(e,t){return Xs(e,{...t,weekStartsOn:1})}const Jh={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ep=(e,t,r)=>{let n;const o=Jh[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function io(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const tp={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rp={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},np={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},op={date:io({formats:tp,defaultWidth:"full"}),time:io({formats:rp,defaultWidth:"full"}),dateTime:io({formats:np,defaultWidth:"full"})},ip={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ap=(e,t,r,n)=>ip[e];function lr(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,s=r!=null&&r.width?String(r.width):a;o=e.formattingValues[s]||e.formattingValues[a]}else{const a=e.defaultWidth,s=r!=null&&r.width?String(r.width):e.defaultWidth;o=e.values[s]||e.values[a]}const i=e.argumentCallback?e.argumentCallback(t):t;return o[i]}}const sp={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},cp={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},lp={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},up={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},dp={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},fp={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},hp={ordinalNumber:(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:lr({values:sp,defaultWidth:"wide"}),quarter:lr({values:cp,defaultWidth:"wide",argumentCallback:e=>e-1}),month:lr({values:lp,defaultWidth:"wide"}),day:lr({values:up,defaultWidth:"wide"}),dayPeriod:lr({values:dp,defaultWidth:"wide",formattingValues:fp,defaultFormattingWidth:"wide"})};function ur(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;const a=i[0],s=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?mp(s,u=>u.test(a)):pp(s,u=>u.test(a));let l;l=e.valueCallback?e.valueCallback(c):c,l=r.valueCallback?r.valueCallback(l):l;const d=t.slice(a.length);return{value:l,rest:d}}}function pp(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function mp(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function gp(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const o=n[0],i=t.match(e.parsePattern);if(!i)return null;let a=e.valueCallback?e.valueCallback(i[0]):i[0];a=r.valueCallback?r.valueCallback(a):a;const s=t.slice(o.length);return{value:a,rest:s}}}const vp=/^(\d+)(th|st|nd|rd)?/i,yp=/\d+/i,bp={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},wp={any:[/^b/i,/^(a|c)/i]},xp={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ep={any:[/1/i,/2/i,/3/i,/4/i]},Cp={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Sp={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Op={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},_p={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},kp={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Pp={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Mp={ordinalNumber:gp({matchPattern:vp,parsePattern:yp,valueCallback:e=>parseInt(e,10)}),era:ur({matchPatterns:bp,defaultMatchWidth:"wide",parsePatterns:wp,defaultParseWidth:"any"}),quarter:ur({matchPatterns:xp,defaultMatchWidth:"wide",parsePatterns:Ep,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ur({matchPatterns:Cp,defaultMatchWidth:"wide",parsePatterns:Sp,defaultParseWidth:"any"}),day:ur({matchPatterns:Op,defaultMatchWidth:"wide",parsePatterns:_p,defaultParseWidth:"any"}),dayPeriod:ur({matchPatterns:kp,defaultMatchWidth:"any",parsePatterns:Pp,defaultParseWidth:"any"})},ao={code:"en-US",formatDistance:ep,formatLong:op,formatRelative:ap,localize:hp,match:Mp,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ap(e,t){const r=de(e,t==null?void 0:t.in);return qs(r,Gs(r))+1}function Qs(e,t){const r=de(e,t==null?void 0:t.in),n=+sr(r)-+Bh(r);return Math.round(n/Rs)+1}function Zs(e,t){var d,u,h,p;const r=de(e,t==null?void 0:t.in),n=r.getFullYear(),o=ar(),i=(t==null?void 0:t.firstWeekContainsDate)??((u=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??o.firstWeekContainsDate??((p=(h=o.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,a=we((t==null?void 0:t.in)||e,0);a.setFullYear(n+1,0,i),a.setHours(0,0,0,0);const s=Ht(a,t),c=we((t==null?void 0:t.in)||e,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const l=Ht(c,t);return+r>=+s?n+1:+r>=+l?n:n-1}function Np(e,t){var s,c,l,d;const r=ar(),n=(t==null?void 0:t.firstWeekContainsDate)??((c=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(l=r.locale)==null?void 0:l.options)==null?void 0:d.firstWeekContainsDate)??1,o=Zs(e,t),i=we((t==null?void 0:t.in)||e,0);return i.setFullYear(o,0,n),i.setHours(0,0,0,0),Ht(i,t)}function Js(e,t){const r=de(e,t==null?void 0:t.in),n=+Ht(r,t)-+Np(r,t);return Math.round(n/Rs)+1}function ce(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const gt={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return ce(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):ce(r+1,2)},d(e,t){return ce(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return ce(e.getHours()%12||12,t.length)},H(e,t){return ce(e.getHours(),t.length)},m(e,t){return ce(e.getMinutes(),t.length)},s(e,t){return ce(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),o=Math.trunc(n*Math.pow(10,r-3));return ce(o,t.length)}},Yt={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ec={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return gt.y(e,t)},Y:function(e,t,r,n){const o=Zs(e,n),i=o>0?o:1-o;if(t==="YY"){const a=i%100;return ce(a,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):ce(i,t.length)},R:function(e,t){const r=Ys(e);return ce(r,t.length)},u:function(e,t){const r=e.getFullYear();return ce(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return ce(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return ce(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return gt.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return ce(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const o=Js(e,n);return t==="wo"?r.ordinalNumber(o,{unit:"week"}):ce(o,t.length)},I:function(e,t,r){const n=Qs(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):ce(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):gt.d(e,t)},D:function(e,t,r){const n=Ap(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):ce(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const o=e.getDay(),i=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return ce(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});case"eeee":default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const o=e.getDay(),i=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return ce(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});case"cccc":default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),o=n===0?7:n;switch(t){case"i":return String(o);case"ii":return ce(o,t.length);case"io":return r.ordinalNumber(o,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let o;switch(n===12?o=Yt.noon:n===0?o=Yt.midnight:o=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let o;switch(n>=17?o=Yt.evening:n>=12?o=Yt.afternoon:n>=4?o=Yt.morning:o=Yt.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return gt.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):gt.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):ce(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):ce(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):gt.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):gt.s(e,t)},S:function(e,t){return gt.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return rc(n);case"XXXX":case"XX":return Ot(n);case"XXXXX":case"XXX":default:return Ot(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return rc(n);case"xxxx":case"xx":return Ot(n);case"xxxxx":case"xxx":default:return Ot(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+tc(n,":");case"OOOO":default:return"GMT"+Ot(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+tc(n,":");case"zzzz":default:return"GMT"+Ot(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return ce(n,t.length)},T:function(e,t,r){return ce(+e,t.length)}};function tc(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=Math.trunc(n/60),i=n%60;return i===0?r+String(o):r+String(o)+t+ce(i,2)}function rc(e,t){return e%60===0?(e>0?"-":"+")+ce(Math.abs(e)/60,2):Ot(e,t)}function Ot(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=ce(Math.trunc(n/60),2),i=ce(n%60,2);return r+o+t+i}const nc=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},oc=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Dp={p:oc,P:(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],o=r[2];if(!o)return nc(e,t);let i;switch(n){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",nc(n,t)).replace("{{time}}",oc(o,t))}},Tp=/^D+$/,Fp=/^Y+$/,Ip=["D","DD","YY","YYYY"];function Wp(e){return Tp.test(e)}function jp(e){return Fp.test(e)}function Lp(e,t,r){const n=Bp(e,t,r);if(console.warn(n),Ip.includes(e))throw new RangeError(n)}function Bp(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const $p=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Rp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Vp=/^'([^]*?)'?$/,Hp=/''/g,Up=/[a-zA-Z]/;function so(e,t,r){var d,u,h,p,x,f,v,g;const n=ar(),o=(r==null?void 0:r.locale)??n.locale??ao,i=(r==null?void 0:r.firstWeekContainsDate)??((u=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(h=n.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,a=(r==null?void 0:r.weekStartsOn)??((f=(x=r==null?void 0:r.locale)==null?void 0:x.options)==null?void 0:f.weekStartsOn)??n.weekStartsOn??((g=(v=n.locale)==null?void 0:v.options)==null?void 0:g.weekStartsOn)??0,s=de(e,r==null?void 0:r.in);if(!Yh(s))throw new RangeError("Invalid time value");let c=t.match(Rp).map(y=>{const b=y[0];if(b==="p"||b==="P"){const O=Dp[b];return O(y,o.formatLong)}return y}).join("").match($p).map(y=>{if(y==="''")return{isToken:!1,value:"'"};const b=y[0];if(b==="'")return{isToken:!1,value:Yp(y)};if(ec[b])return{isToken:!0,value:y};if(b.match(Up))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:y}});o.localize.preprocessor&&(c=o.localize.preprocessor(s,c));const l={firstWeekContainsDate:i,weekStartsOn:a,locale:o};return c.map(y=>{if(!y.isToken)return y.value;const b=y.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&jp(b)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&Wp(b))&&Lp(b,t,String(e));const O=ec[b[0]];return O(s,b,o.localize,l)}).join("")}function Yp(e){const t=e.match(Vp);return t?t[1].replace(Hp,"'"):e}function zp(e,t){const r=de(e,t==null?void 0:t.in),n=r.getFullYear(),o=r.getMonth(),i=we(r,0);return i.setFullYear(n,o+1,0),i.setHours(0,0,0,0),i.getDate()}function qp(e,t){return de(e,t==null?void 0:t.in).getMonth()}function Kp(e,t){return de(e,t==null?void 0:t.in).getFullYear()}function Gp(e,t){return+de(e)>+de(t)}function Xp(e,t){return+de(e)<+de(t)}function Qp(e,t,r){const[n,o]=Ut(r==null?void 0:r.in,e,t);return n.getFullYear()===o.getFullYear()&&n.getMonth()===o.getMonth()}function Zp(e,t,r){const[n,o]=Ut(r==null?void 0:r.in,e,t);return n.getFullYear()===o.getFullYear()}function Jp(e,t,r){const n=de(e,r==null?void 0:r.in),o=n.getFullYear(),i=n.getDate(),a=we(e,0);a.setFullYear(o,t,15),a.setHours(0,0,0,0);const s=zp(a);return n.setMonth(t,Math.min(i,s)),n}function em(e,t,r){const n=de(e,r==null?void 0:r.in);return isNaN(+n)?we(e,NaN):(n.setFullYear(t),n)}const co={},dr={};function fr(e,t){try{const n=(co[e]||(co[e]=new Intl.DateTimeFormat("en-GB",{timeZone:e,hour:"numeric",timeZoneName:"longOffset"}).format))(t).split("GMT")[1]||"";return n in dr?dr[n]:ic(n,n.split(":"))}catch{if(e in dr)return dr[e];const r=e==null?void 0:e.match(tm);return r?ic(e,r.slice(1)):NaN}}const tm=/([+-]\d\d):?(\d\d)?/;function ic(e,t){const r=+t[0],n=+(t[1]||0);return dr[e]=r>0?r*60+n:r*60-n}class ze extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(fr(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),sc(this),lo(this)):this.setTime(Date.now())}static tz(t,...r){return r.length?new ze(...r,t):new ze(Date.now(),t)}withTimeZone(t){return new ze(+this,t)}getTimezoneOffset(){return-fr(this.timeZone,this)}setTime(t){return Date.prototype.setTime.apply(this,arguments),lo(this),+this}[Symbol.for("constructDateFrom")](t){return new ze(+new Date(t),this.timeZone)}}const ac=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!ac.test(e))return;const t=e.replace(ac,"$1UTC");ze.prototype[t]&&(e.startsWith("get")?ze.prototype[e]=function(){return this.internal[t]()}:(ze.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),rm(this),+this},ze.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),lo(this),+this}))});function lo(e){e.internal.setTime(+e),e.internal.setUTCMinutes(e.internal.getUTCMinutes()-e.getTimezoneOffset())}function rm(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),sc(e)}function sc(e){const t=fr(e.timeZone,e),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const n=-new Date(+e).getTimezoneOffset(),o=-new Date(+r).getTimezoneOffset(),i=n-o,a=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();i&&a&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+i);const s=n-t;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);const c=fr(e.timeZone,e),d=-new Date(+e).getTimezoneOffset()-c,u=c!==t,h=d-s;if(u&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);const p=fr(e.timeZone,e),x=c-p;x&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+x),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+x))}}class Se extends ze{static tz(t,...r){return r.length?new Se(...r,t):new Se(Date.now(),t)}toISOString(){const[t,r,n]=this.tzComponents(),o=`${t}${r}:${n}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,r,n,o]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${n} ${r} ${o}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[r,n,o]=this.tzComponents();return`${t} GMT${r}${n}${o} (${nm(this.timeZone,this)})`}toLocaleString(t,r){return Date.prototype.toLocaleString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleDateString(t,r){return Date.prototype.toLocaleDateString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleTimeString(t,r){return Date.prototype.toLocaleTimeString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),r=t>0?"-":"+",n=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),o=String(Math.abs(t)%60).padStart(2,"0");return[r,n,o]}withTimeZone(t){return new Se(+this,t)}[Symbol.for("constructDateFrom")](t){return new Se(+new Date(t),this.timeZone)}}function nm(e,t){return new Intl.DateTimeFormat("en-GB",{timeZone:e,timeZoneName:"long"}).format(t).slice(12)}var G;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(G||(G={}));var ge;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(ge||(ge={}));var We;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(We||(We={}));var Ae;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(Ae||(Ae={}));const cc=5,om=4;function im(e,t){const r=t.startOfMonth(e),n=r.getDay()>0?r.getDay():7,o=t.addDays(e,-n+1),i=t.addDays(o,cc*7-1);return t.getMonth(e)===t.getMonth(i)?cc:om}function lc(e,t){const r=t.startOfMonth(e),n=r.getDay();return n===1?r:n===0?t.addDays(r,-1*6):t.addDays(r,-1*(n-1))}function am(e,t){const r=lc(e,t),n=im(e,t);return t.addDays(r,n*7-1)}class rt{constructor(t,r){this.Date=Date,this.today=()=>{var n;return(n=this.overrides)!=null&&n.today?this.overrides.today():this.options.timeZone?Se.tz(this.options.timeZone):new this.Date},this.newDate=(n,o,i)=>{var a;return(a=this.overrides)!=null&&a.newDate?this.overrides.newDate(n,o,i):this.options.timeZone?new Se(n,o,i,this.options.timeZone):new Date(n,o,i)},this.addDays=(n,o)=>{var i;return(i=this.overrides)!=null&&i.addDays?this.overrides.addDays(n,o):Hs(n,o)},this.addMonths=(n,o)=>{var i;return(i=this.overrides)!=null&&i.addMonths?this.overrides.addMonths(n,o):Us(n,o)},this.addWeeks=(n,o)=>{var i;return(i=this.overrides)!=null&&i.addWeeks?this.overrides.addWeeks(n,o):$h(n,o)},this.addYears=(n,o)=>{var i;return(i=this.overrides)!=null&&i.addYears?this.overrides.addYears(n,o):Rh(n,o)},this.differenceInCalendarDays=(n,o)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarDays?this.overrides.differenceInCalendarDays(n,o):qs(n,o)},this.differenceInCalendarMonths=(n,o)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(n,o):zh(n,o)},this.eachMonthOfInterval=n=>{var o;return(o=this.overrides)!=null&&o.eachMonthOfInterval?this.overrides.eachMonthOfInterval(n):Gh(n)},this.endOfBroadcastWeek=n=>{var o;return(o=this.overrides)!=null&&o.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(n):am(n,this)},this.endOfISOWeek=n=>{var o;return(o=this.overrides)!=null&&o.endOfISOWeek?this.overrides.endOfISOWeek(n):Zh(n)},this.endOfMonth=n=>{var o;return(o=this.overrides)!=null&&o.endOfMonth?this.overrides.endOfMonth(n):qh(n)},this.endOfWeek=(n,o)=>{var i;return(i=this.overrides)!=null&&i.endOfWeek?this.overrides.endOfWeek(n,o):Xs(n,this.options)},this.endOfYear=n=>{var o;return(o=this.overrides)!=null&&o.endOfYear?this.overrides.endOfYear(n):Qh(n)},this.format=(n,o,i)=>{var s;const a=(s=this.overrides)!=null&&s.format?this.overrides.format(n,o,this.options):so(n,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(a):a},this.getISOWeek=n=>{var o;return(o=this.overrides)!=null&&o.getISOWeek?this.overrides.getISOWeek(n):Qs(n)},this.getMonth=(n,o)=>{var i;return(i=this.overrides)!=null&&i.getMonth?this.overrides.getMonth(n,this.options):qp(n,this.options)},this.getYear=(n,o)=>{var i;return(i=this.overrides)!=null&&i.getYear?this.overrides.getYear(n,this.options):Kp(n,this.options)},this.getWeek=(n,o)=>{var i;return(i=this.overrides)!=null&&i.getWeek?this.overrides.getWeek(n,this.options):Js(n,this.options)},this.isAfter=(n,o)=>{var i;return(i=this.overrides)!=null&&i.isAfter?this.overrides.isAfter(n,o):Gp(n,o)},this.isBefore=(n,o)=>{var i;return(i=this.overrides)!=null&&i.isBefore?this.overrides.isBefore(n,o):Xp(n,o)},this.isDate=n=>{var o;return(o=this.overrides)!=null&&o.isDate?this.overrides.isDate(n):Ks(n)},this.isSameDay=(n,o)=>{var i;return(i=this.overrides)!=null&&i.isSameDay?this.overrides.isSameDay(n,o):Uh(n,o)},this.isSameMonth=(n,o)=>{var i;return(i=this.overrides)!=null&&i.isSameMonth?this.overrides.isSameMonth(n,o):Qp(n,o)},this.isSameYear=(n,o)=>{var i;return(i=this.overrides)!=null&&i.isSameYear?this.overrides.isSameYear(n,o):Zp(n,o)},this.max=n=>{var o;return(o=this.overrides)!=null&&o.max?this.overrides.max(n):Vh(n)},this.min=n=>{var o;return(o=this.overrides)!=null&&o.min?this.overrides.min(n):Hh(n)},this.setMonth=(n,o)=>{var i;return(i=this.overrides)!=null&&i.setMonth?this.overrides.setMonth(n,o):Jp(n,o)},this.setYear=(n,o)=>{var i;return(i=this.overrides)!=null&&i.setYear?this.overrides.setYear(n,o):em(n,o)},this.startOfBroadcastWeek=(n,o)=>{var i;return(i=this.overrides)!=null&&i.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(n,this):lc(n,this)},this.startOfDay=n=>{var o;return(o=this.overrides)!=null&&o.startOfDay?this.overrides.startOfDay(n):cr(n)},this.startOfISOWeek=n=>{var o;return(o=this.overrides)!=null&&o.startOfISOWeek?this.overrides.startOfISOWeek(n):sr(n)},this.startOfMonth=n=>{var o;return(o=this.overrides)!=null&&o.startOfMonth?this.overrides.startOfMonth(n):Xh(n)},this.startOfWeek=(n,o)=>{var i;return(i=this.overrides)!=null&&i.startOfWeek?this.overrides.startOfWeek(n,this.options):Ht(n,this.options)},this.startOfYear=n=>{var o;return(o=this.overrides)!=null&&o.startOfYear?this.overrides.startOfYear(n):Gs(n)},this.options={locale:ao,...t},this.overrides=r}getDigitMap(){const{numerals:t="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:t}),n={};for(let o=0;o<10;o++)n[o.toString()]=r.format(o);return n}replaceDigits(t){const r=this.getDigitMap();return t.replace(/\d/g,n=>r[n]||n)}formatNumber(t){return this.replaceDigits(t.toString())}}const qe=new rt;class uc{constructor(t,r,n=qe){this.date=t,this.displayMonth=r,this.outside=!!(r&&!n.isSameMonth(t,r)),this.dateLib=n}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class sm{constructor(t,r){this.date=t,this.weeks=r}}class cm{constructor(t,r){this.days=r,this.weekNumber=t}}function nt(e,t,r=!1,n=qe){let{from:o,to:i}=e;const{differenceInCalendarDays:a,isSameDay:s}=n;return o&&i?(a(i,o)<0&&([o,i]=[i,o]),a(t,o)>=(r?1:0)&&a(i,t)>=(r?1:0)):!r&&i?s(i,t):!r&&o?s(o,t):!1}function dc(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function uo(e){return!!(e&&typeof e=="object"&&"from"in e)}function fc(e){return!!(e&&typeof e=="object"&&"after"in e)}function hc(e){return!!(e&&typeof e=="object"&&"before"in e)}function pc(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function mc(e,t){return Array.isArray(e)&&e.every(t.isDate)}function ot(e,t,r=qe){const n=Array.isArray(t)?t:[t],{isSameDay:o,differenceInCalendarDays:i,isAfter:a}=r;return n.some(s=>{if(typeof s=="boolean")return s;if(r.isDate(s))return o(e,s);if(mc(s,r))return s.includes(e);if(uo(s))return nt(s,e,!1,r);if(pc(s))return Array.isArray(s.dayOfWeek)?s.dayOfWeek.includes(e.getDay()):s.dayOfWeek===e.getDay();if(dc(s)){const c=i(s.before,e),l=i(s.after,e),d=c>0,u=l<0;return a(s.before,s.after)?u&&d:d||u}return fc(s)?i(e,s.after)>0:hc(s)?i(s.before,e)>0:typeof s=="function"?s(e):!1})}function lm(e,t,r){const{disabled:n,hidden:o,modifiers:i,showOutsideDays:a,broadcastCalendar:s,today:c}=t,{isSameDay:l,isSameMonth:d,startOfMonth:u,isBefore:h,endOfMonth:p,isAfter:x}=r,f=t.startMonth&&u(t.startMonth),v=t.endMonth&&p(t.endMonth),g={[ge.focused]:[],[ge.outside]:[],[ge.disabled]:[],[ge.hidden]:[],[ge.today]:[]},y={};for(const b of e){const{date:O,displayMonth:S}=b,T=!!(S&&!d(O,S)),P=!!(f&&h(O,f)),L=!!(v&&x(O,v)),H=!!(n&&ot(O,n,r)),B=!!(o&&ot(O,o,r))||P||L||!s&&!a&&T||s&&a===!1&&T,U=l(O,c??r.today());T&&g.outside.push(b),H&&g.disabled.push(b),B&&g.hidden.push(b),U&&g.today.push(b),i&&Object.keys(i).forEach($=>{const K=i==null?void 0:i[$];K&&ot(O,K,r)&&(y[$]?y[$].push(b):y[$]=[b])})}return b=>{const O={[ge.focused]:!1,[ge.disabled]:!1,[ge.hidden]:!1,[ge.outside]:!1,[ge.today]:!1},S={};for(const T in g){const P=g[T];O[T]=P.some(L=>L===b)}for(const T in y)S[T]=y[T].some(P=>P===b);return{...O,...S}}}function um(e,t,r={}){return Object.entries(e).filter(([,o])=>o===!0).reduce((o,[i])=>(r[i]?o.push(r[i]):t[ge[i]]?o.push(t[ge[i]]):t[We[i]]&&o.push(t[We[i]]),o),[t[G.Day]])}function dm(e){return D.createElement("button",{...e})}function fm(e){return D.createElement("span",{...e})}function hm(e){const{size:t=24,orientation:r="left",className:n}=e;return D.createElement("svg",{className:n,width:t,height:t,viewBox:"0 0 24 24"},r==="up"&&D.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&D.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&D.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&D.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function pm(e){const{day:t,modifiers:r,...n}=e;return D.createElement("td",{...n})}function mm(e){const{day:t,modifiers:r,...n}=e,o=D.useRef(null);return D.useEffect(()=>{var i;r.focused&&((i=o.current)==null||i.focus())},[r.focused]),D.createElement("button",{ref:o,...n})}function gm(e){const{options:t,className:r,components:n,classNames:o,...i}=e,a=[o[G.Dropdown],r].join(" "),s=t==null?void 0:t.find(({value:c})=>c===i.value);return D.createElement("span",{"data-disabled":i.disabled,className:o[G.DropdownRoot]},D.createElement(n.Select,{className:a,...i},t==null?void 0:t.map(({value:c,label:l,disabled:d})=>D.createElement(n.Option,{key:c,value:c,disabled:d},l))),D.createElement("span",{className:o[G.CaptionLabel],"aria-hidden":!0},s==null?void 0:s.label,D.createElement(n.Chevron,{orientation:"down",size:18,className:o[G.Chevron]})))}function vm(e){return D.createElement("div",{...e})}function ym(e){return D.createElement("div",{...e})}function bm(e){const{calendarMonth:t,displayIndex:r,...n}=e;return D.createElement("div",{...n},e.children)}function wm(e){const{calendarMonth:t,displayIndex:r,...n}=e;return D.createElement("div",{...n})}function xm(e){return D.createElement("table",{...e})}function Em(e){return D.createElement("div",{...e})}const gc=D.createContext(void 0);function hr(){const e=D.useContext(gc);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Cm(e){const{components:t}=hr();return D.createElement(t.Dropdown,{...e})}function Sm(e){const{onPreviousClick:t,onNextClick:r,previousMonth:n,nextMonth:o,...i}=e,{components:a,classNames:s,labels:{labelPrevious:c,labelNext:l}}=hr(),d=D.useCallback(h=>{o&&(r==null||r(h))},[o,r]),u=D.useCallback(h=>{n&&(t==null||t(h))},[n,t]);return D.createElement("nav",{...i},D.createElement(a.PreviousMonthButton,{type:"button",className:s[G.PreviousMonthButton],tabIndex:n?void 0:-1,"aria-disabled":n?void 0:!0,"aria-label":c(n),onClick:u},D.createElement(a.Chevron,{disabled:n?void 0:!0,className:s[G.Chevron],orientation:"left"})),D.createElement(a.NextMonthButton,{type:"button",className:s[G.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":l(o),onClick:d},D.createElement(a.Chevron,{disabled:o?void 0:!0,orientation:"right",className:s[G.Chevron]})))}function Om(e){const{components:t}=hr();return D.createElement(t.Button,{...e})}function _m(e){return D.createElement("option",{...e})}function km(e){const{components:t}=hr();return D.createElement(t.Button,{...e})}function Pm(e){const{rootRef:t,...r}=e;return D.createElement("div",{...r,ref:t})}function Mm(e){return D.createElement("select",{...e})}function Am(e){const{week:t,...r}=e;return D.createElement("tr",{...r})}function Nm(e){return D.createElement("th",{...e})}function Dm(e){return D.createElement("thead",{"aria-hidden":!0},D.createElement("tr",{...e}))}function Tm(e){const{week:t,...r}=e;return D.createElement("th",{...r})}function Fm(e){return D.createElement("th",{...e})}function Im(e){return D.createElement("tbody",{...e})}function Wm(e){const{components:t}=hr();return D.createElement(t.Dropdown,{...e})}const jm=Object.freeze(Object.defineProperty({__proto__:null,Button:dm,CaptionLabel:fm,Chevron:hm,Day:pm,DayButton:mm,Dropdown:gm,DropdownNav:vm,Footer:ym,Month:bm,MonthCaption:wm,MonthGrid:xm,Months:Em,MonthsDropdown:Cm,Nav:Sm,NextMonthButton:Om,Option:_m,PreviousMonthButton:km,Root:Pm,Select:Mm,Week:Am,WeekNumber:Tm,WeekNumberHeader:Fm,Weekday:Nm,Weekdays:Dm,Weeks:Im,YearsDropdown:Wm},Symbol.toStringTag,{value:"Module"}));function Lm(e){return{...jm,...e}}function Bm(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([r,n])=>{r.startsWith("data-")&&(t[r]=n)}),t}function $m(){const e={};for(const t in G)e[G[t]]=`rdp-${G[t]}`;for(const t in ge)e[ge[t]]=`rdp-${ge[t]}`;for(const t in We)e[We[t]]=`rdp-${We[t]}`;for(const t in Ae)e[Ae[t]]=`rdp-${Ae[t]}`;return e}function vc(e,t,r){return(r??new rt(t)).format(e,"LLLL y")}const Rm=vc;function Vm(e,t,r){return(r??new rt(t)).format(e,"d")}function Hm(e,t=qe){return t.format(e,"LLLL")}function Um(e,t=qe){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function Ym(){return""}function zm(e,t,r){return(r??new rt(t)).format(e,"cccccc")}function yc(e,t=qe){return t.format(e,"yyyy")}const qm=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:vc,formatDay:Vm,formatMonthCaption:Rm,formatMonthDropdown:Hm,formatWeekNumber:Um,formatWeekNumberHeader:Ym,formatWeekdayName:zm,formatYearCaption:yc,formatYearDropdown:yc},Symbol.toStringTag,{value:"Module"}));function Km(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...qm,...e}}function Gm(e,t,r,n,o){const{startOfMonth:i,startOfYear:a,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=o;return c({start:a(e),end:s(e)}).map(h=>{const p=n.formatMonthDropdown(h,o),x=l(h),f=t&&h<i(t)||r&&h>i(r)||!1;return{value:x,label:p,disabled:f}})}function Xm(e,t={},r={}){let n={...t==null?void 0:t[G.Day]};return Object.entries(e).filter(([,o])=>o===!0).forEach(([o])=>{n={...n,...r==null?void 0:r[o]}}),n}function Qm(e,t,r){const n=e.today(),o=t?e.startOfISOWeek(n):e.startOfWeek(n),i=[];for(let a=0;a<7;a++){const s=e.addDays(o,a);i.push(s)}return i}function Zm(e,t,r,n){if(!e||!t)return;const{startOfYear:o,endOfYear:i,addYears:a,getYear:s,isBefore:c,isSameYear:l}=n,d=o(e),u=i(t),h=[];let p=d;for(;c(p,u)||l(p,u);)h.push(p),p=a(p,1);return h.map(x=>{const f=r.formatYearDropdown(x,n);return{value:s(x),label:f,disabled:!1}})}function bc(e,t,r){return(r??new rt(t)).format(e,"LLLL y")}const Jm=bc;function eg(e,t,r,n){let o=(n??new rt(r)).format(e,"PPPP");return t!=null&&t.today&&(o=`Today, ${o}`),o}function wc(e,t,r,n){let o=(n??new rt(r)).format(e,"PPPP");return t.today&&(o=`Today, ${o}`),t.selected&&(o=`${o}, selected`),o}const tg=wc;function rg(){return""}function ng(e){return"Choose the Month"}function og(e){return"Go to the Next Month"}function ig(e){return"Go to the Previous Month"}function ag(e,t,r){return(r??new rt(t)).format(e,"cccc")}function sg(e,t){return`Week ${e}`}function cg(e){return"Week Number"}function lg(e){return"Choose the Year"}const ug=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:Jm,labelDay:tg,labelDayButton:wc,labelGrid:bc,labelGridcell:eg,labelMonthDropdown:ng,labelNav:rg,labelNext:og,labelPrevious:ig,labelWeekNumber:sg,labelWeekNumberHeader:cg,labelWeekday:ag,labelYearDropdown:lg},Symbol.toStringTag,{value:"Module"})),pr=e=>e instanceof HTMLElement?e:null,fo=e=>[...e.querySelectorAll("[data-animated-month]")??[]],dg=e=>pr(e.querySelector("[data-animated-month]")),ho=e=>pr(e.querySelector("[data-animated-caption]")),po=e=>pr(e.querySelector("[data-animated-weeks]")),fg=e=>pr(e.querySelector("[data-animated-nav]")),hg=e=>pr(e.querySelector("[data-animated-weekdays]"));function pg(e,t,{classNames:r,months:n,focused:o,dateLib:i}){const a=D.useRef(null),s=D.useRef(n),c=D.useRef(!1);D.useLayoutEffect(()=>{const l=s.current;if(s.current=n,!t||!e.current||!(e.current instanceof HTMLElement)||n.length===0||l.length===0||n.length!==l.length)return;const d=i.isSameMonth(n[0].date,l[0].date),u=i.isAfter(n[0].date,l[0].date),h=u?r[Ae.caption_after_enter]:r[Ae.caption_before_enter],p=u?r[Ae.weeks_after_enter]:r[Ae.weeks_before_enter],x=a.current,f=e.current.cloneNode(!0);if(f instanceof HTMLElement?(fo(f).forEach(b=>{if(!(b instanceof HTMLElement))return;const O=dg(b);O&&b.contains(O)&&b.removeChild(O);const S=ho(b);S&&S.classList.remove(h);const T=po(b);T&&T.classList.remove(p)}),a.current=f):a.current=null,c.current||d||o)return;const v=x instanceof HTMLElement?fo(x):[],g=fo(e.current);if(g&&g.every(y=>y instanceof HTMLElement)&&v&&v.every(y=>y instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const y=fg(e.current);y&&(y.style.zIndex="1"),g.forEach((b,O)=>{const S=v[O];if(!S)return;b.style.position="relative",b.style.overflow="hidden";const T=ho(b);T&&T.classList.add(h);const P=po(b);P&&P.classList.add(p);const L=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),y&&(y.style.zIndex=""),T&&T.classList.remove(h),P&&P.classList.remove(p),b.style.position="",b.style.overflow="",b.contains(S)&&b.removeChild(S)};S.style.pointerEvents="none",S.style.position="absolute",S.style.overflow="hidden",S.setAttribute("aria-hidden","true");const H=hg(S);H&&(H.style.opacity="0");const B=ho(S);B&&(B.classList.add(u?r[Ae.caption_before_exit]:r[Ae.caption_after_exit]),B.addEventListener("animationend",L));const U=po(S);U&&U.classList.add(u?r[Ae.weeks_before_exit]:r[Ae.weeks_after_exit]),b.insertBefore(S,b.firstChild)})}})}function mg(e,t,r,n){const o=e[0],i=e[e.length-1],{ISOWeek:a,fixedWeeks:s,broadcastCalendar:c}=r??{},{addDays:l,differenceInCalendarDays:d,differenceInCalendarMonths:u,endOfBroadcastWeek:h,endOfISOWeek:p,endOfMonth:x,endOfWeek:f,isAfter:v,startOfBroadcastWeek:g,startOfISOWeek:y,startOfWeek:b}=n,O=c?g(o,n):a?y(o):b(o),S=c?h(i):a?p(x(i)):f(x(i)),T=d(S,O),P=u(i,o)+1,L=[];for(let U=0;U<=T;U++){const $=l(O,U);if(t&&v($,t))break;L.push($)}const B=(c?35:42)*P;if(s&&L.length<B){const U=B-L.length;for(let $=0;$<U;$++){const K=l(L[L.length-1],1);L.push(K)}}return L}function gg(e){const t=[];return e.reduce((r,n)=>{const o=n.weeks.reduce((i,a)=>[...i,...a.days],t);return[...r,...o]},t)}function vg(e,t,r,n){const{numberOfMonths:o=1}=r,i=[];for(let a=0;a<o;a++){const s=n.addMonths(e,a);if(t&&s>t)break;i.push(s)}return i}function xc(e,t){const{month:r,defaultMonth:n,today:o=t.today(),numberOfMonths:i=1,endMonth:a,startMonth:s}=e;let c=r||n||o;const{differenceInCalendarMonths:l,addMonths:d,startOfMonth:u}=t;if(a&&l(a,c)<0){const h=-1*(i-1);c=d(a,h)}return s&&l(c,s)<0&&(c=s),u(c)}function yg(e,t,r,n){const{addDays:o,endOfBroadcastWeek:i,endOfISOWeek:a,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:d,startOfBroadcastWeek:u,startOfISOWeek:h,startOfWeek:p}=n,x=e.reduce((f,v)=>{const g=r.broadcastCalendar?u(v,n):r.ISOWeek?h(v):p(v),y=r.broadcastCalendar?i(v):r.ISOWeek?a(s(v)):c(s(v)),b=t.filter(P=>P>=g&&P<=y),O=r.broadcastCalendar?35:42;if(r.fixedWeeks&&b.length<O){const P=t.filter(L=>{const H=O-b.length;return L>y&&L<=o(y,H)});b.push(...P)}const S=b.reduce((P,L)=>{const H=r.ISOWeek?l(L):d(L),B=P.find($=>$.weekNumber===H),U=new uc(L,v,n);return B?B.days.push(U):P.push(new cm(H,[U])),P},[]),T=new sm(v,S);return f.push(T),f},[]);return r.reverseMonths?x.reverse():x}function bg(e,t){let{startMonth:r,endMonth:n}=e;const{startOfYear:o,startOfDay:i,startOfMonth:a,endOfMonth:s,addYears:c,endOfYear:l,newDate:d,today:u}=t,{fromYear:h,toYear:p,fromMonth:x,toMonth:f}=e;!r&&x&&(r=x),!r&&h&&(r=t.newDate(h,0,1)),!n&&f&&(n=f),!n&&p&&(n=d(p,11,31));const v=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return r?r=a(r):h?r=d(h,0,1):!r&&v&&(r=o(c(e.today??u(),-100))),n?n=s(n):p?n=d(p,11,31):!n&&v&&(n=l(e.today??u())),[r&&i(r),n&&i(n)]}function wg(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:i=1}=r,{startOfMonth:a,addMonths:s,differenceInCalendarMonths:c}=n,l=o?i:1,d=a(e);if(!t)return s(d,l);if(!(c(t,e)<i))return s(d,l)}function xg(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:i}=r,{startOfMonth:a,addMonths:s,differenceInCalendarMonths:c}=n,l=o?i??1:1,d=a(e);if(!t)return s(d,-l);if(!(c(d,t)<=0))return s(d,-l)}function Eg(e){const t=[];return e.reduce((r,n)=>[...r,...n.weeks],t)}function Jr(e,t){const[r,n]=D.useState(e);return[t===void 0?r:t,n]}function Cg(e,t){const[r,n]=bg(e,t),{startOfMonth:o,endOfMonth:i}=t,a=xc(e,t),[s,c]=Jr(a,e.month?a:void 0);D.useEffect(()=>{const T=xc(e,t);c(T)},[e.timeZone]);const l=vg(s,n,e,t),d=mg(l,e.endMonth?i(e.endMonth):void 0,e,t),u=yg(l,d,e,t),h=Eg(u),p=gg(u),x=xg(s,r,e,t),f=wg(s,n,e,t),{disableNavigation:v,onMonthChange:g}=e,y=T=>h.some(P=>P.days.some(L=>L.isEqualTo(T))),b=T=>{if(v)return;let P=o(T);r&&P<o(r)&&(P=o(r)),n&&P>o(n)&&(P=o(n)),c(P),g==null||g(P)};return{months:u,weeks:h,days:p,navStart:r,navEnd:n,previousMonth:x,nextMonth:f,goToMonth:b,goToDay:T=>{y(T)||b(T.date)}}}var Ke;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Ke||(Ke={}));function Ec(e){return!e[ge.disabled]&&!e[ge.hidden]&&!e[ge.outside]}function Sg(e,t,r,n){let o,i=-1;for(const a of e){const s=t(a);Ec(s)&&(s[ge.focused]&&i<Ke.FocusedModifier?(o=a,i=Ke.FocusedModifier):n!=null&&n.isEqualTo(a)&&i<Ke.LastFocused?(o=a,i=Ke.LastFocused):r(a.date)&&i<Ke.Selected?(o=a,i=Ke.Selected):s[ge.today]&&i<Ke.Today&&(o=a,i=Ke.Today))}return o||(o=e.find(a=>Ec(t(a)))),o}function Og(e,t,r,n,o,i,a){const{ISOWeek:s,broadcastCalendar:c}=i,{addDays:l,addMonths:d,addWeeks:u,addYears:h,endOfBroadcastWeek:p,endOfISOWeek:x,endOfWeek:f,max:v,min:g,startOfBroadcastWeek:y,startOfISOWeek:b,startOfWeek:O}=a;let T={day:l,week:u,month:d,year:h,startOfWeek:P=>c?y(P,a):s?b(P):O(P),endOfWeek:P=>c?p(P):s?x(P):f(P)}[e](r,t==="after"?1:-1);return t==="before"&&n?T=v([n,T]):t==="after"&&o&&(T=g([o,T])),T}function Cc(e,t,r,n,o,i,a,s=0){if(s>365)return;const c=Og(e,t,r.date,n,o,i,a),l=!!(i.disabled&&ot(c,i.disabled,a)),d=!!(i.hidden&&ot(c,i.hidden,a)),u=c,h=new uc(c,u,a);return!l&&!d?h:Cc(e,t,h,n,o,i,a,s+1)}function _g(e,t,r,n,o){const{autoFocus:i}=e,[a,s]=D.useState(),c=Sg(t.days,r,n||(()=>!1),a),[l,d]=D.useState(i?c:void 0);return{isFocusTarget:f=>!!(c!=null&&c.isEqualTo(f)),setFocused:d,focused:l,blur:()=>{s(l),d(void 0)},moveFocus:(f,v)=>{if(!l)return;const g=Cc(f,v,l,t.navStart,t.navEnd,e,o);g&&(t.goToDay(g),d(g))}}}function kg(e,t){const{selected:r,required:n,onSelect:o}=e,[i,a]=Jr(r,o?r:void 0),s=o?r:i,{isSameDay:c}=t,l=p=>(s==null?void 0:s.some(x=>c(x,p)))??!1,{min:d,max:u}=e;return{selected:s,select:(p,x,f)=>{let v=[...s??[]];if(l(p)){if((s==null?void 0:s.length)===d||n&&(s==null?void 0:s.length)===1)return;v=s==null?void 0:s.filter(g=>!c(g,p))}else(s==null?void 0:s.length)===u?v=[p]:v=[...v,p];return o||a(v),o==null||o(v,p,x,f),v},isSelected:l}}function Pg(e,t,r=0,n=0,o=!1,i=qe){const{from:a,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:d}=i;let u;if(!a&&!s)u={from:e,to:r>0?void 0:e};else if(a&&!s)c(a,e)?o?u={from:a,to:void 0}:u=void 0:d(e,a)?u={from:e,to:a}:u={from:a,to:e};else if(a&&s)if(c(a,e)&&c(s,e))o?u={from:a,to:s}:u=void 0;else if(c(a,e))u={from:a,to:r>0?void 0:e};else if(c(s,e))u={from:e,to:r>0?void 0:e};else if(d(e,a))u={from:e,to:s};else if(l(e,a))u={from:a,to:e};else if(l(e,s))u={from:a,to:e};else throw new Error("Invalid range");if(u!=null&&u.from&&(u!=null&&u.to)){const h=i.differenceInCalendarDays(u.to,u.from);n>0&&h>n?u={from:e,to:void 0}:r>1&&h<r&&(u={from:e,to:void 0})}return u}function Mg(e,t,r=qe){const n=Array.isArray(t)?t:[t];let o=e.from;const i=r.differenceInCalendarDays(e.to,e.from),a=Math.min(i,6);for(let s=0;s<=a;s++){if(n.includes(o.getDay()))return!0;o=r.addDays(o,1)}return!1}function Sc(e,t,r=qe){return nt(e,t.from,!1,r)||nt(e,t.to,!1,r)||nt(t,e.from,!1,r)||nt(t,e.to,!1,r)}function Ag(e,t,r=qe){const n=Array.isArray(t)?t:[t];if(n.filter(s=>typeof s!="function").some(s=>typeof s=="boolean"?s:r.isDate(s)?nt(e,s,!1,r):mc(s,r)?s.some(c=>nt(e,c,!1,r)):uo(s)?s.from&&s.to?Sc(e,{from:s.from,to:s.to},r):!1:pc(s)?Mg(e,s.dayOfWeek,r):dc(s)?r.isAfter(s.before,s.after)?Sc(e,{from:r.addDays(s.after,1),to:r.addDays(s.before,-1)},r):ot(e.from,s,r)||ot(e.to,s,r):fc(s)||hc(s)?ot(e.from,s,r)||ot(e.to,s,r):!1))return!0;const a=n.filter(s=>typeof s=="function");if(a.length){let s=e.from;const c=r.differenceInCalendarDays(e.to,e.from);for(let l=0;l<=c;l++){if(a.some(d=>d(s)))return!0;s=r.addDays(s,1)}}return!1}function Ng(e,t){const{disabled:r,excludeDisabled:n,selected:o,required:i,onSelect:a}=e,[s,c]=Jr(o,a?o:void 0),l=a?o:s;return{selected:l,select:(h,p,x)=>{const{min:f,max:v}=e,g=h?Pg(h,l,f,v,i,t):void 0;return n&&r&&(g!=null&&g.from)&&g.to&&Ag({from:g.from,to:g.to},r,t)&&(g.from=h,g.to=void 0),a||c(g),a==null||a(g,h,p,x),g},isSelected:h=>l&&nt(l,h,!1,t)}}function Dg(e,t){const{selected:r,required:n,onSelect:o}=e,[i,a]=Jr(r,o?r:void 0),s=o?r:i,{isSameDay:c}=t;return{selected:s,select:(u,h,p)=>{let x=u;return!n&&s&&s&&c(u,s)&&(x=void 0),o||a(x),o==null||o(x,u,h,p),x},isSelected:u=>s?c(s,u):!1}}function Tg(e,t){const r=Dg(e,t),n=kg(e,t),o=Ng(e,t);switch(e.mode){case"single":return r;case"multiple":return n;case"range":return o;default:return}}function Fg(e){var gl;let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new Se(t.today,t.timeZone)),t.month&&(t.month=new Se(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new Se(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new Se(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new Se(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new Se(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=(gl=t.selected)==null?void 0:gl.map(ne=>new Se(ne,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new Se(t.selected.from,t.timeZone):void 0,to:t.selected.to?new Se(t.selected.to,t.timeZone):void 0}));const{components:r,formatters:n,labels:o,dateLib:i,locale:a,classNames:s}=D.useMemo(()=>{const ne={...ao,...t.locale};return{dateLib:new rt({locale:ne,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:Lm(t.components),formatters:Km(t.formatters),labels:{...ug,...t.labels},locale:ne,classNames:{...$m(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:c,mode:l,navLayout:d,numberOfMonths:u=1,onDayBlur:h,onDayClick:p,onDayFocus:x,onDayKeyDown:f,onDayMouseEnter:v,onDayMouseLeave:g,onNextClick:y,onPrevClick:b,showWeekNumber:O,styles:S}=t,{formatCaption:T,formatDay:P,formatMonthDropdown:L,formatWeekNumber:H,formatWeekNumberHeader:B,formatWeekdayName:U,formatYearDropdown:$}=n,K=Cg(t,i),{days:ee,months:V,navStart:X,navEnd:Z,previousMonth:m,nextMonth:C,goToMonth:_}=K,k=lm(ee,t,i),{isSelected:M,select:F,selected:I}=Tg(t,i)??{},{blur:j,focused:W,isFocusTarget:A,moveFocus:R,setFocused:re}=_g(t,K,k,M??(()=>!1),i),{labelDayButton:q,labelGridcell:z,labelGrid:Q,labelMonthDropdown:se,labelNav:Ee,labelPrevious:Le,labelNext:Ne,labelWeekday:Be,labelWeekNumber:De,labelWeekNumberHeader:ye,labelYearDropdown:Fb}=o,Ib=D.useMemo(()=>Qm(i,t.ISOWeek),[i,t.ISOWeek]),pl=l!==void 0||p!==void 0,Bo=D.useCallback(()=>{m&&(_(m),b==null||b(m))},[m,_,b]),$o=D.useCallback(()=>{C&&(_(C),y==null||y(C))},[_,C,y]),Wb=D.useCallback((ne,me)=>he=>{he.preventDefault(),he.stopPropagation(),re(ne),F==null||F(ne.date,me,he),p==null||p(ne.date,me,he)},[F,p,re]),jb=D.useCallback((ne,me)=>he=>{re(ne),x==null||x(ne.date,me,he)},[x,re]),Lb=D.useCallback((ne,me)=>he=>{j(),h==null||h(ne.date,me,he)},[j,h]),Bb=D.useCallback((ne,me)=>he=>{const bt={ArrowLeft:["day",t.dir==="rtl"?"after":"before"],ArrowRight:["day",t.dir==="rtl"?"before":"after"],ArrowDown:["week","after"],ArrowUp:["week","before"],PageUp:[he.shiftKey?"year":"month","before"],PageDown:[he.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(bt[he.key]){he.preventDefault(),he.stopPropagation();const[$e,cn]=bt[he.key];R($e,cn)}f==null||f(ne.date,me,he)},[R,f,t.dir]),$b=D.useCallback((ne,me)=>he=>{v==null||v(ne.date,me,he)},[v]),Rb=D.useCallback((ne,me)=>he=>{g==null||g(ne.date,me,he)},[g]),Vb=D.useCallback(ne=>me=>{const he=Number(me.target.value),bt=i.setMonth(i.startOfMonth(ne),he);_(bt)},[i,_]),Hb=D.useCallback(ne=>me=>{const he=Number(me.target.value),bt=i.setYear(i.startOfMonth(ne),he);_(bt)},[i,_]),{className:Ub,style:Yb}=D.useMemo(()=>({className:[s[G.Root],t.className].filter(Boolean).join(" "),style:{...S==null?void 0:S[G.Root],...t.style}}),[s,t.className,t.style,S]),zb=Bm(t),ml=D.useRef(null);pg(ml,!!t.animate,{classNames:s,months:V,focused:W,dateLib:i});const qb={dayPickerProps:t,selected:I,select:F,isSelected:M,months:V,nextMonth:C,previousMonth:m,goToMonth:_,getModifiers:k,components:r,classNames:s,styles:S,labels:o,formatters:n};return D.createElement(gc.Provider,{value:qb},D.createElement(r.Root,{rootRef:t.animate?ml:void 0,className:Ub,style:Yb,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],...zb},D.createElement(r.Months,{className:s[G.Months],style:S==null?void 0:S[G.Months]},!t.hideNavigation&&!d&&D.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:s[G.Nav],style:S==null?void 0:S[G.Nav],"aria-label":Ee(),onPreviousClick:Bo,onNextClick:$o,previousMonth:m,nextMonth:C}),V.map((ne,me)=>{const he=Gm(ne.date,X,Z,n,i),bt=Zm(X,Z,n,i);return D.createElement(r.Month,{"data-animated-month":t.animate?"true":void 0,className:s[G.Month],style:S==null?void 0:S[G.Month],key:me,displayIndex:me,calendarMonth:ne},d==="around"&&!t.hideNavigation&&me===0&&D.createElement(r.PreviousMonthButton,{type:"button",className:s[G.PreviousMonthButton],tabIndex:m?void 0:-1,"aria-disabled":m?void 0:!0,"aria-label":Le(m),onClick:Bo,"data-animated-button":t.animate?"true":void 0},D.createElement(r.Chevron,{disabled:m?void 0:!0,className:s[G.Chevron],orientation:t.dir==="rtl"?"right":"left"})),D.createElement(r.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:s[G.MonthCaption],style:S==null?void 0:S[G.MonthCaption],calendarMonth:ne,displayIndex:me},c!=null&&c.startsWith("dropdown")?D.createElement(r.DropdownNav,{className:s[G.Dropdowns],style:S==null?void 0:S[G.Dropdowns]},c==="dropdown"||c==="dropdown-months"?D.createElement(r.MonthsDropdown,{className:s[G.MonthsDropdown],"aria-label":se(),classNames:s,components:r,disabled:!!t.disableNavigation,onChange:Vb(ne.date),options:he,style:S==null?void 0:S[G.Dropdown],value:i.getMonth(ne.date)}):D.createElement("span",null,L(ne.date,i)),c==="dropdown"||c==="dropdown-years"?D.createElement(r.YearsDropdown,{className:s[G.YearsDropdown],"aria-label":Fb(i.options),classNames:s,components:r,disabled:!!t.disableNavigation,onChange:Hb(ne.date),options:bt,style:S==null?void 0:S[G.Dropdown],value:i.getYear(ne.date)}):D.createElement("span",null,$(ne.date,i)),D.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},T(ne.date,i.options,i))):D.createElement(r.CaptionLabel,{className:s[G.CaptionLabel],role:"status","aria-live":"polite"},T(ne.date,i.options,i))),d==="around"&&!t.hideNavigation&&me===u-1&&D.createElement(r.NextMonthButton,{type:"button",className:s[G.NextMonthButton],tabIndex:C?void 0:-1,"aria-disabled":C?void 0:!0,"aria-label":Ne(C),onClick:$o,"data-animated-button":t.animate?"true":void 0},D.createElement(r.Chevron,{disabled:C?void 0:!0,className:s[G.Chevron],orientation:t.dir==="rtl"?"left":"right"})),me===u-1&&d==="after"&&!t.hideNavigation&&D.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:s[G.Nav],style:S==null?void 0:S[G.Nav],"aria-label":Ee(),onPreviousClick:Bo,onNextClick:$o,previousMonth:m,nextMonth:C}),D.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":l==="multiple"||l==="range","aria-label":Q(ne.date,i.options,i)||void 0,className:s[G.MonthGrid],style:S==null?void 0:S[G.MonthGrid]},!t.hideWeekdays&&D.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:s[G.Weekdays],style:S==null?void 0:S[G.Weekdays]},O&&D.createElement(r.WeekNumberHeader,{"aria-label":ye(i.options),className:s[G.WeekNumberHeader],style:S==null?void 0:S[G.WeekNumberHeader],scope:"col"},B()),Ib.map(($e,cn)=>D.createElement(r.Weekday,{"aria-label":Be($e,i.options,i),className:s[G.Weekday],key:cn,style:S==null?void 0:S[G.Weekday],scope:"col"},U($e,i.options,i)))),D.createElement(r.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:s[G.Weeks],style:S==null?void 0:S[G.Weeks]},ne.weeks.map(($e,cn)=>D.createElement(r.Week,{className:s[G.Week],key:$e.weekNumber,style:S==null?void 0:S[G.Week],week:$e},O&&D.createElement(r.WeekNumber,{week:$e,style:S==null?void 0:S[G.WeekNumber],"aria-label":De($e.weekNumber,{locale:a}),className:s[G.WeekNumber],scope:"row",role:"rowheader"},H($e.weekNumber,i)),$e.days.map(Oe=>{const{date:Xe}=Oe,le=k(Oe);if(le[ge.focused]=!le.hidden&&!!(W!=null&&W.isEqualTo(Oe)),le[We.selected]=(M==null?void 0:M(Xe))||le.selected,uo(I)){const{from:Ro,to:Vo}=I;le[We.range_start]=!!(Ro&&Vo&&i.isSameDay(Xe,Ro)),le[We.range_end]=!!(Ro&&Vo&&i.isSameDay(Xe,Vo)),le[We.range_middle]=nt(I,Xe,!0,i)}const Kb=Xm(le,S,t.modifiersStyles),Gb=um(le,s,t.modifiersClassNames),Xb=!pl&&!le.hidden?z(Xe,le,i.options,i):void 0;return D.createElement(r.Day,{key:`${i.format(Xe,"yyyy-MM-dd")}_${i.format(Oe.displayMonth,"yyyy-MM")}`,day:Oe,modifiers:le,className:Gb.join(" "),style:Kb,role:"gridcell","aria-selected":le.selected||void 0,"aria-label":Xb,"data-day":i.format(Xe,"yyyy-MM-dd"),"data-month":Oe.outside?i.format(Xe,"yyyy-MM"):void 0,"data-selected":le.selected||void 0,"data-disabled":le.disabled||void 0,"data-hidden":le.hidden||void 0,"data-outside":Oe.outside||void 0,"data-focused":le.focused||void 0,"data-today":le.today||void 0},!le.hidden&&pl?D.createElement(r.DayButton,{className:s[G.DayButton],style:S==null?void 0:S[G.DayButton],type:"button",day:Oe,modifiers:le,disabled:le.disabled||void 0,tabIndex:A(Oe)?0:-1,"aria-label":q(Xe,le,i.options,i),onClick:Wb(Oe,le),onBlur:Lb(Oe,le),onFocus:jb(Oe,le),onKeyDown:Bb(Oe,le),onMouseEnter:$b(Oe,le),onMouseLeave:Rb(Oe,le)},P(Xe,i.options,i)):!le.hidden&&P(Oe.date,i.options,i))}))))))})),t.footer&&D.createElement(r.Footer,{className:s[G.Footer],style:S==null?void 0:S[G.Footer],role:"status","aria-live":"polite"},t.footer)))}function Oc({className:e,classNames:t,showOutsideDays:r=!0,...n}){return w.jsx(Fg,{showOutsideDays:r,className:J("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:J(pn({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:J(pn({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{Chevron:({orientation:o})=>o==="left"?w.jsx(du,{className:"h-4 w-4"}):w.jsx(fu,{className:"h-4 w-4"})},...n})}Oc.displayName="Calendar";var en="Popover",[_c,aw]=Dt(en,[Lr]),mr=Lr(),[Ig,vt]=_c(en),kc=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=e,s=mr(t),c=E.useRef(null),[l,d]=E.useState(!1),[u,h]=tr({prop:n,defaultProp:o??!1,onChange:i,caller:en});return w.jsx(Ma,{...s,children:w.jsx(Ig,{scope:t,contentId:Pr(),triggerRef:c,open:u,onOpenChange:h,onOpenToggle:E.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:l,onCustomAnchorAdd:E.useCallback(()=>d(!0),[]),onCustomAnchorRemove:E.useCallback(()=>d(!1),[]),modal:a,children:r})})};kc.displayName=en;var Pc="PopoverAnchor",Wg=E.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=vt(Pc,r),i=mr(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return E.useEffect(()=>(a(),()=>s()),[a,s]),w.jsx(Hn,{...i,...n,ref:t})});Wg.displayName=Pc;var Mc="PopoverTrigger",Ac=E.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=vt(Mc,r),i=mr(r),a=ue(t,o.triggerRef),s=w.jsx(ie.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Ic(o.open),...n,ref:a,onClick:oe(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:w.jsx(Hn,{asChild:!0,...i,children:s})});Ac.displayName=Mc;var mo="PopoverPortal",[jg,Lg]=_c(mo,{forceMount:void 0}),Nc=e=>{const{__scopePopover:t,forceMount:r,children:n,container:o}=e,i=vt(mo,t);return w.jsx(jg,{scope:t,forceMount:r,children:w.jsx(Xr,{present:r||i.open,children:w.jsx(Un,{asChild:!0,container:o,children:n})})})};Nc.displayName=mo;var zt="PopoverContent",Dc=E.forwardRef((e,t)=>{const r=Lg(zt,e.__scopePopover),{forceMount:n=r.forceMount,...o}=e,i=vt(zt,e.__scopePopover);return w.jsx(Xr,{present:n||i.open,children:i.modal?w.jsx($g,{...o,ref:t}):w.jsx(Rg,{...o,ref:t})})});Dc.displayName=zt;var Bg=Nt("PopoverContent.RemoveScroll"),$g=E.forwardRef((e,t)=>{const r=vt(zt,e.__scopePopover),n=E.useRef(null),o=ue(t,n),i=E.useRef(!1);return E.useEffect(()=>{const a=n.current;if(a)return Fa(a)},[]),w.jsx(Xn,{as:Bg,allowPinchZoom:!0,children:w.jsx(Tc,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:oe(e.onCloseAutoFocus,a=>{var s;a.preventDefault(),i.current||(s=r.triggerRef.current)==null||s.focus()}),onPointerDownOutside:oe(e.onPointerDownOutside,a=>{const s=a.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0,l=s.button===2||c;i.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:oe(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Rg=E.forwardRef((e,t)=>{const r=vt(zt,e.__scopePopover),n=E.useRef(!1),o=E.useRef(!1);return w.jsx(Tc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,s;(a=e.onCloseAutoFocus)==null||a.call(e,i),i.defaultPrevented||(n.current||(s=r.triggerRef.current)==null||s.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{var c,l;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=i.target;((l=r.triggerRef.current)==null?void 0:l.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Tc=E.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:d,...u}=e,h=vt(zt,r),p=mr(r);return Ki(),w.jsx(Pn,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:w.jsx(Sn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),children:w.jsx(Aa,{"data-state":Ic(h.open),role:"dialog",id:h.contentId,...p,...u,ref:t,style:{...u.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)"}})})})}),Fc="PopoverClose",Vg=E.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=vt(Fc,r);return w.jsx(ie.button,{type:"button",...n,ref:t,onClick:oe(e.onClick,()=>o.onOpenChange(!1))})});Vg.displayName=Fc;var Hg="PopoverArrow",Ug=E.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=mr(r);return w.jsx(Na,{...o,...n,ref:t})});Ug.displayName=Hg;function Ic(e){return e?"open":"closed"}var Yg=kc,zg=Ac,qg=Nc,Wc=Dc;const Kg=Yg,Gg=zg,jc=E.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},o)=>w.jsx(qg,{children:w.jsx(Wc,{ref:o,align:t,sideOffset:r,className:J("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));jc.displayName=Wc.displayName;function Xg({id:e,value:t,placeholder:r,disabled:n,onChange:o,onBlur:i,onFocus:a,className:s,"aria-invalid":c}){const[l,d]=E.useState();E.useEffect(()=>{t&&d(new Date(t))},[t]);const u=h=>{d(h),h&&o&&o(so(h,"yyyy-MM-dd"))};return w.jsxs(Kg,{children:[w.jsx(Gg,{asChild:!0,children:w.jsxs(Ze,{id:e,variant:"outline",className:J("w-full justify-start text-left font-normal",!l&&"text-muted-foreground",s),disabled:n,onBlur:i,onFocus:a,"aria-invalid":c,children:[w.jsx(uu,{className:"mr-2 h-4 w-4"}),l?so(l,"PPP"):w.jsx("span",{children:r})]})}),w.jsx(jc,{className:"w-auto p-0",children:w.jsx(Oc,{mode:"single",selected:l,onSelect:u,initialFocus:!0})})]})}function Lc(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async y=>{const b=y.target.value===""?d.emptyValue:y.target.value;s(b),await p.onChange(b)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=u.length>0;return w.jsx(be,{id:t,type:"text",value:r||"",placeholder:a,required:n,disabled:o,readOnly:i,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function Bc(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async b=>{const O=b.target.value===""?d.emptyValue:b.target.value;s(O),await p.onChange(O)},f=async b=>{const O=b.target.value;c&&c(t,O),await p.onBlur(O)},v=async b=>{const O=b.target.value;l&&l(t,O),await p.onFocus(O)},g=u.length>0,y=d.rows||4;return w.jsx(Hi,{id:t,value:r||"",placeholder:a,required:n,disabled:o,readOnly:i,rows:y,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J("resize-y",g&&"border-destructive focus-visible:ring-destructive/20")})}function $c(e){const{id:t,value:r,required:n,disabled:o,onChange:i,onBlur:a,onFocus:s,options:c,rawErrors:l=[],schema:d}=e,u=ve(t,d),h=async g=>{const y=g===""?c.emptyValue:g;i(y),await u.onChange(y)},p=async()=>{a&&a(t,r),await u.onBlur(r)},x=async()=>{s&&s(t,r),await u.onFocus(r)},f=l.length>0,{enumOptions:v=[]}=c;return w.jsxs(_h,{value:r||"",onValueChange:h,disabled:o,required:n,children:[w.jsx(Ps,{id:t,"aria-invalid":f,className:J("w-full",f&&"border-destructive focus-visible:ring-destructive/20"),onBlur:p,onFocus:x,children:w.jsx(kh,{placeholder:"Select an option..."})}),w.jsx(Ns,{children:v.map(g=>w.jsx(Ds,{value:g.value,children:g.label},g.value))})]})}function Rc(e){const{id:t,value:r,disabled:n,readonly:o,onChange:i,onBlur:a,onFocus:s,label:c,rawErrors:l=[],schema:d}=e,u=ve(t,d),h=async v=>{i(v),await u.onChange(v)},p=async()=>{a&&a(t,r),await u.onBlur(r)},x=async()=>{s&&s(t,r),await u.onFocus(r)},f=l.length>0;return w.jsxs("div",{className:"flex items-start space-x-2",children:[w.jsx($s,{id:t,checked:r||!1,disabled:n||o,onCheckedChange:h,onBlur:p,onFocus:x,"aria-invalid":f,className:J("mt-0.5",f&&"border-destructive focus-visible:ring-destructive/20")}),c&&w.jsx(ke,{htmlFor:t,className:J("text-sm leading-none",n&&"opacity-50",!o&&!n&&"cursor-pointer"),children:c})]})}function Vc(e){const{id:t,value:r,disabled:n,readonly:o,onChange:i,onBlur:a,onFocus:s,options:c,rawErrors:l=[],schema:d}=e,u=ve(t,d),h=async g=>{i(g),await u.onChange(g)},p=async()=>{a&&a(t,r),await u.onBlur(r)},x=async()=>{s&&s(t,r),await u.onFocus(r)},f=l.length>0,{enumOptions:v=[]}=c;return w.jsx("div",{className:"space-y-2",children:v.map((g,y)=>w.jsxs("div",{className:"flex items-center",children:[w.jsx("input",{id:`${t}_${y}`,type:"radio",name:t,value:g.value,checked:r===g.value,disabled:n,readOnly:o,onChange:()=>h(g.value),onBlur:p,onFocus:x,className:`
|
|
101
|
+
`)},Gf=0,Rt=[];function Xf(e){var t=E.useRef([]),r=E.useRef([0,0]),n=E.useRef(),o=E.useState(Gf++)[0],i=E.useState($a)[0],a=E.useRef(e);E.useEffect(function(){a.current=e},[e]),E.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var f=vf([e.lockRef.current],(e.shards||[]).map(qa),!0).filter(Boolean);return f.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),f.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=E.useCallback(function(f,v){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!a.current.allowPinchZoom;var g=Yr(f),y=r.current,b="deltaX"in f?f.deltaX:y[0]-g[0],O="deltaY"in f?f.deltaY:y[1]-g[1],S,T=f.target,P=Math.abs(b)>Math.abs(O)?"h":"v";if("touches"in f&&P==="h"&&T.type==="range")return!1;var L=Ha(P,T);if(!L)return!0;if(L?S=P:(S=P==="v"?"h":"v",L=Ha(P,T)),!L)return!1;if(!n.current&&"changedTouches"in f&&(b||O)&&(n.current=S),!S)return!0;var $=n.current||S;return zf($,v,f,$==="h"?b:O)},[]),c=E.useCallback(function(f){var v=f;if(!(!Rt.length||Rt[Rt.length-1]!==i)){var g="deltaY"in v?za(v):Yr(v),y=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&qf(S.delta,g)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var b=(a.current.shards||[]).map(qa).filter(Boolean).filter(function(S){return S.contains(v.target)}),O=b.length>0?s(v,b[0]):!a.current.noIsolation;O&&v.cancelable&&v.preventDefault()}}},[]),l=E.useCallback(function(f,v,g,y){var b={name:f,delta:v,target:g,should:y,shadowParent:Qf(g)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(O){return O!==b})},1)},[]),d=E.useCallback(function(f){r.current=Yr(f),n.current=void 0},[]),u=E.useCallback(function(f){l(f.type,za(f),f.target,s(f,e.lockRef.current))},[]),h=E.useCallback(function(f){l(f.type,Yr(f),f.target,s(f,e.lockRef.current))},[]);E.useEffect(function(){return Rt.push(i),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,$t),document.addEventListener("touchmove",c,$t),document.addEventListener("touchstart",d,$t),function(){Rt=Rt.filter(function(f){return f!==i}),document.removeEventListener("wheel",c,$t),document.removeEventListener("touchmove",c,$t),document.removeEventListener("touchstart",d,$t)}},[]);var p=e.removeScrollBar,x=e.inert;return E.createElement(E.Fragment,null,x?E.createElement(i,{styles:Kf(o)}):null,p?E.createElement(Bf,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Qf(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Zf=_f(Ba,Xf);var Xn=E.forwardRef(function(e,t){return E.createElement(Hr,Ye({},e,{ref:t,sideCar:Zf}))});Xn.classNames=Hr.classNames;var Jf=[" ","Enter","ArrowUp","ArrowDown"],eh=[" ","Enter"],Ct="Select",[zr,qr,th]=Oi(Ct),[Vt,rw]=Dt(Ct,[th,Lr]),Kr=Lr(),[rh,ht]=Vt(Ct),[nh,oh]=Vt(Ct),Ka=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:o,onOpenChange:i,value:a,defaultValue:s,onValueChange:c,dir:l,name:d,autoComplete:u,disabled:h,required:p,form:x}=e,f=Kr(t),[v,g]=E.useState(null),[y,b]=E.useState(null),[O,S]=E.useState(!1),T=Si(l),[P,L]=tr({prop:n,defaultProp:o??!1,onChange:i,caller:Ct}),[$,B]=tr({prop:a,defaultProp:s,onChange:c,caller:Ct}),U=E.useRef(null),R=v?x||!!v.closest("form"):!0,[K,ee]=E.useState(new Set),H=Array.from(K).map(X=>X.props.value).join(";");return w.jsx(Aa,{...f,children:w.jsxs(rh,{required:p,scope:t,trigger:v,onTriggerChange:g,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:O,onValueNodeHasChildrenChange:S,contentId:Pr(),value:$,onValueChange:B,open:P,onOpenChange:L,dir:T,triggerPointerDownPosRef:U,disabled:h,children:[w.jsx(zr.Provider,{scope:t,children:w.jsx(nh,{scope:e.__scopeSelect,onNativeOptionAdd:E.useCallback(X=>{ee(Z=>new Set(Z).add(X))},[]),onNativeOptionRemove:E.useCallback(X=>{ee(Z=>{const m=new Set(Z);return m.delete(X),m})},[]),children:r})}),R?w.jsxs(ys,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:u,value:$,onChange:X=>B(X.target.value),disabled:h,form:x,children:[$===void 0?w.jsx("option",{value:""}):null,Array.from(K)]},H):null]})})};Ka.displayName=Ct;var Ga="SelectTrigger",Xa=E.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...o}=e,i=Kr(r),a=ht(Ga,r),s=a.disabled||n,c=ue(t,a.onTriggerChange),l=qr(r),d=E.useRef("touch"),[u,h,p]=ws(f=>{const v=l().filter(b=>!b.disabled),g=v.find(b=>b.value===a.value),y=xs(v,f,g);y!==void 0&&a.onValueChange(y.value)}),x=f=>{s||(a.onOpenChange(!0),p()),f&&(a.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return w.jsx(Hn,{asChild:!0,...i,children:w.jsx(ie.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":bs(a.value)?"":void 0,...o,ref:c,onClick:oe(o.onClick,f=>{f.currentTarget.focus(),d.current!=="mouse"&&x(f)}),onPointerDown:oe(o.onPointerDown,f=>{d.current=f.pointerType;const v=f.target;v.hasPointerCapture(f.pointerId)&&v.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(x(f),f.preventDefault())}),onKeyDown:oe(o.onKeyDown,f=>{const v=u.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&h(f.key),!(v&&f.key===" ")&&Jf.includes(f.key)&&(x(),f.preventDefault())})})})});Xa.displayName=Ga;var Qa="SelectValue",Za=E.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=e,c=ht(Qa,r),{onValueNodeHasChildrenChange:l}=c,d=i!==void 0,u=ue(t,c.onValueNodeChange);return Ce(()=>{l(d)},[l,d]),w.jsx(ie.span,{...s,ref:u,style:{pointerEvents:"none"},children:bs(c.value)?w.jsx(w.Fragment,{children:a}):i})});Za.displayName=Qa;var ih="SelectIcon",Ja=E.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...o}=e;return w.jsx(ie.span,{"aria-hidden":!0,...o,ref:t,children:n||"▼"})});Ja.displayName=ih;var ah="SelectPortal",es=e=>w.jsx(Un,{asChild:!0,...e});es.displayName=ah;var St="SelectContent",ts=E.forwardRef((e,t)=>{const r=ht(St,e.__scopeSelect),[n,o]=E.useState();if(Ce(()=>{o(new DocumentFragment)},[]),!r.open){const i=n;return i?Cr.createPortal(w.jsx(rs,{scope:e.__scopeSelect,children:w.jsx(zr.Slot,{scope:e.__scopeSelect,children:w.jsx("div",{children:e.children})})}),i):null}return w.jsx(ns,{...e,ref:t})});ts.displayName=St;var Ie=10,[rs,pt]=Vt(St),sh="SelectContentImpl",ch=Nt("SelectContent.RemoveScroll"),ns=E.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:c,align:l,alignOffset:d,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:x,hideWhenDetached:f,avoidCollisions:v,...g}=e,y=ht(St,r),[b,O]=E.useState(null),[S,T]=E.useState(null),P=ue(t,A=>O(A)),[L,$]=E.useState(null),[B,U]=E.useState(null),R=qr(r),[K,ee]=E.useState(!1),H=E.useRef(!1);E.useEffect(()=>{if(b)return Ia(b)},[b]),Gi();const X=E.useCallback(A=>{const[V,...re]=R().map(Q=>Q.ref.current),[q]=re.slice(-1),z=document.activeElement;for(const Q of A)if(Q===z||(Q==null||Q.scrollIntoView({block:"nearest"}),Q===V&&S&&(S.scrollTop=0),Q===q&&S&&(S.scrollTop=S.scrollHeight),Q==null||Q.focus(),document.activeElement!==z))return},[R,S]),Z=E.useCallback(()=>X([L,b]),[X,L,b]);E.useEffect(()=>{K&&Z()},[K,Z]);const{onOpenChange:m,triggerPointerDownPosRef:C}=y;E.useEffect(()=>{if(b){let A={x:0,y:0};const V=q=>{var z,Q;A={x:Math.abs(Math.round(q.pageX)-(((z=C.current)==null?void 0:z.x)??0)),y:Math.abs(Math.round(q.pageY)-(((Q=C.current)==null?void 0:Q.y)??0))}},re=q=>{A.x<=10&&A.y<=10?q.preventDefault():b.contains(q.target)||m(!1),document.removeEventListener("pointermove",V),C.current=null};return C.current!==null&&(document.addEventListener("pointermove",V),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",V),document.removeEventListener("pointerup",re,{capture:!0})}}},[b,m,C]),E.useEffect(()=>{const A=()=>m(!1);return window.addEventListener("blur",A),window.addEventListener("resize",A),()=>{window.removeEventListener("blur",A),window.removeEventListener("resize",A)}},[m]);const[_,k]=ws(A=>{const V=R().filter(z=>!z.disabled),re=V.find(z=>z.ref.current===document.activeElement),q=xs(V,A,re);q&&setTimeout(()=>q.ref.current.focus())}),M=E.useCallback((A,V,re)=>{const q=!H.current&&!re;(y.value!==void 0&&y.value===V||q)&&($(A),q&&(H.current=!0))},[y.value]),F=E.useCallback(()=>b==null?void 0:b.focus(),[b]),I=E.useCallback((A,V,re)=>{const q=!H.current&&!re;(y.value!==void 0&&y.value===V||q)&&U(A)},[y.value]),j=n==="popper"?Qn:os,W=j===Qn?{side:s,sideOffset:c,align:l,alignOffset:d,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:x,hideWhenDetached:f,avoidCollisions:v}:{};return w.jsx(rs,{scope:r,content:b,viewport:S,onViewportChange:T,itemRefCallback:M,selectedItem:L,onItemLeave:F,itemTextRefCallback:I,focusSelectedItem:Z,selectedItemText:B,position:n,isPositioned:K,searchRef:_,children:w.jsx(Xn,{as:ch,allowPinchZoom:!0,children:w.jsx(Pn,{asChild:!0,trapped:y.open,onMountAutoFocus:A=>{A.preventDefault()},onUnmountAutoFocus:oe(o,A=>{var V;(V=y.trigger)==null||V.focus({preventScroll:!0}),A.preventDefault()}),children:w.jsx(Sn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:A=>A.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:w.jsx(j,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:A=>A.preventDefault(),...g,...W,onPlaced:()=>ee(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:oe(g.onKeyDown,A=>{const V=A.ctrlKey||A.altKey||A.metaKey;if(A.key==="Tab"&&A.preventDefault(),!V&&A.key.length===1&&k(A.key),["ArrowUp","ArrowDown","Home","End"].includes(A.key)){let q=R().filter(z=>!z.disabled).map(z=>z.ref.current);if(["ArrowUp","End"].includes(A.key)&&(q=q.slice().reverse()),["ArrowUp","ArrowDown"].includes(A.key)){const z=A.target,Q=q.indexOf(z);q=q.slice(Q+1)}setTimeout(()=>X(q)),A.preventDefault()}})})})})})})});ns.displayName=sh;var lh="SelectItemAlignedPosition",os=E.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...o}=e,i=ht(St,r),a=pt(St,r),[s,c]=E.useState(null),[l,d]=E.useState(null),u=ue(t,P=>d(P)),h=qr(r),p=E.useRef(!1),x=E.useRef(!0),{viewport:f,selectedItem:v,selectedItemText:g,focusSelectedItem:y}=a,b=E.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&f&&v&&g){const P=i.trigger.getBoundingClientRect(),L=l.getBoundingClientRect(),$=i.valueNode.getBoundingClientRect(),B=g.getBoundingClientRect();if(i.dir!=="rtl"){const z=B.left-L.left,Q=$.left-z,se=P.left-Q,Ee=P.width+se,Le=Math.max(Ee,L.width),Ne=window.innerWidth-Ie,Be=_r(Q,[Ie,Math.max(Ie,Ne-Le)]);s.style.minWidth=Ee+"px",s.style.left=Be+"px"}else{const z=L.right-B.right,Q=window.innerWidth-$.right-z,se=window.innerWidth-P.right-Q,Ee=P.width+se,Le=Math.max(Ee,L.width),Ne=window.innerWidth-Ie,Be=_r(Q,[Ie,Math.max(Ie,Ne-Le)]);s.style.minWidth=Ee+"px",s.style.right=Be+"px"}const U=h(),R=window.innerHeight-Ie*2,K=f.scrollHeight,ee=window.getComputedStyle(l),H=parseInt(ee.borderTopWidth,10),X=parseInt(ee.paddingTop,10),Z=parseInt(ee.borderBottomWidth,10),m=parseInt(ee.paddingBottom,10),C=H+X+K+m+Z,_=Math.min(v.offsetHeight*5,C),k=window.getComputedStyle(f),M=parseInt(k.paddingTop,10),F=parseInt(k.paddingBottom,10),I=P.top+P.height/2-Ie,j=R-I,W=v.offsetHeight/2,A=v.offsetTop+W,V=H+X+A,re=C-V;if(V<=I){const z=U.length>0&&v===U[U.length-1].ref.current;s.style.bottom="0px";const Q=l.clientHeight-f.offsetTop-f.offsetHeight,se=Math.max(j,W+(z?F:0)+Q+Z),Ee=V+se;s.style.height=Ee+"px"}else{const z=U.length>0&&v===U[0].ref.current;s.style.top="0px";const se=Math.max(I,H+f.offsetTop+(z?M:0)+W)+re;s.style.height=se+"px",f.scrollTop=V-I+f.offsetTop}s.style.margin=`${Ie}px 0`,s.style.minHeight=_+"px",s.style.maxHeight=R+"px",n==null||n(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,s,l,f,v,g,i.dir,n]);Ce(()=>b(),[b]);const[O,S]=E.useState();Ce(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]);const T=E.useCallback(P=>{P&&x.current===!0&&(b(),y==null||y(),x.current=!1)},[b,y]);return w.jsx(dh,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:w.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:O},children:w.jsx(ie.div,{...o,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});os.displayName=lh;var uh="SelectPopperPosition",Qn=E.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:o=Ie,...i}=e,a=Kr(r);return w.jsx(Na,{...a,...i,ref:t,align:n,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Qn.displayName=uh;var[dh,Zn]=Vt(St,{}),Jn="SelectViewport",is=E.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...o}=e,i=pt(Jn,r),a=Zn(Jn,r),s=ue(t,i.onViewportChange),c=E.useRef(0);return w.jsxs(w.Fragment,{children:[w.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:n}),w.jsx(zr.Slot,{scope:r,children:w.jsx(ie.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:oe(o.onScroll,l=>{const d=l.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:h}=a;if(h!=null&&h.current&&u){const p=Math.abs(c.current-d.scrollTop);if(p>0){const x=window.innerHeight-Ie*2,f=parseFloat(u.style.minHeight),v=parseFloat(u.style.height),g=Math.max(f,v);if(g<x){const y=g+p,b=Math.min(x,y),O=y-b;u.style.height=b+"px",u.style.bottom==="0px"&&(d.scrollTop=O>0?O:0,u.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});is.displayName=Jn;var as="SelectGroup",[fh,hh]=Vt(as),ph=E.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,o=Pr();return w.jsx(fh,{scope:r,id:o,children:w.jsx(ie.div,{role:"group","aria-labelledby":o,...n,ref:t})})});ph.displayName=as;var ss="SelectLabel",cs=E.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,o=hh(ss,r);return w.jsx(ie.div,{id:o.id,...n,ref:t})});cs.displayName=ss;var Gr="SelectItem",[mh,ls]=Vt(Gr),us=E.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=e,s=ht(Gr,r),c=pt(Gr,r),l=s.value===n,[d,u]=E.useState(i??""),[h,p]=E.useState(!1),x=ue(t,y=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,y,n,o)}),f=Pr(),v=E.useRef("touch"),g=()=>{o||(s.onValueChange(n),s.onOpenChange(!1))};if(n==="")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 w.jsx(mh,{scope:r,value:n,disabled:o,textId:f,isSelected:l,onItemTextChange:E.useCallback(y=>{u(b=>b||((y==null?void 0:y.textContent)??"").trim())},[]),children:w.jsx(zr.ItemSlot,{scope:r,value:n,disabled:o,textValue:d,children:w.jsx(ie.div,{role:"option","aria-labelledby":f,"data-highlighted":h?"":void 0,"aria-selected":l&&h,"data-state":l?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:x,onFocus:oe(a.onFocus,()=>p(!0)),onBlur:oe(a.onBlur,()=>p(!1)),onClick:oe(a.onClick,()=>{v.current!=="mouse"&&g()}),onPointerUp:oe(a.onPointerUp,()=>{v.current==="mouse"&&g()}),onPointerDown:oe(a.onPointerDown,y=>{v.current=y.pointerType}),onPointerMove:oe(a.onPointerMove,y=>{var b;v.current=y.pointerType,o?(b=c.onItemLeave)==null||b.call(c):v.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:oe(a.onPointerLeave,y=>{var b;y.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:oe(a.onKeyDown,y=>{var O;((O=c.searchRef)==null?void 0:O.current)!==""&&y.key===" "||(eh.includes(y.key)&&g(),y.key===" "&&y.preventDefault())})})})})});us.displayName=Gr;var ir="SelectItemText",ds=E.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:o,...i}=e,a=ht(ir,r),s=pt(ir,r),c=ls(ir,r),l=oh(ir,r),[d,u]=E.useState(null),h=ue(t,g=>u(g),c.onItemTextChange,g=>{var y;return(y=s.itemTextRefCallback)==null?void 0:y.call(s,g,c.value,c.disabled)}),p=d==null?void 0:d.textContent,x=E.useMemo(()=>w.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:f,onNativeOptionRemove:v}=l;return Ce(()=>(f(x),()=>v(x)),[f,v,x]),w.jsxs(w.Fragment,{children:[w.jsx(ie.span,{id:c.textId,...i,ref:h}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Cr.createPortal(i.children,a.valueNode):null]})});ds.displayName=ir;var fs="SelectItemIndicator",hs=E.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return ls(fs,r).isSelected?w.jsx(ie.span,{"aria-hidden":!0,...n,ref:t}):null});hs.displayName=fs;var eo="SelectScrollUpButton",ps=E.forwardRef((e,t)=>{const r=pt(eo,e.__scopeSelect),n=Zn(eo,e.__scopeSelect),[o,i]=E.useState(!1),a=ue(t,n.onScrollButtonChange);return Ce(()=>{if(r.viewport&&r.isPositioned){let s=function(){const l=c.scrollTop>0;i(l)};const c=r.viewport;return s(),c.addEventListener("scroll",s),()=>c.removeEventListener("scroll",s)}},[r.viewport,r.isPositioned]),o?w.jsx(gs,{...e,ref:a,onAutoScroll:()=>{const{viewport:s,selectedItem:c}=r;s&&c&&(s.scrollTop=s.scrollTop-c.offsetHeight)}}):null});ps.displayName=eo;var to="SelectScrollDownButton",ms=E.forwardRef((e,t)=>{const r=pt(to,e.__scopeSelect),n=Zn(to,e.__scopeSelect),[o,i]=E.useState(!1),a=ue(t,n.onScrollButtonChange);return Ce(()=>{if(r.viewport&&r.isPositioned){let s=function(){const l=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<l;i(d)};const c=r.viewport;return s(),c.addEventListener("scroll",s),()=>c.removeEventListener("scroll",s)}},[r.viewport,r.isPositioned]),o?w.jsx(gs,{...e,ref:a,onAutoScroll:()=>{const{viewport:s,selectedItem:c}=r;s&&c&&(s.scrollTop=s.scrollTop+c.offsetHeight)}}):null});ms.displayName=to;var gs=E.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...o}=e,i=pt("SelectScrollButton",r),a=E.useRef(null),s=qr(r),c=E.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return E.useEffect(()=>()=>c(),[c]),Ce(()=>{var d;const l=s().find(u=>u.ref.current===document.activeElement);(d=l==null?void 0:l.ref.current)==null||d.scrollIntoView({block:"nearest"})},[s]),w.jsx(ie.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:oe(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:oe(o.onPointerMove,()=>{var l;(l=i.onItemLeave)==null||l.call(i),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:oe(o.onPointerLeave,()=>{c()})})}),gh="SelectSeparator",vs=E.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return w.jsx(ie.div,{"aria-hidden":!0,...n,ref:t})});vs.displayName=gh;var ro="SelectArrow",vh=E.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,o=Kr(r),i=ht(ro,r),a=pt(ro,r);return i.open&&a.position==="popper"?w.jsx(Da,{...o,...n,ref:t}):null});vh.displayName=ro;var yh="SelectBubbleInput",ys=E.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const o=E.useRef(null),i=ue(n,o),a=vn(t);return E.useEffect(()=>{const s=o.current;if(!s)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&d){const u=new Event("change",{bubbles:!0});d.call(s,t),s.dispatchEvent(u)}},[a,t]),w.jsx(ie.select,{...r,style:{...Ta,...r.style},ref:i,defaultValue:t})});ys.displayName=yh;function bs(e){return e===""||e===void 0}function ws(e){const t=xt(e),r=E.useRef(""),n=E.useRef(0),o=E.useCallback(a=>{const s=r.current+a;t(s),function c(l){r.current=l,window.clearTimeout(n.current),l!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(s)},[t]),i=E.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function xs(e,t,r){const o=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,i=r?e.indexOf(r):-1;let a=bh(e,Math.max(i,0));o.length===1&&(a=a.filter(l=>l!==r));const c=a.find(l=>l.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==r?c:void 0}function bh(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var wh=Ka,Es=Xa,xh=Za,Eh=Ja,Ch=es,Cs=ts,Sh=is,Ss=cs,Os=us,Oh=ds,_h=hs,_s=ps,ks=ms,Ps=vs;const kh=wh,Ph=xh,Ms=E.forwardRef(({className:e,children:t,...r},n)=>w.jsxs(Es,{ref:n,className:J("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,w.jsx(Eh,{asChild:!0,children:w.jsx(mn,{className:"h-4 w-4 opacity-50"})})]}));Ms.displayName=Es.displayName;const As=E.forwardRef(({className:e,...t},r)=>w.jsx(_s,{ref:r,className:J("flex cursor-default items-center justify-center py-1",e),...t,children:w.jsx(gi,{className:"h-4 w-4"})}));As.displayName=_s.displayName;const Ns=E.forwardRef(({className:e,...t},r)=>w.jsx(ks,{ref:r,className:J("flex cursor-default items-center justify-center py-1",e),...t,children:w.jsx(mn,{className:"h-4 w-4"})}));Ns.displayName=ks.displayName;const Ds=E.forwardRef(({className:e,children:t,position:r="popper",...n},o)=>w.jsx(Ch,{children:w.jsxs(Cs,{ref:o,className:J("relative z-50 max-h-96 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",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[w.jsx(As,{}),w.jsx(Sh,{className:J("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),w.jsx(Ns,{})]})}));Ds.displayName=Cs.displayName;const Mh=E.forwardRef(({className:e,...t},r)=>w.jsx(Ss,{ref:r,className:J("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Mh.displayName=Ss.displayName;const Ts=E.forwardRef(({className:e,children:t,...r},n)=>w.jsxs(Os,{ref:n,className:J("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[w.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(_h,{children:w.jsx(mi,{className:"h-4 w-4"})})}),w.jsx(Oh,{children:t})]}));Ts.displayName=Os.displayName;const Ah=E.forwardRef(({className:e,...t},r)=>w.jsx(Ps,{ref:r,className:J("-mx-1 my-1 h-px bg-muted",e),...t}));Ah.displayName=Ps.displayName;function Nh(e,t){return E.useReducer((r,n)=>t[r][n]??r,e)}var Xr=e=>{const{present:t,children:r}=e,n=Dh(t),o=typeof r=="function"?r({present:n.isPresent}):E.Children.only(r),i=ue(n.ref,Th(o));return typeof r=="function"||n.isPresent?E.cloneElement(o,{ref:i}):null};Xr.displayName="Presence";function Dh(e){const[t,r]=E.useState(),n=E.useRef(null),o=E.useRef(e),i=E.useRef("none"),a=e?"mounted":"unmounted",[s,c]=Nh(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const l=Qr(n.current);i.current=s==="mounted"?l:"none"},[s]),Ce(()=>{const l=n.current,d=o.current;if(d!==e){const h=i.current,p=Qr(l);e?c("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Ce(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,u=p=>{const f=Qr(n.current).includes(p.animationName);if(p.target===t&&f&&(c("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",l=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},h=p=>{p.target===t&&(i.current=Qr(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{d.clearTimeout(l),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:E.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Qr(e){return(e==null?void 0:e.animationName)||"none"}function Th(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Zr="Checkbox",[Fh,nw]=Dt(Zr),[Ih,no]=Fh(Zr);function Wh(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:o,disabled:i,form:a,name:s,onCheckedChange:c,required:l,value:d="on",internal_do_not_use_render:u}=e,[h,p]=tr({prop:r,defaultProp:o??!1,onChange:c,caller:Zr}),[x,f]=E.useState(null),[v,g]=E.useState(null),y=E.useRef(!1),b=x?!!a||!!x.closest("form"):!0,O={checked:h,disabled:i,setChecked:p,control:x,setControl:f,name:s,form:a,value:d,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:mt(o)?!1:o,isFormControl:b,bubbleInput:v,setBubbleInput:g};return w.jsx(Ih,{scope:t,...O,children:jh(u)?u(O):n})}var Fs="CheckboxTrigger",Is=E.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},o)=>{const{control:i,value:a,disabled:s,checked:c,required:l,setControl:d,setChecked:u,hasConsumerStoppedPropagationRef:h,isFormControl:p,bubbleInput:x}=no(Fs,e),f=ue(o,d),v=E.useRef(c);return E.useEffect(()=>{const g=i==null?void 0:i.form;if(g){const y=()=>u(v.current);return g.addEventListener("reset",y),()=>g.removeEventListener("reset",y)}},[i,u]),w.jsx(ie.button,{type:"button",role:"checkbox","aria-checked":mt(c)?"mixed":c,"aria-required":l,"data-state":$s(c),"data-disabled":s?"":void 0,disabled:s,value:a,...n,ref:f,onKeyDown:oe(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:oe(r,g=>{u(y=>mt(y)?!0:!y),x&&p&&(h.current=g.isPropagationStopped(),h.current||g.stopPropagation())})})});Is.displayName=Fs;var oo=E.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:c,onCheckedChange:l,form:d,...u}=e;return w.jsx(Wh,{__scopeCheckbox:r,checked:o,defaultChecked:i,disabled:s,required:a,onCheckedChange:l,name:n,form:d,value:c,internal_do_not_use_render:({isFormControl:h})=>w.jsxs(w.Fragment,{children:[w.jsx(Is,{...u,ref:t,__scopeCheckbox:r}),h&&w.jsx(Bs,{__scopeCheckbox:r})]})})});oo.displayName=Zr;var Ws="CheckboxIndicator",js=E.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...o}=e,i=no(Ws,r);return w.jsx(Xr,{present:n||mt(i.checked)||i.checked===!0,children:w.jsx(ie.span,{"data-state":$s(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});js.displayName=Ws;var Ls="CheckboxBubbleInput",Bs=E.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:a,required:s,disabled:c,name:l,value:d,form:u,bubbleInput:h,setBubbleInput:p}=no(Ls,e),x=ue(r,p),f=vn(i),v=yn(n);E.useEffect(()=>{const y=h;if(!y)return;const b=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(b,"checked").set,T=!o.current;if(f!==i&&S){const P=new Event("click",{bubbles:T});y.indeterminate=mt(i),S.call(y,mt(i)?!1:i),y.dispatchEvent(P)}},[h,f,i,o]);const g=E.useRef(mt(i)?!1:i);return w.jsx(ie.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??g.current,required:s,disabled:c,name:l,value:d,form:u,...t,tabIndex:-1,ref:x,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Bs.displayName=Ls;function jh(e){return typeof e=="function"}function mt(e){return e==="indeterminate"}function $s(e){return mt(e)?"indeterminate":e?"checked":"unchecked"}const Rs=E.forwardRef(({className:e,...t},r)=>w.jsx(oo,{ref:r,className:J("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:w.jsx(js,{className:J("flex items-center justify-center text-current"),children:w.jsx(mi,{className:"h-4 w-4"})})}));Rs.displayName=oo.displayName;const Vs=6048e5,Lh=864e5,Hs=Symbol.for("constructDateFrom");function we(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Hs in e?e[Hs](t):e instanceof Date?new e.constructor(t):new Date(t)}function de(e,t){return we(t||e,e)}function Us(e,t,r){const n=de(e,r==null?void 0:r.in);return isNaN(t)?we(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function Ys(e,t,r){const n=de(e,r==null?void 0:r.in);if(isNaN(t))return we(e,NaN);if(!t)return n;const o=n.getDate(),i=we(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const a=i.getDate();return o>=a?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}let Bh={};function ar(){return Bh}function Ht(e,t){var s,c,l,d;const r=ar(),n=(t==null?void 0:t.weekStartsOn)??((c=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(l=r.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??0,o=de(e,t==null?void 0:t.in),i=o.getDay(),a=(i<n?7:0)+i-n;return o.setDate(o.getDate()-a),o.setHours(0,0,0,0),o}function sr(e,t){return Ht(e,{...t,weekStartsOn:1})}function zs(e,t){const r=de(e,t==null?void 0:t.in),n=r.getFullYear(),o=we(r,0);o.setFullYear(n+1,0,4),o.setHours(0,0,0,0);const i=sr(o),a=we(r,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const s=sr(a);return r.getTime()>=i.getTime()?n+1:r.getTime()>=s.getTime()?n:n-1}function qs(e){const t=de(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function Ut(e,...t){const r=we.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function cr(e,t){const r=de(e,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function Ks(e,t,r){const[n,o]=Ut(r==null?void 0:r.in,e,t),i=cr(n),a=cr(o),s=+i-qs(i),c=+a-qs(a);return Math.round((s-c)/Lh)}function $h(e,t){const r=zs(e,t),n=we(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),sr(n)}function Rh(e,t,r){return Us(e,t*7,r)}function Vh(e,t,r){return Ys(e,t*12,r)}function Hh(e,t){let r,n=t==null?void 0:t.in;return e.forEach(o=>{!n&&typeof o=="object"&&(n=we.bind(null,o));const i=de(o,n);(!r||r<i||isNaN(+i))&&(r=i)}),we(n,r||NaN)}function Uh(e,t){let r,n=t==null?void 0:t.in;return e.forEach(o=>{!n&&typeof o=="object"&&(n=we.bind(null,o));const i=de(o,n);(!r||r>i||isNaN(+i))&&(r=i)}),we(n,r||NaN)}function Yh(e,t,r){const[n,o]=Ut(r==null?void 0:r.in,e,t);return+cr(n)==+cr(o)}function Gs(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function zh(e){return!(!Gs(e)&&typeof e!="number"||isNaN(+de(e)))}function qh(e,t,r){const[n,o]=Ut(r==null?void 0:r.in,e,t),i=n.getFullYear()-o.getFullYear(),a=n.getMonth()-o.getMonth();return i*12+a}function Kh(e,t){const r=de(e,t==null?void 0:t.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function Gh(e,t){const[r,n]=Ut(e,t.start,t.end);return{start:r,end:n}}function Xh(e,t){const{start:r,end:n}=Gh(t==null?void 0:t.in,e);let o=+r>+n;const i=o?+r:+n,a=o?n:r;a.setHours(0,0,0,0),a.setDate(1);let s=1;const c=[];for(;+a<=i;)c.push(we(r,a)),a.setMonth(a.getMonth()+s);return o?c.reverse():c}function Qh(e,t){const r=de(e,t==null?void 0:t.in);return r.setDate(1),r.setHours(0,0,0,0),r}function Zh(e,t){const r=de(e,t==null?void 0:t.in),n=r.getFullYear();return r.setFullYear(n+1,0,0),r.setHours(23,59,59,999),r}function Xs(e,t){const r=de(e,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function Qs(e,t){var s,c,l,d;const r=ar(),n=(t==null?void 0:t.weekStartsOn)??((c=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(l=r.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??0,o=de(e,t==null?void 0:t.in),i=o.getDay(),a=(i<n?-7:0)+6-(i-n);return o.setDate(o.getDate()+a),o.setHours(23,59,59,999),o}function Jh(e,t){return Qs(e,{...t,weekStartsOn:1})}const ep={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},tp=(e,t,r)=>{let n;const o=ep[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function io(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const rp={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},np={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},op={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ip={date:io({formats:rp,defaultWidth:"full"}),time:io({formats:np,defaultWidth:"full"}),dateTime:io({formats:op,defaultWidth:"full"})},ap={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},sp=(e,t,r,n)=>ap[e];function lr(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,s=r!=null&&r.width?String(r.width):a;o=e.formattingValues[s]||e.formattingValues[a]}else{const a=e.defaultWidth,s=r!=null&&r.width?String(r.width):e.defaultWidth;o=e.values[s]||e.values[a]}const i=e.argumentCallback?e.argumentCallback(t):t;return o[i]}}const cp={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},lp={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},up={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dp={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},fp={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},hp={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},pp={ordinalNumber:(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:lr({values:cp,defaultWidth:"wide"}),quarter:lr({values:lp,defaultWidth:"wide",argumentCallback:e=>e-1}),month:lr({values:up,defaultWidth:"wide"}),day:lr({values:dp,defaultWidth:"wide"}),dayPeriod:lr({values:fp,defaultWidth:"wide",formattingValues:hp,defaultFormattingWidth:"wide"})};function ur(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;const a=i[0],s=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?gp(s,u=>u.test(a)):mp(s,u=>u.test(a));let l;l=e.valueCallback?e.valueCallback(c):c,l=r.valueCallback?r.valueCallback(l):l;const d=t.slice(a.length);return{value:l,rest:d}}}function mp(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function gp(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function vp(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const o=n[0],i=t.match(e.parsePattern);if(!i)return null;let a=e.valueCallback?e.valueCallback(i[0]):i[0];a=r.valueCallback?r.valueCallback(a):a;const s=t.slice(o.length);return{value:a,rest:s}}}const yp=/^(\d+)(th|st|nd|rd)?/i,bp=/\d+/i,wp={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},xp={any:[/^b/i,/^(a|c)/i]},Ep={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Cp={any:[/1/i,/2/i,/3/i,/4/i]},Sp={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Op={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},_p={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},kp={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Pp={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Mp={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Ap={ordinalNumber:vp({matchPattern:yp,parsePattern:bp,valueCallback:e=>parseInt(e,10)}),era:ur({matchPatterns:wp,defaultMatchWidth:"wide",parsePatterns:xp,defaultParseWidth:"any"}),quarter:ur({matchPatterns:Ep,defaultMatchWidth:"wide",parsePatterns:Cp,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ur({matchPatterns:Sp,defaultMatchWidth:"wide",parsePatterns:Op,defaultParseWidth:"any"}),day:ur({matchPatterns:_p,defaultMatchWidth:"wide",parsePatterns:kp,defaultParseWidth:"any"}),dayPeriod:ur({matchPatterns:Pp,defaultMatchWidth:"any",parsePatterns:Mp,defaultParseWidth:"any"})},ao={code:"en-US",formatDistance:tp,formatLong:ip,formatRelative:sp,localize:pp,match:Ap,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Np(e,t){const r=de(e,t==null?void 0:t.in);return Ks(r,Xs(r))+1}function Zs(e,t){const r=de(e,t==null?void 0:t.in),n=+sr(r)-+$h(r);return Math.round(n/Vs)+1}function Js(e,t){var d,u,h,p;const r=de(e,t==null?void 0:t.in),n=r.getFullYear(),o=ar(),i=(t==null?void 0:t.firstWeekContainsDate)??((u=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??o.firstWeekContainsDate??((p=(h=o.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,a=we((t==null?void 0:t.in)||e,0);a.setFullYear(n+1,0,i),a.setHours(0,0,0,0);const s=Ht(a,t),c=we((t==null?void 0:t.in)||e,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const l=Ht(c,t);return+r>=+s?n+1:+r>=+l?n:n-1}function Dp(e,t){var s,c,l,d;const r=ar(),n=(t==null?void 0:t.firstWeekContainsDate)??((c=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(l=r.locale)==null?void 0:l.options)==null?void 0:d.firstWeekContainsDate)??1,o=Js(e,t),i=we((t==null?void 0:t.in)||e,0);return i.setFullYear(o,0,n),i.setHours(0,0,0,0),Ht(i,t)}function ec(e,t){const r=de(e,t==null?void 0:t.in),n=+Ht(r,t)-+Dp(r,t);return Math.round(n/Vs)+1}function ce(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const gt={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return ce(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):ce(r+1,2)},d(e,t){return ce(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return ce(e.getHours()%12||12,t.length)},H(e,t){return ce(e.getHours(),t.length)},m(e,t){return ce(e.getMinutes(),t.length)},s(e,t){return ce(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),o=Math.trunc(n*Math.pow(10,r-3));return ce(o,t.length)}},Yt={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},tc={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return gt.y(e,t)},Y:function(e,t,r,n){const o=Js(e,n),i=o>0?o:1-o;if(t==="YY"){const a=i%100;return ce(a,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):ce(i,t.length)},R:function(e,t){const r=zs(e);return ce(r,t.length)},u:function(e,t){const r=e.getFullYear();return ce(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return ce(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return ce(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return gt.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return ce(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const o=ec(e,n);return t==="wo"?r.ordinalNumber(o,{unit:"week"}):ce(o,t.length)},I:function(e,t,r){const n=Zs(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):ce(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):gt.d(e,t)},D:function(e,t,r){const n=Np(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):ce(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const o=e.getDay(),i=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return ce(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});case"eeee":default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const o=e.getDay(),i=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return ce(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});case"cccc":default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),o=n===0?7:n;switch(t){case"i":return String(o);case"ii":return ce(o,t.length);case"io":return r.ordinalNumber(o,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let o;switch(n===12?o=Yt.noon:n===0?o=Yt.midnight:o=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let o;switch(n>=17?o=Yt.evening:n>=12?o=Yt.afternoon:n>=4?o=Yt.morning:o=Yt.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return gt.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):gt.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):ce(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):ce(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):gt.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):gt.s(e,t)},S:function(e,t){return gt.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return nc(n);case"XXXX":case"XX":return Ot(n);case"XXXXX":case"XXX":default:return Ot(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return nc(n);case"xxxx":case"xx":return Ot(n);case"xxxxx":case"xxx":default:return Ot(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+rc(n,":");case"OOOO":default:return"GMT"+Ot(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+rc(n,":");case"zzzz":default:return"GMT"+Ot(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return ce(n,t.length)},T:function(e,t,r){return ce(+e,t.length)}};function rc(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=Math.trunc(n/60),i=n%60;return i===0?r+String(o):r+String(o)+t+ce(i,2)}function nc(e,t){return e%60===0?(e>0?"-":"+")+ce(Math.abs(e)/60,2):Ot(e,t)}function Ot(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=ce(Math.trunc(n/60),2),i=ce(n%60,2);return r+o+t+i}const oc=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},ic=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Tp={p:ic,P:(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],o=r[2];if(!o)return oc(e,t);let i;switch(n){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",oc(n,t)).replace("{{time}}",ic(o,t))}},Fp=/^D+$/,Ip=/^Y+$/,Wp=["D","DD","YY","YYYY"];function jp(e){return Fp.test(e)}function Lp(e){return Ip.test(e)}function Bp(e,t,r){const n=$p(e,t,r);if(console.warn(n),Wp.includes(e))throw new RangeError(n)}function $p(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Rp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Vp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hp=/^'([^]*?)'?$/,Up=/''/g,Yp=/[a-zA-Z]/;function so(e,t,r){var d,u,h,p,x,f,v,g;const n=ar(),o=(r==null?void 0:r.locale)??n.locale??ao,i=(r==null?void 0:r.firstWeekContainsDate)??((u=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(h=n.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,a=(r==null?void 0:r.weekStartsOn)??((f=(x=r==null?void 0:r.locale)==null?void 0:x.options)==null?void 0:f.weekStartsOn)??n.weekStartsOn??((g=(v=n.locale)==null?void 0:v.options)==null?void 0:g.weekStartsOn)??0,s=de(e,r==null?void 0:r.in);if(!zh(s))throw new RangeError("Invalid time value");let c=t.match(Vp).map(y=>{const b=y[0];if(b==="p"||b==="P"){const O=Tp[b];return O(y,o.formatLong)}return y}).join("").match(Rp).map(y=>{if(y==="''")return{isToken:!1,value:"'"};const b=y[0];if(b==="'")return{isToken:!1,value:zp(y)};if(tc[b])return{isToken:!0,value:y};if(b.match(Yp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:y}});o.localize.preprocessor&&(c=o.localize.preprocessor(s,c));const l={firstWeekContainsDate:i,weekStartsOn:a,locale:o};return c.map(y=>{if(!y.isToken)return y.value;const b=y.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&Lp(b)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&jp(b))&&Bp(b,t,String(e));const O=tc[b[0]];return O(s,b,o.localize,l)}).join("")}function zp(e){const t=e.match(Hp);return t?t[1].replace(Up,"'"):e}function qp(e,t){const r=de(e,t==null?void 0:t.in),n=r.getFullYear(),o=r.getMonth(),i=we(r,0);return i.setFullYear(n,o+1,0),i.setHours(0,0,0,0),i.getDate()}function Kp(e,t){return de(e,t==null?void 0:t.in).getMonth()}function Gp(e,t){return de(e,t==null?void 0:t.in).getFullYear()}function Xp(e,t){return+de(e)>+de(t)}function Qp(e,t){return+de(e)<+de(t)}function Zp(e,t,r){const[n,o]=Ut(r==null?void 0:r.in,e,t);return n.getFullYear()===o.getFullYear()&&n.getMonth()===o.getMonth()}function Jp(e,t,r){const[n,o]=Ut(r==null?void 0:r.in,e,t);return n.getFullYear()===o.getFullYear()}function em(e,t,r){const n=de(e,r==null?void 0:r.in),o=n.getFullYear(),i=n.getDate(),a=we(e,0);a.setFullYear(o,t,15),a.setHours(0,0,0,0);const s=qp(a);return n.setMonth(t,Math.min(i,s)),n}function tm(e,t,r){const n=de(e,r==null?void 0:r.in);return isNaN(+n)?we(e,NaN):(n.setFullYear(t),n)}const co={},dr={};function fr(e,t){try{const n=(co[e]||(co[e]=new Intl.DateTimeFormat("en-GB",{timeZone:e,hour:"numeric",timeZoneName:"longOffset"}).format))(t).split("GMT")[1]||"";return n in dr?dr[n]:ac(n,n.split(":"))}catch{if(e in dr)return dr[e];const r=e==null?void 0:e.match(rm);return r?ac(e,r.slice(1)):NaN}}const rm=/([+-]\d\d):?(\d\d)?/;function ac(e,t){const r=+t[0],n=+(t[1]||0);return dr[e]=r>0?r*60+n:r*60-n}class ze extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(fr(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),cc(this),lo(this)):this.setTime(Date.now())}static tz(t,...r){return r.length?new ze(...r,t):new ze(Date.now(),t)}withTimeZone(t){return new ze(+this,t)}getTimezoneOffset(){return-fr(this.timeZone,this)}setTime(t){return Date.prototype.setTime.apply(this,arguments),lo(this),+this}[Symbol.for("constructDateFrom")](t){return new ze(+new Date(t),this.timeZone)}}const sc=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!sc.test(e))return;const t=e.replace(sc,"$1UTC");ze.prototype[t]&&(e.startsWith("get")?ze.prototype[e]=function(){return this.internal[t]()}:(ze.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),nm(this),+this},ze.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),lo(this),+this}))});function lo(e){e.internal.setTime(+e),e.internal.setUTCMinutes(e.internal.getUTCMinutes()-e.getTimezoneOffset())}function nm(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),cc(e)}function cc(e){const t=fr(e.timeZone,e),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const n=-new Date(+e).getTimezoneOffset(),o=-new Date(+r).getTimezoneOffset(),i=n-o,a=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();i&&a&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+i);const s=n-t;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);const c=fr(e.timeZone,e),d=-new Date(+e).getTimezoneOffset()-c,u=c!==t,h=d-s;if(u&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);const p=fr(e.timeZone,e),x=c-p;x&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+x),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+x))}}class Se extends ze{static tz(t,...r){return r.length?new Se(...r,t):new Se(Date.now(),t)}toISOString(){const[t,r,n]=this.tzComponents(),o=`${t}${r}:${n}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,r,n,o]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${n} ${r} ${o}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[r,n,o]=this.tzComponents();return`${t} GMT${r}${n}${o} (${om(this.timeZone,this)})`}toLocaleString(t,r){return Date.prototype.toLocaleString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleDateString(t,r){return Date.prototype.toLocaleDateString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleTimeString(t,r){return Date.prototype.toLocaleTimeString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),r=t>0?"-":"+",n=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),o=String(Math.abs(t)%60).padStart(2,"0");return[r,n,o]}withTimeZone(t){return new Se(+this,t)}[Symbol.for("constructDateFrom")](t){return new Se(+new Date(t),this.timeZone)}}function om(e,t){return new Intl.DateTimeFormat("en-GB",{timeZone:e,timeZoneName:"long"}).format(t).slice(12)}var G;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(G||(G={}));var ge;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(ge||(ge={}));var We;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(We||(We={}));var Ae;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(Ae||(Ae={}));const lc=5,im=4;function am(e,t){const r=t.startOfMonth(e),n=r.getDay()>0?r.getDay():7,o=t.addDays(e,-n+1),i=t.addDays(o,lc*7-1);return t.getMonth(e)===t.getMonth(i)?lc:im}function uc(e,t){const r=t.startOfMonth(e),n=r.getDay();return n===1?r:n===0?t.addDays(r,-1*6):t.addDays(r,-1*(n-1))}function sm(e,t){const r=uc(e,t),n=am(e,t);return t.addDays(r,n*7-1)}class rt{constructor(t,r){this.Date=Date,this.today=()=>{var n;return(n=this.overrides)!=null&&n.today?this.overrides.today():this.options.timeZone?Se.tz(this.options.timeZone):new this.Date},this.newDate=(n,o,i)=>{var a;return(a=this.overrides)!=null&&a.newDate?this.overrides.newDate(n,o,i):this.options.timeZone?new Se(n,o,i,this.options.timeZone):new Date(n,o,i)},this.addDays=(n,o)=>{var i;return(i=this.overrides)!=null&&i.addDays?this.overrides.addDays(n,o):Us(n,o)},this.addMonths=(n,o)=>{var i;return(i=this.overrides)!=null&&i.addMonths?this.overrides.addMonths(n,o):Ys(n,o)},this.addWeeks=(n,o)=>{var i;return(i=this.overrides)!=null&&i.addWeeks?this.overrides.addWeeks(n,o):Rh(n,o)},this.addYears=(n,o)=>{var i;return(i=this.overrides)!=null&&i.addYears?this.overrides.addYears(n,o):Vh(n,o)},this.differenceInCalendarDays=(n,o)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarDays?this.overrides.differenceInCalendarDays(n,o):Ks(n,o)},this.differenceInCalendarMonths=(n,o)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(n,o):qh(n,o)},this.eachMonthOfInterval=n=>{var o;return(o=this.overrides)!=null&&o.eachMonthOfInterval?this.overrides.eachMonthOfInterval(n):Xh(n)},this.endOfBroadcastWeek=n=>{var o;return(o=this.overrides)!=null&&o.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(n):sm(n,this)},this.endOfISOWeek=n=>{var o;return(o=this.overrides)!=null&&o.endOfISOWeek?this.overrides.endOfISOWeek(n):Jh(n)},this.endOfMonth=n=>{var o;return(o=this.overrides)!=null&&o.endOfMonth?this.overrides.endOfMonth(n):Kh(n)},this.endOfWeek=(n,o)=>{var i;return(i=this.overrides)!=null&&i.endOfWeek?this.overrides.endOfWeek(n,o):Qs(n,this.options)},this.endOfYear=n=>{var o;return(o=this.overrides)!=null&&o.endOfYear?this.overrides.endOfYear(n):Zh(n)},this.format=(n,o,i)=>{var s;const a=(s=this.overrides)!=null&&s.format?this.overrides.format(n,o,this.options):so(n,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(a):a},this.getISOWeek=n=>{var o;return(o=this.overrides)!=null&&o.getISOWeek?this.overrides.getISOWeek(n):Zs(n)},this.getMonth=(n,o)=>{var i;return(i=this.overrides)!=null&&i.getMonth?this.overrides.getMonth(n,this.options):Kp(n,this.options)},this.getYear=(n,o)=>{var i;return(i=this.overrides)!=null&&i.getYear?this.overrides.getYear(n,this.options):Gp(n,this.options)},this.getWeek=(n,o)=>{var i;return(i=this.overrides)!=null&&i.getWeek?this.overrides.getWeek(n,this.options):ec(n,this.options)},this.isAfter=(n,o)=>{var i;return(i=this.overrides)!=null&&i.isAfter?this.overrides.isAfter(n,o):Xp(n,o)},this.isBefore=(n,o)=>{var i;return(i=this.overrides)!=null&&i.isBefore?this.overrides.isBefore(n,o):Qp(n,o)},this.isDate=n=>{var o;return(o=this.overrides)!=null&&o.isDate?this.overrides.isDate(n):Gs(n)},this.isSameDay=(n,o)=>{var i;return(i=this.overrides)!=null&&i.isSameDay?this.overrides.isSameDay(n,o):Yh(n,o)},this.isSameMonth=(n,o)=>{var i;return(i=this.overrides)!=null&&i.isSameMonth?this.overrides.isSameMonth(n,o):Zp(n,o)},this.isSameYear=(n,o)=>{var i;return(i=this.overrides)!=null&&i.isSameYear?this.overrides.isSameYear(n,o):Jp(n,o)},this.max=n=>{var o;return(o=this.overrides)!=null&&o.max?this.overrides.max(n):Hh(n)},this.min=n=>{var o;return(o=this.overrides)!=null&&o.min?this.overrides.min(n):Uh(n)},this.setMonth=(n,o)=>{var i;return(i=this.overrides)!=null&&i.setMonth?this.overrides.setMonth(n,o):em(n,o)},this.setYear=(n,o)=>{var i;return(i=this.overrides)!=null&&i.setYear?this.overrides.setYear(n,o):tm(n,o)},this.startOfBroadcastWeek=(n,o)=>{var i;return(i=this.overrides)!=null&&i.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(n,this):uc(n,this)},this.startOfDay=n=>{var o;return(o=this.overrides)!=null&&o.startOfDay?this.overrides.startOfDay(n):cr(n)},this.startOfISOWeek=n=>{var o;return(o=this.overrides)!=null&&o.startOfISOWeek?this.overrides.startOfISOWeek(n):sr(n)},this.startOfMonth=n=>{var o;return(o=this.overrides)!=null&&o.startOfMonth?this.overrides.startOfMonth(n):Qh(n)},this.startOfWeek=(n,o)=>{var i;return(i=this.overrides)!=null&&i.startOfWeek?this.overrides.startOfWeek(n,this.options):Ht(n,this.options)},this.startOfYear=n=>{var o;return(o=this.overrides)!=null&&o.startOfYear?this.overrides.startOfYear(n):Xs(n)},this.options={locale:ao,...t},this.overrides=r}getDigitMap(){const{numerals:t="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:t}),n={};for(let o=0;o<10;o++)n[o.toString()]=r.format(o);return n}replaceDigits(t){const r=this.getDigitMap();return t.replace(/\d/g,n=>r[n]||n)}formatNumber(t){return this.replaceDigits(t.toString())}}const qe=new rt;class dc{constructor(t,r,n=qe){this.date=t,this.displayMonth=r,this.outside=!!(r&&!n.isSameMonth(t,r)),this.dateLib=n}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class cm{constructor(t,r){this.date=t,this.weeks=r}}class lm{constructor(t,r){this.days=r,this.weekNumber=t}}function nt(e,t,r=!1,n=qe){let{from:o,to:i}=e;const{differenceInCalendarDays:a,isSameDay:s}=n;return o&&i?(a(i,o)<0&&([o,i]=[i,o]),a(t,o)>=(r?1:0)&&a(i,t)>=(r?1:0)):!r&&i?s(i,t):!r&&o?s(o,t):!1}function fc(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function uo(e){return!!(e&&typeof e=="object"&&"from"in e)}function hc(e){return!!(e&&typeof e=="object"&&"after"in e)}function pc(e){return!!(e&&typeof e=="object"&&"before"in e)}function mc(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function gc(e,t){return Array.isArray(e)&&e.every(t.isDate)}function ot(e,t,r=qe){const n=Array.isArray(t)?t:[t],{isSameDay:o,differenceInCalendarDays:i,isAfter:a}=r;return n.some(s=>{if(typeof s=="boolean")return s;if(r.isDate(s))return o(e,s);if(gc(s,r))return s.includes(e);if(uo(s))return nt(s,e,!1,r);if(mc(s))return Array.isArray(s.dayOfWeek)?s.dayOfWeek.includes(e.getDay()):s.dayOfWeek===e.getDay();if(fc(s)){const c=i(s.before,e),l=i(s.after,e),d=c>0,u=l<0;return a(s.before,s.after)?u&&d:d||u}return hc(s)?i(e,s.after)>0:pc(s)?i(s.before,e)>0:typeof s=="function"?s(e):!1})}function um(e,t,r){const{disabled:n,hidden:o,modifiers:i,showOutsideDays:a,broadcastCalendar:s,today:c}=t,{isSameDay:l,isSameMonth:d,startOfMonth:u,isBefore:h,endOfMonth:p,isAfter:x}=r,f=t.startMonth&&u(t.startMonth),v=t.endMonth&&p(t.endMonth),g={[ge.focused]:[],[ge.outside]:[],[ge.disabled]:[],[ge.hidden]:[],[ge.today]:[]},y={};for(const b of e){const{date:O,displayMonth:S}=b,T=!!(S&&!d(O,S)),P=!!(f&&h(O,f)),L=!!(v&&x(O,v)),$=!!(n&&ot(O,n,r)),B=!!(o&&ot(O,o,r))||P||L||!s&&!a&&T||s&&a===!1&&T,U=l(O,c??r.today());T&&g.outside.push(b),$&&g.disabled.push(b),B&&g.hidden.push(b),U&&g.today.push(b),i&&Object.keys(i).forEach(R=>{const K=i==null?void 0:i[R];K&&ot(O,K,r)&&(y[R]?y[R].push(b):y[R]=[b])})}return b=>{const O={[ge.focused]:!1,[ge.disabled]:!1,[ge.hidden]:!1,[ge.outside]:!1,[ge.today]:!1},S={};for(const T in g){const P=g[T];O[T]=P.some(L=>L===b)}for(const T in y)S[T]=y[T].some(P=>P===b);return{...O,...S}}}function dm(e,t,r={}){return Object.entries(e).filter(([,o])=>o===!0).reduce((o,[i])=>(r[i]?o.push(r[i]):t[ge[i]]?o.push(t[ge[i]]):t[We[i]]&&o.push(t[We[i]]),o),[t[G.Day]])}function fm(e){return D.createElement("button",{...e})}function hm(e){return D.createElement("span",{...e})}function pm(e){const{size:t=24,orientation:r="left",className:n}=e;return D.createElement("svg",{className:n,width:t,height:t,viewBox:"0 0 24 24"},r==="up"&&D.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&D.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&D.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&D.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function mm(e){const{day:t,modifiers:r,...n}=e;return D.createElement("td",{...n})}function gm(e){const{day:t,modifiers:r,...n}=e,o=D.useRef(null);return D.useEffect(()=>{var i;r.focused&&((i=o.current)==null||i.focus())},[r.focused]),D.createElement("button",{ref:o,...n})}function vm(e){const{options:t,className:r,components:n,classNames:o,...i}=e,a=[o[G.Dropdown],r].join(" "),s=t==null?void 0:t.find(({value:c})=>c===i.value);return D.createElement("span",{"data-disabled":i.disabled,className:o[G.DropdownRoot]},D.createElement(n.Select,{className:a,...i},t==null?void 0:t.map(({value:c,label:l,disabled:d})=>D.createElement(n.Option,{key:c,value:c,disabled:d},l))),D.createElement("span",{className:o[G.CaptionLabel],"aria-hidden":!0},s==null?void 0:s.label,D.createElement(n.Chevron,{orientation:"down",size:18,className:o[G.Chevron]})))}function ym(e){return D.createElement("div",{...e})}function bm(e){return D.createElement("div",{...e})}function wm(e){const{calendarMonth:t,displayIndex:r,...n}=e;return D.createElement("div",{...n},e.children)}function xm(e){const{calendarMonth:t,displayIndex:r,...n}=e;return D.createElement("div",{...n})}function Em(e){return D.createElement("table",{...e})}function Cm(e){return D.createElement("div",{...e})}const vc=D.createContext(void 0);function hr(){const e=D.useContext(vc);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Sm(e){const{components:t}=hr();return D.createElement(t.Dropdown,{...e})}function Om(e){const{onPreviousClick:t,onNextClick:r,previousMonth:n,nextMonth:o,...i}=e,{components:a,classNames:s,labels:{labelPrevious:c,labelNext:l}}=hr(),d=D.useCallback(h=>{o&&(r==null||r(h))},[o,r]),u=D.useCallback(h=>{n&&(t==null||t(h))},[n,t]);return D.createElement("nav",{...i},D.createElement(a.PreviousMonthButton,{type:"button",className:s[G.PreviousMonthButton],tabIndex:n?void 0:-1,"aria-disabled":n?void 0:!0,"aria-label":c(n),onClick:u},D.createElement(a.Chevron,{disabled:n?void 0:!0,className:s[G.Chevron],orientation:"left"})),D.createElement(a.NextMonthButton,{type:"button",className:s[G.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":l(o),onClick:d},D.createElement(a.Chevron,{disabled:o?void 0:!0,orientation:"right",className:s[G.Chevron]})))}function _m(e){const{components:t}=hr();return D.createElement(t.Button,{...e})}function km(e){return D.createElement("option",{...e})}function Pm(e){const{components:t}=hr();return D.createElement(t.Button,{...e})}function Mm(e){const{rootRef:t,...r}=e;return D.createElement("div",{...r,ref:t})}function Am(e){return D.createElement("select",{...e})}function Nm(e){const{week:t,...r}=e;return D.createElement("tr",{...r})}function Dm(e){return D.createElement("th",{...e})}function Tm(e){return D.createElement("thead",{"aria-hidden":!0},D.createElement("tr",{...e}))}function Fm(e){const{week:t,...r}=e;return D.createElement("th",{...r})}function Im(e){return D.createElement("th",{...e})}function Wm(e){return D.createElement("tbody",{...e})}function jm(e){const{components:t}=hr();return D.createElement(t.Dropdown,{...e})}const Lm=Object.freeze(Object.defineProperty({__proto__:null,Button:fm,CaptionLabel:hm,Chevron:pm,Day:mm,DayButton:gm,Dropdown:vm,DropdownNav:ym,Footer:bm,Month:wm,MonthCaption:xm,MonthGrid:Em,Months:Cm,MonthsDropdown:Sm,Nav:Om,NextMonthButton:_m,Option:km,PreviousMonthButton:Pm,Root:Mm,Select:Am,Week:Nm,WeekNumber:Fm,WeekNumberHeader:Im,Weekday:Dm,Weekdays:Tm,Weeks:Wm,YearsDropdown:jm},Symbol.toStringTag,{value:"Module"}));function Bm(e){return{...Lm,...e}}function $m(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([r,n])=>{r.startsWith("data-")&&(t[r]=n)}),t}function Rm(){const e={};for(const t in G)e[G[t]]=`rdp-${G[t]}`;for(const t in ge)e[ge[t]]=`rdp-${ge[t]}`;for(const t in We)e[We[t]]=`rdp-${We[t]}`;for(const t in Ae)e[Ae[t]]=`rdp-${Ae[t]}`;return e}function yc(e,t,r){return(r??new rt(t)).format(e,"LLLL y")}const Vm=yc;function Hm(e,t,r){return(r??new rt(t)).format(e,"d")}function Um(e,t=qe){return t.format(e,"LLLL")}function Ym(e,t=qe){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function zm(){return""}function qm(e,t,r){return(r??new rt(t)).format(e,"cccccc")}function bc(e,t=qe){return t.format(e,"yyyy")}const Km=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:yc,formatDay:Hm,formatMonthCaption:Vm,formatMonthDropdown:Um,formatWeekNumber:Ym,formatWeekNumberHeader:zm,formatWeekdayName:qm,formatYearCaption:bc,formatYearDropdown:bc},Symbol.toStringTag,{value:"Module"}));function Gm(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...Km,...e}}function Xm(e,t,r,n,o){const{startOfMonth:i,startOfYear:a,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=o;return c({start:a(e),end:s(e)}).map(h=>{const p=n.formatMonthDropdown(h,o),x=l(h),f=t&&h<i(t)||r&&h>i(r)||!1;return{value:x,label:p,disabled:f}})}function Qm(e,t={},r={}){let n={...t==null?void 0:t[G.Day]};return Object.entries(e).filter(([,o])=>o===!0).forEach(([o])=>{n={...n,...r==null?void 0:r[o]}}),n}function Zm(e,t,r){const n=e.today(),o=t?e.startOfISOWeek(n):e.startOfWeek(n),i=[];for(let a=0;a<7;a++){const s=e.addDays(o,a);i.push(s)}return i}function Jm(e,t,r,n){if(!e||!t)return;const{startOfYear:o,endOfYear:i,addYears:a,getYear:s,isBefore:c,isSameYear:l}=n,d=o(e),u=i(t),h=[];let p=d;for(;c(p,u)||l(p,u);)h.push(p),p=a(p,1);return h.map(x=>{const f=r.formatYearDropdown(x,n);return{value:s(x),label:f,disabled:!1}})}function wc(e,t,r){return(r??new rt(t)).format(e,"LLLL y")}const eg=wc;function tg(e,t,r,n){let o=(n??new rt(r)).format(e,"PPPP");return t!=null&&t.today&&(o=`Today, ${o}`),o}function xc(e,t,r,n){let o=(n??new rt(r)).format(e,"PPPP");return t.today&&(o=`Today, ${o}`),t.selected&&(o=`${o}, selected`),o}const rg=xc;function ng(){return""}function og(e){return"Choose the Month"}function ig(e){return"Go to the Next Month"}function ag(e){return"Go to the Previous Month"}function sg(e,t,r){return(r??new rt(t)).format(e,"cccc")}function cg(e,t){return`Week ${e}`}function lg(e){return"Week Number"}function ug(e){return"Choose the Year"}const dg=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:eg,labelDay:rg,labelDayButton:xc,labelGrid:wc,labelGridcell:tg,labelMonthDropdown:og,labelNav:ng,labelNext:ig,labelPrevious:ag,labelWeekNumber:cg,labelWeekNumberHeader:lg,labelWeekday:sg,labelYearDropdown:ug},Symbol.toStringTag,{value:"Module"})),pr=e=>e instanceof HTMLElement?e:null,fo=e=>[...e.querySelectorAll("[data-animated-month]")??[]],fg=e=>pr(e.querySelector("[data-animated-month]")),ho=e=>pr(e.querySelector("[data-animated-caption]")),po=e=>pr(e.querySelector("[data-animated-weeks]")),hg=e=>pr(e.querySelector("[data-animated-nav]")),pg=e=>pr(e.querySelector("[data-animated-weekdays]"));function mg(e,t,{classNames:r,months:n,focused:o,dateLib:i}){const a=D.useRef(null),s=D.useRef(n),c=D.useRef(!1);D.useLayoutEffect(()=>{const l=s.current;if(s.current=n,!t||!e.current||!(e.current instanceof HTMLElement)||n.length===0||l.length===0||n.length!==l.length)return;const d=i.isSameMonth(n[0].date,l[0].date),u=i.isAfter(n[0].date,l[0].date),h=u?r[Ae.caption_after_enter]:r[Ae.caption_before_enter],p=u?r[Ae.weeks_after_enter]:r[Ae.weeks_before_enter],x=a.current,f=e.current.cloneNode(!0);if(f instanceof HTMLElement?(fo(f).forEach(b=>{if(!(b instanceof HTMLElement))return;const O=fg(b);O&&b.contains(O)&&b.removeChild(O);const S=ho(b);S&&S.classList.remove(h);const T=po(b);T&&T.classList.remove(p)}),a.current=f):a.current=null,c.current||d||o)return;const v=x instanceof HTMLElement?fo(x):[],g=fo(e.current);if(g&&g.every(y=>y instanceof HTMLElement)&&v&&v.every(y=>y instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const y=hg(e.current);y&&(y.style.zIndex="1"),g.forEach((b,O)=>{const S=v[O];if(!S)return;b.style.position="relative",b.style.overflow="hidden";const T=ho(b);T&&T.classList.add(h);const P=po(b);P&&P.classList.add(p);const L=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),y&&(y.style.zIndex=""),T&&T.classList.remove(h),P&&P.classList.remove(p),b.style.position="",b.style.overflow="",b.contains(S)&&b.removeChild(S)};S.style.pointerEvents="none",S.style.position="absolute",S.style.overflow="hidden",S.setAttribute("aria-hidden","true");const $=pg(S);$&&($.style.opacity="0");const B=ho(S);B&&(B.classList.add(u?r[Ae.caption_before_exit]:r[Ae.caption_after_exit]),B.addEventListener("animationend",L));const U=po(S);U&&U.classList.add(u?r[Ae.weeks_before_exit]:r[Ae.weeks_after_exit]),b.insertBefore(S,b.firstChild)})}})}function gg(e,t,r,n){const o=e[0],i=e[e.length-1],{ISOWeek:a,fixedWeeks:s,broadcastCalendar:c}=r??{},{addDays:l,differenceInCalendarDays:d,differenceInCalendarMonths:u,endOfBroadcastWeek:h,endOfISOWeek:p,endOfMonth:x,endOfWeek:f,isAfter:v,startOfBroadcastWeek:g,startOfISOWeek:y,startOfWeek:b}=n,O=c?g(o,n):a?y(o):b(o),S=c?h(i):a?p(x(i)):f(x(i)),T=d(S,O),P=u(i,o)+1,L=[];for(let U=0;U<=T;U++){const R=l(O,U);if(t&&v(R,t))break;L.push(R)}const B=(c?35:42)*P;if(s&&L.length<B){const U=B-L.length;for(let R=0;R<U;R++){const K=l(L[L.length-1],1);L.push(K)}}return L}function vg(e){const t=[];return e.reduce((r,n)=>{const o=n.weeks.reduce((i,a)=>[...i,...a.days],t);return[...r,...o]},t)}function yg(e,t,r,n){const{numberOfMonths:o=1}=r,i=[];for(let a=0;a<o;a++){const s=n.addMonths(e,a);if(t&&s>t)break;i.push(s)}return i}function Ec(e,t){const{month:r,defaultMonth:n,today:o=t.today(),numberOfMonths:i=1,endMonth:a,startMonth:s}=e;let c=r||n||o;const{differenceInCalendarMonths:l,addMonths:d,startOfMonth:u}=t;if(a&&l(a,c)<0){const h=-1*(i-1);c=d(a,h)}return s&&l(c,s)<0&&(c=s),u(c)}function bg(e,t,r,n){const{addDays:o,endOfBroadcastWeek:i,endOfISOWeek:a,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:d,startOfBroadcastWeek:u,startOfISOWeek:h,startOfWeek:p}=n,x=e.reduce((f,v)=>{const g=r.broadcastCalendar?u(v,n):r.ISOWeek?h(v):p(v),y=r.broadcastCalendar?i(v):r.ISOWeek?a(s(v)):c(s(v)),b=t.filter(P=>P>=g&&P<=y),O=r.broadcastCalendar?35:42;if(r.fixedWeeks&&b.length<O){const P=t.filter(L=>{const $=O-b.length;return L>y&&L<=o(y,$)});b.push(...P)}const S=b.reduce((P,L)=>{const $=r.ISOWeek?l(L):d(L),B=P.find(R=>R.weekNumber===$),U=new dc(L,v,n);return B?B.days.push(U):P.push(new lm($,[U])),P},[]),T=new cm(v,S);return f.push(T),f},[]);return r.reverseMonths?x.reverse():x}function wg(e,t){let{startMonth:r,endMonth:n}=e;const{startOfYear:o,startOfDay:i,startOfMonth:a,endOfMonth:s,addYears:c,endOfYear:l,newDate:d,today:u}=t,{fromYear:h,toYear:p,fromMonth:x,toMonth:f}=e;!r&&x&&(r=x),!r&&h&&(r=t.newDate(h,0,1)),!n&&f&&(n=f),!n&&p&&(n=d(p,11,31));const v=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return r?r=a(r):h?r=d(h,0,1):!r&&v&&(r=o(c(e.today??u(),-100))),n?n=s(n):p?n=d(p,11,31):!n&&v&&(n=l(e.today??u())),[r&&i(r),n&&i(n)]}function xg(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:i=1}=r,{startOfMonth:a,addMonths:s,differenceInCalendarMonths:c}=n,l=o?i:1,d=a(e);if(!t)return s(d,l);if(!(c(t,e)<i))return s(d,l)}function Eg(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:i}=r,{startOfMonth:a,addMonths:s,differenceInCalendarMonths:c}=n,l=o?i??1:1,d=a(e);if(!t)return s(d,-l);if(!(c(d,t)<=0))return s(d,-l)}function Cg(e){const t=[];return e.reduce((r,n)=>[...r,...n.weeks],t)}function Jr(e,t){const[r,n]=D.useState(e);return[t===void 0?r:t,n]}function Sg(e,t){const[r,n]=wg(e,t),{startOfMonth:o,endOfMonth:i}=t,a=Ec(e,t),[s,c]=Jr(a,e.month?a:void 0);D.useEffect(()=>{const T=Ec(e,t);c(T)},[e.timeZone]);const l=yg(s,n,e,t),d=gg(l,e.endMonth?i(e.endMonth):void 0,e,t),u=bg(l,d,e,t),h=Cg(u),p=vg(u),x=Eg(s,r,e,t),f=xg(s,n,e,t),{disableNavigation:v,onMonthChange:g}=e,y=T=>h.some(P=>P.days.some(L=>L.isEqualTo(T))),b=T=>{if(v)return;let P=o(T);r&&P<o(r)&&(P=o(r)),n&&P>o(n)&&(P=o(n)),c(P),g==null||g(P)};return{months:u,weeks:h,days:p,navStart:r,navEnd:n,previousMonth:x,nextMonth:f,goToMonth:b,goToDay:T=>{y(T)||b(T.date)}}}var Ke;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Ke||(Ke={}));function Cc(e){return!e[ge.disabled]&&!e[ge.hidden]&&!e[ge.outside]}function Og(e,t,r,n){let o,i=-1;for(const a of e){const s=t(a);Cc(s)&&(s[ge.focused]&&i<Ke.FocusedModifier?(o=a,i=Ke.FocusedModifier):n!=null&&n.isEqualTo(a)&&i<Ke.LastFocused?(o=a,i=Ke.LastFocused):r(a.date)&&i<Ke.Selected?(o=a,i=Ke.Selected):s[ge.today]&&i<Ke.Today&&(o=a,i=Ke.Today))}return o||(o=e.find(a=>Cc(t(a)))),o}function _g(e,t,r,n,o,i,a){const{ISOWeek:s,broadcastCalendar:c}=i,{addDays:l,addMonths:d,addWeeks:u,addYears:h,endOfBroadcastWeek:p,endOfISOWeek:x,endOfWeek:f,max:v,min:g,startOfBroadcastWeek:y,startOfISOWeek:b,startOfWeek:O}=a;let T={day:l,week:u,month:d,year:h,startOfWeek:P=>c?y(P,a):s?b(P):O(P),endOfWeek:P=>c?p(P):s?x(P):f(P)}[e](r,t==="after"?1:-1);return t==="before"&&n?T=v([n,T]):t==="after"&&o&&(T=g([o,T])),T}function Sc(e,t,r,n,o,i,a,s=0){if(s>365)return;const c=_g(e,t,r.date,n,o,i,a),l=!!(i.disabled&&ot(c,i.disabled,a)),d=!!(i.hidden&&ot(c,i.hidden,a)),u=c,h=new dc(c,u,a);return!l&&!d?h:Sc(e,t,h,n,o,i,a,s+1)}function kg(e,t,r,n,o){const{autoFocus:i}=e,[a,s]=D.useState(),c=Og(t.days,r,n||(()=>!1),a),[l,d]=D.useState(i?c:void 0);return{isFocusTarget:f=>!!(c!=null&&c.isEqualTo(f)),setFocused:d,focused:l,blur:()=>{s(l),d(void 0)},moveFocus:(f,v)=>{if(!l)return;const g=Sc(f,v,l,t.navStart,t.navEnd,e,o);g&&(t.goToDay(g),d(g))}}}function Pg(e,t){const{selected:r,required:n,onSelect:o}=e,[i,a]=Jr(r,o?r:void 0),s=o?r:i,{isSameDay:c}=t,l=p=>(s==null?void 0:s.some(x=>c(x,p)))??!1,{min:d,max:u}=e;return{selected:s,select:(p,x,f)=>{let v=[...s??[]];if(l(p)){if((s==null?void 0:s.length)===d||n&&(s==null?void 0:s.length)===1)return;v=s==null?void 0:s.filter(g=>!c(g,p))}else(s==null?void 0:s.length)===u?v=[p]:v=[...v,p];return o||a(v),o==null||o(v,p,x,f),v},isSelected:l}}function Mg(e,t,r=0,n=0,o=!1,i=qe){const{from:a,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:d}=i;let u;if(!a&&!s)u={from:e,to:r>0?void 0:e};else if(a&&!s)c(a,e)?o?u={from:a,to:void 0}:u=void 0:d(e,a)?u={from:e,to:a}:u={from:a,to:e};else if(a&&s)if(c(a,e)&&c(s,e))o?u={from:a,to:s}:u=void 0;else if(c(a,e))u={from:a,to:r>0?void 0:e};else if(c(s,e))u={from:e,to:r>0?void 0:e};else if(d(e,a))u={from:e,to:s};else if(l(e,a))u={from:a,to:e};else if(l(e,s))u={from:a,to:e};else throw new Error("Invalid range");if(u!=null&&u.from&&(u!=null&&u.to)){const h=i.differenceInCalendarDays(u.to,u.from);n>0&&h>n?u={from:e,to:void 0}:r>1&&h<r&&(u={from:e,to:void 0})}return u}function Ag(e,t,r=qe){const n=Array.isArray(t)?t:[t];let o=e.from;const i=r.differenceInCalendarDays(e.to,e.from),a=Math.min(i,6);for(let s=0;s<=a;s++){if(n.includes(o.getDay()))return!0;o=r.addDays(o,1)}return!1}function Oc(e,t,r=qe){return nt(e,t.from,!1,r)||nt(e,t.to,!1,r)||nt(t,e.from,!1,r)||nt(t,e.to,!1,r)}function Ng(e,t,r=qe){const n=Array.isArray(t)?t:[t];if(n.filter(s=>typeof s!="function").some(s=>typeof s=="boolean"?s:r.isDate(s)?nt(e,s,!1,r):gc(s,r)?s.some(c=>nt(e,c,!1,r)):uo(s)?s.from&&s.to?Oc(e,{from:s.from,to:s.to},r):!1:mc(s)?Ag(e,s.dayOfWeek,r):fc(s)?r.isAfter(s.before,s.after)?Oc(e,{from:r.addDays(s.after,1),to:r.addDays(s.before,-1)},r):ot(e.from,s,r)||ot(e.to,s,r):hc(s)||pc(s)?ot(e.from,s,r)||ot(e.to,s,r):!1))return!0;const a=n.filter(s=>typeof s=="function");if(a.length){let s=e.from;const c=r.differenceInCalendarDays(e.to,e.from);for(let l=0;l<=c;l++){if(a.some(d=>d(s)))return!0;s=r.addDays(s,1)}}return!1}function Dg(e,t){const{disabled:r,excludeDisabled:n,selected:o,required:i,onSelect:a}=e,[s,c]=Jr(o,a?o:void 0),l=a?o:s;return{selected:l,select:(h,p,x)=>{const{min:f,max:v}=e,g=h?Mg(h,l,f,v,i,t):void 0;return n&&r&&(g!=null&&g.from)&&g.to&&Ng({from:g.from,to:g.to},r,t)&&(g.from=h,g.to=void 0),a||c(g),a==null||a(g,h,p,x),g},isSelected:h=>l&&nt(l,h,!1,t)}}function Tg(e,t){const{selected:r,required:n,onSelect:o}=e,[i,a]=Jr(r,o?r:void 0),s=o?r:i,{isSameDay:c}=t;return{selected:s,select:(u,h,p)=>{let x=u;return!n&&s&&s&&c(u,s)&&(x=void 0),o||a(x),o==null||o(x,u,h,p),x},isSelected:u=>s?c(s,u):!1}}function Fg(e,t){const r=Tg(e,t),n=Pg(e,t),o=Dg(e,t);switch(e.mode){case"single":return r;case"multiple":return n;case"range":return o;default:return}}function Ig(e){var vl;let t=e;t.timeZone&&(t={...e},t.today&&(t.today=new Se(t.today,t.timeZone)),t.month&&(t.month=new Se(t.month,t.timeZone)),t.defaultMonth&&(t.defaultMonth=new Se(t.defaultMonth,t.timeZone)),t.startMonth&&(t.startMonth=new Se(t.startMonth,t.timeZone)),t.endMonth&&(t.endMonth=new Se(t.endMonth,t.timeZone)),t.mode==="single"&&t.selected?t.selected=new Se(t.selected,t.timeZone):t.mode==="multiple"&&t.selected?t.selected=(vl=t.selected)==null?void 0:vl.map(ne=>new Se(ne,t.timeZone)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?new Se(t.selected.from,t.timeZone):void 0,to:t.selected.to?new Se(t.selected.to,t.timeZone):void 0}));const{components:r,formatters:n,labels:o,dateLib:i,locale:a,classNames:s}=D.useMemo(()=>{const ne={...ao,...t.locale};return{dateLib:new rt({locale:ne,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib),components:Bm(t.components),formatters:Gm(t.formatters),labels:{...dg,...t.labels},locale:ne,classNames:{...Rm(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]),{captionLayout:c,mode:l,navLayout:d,numberOfMonths:u=1,onDayBlur:h,onDayClick:p,onDayFocus:x,onDayKeyDown:f,onDayMouseEnter:v,onDayMouseLeave:g,onNextClick:y,onPrevClick:b,showWeekNumber:O,styles:S}=t,{formatCaption:T,formatDay:P,formatMonthDropdown:L,formatWeekNumber:$,formatWeekNumberHeader:B,formatWeekdayName:U,formatYearDropdown:R}=n,K=Sg(t,i),{days:ee,months:H,navStart:X,navEnd:Z,previousMonth:m,nextMonth:C,goToMonth:_}=K,k=um(ee,t,i),{isSelected:M,select:F,selected:I}=Fg(t,i)??{},{blur:j,focused:W,isFocusTarget:A,moveFocus:V,setFocused:re}=kg(t,K,k,M??(()=>!1),i),{labelDayButton:q,labelGridcell:z,labelGrid:Q,labelMonthDropdown:se,labelNav:Ee,labelPrevious:Le,labelNext:Ne,labelWeekday:Be,labelWeekNumber:De,labelWeekNumberHeader:ye,labelYearDropdown:Ib}=o,Wb=D.useMemo(()=>Zm(i,t.ISOWeek),[i,t.ISOWeek]),ml=l!==void 0||p!==void 0,$o=D.useCallback(()=>{m&&(_(m),b==null||b(m))},[m,_,b]),Ro=D.useCallback(()=>{C&&(_(C),y==null||y(C))},[_,C,y]),jb=D.useCallback((ne,me)=>he=>{he.preventDefault(),he.stopPropagation(),re(ne),F==null||F(ne.date,me,he),p==null||p(ne.date,me,he)},[F,p,re]),Lb=D.useCallback((ne,me)=>he=>{re(ne),x==null||x(ne.date,me,he)},[x,re]),Bb=D.useCallback((ne,me)=>he=>{j(),h==null||h(ne.date,me,he)},[j,h]),$b=D.useCallback((ne,me)=>he=>{const bt={ArrowLeft:["day",t.dir==="rtl"?"after":"before"],ArrowRight:["day",t.dir==="rtl"?"before":"after"],ArrowDown:["week","after"],ArrowUp:["week","before"],PageUp:[he.shiftKey?"year":"month","before"],PageDown:[he.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(bt[he.key]){he.preventDefault(),he.stopPropagation();const[$e,cn]=bt[he.key];V($e,cn)}f==null||f(ne.date,me,he)},[V,f,t.dir]),Rb=D.useCallback((ne,me)=>he=>{v==null||v(ne.date,me,he)},[v]),Vb=D.useCallback((ne,me)=>he=>{g==null||g(ne.date,me,he)},[g]),Hb=D.useCallback(ne=>me=>{const he=Number(me.target.value),bt=i.setMonth(i.startOfMonth(ne),he);_(bt)},[i,_]),Ub=D.useCallback(ne=>me=>{const he=Number(me.target.value),bt=i.setYear(i.startOfMonth(ne),he);_(bt)},[i,_]),{className:Yb,style:zb}=D.useMemo(()=>({className:[s[G.Root],t.className].filter(Boolean).join(" "),style:{...S==null?void 0:S[G.Root],...t.style}}),[s,t.className,t.style,S]),qb=$m(t),gl=D.useRef(null);mg(gl,!!t.animate,{classNames:s,months:H,focused:W,dateLib:i});const Kb={dayPickerProps:t,selected:I,select:F,isSelected:M,months:H,nextMonth:C,previousMonth:m,goToMonth:_,getModifiers:k,components:r,classNames:s,styles:S,labels:o,formatters:n};return D.createElement(vc.Provider,{value:Kb},D.createElement(r.Root,{rootRef:t.animate?gl:void 0,className:Yb,style:zb,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],...qb},D.createElement(r.Months,{className:s[G.Months],style:S==null?void 0:S[G.Months]},!t.hideNavigation&&!d&&D.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:s[G.Nav],style:S==null?void 0:S[G.Nav],"aria-label":Ee(),onPreviousClick:$o,onNextClick:Ro,previousMonth:m,nextMonth:C}),H.map((ne,me)=>{const he=Xm(ne.date,X,Z,n,i),bt=Jm(X,Z,n,i);return D.createElement(r.Month,{"data-animated-month":t.animate?"true":void 0,className:s[G.Month],style:S==null?void 0:S[G.Month],key:me,displayIndex:me,calendarMonth:ne},d==="around"&&!t.hideNavigation&&me===0&&D.createElement(r.PreviousMonthButton,{type:"button",className:s[G.PreviousMonthButton],tabIndex:m?void 0:-1,"aria-disabled":m?void 0:!0,"aria-label":Le(m),onClick:$o,"data-animated-button":t.animate?"true":void 0},D.createElement(r.Chevron,{disabled:m?void 0:!0,className:s[G.Chevron],orientation:t.dir==="rtl"?"right":"left"})),D.createElement(r.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:s[G.MonthCaption],style:S==null?void 0:S[G.MonthCaption],calendarMonth:ne,displayIndex:me},c!=null&&c.startsWith("dropdown")?D.createElement(r.DropdownNav,{className:s[G.Dropdowns],style:S==null?void 0:S[G.Dropdowns]},c==="dropdown"||c==="dropdown-months"?D.createElement(r.MonthsDropdown,{className:s[G.MonthsDropdown],"aria-label":se(),classNames:s,components:r,disabled:!!t.disableNavigation,onChange:Hb(ne.date),options:he,style:S==null?void 0:S[G.Dropdown],value:i.getMonth(ne.date)}):D.createElement("span",null,L(ne.date,i)),c==="dropdown"||c==="dropdown-years"?D.createElement(r.YearsDropdown,{className:s[G.YearsDropdown],"aria-label":Ib(i.options),classNames:s,components:r,disabled:!!t.disableNavigation,onChange:Ub(ne.date),options:bt,style:S==null?void 0:S[G.Dropdown],value:i.getYear(ne.date)}):D.createElement("span",null,R(ne.date,i)),D.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},T(ne.date,i.options,i))):D.createElement(r.CaptionLabel,{className:s[G.CaptionLabel],role:"status","aria-live":"polite"},T(ne.date,i.options,i))),d==="around"&&!t.hideNavigation&&me===u-1&&D.createElement(r.NextMonthButton,{type:"button",className:s[G.NextMonthButton],tabIndex:C?void 0:-1,"aria-disabled":C?void 0:!0,"aria-label":Ne(C),onClick:Ro,"data-animated-button":t.animate?"true":void 0},D.createElement(r.Chevron,{disabled:C?void 0:!0,className:s[G.Chevron],orientation:t.dir==="rtl"?"left":"right"})),me===u-1&&d==="after"&&!t.hideNavigation&&D.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:s[G.Nav],style:S==null?void 0:S[G.Nav],"aria-label":Ee(),onPreviousClick:$o,onNextClick:Ro,previousMonth:m,nextMonth:C}),D.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":l==="multiple"||l==="range","aria-label":Q(ne.date,i.options,i)||void 0,className:s[G.MonthGrid],style:S==null?void 0:S[G.MonthGrid]},!t.hideWeekdays&&D.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:s[G.Weekdays],style:S==null?void 0:S[G.Weekdays]},O&&D.createElement(r.WeekNumberHeader,{"aria-label":ye(i.options),className:s[G.WeekNumberHeader],style:S==null?void 0:S[G.WeekNumberHeader],scope:"col"},B()),Wb.map(($e,cn)=>D.createElement(r.Weekday,{"aria-label":Be($e,i.options,i),className:s[G.Weekday],key:cn,style:S==null?void 0:S[G.Weekday],scope:"col"},U($e,i.options,i)))),D.createElement(r.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:s[G.Weeks],style:S==null?void 0:S[G.Weeks]},ne.weeks.map(($e,cn)=>D.createElement(r.Week,{className:s[G.Week],key:$e.weekNumber,style:S==null?void 0:S[G.Week],week:$e},O&&D.createElement(r.WeekNumber,{week:$e,style:S==null?void 0:S[G.WeekNumber],"aria-label":De($e.weekNumber,{locale:a}),className:s[G.WeekNumber],scope:"row",role:"rowheader"},$($e.weekNumber,i)),$e.days.map(Oe=>{const{date:Xe}=Oe,le=k(Oe);if(le[ge.focused]=!le.hidden&&!!(W!=null&&W.isEqualTo(Oe)),le[We.selected]=(M==null?void 0:M(Xe))||le.selected,uo(I)){const{from:Vo,to:Ho}=I;le[We.range_start]=!!(Vo&&Ho&&i.isSameDay(Xe,Vo)),le[We.range_end]=!!(Vo&&Ho&&i.isSameDay(Xe,Ho)),le[We.range_middle]=nt(I,Xe,!0,i)}const Gb=Qm(le,S,t.modifiersStyles),Xb=dm(le,s,t.modifiersClassNames),Qb=!ml&&!le.hidden?z(Xe,le,i.options,i):void 0;return D.createElement(r.Day,{key:`${i.format(Xe,"yyyy-MM-dd")}_${i.format(Oe.displayMonth,"yyyy-MM")}`,day:Oe,modifiers:le,className:Xb.join(" "),style:Gb,role:"gridcell","aria-selected":le.selected||void 0,"aria-label":Qb,"data-day":i.format(Xe,"yyyy-MM-dd"),"data-month":Oe.outside?i.format(Xe,"yyyy-MM"):void 0,"data-selected":le.selected||void 0,"data-disabled":le.disabled||void 0,"data-hidden":le.hidden||void 0,"data-outside":Oe.outside||void 0,"data-focused":le.focused||void 0,"data-today":le.today||void 0},!le.hidden&&ml?D.createElement(r.DayButton,{className:s[G.DayButton],style:S==null?void 0:S[G.DayButton],type:"button",day:Oe,modifiers:le,disabled:le.disabled||void 0,tabIndex:A(Oe)?0:-1,"aria-label":q(Xe,le,i.options,i),onClick:jb(Oe,le),onBlur:Bb(Oe,le),onFocus:Lb(Oe,le),onKeyDown:$b(Oe,le),onMouseEnter:Rb(Oe,le),onMouseLeave:Vb(Oe,le)},P(Xe,i.options,i)):!le.hidden&&P(Oe.date,i.options,i))}))))))})),t.footer&&D.createElement(r.Footer,{className:s[G.Footer],style:S==null?void 0:S[G.Footer],role:"status","aria-live":"polite"},t.footer)))}function _c({className:e,classNames:t,showOutsideDays:r=!0,...n}){return w.jsx(Ig,{showOutsideDays:r,className:J("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:J(pn({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:J(pn({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{Chevron:({orientation:o})=>o==="left"?w.jsx(fu,{className:"h-4 w-4"}):w.jsx(hu,{className:"h-4 w-4"})},...n})}_c.displayName="Calendar";var en="Popover",[kc,sw]=Dt(en,[Lr]),mr=Lr(),[Wg,vt]=kc(en),Pc=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=e,s=mr(t),c=E.useRef(null),[l,d]=E.useState(!1),[u,h]=tr({prop:n,defaultProp:o??!1,onChange:i,caller:en});return w.jsx(Aa,{...s,children:w.jsx(Wg,{scope:t,contentId:Pr(),triggerRef:c,open:u,onOpenChange:h,onOpenToggle:E.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:l,onCustomAnchorAdd:E.useCallback(()=>d(!0),[]),onCustomAnchorRemove:E.useCallback(()=>d(!1),[]),modal:a,children:r})})};Pc.displayName=en;var Mc="PopoverAnchor",jg=E.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=vt(Mc,r),i=mr(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return E.useEffect(()=>(a(),()=>s()),[a,s]),w.jsx(Hn,{...i,...n,ref:t})});jg.displayName=Mc;var Ac="PopoverTrigger",Nc=E.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=vt(Ac,r),i=mr(r),a=ue(t,o.triggerRef),s=w.jsx(ie.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Wc(o.open),...n,ref:a,onClick:oe(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:w.jsx(Hn,{asChild:!0,...i,children:s})});Nc.displayName=Ac;var mo="PopoverPortal",[Lg,Bg]=kc(mo,{forceMount:void 0}),Dc=e=>{const{__scopePopover:t,forceMount:r,children:n,container:o}=e,i=vt(mo,t);return w.jsx(Lg,{scope:t,forceMount:r,children:w.jsx(Xr,{present:r||i.open,children:w.jsx(Un,{asChild:!0,container:o,children:n})})})};Dc.displayName=mo;var zt="PopoverContent",Tc=E.forwardRef((e,t)=>{const r=Bg(zt,e.__scopePopover),{forceMount:n=r.forceMount,...o}=e,i=vt(zt,e.__scopePopover);return w.jsx(Xr,{present:n||i.open,children:i.modal?w.jsx(Rg,{...o,ref:t}):w.jsx(Vg,{...o,ref:t})})});Tc.displayName=zt;var $g=Nt("PopoverContent.RemoveScroll"),Rg=E.forwardRef((e,t)=>{const r=vt(zt,e.__scopePopover),n=E.useRef(null),o=ue(t,n),i=E.useRef(!1);return E.useEffect(()=>{const a=n.current;if(a)return Ia(a)},[]),w.jsx(Xn,{as:$g,allowPinchZoom:!0,children:w.jsx(Fc,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:oe(e.onCloseAutoFocus,a=>{var s;a.preventDefault(),i.current||(s=r.triggerRef.current)==null||s.focus()}),onPointerDownOutside:oe(e.onPointerDownOutside,a=>{const s=a.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0,l=s.button===2||c;i.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:oe(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Vg=E.forwardRef((e,t)=>{const r=vt(zt,e.__scopePopover),n=E.useRef(!1),o=E.useRef(!1);return w.jsx(Fc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,s;(a=e.onCloseAutoFocus)==null||a.call(e,i),i.defaultPrevented||(n.current||(s=r.triggerRef.current)==null||s.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{var c,l;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=i.target;((l=r.triggerRef.current)==null?void 0:l.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Fc=E.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:d,...u}=e,h=vt(zt,r),p=mr(r);return Gi(),w.jsx(Pn,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:w.jsx(Sn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),children:w.jsx(Na,{"data-state":Wc(h.open),role:"dialog",id:h.contentId,...p,...u,ref:t,style:{...u.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)"}})})})}),Ic="PopoverClose",Hg=E.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=vt(Ic,r);return w.jsx(ie.button,{type:"button",...n,ref:t,onClick:oe(e.onClick,()=>o.onOpenChange(!1))})});Hg.displayName=Ic;var Ug="PopoverArrow",Yg=E.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=mr(r);return w.jsx(Da,{...o,...n,ref:t})});Yg.displayName=Ug;function Wc(e){return e?"open":"closed"}var zg=Pc,qg=Nc,Kg=Dc,jc=Tc;const Gg=zg,Xg=qg,Lc=E.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},o)=>w.jsx(Kg,{children:w.jsx(jc,{ref:o,align:t,sideOffset:r,className:J("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Lc.displayName=jc.displayName;function Qg({id:e,value:t,placeholder:r,disabled:n,onChange:o,onBlur:i,onFocus:a,className:s,"aria-invalid":c}){const[l,d]=E.useState();E.useEffect(()=>{t&&d(new Date(t))},[t]);const u=h=>{d(h),h&&o&&o(so(h,"yyyy-MM-dd"))};return w.jsxs(Gg,{children:[w.jsx(Xg,{asChild:!0,children:w.jsxs(Ze,{id:e,variant:"outline",className:J("w-full justify-start text-left font-normal",!l&&"text-muted-foreground",s),disabled:n,onBlur:i,onFocus:a,"aria-invalid":c,children:[w.jsx(du,{className:"mr-2 h-4 w-4"}),l?so(l,"PPP"):w.jsx("span",{children:r})]})}),w.jsx(Lc,{className:"w-auto p-0",children:w.jsx(_c,{mode:"single",selected:l,onSelect:u,initialFocus:!0})})]})}function Bc(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async y=>{const b=y.target.value===""?d.emptyValue:y.target.value;s(b),await p.onChange(b)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=u.length>0;return w.jsx(be,{id:t,type:"text",value:r||"",placeholder:a,required:n,disabled:o,readOnly:i,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function $c(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async b=>{const O=b.target.value===""?d.emptyValue:b.target.value;s(O),await p.onChange(O)},f=async b=>{const O=b.target.value;c&&c(t,O),await p.onBlur(O)},v=async b=>{const O=b.target.value;l&&l(t,O),await p.onFocus(O)},g=u.length>0,y=d.rows||4;return w.jsx(Ui,{id:t,value:r||"",placeholder:a,required:n,disabled:o,readOnly:i,rows:y,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J("resize-y",g&&"border-destructive focus-visible:ring-destructive/20")})}function Rc(e){const{id:t,value:r,required:n,disabled:o,onChange:i,onBlur:a,onFocus:s,options:c,rawErrors:l=[],schema:d}=e,u=ve(t,d),h=async g=>{const y=g===""?c.emptyValue:g;i(y),await u.onChange(y)},p=async()=>{a&&a(t,r),await u.onBlur(r)},x=async()=>{s&&s(t,r),await u.onFocus(r)},f=l.length>0,{enumOptions:v=[]}=c;return w.jsxs(kh,{value:r||"",onValueChange:h,disabled:o,required:n,children:[w.jsx(Ms,{id:t,"aria-invalid":f,className:J("w-full",f&&"border-destructive focus-visible:ring-destructive/20"),onBlur:p,onFocus:x,children:w.jsx(Ph,{placeholder:"Select an option..."})}),w.jsx(Ds,{children:v.map(g=>w.jsx(Ts,{value:g.value,children:g.label},g.value))})]})}function Vc(e){const{id:t,value:r,disabled:n,readonly:o,onChange:i,onBlur:a,onFocus:s,label:c,rawErrors:l=[],schema:d}=e,u=ve(t,d),h=async v=>{i(v),await u.onChange(v)},p=async()=>{a&&a(t,r),await u.onBlur(r)},x=async()=>{s&&s(t,r),await u.onFocus(r)},f=l.length>0;return w.jsxs("div",{className:"flex items-start space-x-2",children:[w.jsx(Rs,{id:t,checked:r||!1,disabled:n||o,onCheckedChange:h,onBlur:p,onFocus:x,"aria-invalid":f,className:J("mt-0.5",f&&"border-destructive focus-visible:ring-destructive/20")}),c&&w.jsx(ke,{htmlFor:t,className:J("text-sm leading-none",n&&"opacity-50",!o&&!n&&"cursor-pointer"),children:c})]})}function Hc(e){const{id:t,value:r,disabled:n,readonly:o,onChange:i,onBlur:a,onFocus:s,options:c,rawErrors:l=[],schema:d}=e,u=ve(t,d),h=async g=>{i(g),await u.onChange(g)},p=async()=>{a&&a(t,r),await u.onBlur(r)},x=async()=>{s&&s(t,r),await u.onFocus(r)},f=l.length>0,{enumOptions:v=[]}=c;return w.jsx("div",{className:"space-y-2",children:v.map((g,y)=>w.jsxs("div",{className:"flex items-center",children:[w.jsx("input",{id:`${t}_${y}`,type:"radio",name:t,value:g.value,checked:r===g.value,disabled:n,readOnly:o,onChange:()=>h(g.value),onBlur:p,onFocus:x,className:`
|
|
102
102
|
h-4 w-4 border-gray-300 text-blue-600 mr-3
|
|
103
103
|
focus:ring-blue-500 transition-colors duration-200
|
|
104
104
|
${f?"border-red-300 focus:ring-red-500":""}
|
|
105
105
|
${n?"cursor-not-allowed opacity-50":"cursor-pointer"}
|
|
106
|
-
`}),w.jsx("label",{htmlFor:`${t}_${y}`,className:`text-sm text-gray-700 ${n?"opacity-50":""} ${o?"":"cursor-pointer"}`,children:g.label})]},g.value))})}function Hc(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,schema:u,rawErrors:h=[]}=e,p=ve(t,u),x=async y=>{const b=y.target.value,O=b===""?d.emptyValue:parseFloat(b);s(O),await p.onChange(O)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=h.length>0;return w.jsx(be,{id:t,type:"number",value:r??"",placeholder:a,required:n,disabled:o,readOnly:i,min:u.minimum,max:u.maximum,step:u.multipleOf||"any",onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function go(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async y=>{const b=y.target.value===""?d.emptyValue:y.target.value;s(b),await p.onChange(b)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=u.length>0;return w.jsx(be,{id:t,type:"tel",value:r||"",placeholder:a||"Enter phone number",required:n,disabled:o,readOnly:i,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function vo(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async y=>{const b=y.target.value===""?d.emptyValue:y.target.value;s(b),await p.onChange(b)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=u.length>0;return w.jsx(be,{id:t,type:"email",value:r||"",placeholder:a||"Enter email address",required:n,disabled:o,readOnly:i,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function yo(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async y=>{const b=y.target.value===""?d.emptyValue:y.target.value;s(b),await p.onChange(b)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=u.length>0;return w.jsx(be,{id:t,type:"url",value:r||"",placeholder:a||"Enter URL",required:n,disabled:o,readOnly:i,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function bo(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async y=>{const b=y.target.value===""?d.emptyValue:y.target.value;s(b),await p.onChange(b)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=u.length>0;return w.jsx(be,{id:t,type:"password",value:r||"",placeholder:a||"Enter password",required:n,disabled:o,readOnly:i,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function Uc(e){const{id:t,value:r,required:n,disabled:o,readonly:i,onChange:a,onBlur:s,onFocus:c,options:l,rawErrors:d=[],schema:u}=e,h=ve(t,u),p=async g=>{const y=g===""?l.emptyValue:g;a(y),await h.onChange(y)},x=async()=>{s&&s(t,r),await h.onBlur(r)},f=async()=>{c&&c(t,r),await h.onFocus(r)},v=d.length>0;return i?w.jsx(be,{id:t,type:"date",value:r||"",required:n,disabled:o,readOnly:i,"aria-invalid":v,className:J(v&&"border-destructive focus-visible:ring-destructive/20")}):w.jsx(Xg,{id:t,value:r||"",placeholder:"Select a date",disabled:o,onChange:p,onBlur:x,onFocus:f,"aria-invalid":v,className:J(v&&"border-destructive focus-visible:ring-destructive/20")})}function wo(e){const{id:t,value:r,required:n,disabled:o,readonly:i,onChange:a,onBlur:s,onFocus:c,options:l,rawErrors:d=[],schema:u}=e,h=ve(t,u),p=async g=>{const y=g.target.value===""?l.emptyValue:g.target.value;a(y),await h.onChange(y)},x=async g=>{const y=g.target.value;s&&s(t,y),await h.onBlur(y)},f=async g=>{const y=g.target.value;c&&c(t,y),await h.onFocus(y)},v=d.length>0;return w.jsx(be,{id:t,type:"datetime-local",value:r||"",required:n,disabled:o,readOnly:i,onChange:p,onBlur:x,onFocus:f,"aria-invalid":v,className:J(v&&"border-destructive focus-visible:ring-destructive/20")})}function Yc(e){const{id:t,required:r,disabled:n,readonly:o,onChange:i,onBlur:a,onFocus:s,options:c,rawErrors:l=[],schema:d}=e,u=ve(t,d),h=async g=>{const y=g.target.files;if(y&&y.length>0){const b=y[0],O=new FileReader;O.onload=async()=>{const S=O.result;i(S),await u.onChange(S)},O.readAsDataURL(b)}},p=async g=>{const y=g.target.value;a&&a(t,y),await u.onBlur(y)},x=async g=>{const y=g.target.value;s&&s(t,y),await u.onFocus(y)},f=l.length>0,v=typeof c.accept=="string"?c.accept:"*/*";return w.jsx(be,{id:t,type:"file",required:r,disabled:n,readOnly:o,accept:v,onChange:h,onBlur:p,onFocus:x,"aria-invalid":f,className:J("file:mr-4 file:py-1 file:px-2 file:rounded file:border-0 file:text-sm file:font-medium file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100",f&&"border-destructive focus-visible:ring-destructive/20")})}const zc={TextWidget:Lc,TextareaWidget:Bc,SelectWidget:$c,CheckboxWidget:Rc,RadioWidget:Vc,UpDownWidget:Hc,FileWidget:Yc,tel:go,email:vo,url:yo,password:bo,date:Uc,"datetime-local":wo,TelWidget:go,EmailWidget:vo,URLWidget:yo,PasswordWidget:bo,DateWidget:Uc,DateTimeWidget:wo},qc={color:wi,file:Ei,range:Ri,rating:Vi,...zc},Qg={small:"space-y-2",medium:"space-y-4",large:"space-y-6"},Zg=({children:e,spacing:t="medium",className:r=""})=>w.jsx("div",{className:J("flex flex-col",Qg[t],r),children:e}),Jg={small:"space-x-2",medium:"space-x-4",large:"space-x-6"},ev={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},tv=({children:e,spacing:t="medium",align:r="center",className:n=""})=>w.jsx("div",{className:J("flex flex-row",Jg[t],ev[r],n),children:e}),rv={small:"gap-2",medium:"gap-4",large:"gap-6"},nv=({children:e,columns:t="auto-fit",gap:r="medium",minItemWidth:n="250px",className:o=""})=>{const i={display:"grid"};return typeof t=="number"?i.gridTemplateColumns=`repeat(${t}, 1fr)`:i.gridTemplateColumns=`repeat(${t}, minmax(${n}, 1fr))`,w.jsx("div",{className:J("grid",rv[r],o),style:i,children:e})};class ov{constructor(t){wt(this,"handlers");this.handlers=t}async handleBeforeSubmit(t){return this.handlers.beforeSubmit?await this.handlers.beforeSubmit(t):t}async handleAfterSubmit(t){this.handlers.afterSubmit&&await this.handlers.afterSubmit(t)}async handleBeforeValidation(t){return this.handlers.beforeValidation?await this.handlers.beforeValidation(t):t}async handleAfterValidation(t,r){this.handlers.afterValidation&&await this.handlers.afterValidation(t,r)}}class Kc{constructor(t,r={},n=[]){wt(this,"formHandlers");wt(this,"fieldHandlers");wt(this,"webhooks");wt(this,"debounceTimers",new Map);wt(this,"webhookQueue",[]);wt(this,"isProcessingQueue",!1);this.formHandlers=t,this.fieldHandlers=r,this.webhooks=n}async handleBeforeSubmit(t){return this.formHandlers.beforeSubmit?await this.formHandlers.beforeSubmit(t):t}async handleAfterSubmit(t){this.formHandlers.afterSubmit&&await this.formHandlers.afterSubmit(t)}async handleBeforeValidation(t){return this.formHandlers.beforeValidation?await this.formHandlers.beforeValidation(t):t}async handleAfterValidation(t,r){this.formHandlers.afterValidation&&await this.formHandlers.afterValidation(t,r)}async handleFieldEvent(t,r,n,o,i,a){const s={eventType:t,fieldId:r,fieldValue:n,schema:o,formData:i,timestamp:Date.now(),fieldPath:a};try{switch(t){case"focus":this.fieldHandlers.onFieldFocus&&await this.fieldHandlers.onFieldFocus(s);break;case"blur":this.fieldHandlers.onFieldBlur&&await this.fieldHandlers.onFieldBlur(s);break;case"change":this.fieldHandlers.onFieldChange&&await this.fieldHandlers.onFieldChange(s);break}}catch(c){console.error(`Error in field event handler (${t}):`,c)}this.processWebhooks(s)}processWebhooks(t){const r=this.webhooks.filter(n=>!n.events||n.events.includes(t.eventType));for(const n of r)n.debounceMs&&n.debounceMs>0?this.debounceWebhook(n,t):this.queueWebhook(n,t)}debounceWebhook(t,r){const n=`${t.url}-${r.fieldId}-${r.eventType}`;this.debounceTimers.has(n)&&clearTimeout(this.debounceTimers.get(n));const o=setTimeout(()=>{this.queueWebhook(t,r),this.debounceTimers.delete(n)},t.debounceMs);this.debounceTimers.set(n,o)}queueWebhook(t,r){this.webhookQueue.push({config:t,event:r,retryCount:0}),this.isProcessingQueue||this.processWebhookQueue()}async processWebhookQueue(){if(!(this.isProcessingQueue||this.webhookQueue.length===0)){for(this.isProcessingQueue=!0;this.webhookQueue.length>0;){const t=this.webhookQueue.shift();try{await this.callWebhook(t.config,t.event)}catch(r){const n=t.config.retries||3;t.retryCount<n?(t.retryCount++,setTimeout(()=>{this.webhookQueue.push(t)},Math.pow(2,t.retryCount)*1e3)):console.error(`Webhook failed after ${n} retries:`,r)}}this.isProcessingQueue=!1}}async callWebhook(t,r){const n={event:r,timestamp:Date.now(),source:"extended-dynamic-forms"},o={method:t.method||"POST",headers:{"Content-Type":"application/json",...t.headers},body:JSON.stringify(n)};t.timeout&&(o.signal=AbortSignal.timeout(t.timeout));const i=await fetch(t.url,o);if(!i.ok)throw new Error(`Webhook request failed: ${i.status} ${i.statusText}`)}createFieldEventHandlers(t,r,n,o){return{onFocus:i=>this.handleFieldEvent("focus",t,i,r,n,o),onBlur:i=>this.handleFieldEvent("blur",t,i,r,n,o),onChange:i=>this.handleFieldEvent("change",t,i,r,n,o)}}cleanup(){for(const t of this.debounceTimers.values())clearTimeout(t);this.debounceTimers.clear()}}const Gc={cloneFormData:e=>JSON.parse(JSON.stringify(e)),mergeFormData:(e,t)=>({...e,...t}),getNestedValue:(e,t)=>{const r=t.split(".");let n=e;for(const o of r)if(n&&typeof n=="object"&&o in n)n=n[o];else return;return n},setNestedValue:(e,t,r)=>{const n=t.split("."),o={...e};let i=o;for(let a=0;a<n.length-1;a++){const s=n[a];(!(s in i)||typeof i[s]!="object")&&(i[s]={}),i=i[s]}return i[n[n.length-1]]=r,o},removeEmptyValues:e=>{if(Array.isArray(e))return e.filter(t=>t!=null&&t!=="");if(e!==null&&typeof e=="object"){const t={};for(const[r,n]of Object.entries(e))n!=null&&n!==""&&(t[r]=Gc.removeEmptyValues(n));return t}return e}},Xc={getRequiredFields:e=>e.required||[],isFieldRequired:(e,t)=>(e.required||[]).includes(t),getFieldSchema:(e,t)=>{const r=t.split(".");let n=e;for(const o of r)if(n.type==="object"&&n.properties)n=n.properties[o];else if(n.type==="array"&&n.items)n=n.items;else return;return n},mergeSchemas:(e,t)=>({...e,...t,properties:{...e.properties,...t.properties},required:[...new Set([...e.required||[],...t.required||[]])]}),getAllFieldPaths:(e,t="")=>{const r=[];if(e.type==="object"&&e.properties)for(const[n,o]of Object.entries(e.properties)){const i=t?`${t}.${n}`:n;r.push(i),r.push(...Xc.getAllFieldPaths(o,i))}return r}},iv={isValidEmail:e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),isValidPhone:e=>/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/.test(e),isValidUrl:e=>{try{return new URL(e),!0}catch{return!1}},isValidDate:e=>{const t=new Date(e);return t instanceof Date&&!isNaN(t.getTime())},isInRange:(e,t,r)=>!(t!==void 0&&e<t||r!==void 0&&e>r),getValidationMessage:(e,t)=>({required:"This field is required",email:"Please enter a valid email address",phone:"Please enter a valid phone number",url:"Please enter a valid URL",date:"Please enter a valid date",min:`Value must be at least ${t==null?void 0:t.min}`,max:`Value must be at most ${t==null?void 0:t.max}`,minLength:`Must be at least ${t==null?void 0:t.minLength} characters`,maxLength:`Must be at most ${t==null?void 0:t.maxLength} characters`})[e]||"Invalid value"},Qc=({schema:e,uiSchema:t,formData:r,onSubmit:n,onChange:o,onError:i,onBlur:a,onFocus:s,beforeSubmit:c,afterSubmit:l,beforeValidation:d,afterValidation:u,onFieldFocus:h,onFieldBlur:p,onFieldChange:x,webhooks:f=[],widgets:v={},fields:g={},templates:y={},...b})=>{const O=D.useRef(null),S=D.useMemo(()=>{const U=new Kc({beforeSubmit:c,afterSubmit:l,beforeValidation:d,afterValidation:u},{onFieldFocus:h,onFieldBlur:p,onFieldChange:x},f);return O.current=U,U},[c,l,d,u,h,p,x,f]);D.useEffect(()=>()=>{O.current&&O.current.cleanup()},[]);const T=async(U,$)=>{const K=await S.handleBeforeSubmit(U);n&&await n(K,$),await S.handleAfterSubmit(K)},P=U=>{o&&o(U)},L={...qc,...v},H={...yi,...g},B={...bi,...y};return w.jsx(ui,{eventHub:S,formData:r,children:w.jsx(yl,{schema:e,uiSchema:t,formData:r,validator:Uo,onSubmit:T,onChange:P,onError:i,onBlur:a,onFocus:s,widgets:L,fields:H,templates:B,...b})})};function av(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var _e={},it={},gr={},xo={};Object.defineProperty(xo,"__esModule",{value:!0});function sv(e){for(var t=e.length,r=5381,n=52711,o;t--;)o=e.charCodeAt(t),r=r*33^o,n=n*33^o;return(r>>>0)*4096+(n>>>0)}var vr="|",cv=/\[object ([HTML|SVG](.*)Element)\]/,lv={"[object Arguments]":0,"[object Array]":1,"[object ArrayBuffer]":2,"[object AsyncFunction]":3,"[object AsyncGeneratorFunction]":4,"[object BigInt]":5,"[object BigInt64Array]":6,"[object BigUint64Array]":7,"[object Boolean]":8,"[object DataView]":9,"[object Date]":10,"[object DocumentFragment]":11,"[object Error]":12,"[object Event]":13,"[object Float32Array]":14,"[object Float64Array]":15,"[object Function]":16,"[object Generator]":17,"[object GeneratorFunction]":18,"[object Int8Array]":19,"[object Int16Array]":20,"[object Map]":21,"[object Number]":22,"[object Object]":23,"[object Promise]":24,"[object RegExp]":25,"[object Set]":26,"[object SharedArrayBuffer]":27,"[object String]":28,"[object Uint8Array]":29,"[object Uint8ClampedArray]":30,"[object Uint16Array]":31,"[object Uint32Array]":32,"[object WeakMap]":33,"[object WeakRef]":34,"[object WeakSet]":35,CUSTOM:36,ELEMENT:37},uv={"[object Arguments]":1,"[object Array]":2},Zc={"[object Generator]":1,"[object Promise]":2,"[object WeakMap]":3,"[object WeakRef]":4,"[object WeakSet]":5},dv={"[object AsyncFunction]":1,"[object AsyncGeneratorFunction]":2,"[object Boolean]":3,"[object Function]":4,"[object GeneratorFunction]":5,"[object Number]":6,"[object String]":7},fv={"[object BigInt64Array]":1,"[object BigUint64Array]":2,"[object Float32Array]":3,"[object Float64Array]":4,"[object Int8Array]":5,"[object Int16Array]":6,"[object Uint8Array]":7,"[object Uint8ClampedArray]":8,"[object Uint16Array]":9,"[object Uint32Array]":10},hv={"[object Arguments]":1,"[object Array]":2,"[object ArrayBuffer]":3,"[object BigInt64Array]":4,"[object BigUint64Array]":5,"[object DataView]":6,"[object Float32Array]":7,"[object Float64Array]":8,"[object Int8Array]":9,"[object Int16Array]":10,"[object Map]":11,"[object Object]":12,"[object Set]":13,"[object SharedArrayBuffer]":14,"[object Uint8Array]":15,"[object Uint8ClampedArray]":16,"[object Uint16Array]":17,"[object Uint32Array]":18,CUSTOM:19},yr={bigint:"i",boolean:"b",empty:"e",function:"g",number:"n",object:"o",string:"s",symbol:"s"};function pv(e,t){return e[0]>t[0]}function Jc(e,t){return e>t}function Eo(e,t){for(var r,n,o=0;o<e.length;++o){for(n=e[o],r=o-1;~r&&t(e[r],n);--r)e[r+1]=e[r];e[r+1]=n}return e}function xe(e,t){return yr.object+vr+lv[e]+vr+t}var el=new WeakMap,mv=0;function Co(e,t){var r=el.get(e);if(r)return r;var n=xe(t,"NOT_ENUMERABLE"+vr+mv++);return el.set(e,n),n}var gv=Object.prototype.toString;function vv(e,t,r){if(hv[t])return tl(t,e,r);if(t==="[object Date]")return xe(t,e.getTime());if(t==="[object RegExp]")return xe(t,e.toString());if(t==="[object Event]")return xe(t,[e.bubbles,e.cancelBubble,e.cancelable,e.composed,e.currentTarget,e.defaultPrevented,e.eventPhase,e.isTrusted,e.returnValue,e.target,e.type].join());if(t==="[object Error]")return xe(t,e.message+vr+e.stack);if(t==="[object DocumentFragment]")return xe(t,Ev(e));var n=t.match(cv);return n?xe("ELEMENT",n[1]+vr+e.outerHTML):Zc[t]?Co(e,t):dv[t]?xe(t,e.toString()):tl("CUSTOM",e,r)}function tl(e,t,r){var n=r.cache.get(t);return n?xe(e,"RECURSIVE~"+n):(r.cache.set(t,++r.id),e==="[object Object]"?t[Symbol.iterator]?Co(t,e):xe(e,nl(t,r)):uv[e]?xe(e,yv(t,r)):e==="[object Map]"?xe(e,Cv(t,r)):e==="[object Set]"?xe(e,Sv(t,r)):fv[e]?xe(e,t.join()):e==="[object ArrayBuffer]"?xe(e,rl(t)):e==="[object DataView]"?xe(e,rl(t.buffer)):Zc[e]?Co(t,e):xe("CUSTOM",nl(t,r)))}function yv(e,t){for(var r=e.length,n=new Array(r);--r>=0;)n[r]=qt(e[r],t);return n.join()}function bv(e){return Buffer.from(e).toString("utf8")}function wv(e){return String.fromCharCode.apply(null,new Uint16Array(e))}function xv(){return"UNSUPPORTED"}function Ev(e){for(var t=e.children,r=t.length,n=new Array(r);--r>=0;)n[r]=t[r].outerHTML;return n.join()}var rl=typeof Buffer<"u"&&typeof Buffer.from=="function"?bv:typeof Uint16Array=="function"?wv:xv;function Cv(e,t){var r=new Array(e.size),n=0;for(e.forEach(function(o,i){r[n++]=[qt(i,t),qt(o,t)]}),Eo(r,pv);--n>=0;)r[n]="["+r[n][0]+","+r[n][1]+"]";return"["+r.join()+"]"}function nl(e,t){for(var r=Eo(Object.getOwnPropertyNames(e),Jc),n=r.length,o=new Array(n),i=n;--i>=0;)o[i]=r[i]+":"+qt(e[r[i]],t);return"{"+o.join()+"}"}function Sv(e,t){var r=new Array(e.size),n=0;return e.forEach(function(o){r[n++]=qt(o,t)}),"["+Eo(r,Jc).join()+"]"}function qt(e,t){var r=typeof e;return e==null||r==="undefined"?yr.empty+e:r==="object"?vv(e,gv.call(e),t||{cache:new WeakMap,id:1}):r==="function"||r==="symbol"?yr[r]+e.toString():r==="boolean"?yr.boolean+ +e:yr[r]+e}function Ov(e){return sv(qt(e,void 0))}xo.default=Ov,Object.defineProperty(gr,"__esModule",{value:!0});var _v=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),kv=xo,Pv=Mv(kv);function Mv(e){return e&&e.__esModule?e:{default:e}}function Av(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var So=function(){function e(t,r,n){Av(this,e),this.id=t;var o={cache:!0};if(typeof n>"u"&&(n=o),typeof r!="function"?(this.value=r,this.type=this.constructor.CONSTANT):(this.calculationMethod=r,this.type=this.constructor.DYNAMIC),!this.id)throw new Error("factId required");return this.priority=parseInt(n.priority||1,10),this.options=Object.assign({},o,n),this.cacheKeyMethod=this.defaultCacheKeys,this}return _v(e,[{key:"isConstant",value:function(){return this.type===this.constructor.CONSTANT}},{key:"isDynamic",value:function(){return this.type===this.constructor.DYNAMIC}},{key:"calculate",value:function(r,n){return Object.prototype.hasOwnProperty.call(this,"value")?this.value:this.calculationMethod(r,n)}},{key:"defaultCacheKeys",value:function(r,n){return{params:n,id:r}}},{key:"getCacheKey",value:function(r){if(this.options.cache===!0){var n=this.cacheKeyMethod(this.id,r),o=e.hashFromObject(n);return o}}}],[{key:"hashFromObject",value:function(r){return(0,Pv.default)(r)}}]),e}();So.CONSTANT="CONSTANT",So.DYNAMIC="DYNAMIC",gr.default=So;var tn={},rn={},_t={};Object.defineProperty(_t,"__esModule",{value:!0});function Nv(){try{if(typeof process<"u"&&process.env&&process.env.DEBUG&&process.env.DEBUG.match(/json-rules-engine/)||typeof window<"u"&&window.localStorage&&window.localStorage.debug&&window.localStorage.debug.match(/json-rules-engine/))return console.debug.bind(console)}catch{}return function(){}}_t.default=Nv(),Object.defineProperty(rn,"__esModule",{value:!0});var Dv=function(){function e(t,r){var n=[],o=!0,i=!1,a=void 0;try{for(var s=t[Symbol.iterator](),c;!(o=(c=s.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){i=!0,a=l}finally{try{!o&&s.return&&s.return()}finally{if(i)throw a}}return n}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Tv=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Fv=_t,Iv=Wv(Fv);function Wv(e){return e&&e.__esModule?e:{default:e}}function jv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Lv=function(){function e(t){if(jv(this,e),!t)throw new Error("Condition: constructor options required");var r=e.booleanOperator(t);if(Object.assign(this,t),r){var n=t[r],o=Array.isArray(n);if(r!=="not"&&!o)throw new Error('"'+r+'" must be an array');if(r==="not"&&o)throw new Error('"'+r+'" cannot be an array');this.operator=r,this.priority=parseInt(t.priority,10)||1,o?this[r]=n.map(function(i){return new e(i)}):this[r]=new e(n)}else if(!Object.prototype.hasOwnProperty.call(t,"condition")){if(!Object.prototype.hasOwnProperty.call(t,"fact"))throw new Error('Condition: constructor "fact" property required');if(!Object.prototype.hasOwnProperty.call(t,"operator"))throw new Error('Condition: constructor "operator" property required');if(!Object.prototype.hasOwnProperty.call(t,"value"))throw new Error('Condition: constructor "value" property required');Object.prototype.hasOwnProperty.call(t,"priority")&&(t.priority=parseInt(t.priority,10))}}return Tv(e,[{key:"toJSON",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n={};this.priority&&(n.priority=this.priority),this.name&&(n.name=this.name);var o=e.booleanOperator(this);return o?Array.isArray(this[o])?n[o]=this[o].map(function(i){return i.toJSON(!1)}):n[o]=this[o].toJSON(!1):this.isConditionReference()?n.condition=this.condition:(n.operator=this.operator,n.value=this.value,n.fact=this.fact,this.factResult!==void 0&&(n.factResult=this.factResult),this.valueResult!==void 0&&(n.valueResult=this.valueResult),this.result!==void 0&&(n.result=this.result),this.params&&(n.params=this.params),this.path&&(n.path=this.path)),r?JSON.stringify(n):n}},{key:"evaluate",value:function(r,n){var o=this;if(!r)return Promise.reject(new Error("almanac required"));if(!n)return Promise.reject(new Error("operatorMap required"));if(this.isBooleanOperator())return Promise.reject(new Error("Cannot evaluate() a boolean condition"));var i=n.get(this.operator);return i?Promise.all([r.getValue(this.value),r.factValue(this.fact,this.params,this.path)]).then(function(a){var s=Dv(a,2),c=s[0],l=s[1],d=i.evaluate(l,c);return(0,Iv.default)("condition::evaluate",{leftHandSideValue:l,operator:o.operator,rightHandSideValue:c,result:d}),{result:d,leftHandSideValue:l,rightHandSideValue:c,operator:o.operator}}):Promise.reject(new Error("Unknown operator: "+this.operator))}},{key:"booleanOperator",value:function(){return e.booleanOperator(this)}},{key:"isBooleanOperator",value:function(){return e.booleanOperator(this)!==void 0}},{key:"isConditionReference",value:function(){return Object.prototype.hasOwnProperty.call(this,"condition")}}],[{key:"booleanOperator",value:function(r){if(Object.prototype.hasOwnProperty.call(r,"any"))return"any";if(Object.prototype.hasOwnProperty.call(r,"all"))return"all";if(Object.prototype.hasOwnProperty.call(r,"not"))return"not"}}]),e}();rn.default=Lv;var Oo={},ol={exports:{}};(function(e){var t=function(){function r(h,p){return p!=null&&h instanceof p}var n;try{n=Map}catch{n=function(){}}var o;try{o=Set}catch{o=function(){}}var i;try{i=Promise}catch{i=function(){}}function a(h,p,x,f,v){typeof p=="object"&&(x=p.depth,f=p.prototype,v=p.includeNonEnumerable,p=p.circular);var g=[],y=[],b=typeof Buffer<"u";typeof p>"u"&&(p=!0),typeof x>"u"&&(x=1/0);function O(S,T){if(S===null)return null;if(T===0)return S;var P,L;if(typeof S!="object")return S;if(r(S,n))P=new n;else if(r(S,o))P=new o;else if(r(S,i))P=new i(function(Z,m){S.then(function(C){Z(O(C,T-1))},function(C){m(O(C,T-1))})});else if(a.__isArray(S))P=[];else if(a.__isRegExp(S))P=new RegExp(S.source,u(S)),S.lastIndex&&(P.lastIndex=S.lastIndex);else if(a.__isDate(S))P=new Date(S.getTime());else{if(b&&Buffer.isBuffer(S))return Buffer.allocUnsafe?P=Buffer.allocUnsafe(S.length):P=new Buffer(S.length),S.copy(P),P;r(S,Error)?P=Object.create(S):typeof f>"u"?(L=Object.getPrototypeOf(S),P=Object.create(L)):(P=Object.create(f),L=f)}if(p){var H=g.indexOf(S);if(H!=-1)return y[H];g.push(S),y.push(P)}r(S,n)&&S.forEach(function(Z,m){var C=O(m,T-1),_=O(Z,T-1);P.set(C,_)}),r(S,o)&&S.forEach(function(Z){var m=O(Z,T-1);P.add(m)});for(var B in S){var U;L&&(U=Object.getOwnPropertyDescriptor(L,B)),!(U&&U.set==null)&&(P[B]=O(S[B],T-1))}if(Object.getOwnPropertySymbols)for(var $=Object.getOwnPropertySymbols(S),B=0;B<$.length;B++){var K=$[B],ee=Object.getOwnPropertyDescriptor(S,K);ee&&!ee.enumerable&&!v||(P[K]=O(S[K],T-1),ee.enumerable||Object.defineProperty(P,K,{enumerable:!1}))}if(v)for(var V=Object.getOwnPropertyNames(S),B=0;B<V.length;B++){var X=V[B],ee=Object.getOwnPropertyDescriptor(S,X);ee&&ee.enumerable||(P[X]=O(S[X],T-1),Object.defineProperty(P,X,{enumerable:!1}))}return P}return O(h,x)}a.clonePrototype=function(p){if(p===null)return null;var x=function(){};return x.prototype=p,new x};function s(h){return Object.prototype.toString.call(h)}a.__objToStr=s;function c(h){return typeof h=="object"&&s(h)==="[object Date]"}a.__isDate=c;function l(h){return typeof h=="object"&&s(h)==="[object Array]"}a.__isArray=l;function d(h){return typeof h=="object"&&s(h)==="[object RegExp]"}a.__isRegExp=d;function u(h){var p="";return h.global&&(p+="g"),h.ignoreCase&&(p+="i"),h.multiline&&(p+="m"),p}return a.__getRegExpFlags=u,a}();e.exports&&(e.exports=t)})(ol);var il=ol.exports;Object.defineProperty(Oo,"__esModule",{value:!0});var Bv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$v=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Rv=il,nn=Vv(Rv);function Vv(e){return e&&e.__esModule?e:{default:e}}function Hv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Uv=function(){function e(t,r,n,o){Hv(this,e),this.conditions=(0,nn.default)(t),this.event=(0,nn.default)(r),this.priority=(0,nn.default)(n),this.name=(0,nn.default)(o),this.result=null}return $v(e,[{key:"setResult",value:function(r){this.result=r}},{key:"resolveEventParams",value:function(r){var n=this;if(this.event.params!==null&&Bv(this.event.params)==="object"){var o=[],i=function(c){Object.prototype.hasOwnProperty.call(n.event.params,c)&&o.push(r.getValue(n.event.params[c]).then(function(l){return n.event.params[c]=l}))};for(var a in this.event.params)i(a);return Promise.all(o)}return Promise.resolve()}},{key:"toJSON",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n={conditions:this.conditions.toJSON(!1),event:this.event,priority:this.priority,name:this.name,result:this.result};return r?JSON.stringify(n):n}}]),e}();Oo.default=Uv;var al={exports:{}};/*!
|
|
106
|
+
`}),w.jsx("label",{htmlFor:`${t}_${y}`,className:`text-sm text-gray-700 ${n?"opacity-50":""} ${o?"":"cursor-pointer"}`,children:g.label})]},g.value))})}function Uc(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,schema:u,rawErrors:h=[]}=e,p=ve(t,u),x=async y=>{const b=y.target.value,O=b===""?d.emptyValue:parseFloat(b);s(O),await p.onChange(O)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=h.length>0;return w.jsx(be,{id:t,type:"number",value:r??"",placeholder:a,required:n,disabled:o,readOnly:i,min:u.minimum,max:u.maximum,step:u.multipleOf||"any",onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function go(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async y=>{const b=y.target.value===""?d.emptyValue:y.target.value;s(b),await p.onChange(b)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=u.length>0;return w.jsx(be,{id:t,type:"tel",value:r||"",placeholder:a||"Enter phone number",required:n,disabled:o,readOnly:i,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function vo(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async y=>{const b=y.target.value===""?d.emptyValue:y.target.value;s(b),await p.onChange(b)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=u.length>0;return w.jsx(be,{id:t,type:"email",value:r||"",placeholder:a||"Enter email address",required:n,disabled:o,readOnly:i,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function yo(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async y=>{const b=y.target.value===""?d.emptyValue:y.target.value;s(b),await p.onChange(b)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=u.length>0;return w.jsx(be,{id:t,type:"url",value:r||"",placeholder:a||"Enter URL",required:n,disabled:o,readOnly:i,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function bo(e){const{id:t,value:r,required:n,disabled:o,readonly:i,placeholder:a,onChange:s,onBlur:c,onFocus:l,options:d,rawErrors:u=[],schema:h}=e,p=ve(t,h),x=async y=>{const b=y.target.value===""?d.emptyValue:y.target.value;s(b),await p.onChange(b)},f=async y=>{const b=y.target.value;c&&c(t,b),await p.onBlur(b)},v=async y=>{const b=y.target.value;l&&l(t,b),await p.onFocus(b)},g=u.length>0;return w.jsx(be,{id:t,type:"password",value:r||"",placeholder:a||"Enter password",required:n,disabled:o,readOnly:i,onChange:x,onBlur:f,onFocus:v,"aria-invalid":g,className:J(g&&"border-destructive focus-visible:ring-destructive/20")})}function Yc(e){const{id:t,value:r,required:n,disabled:o,readonly:i,onChange:a,onBlur:s,onFocus:c,options:l,rawErrors:d=[],schema:u}=e,h=ve(t,u),p=async g=>{const y=g===""?l.emptyValue:g;a(y),await h.onChange(y)},x=async()=>{s&&s(t,r),await h.onBlur(r)},f=async()=>{c&&c(t,r),await h.onFocus(r)},v=d.length>0;return i?w.jsx(be,{id:t,type:"date",value:r||"",required:n,disabled:o,readOnly:i,"aria-invalid":v,className:J(v&&"border-destructive focus-visible:ring-destructive/20")}):w.jsx(Qg,{id:t,value:r||"",placeholder:"Select a date",disabled:o,onChange:p,onBlur:x,onFocus:f,"aria-invalid":v,className:J(v&&"border-destructive focus-visible:ring-destructive/20")})}function wo(e){const{id:t,value:r,required:n,disabled:o,readonly:i,onChange:a,onBlur:s,onFocus:c,options:l,rawErrors:d=[],schema:u}=e,h=ve(t,u),p=async g=>{const y=g.target.value===""?l.emptyValue:g.target.value;a(y),await h.onChange(y)},x=async g=>{const y=g.target.value;s&&s(t,y),await h.onBlur(y)},f=async g=>{const y=g.target.value;c&&c(t,y),await h.onFocus(y)},v=d.length>0;return w.jsx(be,{id:t,type:"datetime-local",value:r||"",required:n,disabled:o,readOnly:i,onChange:p,onBlur:x,onFocus:f,"aria-invalid":v,className:J(v&&"border-destructive focus-visible:ring-destructive/20")})}function zc(e){const{id:t,required:r,disabled:n,readonly:o,onChange:i,onBlur:a,onFocus:s,options:c,rawErrors:l=[],schema:d}=e,u=ve(t,d),h=async g=>{const y=g.target.files;if(y&&y.length>0){const b=y[0],O=new FileReader;O.onload=async()=>{const S=O.result;i(S),await u.onChange(S)},O.readAsDataURL(b)}},p=async g=>{const y=g.target.value;a&&a(t,y),await u.onBlur(y)},x=async g=>{const y=g.target.value;s&&s(t,y),await u.onFocus(y)},f=l.length>0,v=typeof c.accept=="string"?c.accept:"*/*";return w.jsx(be,{id:t,type:"file",required:r,disabled:n,readOnly:o,accept:v,onChange:h,onBlur:p,onFocus:x,"aria-invalid":f,className:J("file:mr-4 file:py-1 file:px-2 file:rounded file:border-0 file:text-sm file:font-medium file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100",f&&"border-destructive focus-visible:ring-destructive/20")})}const qc={TextWidget:Bc,TextareaWidget:$c,SelectWidget:Rc,CheckboxWidget:Vc,RadioWidget:Hc,UpDownWidget:Uc,FileWidget:zc,tel:go,email:vo,url:yo,password:bo,date:Yc,"datetime-local":wo,TelWidget:go,EmailWidget:vo,URLWidget:yo,PasswordWidget:bo,DateWidget:Yc,DateTimeWidget:wo},Kc={color:xi,file:Ci,range:Vi,rating:Hi,...qc},Zg={small:"space-y-2",medium:"space-y-4",large:"space-y-6"},Jg=({children:e,spacing:t="medium",className:r=""})=>w.jsx("div",{className:J("flex flex-col",Zg[t],r),children:e}),ev={small:"space-x-2",medium:"space-x-4",large:"space-x-6"},tv={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},rv=({children:e,spacing:t="medium",align:r="center",className:n=""})=>w.jsx("div",{className:J("flex flex-row",ev[t],tv[r],n),children:e}),nv={small:"gap-2",medium:"gap-4",large:"gap-6"},ov=({children:e,columns:t="auto-fit",gap:r="medium",minItemWidth:n="250px",className:o=""})=>{const i={display:"grid"};return typeof t=="number"?i.gridTemplateColumns=`repeat(${t}, 1fr)`:i.gridTemplateColumns=`repeat(${t}, minmax(${n}, 1fr))`,w.jsx("div",{className:J("grid",nv[r],o),style:i,children:e})};class iv{constructor(t){wt(this,"handlers");this.handlers=t}async handleBeforeSubmit(t){return this.handlers.beforeSubmit?await this.handlers.beforeSubmit(t):t}async handleAfterSubmit(t){this.handlers.afterSubmit&&await this.handlers.afterSubmit(t)}async handleBeforeValidation(t){return this.handlers.beforeValidation?await this.handlers.beforeValidation(t):t}async handleAfterValidation(t,r){this.handlers.afterValidation&&await this.handlers.afterValidation(t,r)}}class Gc{constructor(t,r={},n=[]){wt(this,"formHandlers");wt(this,"fieldHandlers");wt(this,"webhooks");wt(this,"debounceTimers",new Map);wt(this,"webhookQueue",[]);wt(this,"isProcessingQueue",!1);this.formHandlers=t,this.fieldHandlers=r,this.webhooks=n}async handleBeforeSubmit(t){return this.formHandlers.beforeSubmit?await this.formHandlers.beforeSubmit(t):t}async handleAfterSubmit(t){this.formHandlers.afterSubmit&&await this.formHandlers.afterSubmit(t)}async handleBeforeValidation(t){return this.formHandlers.beforeValidation?await this.formHandlers.beforeValidation(t):t}async handleAfterValidation(t,r){this.formHandlers.afterValidation&&await this.formHandlers.afterValidation(t,r)}async handleFieldEvent(t,r,n,o,i,a){const s={eventType:t,fieldId:r,fieldValue:n,schema:o,formData:i,timestamp:Date.now(),fieldPath:a};try{switch(t){case"focus":this.fieldHandlers.onFieldFocus&&await this.fieldHandlers.onFieldFocus(s);break;case"blur":this.fieldHandlers.onFieldBlur&&await this.fieldHandlers.onFieldBlur(s);break;case"change":this.fieldHandlers.onFieldChange&&await this.fieldHandlers.onFieldChange(s);break}}catch(c){console.error(`Error in field event handler (${t}):`,c)}this.processWebhooks(s)}processWebhooks(t){const r=this.webhooks.filter(n=>!n.events||n.events.includes(t.eventType));for(const n of r)n.debounceMs&&n.debounceMs>0?this.debounceWebhook(n,t):this.queueWebhook(n,t)}debounceWebhook(t,r){const n=`${t.url}-${r.fieldId}-${r.eventType}`;this.debounceTimers.has(n)&&clearTimeout(this.debounceTimers.get(n));const o=setTimeout(()=>{this.queueWebhook(t,r),this.debounceTimers.delete(n)},t.debounceMs);this.debounceTimers.set(n,o)}queueWebhook(t,r){this.webhookQueue.push({config:t,event:r,retryCount:0}),this.isProcessingQueue||this.processWebhookQueue()}async processWebhookQueue(){if(!(this.isProcessingQueue||this.webhookQueue.length===0)){for(this.isProcessingQueue=!0;this.webhookQueue.length>0;){const t=this.webhookQueue.shift();try{await this.callWebhook(t.config,t.event)}catch(r){const n=t.config.retries||3;t.retryCount<n?(t.retryCount++,setTimeout(()=>{this.webhookQueue.push(t)},Math.pow(2,t.retryCount)*1e3)):console.error(`Webhook failed after ${n} retries:`,r)}}this.isProcessingQueue=!1}}async callWebhook(t,r){const n={event:r,timestamp:Date.now(),source:"extended-dynamic-forms"},o={method:t.method||"POST",headers:{"Content-Type":"application/json",...t.headers},body:JSON.stringify(n)};t.timeout&&(o.signal=AbortSignal.timeout(t.timeout));const i=await fetch(t.url,o);if(!i.ok)throw new Error(`Webhook request failed: ${i.status} ${i.statusText}`)}createFieldEventHandlers(t,r,n,o){return{onFocus:i=>this.handleFieldEvent("focus",t,i,r,n,o),onBlur:i=>this.handleFieldEvent("blur",t,i,r,n,o),onChange:i=>this.handleFieldEvent("change",t,i,r,n,o)}}cleanup(){for(const t of this.debounceTimers.values())clearTimeout(t);this.debounceTimers.clear()}}const Xc={cloneFormData:e=>JSON.parse(JSON.stringify(e)),mergeFormData:(e,t)=>({...e,...t}),getNestedValue:(e,t)=>{const r=t.split(".");let n=e;for(const o of r)if(n&&typeof n=="object"&&o in n)n=n[o];else return;return n},setNestedValue:(e,t,r)=>{const n=t.split("."),o={...e};let i=o;for(let a=0;a<n.length-1;a++){const s=n[a];(!(s in i)||typeof i[s]!="object")&&(i[s]={}),i=i[s]}return i[n[n.length-1]]=r,o},removeEmptyValues:e=>{if(Array.isArray(e))return e.filter(t=>t!=null&&t!=="");if(e!==null&&typeof e=="object"){const t={};for(const[r,n]of Object.entries(e))n!=null&&n!==""&&(t[r]=Xc.removeEmptyValues(n));return t}return e}},Qc={getRequiredFields:e=>e.required||[],isFieldRequired:(e,t)=>(e.required||[]).includes(t),getFieldSchema:(e,t)=>{const r=t.split(".");let n=e;for(const o of r)if(n.type==="object"&&n.properties)n=n.properties[o];else if(n.type==="array"&&n.items)n=n.items;else return;return n},mergeSchemas:(e,t)=>({...e,...t,properties:{...e.properties,...t.properties},required:[...new Set([...e.required||[],...t.required||[]])]}),getAllFieldPaths:(e,t="")=>{const r=[];if(e.type==="object"&&e.properties)for(const[n,o]of Object.entries(e.properties)){const i=t?`${t}.${n}`:n;r.push(i),r.push(...Qc.getAllFieldPaths(o,i))}return r}},av={isValidEmail:e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),isValidPhone:e=>/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/.test(e),isValidUrl:e=>{try{return new URL(e),!0}catch{return!1}},isValidDate:e=>{const t=new Date(e);return t instanceof Date&&!isNaN(t.getTime())},isInRange:(e,t,r)=>!(t!==void 0&&e<t||r!==void 0&&e>r),getValidationMessage:(e,t)=>({required:"This field is required",email:"Please enter a valid email address",phone:"Please enter a valid phone number",url:"Please enter a valid URL",date:"Please enter a valid date",min:`Value must be at least ${t==null?void 0:t.min}`,max:`Value must be at most ${t==null?void 0:t.max}`,minLength:`Must be at least ${t==null?void 0:t.minLength} characters`,maxLength:`Must be at most ${t==null?void 0:t.maxLength} characters`})[e]||"Invalid value"},Zc=({schema:e,uiSchema:t,formData:r,onSubmit:n,onChange:o,onError:i,onBlur:a,onFocus:s,beforeSubmit:c,afterSubmit:l,beforeValidation:d,afterValidation:u,onFieldFocus:h,onFieldBlur:p,onFieldChange:x,webhooks:f=[],widgets:v={},fields:g={},templates:y={},...b})=>{const O=D.useRef(null),S=D.useMemo(()=>{const U=new Gc({beforeSubmit:c,afterSubmit:l,beforeValidation:d,afterValidation:u},{onFieldFocus:h,onFieldBlur:p,onFieldChange:x},f);return O.current=U,U},[c,l,d,u,h,p,x,f]);D.useEffect(()=>()=>{O.current&&O.current.cleanup()},[]);const T=async(U,R)=>{const K=await S.handleBeforeSubmit(U);n&&await n(K,R),await S.handleAfterSubmit(K)},P=U=>{o&&o(U)},L={...Kc,...v},$={...bi,...g},B={...wi,...y};return w.jsx(di,{eventHub:S,formData:r,children:w.jsx(bl,{schema:e,uiSchema:t,formData:r,validator:Yo,onSubmit:T,onChange:P,onError:i,onBlur:a,onFocus:s,widgets:L,fields:$,templates:B,...b})})};function sv(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var _e={},it={},gr={},xo={};Object.defineProperty(xo,"__esModule",{value:!0});function cv(e){for(var t=e.length,r=5381,n=52711,o;t--;)o=e.charCodeAt(t),r=r*33^o,n=n*33^o;return(r>>>0)*4096+(n>>>0)}var vr="|",lv=/\[object ([HTML|SVG](.*)Element)\]/,uv={"[object Arguments]":0,"[object Array]":1,"[object ArrayBuffer]":2,"[object AsyncFunction]":3,"[object AsyncGeneratorFunction]":4,"[object BigInt]":5,"[object BigInt64Array]":6,"[object BigUint64Array]":7,"[object Boolean]":8,"[object DataView]":9,"[object Date]":10,"[object DocumentFragment]":11,"[object Error]":12,"[object Event]":13,"[object Float32Array]":14,"[object Float64Array]":15,"[object Function]":16,"[object Generator]":17,"[object GeneratorFunction]":18,"[object Int8Array]":19,"[object Int16Array]":20,"[object Map]":21,"[object Number]":22,"[object Object]":23,"[object Promise]":24,"[object RegExp]":25,"[object Set]":26,"[object SharedArrayBuffer]":27,"[object String]":28,"[object Uint8Array]":29,"[object Uint8ClampedArray]":30,"[object Uint16Array]":31,"[object Uint32Array]":32,"[object WeakMap]":33,"[object WeakRef]":34,"[object WeakSet]":35,CUSTOM:36,ELEMENT:37},dv={"[object Arguments]":1,"[object Array]":2},Jc={"[object Generator]":1,"[object Promise]":2,"[object WeakMap]":3,"[object WeakRef]":4,"[object WeakSet]":5},fv={"[object AsyncFunction]":1,"[object AsyncGeneratorFunction]":2,"[object Boolean]":3,"[object Function]":4,"[object GeneratorFunction]":5,"[object Number]":6,"[object String]":7},hv={"[object BigInt64Array]":1,"[object BigUint64Array]":2,"[object Float32Array]":3,"[object Float64Array]":4,"[object Int8Array]":5,"[object Int16Array]":6,"[object Uint8Array]":7,"[object Uint8ClampedArray]":8,"[object Uint16Array]":9,"[object Uint32Array]":10},pv={"[object Arguments]":1,"[object Array]":2,"[object ArrayBuffer]":3,"[object BigInt64Array]":4,"[object BigUint64Array]":5,"[object DataView]":6,"[object Float32Array]":7,"[object Float64Array]":8,"[object Int8Array]":9,"[object Int16Array]":10,"[object Map]":11,"[object Object]":12,"[object Set]":13,"[object SharedArrayBuffer]":14,"[object Uint8Array]":15,"[object Uint8ClampedArray]":16,"[object Uint16Array]":17,"[object Uint32Array]":18,CUSTOM:19},yr={bigint:"i",boolean:"b",empty:"e",function:"g",number:"n",object:"o",string:"s",symbol:"s"};function mv(e,t){return e[0]>t[0]}function el(e,t){return e>t}function Eo(e,t){for(var r,n,o=0;o<e.length;++o){for(n=e[o],r=o-1;~r&&t(e[r],n);--r)e[r+1]=e[r];e[r+1]=n}return e}function xe(e,t){return yr.object+vr+uv[e]+vr+t}var tl=new WeakMap,gv=0;function Co(e,t){var r=tl.get(e);if(r)return r;var n=xe(t,"NOT_ENUMERABLE"+vr+gv++);return tl.set(e,n),n}var vv=Object.prototype.toString;function yv(e,t,r){if(pv[t])return rl(t,e,r);if(t==="[object Date]")return xe(t,e.getTime());if(t==="[object RegExp]")return xe(t,e.toString());if(t==="[object Event]")return xe(t,[e.bubbles,e.cancelBubble,e.cancelable,e.composed,e.currentTarget,e.defaultPrevented,e.eventPhase,e.isTrusted,e.returnValue,e.target,e.type].join());if(t==="[object Error]")return xe(t,e.message+vr+e.stack);if(t==="[object DocumentFragment]")return xe(t,Cv(e));var n=t.match(lv);return n?xe("ELEMENT",n[1]+vr+e.outerHTML):Jc[t]?Co(e,t):fv[t]?xe(t,e.toString()):rl("CUSTOM",e,r)}function rl(e,t,r){var n=r.cache.get(t);return n?xe(e,"RECURSIVE~"+n):(r.cache.set(t,++r.id),e==="[object Object]"?t[Symbol.iterator]?Co(t,e):xe(e,ol(t,r)):dv[e]?xe(e,bv(t,r)):e==="[object Map]"?xe(e,Sv(t,r)):e==="[object Set]"?xe(e,Ov(t,r)):hv[e]?xe(e,t.join()):e==="[object ArrayBuffer]"?xe(e,nl(t)):e==="[object DataView]"?xe(e,nl(t.buffer)):Jc[e]?Co(t,e):xe("CUSTOM",ol(t,r)))}function bv(e,t){for(var r=e.length,n=new Array(r);--r>=0;)n[r]=qt(e[r],t);return n.join()}function wv(e){return Buffer.from(e).toString("utf8")}function xv(e){return String.fromCharCode.apply(null,new Uint16Array(e))}function Ev(){return"UNSUPPORTED"}function Cv(e){for(var t=e.children,r=t.length,n=new Array(r);--r>=0;)n[r]=t[r].outerHTML;return n.join()}var nl=typeof Buffer<"u"&&typeof Buffer.from=="function"?wv:typeof Uint16Array=="function"?xv:Ev;function Sv(e,t){var r=new Array(e.size),n=0;for(e.forEach(function(o,i){r[n++]=[qt(i,t),qt(o,t)]}),Eo(r,mv);--n>=0;)r[n]="["+r[n][0]+","+r[n][1]+"]";return"["+r.join()+"]"}function ol(e,t){for(var r=Eo(Object.getOwnPropertyNames(e),el),n=r.length,o=new Array(n),i=n;--i>=0;)o[i]=r[i]+":"+qt(e[r[i]],t);return"{"+o.join()+"}"}function Ov(e,t){var r=new Array(e.size),n=0;return e.forEach(function(o){r[n++]=qt(o,t)}),"["+Eo(r,el).join()+"]"}function qt(e,t){var r=typeof e;return e==null||r==="undefined"?yr.empty+e:r==="object"?yv(e,vv.call(e),t||{cache:new WeakMap,id:1}):r==="function"||r==="symbol"?yr[r]+e.toString():r==="boolean"?yr.boolean+ +e:yr[r]+e}function _v(e){return cv(qt(e,void 0))}xo.default=_v,Object.defineProperty(gr,"__esModule",{value:!0});var kv=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Pv=xo,Mv=Av(Pv);function Av(e){return e&&e.__esModule?e:{default:e}}function Nv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var So=function(){function e(t,r,n){Nv(this,e),this.id=t;var o={cache:!0};if(typeof n>"u"&&(n=o),typeof r!="function"?(this.value=r,this.type=this.constructor.CONSTANT):(this.calculationMethod=r,this.type=this.constructor.DYNAMIC),!this.id)throw new Error("factId required");return this.priority=parseInt(n.priority||1,10),this.options=Object.assign({},o,n),this.cacheKeyMethod=this.defaultCacheKeys,this}return kv(e,[{key:"isConstant",value:function(){return this.type===this.constructor.CONSTANT}},{key:"isDynamic",value:function(){return this.type===this.constructor.DYNAMIC}},{key:"calculate",value:function(r,n){return Object.prototype.hasOwnProperty.call(this,"value")?this.value:this.calculationMethod(r,n)}},{key:"defaultCacheKeys",value:function(r,n){return{params:n,id:r}}},{key:"getCacheKey",value:function(r){if(this.options.cache===!0){var n=this.cacheKeyMethod(this.id,r),o=e.hashFromObject(n);return o}}}],[{key:"hashFromObject",value:function(r){return(0,Mv.default)(r)}}]),e}();So.CONSTANT="CONSTANT",So.DYNAMIC="DYNAMIC",gr.default=So;var tn={},rn={},_t={};Object.defineProperty(_t,"__esModule",{value:!0});function Dv(){try{if(typeof process<"u"&&process.env&&process.env.DEBUG&&process.env.DEBUG.match(/json-rules-engine/)||typeof window<"u"&&window.localStorage&&window.localStorage.debug&&window.localStorage.debug.match(/json-rules-engine/))return console.debug.bind(console)}catch{}return function(){}}_t.default=Dv(),Object.defineProperty(rn,"__esModule",{value:!0});var Tv=function(){function e(t,r){var n=[],o=!0,i=!1,a=void 0;try{for(var s=t[Symbol.iterator](),c;!(o=(c=s.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){i=!0,a=l}finally{try{!o&&s.return&&s.return()}finally{if(i)throw a}}return n}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Fv=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Iv=_t,Wv=jv(Iv);function jv(e){return e&&e.__esModule?e:{default:e}}function Lv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Bv=function(){function e(t){if(Lv(this,e),!t)throw new Error("Condition: constructor options required");var r=e.booleanOperator(t);if(Object.assign(this,t),r){var n=t[r],o=Array.isArray(n);if(r!=="not"&&!o)throw new Error('"'+r+'" must be an array');if(r==="not"&&o)throw new Error('"'+r+'" cannot be an array');this.operator=r,this.priority=parseInt(t.priority,10)||1,o?this[r]=n.map(function(i){return new e(i)}):this[r]=new e(n)}else if(!Object.prototype.hasOwnProperty.call(t,"condition")){if(!Object.prototype.hasOwnProperty.call(t,"fact"))throw new Error('Condition: constructor "fact" property required');if(!Object.prototype.hasOwnProperty.call(t,"operator"))throw new Error('Condition: constructor "operator" property required');if(!Object.prototype.hasOwnProperty.call(t,"value"))throw new Error('Condition: constructor "value" property required');Object.prototype.hasOwnProperty.call(t,"priority")&&(t.priority=parseInt(t.priority,10))}}return Fv(e,[{key:"toJSON",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n={};this.priority&&(n.priority=this.priority),this.name&&(n.name=this.name);var o=e.booleanOperator(this);return o?Array.isArray(this[o])?n[o]=this[o].map(function(i){return i.toJSON(!1)}):n[o]=this[o].toJSON(!1):this.isConditionReference()?n.condition=this.condition:(n.operator=this.operator,n.value=this.value,n.fact=this.fact,this.factResult!==void 0&&(n.factResult=this.factResult),this.valueResult!==void 0&&(n.valueResult=this.valueResult),this.result!==void 0&&(n.result=this.result),this.params&&(n.params=this.params),this.path&&(n.path=this.path)),r?JSON.stringify(n):n}},{key:"evaluate",value:function(r,n){var o=this;if(!r)return Promise.reject(new Error("almanac required"));if(!n)return Promise.reject(new Error("operatorMap required"));if(this.isBooleanOperator())return Promise.reject(new Error("Cannot evaluate() a boolean condition"));var i=n.get(this.operator);return i?Promise.all([r.getValue(this.value),r.factValue(this.fact,this.params,this.path)]).then(function(a){var s=Tv(a,2),c=s[0],l=s[1],d=i.evaluate(l,c);return(0,Wv.default)("condition::evaluate",{leftHandSideValue:l,operator:o.operator,rightHandSideValue:c,result:d}),{result:d,leftHandSideValue:l,rightHandSideValue:c,operator:o.operator}}):Promise.reject(new Error("Unknown operator: "+this.operator))}},{key:"booleanOperator",value:function(){return e.booleanOperator(this)}},{key:"isBooleanOperator",value:function(){return e.booleanOperator(this)!==void 0}},{key:"isConditionReference",value:function(){return Object.prototype.hasOwnProperty.call(this,"condition")}}],[{key:"booleanOperator",value:function(r){if(Object.prototype.hasOwnProperty.call(r,"any"))return"any";if(Object.prototype.hasOwnProperty.call(r,"all"))return"all";if(Object.prototype.hasOwnProperty.call(r,"not"))return"not"}}]),e}();rn.default=Bv;var Oo={},il={exports:{}};(function(e){var t=function(){function r(h,p){return p!=null&&h instanceof p}var n;try{n=Map}catch{n=function(){}}var o;try{o=Set}catch{o=function(){}}var i;try{i=Promise}catch{i=function(){}}function a(h,p,x,f,v){typeof p=="object"&&(x=p.depth,f=p.prototype,v=p.includeNonEnumerable,p=p.circular);var g=[],y=[],b=typeof Buffer<"u";typeof p>"u"&&(p=!0),typeof x>"u"&&(x=1/0);function O(S,T){if(S===null)return null;if(T===0)return S;var P,L;if(typeof S!="object")return S;if(r(S,n))P=new n;else if(r(S,o))P=new o;else if(r(S,i))P=new i(function(Z,m){S.then(function(C){Z(O(C,T-1))},function(C){m(O(C,T-1))})});else if(a.__isArray(S))P=[];else if(a.__isRegExp(S))P=new RegExp(S.source,u(S)),S.lastIndex&&(P.lastIndex=S.lastIndex);else if(a.__isDate(S))P=new Date(S.getTime());else{if(b&&Buffer.isBuffer(S))return Buffer.allocUnsafe?P=Buffer.allocUnsafe(S.length):P=new Buffer(S.length),S.copy(P),P;r(S,Error)?P=Object.create(S):typeof f>"u"?(L=Object.getPrototypeOf(S),P=Object.create(L)):(P=Object.create(f),L=f)}if(p){var $=g.indexOf(S);if($!=-1)return y[$];g.push(S),y.push(P)}r(S,n)&&S.forEach(function(Z,m){var C=O(m,T-1),_=O(Z,T-1);P.set(C,_)}),r(S,o)&&S.forEach(function(Z){var m=O(Z,T-1);P.add(m)});for(var B in S){var U;L&&(U=Object.getOwnPropertyDescriptor(L,B)),!(U&&U.set==null)&&(P[B]=O(S[B],T-1))}if(Object.getOwnPropertySymbols)for(var R=Object.getOwnPropertySymbols(S),B=0;B<R.length;B++){var K=R[B],ee=Object.getOwnPropertyDescriptor(S,K);ee&&!ee.enumerable&&!v||(P[K]=O(S[K],T-1),ee.enumerable||Object.defineProperty(P,K,{enumerable:!1}))}if(v)for(var H=Object.getOwnPropertyNames(S),B=0;B<H.length;B++){var X=H[B],ee=Object.getOwnPropertyDescriptor(S,X);ee&&ee.enumerable||(P[X]=O(S[X],T-1),Object.defineProperty(P,X,{enumerable:!1}))}return P}return O(h,x)}a.clonePrototype=function(p){if(p===null)return null;var x=function(){};return x.prototype=p,new x};function s(h){return Object.prototype.toString.call(h)}a.__objToStr=s;function c(h){return typeof h=="object"&&s(h)==="[object Date]"}a.__isDate=c;function l(h){return typeof h=="object"&&s(h)==="[object Array]"}a.__isArray=l;function d(h){return typeof h=="object"&&s(h)==="[object RegExp]"}a.__isRegExp=d;function u(h){var p="";return h.global&&(p+="g"),h.ignoreCase&&(p+="i"),h.multiline&&(p+="m"),p}return a.__getRegExpFlags=u,a}();e.exports&&(e.exports=t)})(il);var al=il.exports;Object.defineProperty(Oo,"__esModule",{value:!0});var $v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rv=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Vv=al,nn=Hv(Vv);function Hv(e){return e&&e.__esModule?e:{default:e}}function Uv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Yv=function(){function e(t,r,n,o){Uv(this,e),this.conditions=(0,nn.default)(t),this.event=(0,nn.default)(r),this.priority=(0,nn.default)(n),this.name=(0,nn.default)(o),this.result=null}return Rv(e,[{key:"setResult",value:function(r){this.result=r}},{key:"resolveEventParams",value:function(r){var n=this;if(this.event.params!==null&&$v(this.event.params)==="object"){var o=[],i=function(c){Object.prototype.hasOwnProperty.call(n.event.params,c)&&o.push(r.getValue(n.event.params[c]).then(function(l){return n.event.params[c]=l}))};for(var a in this.event.params)i(a);return Promise.all(o)}return Promise.resolve()}},{key:"toJSON",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n={conditions:this.conditions.toJSON(!1),event:this.event,priority:this.priority,name:this.name,result:this.result};return r?JSON.stringify(n):n}}]),e}();Oo.default=Yv;var sl={exports:{}};/*!
|
|
107
107
|
* EventEmitter2
|
|
108
108
|
* https://github.com/hij1nx/EventEmitter2
|
|
109
109
|
*
|
|
110
110
|
* Copyright (c) 2013 hij1nx
|
|
111
111
|
* Licensed under the MIT license.
|
|
112
|
-
*/(function(e,t){(function(r){var n=Object.hasOwnProperty,o=Array.isArray?Array.isArray:function(C){return Object.prototype.toString.call(C)==="[object Array]"},i=10,a=typeof process=="object"&&typeof process.nextTick=="function",s=typeof Symbol=="function",c=typeof Reflect=="object",l=typeof setImmediate=="function",d=l?setImmediate:setTimeout,u=s?c&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(m){var C=Object.getOwnPropertyNames(m);return C.push.apply(C,Object.getOwnPropertySymbols(m)),C}:Object.keys;function h(){this._events={},this._conf&&p.call(this,this._conf)}function p(m){m&&(this._conf=m,m.delimiter&&(this.delimiter=m.delimiter),m.maxListeners!==r&&(this._maxListeners=m.maxListeners),m.wildcard&&(this.wildcard=m.wildcard),m.newListener&&(this._newListener=m.newListener),m.removeListener&&(this._removeListener=m.removeListener),m.verboseMemoryLeak&&(this.verboseMemoryLeak=m.verboseMemoryLeak),m.ignoreErrors&&(this.ignoreErrors=m.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function x(m,C){var _="(node) warning: possible EventEmitter memory leak detected. "+m+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(_+=" Event name: "+C+"."),typeof process<"u"&&process.emitWarning){var k=new Error(_);k.name="MaxListenersExceededWarning",k.emitter=this,k.count=m,process.emitWarning(k)}else console.error(_),console.trace&&console.trace()}var f=function(m,C,_){var k=arguments.length;switch(k){case 0:return[];case 1:return[m];case 2:return[m,C];case 3:return[m,C,_];default:for(var M=new Array(k);k--;)M[k]=arguments[k];return M}};function v(m,C){for(var _={},k,M=m.length,F=0,I=0;I<M;I++)k=m[I],_[k]=I<F?C[I]:r;return _}function g(m,C,_){this._emitter=m,this._target=C,this._listeners={},this._listenersCount=0;var k,M;if((_.on||_.off)&&(k=_.on,M=_.off),C.addEventListener?(k=C.addEventListener,M=C.removeEventListener):C.addListener?(k=C.addListener,M=C.removeListener):C.on&&(k=C.on,M=C.off),!k&&!M)throw Error("target does not implement any known event API");if(typeof k!="function")throw TypeError("on method must be a function");if(typeof M!="function")throw TypeError("off method must be a function");this._on=k,this._off=M;var F=m._observers;F?F.push(this):m._observers=[this]}Object.assign(g.prototype,{subscribe:function(m,C,_){var k=this,M=this._target,F=this._emitter,I=this._listeners,j=function(){var W=f.apply(null,arguments),A={data:W,name:C,original:m};if(_){var R=_.call(M,A);R!==!1&&F.emit.apply(F,[A.name].concat(W));return}F.emit.apply(F,[C].concat(W))};if(I[m])throw Error("Event '"+m+"' is already listening");this._listenersCount++,F._newListener&&F._removeListener&&!k._onNewListener?(this._onNewListener=function(W){W===C&&I[m]===null&&(I[m]=j,k._on.call(M,m,j))},F.on("newListener",this._onNewListener),this._onRemoveListener=function(W){W===C&&!F.hasListeners(W)&&I[m]&&(I[m]=null,k._off.call(M,m,j))},I[m]=null,F.on("removeListener",this._onRemoveListener)):(I[m]=j,k._on.call(M,m,j))},unsubscribe:function(m){var C=this,_=this._listeners,k=this._emitter,M,F,I=this._off,j=this._target,W;if(m&&typeof m!="string")throw TypeError("event must be a string");function A(){C._onNewListener&&(k.off("newListener",C._onNewListener),k.off("removeListener",C._onRemoveListener),C._onNewListener=null,C._onRemoveListener=null);var R=L.call(k,C);k._observers.splice(R,1)}if(m){if(M=_[m],!M)return;I.call(j,m,M),delete _[m],--this._listenersCount||A()}else{for(F=u(_),W=F.length;W-- >0;)m=F[W],I.call(j,m,_[m]);this._listeners={},this._listenersCount=0,A()}}});function y(m,C,_,k){var M=Object.assign({},C);if(!m)return M;if(typeof m!="object")throw TypeError("options must be an object");var F=Object.keys(m),I=F.length,j,W,A;function R(q){throw Error('Invalid "'+j+'" option value'+(q?". Reason: "+q:""))}for(var re=0;re<I;re++){if(j=F[re],!n.call(C,j))throw Error('Unknown "'+j+'" option');W=m[j],W!==r&&(A=_[j],M[j]=A?A(W,R):W)}return M}function b(m,C){return(typeof m!="function"||!m.hasOwnProperty("prototype"))&&C("value must be a constructor"),m}function O(m){var C="value must be type of "+m.join("|"),_=m.length,k=m[0],M=m[1];return _===1?function(F,I){if(typeof F===k)return F;I(C)}:_===2?function(F,I){var j=typeof F;if(j===k||j===M)return F;I(C)}:function(F,I){for(var j=typeof F,W=_;W-- >0;)if(j===m[W])return F;I(C)}}var S=O(["function"]),T=O(["object","function"]);function P(m,C,_){var k,M,F=0,I,j=new m(function(W,A,R){_=y(_,{timeout:0,overload:!1},{timeout:function(Q,se){return Q*=1,(typeof Q!="number"||Q<0||!Number.isFinite(Q))&&se("timeout must be a positive number"),Q}}),k=!_.overload&&typeof m.prototype.cancel=="function"&&typeof R=="function";function re(){M&&(M=null),F&&(clearTimeout(F),F=0)}var q=function(Q){re(),W(Q)},z=function(Q){re(),A(Q)};k?C(q,z,R):(M=[function(Q){z(Q||Error("canceled"))}],C(q,z,function(Q){if(I)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof Q!="function")throw TypeError("onCancel callback must be a function");M.push(Q)}),I=!0),_.timeout>0&&(F=setTimeout(function(){var Q=Error("timeout");Q.code="ETIMEDOUT",F=0,j.cancel(Q),A(Q)},_.timeout))});return k||(j.cancel=function(W){if(M){for(var A=M.length,R=1;R<A;R++)M[R](W);M[0](W),M=null}}),j}function L(m){var C=this._observers;if(!C)return-1;for(var _=C.length,k=0;k<_;k++)if(C[k]._target===m)return k;return-1}function H(m,C,_,k,M){if(!_)return null;if(k===0){var F=typeof C;if(F==="string"){var I,j,W=0,A=0,R=this.delimiter,re=R.length;if((j=C.indexOf(R))!==-1){I=new Array(5);do I[W++]=C.slice(A,j),A=j+re;while((j=C.indexOf(R,A))!==-1);I[W++]=C.slice(A),C=I,M=W}else C=[C],M=1}else F==="object"?M=C.length:(C=[C],M=1)}var q=null,z,Q,se,Ee,Le,Ne=C[k],Be=C[k+1],De,ye;if(k===M)_._listeners&&(typeof _._listeners=="function"?(m&&m.push(_._listeners),q=[_]):(m&&m.push.apply(m,_._listeners),q=[_]));else if(Ne==="*"){for(De=u(_),j=De.length;j-- >0;)z=De[j],z!=="_listeners"&&(ye=H(m,C,_[z],k+1,M),ye&&(q?q.push.apply(q,ye):q=ye));return q}else if(Ne==="**"){for(Le=k+1===M||k+2===M&&Be==="*",Le&&_._listeners&&(q=H(m,C,_,M,M)),De=u(_),j=De.length;j-- >0;)z=De[j],z!=="_listeners"&&(z==="*"||z==="**"?(_[z]._listeners&&!Le&&(ye=H(m,C,_[z],M,M),ye&&(q?q.push.apply(q,ye):q=ye)),ye=H(m,C,_[z],k,M)):z===Be?ye=H(m,C,_[z],k+2,M):ye=H(m,C,_[z],k,M),ye&&(q?q.push.apply(q,ye):q=ye));return q}else _[Ne]&&(q=H(m,C,_[Ne],k+1,M));if(Q=_["*"],Q&&H(m,C,Q,k+1,M),se=_["**"],se)if(k<M)for(se._listeners&&H(m,C,se,M,M),De=u(se),j=De.length;j-- >0;)z=De[j],z!=="_listeners"&&(z===Be?H(m,C,se[z],k+2,M):z===Ne?H(m,C,se[z],k+1,M):(Ee={},Ee[z]=se[z],H(m,C,{"**":Ee},k+1,M)));else se._listeners?H(m,C,se,M,M):se["*"]&&se["*"]._listeners&&H(m,C,se["*"],M,M);return q}function B(m,C,_){var k=0,M=0,F,I=this.delimiter,j=I.length,W;if(typeof m=="string")if((F=m.indexOf(I))!==-1){W=new Array(5);do W[k++]=m.slice(M,F),M=F+j;while((F=m.indexOf(I,M))!==-1);W[k++]=m.slice(M)}else W=[m],k=1;else W=m,k=m.length;if(k>1){for(F=0;F+1<k;F++)if(W[F]==="**"&&W[F+1]==="**")return}var A=this.listenerTree,R;for(F=0;F<k;F++)if(R=W[F],A=A[R]||(A[R]={}),F===k-1)return A._listeners?(typeof A._listeners=="function"&&(A._listeners=[A._listeners]),_?A._listeners.unshift(C):A._listeners.push(C),!A._listeners.warned&&this._maxListeners>0&&A._listeners.length>this._maxListeners&&(A._listeners.warned=!0,x.call(this,A._listeners.length,R))):A._listeners=C,!0;return!0}function U(m,C,_,k){for(var M=u(m),F=M.length,I,j,W,A=m._listeners,R;F-- >0;)j=M[F],I=m[j],j==="_listeners"?W=_:W=_?_.concat(j):[j],R=k||typeof j=="symbol",A&&C.push(R?W:W.join(this.delimiter)),typeof I=="object"&&U.call(this,I,C,W,R);return C}function $(m){for(var C=u(m),_=C.length,k,M,F;_-- >0;)M=C[_],k=m[M],k&&(F=!0,M!=="_listeners"&&!$(k)&&delete m[M]);return F}function K(m,C,_){this.emitter=m,this.event=C,this.listener=_}K.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function ee(m,C,_){if(_===!0)M=!0;else if(_===!1)k=!0;else{if(!_||typeof _!="object")throw TypeError("options should be an object or true");var k=_.async,M=_.promisify,F=_.nextTick,I=_.objectify}if(k||F||M){var j=C,W=C._origin||C;if(F&&!a)throw Error("process.nextTick is not supported");M===r&&(M=C.constructor.name==="AsyncFunction"),C=function(){var A=arguments,R=this,re=this.event;return M?F?Promise.resolve():new Promise(function(q){d(q)}).then(function(){return R.event=re,j.apply(R,A)}):(F?process.nextTick:d)(function(){R.event=re,j.apply(R,A)})},C._async=!0,C._origin=W}return[C,I?new K(this,m,C):this]}function V(m){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,p.call(this,m)}V.EventEmitter2=V,V.prototype.listenTo=function(m,C,_){if(typeof m!="object")throw TypeError("target musts be an object");var k=this;_=y(_,{on:r,off:r,reducers:r},{on:S,off:S,reducers:T});function M(F){if(typeof F!="object")throw TypeError("events must be an object");var I=_.reducers,j=L.call(k,m),W;j===-1?W=new g(k,m,_):W=k._observers[j];for(var A=u(F),R=A.length,re,q=typeof I=="function",z=0;z<R;z++)re=A[z],W.subscribe(re,F[re]||re,q?I:I&&I[re])}return o(C)?M(v(C)):M(typeof C=="string"?v(C.split(/\s+/)):C),this},V.prototype.stopListeningTo=function(m,C){var _=this._observers;if(!_)return!1;var k=_.length,M,F=!1;if(m&&typeof m!="object")throw TypeError("target should be an object");for(;k-- >0;)M=_[k],(!m||M._target===m)&&(M.unsubscribe(C),F=!0);return F},V.prototype.delimiter=".",V.prototype.setMaxListeners=function(m){m!==r&&(this._maxListeners=m,this._conf||(this._conf={}),this._conf.maxListeners=m)},V.prototype.getMaxListeners=function(){return this._maxListeners},V.prototype.event="",V.prototype.once=function(m,C,_){return this._once(m,C,!1,_)},V.prototype.prependOnceListener=function(m,C,_){return this._once(m,C,!0,_)},V.prototype._once=function(m,C,_,k){return this._many(m,1,C,_,k)},V.prototype.many=function(m,C,_,k){return this._many(m,C,_,!1,k)},V.prototype.prependMany=function(m,C,_,k){return this._many(m,C,_,!0,k)},V.prototype._many=function(m,C,_,k,M){var F=this;if(typeof _!="function")throw new Error("many only accepts instances of Function");function I(){return--C===0&&F.off(m,I),_.apply(this,arguments)}return I._origin=_,this._on(m,I,k,M)},V.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var m=arguments[0],C,_=this.wildcard,k,M,F,I,j;if(m==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(_&&(C=m,m!=="newListener"&&m!=="removeListener"&&typeof m=="object")){if(M=m.length,s){for(F=0;F<M;F++)if(typeof m[F]=="symbol"){j=!0;break}}j||(m=m.join(this.delimiter))}var W=arguments.length,A;if(this._all&&this._all.length)for(A=this._all.slice(),F=0,M=A.length;F<M;F++)switch(this.event=m,W){case 1:A[F].call(this,m);break;case 2:A[F].call(this,m,arguments[1]);break;case 3:A[F].call(this,m,arguments[1],arguments[2]);break;default:A[F].apply(this,arguments)}if(_)A=[],H.call(this,A,C,this.listenerTree,0,M);else if(A=this._events[m],typeof A=="function"){switch(this.event=m,W){case 1:A.call(this);break;case 2:A.call(this,arguments[1]);break;case 3:A.call(this,arguments[1],arguments[2]);break;default:for(k=new Array(W-1),I=1;I<W;I++)k[I-1]=arguments[I];A.apply(this,k)}return!0}else A&&(A=A.slice());if(A&&A.length){if(W>3)for(k=new Array(W-1),I=1;I<W;I++)k[I-1]=arguments[I];for(F=0,M=A.length;F<M;F++)switch(this.event=m,W){case 1:A[F].call(this);break;case 2:A[F].call(this,arguments[1]);break;case 3:A[F].call(this,arguments[1],arguments[2]);break;default:A[F].apply(this,k)}return!0}else if(!this.ignoreErrors&&!this._all&&m==="error")throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},V.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var m=arguments[0],C=this.wildcard,_,k,M,F,I,j;if(m==="newListener"&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(C&&(_=m,m!=="newListener"&&m!=="removeListener"&&typeof m=="object")){if(F=m.length,s){for(I=0;I<F;I++)if(typeof m[I]=="symbol"){k=!0;break}}k||(m=m.join(this.delimiter))}var W=[],A=arguments.length,R;if(this._all)for(I=0,F=this._all.length;I<F;I++)switch(this.event=m,A){case 1:W.push(this._all[I].call(this,m));break;case 2:W.push(this._all[I].call(this,m,arguments[1]));break;case 3:W.push(this._all[I].call(this,m,arguments[1],arguments[2]));break;default:W.push(this._all[I].apply(this,arguments))}if(C?(R=[],H.call(this,R,_,this.listenerTree,0)):R=this._events[m],typeof R=="function")switch(this.event=m,A){case 1:W.push(R.call(this));break;case 2:W.push(R.call(this,arguments[1]));break;case 3:W.push(R.call(this,arguments[1],arguments[2]));break;default:for(M=new Array(A-1),j=1;j<A;j++)M[j-1]=arguments[j];W.push(R.apply(this,M))}else if(R&&R.length){if(R=R.slice(),A>3)for(M=new Array(A-1),j=1;j<A;j++)M[j-1]=arguments[j];for(I=0,F=R.length;I<F;I++)switch(this.event=m,A){case 1:W.push(R[I].call(this));break;case 2:W.push(R[I].call(this,arguments[1]));break;case 3:W.push(R[I].call(this,arguments[1],arguments[2]));break;default:W.push(R[I].apply(this,M))}}else if(!this.ignoreErrors&&!this._all&&m==="error")return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(W)},V.prototype.on=function(m,C,_){return this._on(m,C,!1,_)},V.prototype.prependListener=function(m,C,_){return this._on(m,C,!0,_)},V.prototype.onAny=function(m){return this._onAny(m,!1)},V.prototype.prependAny=function(m){return this._onAny(m,!0)},V.prototype.addListener=V.prototype.on,V.prototype._onAny=function(m,C){if(typeof m!="function")throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),C?this._all.unshift(m):this._all.push(m),this},V.prototype._on=function(m,C,_,k){if(typeof m=="function")return this._onAny(m,C),this;if(typeof C!="function")throw new Error("on only accepts instances of Function");this._events||h.call(this);var M=this,F;return k!==r&&(F=ee.call(this,m,C,k),C=F[0],M=F[1]),this._newListener&&this.emit("newListener",m,C),this.wildcard?(B.call(this,m,C,_),M):(this._events[m]?(typeof this._events[m]=="function"&&(this._events[m]=[this._events[m]]),_?this._events[m].unshift(C):this._events[m].push(C),!this._events[m].warned&&this._maxListeners>0&&this._events[m].length>this._maxListeners&&(this._events[m].warned=!0,x.call(this,this._events[m].length,m))):this._events[m]=C,M)},V.prototype.off=function(m,C){if(typeof C!="function")throw new Error("removeListener only takes instances of Function");var _,k=[];if(this.wildcard){var M=typeof m=="string"?m.split(this.delimiter):m.slice();if(k=H.call(this,null,M,this.listenerTree,0),!k)return this}else{if(!this._events[m])return this;_=this._events[m],k.push({_listeners:_})}for(var F=0;F<k.length;F++){var I=k[F];if(_=I._listeners,o(_)){for(var j=-1,W=0,A=_.length;W<A;W++)if(_[W]===C||_[W].listener&&_[W].listener===C||_[W]._origin&&_[W]._origin===C){j=W;break}if(j<0)continue;return this.wildcard?I._listeners.splice(j,1):this._events[m].splice(j,1),_.length===0&&(this.wildcard?delete I._listeners:delete this._events[m]),this._removeListener&&this.emit("removeListener",m,C),this}else(_===C||_.listener&&_.listener===C||_._origin&&_._origin===C)&&(this.wildcard?delete I._listeners:delete this._events[m],this._removeListener&&this.emit("removeListener",m,C))}return this.listenerTree&&$(this.listenerTree),this},V.prototype.offAny=function(m){var C=0,_=0,k;if(m&&this._all&&this._all.length>0){for(k=this._all,C=0,_=k.length;C<_;C++)if(m===k[C])return k.splice(C,1),this._removeListener&&this.emit("removeListenerAny",m),this}else{if(k=this._all,this._removeListener)for(C=0,_=k.length;C<_;C++)this.emit("removeListenerAny",k[C]);this._all=[]}return this},V.prototype.removeListener=V.prototype.off,V.prototype.removeAllListeners=function(m){if(m===r)return!this._events||h.call(this),this;if(this.wildcard){var C=H.call(this,null,m,this.listenerTree,0),_,k;if(!C)return this;for(k=0;k<C.length;k++)_=C[k],_._listeners=null;this.listenerTree&&$(this.listenerTree)}else this._events&&(this._events[m]=null);return this},V.prototype.listeners=function(m){var C=this._events,_,k,M,F,I;if(m===r){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!C)return[];for(_=u(C),F=_.length,M=[];F-- >0;)k=C[_[F]],typeof k=="function"?M.push(k):M.push.apply(M,k);return M}else{if(this.wildcard){if(I=this.listenerTree,!I)return[];var j=[],W=typeof m=="string"?m.split(this.delimiter):m.slice();return H.call(this,j,W,I,0),j}return C?(k=C[m],k?typeof k=="function"?[k]:k:[]):[]}},V.prototype.eventNames=function(m){var C=this._events;return this.wildcard?U.call(this,this.listenerTree,[],null,m):C?u(C):[]},V.prototype.listenerCount=function(m){return this.listeners(m).length},V.prototype.hasListeners=function(m){if(this.wildcard){var C=[],_=typeof m=="string"?m.split(this.delimiter):m.slice();return H.call(this,C,_,this.listenerTree,0),C.length>0}var k=this._events,M=this._all;return!!(M&&M.length||k&&(m===r?u(k).length:k[m]))},V.prototype.listenersAny=function(){return this._all?this._all:[]},V.prototype.waitFor=function(m,C){var _=this,k=typeof C;return k==="number"?C={timeout:C}:k==="function"&&(C={filter:C}),C=y(C,{timeout:0,filter:r,handleError:!1,Promise,overload:!1},{filter:S,Promise:b}),P(C.Promise,function(M,F,I){function j(){var W=C.filter;if(!(W&&!W.apply(_,arguments)))if(_.off(m,j),C.handleError){var A=arguments[0];A?F(A):M(f.apply(null,arguments).slice(1))}else M(f.apply(null,arguments))}I(function(){_.off(m,j)}),_._on(m,j,!1)},{timeout:C.timeout,overload:C.overload})};function X(m,C,_){_=y(_,{Promise,timeout:0,overload:!1},{Promise:b});var k=_.Promise;return P(k,function(M,F,I){var j;if(typeof m.addEventListener=="function"){j=function(){M(f.apply(null,arguments))},I(function(){m.removeEventListener(C,j)}),m.addEventListener(C,j,{once:!0});return}var W=function(){A&&m.removeListener("error",A),M(f.apply(null,arguments))},A;C!=="error"&&(A=function(R){m.removeListener(C,W),F(R)},m.once("error",A)),I(function(){A&&m.removeListener("error",A),m.removeListener(C,W)}),m.once(C,W)},{timeout:_.timeout,overload:_.overload})}var Z=V.prototype;Object.defineProperties(V,{defaultMaxListeners:{get:function(){return Z._maxListeners},set:function(m){if(typeof m!="number"||m<0||Number.isNaN(m))throw TypeError("n must be a non-negative number");Z._maxListeners=m},enumerable:!0},once:{value:X,writable:!0,configurable:!0}}),Object.defineProperties(Z,{_maxListeners:{value:i,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=V})()})(al);var sl=al.exports;Object.defineProperty(tn,"__esModule",{value:!0});var Yv=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),zv=rn,qv=br(zv),Kv=Oo,Gv=br(Kv),Xv=_t,Qv=br(Xv),Zv=il,Jv=br(Zv),ey=sl,ty=br(ey);function br(e){return e&&e.__esModule?e:{default:e}}function ry(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ny(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function oy(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var iy=function(e){oy(t,e);function t(r){ry(this,t);var n=ny(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));typeof r=="string"&&(r=JSON.parse(r)),r&&r.conditions&&n.setConditions(r.conditions),r&&r.onSuccess&&n.on("success",r.onSuccess),r&&r.onFailure&&n.on("failure",r.onFailure),r&&(r.name||r.name===0)&&n.setName(r.name);var o=r&&r.priority||1;n.setPriority(o);var i=r&&r.event||{type:"unknown"};return n.setEvent(i),n}return Yv(t,[{key:"setPriority",value:function(n){if(n=parseInt(n,10),n<=0)throw new Error("Priority must be greater than zero");return this.priority=n,this}},{key:"setName",value:function(n){if(!n&&n!==0)throw new Error('Rule "name" must be defined');return this.name=n,this}},{key:"setConditions",value:function(n){if(!Object.prototype.hasOwnProperty.call(n,"all")&&!Object.prototype.hasOwnProperty.call(n,"any")&&!Object.prototype.hasOwnProperty.call(n,"not")&&!Object.prototype.hasOwnProperty.call(n,"condition"))throw new Error('"conditions" root must contain a single instance of "all", "any", "not", or "condition"');return this.conditions=new qv.default(n),this}},{key:"setEvent",value:function(n){if(!n)throw new Error("Rule: setEvent() requires event object");if(!Object.prototype.hasOwnProperty.call(n,"type"))throw new Error('Rule: setEvent() requires event object with "type" property');return this.ruleEvent={type:n.type},this.event=this.ruleEvent,n.params&&(this.ruleEvent.params=n.params),this}},{key:"getEvent",value:function(){return this.ruleEvent}},{key:"getPriority",value:function(){return this.priority}},{key:"getConditions",value:function(){return this.conditions}},{key:"getEngine",value:function(){return this.engine}},{key:"setEngine",value:function(n){return this.engine=n,this}},{key:"toJSON",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,o={conditions:this.conditions.toJSON(!1),priority:this.priority,event:this.ruleEvent,name:this.name};return n?JSON.stringify(o):o}},{key:"prioritizeConditions",value:function(n){var o=this,i=n.reduce(function(a,s){var c=s.priority;if(!c){var l=o.engine.getFact(s.fact);c=l&&l.priority||1}return a[c]||(a[c]=[]),a[c].push(s),a},{});return Object.keys(i).sort(function(a,s){return Number(a)>Number(s)?-1:1}).map(function(a){return i[a]})}},{key:"evaluate",value:function(n){var o=this,i=new Gv.default(this.conditions,this.ruleEvent,this.priority,this.name),a=function(f){if(f.isConditionReference())return h(f);if(f.isBooleanOperator()){var v=f[f.operator],g=void 0;return f.operator==="all"?g=d(v):f.operator==="any"?g=l(v):g=u(v),g.then(function(y){var b=y===!0;return f.result=b,b})}else return f.evaluate(n,o.engine.operators).then(function(y){var b=y.result;return f.factResult=y.leftHandSideValue,f.valueResult=y.rightHandSideValue,f.result=b,b})},s=function(f,v){return Array.isArray(f)||(f=[f]),Promise.all(f.map(function(g){return a(g)})).then(function(g){return(0,Qv.default)("rule::evaluateConditions",{results:g}),v.call(g,function(y){return y===!0})})},c=function(f,v){if(f.length===0)return Promise.resolve(!0);if(f.length===1)return a(f[0]);for(var g=o.prioritizeConditions(f),y=Promise.resolve(v==="all"),b=function(T){var P=g[T];y=y.then(function(L){return v==="any"?L||s(P,Array.prototype.some):L&&s(P,Array.prototype.every)})},O=0;O<g.length;O++)b(O);return y},l=function(f){return c(f,"any")},d=function(f){return c(f,"all")},u=function(f){return c([f],"not").then(function(v){return!v})},h=function(f){var v=o.engine.conditions.get(f.condition);if(v)return delete f.condition,Object.assign(f,(0,Jv.default)(v)),a(f);if(o.engine.allowUndefinedConditions)return f.result=!1,Promise.resolve(!1);throw new Error("No condition "+f.condition+" exists")},p=function(f){i.setResult(f);var v=Promise.resolve();o.engine.replaceFactsInEventParams&&(v=i.resolveEventParams(n));var g=f?"success":"failure";return v.then(function(){return o.emitAsync(g,i.event,n,i)}).then(function(){return i})};return i.conditions.any?l(i.conditions.any).then(function(x){return p(x)}):i.conditions.all?d(i.conditions.all).then(function(x){return p(x)}):i.conditions.not?u(i.conditions.not).then(function(x){return p(x)}):h(i.conditions).then(function(x){return p(x)})}}]),t}(ty.default);tn.default=iy;var on={},_o={};Object.defineProperty(_o,"__esModule",{value:!0});function ay(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sy(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function cy(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}_o.UndefinedFactError=function(e){cy(t,e);function t(){var r;ay(this,t);for(var n=arguments.length,o=Array(n),i=0;i<n;i++)o[i]=arguments[i];var a=sy(this,(r=t.__proto__||Object.getPrototypeOf(t)).call.apply(r,[this].concat(o)));return a.code="UNDEFINED_FACT",a}return t}(Error);class ly{add(t,r,n){if(typeof arguments[0]!="string")for(let o in arguments[0])this.add(o,arguments[0][o],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(o){this[o]=this[o]||[],r&&this[o][n?"unshift":"push"](r)},this)}run(t,r){this[t]=this[t]||[],this[t].forEach(function(n){n.call(r&&r.context?r.context:r,r)})}}class uy{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach(o=>{if(typeof o!="object"||!o.name||!o.init)throw new Error("Invalid JSEP plugin format");this.registered[o.name]||(o.init(this.jsep),this.registered[o.name]=o)})}}class N{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+N.version}static addUnaryOp(t){return N.max_unop_len=Math.max(t.length,N.max_unop_len),N.unary_ops[t]=1,N}static addBinaryOp(t,r,n){return N.max_binop_len=Math.max(t.length,N.max_binop_len),N.binary_ops[t]=r,n?N.right_associative.add(t):N.right_associative.delete(t),N}static addIdentifierChar(t){return N.additional_identifier_chars.add(t),N}static addLiteral(t,r){return N.literals[t]=r,N}static removeUnaryOp(t){return delete N.unary_ops[t],t.length===N.max_unop_len&&(N.max_unop_len=N.getMaxKeyLen(N.unary_ops)),N}static removeAllUnaryOps(){return N.unary_ops={},N.max_unop_len=0,N}static removeIdentifierChar(t){return N.additional_identifier_chars.delete(t),N}static removeBinaryOp(t){return delete N.binary_ops[t],t.length===N.max_binop_len&&(N.max_binop_len=N.getMaxKeyLen(N.binary_ops)),N.right_associative.delete(t),N}static removeAllBinaryOps(){return N.binary_ops={},N.max_binop_len=0,N}static removeLiteral(t){return delete N.literals[t],N}static removeAllLiterals(){return N.literals={},N}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new N(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(r=>r.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return N.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!N.binary_ops[String.fromCharCode(t)]||N.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return N.isIdentifierStart(t)||N.isDecimalDigit(t)}throwError(t){const r=new Error(t+" at character "+this.index);throw r.index=this.index,r.description=t,r}runHook(t,r){if(N.hooks[t]){const n={context:this,node:r};return N.hooks.run(t,n),n.node}return r}searchHook(t){if(N.hooks[t]){const r={context:this};return N.hooks[t].find(function(n){return n.call(r.context,r),r.node}),r.node}}gobbleSpaces(){let t=this.code;for(;t===N.SPACE_CODE||t===N.TAB_CODE||t===N.LF_CODE||t===N.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),r=t.length===1?t[0]:{type:N.COMPOUND,body:t};return this.runHook("after-all",r)}gobbleExpressions(t){let r=[],n,o;for(;this.index<this.expr.length;)if(n=this.code,n===N.SEMCOL_CODE||n===N.COMMA_CODE)this.index++;else if(o=this.gobbleExpression())r.push(o);else if(this.index<this.expr.length){if(n===t)break;this.throwError('Unexpected "'+this.char+'"')}return r}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,N.max_binop_len),r=t.length;for(;r>0;){if(N.binary_ops.hasOwnProperty(t)&&(!N.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!N.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=r,t;t=t.substr(0,--r)}return!1}gobbleBinaryExpression(){let t,r,n,o,i,a,s,c,l;if(a=this.gobbleToken(),!a||(r=this.gobbleBinaryOp(),!r))return a;for(i={value:r,prec:N.binaryPrecedence(r),right_a:N.right_associative.has(r)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+r),o=[a,i,s];r=this.gobbleBinaryOp();){if(n=N.binaryPrecedence(r),n===0){this.index-=r.length;break}i={value:r,prec:n,right_a:N.right_associative.has(r)},l=r;const d=u=>i.right_a&&u.right_a?n>u.prec:n<=u.prec;for(;o.length>2&&d(o[o.length-2]);)s=o.pop(),r=o.pop().value,a=o.pop(),t={type:N.BINARY_EXP,operator:r,left:a,right:s},o.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+l),o.push(i,t)}for(c=o.length-1,t=o[c];c>1;)t={type:N.BINARY_EXP,operator:o[c-1].value,left:o[c-2],right:t},c-=2;return t}gobbleToken(){let t,r,n,o;if(this.gobbleSpaces(),o=this.searchHook("gobble-token"),o)return this.runHook("after-token",o);if(t=this.code,N.isDecimalDigit(t)||t===N.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===N.SQUOTE_CODE||t===N.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===N.OBRACK_CODE)o=this.gobbleArray();else{for(r=this.expr.substr(this.index,N.max_unop_len),n=r.length;n>0;){if(N.unary_ops.hasOwnProperty(r)&&(!N.isIdentifierStart(this.code)||this.index+r.length<this.expr.length&&!N.isIdentifierPart(this.expr.charCodeAt(this.index+r.length)))){this.index+=n;const i=this.gobbleToken();return i||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:N.UNARY_EXP,operator:r,argument:i,prefix:!0})}r=r.substr(0,--n)}N.isIdentifierStart(t)?(o=this.gobbleIdentifier(),N.literals.hasOwnProperty(o.name)?o={type:N.LITERAL,value:N.literals[o.name],raw:o.name}:o.name===N.this_str&&(o={type:N.THIS_EXP})):t===N.OPAREN_CODE&&(o=this.gobbleGroup())}return o?(o=this.gobbleTokenProperty(o),this.runHook("after-token",o)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let r=this.code;for(;r===N.PERIOD_CODE||r===N.OBRACK_CODE||r===N.OPAREN_CODE||r===N.QUMARK_CODE;){let n;if(r===N.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==N.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),r=this.code}this.index++,r===N.OBRACK_CODE?(t={type:N.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),r=this.code,r!==N.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):r===N.OPAREN_CODE?t={type:N.CALL_EXP,arguments:this.gobbleArguments(N.CPAREN_CODE),callee:t}:(r===N.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),t={type:N.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),n&&(t.optional=!0),this.gobbleSpaces(),r=this.code}return t}gobbleNumericLiteral(){let t="",r,n;for(;N.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===N.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);N.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(r=this.char,r==="e"||r==="E"){for(t+=this.expr.charAt(this.index++),r=this.char,(r==="+"||r==="-")&&(t+=this.expr.charAt(this.index++));N.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);N.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return n=this.code,N.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(n===N.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===N.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:N.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";const r=this.index,n=this.expr.charAt(this.index++);let o=!1;for(;this.index<this.expr.length;){let i=this.expr.charAt(this.index++);if(i===n){o=!0;break}else if(i==="\\")switch(i=this.expr.charAt(this.index++),i){case"n":t+=`
|
|
113
|
-
`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=i}else t+=i}return o||this.throwError('Unclosed quote after "'+t+'"'),{type:N.LITERAL,value:t,raw:this.expr.substring(r,this.index)}}gobbleIdentifier(){let t=this.code,r=this.index;for(N.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,N.isIdentifierPart(t));)this.index++;return{type:N.IDENTIFIER,name:this.expr.slice(r,this.index)}}gobbleArguments(t){const r=[];let n=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let i=this.code;if(i===t){n=!0,this.index++,t===N.CPAREN_CODE&&o&&o>=r.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(i===N.COMMA_CODE){if(this.index++,o++,o!==r.length){if(t===N.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===N.CBRACK_CODE)for(let a=r.length;a<o;a++)r.push(null)}}else if(r.length!==o&&o!==0)this.throwError("Expected comma");else{const a=this.gobbleExpression();(!a||a.type===N.COMPOUND)&&this.throwError("Expected comma"),r.push(a)}}return n||this.throwError("Expected "+String.fromCharCode(t)),r}gobbleGroup(){this.index++;let t=this.gobbleExpressions(N.CPAREN_CODE);if(this.code===N.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:N.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:N.ARRAY_EXP,elements:this.gobbleArguments(N.CBRACK_CODE)}}}const dy=new ly;Object.assign(N,{hooks:dy,plugins:new uy(N),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),N.max_unop_len=N.getMaxKeyLen(N.unary_ops),N.max_binop_len=N.getMaxKeyLen(N.binary_ops);const at=e=>new N(e).parse(),fy=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(N).filter(e=>!fy.includes(e)&&at[e]===void 0).forEach(e=>{at[e]=N[e]}),at.Jsep=N;const hy="ConditionalExpression";var py={name:"ternary",init(e){e.hooks.add("after-expression",function(r){if(r.node&&this.code===e.QUMARK_CODE){this.index++;const n=r.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),r.node={type:hy,test:n,consequent:o,alternate:i},n.operator&&e.binary_ops[n.operator]<=.9){let a=n;for(;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;r.node.test=a.right,a.right=r.node,r.node=n}}else this.throwError("Expected :")}})}};at.plugins.register(py);const cl=47,my=92;var gy={name:"regex",init(e){e.hooks.add("gobble-token",function(r){if(this.code===cl){const n=++this.index;let o=!1;for(;this.index<this.expr.length;){if(this.code===cl&&!o){const i=this.expr.slice(n,this.index);let a="";for(;++this.index<this.expr.length;){const c=this.code;if(c>=97&&c<=122||c>=65&&c<=90||c>=48&&c<=57)a+=this.char;else break}let s;try{s=new RegExp(i,a)}catch(c){this.throwError(c.message)}return r.node={type:e.LITERAL,value:s,raw:this.expr.slice(n-1,this.index)},r.node=this.gobbleTokenProperty(r.node),r.node}this.code===e.OBRACK_CODE?o=!0:o&&this.code===e.CBRACK_CODE&&(o=!1),this.index+=this.code===my?2:1}this.throwError("Unclosed Regex")}})}};const ko=43,Kt={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[ko,45],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];Kt.assignmentOperators.forEach(n=>e.addBinaryOp(n,Kt.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(o){const i=this.code;Kt.updateOperators.some(a=>a===i&&a===this.expr.charCodeAt(this.index+1))&&(this.index+=2,o.node={type:"UpdateExpression",operator:i===ko?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!o.node.argument||!t.includes(o.node.argument.type))&&this.throwError(`Unexpected ${o.node.operator}`))}),e.hooks.add("after-token",function(o){if(o.node){const i=this.code;Kt.updateOperators.some(a=>a===i&&a===this.expr.charCodeAt(this.index+1))&&(t.includes(o.node.type)||this.throwError(`Unexpected ${o.node.operator}`),this.index+=2,o.node={type:"UpdateExpression",operator:i===ko?"++":"--",argument:o.node,prefix:!1})}}),e.hooks.add("after-expression",function(o){o.node&&r(o.node)});function r(n){Kt.assignmentOperators.has(n.operator)?(n.type="AssignmentExpression",r(n.left),r(n.right)):n.operator||Object.values(n).forEach(o=>{o&&typeof o=="object"&&r(o)})}}};at.plugins.register(gy,Kt),at.addUnaryOp("typeof"),at.addLiteral("null",null),at.addLiteral("undefined",void 0);const vy=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),fe={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return fe.evalBinaryExpression(e,t);case"Compound":return fe.evalCompound(e,t);case"ConditionalExpression":return fe.evalConditionalExpression(e,t);case"Identifier":return fe.evalIdentifier(e,t);case"Literal":return fe.evalLiteral(e,t);case"MemberExpression":return fe.evalMemberExpression(e,t);case"UnaryExpression":return fe.evalUnaryExpression(e,t);case"ArrayExpression":return fe.evalArrayExpression(e,t);case"CallExpression":return fe.evalCallExpression(e,t);case"AssignmentExpression":return fe.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression(e,t){return{"||":(n,o)=>n||o(),"&&":(n,o)=>n&&o(),"|":(n,o)=>n|o(),"^":(n,o)=>n^o(),"&":(n,o)=>n&o(),"==":(n,o)=>n==o(),"!=":(n,o)=>n!=o(),"===":(n,o)=>n===o(),"!==":(n,o)=>n!==o(),"<":(n,o)=>n<o(),">":(n,o)=>n>o(),"<=":(n,o)=>n<=o(),">=":(n,o)=>n>=o(),"<<":(n,o)=>n<<o(),">>":(n,o)=>n>>o(),">>>":(n,o)=>n>>>o(),"+":(n,o)=>n+o(),"-":(n,o)=>n-o(),"*":(n,o)=>n*o(),"/":(n,o)=>n/o(),"%":(n,o)=>n%o()}[e.operator](fe.evalAst(e.left,t),()=>fe.evalAst(e.right,t))},evalCompound(e,t){let r;for(let n=0;n<e.body.length;n++){e.body[n].type==="Identifier"&&["var","let","const"].includes(e.body[n].name)&&e.body[n+1]&&e.body[n+1].type==="AssignmentExpression"&&(n+=1);const o=e.body[n];r=fe.evalAst(o,t)}return r},evalConditionalExpression(e,t){return fe.evalAst(e.test,t)?fe.evalAst(e.consequent,t):fe.evalAst(e.alternate,t)},evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral(e){return e.value},evalMemberExpression(e,t){const r=String(e.computed?fe.evalAst(e.property):e.property.name),n=fe.evalAst(e.object,t);if(n==null)throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);if(!Object.hasOwn(n,r)&&vy.has(r))throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);const o=n[r];return typeof o=="function"?o.bind(n):o},evalUnaryExpression(e,t){return{"-":n=>-fe.evalAst(n,t),"!":n=>!fe.evalAst(n,t),"~":n=>~fe.evalAst(n,t),"+":n=>+fe.evalAst(n,t),typeof:n=>typeof fe.evalAst(n,t)}[e.operator](e.argument)},evalArrayExpression(e,t){return e.elements.map(r=>fe.evalAst(r,t))},evalCallExpression(e,t){const r=e.arguments.map(o=>fe.evalAst(o,t));return fe.evalAst(e.callee,t)(...r)},evalAssignmentExpression(e,t){if(e.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const r=e.left.name,n=fe.evalAst(e.right,t);return t[r]=n,t[r]}};class yy{constructor(t){this.code=t,this.ast=at(this.code)}runInNewContext(t){const r=Object.assign(Object.create(null),t);return fe.evalAst(this.ast,r)}}function yt(e,t){return e=e.slice(),e.push(t),e}function Po(e,t){return t=t.slice(),t.unshift(e),t}class by extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}}function ae(e,t,r,n,o){if(!(this instanceof ae))try{return new ae(e,t,r,n,o)}catch(a){if(!a.avoidNew)throw a;return a.value}typeof e=="string"&&(o=n,n=r,r=t,t=e,e=null);const i=e&&typeof e=="object";if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?"safe":e.eval,this.ignoreEvalErrors=typeof e.ignoreEvalErrors>"u"?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){const a={path:i?e.path:t};i?"json"in e&&(a.json=e.json):a.json=r;const s=this.evaluate(a);if(!s||typeof s!="object")throw new by(s);return s}}ae.prototype.evaluate=function(e,t,r,n){let o=this.parent,i=this.parentProperty,{flatten:a,wrap:s}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),a=Object.hasOwn(e,"flatten")?e.flatten:a,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,s=Object.hasOwn(e,"wrap")?e.wrap:s,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,r=Object.hasOwn(e,"callback")?e.callback:r,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=Object.hasOwn(e,"parent")?e.parent:o,i=Object.hasOwn(e,"parentProperty")?e.parentProperty:i,e=e.path}if(o=o||null,i=i||null,Array.isArray(e)&&(e=ae.toPathString(e)),!e&&e!==""||!t)return;const c=ae.toPathArray(e);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;const l=this._trace(c,t,["$"],o,i,r).filter(function(d){return d&&!d.isParentSelector});return l.length?!s&&l.length===1&&!l[0].hasArrExpr?this._getPreferredOutput(l[0]):l.reduce((d,u)=>{const h=this._getPreferredOutput(u);return a&&Array.isArray(h)?d=d.concat(h):d.push(h),d},[]):s?[]:void 0},ae.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const r=Array.isArray(e.path)?e.path:ae.toPathArray(e.path);return e.pointer=ae.toPointer(r),e.path=typeof e.path=="string"?e.path:ae.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return ae.toPathString(e[t]);case"pointer":return ae.toPointer(e.path);default:throw new TypeError("Unknown result type")}},ae.prototype._handleCallback=function(e,t,r){if(t){const n=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:ae.toPathString(e.path),t(n,r,e)}},ae.prototype._trace=function(e,t,r,n,o,i,a,s){let c;if(!e.length)return c={path:r,value:t,parent:n,parentProperty:o,hasArrExpr:a},this._handleCallback(c,i,"value"),c;const l=e[0],d=e.slice(1),u=[];function h(p){Array.isArray(p)?p.forEach(x=>{u.push(x)}):u.push(p)}if((typeof l!="string"||s)&&t&&Object.hasOwn(t,l))h(this._trace(d,t[l],yt(r,l),t,l,i,a));else if(l==="*")this._walk(t,p=>{h(this._trace(d,t[p],yt(r,p),t,p,i,!0,!0))});else if(l==="..")h(this._trace(d,t,r,n,o,i,a)),this._walk(t,p=>{typeof t[p]=="object"&&h(this._trace(e.slice(),t[p],yt(r,p),t,p,i,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:d,isParentSelector:!0};if(l==="~")return c={path:yt(r,l),value:o,parent:n,parentProperty:null},this._handleCallback(c,i,"property"),c;if(l==="$")h(this._trace(d,t,r,null,null,i,a));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))h(this._slice(l,d,t,r,n,o,i));else if(l.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const p=l.replace(/^\?\((.*?)\)$/u,"$1"),x=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(p);x?this._walk(t,f=>{const v=[x[2]],g=x[1]?t[f][x[1]]:t[f];this._trace(v,g,r,n,o,i,!0).length>0&&h(this._trace(d,t[f],yt(r,f),t,f,i,!0))}):this._walk(t,f=>{this._eval(p,t[f],f,r,n,o)&&h(this._trace(d,t[f],yt(r,f),t,f,i,!0))})}else if(l[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(Po(this._eval(l,t,r.at(-1),r.slice(0,-1),n,o),d),t,r,n,o,i,a))}else if(l[0]==="@"){let p=!1;const x=l.slice(1,-2);switch(x){case"scalar":(!t||!["object","function"].includes(typeof t))&&(p=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===x&&(p=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(p=!0);break;case"number":Number.isFinite(t)&&(p=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(p=!0);break;case"object":t&&typeof t===x&&(p=!0);break;case"array":Array.isArray(t)&&(p=!0);break;case"other":p=this.currOtherTypeCallback(t,r,n,o);break;case"null":t===null&&(p=!0);break;default:throw new TypeError("Unknown value type "+x)}if(p)return c={path:r,value:t,parent:n,parentProperty:o},this._handleCallback(c,i,"value"),c}else if(l[0]==="`"&&t&&Object.hasOwn(t,l.slice(1))){const p=l.slice(1);h(this._trace(d,t[p],yt(r,p),t,p,i,a,!0))}else if(l.includes(",")){const p=l.split(",");for(const x of p)h(this._trace(Po(x,d),t,r,n,o,i,!0))}else!s&&t&&Object.hasOwn(t,l)&&h(this._trace(d,t[l],yt(r,l),t,l,i,a,!0))}if(this._hasParentSelector)for(let p=0;p<u.length;p++){const x=u[p];if(x&&x.isParentSelector){const f=this._trace(x.expr,t,x.path,n,o,i,a);if(Array.isArray(f)){u[p]=f[0];const v=f.length;for(let g=1;g<v;g++)p++,u.splice(p,0,f[g])}else u[p]=f}}return u},ae.prototype._walk=function(e,t){if(Array.isArray(e)){const r=e.length;for(let n=0;n<r;n++)t(n)}else e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t(r)})},ae.prototype._slice=function(e,t,r,n,o,i,a){if(!Array.isArray(r))return;const s=r.length,c=e.split(":"),l=c[2]&&Number.parseInt(c[2])||1;let d=c[0]&&Number.parseInt(c[0])||0,u=c[1]&&Number.parseInt(c[1])||s;d=d<0?Math.max(0,d+s):Math.min(s,d),u=u<0?Math.max(0,u+s):Math.min(s,u);const h=[];for(let p=d;p<u;p+=l)this._trace(Po(p,t),r,n,o,i,a,!0).forEach(f=>{h.push(f)});return h},ae.prototype._eval=function(e,t,r,n,o,i){this.currSandbox._$_parentProperty=i,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;const a=e.includes("@path");a&&(this.currSandbox._$_path=ae.toPathString(n.concat([r])));const s=this.currEval+"Script:"+e;if(!ae.cache[s]){let c=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(a&&(c=c.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)ae.cache[s]=new this.safeVm.Script(c);else if(this.currEval==="native")ae.cache[s]=new this.vm.Script(c);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const l=this.currEval;ae.cache[s]=new l(c)}else if(typeof this.currEval=="function")ae.cache[s]={runInNewContext:l=>this.currEval(c,l)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return ae.cache[s].runInNewContext(this.currSandbox)}catch(c){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+c.message+": "+e)}},ae.cache={},ae.toPathString=function(e){const t=e,r=t.length;let n="$";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(n+=/^[0-9*]+$/u.test(t[o])?"["+t[o]+"]":"['"+t[o]+"']");return n},ae.toPointer=function(e){const t=e,r=t.length;let n="";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(n+="/"+t[o].toString().replaceAll("~","~0").replaceAll("/","~1"));return n},ae.toPathArray=function(e){const{cache:t}=ae;if(t[e])return t[e].concat();const r=[],o=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(i,a){return"[#"+(r.push(a)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(i,a){return"['"+a.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(i,a){return";"+a.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(i){const a=i.match(/#(\d+)/u);return!a||!a[1]?i:r[a[1]]});return t[e]=o,t[e].concat()},ae.prototype.safeVm={Script:yy};const wy=function(e,t,r){const n=e.length;for(let o=0;o<n;o++){const i=e[o];r(i)&&t.push(e.splice(o--,1)[0])}};class xy{constructor(t){this.code=t}runInNewContext(t){let r=this.code;const n=Object.keys(t),o=[];wy(n,o,l=>typeof t[l]=="function");const i=n.map(l=>t[l]);r=o.reduce((l,d)=>{let u=t[d].toString();return/function/u.test(u)||(u="function "+u),"var "+d+"="+u+";"+l},"")+r,!/(['"])use strict\1/u.test(r)&&!n.includes("arguments")&&(r="var arguments = undefined;"+r),r=r.replace(/;\s*$/u,"");const s=r.lastIndexOf(";"),c=s!==-1?r.slice(0,s+1)+" return "+r.slice(s+1):" return "+r;return new Function(...n,c)(...i)}}ae.prototype.vm={Script:xy};const Ey=av(Object.freeze(Object.defineProperty({__proto__:null,JSONPath:ae},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(on,"__esModule",{value:!0});var Mo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cy=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Sy=gr,Ao=ll(Sy),Oy=_o,_y=_t,kt=ll(_y),ky=Ey;function ll(e){return e&&e.__esModule?e:{default:e}}function Py(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function My(e,t){return(0,ky.JSONPath)({path:t,json:e,wrap:!1})}var Ay=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Py(this,e),this.factMap=new Map,this.factResultsCache=new Map,this.allowUndefinedFacts=!!t.allowUndefinedFacts,this.pathResolver=t.pathResolver||My,this.events={success:[],failure:[]},this.ruleResults=[]}return Cy(e,[{key:"addEvent",value:function(r,n){if(!n)throw new Error('outcome required: "success" | "failure"]');this.events[n].push(r)}},{key:"getEvents",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return r?this.events[r]:this.events.success.concat(this.events.failure)}},{key:"addResult",value:function(r){this.ruleResults.push(r)}},{key:"getResults",value:function(){return this.ruleResults}},{key:"_getFact",value:function(r){return this.factMap.get(r)}},{key:"_addConstantFact",value:function(r){this.factMap.set(r.id,r),this._setFactValue(r,{},r.value)}},{key:"_setFactValue",value:function(r,n,o){var i=r.getCacheKey(n),a=Promise.resolve(o);return i&&this.factResultsCache.set(i,a),a}},{key:"addFact",value:function(r,n,o){var i=r,a=void 0;return r instanceof Ao.default?(i=r.id,a=r):a=new Ao.default(r,n,o),(0,kt.default)("almanac::addFact",{id:i}),this.factMap.set(i,a),a.isConstant()&&this._setFactValue(a,{},a.value),this}},{key:"addRuntimeFact",value:function(r,n){(0,kt.default)("almanac::addRuntimeFact",{id:r});var o=new Ao.default(r,n);return this._addConstantFact(o)}},{key:"factValue",value:function(r){var n=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",a=void 0,s=this._getFact(r);if(s===void 0)return this.allowUndefinedFacts?Promise.resolve(void 0):Promise.reject(new Oy.UndefinedFactError("Undefined fact: "+r));if(s.isConstant())a=Promise.resolve(s.calculate(o,this));else{var c=s.getCacheKey(o),l=c&&this.factResultsCache.get(c);l?(a=Promise.resolve(l),(0,kt.default)("almanac::factValue cache hit for fact",{id:r})):((0,kt.default)("almanac::factValue cache miss, calculating",{id:r}),a=this._setFactValue(s,o,s.calculate(o,this)))}return i?((0,kt.default)("condition::evaluate extracting object",{property:i}),a.then(function(d){if(d!=null&&(typeof d>"u"?"undefined":Mo(d))==="object"){var u=n.pathResolver(d,i);return(0,kt.default)("condition::evaluate extracting object",{property:i,received:u}),u}else return(0,kt.default)("condition::evaluate could not compute object path of non-object",{path:i,factValue:d,type:typeof d>"u"?"undefined":Mo(d)}),d})):a}},{key:"getValue",value:function(r){return r!=null&&(typeof r>"u"?"undefined":Mo(r))==="object"&&Object.prototype.hasOwnProperty.call(r,"fact")?this.factValue(r.fact,r.params,r.path):Promise.resolve(r)}}]),e}();on.default=Ay;var No={},Gt={};Object.defineProperty(Gt,"__esModule",{value:!0});var Ny=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function Dy(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ty=function(){function e(t,r,n){if(Dy(this,e),this.name=String(t),!t)throw new Error("Missing operator name");if(typeof r!="function")throw new Error("Missing operator callback");this.cb=r,this.factValueValidator=n,this.factValueValidator||(this.factValueValidator=function(){return!0})}return Ny(e,[{key:"evaluate",value:function(r,n){return this.factValueValidator(r)&&this.cb(r,n)}}]),e}();Gt.default=Ty,Object.defineProperty(No,"__esModule",{value:!0});var Fy=Gt,Ge=Iy(Fy);function Iy(e){return e&&e.__esModule?e:{default:e}}var je=[];je.push(new Ge.default("equal",function(e,t){return e===t})),je.push(new Ge.default("notEqual",function(e,t){return e!==t})),je.push(new Ge.default("in",function(e,t){return t.indexOf(e)>-1})),je.push(new Ge.default("notIn",function(e,t){return t.indexOf(e)===-1})),je.push(new Ge.default("contains",function(e,t){return e.indexOf(t)>-1},Array.isArray)),je.push(new Ge.default("doesNotContain",function(e,t){return e.indexOf(t)===-1},Array.isArray));function an(e){return Number.parseFloat(e).toString()!=="NaN"}je.push(new Ge.default("lessThan",function(e,t){return e<t},an)),je.push(new Ge.default("lessThanInclusive",function(e,t){return e<=t},an)),je.push(new Ge.default("greaterThan",function(e,t){return e>t},an)),je.push(new Ge.default("greaterThanInclusive",function(e,t){return e>=t},an)),No.default=je;var Do={},wr={};Object.defineProperty(wr,"__esModule",{value:!0});var Wy=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),jy=Gt,Ly=By(jy);function By(e){return e&&e.__esModule?e:{default:e}}function $y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ry=function(){function e(t,r,n){if($y(this,e),this.name=String(t),!t)throw new Error("Missing decorator name");if(typeof r!="function")throw new Error("Missing decorator callback");this.cb=r,this.factValueValidator=n,this.factValueValidator||(this.factValueValidator=function(){return!0})}return Wy(e,[{key:"decorate",value:function(r){var n=this,o=r.evaluate.bind(r);return new Ly.default(this.name+":"+r.name,function(i,a){return n.cb(i,a,o)},this.factValueValidator)}}]),e}();wr.default=Ry,Object.defineProperty(Do,"__esModule",{value:!0});var Vy=wr,Xt=Hy(Vy);function Hy(e){return e&&e.__esModule?e:{default:e}}var Pt=[];Pt.push(new Xt.default("someFact",function(e,t,r){return e.some(function(n){return r(n,t)})},Array.isArray)),Pt.push(new Xt.default("someValue",function(e,t,r){return t.some(function(n){return r(e,n)})})),Pt.push(new Xt.default("everyFact",function(e,t,r){return e.every(function(n){return r(n,t)})},Array.isArray)),Pt.push(new Xt.default("everyValue",function(e,t,r){return t.every(function(n){return r(e,n)})})),Pt.push(new Xt.default("swap",function(e,t,r){return r(t,e)})),Pt.push(new Xt.default("not",function(e,t,r){return!r(e,t)})),Do.default=Pt;var To={};Object.defineProperty(To,"__esModule",{value:!0});var Uy=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Yy=Gt,Fo=Wo(Yy),zy=wr,Io=Wo(zy),qy=_t,sn=Wo(qy);function Wo(e){return e&&e.__esModule?e:{default:e}}function Ky(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Gy=function(){function e(){Ky(this,e),this.operators=new Map,this.decorators=new Map}return Uy(e,[{key:"addOperator",value:function(r,n){var o=void 0;r instanceof Fo.default?o=r:o=new Fo.default(r,n),(0,sn.default)("operatorMap::addOperator",{name:o.name}),this.operators.set(o.name,o)}},{key:"removeOperator",value:function(r){var n=void 0;r instanceof Fo.default?n=r.name:n=r;for(var o=":"+n,i=Array.from(this.operators.keys()),a=0;a<i.length;a++)i[a].endsWith(o)&&this.operators.delete(i[a]);return this.operators.delete(n)}},{key:"addOperatorDecorator",value:function(r,n){var o=void 0;r instanceof Io.default?o=r:o=new Io.default(r,n),(0,sn.default)("operatorMap::addOperatorDecorator",{name:o.name}),this.decorators.set(o.name,o)}},{key:"removeOperatorDecorator",value:function(r){var n=void 0;r instanceof Io.default?n=r.name:n=r;for(var o=n+":",i=Array.from(this.operators.keys()),a=0;a<i.length;a++)i[a].includes(o)&&this.operators.delete(i[a]);return this.decorators.delete(n)}},{key:"get",value:function(r){for(var n=[],o=r;!this.operators.has(o);){var i=o.indexOf(":");if(i>0){var a=o.slice(0,i),s=this.decorators.get(a);if(!s)return(0,sn.default)("operatorMap::get invalid decorator",{name:a}),null;n.unshift(s),o=o.slice(i+1)}else return(0,sn.default)("operatorMap::get no operator",{name:o}),null}for(var c=this.operators.get(o),l=0;l<n.length;l++)c=n[l].decorate(c),this.operators.set(c.name,c);return c}}]),e}();To.default=Gy,Object.defineProperty(it,"__esModule",{value:!0}),it.FINISHED=it.RUNNING=it.READY=void 0;var Xy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qy=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Zy=gr,xr=st(Zy),Jy=tn,jo=st(Jy),eb=on,tb=st(eb),rb=sl,nb=st(rb),ob=No,ib=st(ob),ab=Do,sb=st(ab),cb=_t,Qt=st(cb),lb=rn,ub=st(lb),db=To,fb=st(db);function st(e){return e&&e.__esModule?e:{default:e}}function hb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pb(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function mb(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var gb=it.READY="READY",ul=it.RUNNING="RUNNING",dl=it.FINISHED="FINISHED",vb=function(e){mb(t,e);function t(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};hb(this,t);var o=pb(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.rules=[],o.allowUndefinedFacts=n.allowUndefinedFacts||!1,o.allowUndefinedConditions=n.allowUndefinedConditions||!1,o.replaceFactsInEventParams=n.replaceFactsInEventParams||!1,o.pathResolver=n.pathResolver,o.operators=new fb.default,o.facts=new Map,o.conditions=new Map,o.status=gb,r.map(function(i){return o.addRule(i)}),ib.default.map(function(i){return o.addOperator(i)}),sb.default.map(function(i){return o.addOperatorDecorator(i)}),o}return Qy(t,[{key:"addRule",value:function(n){if(!n)throw new Error("Engine: addRule() requires options");var o=void 0;if(n instanceof jo.default)o=n;else{if(!Object.prototype.hasOwnProperty.call(n,"event"))throw new Error('Engine: addRule() argument requires "event" property');if(!Object.prototype.hasOwnProperty.call(n,"conditions"))throw new Error('Engine: addRule() argument requires "conditions" property');o=new jo.default(n)}return o.setEngine(this),this.rules.push(o),this.prioritizedRules=null,this}},{key:"updateRule",value:function(n){var o=this.rules.findIndex(function(i){return i.name===n.name});if(o>-1)this.rules.splice(o,1),this.addRule(n),this.prioritizedRules=null;else throw new Error("Engine: updateRule() rule not found")}},{key:"removeRule",value:function(n){var o=!1;if(n instanceof jo.default){var a=this.rules.indexOf(n);a>-1&&(o=!!this.rules.splice(a,1).length)}else{var i=this.rules.filter(function(s){return s.name!==n});o=i.length!==this.rules.length,this.rules=i}return o&&(this.prioritizedRules=null),o}},{key:"setCondition",value:function(n,o){if(!n)throw new Error("Engine: setCondition() requires name");if(!o)throw new Error("Engine: setCondition() requires conditions");if(!Object.prototype.hasOwnProperty.call(o,"all")&&!Object.prototype.hasOwnProperty.call(o,"any")&&!Object.prototype.hasOwnProperty.call(o,"not")&&!Object.prototype.hasOwnProperty.call(o,"condition"))throw new Error('"conditions" root must contain a single instance of "all", "any", "not", or "condition"');return this.conditions.set(n,new ub.default(o)),this}},{key:"removeCondition",value:function(n){return this.conditions.delete(n)}},{key:"addOperator",value:function(n,o){this.operators.addOperator(n,o)}},{key:"removeOperator",value:function(n){return this.operators.removeOperator(n)}},{key:"addOperatorDecorator",value:function(n,o){this.operators.addOperatorDecorator(n,o)}},{key:"removeOperatorDecorator",value:function(n){return this.operators.removeOperatorDecorator(n)}},{key:"addFact",value:function(n,o,i){var a=n,s=void 0;return n instanceof xr.default?(a=n.id,s=n):s=new xr.default(n,o,i),(0,Qt.default)("engine::addFact",{id:a}),this.facts.set(a,s),this}},{key:"removeFact",value:function(n){var o=void 0;return n instanceof xr.default?o=n.id:o=n,this.facts.delete(o)}},{key:"prioritizeRules",value:function(){if(!this.prioritizedRules){var n=this.rules.reduce(function(o,i){var a=i.priority;return o[a]||(o[a]=[]),o[a].push(i),o},{});this.prioritizedRules=Object.keys(n).sort(function(o,i){return Number(o)>Number(i)?-1:1}).map(function(o){return n[o]})}return this.prioritizedRules}},{key:"stop",value:function(){return this.status=dl,this}},{key:"getFact",value:function(n){return this.facts.get(n)}},{key:"evaluateRules",value:function(n,o){var i=this;return Promise.all(n.map(function(a){return i.status!==ul?((0,Qt.default)("engine::run, skipping remaining rules",{status:i.status}),Promise.resolve()):a.evaluate(o).then(function(s){return(0,Qt.default)("engine::run",{ruleResult:s.result}),o.addResult(s),s.result?(o.addEvent(s.event,"success"),i.emitAsync("success",s.event,o,s).then(function(){return i.emitAsync(s.event.type,s.event.params,o,s)})):(o.addEvent(s.event,"failure"),i.emitAsync("failure",s.event,o,s))})}))}},{key:"run",value:function(){var n=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(0,Qt.default)("engine::run started"),this.status=ul;var a=i.almanac||new tb.default({allowUndefinedFacts:this.allowUndefinedFacts,pathResolver:this.pathResolver});this.facts.forEach(function(u){a.addFact(u)});for(var s in o){var c=void 0;o[s]instanceof xr.default?c=o[s]:c=new xr.default(s,o[s]),a.addFact(c),(0,Qt.default)("engine::run initialized runtime fact",{id:c.id,value:c.value,type:Xy(c.value)})}var l=this.prioritizeRules(),d=Promise.resolve();return new Promise(function(u,h){l.map(function(p){return d=d.then(function(){return n.evaluateRules(p,a)}).catch(h),d}),d.then(function(){n.status=dl,(0,Qt.default)("engine::run completed");var p=a.getResults(),x=p.reduce(function(g,y){var b=y.result?"results":"failureResults";return g[b].push(y),g},{results:[],failureResults:[]}),f=x.results,v=x.failureResults;u({almanac:a,results:f,failureResults:v,events:a.getEvents("success"),failureEvents:a.getEvents("failure")})}).catch(h)})}}]),t}(nb.default);it.default=vb,Object.defineProperty(_e,"__esModule",{value:!0}),_e.OperatorDecorator=_e.Almanac=_e.Engine=_e.Operator=_e.Rule=_e.Fact=void 0,_e.default=function(e,t){return new fl.default(e,t)};var yb=it,fl=Zt(yb),bb=gr,wb=Zt(bb),xb=tn,Eb=Zt(xb),Cb=Gt,Sb=Zt(Cb),Ob=on,_b=Zt(Ob),kb=wr,Pb=Zt(kb);function Zt(e){return e&&e.__esModule?e:{default:e}}_e.Fact=wb.default,_e.Rule=Eb.default,_e.Operator=Sb.default,_e.Engine=fl.default,_e.Almanac=_b.default,_e.OperatorDecorator=Pb.default;var Mb=_e;function Ab(e){return e.map(t=>{const r=[];if(Object.entries(t.conditions).forEach(([n,o])=>{n!=="all"&&n!=="any"&&typeof o=="object"&&!Array.isArray(o)&&r.push(...Lo(n,o))}),t.conditions.all&&Array.isArray(t.conditions.all)&&t.conditions.all.forEach(n=>{Object.entries(n).forEach(([o,i])=>{r.push(...Lo(o,i))})}),t.conditions.any&&Array.isArray(t.conditions.any)){const n=[];t.conditions.any.forEach(o=>{const i=[];Object.entries(o).forEach(([a,s])=>{i.push(...Lo(a,s))}),i.length>0&&(i.length===1?n.push(i[0]):n.push({all:i}))}),n.length>0&&r.push({any:n})}return{conditions:{all:r},event:t.event}})}function Lo(e,t){const r=[];return Object.entries(t).forEach(([n,o])=>{const i=Nb(n);i&&r.push({fact:e,operator:i,value:o})}),r}function Nb(e){return{equals:"equal",notEquals:"notEqual",greaterThan:"greaterThan",lessThan:"lessThan",greaterThanOrEqual:"greaterThanOrEqual",lessThanOrEqual:"lessThanOrEqual",contains:"contains",notContains:"doesNotContain",in:"in",notIn:"notIn",empty:"empty",notEmpty:"notEmpty"}[e]||null}function Db(e,t,r){const n=JSON.parse(JSON.stringify(e)),o=JSON.parse(JSON.stringify(t||{}));if(r.hiddenFields.forEach(i=>{const a=i.replace("root_","").split("_");hl(o,a,"ui:widget","hidden")}),r.disabledFields.forEach(i=>{const a=i.replace("root_","").split("_");hl(o,a,"ui:disabled",!0)}),n.properties){const i=new Set(n.required||[]);r.requiredFields.forEach(a=>{const s=a.replace("root_","");s&&i.add(s)}),n.required=Array.from(i)}return{schema:n,uiSchema:o}}function hl(e,t,r,n){let o=e;for(let a=0;a<t.length-1;a++)o[t[a]]||(o[t[a]]={}),o=o[t[a]];const i=t[t.length-1];o[i]||(o[i]={}),o[i][r]=n}const Tb=({schema:e,uiSchema:t={},formData:r,conditionalRules:n,debug:o=!1,onFieldChange:i,onFieldFocus:a,onFieldBlur:s,...c})=>{const[l,d]=D.useState({hiddenFields:new Set,disabledFields:new Set,requiredFields:new Set}),[u,h]=D.useState(r||{}),p=D.useMemo(()=>{const b=new Mb.Engine;return b.addOperator("empty",(S,T)=>{const P=!S||S===""||Array.isArray(S)&&S.length===0;return T?P:!P}),b.addOperator("notEmpty",(S,T)=>{const P=!S||S===""||Array.isArray(S)&&S.length===0;return T?!P:P}),Ab(n).forEach(S=>b.addRule(S)),b},[n]),x=D.useCallback(async b=>{if(!n||n.length===0){d({hiddenFields:new Set,disabledFields:new Set,requiredFields:new Set});return}try{const O={};e.properties&&Object.keys(e.properties).forEach(P=>{O[P]=void 0}),Object.assign(O,b),o&&(console.log("Form data:",b),console.log("Extracted facts:",O));const{events:S}=await p.run(O),T={hiddenFields:new Set,disabledFields:new Set,requiredFields:new Set};S.forEach(P=>{var H;const L=((H=P.params)==null?void 0:H.fields)||[];switch(P.type){case"show":L.forEach(B=>T.hiddenFields.delete(B));break;case"hide":L.forEach(B=>T.hiddenFields.add(B));break;case"require":L.forEach(B=>T.requiredFields.add(B));break;case"unrequire":L.forEach(B=>T.requiredFields.delete(B));break;case"disable":L.forEach(B=>T.disabledFields.add(B));break;case"enable":L.forEach(B=>T.disabledFields.delete(B));break}}),o&&(console.log("Conditional engine events:",S),console.log("Conditional state after evaluation:",{hidden:Array.from(T.hiddenFields),disabled:Array.from(T.disabledFields),required:Array.from(T.requiredFields)})),d(T)}catch(O){console.error("Error evaluating conditional rules with engine:",O)}},[p,n,o]);D.useEffect(()=>{x(u)},[u,x]);const{schema:f,uiSchema:v}=D.useMemo(()=>{const b=Db(e,t,l);return o&&l.requiredFields.size>0&&console.log("Modified schema required fields:",b.schema.required),b},[e,t,l,o]),g=D.useCallback(b=>{o&&console.log("Field changed:",b),i==null||i(b),b.formData&&h(b.formData)},[i,o]),y=D.useCallback(b=>{h(b.formData),c.onChange&&c.onChange(b)},[c]);return w.jsx(Qc,{...c,schema:f,uiSchema:v,formData:u,onChange:y,onFieldChange:g,onFieldFocus:a,onFieldBlur:s})};Y.validator=Uo,Object.defineProperty(Y,"generateTheme",{enumerable:!0,get:()=>vl.generateTheme}),Y.AddressField=ci,Y.ArrayFieldItemTemplate=vi,Y.ArrayFieldTemplate=gi,Y.ColorWidget=wi,Y.ConditionalForm=Tb,Y.CurrencyField=hi,Y.DateTimeWidget=wo,Y.DateWidget=gu,Y.EmailWidget=vo,Y.EnhancedCheckboxWidget=Rc,Y.EnhancedNumberWidget=Hc,Y.EnhancedRadioWidget=Vc,Y.EnhancedSelectWidget=$c,Y.EnhancedTextWidget=Lc,Y.EnhancedTextareaWidget=Bc,Y.ExtendedForm=Qc,Y.FileUploadWidget=Yc,Y.FileWidget=Ei,Y.FormEventHub=Kc,Y.FormEventManager=ov,Y.FormEventProvider=ui,Y.GridLayout=nv,Y.HorizontalLayout=tv,Y.PasswordWidget=bo,Y.PhoneField=fi,Y.RangeWidget=Ri,Y.RatingWidget=Vi,Y.TelephoneWidget=go,Y.URLWidget=yo,Y.VerticalLayout=Zg,Y.cn=J,Y.customFields=yi,Y.customTemplates=bi,Y.customWidgets=qc,Y.enhancedWidgets=zc,Y.formDataUtils=Gc,Y.schemaUtils=Xc,Y.useFieldEventHandlers=ve,Y.useFormEventHub=di,Y.validationUtils=iv,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
|
|
112
|
+
*/(function(e,t){(function(r){var n=Object.hasOwnProperty,o=Array.isArray?Array.isArray:function(C){return Object.prototype.toString.call(C)==="[object Array]"},i=10,a=typeof process=="object"&&typeof process.nextTick=="function",s=typeof Symbol=="function",c=typeof Reflect=="object",l=typeof setImmediate=="function",d=l?setImmediate:setTimeout,u=s?c&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(m){var C=Object.getOwnPropertyNames(m);return C.push.apply(C,Object.getOwnPropertySymbols(m)),C}:Object.keys;function h(){this._events={},this._conf&&p.call(this,this._conf)}function p(m){m&&(this._conf=m,m.delimiter&&(this.delimiter=m.delimiter),m.maxListeners!==r&&(this._maxListeners=m.maxListeners),m.wildcard&&(this.wildcard=m.wildcard),m.newListener&&(this._newListener=m.newListener),m.removeListener&&(this._removeListener=m.removeListener),m.verboseMemoryLeak&&(this.verboseMemoryLeak=m.verboseMemoryLeak),m.ignoreErrors&&(this.ignoreErrors=m.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function x(m,C){var _="(node) warning: possible EventEmitter memory leak detected. "+m+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(_+=" Event name: "+C+"."),typeof process<"u"&&process.emitWarning){var k=new Error(_);k.name="MaxListenersExceededWarning",k.emitter=this,k.count=m,process.emitWarning(k)}else console.error(_),console.trace&&console.trace()}var f=function(m,C,_){var k=arguments.length;switch(k){case 0:return[];case 1:return[m];case 2:return[m,C];case 3:return[m,C,_];default:for(var M=new Array(k);k--;)M[k]=arguments[k];return M}};function v(m,C){for(var _={},k,M=m.length,F=0,I=0;I<M;I++)k=m[I],_[k]=I<F?C[I]:r;return _}function g(m,C,_){this._emitter=m,this._target=C,this._listeners={},this._listenersCount=0;var k,M;if((_.on||_.off)&&(k=_.on,M=_.off),C.addEventListener?(k=C.addEventListener,M=C.removeEventListener):C.addListener?(k=C.addListener,M=C.removeListener):C.on&&(k=C.on,M=C.off),!k&&!M)throw Error("target does not implement any known event API");if(typeof k!="function")throw TypeError("on method must be a function");if(typeof M!="function")throw TypeError("off method must be a function");this._on=k,this._off=M;var F=m._observers;F?F.push(this):m._observers=[this]}Object.assign(g.prototype,{subscribe:function(m,C,_){var k=this,M=this._target,F=this._emitter,I=this._listeners,j=function(){var W=f.apply(null,arguments),A={data:W,name:C,original:m};if(_){var V=_.call(M,A);V!==!1&&F.emit.apply(F,[A.name].concat(W));return}F.emit.apply(F,[C].concat(W))};if(I[m])throw Error("Event '"+m+"' is already listening");this._listenersCount++,F._newListener&&F._removeListener&&!k._onNewListener?(this._onNewListener=function(W){W===C&&I[m]===null&&(I[m]=j,k._on.call(M,m,j))},F.on("newListener",this._onNewListener),this._onRemoveListener=function(W){W===C&&!F.hasListeners(W)&&I[m]&&(I[m]=null,k._off.call(M,m,j))},I[m]=null,F.on("removeListener",this._onRemoveListener)):(I[m]=j,k._on.call(M,m,j))},unsubscribe:function(m){var C=this,_=this._listeners,k=this._emitter,M,F,I=this._off,j=this._target,W;if(m&&typeof m!="string")throw TypeError("event must be a string");function A(){C._onNewListener&&(k.off("newListener",C._onNewListener),k.off("removeListener",C._onRemoveListener),C._onNewListener=null,C._onRemoveListener=null);var V=L.call(k,C);k._observers.splice(V,1)}if(m){if(M=_[m],!M)return;I.call(j,m,M),delete _[m],--this._listenersCount||A()}else{for(F=u(_),W=F.length;W-- >0;)m=F[W],I.call(j,m,_[m]);this._listeners={},this._listenersCount=0,A()}}});function y(m,C,_,k){var M=Object.assign({},C);if(!m)return M;if(typeof m!="object")throw TypeError("options must be an object");var F=Object.keys(m),I=F.length,j,W,A;function V(q){throw Error('Invalid "'+j+'" option value'+(q?". Reason: "+q:""))}for(var re=0;re<I;re++){if(j=F[re],!n.call(C,j))throw Error('Unknown "'+j+'" option');W=m[j],W!==r&&(A=_[j],M[j]=A?A(W,V):W)}return M}function b(m,C){return(typeof m!="function"||!m.hasOwnProperty("prototype"))&&C("value must be a constructor"),m}function O(m){var C="value must be type of "+m.join("|"),_=m.length,k=m[0],M=m[1];return _===1?function(F,I){if(typeof F===k)return F;I(C)}:_===2?function(F,I){var j=typeof F;if(j===k||j===M)return F;I(C)}:function(F,I){for(var j=typeof F,W=_;W-- >0;)if(j===m[W])return F;I(C)}}var S=O(["function"]),T=O(["object","function"]);function P(m,C,_){var k,M,F=0,I,j=new m(function(W,A,V){_=y(_,{timeout:0,overload:!1},{timeout:function(Q,se){return Q*=1,(typeof Q!="number"||Q<0||!Number.isFinite(Q))&&se("timeout must be a positive number"),Q}}),k=!_.overload&&typeof m.prototype.cancel=="function"&&typeof V=="function";function re(){M&&(M=null),F&&(clearTimeout(F),F=0)}var q=function(Q){re(),W(Q)},z=function(Q){re(),A(Q)};k?C(q,z,V):(M=[function(Q){z(Q||Error("canceled"))}],C(q,z,function(Q){if(I)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof Q!="function")throw TypeError("onCancel callback must be a function");M.push(Q)}),I=!0),_.timeout>0&&(F=setTimeout(function(){var Q=Error("timeout");Q.code="ETIMEDOUT",F=0,j.cancel(Q),A(Q)},_.timeout))});return k||(j.cancel=function(W){if(M){for(var A=M.length,V=1;V<A;V++)M[V](W);M[0](W),M=null}}),j}function L(m){var C=this._observers;if(!C)return-1;for(var _=C.length,k=0;k<_;k++)if(C[k]._target===m)return k;return-1}function $(m,C,_,k,M){if(!_)return null;if(k===0){var F=typeof C;if(F==="string"){var I,j,W=0,A=0,V=this.delimiter,re=V.length;if((j=C.indexOf(V))!==-1){I=new Array(5);do I[W++]=C.slice(A,j),A=j+re;while((j=C.indexOf(V,A))!==-1);I[W++]=C.slice(A),C=I,M=W}else C=[C],M=1}else F==="object"?M=C.length:(C=[C],M=1)}var q=null,z,Q,se,Ee,Le,Ne=C[k],Be=C[k+1],De,ye;if(k===M)_._listeners&&(typeof _._listeners=="function"?(m&&m.push(_._listeners),q=[_]):(m&&m.push.apply(m,_._listeners),q=[_]));else if(Ne==="*"){for(De=u(_),j=De.length;j-- >0;)z=De[j],z!=="_listeners"&&(ye=$(m,C,_[z],k+1,M),ye&&(q?q.push.apply(q,ye):q=ye));return q}else if(Ne==="**"){for(Le=k+1===M||k+2===M&&Be==="*",Le&&_._listeners&&(q=$(m,C,_,M,M)),De=u(_),j=De.length;j-- >0;)z=De[j],z!=="_listeners"&&(z==="*"||z==="**"?(_[z]._listeners&&!Le&&(ye=$(m,C,_[z],M,M),ye&&(q?q.push.apply(q,ye):q=ye)),ye=$(m,C,_[z],k,M)):z===Be?ye=$(m,C,_[z],k+2,M):ye=$(m,C,_[z],k,M),ye&&(q?q.push.apply(q,ye):q=ye));return q}else _[Ne]&&(q=$(m,C,_[Ne],k+1,M));if(Q=_["*"],Q&&$(m,C,Q,k+1,M),se=_["**"],se)if(k<M)for(se._listeners&&$(m,C,se,M,M),De=u(se),j=De.length;j-- >0;)z=De[j],z!=="_listeners"&&(z===Be?$(m,C,se[z],k+2,M):z===Ne?$(m,C,se[z],k+1,M):(Ee={},Ee[z]=se[z],$(m,C,{"**":Ee},k+1,M)));else se._listeners?$(m,C,se,M,M):se["*"]&&se["*"]._listeners&&$(m,C,se["*"],M,M);return q}function B(m,C,_){var k=0,M=0,F,I=this.delimiter,j=I.length,W;if(typeof m=="string")if((F=m.indexOf(I))!==-1){W=new Array(5);do W[k++]=m.slice(M,F),M=F+j;while((F=m.indexOf(I,M))!==-1);W[k++]=m.slice(M)}else W=[m],k=1;else W=m,k=m.length;if(k>1){for(F=0;F+1<k;F++)if(W[F]==="**"&&W[F+1]==="**")return}var A=this.listenerTree,V;for(F=0;F<k;F++)if(V=W[F],A=A[V]||(A[V]={}),F===k-1)return A._listeners?(typeof A._listeners=="function"&&(A._listeners=[A._listeners]),_?A._listeners.unshift(C):A._listeners.push(C),!A._listeners.warned&&this._maxListeners>0&&A._listeners.length>this._maxListeners&&(A._listeners.warned=!0,x.call(this,A._listeners.length,V))):A._listeners=C,!0;return!0}function U(m,C,_,k){for(var M=u(m),F=M.length,I,j,W,A=m._listeners,V;F-- >0;)j=M[F],I=m[j],j==="_listeners"?W=_:W=_?_.concat(j):[j],V=k||typeof j=="symbol",A&&C.push(V?W:W.join(this.delimiter)),typeof I=="object"&&U.call(this,I,C,W,V);return C}function R(m){for(var C=u(m),_=C.length,k,M,F;_-- >0;)M=C[_],k=m[M],k&&(F=!0,M!=="_listeners"&&!R(k)&&delete m[M]);return F}function K(m,C,_){this.emitter=m,this.event=C,this.listener=_}K.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function ee(m,C,_){if(_===!0)M=!0;else if(_===!1)k=!0;else{if(!_||typeof _!="object")throw TypeError("options should be an object or true");var k=_.async,M=_.promisify,F=_.nextTick,I=_.objectify}if(k||F||M){var j=C,W=C._origin||C;if(F&&!a)throw Error("process.nextTick is not supported");M===r&&(M=C.constructor.name==="AsyncFunction"),C=function(){var A=arguments,V=this,re=this.event;return M?F?Promise.resolve():new Promise(function(q){d(q)}).then(function(){return V.event=re,j.apply(V,A)}):(F?process.nextTick:d)(function(){V.event=re,j.apply(V,A)})},C._async=!0,C._origin=W}return[C,I?new K(this,m,C):this]}function H(m){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,p.call(this,m)}H.EventEmitter2=H,H.prototype.listenTo=function(m,C,_){if(typeof m!="object")throw TypeError("target musts be an object");var k=this;_=y(_,{on:r,off:r,reducers:r},{on:S,off:S,reducers:T});function M(F){if(typeof F!="object")throw TypeError("events must be an object");var I=_.reducers,j=L.call(k,m),W;j===-1?W=new g(k,m,_):W=k._observers[j];for(var A=u(F),V=A.length,re,q=typeof I=="function",z=0;z<V;z++)re=A[z],W.subscribe(re,F[re]||re,q?I:I&&I[re])}return o(C)?M(v(C)):M(typeof C=="string"?v(C.split(/\s+/)):C),this},H.prototype.stopListeningTo=function(m,C){var _=this._observers;if(!_)return!1;var k=_.length,M,F=!1;if(m&&typeof m!="object")throw TypeError("target should be an object");for(;k-- >0;)M=_[k],(!m||M._target===m)&&(M.unsubscribe(C),F=!0);return F},H.prototype.delimiter=".",H.prototype.setMaxListeners=function(m){m!==r&&(this._maxListeners=m,this._conf||(this._conf={}),this._conf.maxListeners=m)},H.prototype.getMaxListeners=function(){return this._maxListeners},H.prototype.event="",H.prototype.once=function(m,C,_){return this._once(m,C,!1,_)},H.prototype.prependOnceListener=function(m,C,_){return this._once(m,C,!0,_)},H.prototype._once=function(m,C,_,k){return this._many(m,1,C,_,k)},H.prototype.many=function(m,C,_,k){return this._many(m,C,_,!1,k)},H.prototype.prependMany=function(m,C,_,k){return this._many(m,C,_,!0,k)},H.prototype._many=function(m,C,_,k,M){var F=this;if(typeof _!="function")throw new Error("many only accepts instances of Function");function I(){return--C===0&&F.off(m,I),_.apply(this,arguments)}return I._origin=_,this._on(m,I,k,M)},H.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var m=arguments[0],C,_=this.wildcard,k,M,F,I,j;if(m==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(_&&(C=m,m!=="newListener"&&m!=="removeListener"&&typeof m=="object")){if(M=m.length,s){for(F=0;F<M;F++)if(typeof m[F]=="symbol"){j=!0;break}}j||(m=m.join(this.delimiter))}var W=arguments.length,A;if(this._all&&this._all.length)for(A=this._all.slice(),F=0,M=A.length;F<M;F++)switch(this.event=m,W){case 1:A[F].call(this,m);break;case 2:A[F].call(this,m,arguments[1]);break;case 3:A[F].call(this,m,arguments[1],arguments[2]);break;default:A[F].apply(this,arguments)}if(_)A=[],$.call(this,A,C,this.listenerTree,0,M);else if(A=this._events[m],typeof A=="function"){switch(this.event=m,W){case 1:A.call(this);break;case 2:A.call(this,arguments[1]);break;case 3:A.call(this,arguments[1],arguments[2]);break;default:for(k=new Array(W-1),I=1;I<W;I++)k[I-1]=arguments[I];A.apply(this,k)}return!0}else A&&(A=A.slice());if(A&&A.length){if(W>3)for(k=new Array(W-1),I=1;I<W;I++)k[I-1]=arguments[I];for(F=0,M=A.length;F<M;F++)switch(this.event=m,W){case 1:A[F].call(this);break;case 2:A[F].call(this,arguments[1]);break;case 3:A[F].call(this,arguments[1],arguments[2]);break;default:A[F].apply(this,k)}return!0}else if(!this.ignoreErrors&&!this._all&&m==="error")throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},H.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var m=arguments[0],C=this.wildcard,_,k,M,F,I,j;if(m==="newListener"&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(C&&(_=m,m!=="newListener"&&m!=="removeListener"&&typeof m=="object")){if(F=m.length,s){for(I=0;I<F;I++)if(typeof m[I]=="symbol"){k=!0;break}}k||(m=m.join(this.delimiter))}var W=[],A=arguments.length,V;if(this._all)for(I=0,F=this._all.length;I<F;I++)switch(this.event=m,A){case 1:W.push(this._all[I].call(this,m));break;case 2:W.push(this._all[I].call(this,m,arguments[1]));break;case 3:W.push(this._all[I].call(this,m,arguments[1],arguments[2]));break;default:W.push(this._all[I].apply(this,arguments))}if(C?(V=[],$.call(this,V,_,this.listenerTree,0)):V=this._events[m],typeof V=="function")switch(this.event=m,A){case 1:W.push(V.call(this));break;case 2:W.push(V.call(this,arguments[1]));break;case 3:W.push(V.call(this,arguments[1],arguments[2]));break;default:for(M=new Array(A-1),j=1;j<A;j++)M[j-1]=arguments[j];W.push(V.apply(this,M))}else if(V&&V.length){if(V=V.slice(),A>3)for(M=new Array(A-1),j=1;j<A;j++)M[j-1]=arguments[j];for(I=0,F=V.length;I<F;I++)switch(this.event=m,A){case 1:W.push(V[I].call(this));break;case 2:W.push(V[I].call(this,arguments[1]));break;case 3:W.push(V[I].call(this,arguments[1],arguments[2]));break;default:W.push(V[I].apply(this,M))}}else if(!this.ignoreErrors&&!this._all&&m==="error")return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(W)},H.prototype.on=function(m,C,_){return this._on(m,C,!1,_)},H.prototype.prependListener=function(m,C,_){return this._on(m,C,!0,_)},H.prototype.onAny=function(m){return this._onAny(m,!1)},H.prototype.prependAny=function(m){return this._onAny(m,!0)},H.prototype.addListener=H.prototype.on,H.prototype._onAny=function(m,C){if(typeof m!="function")throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),C?this._all.unshift(m):this._all.push(m),this},H.prototype._on=function(m,C,_,k){if(typeof m=="function")return this._onAny(m,C),this;if(typeof C!="function")throw new Error("on only accepts instances of Function");this._events||h.call(this);var M=this,F;return k!==r&&(F=ee.call(this,m,C,k),C=F[0],M=F[1]),this._newListener&&this.emit("newListener",m,C),this.wildcard?(B.call(this,m,C,_),M):(this._events[m]?(typeof this._events[m]=="function"&&(this._events[m]=[this._events[m]]),_?this._events[m].unshift(C):this._events[m].push(C),!this._events[m].warned&&this._maxListeners>0&&this._events[m].length>this._maxListeners&&(this._events[m].warned=!0,x.call(this,this._events[m].length,m))):this._events[m]=C,M)},H.prototype.off=function(m,C){if(typeof C!="function")throw new Error("removeListener only takes instances of Function");var _,k=[];if(this.wildcard){var M=typeof m=="string"?m.split(this.delimiter):m.slice();if(k=$.call(this,null,M,this.listenerTree,0),!k)return this}else{if(!this._events[m])return this;_=this._events[m],k.push({_listeners:_})}for(var F=0;F<k.length;F++){var I=k[F];if(_=I._listeners,o(_)){for(var j=-1,W=0,A=_.length;W<A;W++)if(_[W]===C||_[W].listener&&_[W].listener===C||_[W]._origin&&_[W]._origin===C){j=W;break}if(j<0)continue;return this.wildcard?I._listeners.splice(j,1):this._events[m].splice(j,1),_.length===0&&(this.wildcard?delete I._listeners:delete this._events[m]),this._removeListener&&this.emit("removeListener",m,C),this}else(_===C||_.listener&&_.listener===C||_._origin&&_._origin===C)&&(this.wildcard?delete I._listeners:delete this._events[m],this._removeListener&&this.emit("removeListener",m,C))}return this.listenerTree&&R(this.listenerTree),this},H.prototype.offAny=function(m){var C=0,_=0,k;if(m&&this._all&&this._all.length>0){for(k=this._all,C=0,_=k.length;C<_;C++)if(m===k[C])return k.splice(C,1),this._removeListener&&this.emit("removeListenerAny",m),this}else{if(k=this._all,this._removeListener)for(C=0,_=k.length;C<_;C++)this.emit("removeListenerAny",k[C]);this._all=[]}return this},H.prototype.removeListener=H.prototype.off,H.prototype.removeAllListeners=function(m){if(m===r)return!this._events||h.call(this),this;if(this.wildcard){var C=$.call(this,null,m,this.listenerTree,0),_,k;if(!C)return this;for(k=0;k<C.length;k++)_=C[k],_._listeners=null;this.listenerTree&&R(this.listenerTree)}else this._events&&(this._events[m]=null);return this},H.prototype.listeners=function(m){var C=this._events,_,k,M,F,I;if(m===r){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!C)return[];for(_=u(C),F=_.length,M=[];F-- >0;)k=C[_[F]],typeof k=="function"?M.push(k):M.push.apply(M,k);return M}else{if(this.wildcard){if(I=this.listenerTree,!I)return[];var j=[],W=typeof m=="string"?m.split(this.delimiter):m.slice();return $.call(this,j,W,I,0),j}return C?(k=C[m],k?typeof k=="function"?[k]:k:[]):[]}},H.prototype.eventNames=function(m){var C=this._events;return this.wildcard?U.call(this,this.listenerTree,[],null,m):C?u(C):[]},H.prototype.listenerCount=function(m){return this.listeners(m).length},H.prototype.hasListeners=function(m){if(this.wildcard){var C=[],_=typeof m=="string"?m.split(this.delimiter):m.slice();return $.call(this,C,_,this.listenerTree,0),C.length>0}var k=this._events,M=this._all;return!!(M&&M.length||k&&(m===r?u(k).length:k[m]))},H.prototype.listenersAny=function(){return this._all?this._all:[]},H.prototype.waitFor=function(m,C){var _=this,k=typeof C;return k==="number"?C={timeout:C}:k==="function"&&(C={filter:C}),C=y(C,{timeout:0,filter:r,handleError:!1,Promise,overload:!1},{filter:S,Promise:b}),P(C.Promise,function(M,F,I){function j(){var W=C.filter;if(!(W&&!W.apply(_,arguments)))if(_.off(m,j),C.handleError){var A=arguments[0];A?F(A):M(f.apply(null,arguments).slice(1))}else M(f.apply(null,arguments))}I(function(){_.off(m,j)}),_._on(m,j,!1)},{timeout:C.timeout,overload:C.overload})};function X(m,C,_){_=y(_,{Promise,timeout:0,overload:!1},{Promise:b});var k=_.Promise;return P(k,function(M,F,I){var j;if(typeof m.addEventListener=="function"){j=function(){M(f.apply(null,arguments))},I(function(){m.removeEventListener(C,j)}),m.addEventListener(C,j,{once:!0});return}var W=function(){A&&m.removeListener("error",A),M(f.apply(null,arguments))},A;C!=="error"&&(A=function(V){m.removeListener(C,W),F(V)},m.once("error",A)),I(function(){A&&m.removeListener("error",A),m.removeListener(C,W)}),m.once(C,W)},{timeout:_.timeout,overload:_.overload})}var Z=H.prototype;Object.defineProperties(H,{defaultMaxListeners:{get:function(){return Z._maxListeners},set:function(m){if(typeof m!="number"||m<0||Number.isNaN(m))throw TypeError("n must be a non-negative number");Z._maxListeners=m},enumerable:!0},once:{value:X,writable:!0,configurable:!0}}),Object.defineProperties(Z,{_maxListeners:{value:i,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=H})()})(sl);var cl=sl.exports;Object.defineProperty(tn,"__esModule",{value:!0});var zv=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),qv=rn,Kv=br(qv),Gv=Oo,Xv=br(Gv),Qv=_t,Zv=br(Qv),Jv=al,ey=br(Jv),ty=cl,ry=br(ty);function br(e){return e&&e.__esModule?e:{default:e}}function ny(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oy(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function iy(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var ay=function(e){iy(t,e);function t(r){ny(this,t);var n=oy(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));typeof r=="string"&&(r=JSON.parse(r)),r&&r.conditions&&n.setConditions(r.conditions),r&&r.onSuccess&&n.on("success",r.onSuccess),r&&r.onFailure&&n.on("failure",r.onFailure),r&&(r.name||r.name===0)&&n.setName(r.name);var o=r&&r.priority||1;n.setPriority(o);var i=r&&r.event||{type:"unknown"};return n.setEvent(i),n}return zv(t,[{key:"setPriority",value:function(n){if(n=parseInt(n,10),n<=0)throw new Error("Priority must be greater than zero");return this.priority=n,this}},{key:"setName",value:function(n){if(!n&&n!==0)throw new Error('Rule "name" must be defined');return this.name=n,this}},{key:"setConditions",value:function(n){if(!Object.prototype.hasOwnProperty.call(n,"all")&&!Object.prototype.hasOwnProperty.call(n,"any")&&!Object.prototype.hasOwnProperty.call(n,"not")&&!Object.prototype.hasOwnProperty.call(n,"condition"))throw new Error('"conditions" root must contain a single instance of "all", "any", "not", or "condition"');return this.conditions=new Kv.default(n),this}},{key:"setEvent",value:function(n){if(!n)throw new Error("Rule: setEvent() requires event object");if(!Object.prototype.hasOwnProperty.call(n,"type"))throw new Error('Rule: setEvent() requires event object with "type" property');return this.ruleEvent={type:n.type},this.event=this.ruleEvent,n.params&&(this.ruleEvent.params=n.params),this}},{key:"getEvent",value:function(){return this.ruleEvent}},{key:"getPriority",value:function(){return this.priority}},{key:"getConditions",value:function(){return this.conditions}},{key:"getEngine",value:function(){return this.engine}},{key:"setEngine",value:function(n){return this.engine=n,this}},{key:"toJSON",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,o={conditions:this.conditions.toJSON(!1),priority:this.priority,event:this.ruleEvent,name:this.name};return n?JSON.stringify(o):o}},{key:"prioritizeConditions",value:function(n){var o=this,i=n.reduce(function(a,s){var c=s.priority;if(!c){var l=o.engine.getFact(s.fact);c=l&&l.priority||1}return a[c]||(a[c]=[]),a[c].push(s),a},{});return Object.keys(i).sort(function(a,s){return Number(a)>Number(s)?-1:1}).map(function(a){return i[a]})}},{key:"evaluate",value:function(n){var o=this,i=new Xv.default(this.conditions,this.ruleEvent,this.priority,this.name),a=function(f){if(f.isConditionReference())return h(f);if(f.isBooleanOperator()){var v=f[f.operator],g=void 0;return f.operator==="all"?g=d(v):f.operator==="any"?g=l(v):g=u(v),g.then(function(y){var b=y===!0;return f.result=b,b})}else return f.evaluate(n,o.engine.operators).then(function(y){var b=y.result;return f.factResult=y.leftHandSideValue,f.valueResult=y.rightHandSideValue,f.result=b,b})},s=function(f,v){return Array.isArray(f)||(f=[f]),Promise.all(f.map(function(g){return a(g)})).then(function(g){return(0,Zv.default)("rule::evaluateConditions",{results:g}),v.call(g,function(y){return y===!0})})},c=function(f,v){if(f.length===0)return Promise.resolve(!0);if(f.length===1)return a(f[0]);for(var g=o.prioritizeConditions(f),y=Promise.resolve(v==="all"),b=function(T){var P=g[T];y=y.then(function(L){return v==="any"?L||s(P,Array.prototype.some):L&&s(P,Array.prototype.every)})},O=0;O<g.length;O++)b(O);return y},l=function(f){return c(f,"any")},d=function(f){return c(f,"all")},u=function(f){return c([f],"not").then(function(v){return!v})},h=function(f){var v=o.engine.conditions.get(f.condition);if(v)return delete f.condition,Object.assign(f,(0,ey.default)(v)),a(f);if(o.engine.allowUndefinedConditions)return f.result=!1,Promise.resolve(!1);throw new Error("No condition "+f.condition+" exists")},p=function(f){i.setResult(f);var v=Promise.resolve();o.engine.replaceFactsInEventParams&&(v=i.resolveEventParams(n));var g=f?"success":"failure";return v.then(function(){return o.emitAsync(g,i.event,n,i)}).then(function(){return i})};return i.conditions.any?l(i.conditions.any).then(function(x){return p(x)}):i.conditions.all?d(i.conditions.all).then(function(x){return p(x)}):i.conditions.not?u(i.conditions.not).then(function(x){return p(x)}):h(i.conditions).then(function(x){return p(x)})}}]),t}(ry.default);tn.default=ay;var on={},_o={};Object.defineProperty(_o,"__esModule",{value:!0});function sy(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cy(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function ly(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}_o.UndefinedFactError=function(e){ly(t,e);function t(){var r;sy(this,t);for(var n=arguments.length,o=Array(n),i=0;i<n;i++)o[i]=arguments[i];var a=cy(this,(r=t.__proto__||Object.getPrototypeOf(t)).call.apply(r,[this].concat(o)));return a.code="UNDEFINED_FACT",a}return t}(Error);class uy{add(t,r,n){if(typeof arguments[0]!="string")for(let o in arguments[0])this.add(o,arguments[0][o],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(o){this[o]=this[o]||[],r&&this[o][n?"unshift":"push"](r)},this)}run(t,r){this[t]=this[t]||[],this[t].forEach(function(n){n.call(r&&r.context?r.context:r,r)})}}class dy{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach(o=>{if(typeof o!="object"||!o.name||!o.init)throw new Error("Invalid JSEP plugin format");this.registered[o.name]||(o.init(this.jsep),this.registered[o.name]=o)})}}class N{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+N.version}static addUnaryOp(t){return N.max_unop_len=Math.max(t.length,N.max_unop_len),N.unary_ops[t]=1,N}static addBinaryOp(t,r,n){return N.max_binop_len=Math.max(t.length,N.max_binop_len),N.binary_ops[t]=r,n?N.right_associative.add(t):N.right_associative.delete(t),N}static addIdentifierChar(t){return N.additional_identifier_chars.add(t),N}static addLiteral(t,r){return N.literals[t]=r,N}static removeUnaryOp(t){return delete N.unary_ops[t],t.length===N.max_unop_len&&(N.max_unop_len=N.getMaxKeyLen(N.unary_ops)),N}static removeAllUnaryOps(){return N.unary_ops={},N.max_unop_len=0,N}static removeIdentifierChar(t){return N.additional_identifier_chars.delete(t),N}static removeBinaryOp(t){return delete N.binary_ops[t],t.length===N.max_binop_len&&(N.max_binop_len=N.getMaxKeyLen(N.binary_ops)),N.right_associative.delete(t),N}static removeAllBinaryOps(){return N.binary_ops={},N.max_binop_len=0,N}static removeLiteral(t){return delete N.literals[t],N}static removeAllLiterals(){return N.literals={},N}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new N(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(r=>r.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return N.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!N.binary_ops[String.fromCharCode(t)]||N.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return N.isIdentifierStart(t)||N.isDecimalDigit(t)}throwError(t){const r=new Error(t+" at character "+this.index);throw r.index=this.index,r.description=t,r}runHook(t,r){if(N.hooks[t]){const n={context:this,node:r};return N.hooks.run(t,n),n.node}return r}searchHook(t){if(N.hooks[t]){const r={context:this};return N.hooks[t].find(function(n){return n.call(r.context,r),r.node}),r.node}}gobbleSpaces(){let t=this.code;for(;t===N.SPACE_CODE||t===N.TAB_CODE||t===N.LF_CODE||t===N.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),r=t.length===1?t[0]:{type:N.COMPOUND,body:t};return this.runHook("after-all",r)}gobbleExpressions(t){let r=[],n,o;for(;this.index<this.expr.length;)if(n=this.code,n===N.SEMCOL_CODE||n===N.COMMA_CODE)this.index++;else if(o=this.gobbleExpression())r.push(o);else if(this.index<this.expr.length){if(n===t)break;this.throwError('Unexpected "'+this.char+'"')}return r}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,N.max_binop_len),r=t.length;for(;r>0;){if(N.binary_ops.hasOwnProperty(t)&&(!N.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!N.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=r,t;t=t.substr(0,--r)}return!1}gobbleBinaryExpression(){let t,r,n,o,i,a,s,c,l;if(a=this.gobbleToken(),!a||(r=this.gobbleBinaryOp(),!r))return a;for(i={value:r,prec:N.binaryPrecedence(r),right_a:N.right_associative.has(r)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+r),o=[a,i,s];r=this.gobbleBinaryOp();){if(n=N.binaryPrecedence(r),n===0){this.index-=r.length;break}i={value:r,prec:n,right_a:N.right_associative.has(r)},l=r;const d=u=>i.right_a&&u.right_a?n>u.prec:n<=u.prec;for(;o.length>2&&d(o[o.length-2]);)s=o.pop(),r=o.pop().value,a=o.pop(),t={type:N.BINARY_EXP,operator:r,left:a,right:s},o.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+l),o.push(i,t)}for(c=o.length-1,t=o[c];c>1;)t={type:N.BINARY_EXP,operator:o[c-1].value,left:o[c-2],right:t},c-=2;return t}gobbleToken(){let t,r,n,o;if(this.gobbleSpaces(),o=this.searchHook("gobble-token"),o)return this.runHook("after-token",o);if(t=this.code,N.isDecimalDigit(t)||t===N.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===N.SQUOTE_CODE||t===N.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===N.OBRACK_CODE)o=this.gobbleArray();else{for(r=this.expr.substr(this.index,N.max_unop_len),n=r.length;n>0;){if(N.unary_ops.hasOwnProperty(r)&&(!N.isIdentifierStart(this.code)||this.index+r.length<this.expr.length&&!N.isIdentifierPart(this.expr.charCodeAt(this.index+r.length)))){this.index+=n;const i=this.gobbleToken();return i||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:N.UNARY_EXP,operator:r,argument:i,prefix:!0})}r=r.substr(0,--n)}N.isIdentifierStart(t)?(o=this.gobbleIdentifier(),N.literals.hasOwnProperty(o.name)?o={type:N.LITERAL,value:N.literals[o.name],raw:o.name}:o.name===N.this_str&&(o={type:N.THIS_EXP})):t===N.OPAREN_CODE&&(o=this.gobbleGroup())}return o?(o=this.gobbleTokenProperty(o),this.runHook("after-token",o)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let r=this.code;for(;r===N.PERIOD_CODE||r===N.OBRACK_CODE||r===N.OPAREN_CODE||r===N.QUMARK_CODE;){let n;if(r===N.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==N.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),r=this.code}this.index++,r===N.OBRACK_CODE?(t={type:N.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),r=this.code,r!==N.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):r===N.OPAREN_CODE?t={type:N.CALL_EXP,arguments:this.gobbleArguments(N.CPAREN_CODE),callee:t}:(r===N.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),t={type:N.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),n&&(t.optional=!0),this.gobbleSpaces(),r=this.code}return t}gobbleNumericLiteral(){let t="",r,n;for(;N.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===N.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);N.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(r=this.char,r==="e"||r==="E"){for(t+=this.expr.charAt(this.index++),r=this.char,(r==="+"||r==="-")&&(t+=this.expr.charAt(this.index++));N.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);N.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return n=this.code,N.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(n===N.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===N.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:N.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";const r=this.index,n=this.expr.charAt(this.index++);let o=!1;for(;this.index<this.expr.length;){let i=this.expr.charAt(this.index++);if(i===n){o=!0;break}else if(i==="\\")switch(i=this.expr.charAt(this.index++),i){case"n":t+=`
|
|
113
|
+
`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=i}else t+=i}return o||this.throwError('Unclosed quote after "'+t+'"'),{type:N.LITERAL,value:t,raw:this.expr.substring(r,this.index)}}gobbleIdentifier(){let t=this.code,r=this.index;for(N.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,N.isIdentifierPart(t));)this.index++;return{type:N.IDENTIFIER,name:this.expr.slice(r,this.index)}}gobbleArguments(t){const r=[];let n=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let i=this.code;if(i===t){n=!0,this.index++,t===N.CPAREN_CODE&&o&&o>=r.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(i===N.COMMA_CODE){if(this.index++,o++,o!==r.length){if(t===N.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===N.CBRACK_CODE)for(let a=r.length;a<o;a++)r.push(null)}}else if(r.length!==o&&o!==0)this.throwError("Expected comma");else{const a=this.gobbleExpression();(!a||a.type===N.COMPOUND)&&this.throwError("Expected comma"),r.push(a)}}return n||this.throwError("Expected "+String.fromCharCode(t)),r}gobbleGroup(){this.index++;let t=this.gobbleExpressions(N.CPAREN_CODE);if(this.code===N.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:N.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:N.ARRAY_EXP,elements:this.gobbleArguments(N.CBRACK_CODE)}}}const fy=new uy;Object.assign(N,{hooks:fy,plugins:new dy(N),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),N.max_unop_len=N.getMaxKeyLen(N.unary_ops),N.max_binop_len=N.getMaxKeyLen(N.binary_ops);const at=e=>new N(e).parse(),hy=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(N).filter(e=>!hy.includes(e)&&at[e]===void 0).forEach(e=>{at[e]=N[e]}),at.Jsep=N;const py="ConditionalExpression";var my={name:"ternary",init(e){e.hooks.add("after-expression",function(r){if(r.node&&this.code===e.QUMARK_CODE){this.index++;const n=r.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),r.node={type:py,test:n,consequent:o,alternate:i},n.operator&&e.binary_ops[n.operator]<=.9){let a=n;for(;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;r.node.test=a.right,a.right=r.node,r.node=n}}else this.throwError("Expected :")}})}};at.plugins.register(my);const ll=47,gy=92;var vy={name:"regex",init(e){e.hooks.add("gobble-token",function(r){if(this.code===ll){const n=++this.index;let o=!1;for(;this.index<this.expr.length;){if(this.code===ll&&!o){const i=this.expr.slice(n,this.index);let a="";for(;++this.index<this.expr.length;){const c=this.code;if(c>=97&&c<=122||c>=65&&c<=90||c>=48&&c<=57)a+=this.char;else break}let s;try{s=new RegExp(i,a)}catch(c){this.throwError(c.message)}return r.node={type:e.LITERAL,value:s,raw:this.expr.slice(n-1,this.index)},r.node=this.gobbleTokenProperty(r.node),r.node}this.code===e.OBRACK_CODE?o=!0:o&&this.code===e.CBRACK_CODE&&(o=!1),this.index+=this.code===gy?2:1}this.throwError("Unclosed Regex")}})}};const ko=43,Kt={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[ko,45],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];Kt.assignmentOperators.forEach(n=>e.addBinaryOp(n,Kt.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(o){const i=this.code;Kt.updateOperators.some(a=>a===i&&a===this.expr.charCodeAt(this.index+1))&&(this.index+=2,o.node={type:"UpdateExpression",operator:i===ko?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!o.node.argument||!t.includes(o.node.argument.type))&&this.throwError(`Unexpected ${o.node.operator}`))}),e.hooks.add("after-token",function(o){if(o.node){const i=this.code;Kt.updateOperators.some(a=>a===i&&a===this.expr.charCodeAt(this.index+1))&&(t.includes(o.node.type)||this.throwError(`Unexpected ${o.node.operator}`),this.index+=2,o.node={type:"UpdateExpression",operator:i===ko?"++":"--",argument:o.node,prefix:!1})}}),e.hooks.add("after-expression",function(o){o.node&&r(o.node)});function r(n){Kt.assignmentOperators.has(n.operator)?(n.type="AssignmentExpression",r(n.left),r(n.right)):n.operator||Object.values(n).forEach(o=>{o&&typeof o=="object"&&r(o)})}}};at.plugins.register(vy,Kt),at.addUnaryOp("typeof"),at.addLiteral("null",null),at.addLiteral("undefined",void 0);const yy=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),fe={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return fe.evalBinaryExpression(e,t);case"Compound":return fe.evalCompound(e,t);case"ConditionalExpression":return fe.evalConditionalExpression(e,t);case"Identifier":return fe.evalIdentifier(e,t);case"Literal":return fe.evalLiteral(e,t);case"MemberExpression":return fe.evalMemberExpression(e,t);case"UnaryExpression":return fe.evalUnaryExpression(e,t);case"ArrayExpression":return fe.evalArrayExpression(e,t);case"CallExpression":return fe.evalCallExpression(e,t);case"AssignmentExpression":return fe.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression(e,t){return{"||":(n,o)=>n||o(),"&&":(n,o)=>n&&o(),"|":(n,o)=>n|o(),"^":(n,o)=>n^o(),"&":(n,o)=>n&o(),"==":(n,o)=>n==o(),"!=":(n,o)=>n!=o(),"===":(n,o)=>n===o(),"!==":(n,o)=>n!==o(),"<":(n,o)=>n<o(),">":(n,o)=>n>o(),"<=":(n,o)=>n<=o(),">=":(n,o)=>n>=o(),"<<":(n,o)=>n<<o(),">>":(n,o)=>n>>o(),">>>":(n,o)=>n>>>o(),"+":(n,o)=>n+o(),"-":(n,o)=>n-o(),"*":(n,o)=>n*o(),"/":(n,o)=>n/o(),"%":(n,o)=>n%o()}[e.operator](fe.evalAst(e.left,t),()=>fe.evalAst(e.right,t))},evalCompound(e,t){let r;for(let n=0;n<e.body.length;n++){e.body[n].type==="Identifier"&&["var","let","const"].includes(e.body[n].name)&&e.body[n+1]&&e.body[n+1].type==="AssignmentExpression"&&(n+=1);const o=e.body[n];r=fe.evalAst(o,t)}return r},evalConditionalExpression(e,t){return fe.evalAst(e.test,t)?fe.evalAst(e.consequent,t):fe.evalAst(e.alternate,t)},evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral(e){return e.value},evalMemberExpression(e,t){const r=String(e.computed?fe.evalAst(e.property):e.property.name),n=fe.evalAst(e.object,t);if(n==null)throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);if(!Object.hasOwn(n,r)&&yy.has(r))throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);const o=n[r];return typeof o=="function"?o.bind(n):o},evalUnaryExpression(e,t){return{"-":n=>-fe.evalAst(n,t),"!":n=>!fe.evalAst(n,t),"~":n=>~fe.evalAst(n,t),"+":n=>+fe.evalAst(n,t),typeof:n=>typeof fe.evalAst(n,t)}[e.operator](e.argument)},evalArrayExpression(e,t){return e.elements.map(r=>fe.evalAst(r,t))},evalCallExpression(e,t){const r=e.arguments.map(o=>fe.evalAst(o,t));return fe.evalAst(e.callee,t)(...r)},evalAssignmentExpression(e,t){if(e.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const r=e.left.name,n=fe.evalAst(e.right,t);return t[r]=n,t[r]}};class by{constructor(t){this.code=t,this.ast=at(this.code)}runInNewContext(t){const r=Object.assign(Object.create(null),t);return fe.evalAst(this.ast,r)}}function yt(e,t){return e=e.slice(),e.push(t),e}function Po(e,t){return t=t.slice(),t.unshift(e),t}class wy extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}}function ae(e,t,r,n,o){if(!(this instanceof ae))try{return new ae(e,t,r,n,o)}catch(a){if(!a.avoidNew)throw a;return a.value}typeof e=="string"&&(o=n,n=r,r=t,t=e,e=null);const i=e&&typeof e=="object";if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?"safe":e.eval,this.ignoreEvalErrors=typeof e.ignoreEvalErrors>"u"?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){const a={path:i?e.path:t};i?"json"in e&&(a.json=e.json):a.json=r;const s=this.evaluate(a);if(!s||typeof s!="object")throw new wy(s);return s}}ae.prototype.evaluate=function(e,t,r,n){let o=this.parent,i=this.parentProperty,{flatten:a,wrap:s}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),a=Object.hasOwn(e,"flatten")?e.flatten:a,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,s=Object.hasOwn(e,"wrap")?e.wrap:s,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,r=Object.hasOwn(e,"callback")?e.callback:r,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=Object.hasOwn(e,"parent")?e.parent:o,i=Object.hasOwn(e,"parentProperty")?e.parentProperty:i,e=e.path}if(o=o||null,i=i||null,Array.isArray(e)&&(e=ae.toPathString(e)),!e&&e!==""||!t)return;const c=ae.toPathArray(e);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;const l=this._trace(c,t,["$"],o,i,r).filter(function(d){return d&&!d.isParentSelector});return l.length?!s&&l.length===1&&!l[0].hasArrExpr?this._getPreferredOutput(l[0]):l.reduce((d,u)=>{const h=this._getPreferredOutput(u);return a&&Array.isArray(h)?d=d.concat(h):d.push(h),d},[]):s?[]:void 0},ae.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const r=Array.isArray(e.path)?e.path:ae.toPathArray(e.path);return e.pointer=ae.toPointer(r),e.path=typeof e.path=="string"?e.path:ae.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return ae.toPathString(e[t]);case"pointer":return ae.toPointer(e.path);default:throw new TypeError("Unknown result type")}},ae.prototype._handleCallback=function(e,t,r){if(t){const n=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:ae.toPathString(e.path),t(n,r,e)}},ae.prototype._trace=function(e,t,r,n,o,i,a,s){let c;if(!e.length)return c={path:r,value:t,parent:n,parentProperty:o,hasArrExpr:a},this._handleCallback(c,i,"value"),c;const l=e[0],d=e.slice(1),u=[];function h(p){Array.isArray(p)?p.forEach(x=>{u.push(x)}):u.push(p)}if((typeof l!="string"||s)&&t&&Object.hasOwn(t,l))h(this._trace(d,t[l],yt(r,l),t,l,i,a));else if(l==="*")this._walk(t,p=>{h(this._trace(d,t[p],yt(r,p),t,p,i,!0,!0))});else if(l==="..")h(this._trace(d,t,r,n,o,i,a)),this._walk(t,p=>{typeof t[p]=="object"&&h(this._trace(e.slice(),t[p],yt(r,p),t,p,i,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:d,isParentSelector:!0};if(l==="~")return c={path:yt(r,l),value:o,parent:n,parentProperty:null},this._handleCallback(c,i,"property"),c;if(l==="$")h(this._trace(d,t,r,null,null,i,a));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))h(this._slice(l,d,t,r,n,o,i));else if(l.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const p=l.replace(/^\?\((.*?)\)$/u,"$1"),x=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(p);x?this._walk(t,f=>{const v=[x[2]],g=x[1]?t[f][x[1]]:t[f];this._trace(v,g,r,n,o,i,!0).length>0&&h(this._trace(d,t[f],yt(r,f),t,f,i,!0))}):this._walk(t,f=>{this._eval(p,t[f],f,r,n,o)&&h(this._trace(d,t[f],yt(r,f),t,f,i,!0))})}else if(l[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(Po(this._eval(l,t,r.at(-1),r.slice(0,-1),n,o),d),t,r,n,o,i,a))}else if(l[0]==="@"){let p=!1;const x=l.slice(1,-2);switch(x){case"scalar":(!t||!["object","function"].includes(typeof t))&&(p=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===x&&(p=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(p=!0);break;case"number":Number.isFinite(t)&&(p=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(p=!0);break;case"object":t&&typeof t===x&&(p=!0);break;case"array":Array.isArray(t)&&(p=!0);break;case"other":p=this.currOtherTypeCallback(t,r,n,o);break;case"null":t===null&&(p=!0);break;default:throw new TypeError("Unknown value type "+x)}if(p)return c={path:r,value:t,parent:n,parentProperty:o},this._handleCallback(c,i,"value"),c}else if(l[0]==="`"&&t&&Object.hasOwn(t,l.slice(1))){const p=l.slice(1);h(this._trace(d,t[p],yt(r,p),t,p,i,a,!0))}else if(l.includes(",")){const p=l.split(",");for(const x of p)h(this._trace(Po(x,d),t,r,n,o,i,!0))}else!s&&t&&Object.hasOwn(t,l)&&h(this._trace(d,t[l],yt(r,l),t,l,i,a,!0))}if(this._hasParentSelector)for(let p=0;p<u.length;p++){const x=u[p];if(x&&x.isParentSelector){const f=this._trace(x.expr,t,x.path,n,o,i,a);if(Array.isArray(f)){u[p]=f[0];const v=f.length;for(let g=1;g<v;g++)p++,u.splice(p,0,f[g])}else u[p]=f}}return u},ae.prototype._walk=function(e,t){if(Array.isArray(e)){const r=e.length;for(let n=0;n<r;n++)t(n)}else e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t(r)})},ae.prototype._slice=function(e,t,r,n,o,i,a){if(!Array.isArray(r))return;const s=r.length,c=e.split(":"),l=c[2]&&Number.parseInt(c[2])||1;let d=c[0]&&Number.parseInt(c[0])||0,u=c[1]&&Number.parseInt(c[1])||s;d=d<0?Math.max(0,d+s):Math.min(s,d),u=u<0?Math.max(0,u+s):Math.min(s,u);const h=[];for(let p=d;p<u;p+=l)this._trace(Po(p,t),r,n,o,i,a,!0).forEach(f=>{h.push(f)});return h},ae.prototype._eval=function(e,t,r,n,o,i){this.currSandbox._$_parentProperty=i,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;const a=e.includes("@path");a&&(this.currSandbox._$_path=ae.toPathString(n.concat([r])));const s=this.currEval+"Script:"+e;if(!ae.cache[s]){let c=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(a&&(c=c.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)ae.cache[s]=new this.safeVm.Script(c);else if(this.currEval==="native")ae.cache[s]=new this.vm.Script(c);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const l=this.currEval;ae.cache[s]=new l(c)}else if(typeof this.currEval=="function")ae.cache[s]={runInNewContext:l=>this.currEval(c,l)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return ae.cache[s].runInNewContext(this.currSandbox)}catch(c){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+c.message+": "+e)}},ae.cache={},ae.toPathString=function(e){const t=e,r=t.length;let n="$";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(n+=/^[0-9*]+$/u.test(t[o])?"["+t[o]+"]":"['"+t[o]+"']");return n},ae.toPointer=function(e){const t=e,r=t.length;let n="";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(n+="/"+t[o].toString().replaceAll("~","~0").replaceAll("/","~1"));return n},ae.toPathArray=function(e){const{cache:t}=ae;if(t[e])return t[e].concat();const r=[],o=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(i,a){return"[#"+(r.push(a)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(i,a){return"['"+a.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(i,a){return";"+a.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(i){const a=i.match(/#(\d+)/u);return!a||!a[1]?i:r[a[1]]});return t[e]=o,t[e].concat()},ae.prototype.safeVm={Script:by};const xy=function(e,t,r){const n=e.length;for(let o=0;o<n;o++){const i=e[o];r(i)&&t.push(e.splice(o--,1)[0])}};class Ey{constructor(t){this.code=t}runInNewContext(t){let r=this.code;const n=Object.keys(t),o=[];xy(n,o,l=>typeof t[l]=="function");const i=n.map(l=>t[l]);r=o.reduce((l,d)=>{let u=t[d].toString();return/function/u.test(u)||(u="function "+u),"var "+d+"="+u+";"+l},"")+r,!/(['"])use strict\1/u.test(r)&&!n.includes("arguments")&&(r="var arguments = undefined;"+r),r=r.replace(/;\s*$/u,"");const s=r.lastIndexOf(";"),c=s!==-1?r.slice(0,s+1)+" return "+r.slice(s+1):" return "+r;return new Function(...n,c)(...i)}}ae.prototype.vm={Script:Ey};const Cy=sv(Object.freeze(Object.defineProperty({__proto__:null,JSONPath:ae},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(on,"__esModule",{value:!0});var Mo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sy=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Oy=gr,Ao=ul(Oy),_y=_o,ky=_t,kt=ul(ky),Py=Cy;function ul(e){return e&&e.__esModule?e:{default:e}}function My(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ay(e,t){return(0,Py.JSONPath)({path:t,json:e,wrap:!1})}var Ny=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};My(this,e),this.factMap=new Map,this.factResultsCache=new Map,this.allowUndefinedFacts=!!t.allowUndefinedFacts,this.pathResolver=t.pathResolver||Ay,this.events={success:[],failure:[]},this.ruleResults=[]}return Sy(e,[{key:"addEvent",value:function(r,n){if(!n)throw new Error('outcome required: "success" | "failure"]');this.events[n].push(r)}},{key:"getEvents",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return r?this.events[r]:this.events.success.concat(this.events.failure)}},{key:"addResult",value:function(r){this.ruleResults.push(r)}},{key:"getResults",value:function(){return this.ruleResults}},{key:"_getFact",value:function(r){return this.factMap.get(r)}},{key:"_addConstantFact",value:function(r){this.factMap.set(r.id,r),this._setFactValue(r,{},r.value)}},{key:"_setFactValue",value:function(r,n,o){var i=r.getCacheKey(n),a=Promise.resolve(o);return i&&this.factResultsCache.set(i,a),a}},{key:"addFact",value:function(r,n,o){var i=r,a=void 0;return r instanceof Ao.default?(i=r.id,a=r):a=new Ao.default(r,n,o),(0,kt.default)("almanac::addFact",{id:i}),this.factMap.set(i,a),a.isConstant()&&this._setFactValue(a,{},a.value),this}},{key:"addRuntimeFact",value:function(r,n){(0,kt.default)("almanac::addRuntimeFact",{id:r});var o=new Ao.default(r,n);return this._addConstantFact(o)}},{key:"factValue",value:function(r){var n=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",a=void 0,s=this._getFact(r);if(s===void 0)return this.allowUndefinedFacts?Promise.resolve(void 0):Promise.reject(new _y.UndefinedFactError("Undefined fact: "+r));if(s.isConstant())a=Promise.resolve(s.calculate(o,this));else{var c=s.getCacheKey(o),l=c&&this.factResultsCache.get(c);l?(a=Promise.resolve(l),(0,kt.default)("almanac::factValue cache hit for fact",{id:r})):((0,kt.default)("almanac::factValue cache miss, calculating",{id:r}),a=this._setFactValue(s,o,s.calculate(o,this)))}return i?((0,kt.default)("condition::evaluate extracting object",{property:i}),a.then(function(d){if(d!=null&&(typeof d>"u"?"undefined":Mo(d))==="object"){var u=n.pathResolver(d,i);return(0,kt.default)("condition::evaluate extracting object",{property:i,received:u}),u}else return(0,kt.default)("condition::evaluate could not compute object path of non-object",{path:i,factValue:d,type:typeof d>"u"?"undefined":Mo(d)}),d})):a}},{key:"getValue",value:function(r){return r!=null&&(typeof r>"u"?"undefined":Mo(r))==="object"&&Object.prototype.hasOwnProperty.call(r,"fact")?this.factValue(r.fact,r.params,r.path):Promise.resolve(r)}}]),e}();on.default=Ny;var No={},Gt={};Object.defineProperty(Gt,"__esModule",{value:!0});var Dy=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function Ty(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Fy=function(){function e(t,r,n){if(Ty(this,e),this.name=String(t),!t)throw new Error("Missing operator name");if(typeof r!="function")throw new Error("Missing operator callback");this.cb=r,this.factValueValidator=n,this.factValueValidator||(this.factValueValidator=function(){return!0})}return Dy(e,[{key:"evaluate",value:function(r,n){return this.factValueValidator(r)&&this.cb(r,n)}}]),e}();Gt.default=Fy,Object.defineProperty(No,"__esModule",{value:!0});var Iy=Gt,Ge=Wy(Iy);function Wy(e){return e&&e.__esModule?e:{default:e}}var je=[];je.push(new Ge.default("equal",function(e,t){return e===t})),je.push(new Ge.default("notEqual",function(e,t){return e!==t})),je.push(new Ge.default("in",function(e,t){return t.indexOf(e)>-1})),je.push(new Ge.default("notIn",function(e,t){return t.indexOf(e)===-1})),je.push(new Ge.default("contains",function(e,t){return e.indexOf(t)>-1},Array.isArray)),je.push(new Ge.default("doesNotContain",function(e,t){return e.indexOf(t)===-1},Array.isArray));function an(e){return Number.parseFloat(e).toString()!=="NaN"}je.push(new Ge.default("lessThan",function(e,t){return e<t},an)),je.push(new Ge.default("lessThanInclusive",function(e,t){return e<=t},an)),je.push(new Ge.default("greaterThan",function(e,t){return e>t},an)),je.push(new Ge.default("greaterThanInclusive",function(e,t){return e>=t},an)),No.default=je;var Do={},wr={};Object.defineProperty(wr,"__esModule",{value:!0});var jy=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Ly=Gt,By=$y(Ly);function $y(e){return e&&e.__esModule?e:{default:e}}function Ry(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Vy=function(){function e(t,r,n){if(Ry(this,e),this.name=String(t),!t)throw new Error("Missing decorator name");if(typeof r!="function")throw new Error("Missing decorator callback");this.cb=r,this.factValueValidator=n,this.factValueValidator||(this.factValueValidator=function(){return!0})}return jy(e,[{key:"decorate",value:function(r){var n=this,o=r.evaluate.bind(r);return new By.default(this.name+":"+r.name,function(i,a){return n.cb(i,a,o)},this.factValueValidator)}}]),e}();wr.default=Vy,Object.defineProperty(Do,"__esModule",{value:!0});var Hy=wr,Xt=Uy(Hy);function Uy(e){return e&&e.__esModule?e:{default:e}}var Pt=[];Pt.push(new Xt.default("someFact",function(e,t,r){return e.some(function(n){return r(n,t)})},Array.isArray)),Pt.push(new Xt.default("someValue",function(e,t,r){return t.some(function(n){return r(e,n)})})),Pt.push(new Xt.default("everyFact",function(e,t,r){return e.every(function(n){return r(n,t)})},Array.isArray)),Pt.push(new Xt.default("everyValue",function(e,t,r){return t.every(function(n){return r(e,n)})})),Pt.push(new Xt.default("swap",function(e,t,r){return r(t,e)})),Pt.push(new Xt.default("not",function(e,t,r){return!r(e,t)})),Do.default=Pt;var To={};Object.defineProperty(To,"__esModule",{value:!0});var Yy=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),zy=Gt,Fo=Wo(zy),qy=wr,Io=Wo(qy),Ky=_t,sn=Wo(Ky);function Wo(e){return e&&e.__esModule?e:{default:e}}function Gy(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Xy=function(){function e(){Gy(this,e),this.operators=new Map,this.decorators=new Map}return Yy(e,[{key:"addOperator",value:function(r,n){var o=void 0;r instanceof Fo.default?o=r:o=new Fo.default(r,n),(0,sn.default)("operatorMap::addOperator",{name:o.name}),this.operators.set(o.name,o)}},{key:"removeOperator",value:function(r){var n=void 0;r instanceof Fo.default?n=r.name:n=r;for(var o=":"+n,i=Array.from(this.operators.keys()),a=0;a<i.length;a++)i[a].endsWith(o)&&this.operators.delete(i[a]);return this.operators.delete(n)}},{key:"addOperatorDecorator",value:function(r,n){var o=void 0;r instanceof Io.default?o=r:o=new Io.default(r,n),(0,sn.default)("operatorMap::addOperatorDecorator",{name:o.name}),this.decorators.set(o.name,o)}},{key:"removeOperatorDecorator",value:function(r){var n=void 0;r instanceof Io.default?n=r.name:n=r;for(var o=n+":",i=Array.from(this.operators.keys()),a=0;a<i.length;a++)i[a].includes(o)&&this.operators.delete(i[a]);return this.decorators.delete(n)}},{key:"get",value:function(r){for(var n=[],o=r;!this.operators.has(o);){var i=o.indexOf(":");if(i>0){var a=o.slice(0,i),s=this.decorators.get(a);if(!s)return(0,sn.default)("operatorMap::get invalid decorator",{name:a}),null;n.unshift(s),o=o.slice(i+1)}else return(0,sn.default)("operatorMap::get no operator",{name:o}),null}for(var c=this.operators.get(o),l=0;l<n.length;l++)c=n[l].decorate(c),this.operators.set(c.name,c);return c}}]),e}();To.default=Xy,Object.defineProperty(it,"__esModule",{value:!0}),it.FINISHED=it.RUNNING=it.READY=void 0;var Qy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zy=function(){function e(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),Jy=gr,xr=st(Jy),eb=tn,jo=st(eb),tb=on,rb=st(tb),nb=cl,ob=st(nb),ib=No,ab=st(ib),sb=Do,cb=st(sb),lb=_t,Qt=st(lb),ub=rn,db=st(ub),fb=To,hb=st(fb);function st(e){return e&&e.__esModule?e:{default:e}}function pb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mb(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function gb(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var vb=it.READY="READY",dl=it.RUNNING="RUNNING",fl=it.FINISHED="FINISHED",yb=function(e){gb(t,e);function t(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};pb(this,t);var o=mb(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.rules=[],o.allowUndefinedFacts=n.allowUndefinedFacts||!1,o.allowUndefinedConditions=n.allowUndefinedConditions||!1,o.replaceFactsInEventParams=n.replaceFactsInEventParams||!1,o.pathResolver=n.pathResolver,o.operators=new hb.default,o.facts=new Map,o.conditions=new Map,o.status=vb,r.map(function(i){return o.addRule(i)}),ab.default.map(function(i){return o.addOperator(i)}),cb.default.map(function(i){return o.addOperatorDecorator(i)}),o}return Zy(t,[{key:"addRule",value:function(n){if(!n)throw new Error("Engine: addRule() requires options");var o=void 0;if(n instanceof jo.default)o=n;else{if(!Object.prototype.hasOwnProperty.call(n,"event"))throw new Error('Engine: addRule() argument requires "event" property');if(!Object.prototype.hasOwnProperty.call(n,"conditions"))throw new Error('Engine: addRule() argument requires "conditions" property');o=new jo.default(n)}return o.setEngine(this),this.rules.push(o),this.prioritizedRules=null,this}},{key:"updateRule",value:function(n){var o=this.rules.findIndex(function(i){return i.name===n.name});if(o>-1)this.rules.splice(o,1),this.addRule(n),this.prioritizedRules=null;else throw new Error("Engine: updateRule() rule not found")}},{key:"removeRule",value:function(n){var o=!1;if(n instanceof jo.default){var a=this.rules.indexOf(n);a>-1&&(o=!!this.rules.splice(a,1).length)}else{var i=this.rules.filter(function(s){return s.name!==n});o=i.length!==this.rules.length,this.rules=i}return o&&(this.prioritizedRules=null),o}},{key:"setCondition",value:function(n,o){if(!n)throw new Error("Engine: setCondition() requires name");if(!o)throw new Error("Engine: setCondition() requires conditions");if(!Object.prototype.hasOwnProperty.call(o,"all")&&!Object.prototype.hasOwnProperty.call(o,"any")&&!Object.prototype.hasOwnProperty.call(o,"not")&&!Object.prototype.hasOwnProperty.call(o,"condition"))throw new Error('"conditions" root must contain a single instance of "all", "any", "not", or "condition"');return this.conditions.set(n,new db.default(o)),this}},{key:"removeCondition",value:function(n){return this.conditions.delete(n)}},{key:"addOperator",value:function(n,o){this.operators.addOperator(n,o)}},{key:"removeOperator",value:function(n){return this.operators.removeOperator(n)}},{key:"addOperatorDecorator",value:function(n,o){this.operators.addOperatorDecorator(n,o)}},{key:"removeOperatorDecorator",value:function(n){return this.operators.removeOperatorDecorator(n)}},{key:"addFact",value:function(n,o,i){var a=n,s=void 0;return n instanceof xr.default?(a=n.id,s=n):s=new xr.default(n,o,i),(0,Qt.default)("engine::addFact",{id:a}),this.facts.set(a,s),this}},{key:"removeFact",value:function(n){var o=void 0;return n instanceof xr.default?o=n.id:o=n,this.facts.delete(o)}},{key:"prioritizeRules",value:function(){if(!this.prioritizedRules){var n=this.rules.reduce(function(o,i){var a=i.priority;return o[a]||(o[a]=[]),o[a].push(i),o},{});this.prioritizedRules=Object.keys(n).sort(function(o,i){return Number(o)>Number(i)?-1:1}).map(function(o){return n[o]})}return this.prioritizedRules}},{key:"stop",value:function(){return this.status=fl,this}},{key:"getFact",value:function(n){return this.facts.get(n)}},{key:"evaluateRules",value:function(n,o){var i=this;return Promise.all(n.map(function(a){return i.status!==dl?((0,Qt.default)("engine::run, skipping remaining rules",{status:i.status}),Promise.resolve()):a.evaluate(o).then(function(s){return(0,Qt.default)("engine::run",{ruleResult:s.result}),o.addResult(s),s.result?(o.addEvent(s.event,"success"),i.emitAsync("success",s.event,o,s).then(function(){return i.emitAsync(s.event.type,s.event.params,o,s)})):(o.addEvent(s.event,"failure"),i.emitAsync("failure",s.event,o,s))})}))}},{key:"run",value:function(){var n=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(0,Qt.default)("engine::run started"),this.status=dl;var a=i.almanac||new rb.default({allowUndefinedFacts:this.allowUndefinedFacts,pathResolver:this.pathResolver});this.facts.forEach(function(u){a.addFact(u)});for(var s in o){var c=void 0;o[s]instanceof xr.default?c=o[s]:c=new xr.default(s,o[s]),a.addFact(c),(0,Qt.default)("engine::run initialized runtime fact",{id:c.id,value:c.value,type:Qy(c.value)})}var l=this.prioritizeRules(),d=Promise.resolve();return new Promise(function(u,h){l.map(function(p){return d=d.then(function(){return n.evaluateRules(p,a)}).catch(h),d}),d.then(function(){n.status=fl,(0,Qt.default)("engine::run completed");var p=a.getResults(),x=p.reduce(function(g,y){var b=y.result?"results":"failureResults";return g[b].push(y),g},{results:[],failureResults:[]}),f=x.results,v=x.failureResults;u({almanac:a,results:f,failureResults:v,events:a.getEvents("success"),failureEvents:a.getEvents("failure")})}).catch(h)})}}]),t}(ob.default);it.default=yb,Object.defineProperty(_e,"__esModule",{value:!0}),_e.OperatorDecorator=_e.Almanac=_e.Engine=_e.Operator=_e.Rule=_e.Fact=void 0,_e.default=function(e,t){return new hl.default(e,t)};var bb=it,hl=Zt(bb),wb=gr,xb=Zt(wb),Eb=tn,Cb=Zt(Eb),Sb=Gt,Ob=Zt(Sb),_b=on,kb=Zt(_b),Pb=wr,Mb=Zt(Pb);function Zt(e){return e&&e.__esModule?e:{default:e}}_e.Fact=xb.default,_e.Rule=Cb.default,_e.Operator=Ob.default,_e.Engine=hl.default,_e.Almanac=kb.default,_e.OperatorDecorator=Mb.default;var Ab=_e;function Nb(e){return e.map(t=>{const r=[];if(Object.entries(t.conditions).forEach(([n,o])=>{n!=="all"&&n!=="any"&&typeof o=="object"&&!Array.isArray(o)&&r.push(...Lo(n,o))}),t.conditions.all&&Array.isArray(t.conditions.all)&&t.conditions.all.forEach(n=>{Object.entries(n).forEach(([o,i])=>{r.push(...Lo(o,i))})}),t.conditions.any&&Array.isArray(t.conditions.any)){const n=[];t.conditions.any.forEach(o=>{const i=[];Object.entries(o).forEach(([a,s])=>{i.push(...Lo(a,s))}),i.length>0&&(i.length===1?n.push(i[0]):n.push({all:i}))}),n.length>0&&r.push({any:n})}return{conditions:{all:r},event:t.event}})}function Lo(e,t){const r=[];return Object.entries(t).forEach(([n,o])=>{const i=Db(n);i&&r.push({fact:e,operator:i,value:o})}),r}function Db(e){return{equals:"equal",notEquals:"notEqual",greaterThan:"greaterThan",lessThan:"lessThan",greaterThanOrEqual:"greaterThanOrEqual",lessThanOrEqual:"lessThanOrEqual",contains:"contains",notContains:"doesNotContain",in:"in",notIn:"notIn",empty:"empty",notEmpty:"notEmpty"}[e]||null}function Tb(e,t,r){const n=JSON.parse(JSON.stringify(e)),o=JSON.parse(JSON.stringify(t||{}));if(r.hiddenFields.forEach(i=>{const a=i.replace("root_","").split("_");pl(o,a,"ui:widget","hidden")}),r.disabledFields.forEach(i=>{const a=i.replace("root_","").split("_");pl(o,a,"ui:disabled",!0)}),n.properties){const i=new Set(n.required||[]);r.requiredFields.forEach(a=>{const s=a.replace("root_","");s&&i.add(s)}),n.required=Array.from(i)}return{schema:n,uiSchema:o}}function pl(e,t,r,n){let o=e;for(let a=0;a<t.length-1;a++)o[t[a]]||(o[t[a]]={}),o=o[t[a]];const i=t[t.length-1];o[i]||(o[i]={}),o[i][r]=n}function Bo(e,t="",r="."){const n={};if(!e||typeof e!="object")return n;for(const o in e)if(e.hasOwnProperty(o)){const i=t?`${t}${r}${o}`:o;Array.isArray(e[o])?(e[o].forEach((a,s)=>{const c=`${i}.${s}`;typeof a=="object"&&a!==null?Object.assign(n,Bo(a,c,r)):n[c]=a}),n[i]=e[o]):typeof e[o]=="object"&&e[o]!==null?Object.assign(n,Bo(e[o],i,r)):n[i]=e[o]}return n}const Fb=({schema:e,uiSchema:t={},formData:r,conditionalRules:n,debug:o=!1,onFieldChange:i,onFieldFocus:a,onFieldBlur:s,...c})=>{const[l,d]=D.useState({hiddenFields:new Set,disabledFields:new Set,requiredFields:new Set}),[u,h]=D.useState(r||{}),p=D.useMemo(()=>{const b=new Ab.Engine;return b.addOperator("empty",(S,T)=>{const P=!S||S===""||Array.isArray(S)&&S.length===0;return T?P:!P}),b.addOperator("notEmpty",(S,T)=>{const P=!S||S===""||Array.isArray(S)&&S.length===0;return T?!P:P}),Nb(n).forEach(S=>b.addRule(S)),b},[n]),x=D.useCallback(async b=>{if(!n||n.length===0){d({hiddenFields:new Set,disabledFields:new Set,requiredFields:new Set});return}try{const O=Bo(b);n&&n.forEach(P=>{const L=$=>{Object.keys($).forEach(B=>{B!=="all"&&B!=="any"&&(B in O||(O[B]=void 0))}),$.all&&$.all.forEach(B=>L(B)),$.any&&$.any.forEach(B=>L(B))};L(P.conditions)}),o&&(console.log("Form data:",b),console.log("Extracted facts:",O));const{events:S}=await p.run(O),T={hiddenFields:new Set,disabledFields:new Set,requiredFields:new Set};S.forEach(P=>{var $;const L=(($=P.params)==null?void 0:$.fields)||[];switch(P.type){case"show":L.forEach(B=>T.hiddenFields.delete(B));break;case"hide":L.forEach(B=>T.hiddenFields.add(B));break;case"require":L.forEach(B=>T.requiredFields.add(B));break;case"unrequire":L.forEach(B=>T.requiredFields.delete(B));break;case"disable":L.forEach(B=>T.disabledFields.add(B));break;case"enable":L.forEach(B=>T.disabledFields.delete(B));break}}),o&&(console.log("Conditional engine events:",S),console.log("Conditional state after evaluation:",{hidden:Array.from(T.hiddenFields),disabled:Array.from(T.disabledFields),required:Array.from(T.requiredFields)})),d(T)}catch(O){console.error("Error evaluating conditional rules with engine:",O)}},[p,n,o]);D.useEffect(()=>{x(u)},[u,x]);const{schema:f,uiSchema:v}=D.useMemo(()=>{const b=Tb(e,t,l);return o&&l.requiredFields.size>0&&console.log("Modified schema required fields:",b.schema.required),b},[e,t,l,o]),g=D.useCallback(b=>{o&&console.log("Field changed:",b),i==null||i(b),b.formData&&h(b.formData)},[i,o]),y=D.useCallback(b=>{h(b.formData),c.onChange&&c.onChange(b)},[c]);return w.jsx(Zc,{...c,schema:f,uiSchema:v,formData:u,onChange:y,onFieldChange:g,onFieldFocus:a,onFieldBlur:s})};Y.validator=Yo,Object.defineProperty(Y,"generateTheme",{enumerable:!0,get:()=>yl.generateTheme}),Y.AddressField=li,Y.ArrayFieldItemTemplate=yi,Y.ArrayFieldTemplate=vi,Y.ColorWidget=xi,Y.ConditionalForm=Fb,Y.CurrencyField=pi,Y.DateTimeWidget=wo,Y.DateWidget=vu,Y.EmailWidget=vo,Y.EnhancedCheckboxWidget=Vc,Y.EnhancedNumberWidget=Uc,Y.EnhancedRadioWidget=Hc,Y.EnhancedSelectWidget=Rc,Y.EnhancedTextWidget=Bc,Y.EnhancedTextareaWidget=$c,Y.ExtendedForm=Zc,Y.FileUploadWidget=zc,Y.FileWidget=Ci,Y.FormEventHub=Gc,Y.FormEventManager=iv,Y.FormEventProvider=di,Y.GridLayout=ov,Y.HorizontalLayout=rv,Y.PasswordWidget=bo,Y.PhoneField=hi,Y.RangeWidget=Vi,Y.RatingWidget=Hi,Y.TelephoneWidget=go,Y.URLWidget=yo,Y.VerticalLayout=Jg,Y.cn=J,Y.customFields=bi,Y.customTemplates=wi,Y.customWidgets=Kc,Y.enhancedWidgets=qc,Y.formDataUtils=Xc,Y.schemaUtils=Qc,Y.useFieldEventHandlers=ve,Y.useFormEventHub=fi,Y.validationUtils=av,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
|