@graphprotocol/hypergraph 0.13.0 → 0.13.1
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/mapping/Mapping.js +1 -1
- package/dist/mapping/Mapping.js.map +1 -1
- package/dist/typesync-studio/dist/assets/authenticate-callback-ClHGCEBM.js +29 -1
- package/dist/typesync-studio/dist/assets/authenticate-callback-CtSc34yM.js +1 -0
- package/dist/typesync-studio/dist/assets/ccip-BXDUfOuS.js +1 -0
- package/dist/typesync-studio/dist/assets/ccip-CVB5IdFh.js +167 -1
- package/dist/typesync-studio/dist/assets/index-Bj1QcQTs.js +85 -0
- package/dist/typesync-studio/dist/assets/index-CZGD3lPb.js +13040 -8
- package/dist/typesync-studio/dist/assets/index-DWu6hbGt.js +223 -0
- package/dist/typesync-studio/dist/assets/index-Dmh0I_CD.js +97 -96
- package/dist/typesync-studio/dist/index.html +1 -1
- package/package.json +2 -2
- package/src/mapping/Mapping.ts +1 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import{d as pi,b as Q,g as Me,t as ee,I as st,c as Tl,e as Fl,D as Ol,C as Rl,T as mr,P as wa,f as Il,E as Al,h as Vl,i as Pl,k as jl,l as Nl,m as Dl,B as Ll,n as $l,o as Hl,F as _l,p as Bl,q as Zl,s as Ul,v as zl,w as Gl,x as mi,S as Ie,A as ht,U as gr,y as yn,z as kt,G as _t,N as Le,H as et,J as ae,K as ql,L as ge,M as Un,O as Gs,Q as Kl,V as Wl,W as ve,X as Yl,Y as qs,Z as Ks,_ as Ws,$ as gt,a0 as br,a1 as Ql,a2 as rn,a3 as as,a4 as is,a5 as vr,a6 as Vs,a7 as Ea,a8 as gi,a9 as Sa,aa as _e,ab as zn,ac as an,ad as Gn,ae as Ys,af as ka,ag as Xl,ah as Jl,ai as ec,aj as Ma,ak as os,al as Ca,am as tc,r as o,an as bi,ao as vi,ap as Cn,aq as Tn,u as yr,ar as nc,as as yi,at as xi,au as wi,av as sc,aw as xr,ax as rc,ay as ac,az as ic,aA as oc,aB as lc,aC as Ta,aD as Ei,aE as cc,aF as Fe,aG as Si,j as d,aH as wr,aI as Er,aJ as Je,aK as qn,aL as xt,aM as Nt,aN as Be,aO as Re,aP as Ln,aQ as uc,aR as le,aS as Te,aT as Sr,aU as Bt,aV as wt,aW as kr,aX as Oe,aY as Mr,aZ as Ps,a_ as dc,a$ as fc,b0 as ki,b1 as hc,b2 as Ye,b3 as js,b4 as pc,b5 as mc,b6 as gc,b7 as bc,b8 as vc,b9 as Mi,ba as Ci,bb as yc,bc as We,bd as W,be as ce,bf as pe,bg as qt,bh as U,bi as Ti,bj as ls,bk as cs,bl as Kt,bm as us,bn as ds,bo as ne,bp as Wt,bq as Yt,br as fs,bs as rt,bt as hs,bu as Fa,bv as dn,bw as xc,bx as Fi,by as se,bz as ye,bA as xn,bB as Oi,bC as Dt,bD as Ri,bE as Cr,bF as wn,bG as oe,bH as ke,bI as Ii,bJ as ft,bK as Ai,bL as Xe,bM as Zt,bN as Tr,bO as Fr,bP as Vi,bQ as Pi,bR as ji,bS as Tt,bT as ps,bU as be,bV as Or,bW as Rr,bX as Ir,bY as Se,bZ as wc,b_ as ms,b$ as Qs,c0 as Ar,c1 as Ni,c2 as Ec,c3 as Di,c4 as Vr,c5 as Li,c6 as $i,c7 as gs,c8 as at,c9 as Pr,ca as jr,cb as on,cc as Sc,cd as bs,ce as ln,cf as ze,cg as tt,ch as Hi,ci as Oa,cj as Et,ck as kc,cl as Mc,cm as Cc,cn as Tc,co as _i,cp as Ra,cq as Fc,cr as Oc,cs as Ns,ct as Rc,cu as Ic,cv as Ac,cw as Vc,cx as Pc,cy as jc,cz as Nc,cA as Dc,cB as Lc,cC as $c,cD as Nr,cE as Hc,cF as _c,cG as Bc,cH as Zc,cI as Uc,cJ as zc,cK as Gc,cL as qc,cM as Xs,cN as Kc,cO as Ia,cP as Ue,cQ as Wc,cR as Kn,cS as xe,cT as Bi,cU as Zi,cV as Ui,cW as Ut,cX as zi,cY as Gi,cZ as qi,c_ as Js,c$ as vs,d0 as Yc,d1 as Fn,d2 as Qc,d3 as Xc,d4 as Jc,d5 as On,d6 as Ds,d7 as Rn,d8 as eu,d9 as tu,da as nu,db as Aa}from"./index-DWu6hbGt.js";function su(e){return{type:"createEntity",id:e.id,values:e.values??[]}}function zt(e){return{type:"createRelation",...e}}function Ae(e){return pi(`grc20:genesis:language:${e.toLowerCase()}`)}const Ls={english:()=>Ae("en"),spanish:()=>Ae("es"),french:()=>Ae("fr"),german:()=>Ae("de"),chinese:()=>Ae("zh"),japanese:()=>Ae("ja"),korean:()=>Ae("ko"),portuguese:()=>Ae("pt"),italian:()=>Ae("it"),russian:()=>Ae("ru"),arabic:()=>Ae("ar"),hindi:()=>Ae("hi"),fromCode:e=>Ae(e)},Wn=e=>e.toUpperCase(),Mt=e=>e.toLowerCase(),Yn=e=>e.length===0,nt=e=>e.length>0,Lt=e=>e.length,$n=({id:e,fromEntity:n,toEntity:t,position:s,fromSpace:r,toSpace:a,fromVersion:i,toVersion:l,type:c,entityId:f,entityName:h,entityDescription:g,entityCover:u,entityValues:m,entityRelations:p,entityTypes:b})=>{e&&Q(e,"`id` in `createRelation`"),n&&Q(n,"`fromEntity` in `createRelation`"),t&&Q(t,"`toEntity` in `createRelation`"),r&&Q(r,"`fromSpace` in `createRelation`"),a&&Q(a,"`toSpace` in `createRelation`"),i&&Q(i,"`fromVersion` in `createRelation`"),l&&Q(l,"`toVersion` in `createRelation`"),c&&Q(c,"`type` in `createRelation`"),f&&Q(f,"`entityId` in `createRelation`"),u&&Q(u,"`entityCover` in `createRelation`");for(const w of m??[])Q(w.property,"`entityValues` in `createRelation`"),w.type==="text"&&w.language&&Q(w.language,"`language` in `entityValues` in `createRelation`"),w.type==="float"&&w.unit&&Q(w.unit,"`unit` in `entityValues` in `createRelation`");for(const[w]of Object.entries(p??{}))Q(w,"`entityRelations` in `createRelation`");for(const w of b??[])Q(w,"`entityTypes` in `createRelation`");const y=e??Me(),k=f??Me(),S=[];if(S.push(zt({id:ee(y),entity:ee(k),from:ee(n),to:ee(t),relationType:ee(c),...r?{fromSpace:ee(r)}:{},...i?{fromVersion:ee(i)}:{},...a?{toSpace:ee(a)}:{},...l?{toVersion:ee(l)}:{},...s!==void 0?{position:s}:{}})),h||g||u||m||p||b){const{ops:w}=Dr({id:k,name:h,description:g,cover:u,values:m,relations:p,types:b});S.push(...w)}return{id:st(y),ops:S}},Dr=({id:e,name:n,description:t,cover:s,values:r,relations:a,types:i})=>{e&&Q(e,"`id` in `createEntity`"),s&&Q(s,"`cover` in `createEntity`");for(const h of r??[])Q(h.property,"`values` in `createEntity`"),h.type==="text"&&h.language&&Q(h.language,"`language` in `values` in `createEntity`"),h.type==="float"&&h.unit&&Q(h.unit,"`unit` in `values` in `createEntity`"),h.type==="integer"&&h.unit&&Q(h.unit,"`unit` in `values` in `createEntity`"),h.type==="decimal"&&h.unit&&Q(h.unit,"`unit` in `values` in `createEntity`");for(const[h,g]of Object.entries(a??{}))if(Q(h,"`relations` in `createEntity`"),Array.isArray(g))for(const u of g)Q(u.toEntity,"`toEntity` in `relations` in `createEntity`"),u.toSpace&&Q(u.toSpace,"`toSpace` in `relations` in `createEntity`"),u.fromSpace&&Q(u.fromSpace,"`fromSpace` in `relations` in `createEntity`"),u.fromVersion&&Q(u.fromVersion,"`fromVersion` in `relations` in `createEntity`"),u.toVersion&&Q(u.toVersion,"`toVersion` in `relations` in `createEntity`"),u.entityId&&Q(u.entityId,"`entityId` in `relations` in `createEntity`"),u.entityCover&&Q(u.entityCover,"`entityCover` in `relations` in `createEntity`");else Q(g.toEntity,"`toEntity` in `relations` in `createEntity`"),g.toSpace&&Q(g.toSpace,"`toSpace` in `relations` in `createEntity`"),g.fromSpace&&Q(g.fromSpace,"`fromSpace` in `relations` in `createEntity`"),g.fromVersion&&Q(g.fromVersion,"`fromVersion` in `relations` in `createEntity`"),g.toVersion&&Q(g.toVersion,"`toVersion` in `relations` in `createEntity`"),g.entityId&&Q(g.entityId,"`entityId` in `relations` in `createEntity`"),g.entityCover&&Q(g.entityCover,"`entityCover` in `relations` in `createEntity`");for(const h of i??[])Q(h,"`types` in `createEntity`");const l=e??Me();let c=[];const f=[];n&&f.push({property:ee(Fl),value:{type:"text",value:n,language:Ls.english()}}),t&&f.push({property:ee(Ol),value:{type:"text",value:t,language:Ls.english()}});for(const h of r??[]){const g=ee(h.property);if(h.type==="text")f.push({property:g,value:{type:"text",value:h.value,language:h.language?ee(h.language):Ls.english()}});else if(h.type==="float")f.push({property:g,value:{type:"float",value:h.value,...h.unit?{unit:ee(h.unit)}:{}}});else if(h.type==="boolean")f.push({property:g,value:{type:"boolean",value:h.value}});else if(h.type==="point")f.push({property:g,value:{type:"point",lon:h.lon,lat:h.lat,...h.alt!==void 0?{alt:h.alt}:{}}});else if(h.type==="date")f.push({property:g,value:{type:"date",value:h.value}});else if(h.type==="time")f.push({property:g,value:{type:"time",value:h.value}});else if(h.type==="datetime")f.push({property:g,value:{type:"datetime",value:h.value}});else if(h.type==="schedule")f.push({property:g,value:{type:"schedule",value:h.value}});else if(h.type==="integer")f.push({property:g,value:{type:"integer",value:Tl(h.value,"`integer` value in `createEntity`"),...h.unit?{unit:ee(h.unit)}:{}}});else if(h.type==="decimal")f.push({property:g,value:{type:"decimal",exponent:h.exponent,mantissa:h.mantissa,...h.unit?{unit:ee(h.unit)}:{}}});else if(h.type==="bytes")f.push({property:g,value:{type:"bytes",value:h.value}});else if(h.type==="embedding")f.push({property:g,value:{type:"embedding",subType:h.subType,dims:h.dims,data:h.data}});else{const u=h;throw new Error(`Unsupported value type: ${u.type}`)}}if(c.push(su({id:ee(l),values:f})),s&&c.push(zt({id:ee(Me()),entity:ee(Me()),from:ee(l),to:ee(s),relationType:ee(Rl)})),i)for(const h of i)c.push(zt({id:ee(Me()),entity:ee(Me()),from:ee(l),to:ee(h),relationType:ee(mr)}));for(const[h,g]of Object.entries(a??{})){const u=Array.isArray(g)?g:[g];for(const m of u){const p=m.id??Me(),b=m.entityId??Me(),{ops:y}=$n({id:p,fromEntity:l,toEntity:m.toEntity,type:st(h),position:m.position,fromSpace:m.fromSpace,toSpace:m.toSpace,fromVersion:m.fromVersion,toVersion:m.toVersion,entityId:b,entityName:m.entityName,entityDescription:m.entityDescription,entityCover:m.entityCover,entityValues:m.entityValues,entityRelations:m.entityRelations,entityTypes:m.entityTypes});c=c.concat(y)}}return{id:st(l),ops:c}},ru={BOOLEAN:Zl,INTEGER:Bl,FLOAT:_l,DECIMAL:Hl,TEXT:$l,BYTES:Ll,DATE:Dl,TIME:Nl,DATETIME:jl,SCHEDULE:Pl,POINT:Vl,EMBEDDING:Al},er=e=>{const{id:n,name:t,description:s,cover:r}=e;if(n&&Q(n,"`id` in `createProperty`"),r&&Q(r,"`cover` in `createProperty`"),e.dataType==="RELATION"){for(const c of e.properties??[])Q(c,"`properties` in `createProperty`");for(const c of e.relationValueTypes??[])Q(c,"`relationValueTypes` in `createProperty`")}const a=n??Me(),i=[],{ops:l}=Dr({id:a,name:t,description:s,cover:r});if(i.push(...l),i.push(zt({id:ee(Me()),entity:ee(Me()),from:ee(a),to:ee(wa),relationType:ee(mr)})),e.dataType==="RELATION"){if(e.properties)for(const c of e.properties){Q(c);const{ops:f}=$n({fromEntity:a,toEntity:c,type:wa});i.push(...f)}if(e.relationValueTypes)for(const c of e.relationValueTypes){Q(c);const{ops:f}=$n({fromEntity:a,toEntity:c,type:Il});i.push(...f)}}else{const c=ru[e.dataType],{ops:f}=$n({fromEntity:a,toEntity:c,type:Ul});i.push(...f)}return{id:st(a),ops:i}},Ki=({id:e,name:n,description:t,cover:s,properties:r})=>{e&&Q(e,"`id` in `createType`");for(const l of r??[])Q(l,"`properties` in `createType`");const a=e??Me(),{ops:i}=Dr({id:a,name:n,description:t,cover:s});if(Q(a),i.push(zt({id:ee(Me()),entity:ee(Me()),from:ee(a),to:ee(zl),relationType:ee(mr)})),r)for(const l of r)Q(l,"`propertyId` in `createType`"),i.push(zt({id:ee(Me()),entity:ee(Me()),from:ee(a),to:ee(l),relationType:ee(Gl)}));return{id:st(a),ops:i}};function Wi(e){if(Yn(e))throw new Yi({input:e,cause:"Input is empty"});let n="",t=!1,s=0;for(;s<Lt(e)&&!/[a-zA-Z0-9]/.test(e[s]);)s++;for(;s<Lt(e);s++){const r=e[s];/[a-zA-Z0-9]/.test(r)?t?(n+=Wn(r),t=!1):Lt(n)===0?n+=Mt(r):/[A-Z]/.test(r)&&s>0&&/[a-z0-9]/.test(e[s-1])?n+=Wn(r):n+=Mt(r):t=Lt(n)>0}return n}function tr(e){if(Yn(e))throw new Yi({input:e,cause:"Input is empty"});let n="",t=!0,s=0;for(;s<Lt(e)&&!/[a-zA-Z0-9]/.test(e[s]);)s++;for(;s<Lt(e);s++){const r=e[s];/[a-zA-Z0-9]/.test(r)?t?(n+=Wn(r),t=!1):/[A-Z]/.test(r)&&s>0&&/[a-z0-9]/.test(e[s-1])?n+=Wn(r):n+=Mt(r):t=!0}return n}class Yi extends mi("/typesync/errors/InvalidInputError"){}function ys(e){const n=new Set;for(const t of e){const s=Mt(t.name);if(n.has(s))return!1;n.add(s)}return!0}function dt(e){return/^Relation\((.+)\)$/.test(e)}const Qi=Le.pipe(kt(e=>dt(e))),Xi=br("String","Number","Boolean","Date","Point");gr(Xi,Qi);const Ji=Ie({name:Le,knowledgeGraphId:_t(rn),optional:Gs(Kl(Ql))}),eo=Ie({...Ji.fields,dataType:Qi,relationType:Le.annotations({identifier:"SchemaTypePropertyRelation.relationType",description:"name of the type within the schema that this property is related to",examples:["Account"]})}),to=Ie({...Ji.fields,dataType:Xi});function fn(e){return dt(e.dataType)}const no=Ie({name:Le,knowledgeGraphId:_t(rn),properties:ht(gr(to,eo)).pipe(yn(1),kt(ys,{identifier:"DuplicatePropertyNames",jsonSchema:{},description:"The property.name must be unique across all properties in the type"}))}),so=Ie({types:ht(no).pipe(yn(1),kt(ys,{identifier:"DuplicateTypeNames",jsonSchema:{},description:"The type.name must be unique across all types in the schema"}),kt(ro,{identifier:"AllRelationTypesExist",jsonSchema:{},description:"Each type property of dataType RELATION must have a type of the same name in the schema"}))}).annotations({identifier:"typesync/Schema",title:"TypeSync app Schema",description:"An array of types in the schema defined by the user to generate a Mapping object for",examples:[{types:[{name:"Account",knowledgeGraphId:null,properties:[{name:"username",optional:null,knowledgeGraphId:null,dataType:"String"}]}]},{types:[{name:"Account",knowledgeGraphId:"a5fd07b1120f46c6b46f387ef98396a6",properties:[{name:"name",optional:!0,knowledgeGraphId:"a126ca530c8e48d5b88882c734c38935",dataType:"String"}]}]}]}),au=Wl(so);as(so);function ro(e){const n=et(e,new Set,(t,s)=>t.add(s.name));return ae(e,Un(t=>t.properties),ge(t=>fn(t)),ql(t=>n.has(t.relationType)))}function nr(e){return ae(e,et({},(n,{propName:t,id:s})=>(n[Wi(t)]=s,n)))}function sr(e){return ae(e,et({},(n,{propName:t,id:s})=>(n[Wi(t)]=s,n)))}function iu(e,n){if(e.knowledgeGraphId)return{type:"resolved",mapping:{propName:e.name,id:st(e.knowledgeGraphId)},ops:[]};if(fn(e)){const r=n.get(e.relationType);if(r==null)return{type:"deferred",property:e};const{id:a,ops:i}=er({name:e.name,dataType:"RELATION",relationValueTypes:[r]});return{type:"resolved",mapping:{propName:e.name,id:a},ops:i}}const{id:t,ops:s}=er({name:e.name,dataType:uu(e.dataType)});return{type:"resolved",mapping:{propName:e.name,id:t},ops:s}}function ou(e,n){const t=ae(e.properties,ve(u=>iu(u,n))),s=ae(t,qs(u=>u.type==="resolved"?Ws(u):Ks())),r=ae(t,qs(u=>u.type==="deferred"?Ws(u.property):Ks())),a=ae(s,ge(u=>{const m=e.properties.find(p=>p.name===u.mapping.propName);return m?!fn(m):!1}),ve(u=>u.mapping)),i=ae(s,ge(u=>{const m=e.properties.find(p=>p.name===u.mapping.propName);return m?fn(m):!1}),ve(u=>u.mapping)),l=ae(s,Un(u=>u.ops));if(e.knowledgeGraphId){const u={typeName:tr(e.name),typeIds:[st(e.knowledgeGraphId)]};return gt(a)&&(u.properties=nr(a)),gt(i)&&(u.relations=sr(i)),{type:"complete",entry:u,ops:l}}if(gt(r))return{type:"deferred",schemaType:e,properties:a,relations:i};const c=[...a,...i],{id:f,ops:h}=Ki({name:e.name,properties:ae(c,ve(u=>u.id))});n.set(e.name,f);const g={typeName:tr(e.name),typeIds:[f]};return gt(a)&&(g.properties=nr(a)),gt(i)&&(g.relations=sr(i)),{type:"complete",entry:g,ops:[...l,...h]}}function lu(e){const n=au(e),t=ae(n.types,et(new Map,(g,u)=>g.set(u.name,u.knowledgeGraphId!=null?st(u.knowledgeGraphId):null))),s=ae(n.types,ve(g=>ou(g,t))),[r,a]=ae(s,Yl(g=>g.type==="complete")),i=ae(a,Un(g=>g.ops)),{entries:l,ops:c}=ae(r,et({entries:[],ops:[]},(g,u)=>{const m=ae(u.schemaType.properties,qs(C=>{if(!fn(C)||C.knowledgeGraphId!=null)return Ks();const P=t.get(C.relationType);if(P==null)throw new cu({message:`Failed to resolve type ID for relation type: ${C.relationType}`,property:C.name,relatedType:C.relationType});const{id:x,ops:O}=er({name:C.name,dataType:"RELATION",relationValueTypes:[P]});return Ws({mapping:{propName:C.name,id:x},ops:O})})),p=[...u.relations,...ae(m,ve(C=>C.mapping))],b=[...u.properties,...p],{id:y,ops:k}=Ki({name:u.schemaType.name,properties:ae(b,ve(C=>C.id))});t.set(u.schemaType.name,y);const S=[...ae(m,Un(C=>C.ops)),...k],w={typeName:tr(u.schemaType.name),typeIds:[y]};return gt(u.properties)&&(w.properties=nr(u.properties)),gt(p)&&(w.relations=sr(p)),{entries:[...g.entries,w],ops:[...g.ops,...S]}})),f=[...ae(a,ve(g=>g.entry)),...l];return[ae(f,et({},(g,u)=>{const{typeName:m,...p}=u;return g[m]=p,g})),[...i,...c]]}class cu extends mi("/typesync/errors/RelationValueTypeDoesNotExistError"){}function uu(e){switch(!0){case e==="Boolean":return"BOOLEAN";case e==="Date":return"TIME";case e==="Number":return"FLOAT";case e==="Point":return"POINT";case dt(e):return"RELATION";default:return"TEXT"}}const ao=_t(br("published","synced","published_not_synced")),du=gr(to,eo).pipe(vr(Ie({status:ao})));class rr extends is("/Hypergraph/cli/models/TypesyncHypergraphSchemaType")({...no.omit("properties").fields,status:ao,properties:ht(du).pipe(yn(1),kt(ys,{identifier:"DuplicatePropertyNames",jsonSchema:{},description:"The property.name must be unique across all properties in the type"}))}){}class En extends is("/Hypergraph/cli/models/TypesyncHypergraphSchema")({types:ht(rr).pipe(yn(1),kt(ys,{identifier:"DuplicateTypeNames",jsonSchema:{},description:"The type.name must be unique across all types in the schema"}),kt(ro,{identifier:"AllRelationTypesExist",jsonSchema:{},description:"Each type property of dataType RELATION must have a type of the same name in the schema"}))}){}Vs({key:Le,value:Ie({typeIds:ht(rn).pipe(yn(1)),properties:Gs(Ea(Vs({key:Le,value:rn}))),relations:Gs(Ea(Vs({key:Le,value:rn})))})});const fu=(e,...n)=>e.reduce((t,s,r)=>`${t}${s}${r in n?String(n[r]):""}`,"");var hu=class extends gi{constructor(e,n){super(),this.options=n,this.#n=e,this.#o=null,this.#i=Sa(),this.bindMethods(),this.setOptions(n)}#n;#e=void 0;#s=void 0;#t=void 0;#r;#a;#i;#o;#m;#f;#h;#c;#u;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Va(this.#e,this.options)?this.#d():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ar(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ar(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#e.removeObserver(this)}setOptions(e){const n=this.options,t=this.#e;if(this.options=this.#n.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof _e(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#E(),this.#e.setOptions(this.options),n._defaulted&&!zn(this.options,n)&&this.#n.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const s=this.hasListeners();s&&Pa(this.#e,t,this.options,n)&&this.#d(),this.updateResult(),s&&(this.#e!==t||_e(this.options.enabled,this.#e)!==_e(n.enabled,this.#e)||an(this.options.staleTime,this.#e)!==an(n.staleTime,this.#e))&&this.#g();const r=this.#b();s&&(this.#e!==t||_e(this.options.enabled,this.#e)!==_e(n.enabled,this.#e)||r!==this.#l)&&this.#v(r)}getOptimisticResult(e){const n=this.#n.getQueryCache().build(this.#n,e),t=this.createResult(n,e);return mu(this,t)&&(this.#t=t,this.#a=this.options,this.#r=this.#e.state),t}getCurrentResult(){return this.#t}trackResult(e,n){return new Proxy(e,{get:(t,s)=>(this.trackProp(s),n?.(s),s==="promise"&&!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(t,s))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=this.#n.defaultQueryOptions(e),t=this.#n.getQueryCache().build(this.#n,n);return t.fetch().then(()=>this.createResult(t,n))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#d(e){this.#E();let n=this.#e.fetch(this.options,e);return e?.throwOnError||(n=n.catch(Gn)),n}#g(){this.#x();const e=an(this.options.staleTime,this.#e);if(Ys||this.#t.isStale||!ka(e))return;const t=Xl(this.#t.dataUpdatedAt,e)+1;this.#c=setTimeout(()=>{this.#t.isStale||this.updateResult()},t)}#b(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#v(e){this.#w(),this.#l=e,!(Ys||_e(this.options.enabled,this.#e)===!1||!ka(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||Jl.isFocused())&&this.#d()},this.#l))}#y(){this.#g(),this.#v(this.#b())}#x(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,n){const t=this.#e,s=this.options,r=this.#t,a=this.#r,i=this.#a,c=e!==t?e.state:this.#s,{state:f}=e;let h={...f},g=!1,u;if(n._optimisticResults){const M=this.hasListeners(),D=!M&&Va(e,n),F=M&&Pa(e,t,n,s);(D||F)&&(h={...h,...ec(f.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:m,errorUpdatedAt:p,status:b}=h;u=h.data;let y=!1;if(n.placeholderData!==void 0&&u===void 0&&b==="pending"){let M;r?.isPlaceholderData&&n.placeholderData===i?.placeholderData?(M=r.data,y=!0):M=typeof n.placeholderData=="function"?n.placeholderData(this.#h?.state.data,this.#h):n.placeholderData,M!==void 0&&(b="success",u=Ma(r?.data,M,n),g=!0)}if(n.select&&u!==void 0&&!y)if(r&&u===a?.data&&n.select===this.#m)u=this.#f;else try{this.#m=n.select,u=n.select(u),u=Ma(r?.data,u,n),this.#f=u,this.#o=null}catch(M){this.#o=M}this.#o&&(m=this.#o,u=this.#f,p=Date.now(),b="error");const k=h.fetchStatus==="fetching",S=b==="pending",w=b==="error",C=S&&k,P=u!==void 0,O={status:b,fetchStatus:h.fetchStatus,isPending:S,isSuccess:b==="success",isError:w,isInitialLoading:C,isLoading:C,data:u,dataUpdatedAt:h.dataUpdatedAt,error:m,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:k,isRefetching:k&&!S,isLoadingError:w&&!P,isPaused:h.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:w&&P,isStale:Lr(e,n),refetch:this.refetch,promise:this.#i,isEnabled:_e(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const M=I=>{O.status==="error"?I.reject(O.error):O.data!==void 0&&I.resolve(O.data)},D=()=>{const I=this.#i=O.promise=Sa();M(I)},F=this.#i;switch(F.status){case"pending":e.queryHash===t.queryHash&&M(F);break;case"fulfilled":(O.status==="error"||O.data!==F.value)&&D();break;case"rejected":(O.status!=="error"||O.error!==F.reason)&&D();break}}return O}updateResult(){const e=this.#t,n=this.createResult(this.#e,this.options);if(this.#r=this.#e.state,this.#a=this.options,this.#r.data!==void 0&&(this.#h=this.#e),zn(n,e))return;this.#t=n;const t=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,r=typeof s=="function"?s():s;if(r==="all"||!r&&!this.#p.size)return!0;const a=new Set(r??this.#p);return this.options.throwOnError&&a.add("error"),Object.keys(this.#t).some(i=>{const l=i;return this.#t[l]!==e[l]&&a.has(l)})};this.#S({listeners:t()})}#E(){const e=this.#n.getQueryCache().build(this.#n,this.options);if(e===this.#e)return;const n=this.#e;this.#e=e,this.#s=e.state,this.hasListeners()&&(n?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#S(e){os.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(this.#t)}),this.#n.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function pu(e,n){return _e(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&n.retryOnMount===!1)}function Va(e,n){return pu(e,n)||e.state.data!==void 0&&ar(e,n,n.refetchOnMount)}function ar(e,n,t){if(_e(n.enabled,e)!==!1&&an(n.staleTime,e)!=="static"){const s=typeof t=="function"?t(e):t;return s==="always"||s!==!1&&Lr(e,n)}return!1}function Pa(e,n,t,s){return(e!==n||_e(s.enabled,e)===!1)&&(!t.suspense||e.state.status!=="error")&&Lr(e,t)}function Lr(e,n){return _e(n.enabled,e)!==!1&&e.isStaleByTime(an(n.staleTime,e))}function mu(e,n){return!zn(e.getCurrentResult(),n)}var gu=class extends gi{#n;#e=void 0;#s;#t;constructor(e,n){super(),this.#n=e,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const n=this.options;this.options=this.#n.defaultMutationOptions(e),zn(this.options,n)||this.#n.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),n?.mutationKey&&this.options.mutationKey&&Ca(n.mutationKey)!==Ca(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(e){this.#r(),this.#a(e)}getCurrentResult(){return this.#e}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#r(),this.#a()}mutate(e,n){return this.#t=n,this.#s?.removeObserver(this),this.#s=this.#n.getMutationCache().build(this.#n,this.options),this.#s.addObserver(this),this.#s.execute(e)}#r(){const e=this.#s?.state??tc();this.#e={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#a(e){os.batch(()=>{if(this.#t&&this.hasListeners()){const n=this.#e.variables,t=this.#e.context;e?.type==="success"?(this.#t.onSuccess?.(e.data,n,t),this.#t.onSettled?.(e.data,null,n,t)):e?.type==="error"&&(this.#t.onError?.(e.error,n,t),this.#t.onSettled?.(void 0,e.error,n,t))}this.listeners.forEach(n=>{n(this.#e)})})}},io=o.createContext(!1),bu=()=>o.useContext(io);io.Provider;function vu(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var yu=o.createContext(vu()),xu=()=>o.useContext(yu),wu=(e,n)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(n.isReset()||(e.retryOnMount=!1))},Eu=e=>{o.useEffect(()=>{e.clearReset()},[e])},Su=({result:e,errorResetBoundary:n,throwOnError:t,query:s,suspense:r})=>e.isError&&!n.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||bi(t,[e.error,s])),ku=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),t=e.staleTime;e.staleTime=typeof t=="function"?(...s)=>n(t(...s)):n(t),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Mu=(e,n)=>e.isLoading&&e.isFetching&&!n,Cu=(e,n)=>e?.suspense&&n.isPending,ja=(e,n,t)=>n.fetchOptimistic(e).catch(()=>{t.clearReset()});function Tu(e,n,t){const s=bu(),r=xu(),a=vi(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i),i._optimisticResults=s?"isRestoring":"optimistic",ku(i),wu(i,r),Eu(r);const l=!a.getQueryCache().get(i.queryHash),[c]=o.useState(()=>new n(a,i)),f=c.getOptimisticResult(i),h=!s&&e.subscribed!==!1;if(o.useSyncExternalStore(o.useCallback(g=>{const u=h?c.subscribe(os.batchCalls(g)):Gn;return c.updateResult(),u},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),o.useEffect(()=>{c.setOptions(i)},[i,c]),Cu(i,f))throw ja(i,c,r);if(Su({result:f,errorResetBoundary:r,throwOnError:i.throwOnError,query:a.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,f),i.experimental_prefetchInRender&&!Ys&&Mu(f,s)&&(l?ja(i,c,r):a.getQueryCache().get(i.queryHash)?.promise)?.catch(Gn).finally(()=>{c.updateResult()}),i.notifyOnChangeProps?f:c.trackResult(f)}function $r(e,n){return Tu(e,hu)}function oo(e,n){const t=vi(),[s]=o.useState(()=>new gu(t,e));o.useEffect(()=>{s.setOptions(e)},[s,e]);const r=o.useSyncExternalStore(o.useCallback(i=>s.subscribe(os.batchCalls(i)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),a=o.useCallback((i,l)=>{s.mutate(i,l).catch(Gn)},[s]);if(r.error&&bi(s.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:a,mutateAsync:r.mutate}}const Fu=fu`
|
|
2
|
+
query Spaces($memberId: UUID!) {
|
|
3
|
+
spaces(filter: {members: {some: {memberSpaceId: {is: $memberId}}}}) {
|
|
4
|
+
id
|
|
5
|
+
page {
|
|
6
|
+
name
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
`,Ou=e=>{const n=Cn(Tn,f=>f.context.identity?.accountAddress),t=Cn(Tn,f=>f.context.privyIdentity?.accountAddress),s=n||t,r=$r({queryKey:["hypergraph-public-spaces",e.mode],queryFn:async()=>{const f=await nc(`${yi()}/graphql`,Fu,{accountAddress:s});return f?.spaces?f.spaces.map(h=>({id:h.id,name:h.page?.name})):[]},enabled:e.mode==="public"&&!!s}),{isConnecting:a,listSpaces:i}=yr();o.useEffect(()=>{e.mode==="private"&&!a&&i()},[e.mode,i,a]);const l=Cn(Tn,f=>f.context.spaces),c=Cn(Tn,f=>f.context.spacesLoadingIsPending);return e.mode==="private"?{data:l,isPending:c}:r},v=xi(e=>lo(e),e=>wi(`Expected ${e} to be a valid Id`)),Ru=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,Iu=/^[0-9a-fA-F]{32}$/;function lo(e){return Ru.test(e)||Iu.test(e)}v("1a1fff3357824c3393c7c3a5f3592b60");v("808a04ceb21c4d888ad12e240613e5ca");v("e7d737c536764c609fa16aa64a8c90ad");v("01412f8381894ab1836565c7fd358cc1");v("a126ca530c8e48d5b88882c734c38935");v("9b1f76ff9711404c861e59dc3fa7d037");v("34f535072e6b42c5a84443981a77cfa2");v("8f151ba4de204e3c9cb499ddf96f48f1");v("4d9cba1c4766469881cd3273891a018b");v("beaba5cba67741a8b35377030613fc70");v("7aa4792eeacd41868272fa7fc18298ac");v("149fd752d9d04f80820d1d942eea7841");v("9b597aaec31c46c88565a370da0c2a65");v("a3288c22a0564f6fb409fbcccb2c118c");v("9edb6fcce4544aa5861139d7f024c010");v("66b433247667496899b48a89bd1de22b");v("e661d10292794449a22367dbae1be05a");v("ad75102b03c04d59903813ede9482742");v("167664f668f840e1976b20bd16ed8d47");v("caf4dd12ba4844b99171aff6c1313b50");v("df250d17e364413d97792ddaae841e34");v("f732849378ba4577a33fac5f1c964f18");v("4b6d9fc1fbfe474c861c83398e1b50d9");v("6d29d57849bb4959baf72cc696b1671a");v("283127c96142468492ed90b0ebc7f29a");v("f3f790c4c74e4d23a0a91e8ef84e30d9");v("362c1dbddc6444bba3c4652f38a642d7");v("9eea393f17dd4971a62ea603e8bfec20");v("ba4e41460010499da0a3caaa7f579d0e");v("515f346fe0fb40c78ea95339787eecc1");v("7f6ad0433e214257a6d48bdad36b1d84");v("8a743832c0944a62b6650c3cc2f9c7bc");v("f7b33e08b76d4190aadacadaa9f561e1");v("d7a4817c9795405b93e212df759c43f8");v("33da2ef5bd554e91af973e082e431a13");v("0fb6bbf022044db49f70fa82c41570a4");v("b8803a8665de412bbb357e0c84adf473");v("8ac1c4bf453b44b79eda5d1b527e5ea3");v("f9adb87452b949828f55aa40792751e3");v("1295037a5d9c4d09b27c5502654b9177");v("3b069b04adbe4728917d1283fd4ac27e");v("38ad3edb8eda4330941be9abd0dbc9e1");v("14a46854bfd14b1882152785c2dab9f3");v("8f6df52124fa4576887e0442973e2f33");v("d6b8aa862c7341cabddb63aa0732174c");v("a99f9ce12ffa4dac8c61f6310d46064a");v("1907fd1c81114a3ca378b1f353425b65");v("20a21dc27371482fa1207b147f1dc319");v("cba271cef7c140339047614d174c69f1");v("7d497dba09c249b8968f716bcf520473");v("0aaac6f7c916403eaf6d2e086dc92ada");v("ccb70fc917f04a54b86e3b4d20cc7130");v("4221fb36dcab4c68b150701aaba6c8e0");v("1f69cc9880d444abad493df6a7b15ee4");v("e381794174094df1b5191f3f1a0721e8");v("76474f2f00894e77a0410b39fb17d0bf");v("809bc406d0f34f3ca8a1aa265733c6ce");v("e3e363d1dd294ccb8e6ff3b76d99bc33");v("c167ef23fb2a40449ed945123ce7d2a9");v("c43b537bcff742718822717fdf2c9c01");v("c1f4cb6fece44c3ca447ab005b756972");v("14611456b4664cab920d2245f59ce828");v("ede47e6930b044998ea4aafbda449609");v("265e869b3a2740bdb652a7a77b0df24f");v("81891deccb6c427eaa1fb917292ec2dc");v("9959eb50b0294a158557b39318cbb91b");v("e059a29e6f6b437bbc15c7983d078c0d");v("872cb6f6926d4bb39d63ccede27232b8");v("a87e0291ec3645728af21301b3099e97");v("fc512a408b5544dc85b85aae88b51fae");v("2c765caec1b64cc3a65d693d0a67eaeb");v("c7a192a339094572a848a56b64dc4636");v("f3d4461486b74d2583d89709c9d84f65");v("484a18c5030a499cb0f2ef588ff16d50");v("c38c419810c24cf29dd58f194033fc31");v("c188844a722442abb4762991c9c913f1");v("06053fcf64434dc680ca8a3b173a6016");v("cf37cd59840c4daca22b9d9dde536ea7");v("480e3fc267f3499385fbacdf4ddeaa6b");v("62dfabe5282d44a7ba93f2e80d20743d");v("06beeb0f418d46ad84c382d4b1e58a81");v("bedb6493dc5b47b4b1a5c68bfbbb2b43");v("7ee14d7099f04d0ab37195f08b0295be");v("d81abf9818d94259b968e538c60c841b");v("59fdefec6815486690656d0bc162f2ee");v("838361abf35840449f131586a3266a2b");v("6bc6a6b0b9eb441db89814f7a726877c");v("dd35d5061787402c8e79f696ab839135");v("c50754d3bcb44013a40383f1eb9a442e");v("8f90bd6d81474eb8b67fd34fa2af1397");v("c4b7e33f939a4871b9e22711b6d3f49f");v("31af0a8a6bc14981b2acc45f2ba4d27c");v("f93d044e61f642a892ebef37a377a535");v("080d3c03a77048f2a3065103214aaf45");v("01dbb38e270b40049615fefb10d19f33");v("bfdc5a8f4f6a4955bfbd7bea921d8a42");v("92e64c6e36ad453b95339e4be1033cdf");v("c316cec6ddaa436c9c5243b4179db529");v("50c293271dd2425ebd9cc8257938c891");v("b4ac69855e8e46d88f733ed8a918d33a");v("d172f6f693a84c289577e9d43259863b");v("6e7215ec10ca490488952d89070a9c69");v("238bce0f14204df785a3088aded159fd");v("02fc9e3725a8487eb2193df738004c62");v("e4220e2f655443219144344c3be22c00");v("69a88b159a8f4d56930ed7fc84accb14");v("5f7474c7115e44e49608af93edcaf491");v("c613778efc194342aed543296a72880c");v("1743389cdafb49a6b6679d8bc46f3f52");v("0c06c8a0563e420bb8e53b9c911ffa37");v("8afae81d33b540f7b89cea7d49b10f9f");v("5514744888944ff7a1632f96f7afa7df");v("2315fe0c6a4d4f99bb19b59c8e7c563a");v("40c3c7e1e06643df8eea9900514e96ed");v("cb69723f7456471aa8ad3e93ddc3edfe");v("e4047a7700434ed4a41072139bff7f7e");v("85cebdf1d84f4afd993b35f182096b59");v("a945fa95d15e42bcb70a43d3933048dd");v("7ed45f2bc48b419e8e4664d5ff680b0d");v("fca084311aa140f28a4d0743c2a59df7");v("7cfc4990e0684b7798aa834137d02953");v("eddd99d620334651b0462cecd1bd6ca5");v("0fecaded7c584a719a02e1cb49800e27");v("62f5aa2f34ca47c0bcfca937396676dd");v("e4ed96e692cf42c4967bab2cef56f889");v("6c49012e21fd4b35b97660210ea0ae0f");v("503e9e78866942439777af8fb75cdc56");v("306a88ec196043288cdb77c23de2785a");v("e4e366e9d5554b6892bf7358e824afd2");v("e4e366e9d5554b6892bf7358e824afd2");v("36ea572308514012945e90d05f0e54e9");v("c682b9a582b34345abc91c31cd09a253");v("8ebf2fe7270b4a7e806de481c8c058d0");v("08abac452e194cb6afaa5e11a31eea99");v("0b63fdead04d49858f18f97995926e6e");v("c2a3dd99bd574593a801882e8280b94c");v("29094591c31243c49c4a0c2eb5063e2c");v("1840e2d2487f42a09265f7e7a4752a75");v("f7286c6834124673bd58c25450ab53f9");v("5b33846f474249f986e57009978019a7");v("cc42b16e956e4451a3045f27e1c3ed11");v("b897ab9e6409473c90710a34f3da537b");v("4725dae311634c878e87dcf159e385a6");v("3ed2eb8120b1488c90f5c84f58535083");v("09cf4adfd8e84b2e8cd148a3d9a24ac2");v("15183b436f7346b2812dedbe1de78343");v("4a3066140c75416ca347d36b3cc9c031");v("9291e563afbe47098780a52cbb0f4aa9");v("d9ada08652e34b6688930ccf2f9fd9ea");v("ace1e96c9b8347b4bd331d302ec0a0f5");v("0d4d1b02a9e8498292c499b1d22cd430");v("955933101e7c43daa02ca6f4b630d48a");v("6d5a3fed379c4889b60ed6265a482c93");v("08c4f09378584b7c9b94b82e448abcff");v("5c74731dfabb4dc8b5c53346521c639a");v("48e01bc8324e48c2a6c9cab3f49290c6");v("19a4cfff45f24150abf2af0f43eb2eec");v("49ee1b8918204e75a1ae38a2dcaad4a5");v("103701ddcabe4a8e835b10345327b647");v("dac6e89e76be4f7788e10f556ceb6869");v("808af0bad5884e3391f09dd4b25e18be");v("0ef12e0df2e4478c96cdfd3901109b16");v("8c8405abc6bc4d46a5806e4fc80d8187");v("6ce89cfc43e14e44a5cb4da93ed7d453");v("74a88abeaf694d4d969eef651c61f58a");v("80daec57cf454643a73c632e5dcb6834");v("9ece325c592d42d5b2e785e8e6fe05b6");v("1d7bb89ec2854df7afac28cec9007e38");v("7566286ca054405a83e185ffd60492fb");v("ff7e1b4444a2419187324e6c222afe07");v("21c06b6d7f7846f1ac65e4fc4eadc615");v("e200041dba1a4ca7b28497fe22d8e234");v("3ae3d1efebfc433da4bdebaa823348c9");v("6e76a82830e14bad93a1097d05ab688a");v("6da0310b8aaa46f79f1f23ea5d6df686");v("0b9b1a35206844318f7d2350f958a728");v("0419ca20118b4cdb84dfdb9ed73b50c2");v("74261aaad0ab4756bde405be00ae6bc6");xi(e=>Au(e),e=>wi(`Expected ${e} to be a valid IdBase64`));function Au(e){try{const n=Vu(e);return lo(n)}catch{return!1}}function co(e){return v(sc(e).replaceAll("-",""))}const In="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Vu(e){const n=[];for(let t=0;t<e.length;t+=4){const s=In.indexOf(e[t]),r=In.indexOf(e[t+1]),a=In.indexOf(e[t+2]),i=In.indexOf(e[t+3]),l=s<<18|r<<12|(a&63)<<6|i&63;n.push(l>>16&255),a!==-1&&a!==64&&n.push(l>>8&255),i!==-1&&i!==64&&n.push(l&255)}return co(new Uint8Array(n))}v("0370cdbd57a946e9a5119c0c1ffc69d7");v("90061c99765942c3b9d9edbf6b834487");v("943e38b9e3044300866c06af4e3c298a");v("a2a5ed0cacef46b1835de457956ce915");v("01b05333941a4b00bc78fac5a15b467d");v("96f859efa1ca4b229372c86ad58b694b");v("3317d044a7004a9dbbaf4c16ade42f76");v("42a0a7618c82459fad0834bfeb437cde");v("1845ee9980c648a3abc3809de1753c63");v("5ab7946f82bc42899d02a5f13bd40935");v("bb9a85bd6dc64efd8232e2782cb4b5f8");v("e550fe517e904b2c8fffdf13408f5634");v("7f237bddd95f4d3f8686f52a5dd29386");v("531ac4c5e40946ad9dd3abcd2db955a0");v("043a171c69184dc3a7dbb8471ca6fcc2");v("c188844a722442abb4762991c9c913f1");v("9ca6ab1f3a114e49bbaf72e0c9a985cf");v("e0fcc66c9e8643f480802469d8a1a93a");v("5ef5a5860f274d8e8f6c59ae5b3e89e2");v("1155befffad549b7a2e0da4777b8792c");v("7072d8d0313649939ae5dacae05e25f9");v("ef0edbba69874057b616836483df2344");v("2877c1c3d2ad493fabe76e1bb16e1c37");v("52665f3efb7d48d58b6babb21b0d36db");v("5df8e4329cc54f038f854ac82e157ada");v("a38732e33a3d47f9a459fb369c287709");v("8fcfe5ef3d9147bd83223830a998d26b");v("0a62474e3a3f4c86b5076ea582439dd1");v("9ec2b47e481947c0a99e8ddb27a3ed8e");v("91a9e2f6e51a48f7997661de8561b690");v("54aa3b25c45d4974a9376bb895aeaefe");v("94e43fe8faf241009eb887ab4f999723");v("c9ed4b4b72944eda9a03a7975cd1651e");v("49c5d5e1679a4dbdbfd33f618f227c94");v("f1576465b8d1479f913c9149fe0bd15e");v("4e6ec5d14292498a84e5f607ca1a08ce");v("1dc6a843458848198e7a6e672268f811");v("eed38e74e67946bf8a42ea3e4f8fb5fb");v("28b3ee04c2b946c3bb9d4c450e0f26fd");v("83240c7c1a9b4332bbb567a76e02c003");v("458fbc070dbf4c928f5716f3fdde7c32");v("dfa6aebe1ca94bf29faccc4cc7afb24c");v("0d6259784b3c4b57a86fde45c997c73c");v("9eedefa860ae4ac19a04805054a4b094");v("cdf139bce610446cac42d57cd7967478");v("2282fece749440d6bcdcaad2355c40fb");v("95d770021faf4f7cb7deb21a7d48cda0");v("412ff593e9154012a43d4c27ec5c68b6");v("39e40cadb23d4f63ab2faea1596436c7");v("806d52bc27e94c9193c057978b093351");v("c4c88260ea3a4498a2f9be340a19758e");v("b35bd6d39fb64f3a8aeaf5a9b91b5ef6");v("6e3503fab974460ea3dbab8af9a41427");v("1c5b7c0ad187425e885c2980d9db6b4b");v("eb1141aeba3543dfacdd3329cccd8121");v("e3a967282b094af79af786ef1aa7837e");v("5b722cd361d6494e88871310566437ba");v("35c737c3ce5a4f899c0ba84538bd1e52");v("fb1551b2181646eb8919c73253c32022");v("0f52604826cf40d68bab967e5fb1a08a");var Na;(function(e){e[e.None=0]="None",e[e.Abstain=1]="Abstain",e[e.Yes=2]="Yes",e[e.No=3]="No"})(Na||(Na={}));BigInt(1e7);BigInt(2880*60);xr(rc("EOA_SPACE"));const Pu="https://testnet-api.geobrowser.io";function ju(e){if(e==="TESTNET")return Pu;throw new Error(`Network ${e} not supported`)}class Da extends Error{_tag="IpfsUploadError"}function Nu(e){return pi(e)}async function Du(e){const{name:n,ops:t,author:s,network:r="TESTNET"}=e,a=ac(),i={id:a,name:n,authors:[Nu(s)],createdAt:BigInt(Date.now())*1000n,ops:t},l=ic(i),c=new Uint8Array(l),f=new Blob([c],{type:"application/octet-stream"}),h=new FormData;h.append("file",f);const g=await oc(Lu(h,r)),u=co(a);return{cid:g,editId:u}}function Lu(e,n="TESTNET"){return lc(function*(){const t=yield*Ta({try:()=>fetch(`${ju(n)}/ipfs/upload-edit`,{method:"POST",body:e}),catch:r=>new Da(`Could not upload data to IPFS: ${r}`)});return yield*Ta({try:async()=>{const{cid:r}=await t.json();return r},catch:r=>new Da(`Could not parse response from IPFS: ${r}`)})})}xr(Ei("GOVERNANCE.PROPOSAL_CREATED"));xr(Ei("GOVERNANCE.EDITS_PUBLISHED"));const $u=async({name:e,ops:n,walletClient:t,space:s})=>{const r=t.account?.address;if(!r)throw new Error("No address found");const a=(t.chain.id===cc.id,"TESTNET"),l=(await Du({name:e,ops:n,author:r,network:a})).cid,c=await fetch(`${yi()}/space/${s}/edit/calldata`,{method:"POST",body:JSON.stringify({cid:l})}),{to:f,data:h}=await c.json();return{txResult:await t.sendUserOperation({calls:[{to:f,value:0n,data:h}]}),to:f,data:h,cid:l}};function cn(e,n,t=!0){return e.filter(r=>r.parentId===n&&(!t||r.context?.open)).flatMap(r=>[r,...cn(e,r.id,t)])}function Hu(e){return"nativeEvent"in e}function Qn(e,n){const t=["mouse","pen"];return t.push("",void 0),t.includes(e)}const uo={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},$s=o.forwardRef(function(n,t){const[s,r]=o.useState();Fe(()=>{Si&&r("button")},[]);const a={ref:t,tabIndex:0,role:s,"aria-hidden":s?void 0:!0,style:uo};return d.jsx("span",{...n,...a,"data-base-ui-focus-guard":""})}),_u=o.createContext(void 0);function La(e,n,t,s){const r=wr(fo).current;return Zu(r,e,n,t,s)&&ho(r,[e,n,t,s]),r.callback}function Bu(e){const n=wr(fo).current;return Uu(n,e)&&ho(n,e),n.callback}function fo(){return{callback:null,cleanup:null,refs:[]}}function Zu(e,n,t,s,r){return e.refs[0]!==n||e.refs[1]!==t||e.refs[2]!==s||e.refs[3]!==r}function Uu(e,n){return e.refs.length!==n.length||e.refs.some((t,s)=>t!==n[s])}function ho(e,n){if(e.refs=n,n.every(t=>t==null)){e.callback=null;return}e.callback=t=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),t!=null){const s=Array(n.length).fill(null);for(let r=0;r<n.length;r+=1){const a=n[r];if(a!=null)switch(typeof a){case"function":{const i=a(t);typeof i=="function"&&(s[r]=i);break}case"object":{a.current=t;break}}}e.cleanup=()=>{for(let r=0;r<n.length;r+=1){const a=n[r];if(a!=null)switch(typeof a){case"function":{const i=s[r];typeof i=="function"?i():a(null);break}case"object":{a.current=null;break}}}}}}}const zu=parseInt(o.version,10);function po(e){return zu>=e}function mo(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function Gu(e,n){const t={};for(const s in e){const r=e[s];if(n?.hasOwnProperty(s)){const a=n[s](r);a!=null&&Object.assign(t,a);continue}r===!0?t[`data-${s.toLowerCase()}`]="":r&&(t[`data-${s.toLowerCase()}`]=r.toString())}return t}function qu(e,n){return typeof e=="function"?e(n):e}const un={};function go(e,n,t,s,r){let a={...ir(e,un)};return n&&(a=Hn(a,n)),t&&(a=Hn(a,t)),s&&(a=Hn(a,s)),a}function Ku(e){if(e.length===0)return un;if(e.length===1)return ir(e[0],un);let n={...ir(e[0],un)};for(let t=1;t<e.length;t+=1)n=Hn(n,e[t]);return n}function Hn(e,n){return bo(n)?n(e):Wu(e,n)}function Wu(e,n){if(!n)return e;for(const t in n){const s=n[t];switch(t){case"style":{e[t]=mo(e.style,s);break}case"className":{e[t]=vo(e.className,s);break}default:Yu(t,s)?e[t]=Qu(e[t],s):e[t]=s}}return e}function Yu(e,n){const t=e.charCodeAt(0),s=e.charCodeAt(1),r=e.charCodeAt(2);return t===111&&s===110&&r>=65&&r<=90&&(typeof n=="function"||typeof n>"u")}function bo(e){return typeof e=="function"}function ir(e,n){return bo(e)?e(n):e??un}function Qu(e,n){return n?e?t=>{if(Xu(t)){const r=t;or(r);const a=n(r);return r.baseUIHandlerPrevented||e?.(r),a}const s=n(t);return e?.(t),s}:n:e}function or(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function vo(e,n){return n?e?n+" "+e:n:e}function Xu(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}const Ju={style:{transition:"none"}},bt={},ed={fallbackAxisSide:"end"};function ot(e,n,t={}){const s=n.render,r=td(n,t);if(t.enabled===!1)return null;const a=t.state??bt;return nd(e,s,r,a)}function td(e,n={}){const{className:t,render:s}=e,{state:r=bt,ref:a,props:i,disableStyleHooks:l,customStyleHookMapping:c,enabled:f=!0}=n,h=f?qu(t,r):void 0;let g;l!==!0&&(g=o.useMemo(()=>f?Gu(r,c):bt,[r,c,f]));const u=f?mo(g,Array.isArray(i)?Ku(i):i)??bt:bt;return typeof document<"u"&&(f?Array.isArray(a)?u.ref=Bu([u.ref,$a(s),...a]):u.ref=La(u.ref,$a(s),a):La(null,null)),f?(h!==void 0&&(u.className=vo(u.className,h)),u):bt}function nd(e,n,t,s){if(n){if(typeof n=="function")return n(t,s);const r=go(t,n.props);return r.ref=t.ref,o.cloneElement(n,r)}if(e&&typeof e=="string")return sd(e,t);throw new Error("Base UI: Render element or function are not defined.")}function sd(e,n){return e==="button"?d.jsx("button",{type:"button",...n}):e==="img"?d.jsx("img",{alt:"",...n}):o.createElement(e,n)}function $a(e){return e&&typeof e!="function"?po(19)?e.props.ref:e.ref:null}const rd=o.forwardRef(function(n,t){const{render:s,className:r,children:a,...i}=n,{toasts:l,pauseTimers:c,resumeTimers:f,setHovering:h,setFocused:g,viewportRef:u,windowFocusedRef:m,prevFocusElement:p,setPrevFocusElement:b,hovering:y,focused:k,hasDifferingHeights:S}=Er(),w=o.useRef(!1),C=Je(k),P=l.length;o.useEffect(()=>{if(!u.current)return;function L(Z){P!==0&&Z.key==="F6"&&Z.target!==u.current&&(Z.preventDefault(),b(xt(Nt(u.current))),u.current?.focus(),c(),g(!0))}const N=qn(u.current);return N.addEventListener("keydown",L),()=>{N.removeEventListener("keydown",L)}},[c,g,b,P,u]),o.useEffect(()=>{if(!u.current||!P)return;const L=qn(u.current);function N(q){q.target===L&&(m.current=!1,c())}function Z(q){if(q.relatedTarget||q.target===L)return;const Y=Be(q),z=xt(Nt(u.current));(!Re(u.current,Y)||!Ln(z))&&f(),setTimeout(()=>{m.current=!0})}return L.addEventListener("blur",N,!0),L.addEventListener("focus",Z,!0),()=>{L.removeEventListener("blur",N,!0),L.removeEventListener("focus",Z,!0)}},[c,f,u,m,g,C,P]);function x(L){u.current&&(w.current=!0,L.relatedTarget===u.current?l[0]?.ref?.current?.focus():p?.focus({preventScroll:!0}))}function O(L){L.key==="Tab"&&L.shiftKey&&L.target===u.current&&(L.preventDefault(),p?.focus({preventScroll:!0}),f())}function M(){c(),h(!0)}function D(){const L=xt(Nt(u.current));Re(u.current,L)&&Ln(L)||(f(),h(!1))}function F(){if(w.current){w.current=!1;return}if(k)return;const L=xt(Nt(u.current));!m.current&&!Ln(L)||(g(!0),c())}function I(L){!k||Re(u.current,L.relatedTarget)||(g(!1),f())}const T={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:M,onMouseMove:M,onMouseLeave:D,onFocus:F,onBlur:I,onKeyDown:O,onClick:F},E=o.useMemo(()=>({expanded:y||k||S}),[y,k,S]),V=ot("div",n,{ref:[t,u],state:E,props:[T,{...i,children:d.jsxs(o.Fragment,{children:[P>0&&p&&d.jsx($s,{onFocus:x}),a,P>0&&p&&d.jsx($s,{onFocus:x})]})}]}),j=o.useMemo(()=>({viewportRef:u}),[u]),K=o.useMemo(()=>l.filter(L=>L.priority==="high"),[l]);return d.jsxs(_u.Provider,{value:j,children:[P>0&&p&&d.jsx($s,{onFocus:x}),V,!k&&K.length>0&&d.jsx("div",{style:uo,children:K.map(L=>d.jsxs("div",{role:"alert","aria-atomic":!0,children:[d.jsx("div",{children:L.title}),d.jsx("div",{children:L.description})]},L.id))})]})});function ad(e){return po(19)?e:e?"true":void 0}const yo=o.createContext(void 0);function hn(){const e=o.useContext(yo);if(!e)throw new Error("Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.");return e}let Xn=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const id={[Xn.startingStyle]:""},od={[Xn.endingStyle]:""},xo={transitionStatus(e){return e==="starting"?id:e==="ending"?od:null}},An=null;class ld{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=n=>{this.isScheduled=!1;const t=this.callbacks,s=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,s>0)for(let r=0;r<t.length;r+=1)t[r]?.(n)};request(n){const t=this.nextId;return this.nextId+=1,this.callbacks.push(n),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(n){const t=n-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,this.callbacksCount-=1)}}const Vn=new ld;class Qe{static create(){return new Qe}static request(n){return Vn.request(n)}static cancel(n){return Vn.cancel(n)}currentId=An;request(n){this.cancel(),this.currentId=Vn.request(()=>{this.currentId=An,n()})}cancel=()=>{this.currentId!==An&&(Vn.cancel(this.currentId),this.currentId=An)};disposeEffect=()=>this.cancel}function cd(){const e=wr(Qe.create).current;return uc(e.disposeEffect),e}function ud(e,n=!1){const t=cd();return le((s,r=null)=>{if(t.cancel(),e==null)return;let a;if("current"in e){if(e.current==null)return;a=e.current}else a=e;typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?s():t.request(()=>{function i(){a&&Promise.allSettled(a.getAnimations().map(l=>l.finished)).then(()=>{r!=null&&r.aborted||Te.flushSync(s)})}n?t.request(i):i()})})}function Hr(e){const{enabled:n=!0,open:t,ref:s,onComplete:r}=e,a=Je(t),i=le(r),l=ud(s,t);o.useEffect(()=>{n&&l(()=>{t===a.current&&i()})},[n,t,i,l,a])}let At=(function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e})({});const dd={...xo,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},tn=40,fd=10,ut=.5,hd=1;function Ha(e,n,t){switch(e){case"up":return-t;case"down":return t;case"left":return-n;case"right":return n;default:return 0}}function pd(e){const t=window.getComputedStyle(e).transform;let s=0,r=0,a=1;if(t&&t!=="none"){const i=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const l=i[1].split(", ").map(parseFloat);l.length===6?(s=l[4],r=l[5],a=Math.sqrt(l[0]*l[0]+l[1]*l[1])):l.length===16&&(s=l[12],r=l[13],a=l[0])}}return{x:s,y:r,scale:a}}const md=o.forwardRef(function(n,t){const{toast:s,render:r,className:a,swipeDirection:i=["down","right"],...l}=n,c=Array.isArray(i)?i:[i],{toasts:f,hovering:h,focused:g,close:u,remove:m,setToasts:p,pauseTimers:b,resumeTimers:y,hasDifferingHeights:k}=Er(),[S,w]=o.useState(void 0),[C,P]=o.useState(!1),[x,O]=o.useState(!1),[M,D]=o.useState(!1),[F,I]=o.useState({x:0,y:0}),[T,E]=o.useState({x:0,y:0,scale:1}),[V,j]=o.useState(),[K,L]=o.useState(),[N,Z]=o.useState(null),q=o.useRef(null),Y=o.useRef({x:0,y:0}),z=o.useRef({x:0,y:0,scale:1}),H=o.useRef(void 0),B=o.useRef(0),J=o.useRef(!1),A=o.useRef({x:0,y:0}),R=o.useRef(!1),$=o.useMemo(()=>f.indexOf(s),[s,f]),_=o.useMemo(()=>f.filter(X=>X.transitionStatus!=="ending").indexOf(s),[s,f]),G=o.useMemo(()=>f.slice(0,f.indexOf(s)).reduce((X,te)=>X+(te.height||0),0),[f,s]);Hr({open:s.transitionStatus!=="ending",ref:q,onComplete(){s.transitionStatus==="ending"&&m(s.id)}}),o.useEffect(()=>{if(!q.current)return;function X(){const te=q.current?.offsetHeight;p(de=>de.map(fe=>fe.id===s.id?{...fe,ref:q,height:te,transitionStatus:void 0}:fe))}if(X(),typeof ResizeObserver=="function"){const te=new ResizeObserver(X);return te.observe(q.current),()=>{te.disconnect()}}},[s.id,p]);function ue(X,te){let de=X,fe=te;return!c.includes("left")&&!c.includes("right")?de=X>0?X**ut:-(Math.abs(X)**ut):(!c.includes("right")&&X>0&&(de=X**ut),!c.includes("left")&&X<0&&(de=-(Math.abs(X)**ut))),!c.includes("up")&&!c.includes("down")?fe=te>0?te**ut:-(Math.abs(te)**ut):(!c.includes("down")&&te>0&&(fe=te**ut),!c.includes("up")&&te<0&&(fe=-(Math.abs(te)**ut))),{x:de,y:fe}}function me(X){if(X.button!==0)return;X.pointerType==="touch"&&b();const te=Be(X.nativeEvent);if(!(te&&te.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(J.current=!1,H.current=void 0,B.current=0,Y.current={x:X.clientX,y:X.clientY},A.current=Y.current,q.current){const fe=pd(q.current);z.current=fe,E(fe),I({x:fe.x,y:fe.y})}P(!0),O(!1),Z(null),R.current=!0,q.current?.setPointerCapture(X.pointerId)}}function Ze(X){if(!C)return;X.preventDefault(),R.current&&(Y.current={x:X.clientX,y:X.clientY},R.current=!1);const{clientY:te,clientX:de,movementX:fe,movementY:He}=X;(He<0&&te>A.current.y||He>0&&te<A.current.y)&&(A.current={x:A.current.x,y:te}),(fe<0&&de>A.current.x||fe>0&&de<A.current.x)&&(A.current={x:de,y:A.current.y});const ie=de-Y.current.x,he=te-Y.current.y,Ne=te-A.current.y,De=de-A.current.x;if(!x&&Math.sqrt(ie*ie+he*he)>=hd&&(O(!0),N===null)){const It=c.includes("left")||c.includes("right"),Os=c.includes("up")||c.includes("down");if(It&&Os){const Rs=Math.abs(ie),Is=Math.abs(he);Z(Rs>Is?"horizontal":"vertical")}}let Ce;if(!H.current)N==="vertical"?he>0?Ce="down":he<0&&(Ce="up"):N==="horizontal"?ie>0?Ce="right":ie<0&&(Ce="left"):Math.abs(ie)>=Math.abs(he)?Ce=ie>0?"right":"left":Ce=he>0?"down":"up",Ce&&c.includes(Ce)&&(H.current=Ce,B.current=Ha(Ce,ie,he),w(Ce));else{const Rt=H.current,It=Ha(Rt,De,Ne);It>tn?(J.current=!1,w(Rt)):B.current-It>=fd&&(J.current=!0)}const ct=ue(ie,he);let Ot=z.current.x,en=z.current.y;N==="horizontal"?(c.includes("left")||c.includes("right"))&&(Ot+=ct.x):(N==="vertical"||(c.includes("left")||c.includes("right"))&&(Ot+=ct.x),(c.includes("up")||c.includes("down"))&&(en+=ct.y)),I({x:Ot,y:en})}function Ft(X){if(!C)return;if(X.pointerType==="touch"&&!g&&y(),P(!1),O(!1),Z(null),q.current?.releasePointerCapture(X.pointerId),J.current){I({x:T.x,y:T.y}),w(void 0);return}let te=!1;const de=F.x-T.x,fe=F.y-T.y;let He;for(const ie of c){switch(ie){case"right":de>tn&&(te=!0,He="right");break;case"left":de<-tn&&(te=!0,He="left");break;case"down":fe>tn&&(te=!0,He="down");break;case"up":fe<-tn&&(te=!0,He="up");break}if(te)break}te?(w(He),D(!0),u(s.id)):(I({x:T.x,y:T.y}),w(void 0))}function pt(X){if(X.key==="Escape"){if(!q.current||!Re(q.current,xt(Nt(q.current))))return;u(s.id)}}o.useEffect(()=>{const X=q.current;if(!X)return;function te(de){Re(X,de.target)&&de.preventDefault()}return X.addEventListener("touchmove",te,{passive:!1}),()=>{X.removeEventListener("touchmove",te)}},[]);function we(){if(!C&&F.x===T.x&&F.y===T.y&&!M)return{[At.swipeMovementX]:"0px",[At.swipeMovementY]:"0px"};const X=F.x-T.x,te=F.y-T.y;return{transition:C?"none":void 0,[At.swipeMovementX]:`${X}px`,[At.swipeMovementY]:`${te}px`}}const je=s.priority==="high",mt={role:je?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":V,"aria-describedby":K,"aria-hidden":je&&!g?!0:void 0,onPointerDown:me,onPointerMove:Ze,onPointerUp:Ft,onKeyDown:pt,inert:ad(s.limited),style:{...we(),[At.index]:s.transitionStatus==="ending"?$:_,[At.offsetY]:`${G}px`}},$e=o.useMemo(()=>({rootRef:q,toast:s,titleId:V,setTitleId:j,descriptionId:K,setDescriptionId:L,swiping:C,swipeDirection:S}),[s,V,K,C,S]),lt=o.useMemo(()=>({transitionStatus:s.transitionStatus,expanded:h||g||k,limited:s.limited||!1,type:s.type,swiping:$e.swiping,swipeDirection:$e.swipeDirection}),[h,g,k,s.transitionStatus,s.limited,s.type,$e.swiping,$e.swipeDirection]),Jt=ot("div",n,{ref:[t,$e.rootRef],state:lt,customStyleHookMapping:dd,props:[mt,l]});return d.jsx(yo.Provider,{value:$e,children:Jt})}),gd=o.forwardRef(function(n,t){const{render:s,className:r,id:a,children:i,...l}=n,{toast:c}=hn(),f=i??c.description,h=!!f,g=Sr(a),{setDescriptionId:u}=hn();Fe(()=>{if(h)return u(g),()=>{u(void 0)}},[h,g,u]);const m=o.useMemo(()=>({type:c.type}),[c.type]),p=ot("p",n,{ref:t,state:m,props:{...l,id:g,children:f}});return h?p:null}),bd=o.forwardRef(function(n,t){const{render:s,className:r,id:a,children:i,...l}=n,{toast:c}=hn(),f=i??c.title,h=!!f,g=Sr(a),{setTitleId:u}=hn();Fe(()=>{if(h)return u(g),()=>{u(void 0)}},[h,g,u]);const m=o.useMemo(()=>({type:c.type}),[c.type]),p=ot("h2",n,{ref:t,state:m,props:{...l,id:g,children:f}});return h?p:null}),vd=o.createContext(void 0);function yd(e=!1){const n=o.useContext(vd);if(n===void 0&&!e)throw new Error("Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.");return n}function xd(e){const{focusableWhenDisabled:n,disabled:t,composite:s=!1,tabIndex:r=0,isNativeButton:a}=e,i=s&&n!==!1,l=s&&n===!1;return{props:o.useMemo(()=>{const f={onKeyDown(h){t&&n&&h.key!=="Tab"&&h.preventDefault()}};return s||(f.tabIndex=r,!a&&t&&(f.tabIndex=n?r:-1)),(a&&(n||i)||!a&&t)&&(f["aria-disabled"]=t),a&&(!n||l)&&(f.disabled=t),f},[s,t,n,i,l,a,r])}}function wd(e={}){const{disabled:n=!1,focusableWhenDisabled:t,tabIndex:s=0,native:r=!0}=e,a=o.useRef(null),i=yd(!0)!==void 0,l=le(()=>{const h=a.current;return!!(h?.tagName==="A"&&h?.href)}),{props:c}=xd({focusableWhenDisabled:t,disabled:n,composite:i,tabIndex:s,isNativeButton:r});return Fe(()=>{const h=a.current;h instanceof HTMLButtonElement&&i&&n&&c.disabled===void 0&&h.disabled&&(h.disabled=!1)},[n,c.disabled,i]),{getButtonProps:o.useCallback((h={})=>{const{onClick:g,onMouseDown:u,onKeyUp:m,onKeyDown:p,onPointerDown:b,...y}=h;return go({type:r?"button":void 0,onClick(S){if(n){S.preventDefault();return}g?.(S)},onMouseDown(S){n||u?.(S)},onKeyDown(S){if(n||(or(S),p?.(S)),S.baseUIHandlerPrevented)return;const w=S.target===S.currentTarget&&!r&&!l()&&!n,C=S.key==="Enter",P=S.key===" ";w&&((P||C)&&S.preventDefault(),C&&g?.(S))},onKeyUp(S){n||(or(S),m?.(S)),!S.baseUIHandlerPrevented&&S.target===S.currentTarget&&!r&&!n&&S.key===" "&&g?.(S)},onPointerDown(S){if(n){S.preventDefault();return}b?.(S)}},r?void 0:{role:"button"},c,y)},[n,c,r,l]),buttonRef:a}}const Ed=o.forwardRef(function(n,t){const{render:s,className:r,disabled:a,nativeButton:i=!0,...l}=n,{close:c,focused:f}=Er(),{toast:h}=hn(),{getButtonProps:g,buttonRef:u}=wd({disabled:a,native:i}),m=o.useMemo(()=>({type:h.type}),[h.type]);return ot("button",n,{ref:[t,u],state:m,props:[{"aria-hidden":!f||void 0,onClick(){c(h.id)}},l,g]})});function Sd(){const e=new Map;return{emit(n,t){e.get(n)?.forEach(s=>s(t))},on(n,t){e.has(n)||e.set(n,new Set),e.get(n).add(t)},off(n,t){e.get(n)?.delete(t)}}}const kd=o.createContext(null),Md=o.createContext(null),wo=()=>o.useContext(kd)?.id||null,_r=()=>o.useContext(Md),_a=kr("safe-polygon");function _n(e,n,t){if(t&&!Qn(t))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const s=e();return typeof s=="number"?s:s?.[n]}return e?.[n]}function Hs(e){return typeof e=="function"?e():e}function Cd(e,n={}){const{open:t,onOpenChange:s,dataRef:r,events:a,elements:i}=e,{enabled:l=!0,delay:c=0,handleClose:f=null,mouseOnly:h=!1,restMs:g=0,move:u=!0}=n,m=_r(),p=wo(),b=Je(f),y=Je(c),k=Je(t),S=Je(g),w=o.useRef(void 0),C=Bt(),P=o.useRef(void 0),x=Bt(),O=o.useRef(!0),M=o.useRef(!1),D=o.useRef(()=>{}),F=o.useRef(!1),I=le(()=>{const L=r.current.openEvent?.type;return L?.includes("mouse")&&L!=="mousedown"});o.useEffect(()=>{if(!l)return;function L({open:N}){N||(C.clear(),x.clear(),O.current=!0,F.current=!1)}return a.on("openchange",L),()=>{a.off("openchange",L)}},[l,a,C,x]),o.useEffect(()=>{if(!l||!b.current||!t)return;function L(Z){I()&&s(!1,Z,"hover")}const N=wt(i.floating).documentElement;return N.addEventListener("mouseleave",L),()=>{N.removeEventListener("mouseleave",L)}},[i.floating,t,s,l,b,I]);const T=o.useCallback((L,N=!0,Z="hover")=>{const q=_n(y.current,"close",w.current);q&&!P.current?C.start(q,()=>s(!1,L,Z)):N&&(C.clear(),s(!1,L,Z))},[y,s,C]),E=le(()=>{D.current(),P.current=void 0}),V=le(()=>{if(M.current){const L=wt(i.floating).body;L.style.pointerEvents="",L.removeAttribute(_a),M.current=!1}}),j=le(()=>r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1);o.useEffect(()=>{if(!l)return;function L(z){if(C.clear(),O.current=!1,h&&!Qn(w.current)||Hs(S.current)>0&&!_n(y.current,"open"))return;const H=_n(y.current,"open",w.current);H?C.start(H,()=>{k.current||s(!0,z,"hover")}):t||s(!0,z,"hover")}function N(z){if(j()){V();return}D.current();const H=wt(i.floating);if(x.clear(),F.current=!1,b.current&&r.current.floatingContext){t||C.clear(),P.current=b.current({...r.current.floatingContext,tree:m,x:z.clientX,y:z.clientY,onClose(){V(),E(),j()||T(z,!0,"safe-polygon")}});const J=P.current;H.addEventListener("mousemove",J),D.current=()=>{H.removeEventListener("mousemove",J)};return}(w.current==="touch"?!Re(i.floating,z.relatedTarget):!0)&&T(z)}function Z(z){j()||r.current.floatingContext&&b.current?.({...r.current.floatingContext,tree:m,x:z.clientX,y:z.clientY,onClose(){V(),E(),j()||T(z)}})(z)}function q(){C.clear()}function Y(z){j()||T(z,!1)}if(Oe(i.domReference)){const z=i.domReference,H=i.floating;return t&&z.addEventListener("mouseleave",Z),u&&z.addEventListener("mousemove",L,{once:!0}),z.addEventListener("mouseenter",L),z.addEventListener("mouseleave",N),H&&(H.addEventListener("mouseleave",Z),H.addEventListener("mouseenter",q),H.addEventListener("mouseleave",Y)),()=>{t&&z.removeEventListener("mouseleave",Z),u&&z.removeEventListener("mousemove",L),z.removeEventListener("mouseenter",L),z.removeEventListener("mouseleave",N),H&&(H.removeEventListener("mouseleave",Z),H.removeEventListener("mouseenter",q),H.removeEventListener("mouseleave",Y))}}},[i,l,e,h,u,T,E,V,s,t,k,m,y,b,r,j,S,C,x]),Fe(()=>{if(l&&t&&b.current?.__options?.blockPointerEvents&&I()){M.current=!0;const L=i.floating;if(Oe(i.domReference)&&L){const N=wt(i.floating).body;N.setAttribute(_a,"");const Z=i.domReference,q=m?.nodesRef.current.find(Y=>Y.id===p)?.context?.elements.floating;return q&&(q.style.pointerEvents=""),N.style.pointerEvents="none",Z.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{N.style.pointerEvents="",Z.style.pointerEvents="",L.style.pointerEvents=""}}}},[l,t,p,i,m,b,I]),Fe(()=>{t||(w.current=void 0,F.current=!1,E(),V())},[t,E,V]),o.useEffect(()=>()=>{E(),C.clear(),x.clear(),V()},[l,i.domReference,E,V,C,x]);const K=o.useMemo(()=>{function L(N){w.current=N.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(N){const{nativeEvent:Z}=N;function q(){!O.current&&!k.current&&s(!0,Z,"hover")}h&&!Qn(w.current)||t||Hs(S.current)===0||F.current&&N.movementX**2+N.movementY**2<2||(x.clear(),w.current==="touch"?q():(F.current=!0,x.start(Hs(S.current),q)))}}},[h,s,t,k,S,x]);return o.useMemo(()=>l?{reference:K}:{},[l,K])}const Eo=o.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Mr,currentIdRef:{current:null},currentContextRef:{current:null}});function Td(e){const{children:n,delay:t,timeoutMs:s=0}=e,r=o.useRef(t),a=o.useRef(t),i=o.useRef(null),l=o.useRef(null),c=Bt();return d.jsx(Eo.Provider,{value:o.useMemo(()=>({hasProvider:!0,delayRef:r,initialDelayRef:a,currentIdRef:i,timeoutMs:s,currentContextRef:l,timeout:c}),[s,c]),children:n})}function Fd(e,n={}){const{open:t,onOpenChange:s,floatingId:r}=e,{enabled:a=!0}=n,i=o.useContext(Eo),{currentIdRef:l,delayRef:c,timeoutMs:f,initialDelayRef:h,currentContextRef:g,hasProvider:u,timeout:m}=i,[p,b]=o.useState(!1);return Fe(()=>{function y(){b(!1),g.current?.setIsInstantPhase(!1),l.current=null,g.current=null,c.current=h.current}if(a&&l.current&&!t&&l.current===r){if(b(!1),f)return m.start(f,y),()=>{m.clear()};y()}},[a,t,r,l,c,f,h,g,m]),Fe(()=>{if(!a||!t)return;const y=g.current,k=l.current;g.current={onOpenChange:s,setIsInstantPhase:b},l.current=r,c.current={open:0,close:_n(h.current,"close")},k!==null&&k!==r?(m.clear(),b(!0),y?.setIsInstantPhase(!0),y?.onOpenChange(!1)):(b(!1),y?.setIsInstantPhase(!1))},[a,t,r,s,l,c,f,h,g,m]),Fe(()=>()=>{g.current=null},[g]),o.useMemo(()=>({hasProvider:u,delayRef:c,isInstantPhase:p}),[u,c,p])}function Od(e,n){let t=null,s=null,r=!1;return{contextElement:e||void 0,getBoundingClientRect(){const a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=n.axis==="x"||n.axis==="both",l=n.axis==="y"||n.axis==="both",c=["mouseenter","mousemove"].includes(n.dataRef.current.openEvent?.type||"")&&n.pointerType!=="touch";let f=a.width,h=a.height,g=a.x,u=a.y;return t==null&&n.x&&i&&(t=a.x-n.x),s==null&&n.y&&l&&(s=a.y-n.y),g-=t||0,u-=s||0,f=0,h=0,!r||c?(f=n.axis==="y"?a.width:0,h=n.axis==="x"?a.height:0,g=i&&n.x!=null?n.x:g,u=l&&n.y!=null?n.y:u):r&&!c&&(h=n.axis==="x"?a.height:h,f=n.axis==="y"?a.width:f),r=!0,{width:f,height:h,x:g,y:u,top:u,right:g+f,bottom:u+h,left:g}}}}function Ba(e){return e!=null&&e.clientX!=null}function Rd(e,n={}){const{open:t,dataRef:s,elements:{floating:r,domReference:a},refs:i}=e,{enabled:l=!0,axis:c="both",x:f=null,y:h=null}=n,g=o.useRef(!1),u=o.useRef(null),[m,p]=o.useState(),[b,y]=o.useState([]),k=le((x,O)=>{g.current||s.current.openEvent&&!Ba(s.current.openEvent)||i.setPositionReference(Od(a,{x,y:O,axis:c,dataRef:s,pointerType:m}))}),S=le(x=>{f!=null||h!=null||(t?u.current||y([]):k(x.clientX,x.clientY))}),w=Qn(m)?r:t,C=o.useCallback(()=>{if(!w||!l||f!=null||h!=null)return;const x=qn(r);function O(M){const D=Be(M);Re(r,D)?(x.removeEventListener("mousemove",O),u.current=null):k(M.clientX,M.clientY)}if(!s.current.openEvent||Ba(s.current.openEvent)){x.addEventListener("mousemove",O);const M=()=>{x.removeEventListener("mousemove",O),u.current=null};return u.current=M,M}i.setPositionReference(a)},[w,l,f,h,r,s,i,a,k]);o.useEffect(()=>C(),[C,b]),o.useEffect(()=>{l&&!r&&(g.current=!1)},[l,r]),o.useEffect(()=>{!l&&t&&(g.current=!0)},[l,t]),Fe(()=>{l&&(f!=null||h!=null)&&(g.current=!1,k(f,h))},[l,f,h,k]);const P=o.useMemo(()=>{function x(O){p(O.pointerType)}return{onPointerDown:x,onPointerEnter:x,onMouseMove:S,onMouseEnter:S}},[S]);return o.useMemo(()=>l?{reference:P}:{},[l,P])}const Id={intentional:"onClick",sloppy:"onPointerDown"};function Za(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Ad(e,n={}){const{open:t,onOpenChange:s,elements:r,dataRef:a}=e,{enabled:i=!0,escapeKey:l=!0,outsidePress:c=!0,outsidePressEvent:f="sloppy",referencePress:h=!1,referencePressEvent:g="sloppy",ancestorScroll:u=!1,bubbles:m,capture:p}=n,b=_r(),y=le(typeof c=="function"?c:()=>!1),k=typeof c=="function"?y:c,S=o.useRef(!1),{escapeKey:w,outsidePress:C}=Za(m),{escapeKey:P,outsidePress:x}=Za(p),O=o.useRef(null),M=Bt(),D=Bt(),F=o.useRef(!1),I=o.useRef(""),T=le(A=>{I.current=A.pointerType}),E=le(()=>{const A=I.current,R=A==="pen"||!A?"mouse":A;return typeof f=="string"?f:f[R]}),V=le(A=>{if(!t||!i||!l||A.key!=="Escape"||F.current)return;const R=a.current.floatingContext?.nodeId,$=b?cn(b.nodesRef.current,R):[];if(!w&&(A.stopPropagation(),$.length>0)){let _=!0;if($.forEach(G=>{G.context?.open&&!G.context.dataRef.current.__escapeKeyBubbles&&(_=!1)}),!_)return}s(!1,Hu(A)?A.nativeEvent:A,"escape-key")}),j=le(A=>{const R=E();return R==="intentional"&&A.type!=="click"||R==="sloppy"&&A.type==="click"}),K=le(A=>{const R=()=>{V(A),Be(A)?.removeEventListener("keydown",R)};Be(A)?.addEventListener("keydown",R)}),L=le(A=>{if(j(A))return;const R=a.current.insideReactTree;a.current.insideReactTree=!1;const $=S.current;if(S.current=!1,E()==="intentional"&&$||R||typeof k=="function"&&!k(A))return;const _=Be(A),G=`[${kr("inert")}]`,ue=wt(r.floating).querySelectorAll(G);let me=Oe(_)?_:null;for(;me&&!Ps(me);){const we=dc(me);if(Ps(we)||!Oe(we))break;me=we}if(ue.length&&Oe(_)&&!fc(_)&&!Re(_,r.floating)&&Array.from(ue).every(we=>!Re(me,we)))return;if(ki(_)){const we=Ps(_),je=hc(_),mt=/auto|scroll/,$e=we||mt.test(je.overflowX),lt=we||mt.test(je.overflowY),Jt=$e&&_.clientWidth>0&&_.scrollWidth>_.clientWidth,X=lt&&_.clientHeight>0&&_.scrollHeight>_.clientHeight,te=je.direction==="rtl",de=X&&(te?A.offsetX<=_.offsetWidth-_.clientWidth:A.offsetX>_.clientWidth),fe=Jt&&A.offsetY>_.clientHeight;if(de||fe)return}const Ze=a.current.floatingContext?.nodeId,Ft=b&&cn(b.nodesRef.current,Ze).some(we=>Ye(A,we.context?.elements.floating));if(Ye(A,r.floating)||Ye(A,r.domReference)||Ft)return;const pt=b?cn(b.nodesRef.current,Ze):[];if(pt.length>0){let we=!0;if(pt.forEach(je=>{je.context?.open&&!je.context.dataRef.current.__outsidePressBubbles&&(we=!1)}),!we)return}s(!1,A,"outside-press")}),N=le(A=>{if(!(E()!=="sloppy"||!t||!i||Ye(A,r.floating)||Ye(A,r.domReference))){if(A.pointerType==="touch"){O.current={startTime:Date.now(),startX:A.clientX,startY:A.clientY,dismissOnPointerUp:!1,dismissOnMouseDown:!0},M.start(1e3,()=>{O.current&&(O.current.dismissOnPointerUp=!1,O.current.dismissOnMouseDown=!1)});return}L(A)}}),Z=le(A=>{if(j(A)||(M.clear(),A.type==="mousedown"&&O.current&&!O.current.dismissOnMouseDown))return;const R=()=>{A.type==="pointerdown"?N(A):L(A),Be(A)?.removeEventListener(A.type,R)};Be(A)?.addEventListener(A.type,R)}),q=le(A=>{if(E()!=="sloppy"||A.pointerType!=="touch"||!O.current||Ye(A,r.floating)||Ye(A,r.domReference))return;const R=Math.abs(A.clientX-O.current.startX),$=Math.abs(A.clientY-O.current.startY),_=Math.sqrt(R*R+$*$);_>5&&(O.current.dismissOnPointerUp=!0),_>10&&(L(A),M.clear(),O.current=null)}),Y=le(A=>{E()!=="sloppy"||A.pointerType!=="touch"||!O.current||Ye(A,r.floating)||Ye(A,r.domReference)||(O.current.dismissOnPointerUp&&L(A),M.clear(),O.current=null)});o.useEffect(()=>{if(!t||!i)return;a.current.__escapeKeyBubbles=w,a.current.__outsidePressBubbles=C;const A=new Mr;function R(me){s(!1,me,"ancestor-scroll")}function $(){A.clear(),F.current=!0}function _(){A.start(pc()?5:0,()=>{F.current=!1})}const G=wt(r.floating);G.addEventListener("pointerdown",T,!0),l&&(G.addEventListener("keydown",P?K:V,P),G.addEventListener("compositionstart",$),G.addEventListener("compositionend",_)),k&&(G.addEventListener("click",x?Z:L,x),G.addEventListener("pointerdown",x?Z:L,x),G.addEventListener("pointermove",q,x),G.addEventListener("pointerup",Y,x),G.addEventListener("mousedown",Z,x));let ue=[];return u&&(Oe(r.domReference)&&(ue=js(r.domReference)),Oe(r.floating)&&(ue=ue.concat(js(r.floating))),!Oe(r.reference)&&r.reference&&r.reference.contextElement&&(ue=ue.concat(js(r.reference.contextElement)))),ue=ue.filter(me=>me!==G.defaultView?.visualViewport),ue.forEach(me=>{me.addEventListener("scroll",R,{passive:!0})}),()=>{G.removeEventListener("pointerdown",T,!0),l&&(G.removeEventListener("keydown",P?K:V,P),G.removeEventListener("compositionstart",$),G.removeEventListener("compositionend",_)),k&&(G.removeEventListener("click",x?Z:L,x),G.removeEventListener("pointerdown",x?Z:L,x),G.removeEventListener("pointermove",q,x),G.removeEventListener("pointerup",Y,x),G.removeEventListener("mousedown",Z,x)),ue.forEach(me=>{me.removeEventListener("scroll",R)}),A.clear()}},[a,r,l,k,f,t,s,u,i,w,C,V,P,K,L,x,Z,N,q,Y,T]),o.useEffect(()=>{a.current.insideReactTree=!1},[a,k]);const z=o.useMemo(()=>({onKeyDown:V,...h&&{[Id[g]]:A=>{s(!1,A.nativeEvent,"reference-press")},...g!=="intentional"&&{onClick(A){s(!1,A.nativeEvent,"reference-press")}}}}),[V,s,h,g]),H=le(A=>{const R=Be(A.nativeEvent);Re(r.floating,R)&&(S.current=!0)}),B=le(()=>{a.current.insideReactTree=!0,D.start(0,()=>{a.current.insideReactTree=!1})}),J=o.useMemo(()=>({onKeyDown:V,onMouseDown:H,onMouseUp:H,onPointerDownCapture:B,onMouseDownCapture:B,onClickCapture:B}),[V,H,B]);return o.useMemo(()=>i?{reference:z,floating:J}:{},[i,z,J])}function So(e){const{open:n=!1,onOpenChange:t,elements:s}=e,r=Sr(),a=o.useRef({}),[i]=o.useState(()=>Sd()),l=wo()!=null,[c,f]=o.useState(s.reference),h=le((m,p,b)=>{a.current.openEvent=m?p:void 0,i.emit("openchange",{open:m,event:p,reason:b,nested:l}),t?.(m,p,b)}),g=o.useMemo(()=>({setPositionReference:f}),[]),u=o.useMemo(()=>({reference:c||s.reference||null,floating:s.floating||null,domReference:s.reference}),[c,s.reference,s.floating]);return o.useMemo(()=>({dataRef:a,open:n,onOpenChange:h,elements:u,events:i,floatingId:r,refs:g}),[n,h,u,i,r,g])}function Vd(e={}){const{nodeId:n}=e,t=So({...e,elements:{reference:null,floating:null,...e.elements}}),s=e.rootContext||t,r=s.elements,[a,i]=o.useState(null),[l,c]=o.useState(null),h=r?.domReference||a,g=o.useRef(null),u=_r();Fe(()=>{h&&(g.current=h)},[h]);const m=mc({...e,elements:{...r,...l&&{reference:l}}}),p=o.useCallback(w=>{const C=Oe(w)?{getBoundingClientRect:()=>w.getBoundingClientRect(),getClientRects:()=>w.getClientRects(),contextElement:w}:w;c(C),m.refs.setReference(C)},[m.refs]),b=o.useCallback(w=>{(Oe(w)||w===null)&&(g.current=w,i(w)),(Oe(m.refs.reference.current)||m.refs.reference.current===null||w!==null&&!Oe(w))&&m.refs.setReference(w)},[m.refs]),y=o.useMemo(()=>({...m.refs,setReference:b,setPositionReference:p,domReference:g}),[m.refs,b,p]),k=o.useMemo(()=>({...m.elements,domReference:h}),[m.elements,h]),S=o.useMemo(()=>({...m,...s,refs:y,elements:k,nodeId:n}),[m,y,k,n,s]);return Fe(()=>{s.dataRef.current.floatingContext=S;const w=u?.nodesRef.current.find(C=>C.id===n);w&&(w.context=S)}),o.useMemo(()=>({...m,context:S,refs:y,elements:k}),[m,y,k,S])}const _s=bc&&Si;function Pd(e,n={}){const{open:t,onOpenChange:s,events:r,dataRef:a,elements:i}=e,{enabled:l=!0,visibleOnly:c=!0}=n,f=o.useRef(!1),h=Bt(),g=o.useRef(!0);o.useEffect(()=>{if(!l)return;const m=qn(i.domReference);function p(){!t&&ki(i.domReference)&&i.domReference===xt(wt(i.domReference))&&(f.current=!0)}function b(){g.current=!0}function y(){g.current=!1}return m.addEventListener("blur",p),_s&&(m.addEventListener("keydown",b,!0),m.addEventListener("pointerdown",y,!0)),()=>{m.removeEventListener("blur",p),_s&&(m.removeEventListener("keydown",b,!0),m.removeEventListener("pointerdown",y,!0))}},[i.domReference,t,l]),o.useEffect(()=>{if(!l)return;function m({reason:p}){(p==="reference-press"||p==="escape-key")&&(f.current=!0)}return r.on("openchange",m),()=>{r.off("openchange",m)}},[r,l]);const u=o.useMemo(()=>({onMouseLeave(){f.current=!1},onFocus(m){if(f.current)return;const p=Be(m.nativeEvent);if(c&&Oe(p)){if(_s&&!m.relatedTarget){if(!g.current&&!gc(p))return}else if(!Ln(p))return}s(!0,m.nativeEvent,"focus")},onBlur(m){f.current=!1;const p=m.relatedTarget,b=m.nativeEvent,y=Oe(p)&&p.hasAttribute(kr("focus-guard"))&&p.getAttribute("data-type")==="outside";h.start(0,()=>{const k=xt(i.domReference?i.domReference.ownerDocument:document);!p&&k===i.domReference||Re(a.current.floatingContext?.refs.floating.current,k)||Re(i.domReference,k)||y||s(!1,b,"focus")})}}),[a,i.domReference,s,c,h]);return o.useMemo(()=>l?{reference:u}:{},[l,u])}function jd(e=[]){const n=e.map(l=>l?.reference),t=e.map(l=>l?.floating),s=e.map(l=>l?.item),r=o.useCallback(l=>Bs(l,e,"reference"),n),a=o.useCallback(l=>Bs(l,e,"floating"),t),i=o.useCallback(l=>Bs(l,e,"item"),s);return o.useMemo(()=>({getReferenceProps:r,getFloatingProps:a,getItemProps:i}),[r,a,i])}function Bs(e,n,t){const s=new Map,r=t==="item",a={};t==="floating"&&(a.tabIndex=-1,a[vc]="");for(const i in e)r&&e&&(i===Mi||i===Ci)||(a[i]=e[i]);for(let i=0;i<n.length;i+=1){let l;const c=n[i]?.[t];typeof c=="function"?l=e?c(e):null:l=c,l&&Ua(a,l,r,s)}return Ua(a,e,r,s),a}function Ua(e,n,t,s){for(const r in n){const a=n[r];t&&(r===Mi||r===Ci)||(r.startsWith("on")?(s.has(r)||s.set(r,[]),typeof a=="function"&&(s.get(r)?.push(a),e[r]=(...i)=>s.get(r)?.map(l=>l(...i)).find(l=>l!==void 0))):e[r]=a)}}function za(e,n){const[t,s]=e;let r=!1;const a=n.length;for(let i=0,l=a-1;i<a;l=i++){const[c,f]=n[i]||[0,0],[h,g]=n[l]||[0,0];f>=s!=g>=s&&t<=(h-c)*(s-f)/(g-f)+c&&(r=!r)}return r}function Nd(e,n){return e[0]>=n.x&&e[0]<=n.x+n.width&&e[1]>=n.y&&e[1]<=n.y+n.height}function Dd(e={}){const{buffer:n=.5,blockPointerEvents:t=!1,requireIntent:s=!0}=e,r=new Mr;let a=!1,i=null,l=null,c=typeof performance<"u"?performance.now():0;function f(g,u){const m=performance.now(),p=m-c;if(i===null||l===null||p===0)return i=g,l=u,c=m,null;const b=g-i,y=u-l,S=Math.sqrt(b*b+y*y)/p;return i=g,l=u,c=m,S}const h=({x:g,y:u,placement:m,elements:p,onClose:b,nodeId:y,tree:k})=>function(w){function C(){r.clear(),b()}if(r.clear(),!p.domReference||!p.floating||m==null||g==null||u==null)return;const{clientX:P,clientY:x}=w,O=[P,x],M=Be(w),D=w.type==="mouseleave",F=Re(p.floating,M),I=Re(p.domReference,M),T=p.domReference.getBoundingClientRect(),E=p.floating.getBoundingClientRect(),V=m.split("-")[0],j=g>E.right-E.width/2,K=u>E.bottom-E.height/2,L=Nd(O,T),N=E.width>T.width,Z=E.height>T.height,q=(N?T:E).left,Y=(N?T:E).right,z=(Z?T:E).top,H=(Z?T:E).bottom;if(F&&(a=!0,!D))return;if(I&&(a=!1),I&&!D){a=!0;return}if(D&&Oe(w.relatedTarget)&&Re(p.floating,w.relatedTarget)||k&&cn(k.nodesRef.current,y).some(({context:A})=>A?.open))return;if(V==="top"&&u>=T.bottom-1||V==="bottom"&&u<=T.top+1||V==="left"&&g>=T.right-1||V==="right"&&g<=T.left+1)return C();let B=[];switch(V){case"top":B=[[q,T.top+1],[q,E.bottom-1],[Y,E.bottom-1],[Y,T.top+1]];break;case"bottom":B=[[q,E.top+1],[q,T.bottom-1],[Y,T.bottom-1],[Y,E.top+1]];break;case"left":B=[[E.right-1,H],[E.right-1,z],[T.left+1,z],[T.left+1,H]];break;case"right":B=[[T.right-1,H],[T.right-1,z],[E.left+1,z],[E.left+1,H]];break}function J([A,R]){switch(V){case"top":{const $=[N?A+n/2:j?A+n*4:A-n*4,R+n+1],_=[N?A-n/2:j?A+n*4:A-n*4,R+n+1],G=[[E.left,j||N?E.bottom-n:E.top],[E.right,j?N?E.bottom-n:E.top:E.bottom-n]];return[$,_,...G]}case"bottom":{const $=[N?A+n/2:j?A+n*4:A-n*4,R-n],_=[N?A-n/2:j?A+n*4:A-n*4,R-n],G=[[E.left,j||N?E.top+n:E.bottom],[E.right,j?N?E.top+n:E.bottom:E.top+n]];return[$,_,...G]}case"left":{const $=[A+n+1,Z?R+n/2:K?R+n*4:R-n*4],_=[A+n+1,Z?R-n/2:K?R+n*4:R-n*4];return[...[[K||Z?E.right-n:E.left,E.top],[K?Z?E.right-n:E.left:E.right-n,E.bottom]],$,_]}case"right":{const $=[A-n,Z?R+n/2:K?R+n*4:R-n*4],_=[A-n,Z?R-n/2:K?R+n*4:R-n*4],G=[[K||Z?E.left+n:E.right,E.top],[K?Z?E.left+n:E.right:E.left+n,E.bottom]];return[$,_,...G]}default:return[]}}if(!za([P,x],B)){if(a&&!L)return C();if(!D&&s){const A=f(w.clientX,w.clientY);if(A!==null&&A<.1)return C()}za([P,x],J([g,u]))?!a&&s&&r.start(40,C):C()}};return h.__options={blockPointerEvents:t},h}function Ld(){const e=o.useContext(yc);if(!e)throw new Error("Base UI: useToast must be used within <Toast.Provider>.");const{toasts:n,add:t,close:s,update:r,promise:a}=e;return o.useMemo(()=>({toasts:n,add:t,close:s,update:r,promise:a}),[n,t,s,r,a])}const $d=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),o.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z"}))]]),Hd=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),o.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),_d=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),o.createElement("path",{d:"M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"}))]]),Bd=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M184.49,167.51a12,12,0,0,1,0,17l-48,48a12,12,0,0,1-17,0l-48-48a12,12,0,0,1,17-17L128,207l39.51-39.52A12,12,0,0,1,184.49,167.51Zm-96-79L128,49l39.51,39.52a12,12,0,0,0,17-17l-48-48a12,12,0,0,0-17,0l-48,48a12,12,0,0,0,17,17Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M80,176h96l-48,48ZM128,32,80,80h96Z",opacity:"0.2"}),o.createElement("path",{d:"M176,168H80a8,8,0,0,0-5.66,13.66l48,48a8,8,0,0,0,11.32,0l48-48A8,8,0,0,0,176,168Zm-48,44.69L99.31,184h57.38ZM80,88h96a8,8,0,0,0,5.66-13.66l-48-48a8,8,0,0,0-11.32,0l-48,48A8,8,0,0,0,80,88Zm48-44.69L156.69,72H99.31Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M72.61,83.06a8,8,0,0,1,1.73-8.72l48-48a8,8,0,0,1,11.32,0l48,48A8,8,0,0,1,176,88H80A8,8,0,0,1,72.61,83.06ZM176,168H80a8,8,0,0,0-5.66,13.66l48,48a8,8,0,0,0,11.32,0l48-48A8,8,0,0,0,176,168Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M180.24,171.76a6,6,0,0,1,0,8.48l-48,48a6,6,0,0,1-8.48,0l-48-48a6,6,0,0,1,8.48-8.48L128,215.51l43.76-43.75A6,6,0,0,1,180.24,171.76Zm-96-87.52L128,40.49l43.76,43.75a6,6,0,0,0,8.48-8.48l-48-48a6,6,0,0,0-8.48,0l-48,48a6,6,0,0,0,8.48,8.48Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M181.66,170.34a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-48-48a8,8,0,0,1,11.32-11.32L128,212.69l42.34-42.35A8,8,0,0,1,181.66,170.34Zm-96-84.68L128,43.31l42.34,42.35a8,8,0,0,0,11.32-11.32l-48-48a8,8,0,0,0-11.32,0l-48,48A8,8,0,0,0,85.66,85.66Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M178.83,173.17a4,4,0,0,1,0,5.66l-48,48a4,4,0,0,1-5.66,0l-48-48a4,4,0,0,1,5.66-5.66L128,218.34l45.17-45.17A4,4,0,0,1,178.83,173.17Zm-96-90.34L128,37.66l45.17,45.17a4,4,0,1,0,5.66-5.66l-48-48a4,4,0,0,0-5.66,0l-48,48a4,4,0,0,0,5.66,5.66Z"}))]]),Zd=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),o.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),Ud=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M148,200a20,20,0,1,1-20-20A20,20,0,0,1,148,200Zm-20-40a12,12,0,0,0,12-12V48a12,12,0,0,0-24,0V148A12,12,0,0,0,128,160Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,40V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24H200A16,16,0,0,1,216,40Z",opacity:"0.2"}),o.createElement("path",{d:"M144,200a16,16,0,1,1-16-16A16,16,0,0,1,144,200Zm-16-40a8,8,0,0,0,8-8V48a8,8,0,0,0-16,0V152A8,8,0,0,0,128,160Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V40A16,16,0,0,0,200,24ZM128,160a12,12,0,1,1-12,12A12,12,0,0,1,128,160Zm-8-24V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M142,200a14,14,0,1,1-14-14A14,14,0,0,1,142,200Zm-14-42a6,6,0,0,0,6-6V48a6,6,0,0,0-12,0V152A6,6,0,0,0,128,158Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M144,200a16,16,0,1,1-16-16A16,16,0,0,1,144,200Zm-16-40a8,8,0,0,0,8-8V48a8,8,0,0,0-16,0V152A8,8,0,0,0,128,160Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M140,200a12,12,0,1,1-12-12A12,12,0,0,1,140,200Zm-12-44a4,4,0,0,0,4-4V48a4,4,0,0,0-8,0V152A4,4,0,0,0,128,156Z"}))]]),zd=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),o.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),Gd=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),o.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),qd=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),o.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),Kd=new Map([["bold",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),o.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",o.createElement(o.Fragment,null,o.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",o.createElement(o.Fragment,null,o.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",o.createElement(o.Fragment,null,o.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),ko=o.forwardRef((e,n)=>o.createElement(We,{ref:n,...e,weights:$d}));ko.displayName="ArrowCounterClockwiseIcon";const Mo=o.forwardRef((e,n)=>o.createElement(We,{ref:n,...e,weights:Hd}));Mo.displayName="CaretDownIcon";const Co=o.forwardRef((e,n)=>o.createElement(We,{ref:n,...e,weights:_d}));Co.displayName="CaretRightIcon";const xs=o.forwardRef((e,n)=>o.createElement(We,{ref:n,...e,weights:Bd}));xs.displayName="CaretUpDownIcon";const it=o.forwardRef((e,n)=>o.createElement(We,{ref:n,...e,weights:Zd}));it.displayName="CheckIcon";const Jn=o.forwardRef((e,n)=>o.createElement(We,{ref:n,...e,weights:Ud}));Jn.displayName="ExclamationMarkIcon";const es=o.forwardRef((e,n)=>o.createElement(We,{ref:n,...e,weights:zd}));es.displayName="PlusIcon";const lr=o.forwardRef((e,n)=>o.createElement(We,{ref:n,...e,weights:Gd}));lr.displayName="TrashIcon";const Br=o.forwardRef((e,n)=>o.createElement(We,{ref:n,...e,weights:qd}));Br.displayName="WarningIcon";const Zr=o.forwardRef((e,n)=>o.createElement(We,{ref:n,...e,weights:Kd}));Zr.displayName="XIcon";function Ur(e,n,t){let[s,r]=o.useState(t),a=e!==void 0,i=o.useRef(a),l=o.useRef(!1),c=o.useRef(!1);return a&&!i.current&&!l.current?(l.current=!0,i.current=a,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!a&&i.current&&!c.current&&(c.current=!0,i.current=a,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[a?e:s,W(f=>(a||r(f),n?.(f)))]}function zr(e){let[n]=o.useState(e);return n}function To(e={},n=null,t=[]){for(let[s,r]of Object.entries(e))Oo(t,Fo(n,s),r);return t}function Fo(e,n){return e?e+"["+n+"]":n}function Oo(e,n,t){if(Array.isArray(t))for(let[s,r]of t.entries())Oo(e,Fo(n,s.toString()),r);else t instanceof Date?e.push([n,t.toISOString()]):typeof t=="boolean"?e.push([n,t?"1":"0"]):typeof t=="string"?e.push([n,t]):typeof t=="number"?e.push([n,`${t}`]):t==null?e.push([n,""]):To(t,n,e)}function Ro(e){var n,t;let s=(n=e?.form)!=null?n:e.closest("form");if(s){for(let r of s.elements)if(r!==e&&(r.tagName==="INPUT"&&r.type==="submit"||r.tagName==="BUTTON"&&r.type==="submit"||r.nodeName==="INPUT"&&r.type==="image")){r.click();return}(t=s.requestSubmit)==null||t.call(s)}}let Wd="span";var Gt=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Gt||{});function Yd(e,n){var t;let{features:s=1,...r}=e,a={ref:n,"aria-hidden":(s&2)===2?!0:(t=r["aria-hidden"])!=null?t:void 0,hidden:(s&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(s&4)===4&&(s&2)!==2&&{display:"none"}}};return pe()({ourProps:a,theirProps:r,slot:{},defaultTag:Wd,name:"Hidden"})}let pn=ce(Yd),Qd=o.createContext(null);function Xd({children:e}){let n=o.useContext(Qd);if(!n)return U.createElement(U.Fragment,null,e);let{target:t}=n;return t?Te.createPortal(U.createElement(U.Fragment,null,e),t):null}function Gr({data:e,form:n,disabled:t,onReset:s,overrides:r}){let[a,i]=o.useState(null),l=qt();return o.useEffect(()=>{if(s&&a)return l.addEventListener(a,"reset",s)},[a,n,s]),U.createElement(Xd,null,U.createElement(Jd,{setForm:i,formId:n}),To(e).map(([c,f])=>U.createElement(pn,{features:Gt.Hidden,...Ti({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:n,disabled:t,name:c,value:f,...r})})))}function Jd({setForm:e,formId:n}){return o.useEffect(()=>{if(n){let t=document.getElementById(n);t&&e(t)}},[e,n]),n?null:U.createElement(pn,{features:Gt.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let s=t.closest("form");s&&e(s)}})}let ef="span";function tf(e,n){let t=o.useId(),s=ls(),r=cs(),{id:a=s||`headlessui-checkbox-${t}`,disabled:i=r||!1,autoFocus:l=!1,checked:c,defaultChecked:f,onChange:h,name:g,value:u,form:m,indeterminate:p=!1,tabIndex:b=0,...y}=e,k=zr(f),[S,w]=Ur(c,h,k??!1),C=Kt(),P=us(),x=qt(),[O,M]=o.useState(!1),D=W(()=>{M(!0),w?.(!S),x.nextFrame(()=>{M(!1)})}),F=W(H=>{if(ds(H.currentTarget))return H.preventDefault();H.preventDefault(),D()}),I=W(H=>{H.key===ne.Space?(H.preventDefault(),D()):H.key===ne.Enter&&Ro(H.currentTarget)}),T=W(H=>H.preventDefault()),{isFocusVisible:E,focusProps:V}=Wt({autoFocus:l}),{isHovered:j,hoverProps:K}=Yt({isDisabled:i}),{pressed:L,pressProps:N}=fs({disabled:i}),Z=rt({ref:n,id:a,role:"checkbox","aria-checked":p?"mixed":S?"true":"false","aria-labelledby":C,"aria-describedby":P,"aria-disabled":i?!0:void 0,indeterminate:p?"true":void 0,tabIndex:i?void 0:b,onKeyUp:i?void 0:I,onKeyPress:i?void 0:T,onClick:i?void 0:F},V,K,N),q=o.useMemo(()=>({checked:S,disabled:i,hover:j,focus:E,active:L,indeterminate:p,changing:O,autofocus:l}),[S,p,i,j,E,L,O,l]),Y=o.useCallback(()=>{if(k!==void 0)return w?.(k)},[w,k]),z=pe();return U.createElement(U.Fragment,null,g!=null&&U.createElement(Gr,{disabled:i,data:{[g]:u||"on"},overrides:{type:"checkbox",checked:S},form:m,onReset:Y}),z({ourProps:Z,theirProps:y,slot:q,defaultTag:ef,name:"Checkbox"}))}let nf=ce(tf),sf=o.createContext(()=>{});function Io({value:e,children:n}){return U.createElement(sf.Provider,{value:e},n)}function Vt(e,n,t){let s=t.initialDeps??[],r;function a(){var i,l,c,f;let h;t.key&&((i=t.debug)!=null&&i.call(t))&&(h=Date.now());const g=e();if(!(g.length!==s.length||g.some((p,b)=>s[b]!==p)))return r;s=g;let m;if(t.key&&((l=t.debug)!=null&&l.call(t))&&(m=Date.now()),r=n(...g),t.key&&((c=t.debug)!=null&&c.call(t))){const p=Math.round((Date.now()-h)*100)/100,b=Math.round((Date.now()-m)*100)/100,y=b/16,k=(S,w)=>{for(S=String(S);S.length<w;)S=" "+S;return S};console.info(`%c⏱ ${k(b,5)} /${k(p,5)} ms`,`
|
|
11
|
+
font-size: .6rem;
|
|
12
|
+
font-weight: bold;
|
|
13
|
+
color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,t?.key)}return(f=t?.onChange)==null||f.call(t,r),r}return a.updateDeps=i=>{s=i},a}function Ga(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const rf=(e,n)=>Math.abs(e-n)<1.01,af=(e,n,t)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>n.apply(this,r),t)}},qa=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},of=e=>e,lf=e=>{const n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let r=n;r<=t;r++)s.push(r);return s},cf=(e,n)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;const r=i=>{const{width:l,height:c}=i;n({width:Math.round(l),height:Math.round(c)})};if(r(qa(t)),!s.ResizeObserver)return()=>{};const a=new s.ResizeObserver(i=>{const l=()=>{const c=i[0];if(c?.borderBoxSize){const f=c.borderBoxSize[0];if(f){r({width:f.inlineSize,height:f.blockSize});return}}r(qa(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return a.observe(t,{box:"border-box"}),()=>{a.unobserve(t)}},Ka={passive:!0},Wa=typeof window>"u"?!0:"onscrollend"in window,uf=(e,n)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;let r=0;const a=e.options.useScrollendEvent&&Wa?()=>{}:af(s,()=>{n(r,!1)},e.options.isScrollingResetDelay),i=h=>()=>{const{horizontal:g,isRtl:u}=e.options;r=g?t.scrollLeft*(u&&-1||1):t.scrollTop,a(),n(r,h)},l=i(!0),c=i(!1);c(),t.addEventListener("scroll",l,Ka);const f=e.options.useScrollendEvent&&Wa;return f&&t.addEventListener("scrollend",c,Ka),()=>{t.removeEventListener("scroll",l),f&&t.removeEventListener("scrollend",c)}},df=(e,n,t)=>{if(n?.borderBoxSize){const s=n.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},ff=(e,{adjustments:n=0,behavior:t},s)=>{var r,a;const i=e+n;(a=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||a.call(r,{[s.options.horizontal?"left":"top"]:i,behavior:t})};class hf{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(r=>{r.forEach(a=>{const i=()=>{this._measureElement(a.target,a)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),t=null},observe:r=>{var a;return(a=s())==null?void 0:a.observe(r,{box:"border-box"})},unobserve:r=>{var a;return(a=s())==null?void 0:a.unobserve(r)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([s,r])=>{typeof r>"u"&&delete t[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:of,rangeExtractor:lf,onChange:()=>{},measureElement:df,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,t)},this.maybeNotify=Vt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=a,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,s)=>{const r=new Map,a=new Map;for(let i=s-1;i>=0;i--){const l=t[i];if(r.has(l.lane))continue;const c=a.get(l.lane);if(c==null||l.end>c.end?a.set(l.lane,l):l.end<c.end&&r.set(l.lane,!0),r.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=Vt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,s,r,a,i)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:s,scrollMargin:r,getItemKey:a,enabled:i}),{key:!1}),this.getMeasurements=Vt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:s,scrollMargin:r,getItemKey:a,enabled:i},l)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const f=this.measurementsCache.slice(0,c);for(let h=c;h<t;h++){const g=a(h),u=this.options.lanes===1?f[h-1]:this.getFurthestMeasurement(f,h),m=u?u.end+this.options.gap:s+r,p=l.get(g),b=typeof p=="number"?p:this.options.estimateSize(h),y=m+b,k=u?u.lane:h%this.options.lanes;f[h]={index:h,start:m,size:b,end:y,key:g,lane:k}}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Vt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,r,a)=>this.range=t.length>0&&s>0?pf({measurements:t,outerSize:s,scrollOffset:r,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Vt(()=>{let t=null,s=null;const r=this.calculateRange();return r&&(t=r.startIndex,s=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,r,a,i)=>a===null||i===null?[]:t({startIndex:a,endIndex:i,overscan:s,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,r=t.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(t,s)=>{const r=this.indexFromElement(t),a=this.measurementsCache[r];if(!a)return;const i=a.key,l=this.elementsCache.get(i);l!==t&&(l&&this.observer.unobserve(l),this.observer.observe(t),this.elementsCache.set(i,t)),t.isConnected&&this.resizeItem(r,this.options.measureElement(t,s,this))},this.resizeItem=(t,s)=>{const r=this.measurementsCache[t];if(!r)return;const a=this.itemSizeCache.get(r.key)??r.size,i=s-a;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,i,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((s,r)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(r))});return}this._measureElement(t,void 0)},this.getVirtualItems=Vt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const r=[];for(let a=0,i=t.length;a<i;a++){const l=t[a],c=s[l];r.push(c)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const s=this.getMeasurements();if(s.length!==0)return Ga(s[Ao(0,s.length-1,r=>Ga(s[r]).start,t)])},this.getOffsetForAlignment=(t,s,r=0)=>{const a=this.getSize(),i=this.getScrollOffset();s==="auto"&&(s=t>=i+a?"end":"start"),s==="center"?t+=(r-a)/2:s==="end"&&(t-=a);const l=this.getTotalSize()+this.options.scrollMargin-a;return Math.max(Math.min(l,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const r=this.measurementsCache[t];if(!r)return;const a=this.getSize(),i=this.getScrollOffset();if(s==="auto")if(r.end>=i+a-this.options.scrollPaddingEnd)s="end";else if(r.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];const l=s==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,s,r.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:s="start",behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,s),{adjustments:void 0,behavior:r})},this.scrollToIndex=(t,{align:s="auto",behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1));let a=0;const i=10,l=f=>{if(!this.targetWindow)return;const h=this.getOffsetForIndex(t,f);if(!h){console.warn("Failed to get offset for index:",t);return}const[g,u]=h;this._scrollToOffset(g,{adjustments:void 0,behavior:r}),this.targetWindow.requestAnimationFrame(()=>{const m=this.getScrollOffset(),p=this.getOffsetForIndex(t,u);if(!p){console.warn("Failed to get offset for index:",t);return}rf(p[0],m)||c(u)})},c=f=>{this.targetWindow&&(a++,a<i?this.targetWindow.requestAnimationFrame(()=>l(f)):console.warn(`Failed to scroll to index ${t} after ${i} attempts.`))};l(s)},this.scrollBy=(t,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var t;const s=this.getMeasurements();let r;if(s.length===0)r=this.options.paddingStart;else if(this.options.lanes===1)r=((t=s[s.length-1])==null?void 0:t.end)??0;else{const a=Array(this.options.lanes).fill(null);let i=s.length-1;for(;i>=0&&a.some(l=>l===null);){const l=s[i];a[l.lane]===null&&(a[l.lane]=l.end),i--}r=Math.max(...a.filter(l=>l!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:s,behavior:r})=>{this.options.scrollToFn(t,{behavior:r,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(n)}}const Ao=(e,n,t,s)=>{for(;e<=n;){const r=(e+n)/2|0,a=t(r);if(a<s)e=r+1;else if(a>s)n=r-1;else return r}return e>0?e-1:0};function pf({measurements:e,outerSize:n,scrollOffset:t,lanes:s}){const r=e.length-1,a=c=>e[c].start;if(e.length<=s)return{startIndex:0,endIndex:r};let i=Ao(0,r,a,t),l=i;if(s===1)for(;l<r&&e[l].end<t+n;)l++;else if(s>1){const c=Array(s).fill(0);for(;l<r&&c.some(h=>h<t+n);){const h=e[l];c[h.lane]=h.end,l++}const f=Array(s).fill(t+n);for(;i>=0&&f.some(h=>h>=t);){const h=e[i];f[h.lane]=h.start,i--}i=Math.max(0,i-i%s),l=Math.min(r,l+(s-1-l%s))}return{startIndex:i,endIndex:l}}const Ya=typeof document<"u"?o.useLayoutEffect:o.useEffect;function mf(e){const n=o.useReducer(()=>({}),{})[1],t={...e,onChange:(r,a)=>{var i;a?Te.flushSync(n):n(),(i=e.onChange)==null||i.call(e,r,a)}},[s]=o.useState(()=>new hf(t));return s.setOptions(t),Ya(()=>s._didMount(),[]),Ya(()=>s._willUpdate()),s}function gf(e){return mf({observeElementRect:cf,observeElementOffset:uf,scrollToFn:ff,...e})}function bf(e,n){return e!==null&&n!==null&&typeof e=="object"&&typeof n=="object"&&"id"in e&&"id"in n?e.id===n.id:e===n}function Vo(e=bf){return o.useCallback((n,t)=>{if(typeof e=="string"){let s=e;return n?.[s]===t?.[s]}return e(n,t)},[e])}function qr(e,n,t,s){let r=hs(t);o.useEffect(()=>{e=e??window;function a(i){r.current(i)}return e.addEventListener(n,a,s),()=>e.removeEventListener(n,a,s)},[e,n,s])}function Po(e){let n=o.useRef({value:"",selectionStart:null,selectionEnd:null});return qr(e,"blur",t=>{let s=t.target;Fa(s)&&(n.current={value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd})}),W(()=>{if(document.activeElement!==e&&Fa(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==n.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:t,selectionEnd:s}=n.current;t!==null&&s!==null&&e.setSelectionRange(t,s)}n.current={value:"",selectionStart:null,selectionEnd:null}}})}function mn(e,n){let t=o.useRef([]),s=W(e);o.useEffect(()=>{let r=[...t.current];for(let[a,i]of n.entries())if(t.current[a]!==i){let l=s(n,r);return t.current=n,l}},[s,...n])}function vf({children:e,freeze:n}){let t=ts(n,e);return U.createElement(U.Fragment,null,t)}function ts(e,n){let[t,s]=o.useState(n);return!e&&t!==n&&s(n),e?t:n}function yf(e){function n(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",n))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",n),n())}let Ge=[];yf(()=>{function e(n){if(!dn(n.target)||n.target===document.body||Ge[0]===n.target)return;let t=n.target;t=t.closest(xc),Ge.unshift(t??n.target),Ge=Ge.filter(s=>s!=null&&s.isConnected),Ge.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});var xf=Object.defineProperty,wf=(e,n,t)=>n in e?xf(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Qa=(e,n,t)=>(wf(e,typeof n!="symbol"?n+"":n,t),t),re=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(re||{}),Ve=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ve||{}),Ke=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(Ke||{}),jo=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.DefaultToFirstOption=6]="DefaultToFirstOption",e[e.SetActivationTrigger=7]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=8]="UpdateVirtualConfiguration",e[e.SetInputElement=9]="SetInputElement",e[e.SetButtonElement=10]="SetButtonElement",e[e.SetOptionsElement=11]="SetOptionsElement",e))(jo||{});function Zs(e,n=t=>t){let t=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=n(e.options.slice()),r=s.length>0&&s[0].dataRef.current.order!==null?s.sort((i,l)=>i.dataRef.current.order-l.dataRef.current.order):Ri(s,i=>i.dataRef.current.domRef.current),a=t?r.indexOf(t):null;return a===-1&&(a=null),{options:r,activeOptionIndex:a}}let Ef={1(e){var n;return(n=e.dataRef.current)!=null&&n.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!1}},0(e){var n,t;if((n=e.dataRef.current)!=null&&n.disabled||e.comboboxState===0)return e;if((t=e.dataRef.current)!=null&&t.value){let s=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(s!==-1)return{...e,activeOptionIndex:s,comboboxState:0,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,n){return e.isTyping===n.isTyping?e:{...e,isTyping:n.isTyping}},2(e,n){var t,s,r,a;if((t=e.dataRef.current)!=null&&t.disabled||e.optionsElement&&!((s=e.dataRef.current)!=null&&s.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:f,disabled:h}=e.virtual,g=n.focus===se.Specific?n.idx:Dt(n,{resolveItems:()=>f,resolveActiveIndex:()=>{var m,p;return(p=(m=e.activeOptionIndex)!=null?m:f.findIndex(b=>!h(b)))!=null?p:null},resolveDisabled:h,resolveId(){throw new Error("Function not implemented.")}}),u=(r=n.trigger)!=null?r:2;return e.activeOptionIndex===g&&e.activationTrigger===u?e:{...e,activeOptionIndex:g,activationTrigger:u,isTyping:!1,__demoMode:!1}}let i=Zs(e);if(i.activeOptionIndex===null){let f=i.options.findIndex(h=>!h.dataRef.current.disabled);f!==-1&&(i.activeOptionIndex=f)}let l=n.focus===se.Specific?n.idx:Dt(n,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled}),c=(a=n.trigger)!=null?a:2;return e.activeOptionIndex===l&&e.activationTrigger===c?e:{...e,...i,isTyping:!1,activeOptionIndex:l,activationTrigger:c,__demoMode:!1}},4:(e,n)=>{var t,s,r,a;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:[...e.options,n.payload]};let i=n.payload,l=Zs(e,f=>(f.push(i),f));e.activeOptionIndex===null&&(r=(s=e.dataRef.current).isSelected)!=null&&r.call(s,n.payload.dataRef.current.value)&&(l.activeOptionIndex=l.options.indexOf(i));let c={...e,...l,activationTrigger:2};return(a=e.dataRef.current)!=null&&a.__demoMode&&e.dataRef.current.value===void 0&&(c.activeOptionIndex=0),c},5:(e,n)=>{var t;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:e.options.filter(r=>r.id!==n.id)};let s=Zs(e,r=>{let a=r.findIndex(i=>i.id===n.id);return a!==-1&&r.splice(a,1),r});return{...e,...s,activationTrigger:2}},6:(e,n)=>e.defaultToFirstOption===n.value?e:{...e,defaultToFirstOption:n.value},7:(e,n)=>e.activationTrigger===n.trigger?e:{...e,activationTrigger:n.trigger},8:(e,n)=>{var t,s;if(e.virtual===null)return{...e,virtual:{options:n.options,disabled:(t=n.disabled)!=null?t:()=>!1}};if(e.virtual.options===n.options&&e.virtual.disabled===n.disabled)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let a=n.options.indexOf(e.virtual.options[e.activeOptionIndex]);a!==-1?r=a:r=null}return{...e,activeOptionIndex:r,virtual:{options:n.options,disabled:(s=n.disabled)!=null?s:()=>!1}}},9:(e,n)=>e.inputElement===n.element?e:{...e,inputElement:n.element},10:(e,n)=>e.buttonElement===n.element?e:{...e,buttonElement:n.element},11:(e,n)=>e.optionsElement===n.element?e:{...e,optionsElement:n.element}},Sf=class No extends Fi{constructor(n){super(n),Qa(this,"actions",{onChange:t=>{let{onChange:s,compare:r,mode:a,value:i}=this.state.dataRef.current;return ye(a,{0:()=>s?.(t),1:()=>{let l=i.slice(),c=l.findIndex(f=>r(f,t));return c===-1?l.push(t):l.splice(c,1),s?.(l)}})},registerOption:(t,s)=>(this.send({type:4,payload:{id:t,dataRef:s}}),()=>{this.state.activeOptionIndex===this.state.dataRef.current.calculateIndex(s.current.value)&&this.send({type:6,value:!0}),this.send({type:5,id:t})}),goToOption:(t,s)=>(this.send({type:6,value:!1}),this.send({type:2,...t,trigger:s})),setIsTyping:t=>{this.send({type:3,isTyping:t})},closeCombobox:()=>{var t,s;this.send({type:1}),this.send({type:6,value:!1}),(s=(t=this.state.dataRef.current).onClose)==null||s.call(t)},openCombobox:()=>{this.send({type:0}),this.send({type:6,value:!0})},setActivationTrigger:t=>{this.send({type:7,trigger:t})},selectActiveOption:()=>{let t=this.selectors.activeOptionIndex(this.state);if(t!==null){if(this.actions.setIsTyping(!1),this.state.virtual)this.actions.onChange(this.state.virtual.options[t]);else{let{dataRef:s}=this.state.options[t];this.actions.onChange(s.current.value)}this.actions.goToOption({focus:se.Specific,idx:t})}},setInputElement:t=>{this.send({type:9,element:t})},setButtonElement:t=>{this.send({type:10,element:t})},setOptionsElement:t=>{this.send({type:11,element:t})}}),Qa(this,"selectors",{activeDescendantId:t=>{var s,r;let a=this.selectors.activeOptionIndex(t);if(a!==null)return t.virtual?(r=t.options.find(i=>!i.dataRef.current.disabled&&t.dataRef.current.compare(i.dataRef.current.value,t.virtual.options[a])))==null?void 0:r.id:(s=t.options[a])==null?void 0:s.id},activeOptionIndex:t=>{if(t.defaultToFirstOption&&t.activeOptionIndex===null&&(t.virtual?t.virtual.options.length>0:t.options.length>0)){if(t.virtual){let{options:r,disabled:a}=t.virtual,i=r.findIndex(l=>{var c;return!((c=a?.(l))!=null&&c)});if(i!==-1)return i}let s=t.options.findIndex(r=>!r.dataRef.current.disabled);if(s!==-1)return s}return t.activeOptionIndex},activeOption:t=>{var s,r;let a=this.selectors.activeOptionIndex(t);return a===null?null:t.virtual?t.virtual.options[a??0]:(r=(s=t.options[a])==null?void 0:s.dataRef.current.value)!=null?r:null},isActive:(t,s,r)=>{var a;let i=this.selectors.activeOptionIndex(t);return i===null?!1:t.virtual?i===t.dataRef.current.calculateIndex(s):((a=t.options[i])==null?void 0:a.id)===r},shouldScrollIntoView:(t,s,r)=>!(t.virtual||t.__demoMode||t.comboboxState!==0||t.activationTrigger===0||!this.selectors.isActive(t,s,r))});{let t=this.state.id,s=xn.get(null);this.disposables.add(s.on(Oi.Push,r=>{!s.selectors.isTop(r,t)&&this.state.comboboxState===0&&this.actions.closeCombobox()})),this.on(0,()=>s.actions.push(t)),this.on(1,()=>s.actions.pop(t))}}static new({id:n,virtual:t=null,__demoMode:s=!1}){var r;return new No({id:n,dataRef:{current:{}},comboboxState:s?0:1,isTyping:!1,options:[],virtual:t?{options:t.options,disabled:(r=t.disabled)!=null?r:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:s})}reduce(n,t){return ye(t.type,Ef,n,t)}};const Do=o.createContext(null);function Sn(e){let n=o.useContext(Do);if(n===null){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Lo),t}return n}function Lo({id:e,virtual:n=null,__demoMode:t=!1}){let s=o.useMemo(()=>Sf.new({id:e,virtual:n,__demoMode:t}),[]);return Cr(()=>s.dispose()),s}let gn=o.createContext(null);gn.displayName="ComboboxDataContext";function Qt(e){let n=o.useContext(gn);if(n===null){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Qt),t}return n}let $o=o.createContext(null);function kf(e){let n=Sn("VirtualProvider"),t=Qt("VirtualProvider"),{options:s}=t.virtual,r=oe(n,m=>m.optionsElement),[a,i]=o.useMemo(()=>{let m=r;if(!m)return[0,0];let p=window.getComputedStyle(m);return[parseFloat(p.paddingBlockStart||p.paddingTop),parseFloat(p.paddingBlockEnd||p.paddingBottom)]},[r]),l=gf({enabled:s.length!==0,scrollPaddingStart:a,scrollPaddingEnd:i,count:s.length,estimateSize(){return 40},getScrollElement(){return n.state.optionsElement},overscan:12}),[c,f]=o.useState(0);Se(()=>{f(m=>m+1)},[s]);let h=l.getVirtualItems(),g=oe(n,m=>m.activationTrigger===Ke.Pointer),u=oe(n,n.selectors.activeOptionIndex);return h.length===0?null:U.createElement($o.Provider,{value:l},U.createElement("div",{style:{position:"relative",width:"100%",height:`${l.getTotalSize()}px`},ref:m=>{m&&(g||u!==null&&s.length>u&&l.scrollToIndex(u))}},h.map(m=>{var p;return U.createElement(o.Fragment,{key:m.key},U.cloneElement((p=e.children)==null?void 0:p.call(e,{...e.slot,option:s[m.index]}),{key:`${c}-${m.key}`,"data-index":m.index,"aria-setsize":s.length,"aria-posinset":m.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${m.start}px)`,overflowAnchor:"none"}}))})))}let Mf=o.Fragment;function Cf(e,n){let t=o.useId(),s=cs(),{value:r,defaultValue:a,onChange:i,form:l,name:c,by:f,invalid:h=!1,disabled:g=s||!1,onClose:u,__demoMode:m=!1,multiple:p=!1,immediate:b=!1,virtual:y=null,nullable:k,...S}=e,w=zr(a),[C=p?[]:void 0,P]=Ur(r,i,w),x=Lo({id:t,virtual:y,__demoMode:m}),O=o.useRef({static:!1,hold:!1}),M=Vo(f),D=W($=>y?f===null?y.options.indexOf($):y.options.findIndex(_=>M(_,$)):x.state.options.findIndex(_=>M(_.dataRef.current.value,$))),F=o.useCallback($=>ye(E.mode,{[Ve.Multi]:()=>C.some(_=>M(_,$)),[Ve.Single]:()=>M(C,$)}),[C]),I=oe(x,$=>$.virtual),T=W(()=>u?.()),E=o.useMemo(()=>({__demoMode:m,immediate:b,optionsPropsRef:O,value:C,defaultValue:w,disabled:g,invalid:h,mode:p?Ve.Multi:Ve.Single,virtual:y?I:null,onChange:P,isSelected:F,calculateIndex:D,compare:M,onClose:T}),[C,w,g,h,p,P,F,m,x,y,I,T]);Se(()=>{var $;y&&x.send({type:jo.UpdateVirtualConfiguration,options:y.options,disabled:($=y.disabled)!=null?$:null})},[y,y?.options,y?.disabled]),Se(()=>{x.state.dataRef.current=E},[E]);let[V,j,K,L]=oe(x,$=>[$.comboboxState,$.buttonElement,$.inputElement,$.optionsElement]),N=xn.get(null),Z=oe(N,o.useCallback($=>N.selectors.isTop($,t),[N,t]));Vr(Z,[j,K,L],()=>x.actions.closeCombobox());let q=oe(x,x.selectors.activeOptionIndex),Y=oe(x,x.selectors.activeOption),z=o.useMemo(()=>({open:V===re.Open,disabled:g,invalid:h,activeIndex:q,activeOption:Y,value:C}),[E,g,C,h,Y,V]),[H,B]=Li(),J=n===null?{}:{ref:n},A=o.useCallback(()=>{if(w!==void 0)return P?.(w)},[P,w]),R=pe();return U.createElement(B,{value:H,props:{htmlFor:K?.id},slot:{open:V===re.Open,disabled:g}},U.createElement($i,null,U.createElement(gn.Provider,{value:E},U.createElement(Do.Provider,{value:x},U.createElement(gs,{value:ye(V,{[re.Open]:be.Open,[re.Closed]:be.Closed})},c!=null&&U.createElement(Gr,{disabled:g,data:C!=null?{[c]:C}:{},form:l,onReset:A}),R({ourProps:J,theirProps:S,slot:z,defaultTag:Mf,name:"Combobox"}))))))}let Tf="input";function Ff(e,n){var t,s;let r=Sn("Combobox.Input"),a=Qt("Combobox.Input"),i=o.useId(),l=ls(),{id:c=l||`headlessui-combobox-input-${i}`,onChange:f,displayValue:h,disabled:g=a.disabled||!1,autoFocus:u=!1,type:m="text",...p}=e,[b]=oe(r,B=>[B.inputElement]),y=o.useRef(null),k=ke(y,n,Ii(),r.actions.setInputElement),S=ft(b),[w,C]=oe(r,B=>[B.comboboxState,B.isTyping]),P=qt(),x=W(()=>{r.actions.onChange(null),r.state.optionsElement&&(r.state.optionsElement.scrollTop=0),r.actions.goToOption({focus:se.Nothing})}),O=o.useMemo(()=>{var B;return typeof h=="function"&&a.value!==void 0?(B=h(a.value))!=null?B:"":typeof a.value=="string"?a.value:""},[a.value,h]);mn(([B,J],[A,R])=>{if(r.state.isTyping)return;let $=y.current;$&&((R===re.Open&&J===re.Closed||B!==A)&&($.value=B),requestAnimationFrame(()=>{if(r.state.isTyping||!$||S?.activeElement!==$)return;let{selectionStart:_,selectionEnd:G}=$;Math.abs((G??0)-(_??0))===0&&_===0&&$.setSelectionRange($.value.length,$.value.length)}))},[O,w,S,C]),mn(([B],[J])=>{if(B===re.Open&&J===re.Closed){if(r.state.isTyping)return;let A=y.current;if(!A)return;let R=A.value,{selectionStart:$,selectionEnd:_,selectionDirection:G}=A;A.value="",A.value=R,G!==null?A.setSelectionRange($,_,G):A.setSelectionRange($,_)}},[w]);let M=o.useRef(!1),D=W(()=>{M.current=!0}),F=W(()=>{P.nextFrame(()=>{M.current=!1})}),I=W(B=>{switch(r.actions.setIsTyping(!0),B.key){case ne.Enter:if(r.state.comboboxState!==re.Open||M.current)return;if(B.preventDefault(),B.stopPropagation(),r.selectors.activeOptionIndex(r.state)===null){r.actions.closeCombobox();return}r.actions.selectActiveOption(),a.mode===Ve.Single&&r.actions.closeCombobox();break;case ne.ArrowDown:return B.preventDefault(),B.stopPropagation(),ye(r.state.comboboxState,{[re.Open]:()=>r.actions.goToOption({focus:se.Next}),[re.Closed]:()=>r.actions.openCombobox()});case ne.ArrowUp:return B.preventDefault(),B.stopPropagation(),ye(r.state.comboboxState,{[re.Open]:()=>r.actions.goToOption({focus:se.Previous}),[re.Closed]:()=>{Te.flushSync(()=>r.actions.openCombobox()),a.value||r.actions.goToOption({focus:se.Last})}});case ne.Home:if(B.shiftKey)break;return B.preventDefault(),B.stopPropagation(),r.actions.goToOption({focus:se.First});case ne.PageUp:return B.preventDefault(),B.stopPropagation(),r.actions.goToOption({focus:se.First});case ne.End:if(B.shiftKey)break;return B.preventDefault(),B.stopPropagation(),r.actions.goToOption({focus:se.Last});case ne.PageDown:return B.preventDefault(),B.stopPropagation(),r.actions.goToOption({focus:se.Last});case ne.Escape:return r.state.comboboxState!==re.Open?void 0:(B.preventDefault(),r.state.optionsElement&&!a.optionsPropsRef.current.static&&B.stopPropagation(),a.mode===Ve.Single&&a.value===null&&x(),r.actions.closeCombobox());case ne.Tab:if(r.state.comboboxState!==re.Open)return;a.mode===Ve.Single&&r.state.activationTrigger!==Ke.Focus&&r.actions.selectActiveOption(),r.actions.closeCombobox();break}}),T=W(B=>{f?.(B),a.mode===Ve.Single&&B.target.value===""&&x(),r.actions.openCombobox()}),E=W(B=>{var J,A,R;let $=(J=B.relatedTarget)!=null?J:Ge.find(_=>_!==B.currentTarget);if(!((A=r.state.optionsElement)!=null&&A.contains($))&&!((R=r.state.buttonElement)!=null&&R.contains($))&&r.state.comboboxState===re.Open)return B.preventDefault(),a.mode===Ve.Single&&a.value===null&&x(),r.actions.closeCombobox()}),V=W(B=>{var J,A,R;let $=(J=B.relatedTarget)!=null?J:Ge.find(_=>_!==B.currentTarget);(A=r.state.buttonElement)!=null&&A.contains($)||(R=r.state.optionsElement)!=null&&R.contains($)||a.disabled||a.immediate&&r.state.comboboxState!==re.Open&&P.microTask(()=>{Te.flushSync(()=>r.actions.openCombobox()),r.actions.setActivationTrigger(Ke.Focus)})}),j=Kt(),K=us(),{isFocused:L,focusProps:N}=Wt({autoFocus:u}),{isHovered:Z,hoverProps:q}=Yt({isDisabled:g}),Y=oe(r,B=>B.optionsElement),z=o.useMemo(()=>({open:w===re.Open,disabled:g,invalid:a.invalid,hover:Z,focus:L,autofocus:u}),[a,Z,L,u,g,a.invalid]),H=rt({ref:k,id:c,role:"combobox",type:m,"aria-controls":Y?.id,"aria-expanded":w===re.Open,"aria-activedescendant":oe(r,r.selectors.activeDescendantId),"aria-labelledby":j,"aria-describedby":K,"aria-autocomplete":"list",defaultValue:(s=(t=e.defaultValue)!=null?t:a.defaultValue!==void 0?h?.(a.defaultValue):null)!=null?s:a.defaultValue,disabled:g||void 0,autoFocus:u,onCompositionStart:D,onCompositionEnd:F,onKeyDown:I,onChange:T,onFocus:V,onBlur:E},N,q);return pe()({ourProps:H,theirProps:p,slot:z,defaultTag:Tf,name:"Combobox.Input"})}let Of="button";function Rf(e,n){let t=Sn("Combobox.Button"),s=Qt("Combobox.Button"),[r,a]=o.useState(null),i=ke(n,a,t.actions.setButtonElement),l=o.useId(),{id:c=`headlessui-combobox-button-${l}`,disabled:f=s.disabled||!1,autoFocus:h=!1,...g}=e,[u,m,p]=oe(t,T=>[T.comboboxState,T.inputElement,T.optionsElement]),b=Po(m),y=u===re.Open;Ai(y,{trigger:r,action:o.useCallback(T=>{if(r!=null&&r.contains(T.target))return Xe.Ignore;if(m!=null&&m.contains(T.target))return Xe.Ignore;let E=T.target.closest('[role="option"]:not([data-disabled])');return Zt(E)?Xe.Select(E):p!=null&&p.contains(T.target)?Xe.Ignore:Xe.Close},[r,m,p]),close:t.actions.closeCombobox,select:t.actions.selectActiveOption});let k=W(T=>{switch(T.key){case ne.Space:case ne.Enter:T.preventDefault(),T.stopPropagation(),t.state.comboboxState===re.Closed&&Te.flushSync(()=>t.actions.openCombobox()),b();return;case ne.ArrowDown:T.preventDefault(),T.stopPropagation(),t.state.comboboxState===re.Closed&&(Te.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:se.First})),b();return;case ne.ArrowUp:T.preventDefault(),T.stopPropagation(),t.state.comboboxState===re.Closed&&(Te.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:se.Last})),b();return;case ne.Escape:if(t.state.comboboxState!==re.Open)return;T.preventDefault(),t.state.optionsElement&&!s.optionsPropsRef.current.static&&T.stopPropagation(),Te.flushSync(()=>t.actions.closeCombobox()),b();return;default:return}}),S=W(T=>{T.preventDefault(),!ds(T.currentTarget)&&(T.button===Tr.Left&&(t.state.comboboxState===re.Open?t.actions.closeCombobox():t.actions.openCombobox()),b())}),w=Kt([c]),{isFocusVisible:C,focusProps:P}=Wt({autoFocus:h}),{isHovered:x,hoverProps:O}=Yt({isDisabled:f}),{pressed:M,pressProps:D}=fs({disabled:f}),F=o.useMemo(()=>({open:u===re.Open,active:M||u===re.Open,disabled:f,invalid:s.invalid,value:s.value,hover:x,focus:C}),[s,x,C,M,f,u]),I=rt({ref:i,id:c,type:Fr(e,r),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":p?.id,"aria-expanded":u===re.Open,"aria-labelledby":w,disabled:f||void 0,autoFocus:h,onPointerDown:S,onKeyDown:k},P,O,D);return pe()({ourProps:I,theirProps:g,slot:F,defaultTag:Of,name:"Combobox.Button"})}let If="div",Af=at.RenderStrategy|at.Static;function Vf(e,n){var t,s,r;let a=o.useId(),{id:i=`headlessui-combobox-options-${a}`,hold:l=!1,anchor:c,portal:f=!1,modal:h=!0,transition:g=!1,...u}=e,m=Sn("Combobox.Options"),p=Qt("Combobox.Options"),b=Vi(c);b&&(f=!0);let[y,k]=Pi(b),[S,w]=o.useState(null),C=ji(),P=ke(n,b?y:null,m.actions.setOptionsElement,w),[x,O,M,D,F]=oe(m,G=>[G.comboboxState,G.inputElement,G.buttonElement,G.optionsElement,G.activationTrigger]),I=ft(O||M),T=ft(D),E=Tt(),[V,j]=ps(g,S,E!==null?(E&be.Open)===be.Open:x===re.Open);Or(V,O,m.actions.closeCombobox);let K=p.__demoMode?!1:h&&x===re.Open;Rr(K,T);let L=p.__demoMode?!1:h&&x===re.Open;Ir(L,{allowed:o.useCallback(()=>[O,M,D],[O,M,D])}),Se(()=>{var G;p.optionsPropsRef.current.static=(G=e.static)!=null?G:!1},[p.optionsPropsRef,e.static]),Se(()=>{p.optionsPropsRef.current.hold=l},[p.optionsPropsRef,l]),wc(x===re.Open,{container:D,accept(G){return G.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:G.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(G){G.setAttribute("role","none")}});let N=Kt([M?.id]),Z=o.useMemo(()=>({open:x===re.Open,option:void 0}),[x]),q=W(()=>{m.actions.setActivationTrigger(Ke.Pointer)}),Y=W(G=>{G.preventDefault(),m.actions.setActivationTrigger(Ke.Pointer)}),z=rt(b?C():{},{"aria-labelledby":N,role:"listbox","aria-multiselectable":p.mode===Ve.Multi?!0:void 0,id:i,ref:P,style:{...u.style,...k,"--input-width":Qs(O,!0).width,"--button-width":Qs(M,!0).width},onWheel:F===Ke.Pointer?void 0:q,onMouseDown:Y,...ms(j)}),H=V&&x===re.Closed,B=ts(H,(t=p.virtual)==null?void 0:t.options),J=ts(H,p.value),A=W(G=>p.compare(J,G)),R=o.useMemo(()=>{if(!p.virtual)return p;if(B===void 0)throw new Error("Missing `options` in virtual mode");return B!==p.virtual.options?{...p,virtual:{...p.virtual,options:B}}:p},[p,B,(s=p.virtual)==null?void 0:s.options]);p.virtual&&Object.assign(u,{children:U.createElement(gn.Provider,{value:R},U.createElement(kf,{slot:Z},u.children))});let $=pe(),_=o.useMemo(()=>p.mode===Ve.Multi?p:{...p,isSelected:A},[p,A]);return U.createElement(Ar,{enabled:f?e.static||V:!1,ownerDocument:I},U.createElement(gn.Provider,{value:_},$({ourProps:z,theirProps:{...u,children:U.createElement(vf,{freeze:H},typeof u.children=="function"?(r=u.children)==null?void 0:r.call(u,Z):u.children)},slot:Z,defaultTag:If,features:Af,visible:V,name:"Combobox.Options"})))}let Pf="div";function jf(e,n){var t,s,r;let a=Qt("Combobox.Option"),i=Sn("Combobox.Option"),l=o.useId(),{id:c=`headlessui-combobox-option-${l}`,value:f,disabled:h=(r=(s=(t=a.virtual)==null?void 0:t.disabled)==null?void 0:s.call(t,f))!=null?r:!1,order:g=null,...u}=e,[m]=oe(i,j=>[j.inputElement]),p=Po(m),b=oe(i,o.useCallback(j=>i.selectors.isActive(j,f,c),[f,c])),y=a.isSelected(f),k=o.useRef(null),S=hs({disabled:h,value:f,domRef:k,order:g}),w=o.useContext($o),C=ke(n,k,w?w.measureElement:null),P=W(()=>{i.actions.setIsTyping(!1),i.actions.onChange(f)});Se(()=>i.actions.registerOption(c,S),[S,c]);let x=oe(i,o.useCallback(j=>i.selectors.shouldScrollIntoView(j,f,c),[f,c]));Se(()=>{if(x)return Ni().requestAnimationFrame(()=>{var j,K;(K=(j=k.current)==null?void 0:j.scrollIntoView)==null||K.call(j,{block:"nearest"})})},[x,k]);let O=W(j=>{j.preventDefault(),j.button===Tr.Left&&(h||(P(),Ec()||requestAnimationFrame(()=>p()),a.mode===Ve.Single&&i.actions.closeCombobox()))}),M=W(()=>{if(h)return i.actions.goToOption({focus:se.Nothing});let j=a.calculateIndex(f);i.actions.goToOption({focus:se.Specific,idx:j})}),D=Di(),F=W(j=>D.update(j)),I=W(j=>{if(!D.wasMoved(j)||h||b&&i.state.activationTrigger===Ke.Pointer)return;let K=a.calculateIndex(f);i.actions.goToOption({focus:se.Specific,idx:K},Ke.Pointer)}),T=W(j=>{D.wasMoved(j)&&(h||b&&(a.optionsPropsRef.current.hold||i.state.activationTrigger===Ke.Pointer&&i.actions.goToOption({focus:se.Nothing})))}),E=o.useMemo(()=>({active:b,focus:b,selected:y,disabled:h}),[b,y,h]),V={id:c,ref:C,role:"option",tabIndex:h===!0?void 0:-1,"aria-disabled":h===!0?!0:void 0,"aria-selected":y,disabled:void 0,onMouseDown:O,onFocus:M,onPointerEnter:F,onMouseEnter:F,onPointerMove:I,onMouseMove:I,onPointerLeave:T,onMouseLeave:T};return pe()({ourProps:V,theirProps:u,slot:E,defaultTag:Pf,name:"Combobox.Option"})}let Nf=ce(Cf),Kr=ce(Rf),Wr=ce(Ff),Df=wn,Yr=ce(Vf),bn=ce(jf),Ho=Object.assign(Nf,{Input:Wr,Button:Kr,Label:Df,Options:Yr,Option:bn});function Lf(e,n=typeof document<"u"?document.defaultView:null,t){let s=Pr(e,"escape");qr(n,"keydown",r=>{s&&(r.defaultPrevented||r.key===ne.Escape&&t(r))})}function $f(){var e;let[n]=o.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[t,s]=o.useState((e=n?.matches)!=null?e:!1);return Se(()=>{if(!n)return;function r(a){s(a.matches)}return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[n]),t}function Hf({defaultContainers:e=[],portals:n,mainTreeNode:t}={}){let s=ft(t),r=W(()=>{var a,i;let l=[];for(let c of e)c!==null&&(on(c)?l.push(c):"current"in c&&on(c.current)&&l.push(c.current));if(n!=null&&n.current)for(let c of n.current)l.push(c);for(let c of(a=s?.querySelectorAll("html > *, body > *"))!=null?a:[])c!==document.body&&c!==document.head&&on(c)&&c.id!=="headlessui-portal-root"&&(t&&(c.contains(t)||c.contains((i=t?.getRootNode())==null?void 0:i.host))||l.some(f=>c.contains(f))||l.push(c));return l});return{resolveContainers:r,contains:W(a=>r().some(i=>i.contains(a)))}}let _o=o.createContext(null);function Xa({children:e,node:n}){let[t,s]=o.useState(null),r=Bo(n??t);return U.createElement(_o.Provider,{value:r},e,r===null&&U.createElement(pn,{features:Gt.Hidden,ref:a=>{var i,l;if(a){for(let c of(l=(i=jr(a))==null?void 0:i.querySelectorAll("html > *, body > *"))!=null?l:[])if(c!==document.body&&c!==document.head&&on(c)&&c!=null&&c.contains(a)){s(c);break}}}}))}function Bo(e=null){var n;return(n=o.useContext(_o))!=null?n:e}function Qr(){let e=o.useRef(!1);return Se(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var sn=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(sn||{});function _f(){let e=o.useRef(0);return Sc(!0,"keydown",n=>{n.key==="Tab"&&(e.current=n.shiftKey?1:0)},!0),e}function Zo(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let n=new Set;for(let t of e.current)on(t.current)&&n.add(t.current);return n}let Bf="div";var vt=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(vt||{});function Zf(e,n){let t=o.useRef(null),s=ke(t,n),{initialFocus:r,initialFocusFallback:a,containers:i,features:l=15,...c}=e;bs()||(l=0);let f=ft(t);qf(l,{ownerDocument:f});let h=Kf(l,{ownerDocument:f,container:t,initialFocus:r,initialFocusFallback:a});Wf(l,{ownerDocument:f,container:t,containers:i,previousActiveElement:h});let g=_f(),u=W(S=>{if(!Zt(t.current))return;let w=t.current;(C=>C())(()=>{ye(g.current,{[sn.Forwards]:()=>{ln(w,ze.First,{skipElements:[S.relatedTarget,a]})},[sn.Backwards]:()=>{ln(w,ze.Last,{skipElements:[S.relatedTarget,a]})}})})}),m=Pr(!!(l&2),"focus-trap#tab-lock"),p=qt(),b=o.useRef(!1),y={ref:s,onKeyDown(S){S.key=="Tab"&&(b.current=!0,p.requestAnimationFrame(()=>{b.current=!1}))},onBlur(S){if(!(l&4))return;let w=Zo(i);Zt(t.current)&&w.add(t.current);let C=S.relatedTarget;dn(C)&&C.dataset.headlessuiFocusGuard!=="true"&&(Uo(w,C)||(b.current?ln(t.current,ye(g.current,{[sn.Forwards]:()=>ze.Next,[sn.Backwards]:()=>ze.Previous})|ze.WrapAround,{relativeTo:S.target}):dn(S.target)&&tt(S.target)))}},k=pe();return U.createElement(U.Fragment,null,m&&U.createElement(pn,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:u,features:Gt.Focusable}),k({ourProps:y,theirProps:c,defaultTag:Bf,name:"FocusTrap"}),m&&U.createElement(pn,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:u,features:Gt.Focusable}))}let Uf=ce(Zf),zf=Object.assign(Uf,{features:vt});function Gf(e=!0){let n=o.useRef(Ge.slice());return mn(([t],[s])=>{s===!0&&t===!1&&Hi(()=>{n.current.splice(0)}),s===!1&&t===!0&&(n.current=Ge.slice())},[e,Ge,n]),W(()=>{var t;return(t=n.current.find(s=>s!=null&&s.isConnected))!=null?t:null})}function qf(e,{ownerDocument:n}){let t=!!(e&8),s=Gf(t);mn(()=>{t||n?.activeElement===n?.body&&tt(s())},[t]),Cr(()=>{t&&tt(s())})}function Kf(e,{ownerDocument:n,container:t,initialFocus:s,initialFocusFallback:r}){let a=o.useRef(null),i=Pr(!!(e&1),"focus-trap#initial-focus"),l=Qr();return mn(()=>{if(e===0)return;if(!i){r!=null&&r.current&&tt(r.current);return}let c=t.current;c&&Hi(()=>{if(!l.current)return;let f=n?.activeElement;if(s!=null&&s.current){if(s?.current===f){a.current=f;return}}else if(c.contains(f)){a.current=f;return}if(s!=null&&s.current)tt(s.current);else{if(e&16){if(ln(c,ze.First|ze.AutoFocus)!==Oa.Error)return}else if(ln(c,ze.First)!==Oa.Error)return;if(r!=null&&r.current&&(tt(r.current),n?.activeElement===r.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}a.current=n?.activeElement})},[r,i,e]),a}function Wf(e,{ownerDocument:n,container:t,containers:s,previousActiveElement:r}){let a=Qr(),i=!!(e&4);qr(n?.defaultView,"focus",l=>{if(!i||!a.current)return;let c=Zo(s);Zt(t.current)&&c.add(t.current);let f=r.current;if(!f)return;let h=l.target;Zt(h)?Uo(c,h)?(r.current=h,tt(h)):(l.preventDefault(),l.stopPropagation(),tt(f)):tt(r.current)},!0)}function Uo(e,n){for(let t of e)if(t.contains(n))return!0;return!1}function zo(e){var n;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((n=e.as)!=null?n:qo)!==o.Fragment||U.Children.count(e.children)===1}let ws=o.createContext(null);ws.displayName="TransitionContext";var Yf=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Yf||{});function Qf(){let e=o.useContext(ws);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Xf(){let e=o.useContext(Es);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Es=o.createContext(null);Es.displayName="NestingContext";function Ss(e){return"children"in e?Ss(e.children):e.current.filter(({el:n})=>n.current!==null).filter(({state:n})=>n==="visible").length>0}function Go(e,n){let t=hs(e),s=o.useRef([]),r=Qr(),a=qt(),i=W((m,p=Et.Hidden)=>{let b=s.current.findIndex(({el:y})=>y===m);b!==-1&&(ye(p,{[Et.Unmount](){s.current.splice(b,1)},[Et.Hidden](){s.current[b].state="hidden"}}),a.microTask(()=>{var y;!Ss(s)&&r.current&&((y=t.current)==null||y.call(t))}))}),l=W(m=>{let p=s.current.find(({el:b})=>b===m);return p?p.state!=="visible"&&(p.state="visible"):s.current.push({el:m,state:"visible"}),()=>i(m,Et.Unmount)}),c=o.useRef([]),f=o.useRef(Promise.resolve()),h=o.useRef({enter:[],leave:[]}),g=W((m,p,b)=>{c.current.splice(0),n&&(n.chains.current[p]=n.chains.current[p].filter(([y])=>y!==m)),n?.chains.current[p].push([m,new Promise(y=>{c.current.push(y)})]),n?.chains.current[p].push([m,new Promise(y=>{Promise.all(h.current[p].map(([k,S])=>S)).then(()=>y())})]),p==="enter"?f.current=f.current.then(()=>n?.wait.current).then(()=>b(p)):b(p)}),u=W((m,p,b)=>{Promise.all(h.current[p].splice(0).map(([y,k])=>k)).then(()=>{var y;(y=c.current.shift())==null||y()}).then(()=>b(p))});return o.useMemo(()=>({children:s,register:l,unregister:i,onStart:g,onStop:u,wait:f,chains:h}),[l,i,s,g,u,h,f])}let qo=o.Fragment,Ko=at.RenderStrategy;function Jf(e,n){var t,s;let{transition:r=!0,beforeEnter:a,afterEnter:i,beforeLeave:l,afterLeave:c,enter:f,enterFrom:h,enterTo:g,entered:u,leave:m,leaveFrom:p,leaveTo:b,...y}=e,[k,S]=o.useState(null),w=o.useRef(null),C=zo(e),P=ke(...C?[w,n,S]:n===null?[]:[n]),x=(t=y.unmount)==null||t?Et.Unmount:Et.Hidden,{show:O,appear:M,initial:D}=Qf(),[F,I]=o.useState(O?"visible":"hidden"),T=Xf(),{register:E,unregister:V}=T;Se(()=>E(w),[E,w]),Se(()=>{if(x===Et.Hidden&&w.current){if(O&&F!=="visible"){I("visible");return}return ye(F,{hidden:()=>V(w),visible:()=>E(w)})}},[F,w,E,V,O,x]);let j=bs();Se(()=>{if(C&&j&&F==="visible"&&w.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[w,F,j,C]);let K=D&&!M,L=M&&O&&D,N=o.useRef(!1),Z=Go(()=>{N.current||(I("hidden"),V(w))},T),q=W(R=>{N.current=!0;let $=R?"enter":"leave";Z.onStart(w,$,_=>{_==="enter"?a?.():_==="leave"&&l?.()})}),Y=W(R=>{let $=R?"enter":"leave";N.current=!1,Z.onStop(w,$,_=>{_==="enter"?i?.():_==="leave"&&c?.()}),$==="leave"&&!Ss(Z)&&(I("hidden"),V(w))});o.useEffect(()=>{C&&r||(q(O),Y(O))},[O,C,r]);let z=!(!r||!C||!j||K),[,H]=ps(z,k,O,{start:q,end:Y}),B=Ti({ref:P,className:((s=kc(y.className,L&&f,L&&h,H.enter&&f,H.enter&&H.closed&&h,H.enter&&!H.closed&&g,H.leave&&m,H.leave&&!H.closed&&p,H.leave&&H.closed&&b,!H.transition&&O&&u))==null?void 0:s.trim())||void 0,...ms(H)}),J=0;F==="visible"&&(J|=be.Open),F==="hidden"&&(J|=be.Closed),O&&F==="hidden"&&(J|=be.Opening),!O&&F==="visible"&&(J|=be.Closing);let A=pe();return U.createElement(Es.Provider,{value:Z},U.createElement(gs,{value:J},A({ourProps:B,theirProps:y,defaultTag:qo,features:Ko,visible:F==="visible",name:"Transition.Child"})))}function e0(e,n){let{show:t,appear:s=!1,unmount:r=!0,...a}=e,i=o.useRef(null),l=zo(e),c=ke(...l?[i,n]:n===null?[]:[n]);bs();let f=Tt();if(t===void 0&&f!==null&&(t=(f&be.Open)===be.Open),t===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[h,g]=o.useState(t?"visible":"hidden"),u=Go(()=>{t||g("hidden")}),[m,p]=o.useState(!0),b=o.useRef([t]);Se(()=>{m!==!1&&b.current[b.current.length-1]!==t&&(b.current.push(t),p(!1))},[b,t]);let y=o.useMemo(()=>({show:t,appear:s,initial:m}),[t,s,m]);Se(()=>{t?g("visible"):!Ss(u)&&i.current!==null&&g("hidden")},[t,u]);let k={unmount:r},S=W(()=>{var P;m&&p(!1),(P=e.beforeEnter)==null||P.call(e)}),w=W(()=>{var P;m&&p(!1),(P=e.beforeLeave)==null||P.call(e)}),C=pe();return U.createElement(Es.Provider,{value:u},U.createElement(ws.Provider,{value:y},C({ourProps:{...k,as:o.Fragment,children:U.createElement(Wo,{ref:c,...k,...a,beforeEnter:S,beforeLeave:w})},theirProps:{},defaultTag:o.Fragment,features:Ko,visible:h==="visible",name:"Transition"})))}function t0(e,n){let t=o.useContext(ws)!==null,s=Tt()!==null;return U.createElement(U.Fragment,null,!t&&s?U.createElement(cr,{ref:n,...e}):U.createElement(Wo,{ref:n,...e}))}let cr=ce(e0),Wo=ce(Jf),Xr=ce(t0),n0=Object.assign(cr,{Child:Xr,Root:cr});var s0=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(s0||{}),r0=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(r0||{});let a0={0(e,n){return e.titleId===n.id?e:{...e,titleId:n.id}}},Jr=o.createContext(null);Jr.displayName="DialogContext";function ks(e){let n=o.useContext(Jr);if(n===null){let t=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ks),t}return n}function i0(e,n){return ye(n.type,a0,e,n)}let Ja=ce(function(e,n){let t=o.useId(),{id:s=`headlessui-dialog-${t}`,open:r,onClose:a,initialFocus:i,role:l="dialog",autoFocus:c=!0,__demoMode:f=!1,unmount:h=!1,...g}=e,u=o.useRef(!1);l=(function(){return l==="dialog"||l==="alertdialog"?l:(u.current||(u.current=!0,console.warn(`Invalid role [${l}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let m=Tt();r===void 0&&m!==null&&(r=(m&be.Open)===be.Open);let p=o.useRef(null),b=ke(p,n),y=ft(p),k=r?0:1,[S,w]=o.useReducer(i0,{titleId:null,descriptionId:null,panelRef:o.createRef()}),C=W(()=>a(!1)),P=W(H=>w({type:0,id:H})),x=bs()?k===0:!1,[O,M]=Cc(),D={get current(){var H;return(H=S.panelRef.current)!=null?H:p.current}},F=Bo(),{resolveContainers:I}=Hf({mainTreeNode:F,portals:O,defaultContainers:[D]}),T=m!==null?(m&be.Closing)===be.Closing:!1;Ir(f||T?!1:x,{allowed:W(()=>{var H,B;return[(B=(H=p.current)==null?void 0:H.closest("[data-headlessui-portal]"))!=null?B:null]}),disallowed:W(()=>{var H;return[(H=F?.closest("body > *:not(#headlessui-portal-root)"))!=null?H:null]})});let E=xn.get(null);Se(()=>{if(x)return E.actions.push(s),()=>E.actions.pop(s)},[E,s,x]);let V=oe(E,o.useCallback(H=>E.selectors.isTop(H,s),[E,s]));Vr(V,I,H=>{H.preventDefault(),C()}),Lf(V,y?.defaultView,H=>{H.preventDefault(),H.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),C()}),Rr(f||T?!1:x,y,I),Or(x,p,C);let[j,K]=Tc(),L=o.useMemo(()=>[{dialogState:k,close:C,setTitleId:P,unmount:h},S],[k,S,C,P,h]),N=o.useMemo(()=>({open:k===0}),[k]),Z={ref:b,id:s,role:l,tabIndex:-1,"aria-modal":f?void 0:k===0?!0:void 0,"aria-labelledby":S.titleId,"aria-describedby":j,unmount:h},q=!$f(),Y=vt.None;x&&!f&&(Y|=vt.RestoreFocus,Y|=vt.TabLock,c&&(Y|=vt.AutoFocus),q&&(Y|=vt.InitialFocus));let z=pe();return U.createElement(_i,null,U.createElement(Ra,{force:!0},U.createElement(Ar,null,U.createElement(Jr.Provider,{value:L},U.createElement(Fc,{target:p},U.createElement(Ra,{force:!1},U.createElement(K,{slot:N},U.createElement(M,null,U.createElement(zf,{initialFocus:i,initialFocusFallback:p,containers:I,features:Y},U.createElement(Io,{value:C},z({ourProps:Z,theirProps:g,slot:N,defaultTag:o0,features:l0,visible:k===0,name:"Dialog"})))))))))))}),o0="div",l0=at.RenderStrategy|at.Static;function c0(e,n){let{transition:t=!1,open:s,...r}=e,a=Tt(),i=e.hasOwnProperty("open")||a!==null,l=e.hasOwnProperty("onClose");if(!i&&!l)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!i)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!l)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!a&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(s!==void 0||t)&&!r.static?U.createElement(Xa,null,U.createElement(n0,{show:s,transition:t,unmount:r.unmount},U.createElement(Ja,{ref:n,...r}))):U.createElement(Xa,null,U.createElement(Ja,{ref:n,open:s,...r}))}let u0="div";function d0(e,n){let t=o.useId(),{id:s=`headlessui-dialog-panel-${t}`,transition:r=!1,...a}=e,[{dialogState:i,unmount:l},c]=ks("Dialog.Panel"),f=ke(n,c.panelRef),h=o.useMemo(()=>({open:i===0}),[i]),g=W(y=>{y.stopPropagation()}),u={ref:f,id:s,onClick:g},m=r?Xr:o.Fragment,p=r?{unmount:l}:{},b=pe();return U.createElement(m,{...p},b({ourProps:u,theirProps:a,slot:h,defaultTag:u0,name:"Dialog.Panel"}))}let f0="div";function h0(e,n){let{transition:t=!1,...s}=e,[{dialogState:r,unmount:a}]=ks("Dialog.Backdrop"),i=o.useMemo(()=>({open:r===0}),[r]),l={ref:n,"aria-hidden":!0},c=t?Xr:o.Fragment,f=t?{unmount:a}:{},h=pe();return U.createElement(c,{...f},h({ourProps:l,theirProps:s,slot:i,defaultTag:f0,name:"Dialog.Backdrop"}))}let p0="h2";function m0(e,n){let t=o.useId(),{id:s=`headlessui-dialog-title-${t}`,...r}=e,[{dialogState:a,setTitleId:i}]=ks("Dialog.Title"),l=ke(n);o.useEffect(()=>(i(s),()=>i(null)),[s,i]);let c=o.useMemo(()=>({open:a===0}),[a]),f={ref:l,id:s};return pe()({ourProps:f,theirProps:r,slot:c,defaultTag:p0,name:"Dialog.Title"})}let g0=ce(c0),Yo=ce(d0),b0=ce(h0),Qo=ce(m0),v0=Object.assign(g0,{Panel:Yo,Title:Qo,Description:Mc});var ei;let y0=(ei=U.startTransition)!=null?ei:function(e){e()};var x0=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(x0||{}),w0=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.SetButtonElement=4]="SetButtonElement",e[e.SetPanelElement=5]="SetPanelElement",e))(w0||{});let E0={0:e=>({...e,disclosureState:ye(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},2(e,n){return e.buttonId===n.buttonId?e:{...e,buttonId:n.buttonId}},3(e,n){return e.panelId===n.panelId?e:{...e,panelId:n.panelId}},4(e,n){return e.buttonElement===n.element?e:{...e,buttonElement:n.element}},5(e,n){return e.panelElement===n.element?e:{...e,panelElement:n.element}}},ea=o.createContext(null);ea.displayName="DisclosureContext";function ta(e){let n=o.useContext(ea);if(n===null){let t=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ta),t}return n}let na=o.createContext(null);na.displayName="DisclosureAPIContext";function Xo(e){let n=o.useContext(na);if(n===null){let t=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Xo),t}return n}let sa=o.createContext(null);sa.displayName="DisclosurePanelContext";function S0(){return o.useContext(sa)}function k0(e,n){return ye(n.type,E0,e,n)}let M0=o.Fragment;function C0(e,n){let{defaultOpen:t=!1,...s}=e,r=o.useRef(null),a=ke(n,Oc(b=>{r.current=b},e.as===void 0||e.as===o.Fragment)),i=o.useReducer(k0,{disclosureState:t?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:l,buttonId:c},f]=i,h=W(b=>{f({type:1});let y=jr(r);if(!y||!c)return;let k=b?dn(b)?b:"current"in b&&dn(b.current)?b.current:y.getElementById(c):y.getElementById(c);k?.focus()}),g=o.useMemo(()=>({close:h}),[h]),u=o.useMemo(()=>({open:l===0,close:h}),[l,h]),m={ref:a},p=pe();return U.createElement(ea.Provider,{value:i},U.createElement(na.Provider,{value:g},U.createElement(Io,{value:h},U.createElement(gs,{value:ye(l,{0:be.Open,1:be.Closed})},p({ourProps:m,theirProps:s,slot:u,defaultTag:M0,name:"Disclosure"})))))}let T0="button";function F0(e,n){let t=o.useId(),{id:s=`headlessui-disclosure-button-${t}`,disabled:r=!1,autoFocus:a=!1,...i}=e,[l,c]=ta("Disclosure.Button"),f=S0(),h=f===null?!1:f===l.panelId,g=o.useRef(null),u=ke(g,n,W(D=>{if(!h)return c({type:4,element:D})}));o.useEffect(()=>{if(!h)return c({type:2,buttonId:s}),()=>{c({type:2,buttonId:null})}},[s,c,h]);let m=W(D=>{var F;if(h){if(l.disclosureState===1)return;switch(D.key){case ne.Space:case ne.Enter:D.preventDefault(),D.stopPropagation(),c({type:0}),(F=l.buttonElement)==null||F.focus();break}}else switch(D.key){case ne.Space:case ne.Enter:D.preventDefault(),D.stopPropagation(),c({type:0});break}}),p=W(D=>{switch(D.key){case ne.Space:D.preventDefault();break}}),b=W(D=>{var F;ds(D.currentTarget)||r||(h?(c({type:0}),(F=l.buttonElement)==null||F.focus()):c({type:0}))}),{isFocusVisible:y,focusProps:k}=Wt({autoFocus:a}),{isHovered:S,hoverProps:w}=Yt({isDisabled:r}),{pressed:C,pressProps:P}=fs({disabled:r}),x=o.useMemo(()=>({open:l.disclosureState===0,hover:S,active:C,disabled:r,focus:y,autofocus:a}),[l,S,C,y,r,a]),O=Fr(e,l.buttonElement),M=h?rt({ref:u,type:O,disabled:r||void 0,autoFocus:a,onKeyDown:m,onClick:b},k,w,P):rt({ref:u,id:s,type:O,"aria-expanded":l.disclosureState===0,"aria-controls":l.panelElement?l.panelId:void 0,disabled:r||void 0,autoFocus:a,onKeyDown:m,onKeyUp:p,onClick:b},k,w,P);return pe()({ourProps:M,theirProps:i,slot:x,defaultTag:T0,name:"Disclosure.Button"})}let O0="div",R0=at.RenderStrategy|at.Static;function I0(e,n){let t=o.useId(),{id:s=`headlessui-disclosure-panel-${t}`,transition:r=!1,...a}=e,[i,l]=ta("Disclosure.Panel"),{close:c}=Xo("Disclosure.Panel"),[f,h]=o.useState(null),g=ke(n,W(S=>{y0(()=>l({type:5,element:S}))}),h);o.useEffect(()=>(l({type:3,panelId:s}),()=>{l({type:3,panelId:null})}),[s,l]);let u=Tt(),[m,p]=ps(r,f,u!==null?(u&be.Open)===be.Open:i.disclosureState===0),b=o.useMemo(()=>({open:i.disclosureState===0,close:c}),[i.disclosureState,c]),y={ref:g,id:s,...ms(p)},k=pe();return U.createElement(_i,null,U.createElement(sa.Provider,{value:i.panelId},k({ourProps:y,theirProps:a,slot:b,defaultTag:O0,features:R0,visible:m,name:"Disclosure.Panel"})))}let A0=ce(C0),Jo=ce(F0),el=ce(I0),V0=Object.assign(A0,{Button:Jo,Panel:el}),P0="input";function j0(e,n){let t=o.useId(),s=ls(),r=cs(),{id:a=s||`headlessui-input-${t}`,disabled:i=r||!1,autoFocus:l=!1,invalid:c=!1,...f}=e,h=Kt(),g=us(),{isFocused:u,focusProps:m}=Wt({autoFocus:l}),{isHovered:p,hoverProps:b}=Yt({isDisabled:i}),y=rt({ref:n,id:a,"aria-labelledby":h,"aria-describedby":g,"aria-invalid":c?"true":void 0,disabled:i||void 0,autoFocus:l},m,b),k=o.useMemo(()=>({disabled:i,invalid:c,hover:p,focus:u,autofocus:l}),[i,c,p,u,l]);return pe()({ourProps:y,theirProps:f,slot:k,defaultTag:P0,name:"Input"})}let N0=ce(j0);var D0=Object.defineProperty,L0=(e,n,t)=>n in e?D0(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,ti=(e,n,t)=>(L0(e,typeof n!="symbol"?n+"":n,t),t),Ee=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ee||{}),qe=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(qe||{}),Bn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Bn||{}),tl=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(tl||{});function ni(e,n=t=>t){let t=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=Ri(n(e.options.slice()),a=>a.dataRef.current.domRef.current),r=t?s.indexOf(t):null;return r===-1&&(r=null),{options:s,activeOptionIndex:r}}let $0={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:se.Nothing},listboxState:1,__demoMode:!1}},0(e,n){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:s}=e.dataRef.current,r=e.options.findIndex(a=>s(a.dataRef.current.value));return r!==-1&&(t=r),{...e,pendingFocus:n.focus,listboxState:0,activeOptionIndex:t,__demoMode:!1}},2(e,n){var t,s,r,a,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let l={...e,searchQuery:"",activationTrigger:(t=n.trigger)!=null?t:1,__demoMode:!1};if(n.focus===se.Nothing)return{...l,activeOptionIndex:null};if(n.focus===se.Specific)return{...l,activeOptionIndex:e.options.findIndex(h=>h.id===n.id)};if(n.focus===se.Previous){let h=e.activeOptionIndex;if(h!==null){let g=e.options[h].dataRef.current.domRef,u=Dt(n,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:m=>m.id,resolveDisabled:m=>m.dataRef.current.disabled});if(u!==null){let m=e.options[u].dataRef.current.domRef;if(((s=g.current)==null?void 0:s.previousElementSibling)===m.current||((r=m.current)==null?void 0:r.previousElementSibling)===null)return{...l,activeOptionIndex:u}}}}else if(n.focus===se.Next){let h=e.activeOptionIndex;if(h!==null){let g=e.options[h].dataRef.current.domRef,u=Dt(n,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:m=>m.id,resolveDisabled:m=>m.dataRef.current.disabled});if(u!==null){let m=e.options[u].dataRef.current.domRef;if(((a=g.current)==null?void 0:a.nextElementSibling)===m.current||((i=m.current)==null?void 0:i.nextElementSibling)===null)return{...l,activeOptionIndex:u}}}}let c=ni(e),f=Dt(n,{resolveItems:()=>c.options,resolveActiveIndex:()=>c.activeOptionIndex,resolveId:h=>h.id,resolveDisabled:h=>h.dataRef.current.disabled});return{...l,...c,activeOptionIndex:f}},3:(e,n)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.searchQuery!==""?0:1,s=e.searchQuery+n.value.toLowerCase(),r=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+t).concat(e.options.slice(0,e.activeOptionIndex+t)):e.options).find(i=>{var l;return!i.dataRef.current.disabled&&((l=i.dataRef.current.textValue)==null?void 0:l.startsWith(s))}),a=r?e.options.indexOf(r):-1;return a===-1||a===e.activeOptionIndex?{...e,searchQuery:s}:{...e,searchQuery:s,activeOptionIndex:a,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,n)=>{let t=e.options.concat(n.options),s=e.activeOptionIndex;if(e.pendingFocus.focus!==se.Nothing&&(s=Dt(e.pendingFocus,{resolveItems:()=>t,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:r=>r.id,resolveDisabled:r=>r.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:r}=e.dataRef.current;if(r){let a=t.findIndex(i=>r?.(i.dataRef.current.value));a!==-1&&(s=a)}}return{...e,options:t,activeOptionIndex:s,pendingFocus:{focus:se.Nothing},pendingShouldSort:!0}},6:(e,n)=>{let t=e.options,s=[],r=new Set(n.options);for(let[a,i]of t.entries())if(r.has(i.id)&&(s.push(a),r.delete(i.id),r.size===0))break;if(s.length>0){t=t.slice();for(let a of s.reverse())t.splice(a,1)}return{...e,options:t,activationTrigger:1}},7:(e,n)=>e.buttonElement===n.element?e:{...e,buttonElement:n.element},8:(e,n)=>e.optionsElement===n.element?e:{...e,optionsElement:n.element},9:e=>e.pendingShouldSort?{...e,...ni(e),pendingShouldSort:!1}:e};class ra extends Fi{constructor(n){super(n),ti(this,"actions",{onChange:t=>{let{onChange:s,compare:r,mode:a,value:i}=this.state.dataRef.current;return ye(a,{0:()=>s?.(t),1:()=>{let l=i.slice(),c=l.findIndex(f=>r(f,t));return c===-1?l.push(t):l.splice(c,1),s?.(l)}})},registerOption:Ns(()=>{let t=[],s=new Set;return[(r,a)=>{s.has(a)||(s.add(a),t.push({id:r,dataRef:a}))},()=>(s.clear(),this.send({type:5,options:t.splice(0)}))]}),unregisterOption:Ns(()=>{let t=[];return[s=>t.push(s),()=>{this.send({type:6,options:t.splice(0)})}]}),goToOption:Ns(()=>{let t=null;return[(s,r)=>{t={type:2,...s,trigger:r}},()=>t&&this.send(t)]}),closeListbox:()=>{this.send({type:1})},openListbox:t=>{this.send({type:0,focus:t})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:t,id:s}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(t.current.value),this.send({type:2,focus:se.Specific,id:s})}},selectOption:t=>{let s=this.state.options.find(r=>r.id===t);s&&this.actions.onChange(s.dataRef.current.value)},search:t=>{this.send({type:3,value:t})},clearSearch:()=>{this.send({type:4})},setButtonElement:t=>{this.send({type:7,element:t})},setOptionsElement:t=>{this.send({type:8,element:t})}}),ti(this,"selectors",{activeDescendantId(t){var s;let r=t.activeOptionIndex,a=t.options;return r===null||(s=a[r])==null?void 0:s.id},isActive(t,s){var r;let a=t.activeOptionIndex,i=t.options;return a!==null?((r=i[a])==null?void 0:r.id)===s:!1},shouldScrollIntoView(t,s){return t.__demoMode||t.listboxState!==0||t.activationTrigger===0?!1:this.isActive(t,s)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let t=this.state.id,s=xn.get(null);this.disposables.add(s.on(Oi.Push,r=>{!s.selectors.isTop(r,t)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>s.actions.push(t)),this.on(1,()=>s.actions.pop(t))}}static new({id:n,__demoMode:t=!1}){return new ra({id:n,dataRef:{current:{}},listboxState:t?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:se.Nothing},__demoMode:t})}reduce(n,t){return ye(t.type,$0,n,t)}}const nl=o.createContext(null);function aa(e){let n=o.useContext(nl);if(n===null){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,sl),t}return n}function sl({id:e,__demoMode:n=!1}){let t=o.useMemo(()=>ra.new({id:e,__demoMode:n}),[]);return Cr(()=>t.dispose()),t}let Ms=o.createContext(null);Ms.displayName="ListboxDataContext";function kn(e){let n=o.useContext(Ms);if(n===null){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,kn),t}return n}let H0=o.Fragment;function _0(e,n){let t=o.useId(),s=cs(),{value:r,defaultValue:a,form:i,name:l,onChange:c,by:f,invalid:h=!1,disabled:g=s||!1,horizontal:u=!1,multiple:m=!1,__demoMode:p=!1,...b}=e;const y=u?"horizontal":"vertical";let k=ke(n),S=zr(a),[w=m?[]:void 0,C]=Ur(r,c,S),P=sl({id:t,__demoMode:p}),x=o.useRef({static:!1,hold:!1}),O=o.useRef(new Map),M=Vo(f),D=o.useCallback(z=>ye(F.mode,{[qe.Multi]:()=>w.some(H=>M(H,z)),[qe.Single]:()=>M(w,z)}),[w]),F=o.useMemo(()=>({value:w,disabled:g,invalid:h,mode:m?qe.Multi:qe.Single,orientation:y,onChange:C,compare:M,isSelected:D,optionsPropsRef:x,listRef:O}),[w,g,h,m,y,C,M,D,x,O]);Se(()=>{P.state.dataRef.current=F},[F]);let I=oe(P,z=>z.listboxState),T=xn.get(null),E=oe(T,o.useCallback(z=>T.selectors.isTop(z,t),[T,t])),[V,j]=oe(P,z=>[z.buttonElement,z.optionsElement]);Vr(E,[V,j],(z,H)=>{P.send({type:tl.CloseListbox}),Pc(H,jc.Loose)||(z.preventDefault(),V?.focus())});let K=o.useMemo(()=>({open:I===Ee.Open,disabled:g,invalid:h,value:w}),[I,g,h,w]),[L,N]=Li({inherit:!0}),Z={ref:k},q=o.useCallback(()=>{if(S!==void 0)return C?.(S)},[C,S]),Y=pe();return U.createElement(N,{value:L,props:{htmlFor:V?.id},slot:{open:I===Ee.Open,disabled:g}},U.createElement($i,null,U.createElement(nl.Provider,{value:P},U.createElement(Ms.Provider,{value:F},U.createElement(gs,{value:ye(I,{[Ee.Open]:be.Open,[Ee.Closed]:be.Closed})},l!=null&&w!=null&&U.createElement(Gr,{disabled:g,data:{[l]:w},form:i,onReset:q}),Y({ourProps:Z,theirProps:b,slot:K,defaultTag:H0,name:"Listbox"}))))))}let B0="button";function Z0(e,n){let t=o.useId(),s=ls(),r=kn("Listbox.Button"),a=aa("Listbox.Button"),{id:i=s||`headlessui-listbox-button-${t}`,disabled:l=r.disabled||!1,autoFocus:c=!1,...f}=e,h=ke(n,Ii(),a.actions.setButtonElement),g=Rc(),[u,m,p]=oe(a,N=>[N.listboxState,N.buttonElement,N.optionsElement]),b=u===Ee.Open;Ai(b,{trigger:m,action:o.useCallback(N=>{if(m!=null&&m.contains(N.target))return Xe.Ignore;let Z=N.target.closest('[role="option"]:not([data-disabled])');return Zt(Z)?Xe.Select(Z):p!=null&&p.contains(N.target)?Xe.Ignore:Xe.Close},[m,p]),close:a.actions.closeListbox,select:a.actions.selectActiveOption});let y=W(N=>{switch(N.key){case ne.Enter:Ro(N.currentTarget);break;case ne.Space:case ne.ArrowDown:N.preventDefault(),a.actions.openListbox({focus:r.value?se.Nothing:se.First});break;case ne.ArrowUp:N.preventDefault(),a.actions.openListbox({focus:r.value?se.Nothing:se.Last});break}}),k=W(N=>{switch(N.key){case ne.Space:N.preventDefault();break}}),S=W(N=>{var Z;if(N.button===Tr.Left){if(ds(N.currentTarget))return N.preventDefault();a.state.listboxState===Ee.Open?(Te.flushSync(()=>a.actions.closeListbox()),(Z=a.state.buttonElement)==null||Z.focus({preventScroll:!0})):(N.preventDefault(),a.actions.openListbox({focus:se.Nothing}))}}),w=o.useRef(null),C=W(N=>{w.current=N.pointerType,N.pointerType==="mouse"&&S(N)}),P=W(N=>{w.current!=="mouse"&&S(N)}),x=W(N=>N.preventDefault()),O=Kt([i]),M=us(),{isFocusVisible:D,focusProps:F}=Wt({autoFocus:c}),{isHovered:I,hoverProps:T}=Yt({isDisabled:l}),{pressed:E,pressProps:V}=fs({disabled:l}),j=o.useMemo(()=>({open:u===Ee.Open,active:E||u===Ee.Open,disabled:l,invalid:r.invalid,value:r.value,hover:I,focus:D,autofocus:c}),[u,r.value,l,I,D,E,r.invalid,c]),K=oe(a,N=>N.listboxState===Ee.Open),L=rt(g(),{ref:h,id:i,type:Fr(e,m),"aria-haspopup":"listbox","aria-controls":p?.id,"aria-expanded":K,"aria-labelledby":O,"aria-describedby":M,disabled:l||void 0,autoFocus:c,onKeyDown:y,onKeyUp:k,onKeyPress:x,onPointerDown:C,onClick:P},F,T,V);return pe()({ourProps:L,theirProps:f,slot:j,defaultTag:B0,name:"Listbox.Button"})}let rl=o.createContext(!1),U0="div",z0=at.RenderStrategy|at.Static;function G0(e,n){let t=o.useId(),{id:s=`headlessui-listbox-options-${t}`,anchor:r,portal:a=!1,modal:i=!0,transition:l=!1,...c}=e,f=Vi(r),[h,g]=o.useState(null);f&&(a=!0);let u=kn("Listbox.Options"),m=aa("Listbox.Options"),[p,b,y,k]=oe(m,R=>[R.listboxState,R.buttonElement,R.optionsElement,R.__demoMode]),S=ft(b),w=ft(y),C=Tt(),[P,x]=ps(l,h,C!==null?(C&be.Open)===be.Open:p===Ee.Open);Or(P,b,m.actions.closeListbox);let O=k?!1:i&&p===Ee.Open;Rr(O,w);let M=k?!1:i&&p===Ee.Open;Ir(M,{allowed:o.useCallback(()=>[b,y],[b,y])});let D=p!==Ee.Open,F=Ic(D,b)?!1:P,I=P&&p===Ee.Closed,T=ts(I,u.value),E=W(R=>u.compare(T,R)),V=oe(m,R=>{var $;if(f==null||!(($=f?.to)!=null&&$.includes("selection")))return null;let _=R.options.findIndex(G=>E(G.dataRef.current.value));return _===-1&&(_=0),_}),j=(()=>{if(f==null)return;if(V===null)return{...f,inner:void 0};let R=Array.from(u.listRef.current.values());return{...f,inner:{listRef:{current:R},index:V}}})(),[K,L]=Pi(j),N=ji(),Z=ke(n,f?K:null,m.actions.setOptionsElement,g),q=qt();o.useEffect(()=>{var R;let $=y;$&&p===Ee.Open&&$!==((R=jr($))==null?void 0:R.activeElement)&&$?.focus({preventScroll:!0})},[p,y]);let Y=W(R=>{var $,_;switch(q.dispose(),R.key){case ne.Space:if(m.state.searchQuery!=="")return R.preventDefault(),R.stopPropagation(),m.actions.search(R.key);case ne.Enter:if(R.preventDefault(),R.stopPropagation(),m.state.activeOptionIndex!==null){let{dataRef:G}=m.state.options[m.state.activeOptionIndex];m.actions.onChange(G.current.value)}u.mode===qe.Single&&(Te.flushSync(()=>m.actions.closeListbox()),($=m.state.buttonElement)==null||$.focus({preventScroll:!0}));break;case ye(u.orientation,{vertical:ne.ArrowDown,horizontal:ne.ArrowRight}):return R.preventDefault(),R.stopPropagation(),m.actions.goToOption({focus:se.Next});case ye(u.orientation,{vertical:ne.ArrowUp,horizontal:ne.ArrowLeft}):return R.preventDefault(),R.stopPropagation(),m.actions.goToOption({focus:se.Previous});case ne.Home:case ne.PageUp:return R.preventDefault(),R.stopPropagation(),m.actions.goToOption({focus:se.First});case ne.End:case ne.PageDown:return R.preventDefault(),R.stopPropagation(),m.actions.goToOption({focus:se.Last});case ne.Escape:R.preventDefault(),R.stopPropagation(),Te.flushSync(()=>m.actions.closeListbox()),(_=m.state.buttonElement)==null||_.focus({preventScroll:!0});return;case ne.Tab:R.preventDefault(),R.stopPropagation(),Te.flushSync(()=>m.actions.closeListbox()),Ac(m.state.buttonElement,R.shiftKey?ze.Previous:ze.Next);break;default:R.key.length===1&&(m.actions.search(R.key),q.setTimeout(()=>m.actions.clearSearch(),350));break}}),z=oe(m,R=>{var $;return($=R.buttonElement)==null?void 0:$.id}),H=o.useMemo(()=>({open:p===Ee.Open}),[p]),B=rt(f?N():{},{id:s,ref:Z,"aria-activedescendant":oe(m,m.selectors.activeDescendantId),"aria-multiselectable":u.mode===qe.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":u.orientation,onKeyDown:Y,role:"listbox",tabIndex:p===Ee.Open?0:void 0,style:{...c.style,...L,"--button-width":Qs(b,!0).width},...ms(x)}),J=pe(),A=o.useMemo(()=>u.mode===qe.Multi?u:{...u,isSelected:E},[u,E]);return U.createElement(Ar,{enabled:a?e.static||P:!1,ownerDocument:S},U.createElement(Ms.Provider,{value:A},J({ourProps:B,theirProps:c,slot:H,defaultTag:U0,features:z0,visible:F,name:"Listbox.Options"})))}let q0="div";function K0(e,n){let t=o.useId(),{id:s=`headlessui-listbox-option-${t}`,disabled:r=!1,value:a,...i}=e,l=o.useContext(rl)===!0,c=kn("Listbox.Option"),f=aa("Listbox.Option"),h=oe(f,F=>f.selectors.isActive(F,s)),g=c.isSelected(a),u=o.useRef(null),m=Vc(u),p=hs({disabled:r,value:a,domRef:u,get textValue(){return m()}}),b=ke(n,u,F=>{F?c.listRef.current.set(s,F):c.listRef.current.delete(s)}),y=oe(f,F=>f.selectors.shouldScrollIntoView(F,s));Se(()=>{if(y)return Ni().requestAnimationFrame(()=>{var F,I;(I=(F=u.current)==null?void 0:F.scrollIntoView)==null||I.call(F,{block:"nearest"})})},[y,u]),Se(()=>{if(!l)return f.actions.registerOption(s,p),()=>f.actions.unregisterOption(s)},[p,s,l]);let k=W(F=>{var I;if(r)return F.preventDefault();f.actions.onChange(a),c.mode===qe.Single&&(Te.flushSync(()=>f.actions.closeListbox()),(I=f.state.buttonElement)==null||I.focus({preventScroll:!0}))}),S=W(()=>{if(r)return f.actions.goToOption({focus:se.Nothing});f.actions.goToOption({focus:se.Specific,id:s})}),w=Di(),C=W(F=>w.update(F)),P=W(F=>{w.wasMoved(F)&&(r||h&&f.state.activationTrigger===Bn.Pointer||f.actions.goToOption({focus:se.Specific,id:s},Bn.Pointer))}),x=W(F=>{w.wasMoved(F)&&(r||h&&f.state.activationTrigger===Bn.Pointer&&f.actions.goToOption({focus:se.Nothing}))}),O=o.useMemo(()=>({active:h,focus:h,selected:g,disabled:r,selectedOption:g&&l}),[h,g,r,l]),M=l?{}:{id:s,ref:b,role:"option",tabIndex:r===!0?void 0:-1,"aria-disabled":r===!0?!0:void 0,"aria-selected":g,disabled:void 0,onClick:k,onFocus:S,onPointerEnter:C,onMouseEnter:C,onPointerMove:P,onMouseMove:P,onPointerLeave:x,onMouseLeave:x},D=pe();return!g&&l?null:D({ourProps:M,theirProps:i,slot:O,defaultTag:q0,name:"Listbox.Option"})}let W0=o.Fragment;function Y0(e,n){let{options:t,placeholder:s,...r}=e,a={ref:ke(n)},i=kn("ListboxSelectedOption"),l=o.useMemo(()=>({}),[]),c=i.value===void 0||i.value===null||i.mode===qe.Multi&&Array.isArray(i.value)&&i.value.length===0,f=pe();return U.createElement(rl.Provider,{value:!0},f({ourProps:a,theirProps:{...r,children:U.createElement(U.Fragment,null,s&&c?s:t)},slot:l,defaultTag:W0,name:"ListboxSelectedOption"}))}let Q0=ce(_0),al=ce(Z0),X0=wn,il=ce(G0),ur=ce(K0),J0=ce(Y0),e1=Object.assign(Q0,{Button:al,Label:X0,Options:il,Option:ur,SelectedOption:J0});function t1({controlled:e,default:n,name:t,state:s="value"}){const{current:r}=o.useRef(e!==void 0),[a,i]=o.useState(n),l=r?e:a,c=o.useCallback(f=>{r||i(f)},[]);return[l,c]}const ol=o.createContext(void 0);function Cs(){const e=o.useContext(ol);if(e===void 0)throw new Error("Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>.");return e}function n1(e,n=!1,t=!1){const[s,r]=o.useState(e&&n?"idle":void 0),[a,i]=o.useState(e);return e&&!a&&(i(!0),r("starting")),!e&&a&&s!=="ending"&&!t&&r("ending"),!e&&!a&&s==="ending"&&r(void 0),Fe(()=>{if(!e&&a&&s!=="ending"&&t){const l=Qe.request(()=>{r("ending")});return()=>{Qe.cancel(l)}}},[e,a,s,t]),Fe(()=>{if(!e||n)return;const l=Qe.request(()=>{Te.flushSync(()=>{r(void 0)})});return()=>{Qe.cancel(l)}},[n,e]),Fe(()=>{if(!e||!n)return;e&&a&&s!=="idle"&&r("starting");const l=Qe.request(()=>{r("idle")});return()=>{Qe.cancel(l)}},[n,e,a,r,s]),o.useMemo(()=>({mounted:a,setMounted:i,transitionStatus:s}),[a,s])}const s1=600;function r1(e){if(e)return{"focus-out":"focus-out","escape-key":"escape-key","outside-press":"outside-press","list-navigation":"list-navigation",click:"trigger-press",hover:"trigger-hover",focus:"trigger-focus","reference-press":"trigger-press","safe-polygon":"trigger-hover","ancestor-scroll":void 0}[e]}const ll=o.createContext(void 0);function a1(){return o.useContext(ll)}function ia(e){const{disabled:n=!1,defaultOpen:t=!1,onOpenChange:s,open:r,delay:a,closeDelay:i,hoverable:l=!0,trackCursorAxis:c="none",actionsRef:f,onOpenChangeComplete:h}=e,g=a??s1,u=i??0,[m,p]=o.useState(null),[b,y]=o.useState(null),[k,S]=o.useState(),w=o.useRef(null),[C,P]=t1({controlled:r,default:t,name:"Tooltip",state:"open"}),x=!n&&C;function O(R,$,_){const G=_==="trigger-hover",ue=R&&_==="trigger-focus",me=!R&&(_==="trigger-press"||_==="escape-key");function Ze(){s?.(R,$,_),P(R)}G?Te.flushSync(Ze):Ze(),ue||me?S(ue?"focus":"dismiss"):_==="trigger-hover"&&S(void 0)}const M=le(O);C&&n&&O(!1,void 0,"disabled");const{mounted:D,setMounted:F,transitionStatus:I}=n1(x),T=le(()=>{F(!1),h?.(!1)});Hr({enabled:!f,open:x,ref:w,onComplete(){x||T()}}),o.useImperativeHandle(f,()=>({unmount:T}),[T]);const E=So({elements:{reference:m,floating:b},open:x,onOpenChange(R,$,_){M(R,$,r1(_))}}),V=a1(),{delayRef:j,isInstantPhase:K,hasProvider:L}=Fd(E),N=K?"delay":k,Z=Cd(E,{enabled:!n,mouseOnly:!0,move:!1,handleClose:l&&c!=="both"?Dd():null,restMs(){const R=V?.delay,$=typeof j.current=="object"?j.current.open:void 0;let _=g;return L&&($!==0?_=a??R??g:_=0),_},delay(){const R=typeof j.current=="object"?j.current.close:void 0;let $=u;return i==null&&L&&($=R),{close:$}}}),q=Pd(E,{enabled:!n}),Y=Ad(E,{enabled:!n,referencePress:!0}),z=Rd(E,{enabled:!n&&c!=="none",axis:c==="none"?void 0:c}),{getReferenceProps:H,getFloatingProps:B}=jd([Z,q,Y,z]),J=o.useMemo(()=>({open:x,setOpen:M,mounted:D,setMounted:F,setTriggerElement:p,positionerElement:b,setPositionerElement:y,popupRef:w,triggerProps:H(),popupProps:B(),floatingRootContext:E,instantType:N,transitionStatus:I,onOpenChangeComplete:h}),[x,M,D,F,p,b,y,w,H,B,E,N,I,h]),A=o.useMemo(()=>({...J,delay:g,closeDelay:u,trackCursorAxis:c,hoverable:l}),[J,g,u,c,l]);return d.jsx(ol.Provider,{value:A,children:e.children})}let oa=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Xn.startingStyle]="startingStyle",e[e.endingStyle=Xn.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),i1=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const o1={[i1.popupOpen]:""},l1={[oa.open]:""},c1={[oa.closed]:""},u1={[oa.anchorHidden]:""},d1={open(e){return e?o1:null}},la={open(e){return e?l1:c1},anchorHidden(e){return e?u1:null}},ca=o.forwardRef(function(n,t){const{className:s,render:r,...a}=n,{open:i,setTriggerElement:l,triggerProps:c}=Cs(),f=o.useMemo(()=>({open:i}),[i]);return ot("button",n,{state:f,ref:[t,l],props:[c,a],customStyleHookMapping:d1})}),cl=o.createContext(void 0);function f1(){const e=o.useContext(cl);if(e===void 0)throw new Error("Base UI: <Tooltip.Portal> is missing.");return e}function ua(e){const{children:n,keepMounted:t=!1,container:s}=e,{mounted:r}=Cs();return r||t?d.jsx(cl.Provider,{value:t,children:d.jsx(Nc,{root:s,children:n})}):null}const ul=o.createContext(void 0);function dl(){const e=o.useContext(ul);if(e===void 0)throw new Error("Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>.");return e}const h1=o.createContext(void 0);function p1(e=!0){const n=o.useContext(h1);if(n===void 0&&!e)throw new Error("Base UI: DirectionContext is missing.");return n?.direction??"ltr"}const m1=e=>({name:"arrow",options:e,async fn(n){const{x:t,y:s,placement:r,rects:a,platform:i,elements:l,middlewareData:c}=n,{element:f,padding:h=0,offsetParent:g="real"}=Dc(e,n)||{};if(f==null)return{};const u=Lc(h),m={x:t,y:s},p=$c(r),b=_c(p),y=await i.getDimensions(f),k=p==="y",S=k?"top":"left",w=k?"bottom":"right",C=k?"clientHeight":"clientWidth",P=a.reference[b]+a.reference[p]-m[p]-a.floating[b],x=m[p]-a.reference[p],O=g==="real"?await i.getOffsetParent?.(f):l.floating;let M=l.floating[C]||a.floating[b];(!M||!await i.isElement?.(O))&&(M=l.floating[C]||a.floating[b]);const D=P/2-x/2,F=M/2-y[b]/2-1,I=Math.min(u[S],F),T=Math.min(u[w],F),E=I,V=M-y[b]-T,j=M/2-y[b]/2+D,K=Hc(E,j,V),L=!c.arrow&&Nr(r)!=null&&j!==K&&a.reference[b]/2-(j<E?I:T)-y[b]/2<0,N=L?j<E?j-E:j-V:0;return{[p]:m[p]+N,data:{[p]:K,centerOffset:j-K-N,...L&&{alignmentOffset:N}},reset:L}}}),g1=(e,n)=>({...m1(e),options:[e,n]});function fl(e,n,t){const s=e==="inline-start"||e==="inline-end";return{top:"top",right:s?t?"inline-start":"inline-end":"right",bottom:"bottom",left:s?t?"inline-end":"inline-start":"left"}[n]}function si(e,n,t){const{rects:s,placement:r}=e;return{side:fl(n,Xs(r),t),align:Nr(r)||"center",anchor:{width:s.reference.width,height:s.reference.height},positioner:{width:s.floating.width,height:s.floating.height}}}function b1(e){const{anchor:n,positionMethod:t="absolute",side:s="bottom",sideOffset:r=0,align:a="center",alignOffset:i=0,collisionBoundary:l,collisionPadding:c=5,sticky:f=!1,arrowPadding:h=5,trackAnchor:g=!0,keepMounted:u=!1,floatingRootContext:m,mounted:p,collisionAvoidance:b,shiftCrossAxis:y=!1,nodeId:k,adaptiveOrigin:S}=e,w=b.side||"flip",C=b.align||"flip",P=b.fallbackAxisSide||"end",x=typeof n=="function"?n:void 0,O=le(x),M=x?O:n,D=Je(n),I=p1()==="rtl",T={top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[s],E=a==="center"?T:`${T}-${a}`,V={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:c},j=o.useRef(null),K=Je(r),L=Je(i),q=[Bc(ie=>{const he=si(ie,s,I),Ne=typeof K.current=="function"?K.current(he):K.current,De=typeof L.current=="function"?L.current(he):L.current;return{mainAxis:Ne,crossAxis:De,alignmentAxis:De}},[typeof r!="function"?r:0,typeof i!="function"?i:0,I,s])],Y=C==="none"&&w!=="shift",z=!Y&&(f||y||w==="shift"),H=w==="none"?null:Zc({...V,mainAxis:!y&&w==="flip",crossAxis:C==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),B=Y?null:Uc(ie=>{const he=Nt(ie.elements.floating).documentElement;return{...V,rootBoundary:y?{x:0,y:0,width:he.clientWidth,height:he.clientHeight}:void 0,mainAxis:C!=="none",crossAxis:z,limiter:f||y?void 0:zc(()=>{if(!j.current)return{};const{height:Ne}=j.current.getBoundingClientRect();return{offset:Ne/2+(typeof c=="number"?c:0)}})}},[V,f,y,c,C]);w==="shift"||C==="shift"||a==="center"?q.push(B,H):q.push(H,B),q.push(Gc({...V,apply({elements:{floating:ie},rects:{reference:he},availableWidth:Ne,availableHeight:De}){Object.entries({"--available-width":`${Ne}px`,"--available-height":`${De}px`,"--anchor-width":`${he.width}px`,"--anchor-height":`${he.height}px`}).forEach(([Ce,ct])=>{ie.style.setProperty(Ce,ct)})}}),g1(()=>({element:j.current||document.createElement("div"),padding:h,offsetParent:"floating"}),[h]),qc(),{name:"transformOrigin",fn(ie){const{elements:he,middlewareData:Ne,placement:De,rects:Ce,y:ct}=ie,Ot=Xs(De),en=Kc(Ot),Rt=j.current,It=Ne.arrow?.x||0,Os=Ne.arrow?.y||0,Rs=Rt?.clientWidth||0,Is=Rt?.clientHeight||0,As=It+Rs/2,xa=Os+Is/2,El=Math.abs(Ne.shift?.y||0),Sl=Ce.reference.height/2,kl=El>(typeof r=="function"?r(si(ie,s,I)):r),Ml={top:`${As}px calc(100% + ${r}px)`,bottom:`${As}px ${-r}px`,left:`calc(100% + ${r}px) ${xa}px`,right:`${-r}px ${xa}px`}[Ot],Cl=`${As}px ${Ce.reference.y+Sl-ct}px`;return he.floating.style.setProperty("--transform-origin",z&&en==="y"&&kl?Cl:Ml),{}}},S);let J=m;!p&&m&&(J={...m,elements:{reference:null,floating:null,domReference:null}});const A=o.useMemo(()=>({elementResize:g&&typeof ResizeObserver<"u",layoutShift:g&&typeof IntersectionObserver<"u"}),[g]),{refs:R,elements:$,x:_,y:G,middlewareData:ue,update:me,placement:Ze,context:Ft,isPositioned:pt,floatingStyles:we}=Vd({rootContext:J,placement:E,middleware:q,strategy:t,whileElementsMounted:u?void 0:(...ie)=>Ia(...ie,A),nodeId:k}),{sideX:je,sideY:mt}=ue.adaptiveOrigin||{},$e=o.useMemo(()=>S?{position:t,[je]:`${_}px`,[mt]:`${G}px`}:we,[S,je,mt,t,_,G,we]),lt=o.useRef(null);Fe(()=>{if(!p)return;const ie=D.current,he=typeof ie=="function"?ie():ie,De=(ri(he)?he.current:he)||null||null;De!==lt.current&&(R.setPositionReference(De),lt.current=De)},[p,R,M,D]),o.useEffect(()=>{if(!p)return;const ie=D.current;typeof ie!="function"&&ri(ie)&&ie.current!==lt.current&&(R.setPositionReference(ie.current),lt.current=ie.current)},[p,R,M,D]),o.useEffect(()=>{if(u&&p&&$.domReference&&$.floating)return Ia($.domReference,$.floating,me,A)},[u,p,$,me,A]);const Jt=Xs(Ze),X=fl(s,Jt,I),te=Nr(Ze)||"center",de=!!ue.hide?.referenceHidden,fe=o.useMemo(()=>({position:"absolute",top:ue.arrow?.y,left:ue.arrow?.x}),[ue.arrow]),He=ue.arrow?.centerOffset!==0;return o.useMemo(()=>({positionerStyles:$e,arrowStyles:fe,arrowRef:j,arrowUncentered:He,side:X,align:te,anchorHidden:de,refs:R,context:Ft,isPositioned:pt,update:me}),[$e,fe,j,He,X,te,de,R,Ft,pt,me])}function ri(e){return e!=null&&"current"in e}const da=o.forwardRef(function(n,t){const{render:s,className:r,anchor:a,positionMethod:i="absolute",side:l="top",align:c="center",sideOffset:f=0,alignOffset:h=0,collisionBoundary:g="clipping-ancestors",collisionPadding:u=5,arrowPadding:m=5,sticky:p=!1,trackAnchor:b=!0,collisionAvoidance:y=ed,...k}=n,{open:S,setPositionerElement:w,mounted:C,floatingRootContext:P,trackCursorAxis:x,hoverable:O}=Cs(),M=f1(),D=b1({anchor:a,positionMethod:i,floatingRootContext:P,mounted:C,side:l,sideOffset:f,align:c,alignOffset:h,collisionBoundary:g,collisionPadding:u,sticky:p,arrowPadding:m,trackAnchor:b,keepMounted:M,collisionAvoidance:y}),F=o.useMemo(()=>{const j={};return(!S||x==="both"||!O)&&(j.pointerEvents="none"),{role:"presentation",hidden:!C,style:{...D.positionerStyles,...j}}},[S,x,O,C,D.positionerStyles]),I=o.useMemo(()=>({props:F,...D}),[F,D]),T=o.useMemo(()=>({open:S,side:I.side,align:I.align,anchorHidden:I.anchorHidden}),[S,I.side,I.align,I.anchorHidden]),E=o.useMemo(()=>({...T,arrowRef:I.arrowRef,arrowStyles:I.arrowStyles,arrowUncentered:I.arrowUncentered}),[T,I.arrowRef,I.arrowStyles,I.arrowUncentered]),V=ot("div",n,{state:T,props:[I.props,k],ref:[t,w],customStyleHookMapping:la});return d.jsx(ul.Provider,{value:E,children:V})}),v1={...la,...xo},fa=o.forwardRef(function(n,t){const{className:s,render:r,...a}=n,{open:i,instantType:l,transitionStatus:c,popupProps:f,popupRef:h,onOpenChangeComplete:g}=Cs(),{side:u,align:m}=dl();Hr({open:i,ref:h,onComplete(){i&&g?.(!0)}});const p=o.useMemo(()=>({open:i,side:u,align:m,instant:l,transitionStatus:c}),[i,u,m,l,c]);return ot("div",n,{state:p,ref:[t,h],props:[f,c==="starting"?Ju:bt,a],customStyleHookMapping:v1})}),ha=o.forwardRef(function(n,t){const{className:s,render:r,...a}=n,{open:i,arrowRef:l,side:c,align:f,arrowUncentered:h,arrowStyles:g}=dl(),u=o.useMemo(()=>({open:i,side:c,align:f,uncentered:h}),[i,c,f,h]);return ot("div",n,{state:u,ref:[t,l],props:[{style:g,"aria-hidden":!0},a],customStyleHookMapping:la})}),pa=function(n){const{delay:t,closeDelay:s,timeout:r=400}=n,a=o.useMemo(()=>({delay:t,closeDelay:s}),[t,s]),i=o.useMemo(()=>({open:t,close:s}),[t,s]);return d.jsx(ll.Provider,{value:a,children:d.jsx(Td,{delay:i,timeoutMs:r,children:n.children})})};function Mn(e,n){return typeof e=="function"?e(n):e}function St(e,n){return Ts(n).reduce((s,r)=>{if(s===null)return null;if(typeof s<"u")return s[r]},e)}function Pn(e,n,t){const s=Ts(n);function r(a){if(!s.length)return Mn(t,a);const i=s.shift();if(typeof i=="string"||typeof i=="number"&&!Array.isArray(a))return typeof a=="object"?(a===null&&(a={}),{...a,[i]:r(a[i])}):{[i]:r()};if(Array.isArray(a)&&typeof i=="number"){const l=a.slice(0,i);return[...l.length?l:new Array(i),r(a[i]),...a.slice(i+1)]}return[...new Array(i),r()]}return r(e)}function y1(e,n){const t=Ts(n);function s(r){if(!r)return;if(t.length===1){const i=t[0];if(Array.isArray(r)&&typeof i=="number")return r.filter((f,h)=>h!==i);const{[i]:l,...c}=r;return c}const a=t.shift();if(typeof a=="string"&&typeof r=="object")return{...r,[a]:s(r[a])};if(typeof a=="number"&&Array.isArray(r)){if(a>=r.length)return r;const i=r.slice(0,a);return[...i.length?i:new Array(a),s(r[a]),...r.slice(a+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return s(e)}const x1=/^(\d+)$/gm,w1=/\.(\d+)(?=\.)/gm,E1=/^(\d+)\./gm,S1=/\.(\d+$)/gm,k1=/\.{2,}/gm,dr="__int__",jn=`${dr}$1`;function Ts(e){if(Array.isArray(e))return[...e];if(typeof e!="string")throw new Error("Path must be a string.");return e.replace(/(^\[)|]/gm,"").replace(/\[/g,".").replace(x1,jn).replace(w1,`.${jn}.`).replace(E1,`${jn}.`).replace(S1,`.${jn}`).replace(k1,".").split(".").map(n=>{if(n.startsWith(dr)){const t=n.substring(dr.length),s=parseInt(t,10);return String(s)===t?s:t}return n})}function ai(e,n){return e.length===0?n:n.length===0?e:n.startsWith("[")||n.startsWith(".")?e+n:`${e}.${n}`}function M1(e){return!(Array.isArray(e)&&e.length===0)}function fr(e,n){const t=s=>s.validators.filter(Boolean).map(r=>({cause:r.cause,validate:r.fn}));return n.validationLogic({form:n.form,validators:n.validators,event:{type:e,async:!1},runValidation:t})}function hr(e,n){const{asyncDebounceMs:t}=n,{onBlurAsyncDebounceMs:s,onChangeAsyncDebounceMs:r,onDynamicAsyncDebounceMs:a}=n.validators||{},i=t??0,l=c=>c.validators.filter(Boolean).map(f=>{const h=f?.cause||e;let g=i;switch(h){case"change":g=r??i;break;case"blur":g=s??i;break;case"dynamic":g=a??i;break;case"submit":g=0;break}return e==="submit"&&(g=0),{cause:h,validate:f.fn,debounceMs:g}});return n.validationLogic({form:n.form,validators:n.validators,event:{type:e,async:!0},runValidation:l})}const pr=e=>!!e&&typeof e=="object"&&"fields"in e;function Pt(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[r,a]of e)if(!n.has(r)||!Object.is(a,n.get(r)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}const t=Object.keys(e),s=Object.keys(n);if(t.length!==s.length)return!1;for(const r of t)if(!s.includes(r)||!Pt(e[r],n[r]))return!1;return!0}const ii=({newFormValidatorError:e,isPreviousErrorFromFormValidator:n,previousErrorValue:t})=>e?{newErrorValue:e,newSource:"form"}:n?{newErrorValue:void 0,newSource:void 0}:t?{newErrorValue:t,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},oi=({formLevelError:e,fieldLevelError:n})=>n?{newErrorValue:n,newSource:"field"}:e?{newErrorValue:e,newSource:"form"}:{newErrorValue:void 0,newSource:void 0},$t=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});const n=e.event.async,t=n?void 0:{fn:e.validators.onMount,cause:"mount"},s={fn:n?e.validators.onChangeAsync:e.validators.onChange,cause:"change"},r={fn:n?e.validators.onBlurAsync:e.validators.onBlur,cause:"blur"},a={fn:n?e.validators.onSubmitAsync:e.validators.onSubmit,cause:"submit"},i=n?void 0:{fn:()=>{},cause:"server"};switch(e.event.type){case"mount":return e.runValidation({validators:[t],form:e.form});case"submit":return e.runValidation({validators:[s,r,a,i],form:e.form});case"server":return e.runValidation({validators:[],form:e.form});case"blur":return e.runValidation({validators:[r,i],form:e.form});case"change":return e.runValidation({validators:[s,i],form:e.form});default:throw new Error(`Unknown validation event type: ${e.event.type}`)}};function C1(e){const n=new Map;for(const t of e){const s=[...t.path??[]].map(r=>{const a=typeof r=="object"?r.key:r;return typeof a=="number"?`[${a}]`:a}).join(".").replace(/\.\[/g,"[");n.set(s,(n.get(s)??[]).concat(t))}return Object.fromEntries(n)}const li=e=>{const n=C1(e);return{form:n,fields:n}},Ht={validate({value:e,validationSource:n},t){const s=t["~standard"].validate(e);if(s instanceof Promise)throw new Error("async function passed to sync validator");if(s.issues)return n==="field"?s.issues:li(s.issues)},async validateAsync({value:e,validationSource:n},t){const s=await t["~standard"].validate(e);if(s.issues)return n==="field"?s.issues:li(s.issues)}},hl=e=>!!e&&"~standard"in e,ns={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function Nn(e){function n(g,u,m,p){const b=s(g,u,m,p);({insert:()=>l(b,g,u),remove:()=>c(b),swap:()=>p!==void 0&&h(b,g,u,p),move:()=>p!==void 0&&f(b,g,u,p)})[m]()}function t(g,u){return`${g}[${u}]`}function s(g,u,m,p){const b=[t(g,u)];if(m==="swap")b.push(t(g,p));else if(m==="move"){const[y,k]=[Math.min(u,p),Math.max(u,p)];for(let S=y;S<=k;S++)b.push(t(g,S))}else{const y=e.getFieldValue(g),k=Array.isArray(y)?y.length:0;for(let S=u+1;S<k;S++)b.push(t(g,S))}return Object.keys(e.fieldInfo).filter(y=>b.some(k=>y.startsWith(k)))}function r(g,u){return g.replace(/\[(\d+)\]/,(m,p)=>{const b=parseInt(p,10);return`[${u==="up"?b+1:Math.max(0,b-1)}]`})}function a(g,u){(u==="up"?g:[...g].reverse()).forEach(p=>{const b=r(p.toString(),u),y=e.getFieldMeta(b);y?e.setFieldMeta(p,y):e.setFieldMeta(p,i())})}const i=()=>ns,l=(g,u,m)=>{a(g,"down"),g.forEach(p=>{p.toString().startsWith(t(u,m))&&e.setFieldMeta(p,i())})},c=g=>{a(g,"up")},f=(g,u,m,p)=>{const b=new Map(Object.keys(e.fieldInfo).filter(y=>y.startsWith(t(u,m))).map(y=>[y,e.getFieldMeta(y)]));a(g,m<p?"up":"down"),Object.keys(e.fieldInfo).filter(y=>y.startsWith(t(u,p))).forEach(y=>{const k=y.replace(t(u,p),t(u,m)),S=b.get(k);S&&e.setFieldMeta(y,S)})},h=(g,u,m,p)=>{g.forEach(b=>{if(!b.toString().startsWith(t(u,m)))return;const y=b.toString().replace(t(u,m),t(u,p)),[k,S]=[e.getFieldMeta(b),e.getFieldMeta(y)];k&&e.setFieldMeta(y,k),S&&e.setFieldMeta(b,S)})};return{handleArrayFieldMetaShift:n}}function Us(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class T1{constructor(n){this.options={},this.fieldInfo={},this.prevTransformArray=[],this.mount=()=>{const t=this.fieldMetaDerived.mount(),s=this.store.mount(),r=()=>{t(),s()};this.options.listeners?.onMount?.({formApi:this});const{onMount:a}=this.options.validators||{};return a&&this.validateSync("mount"),r},this.update=t=>{if(!t)return;const s=this.options;this.options=t;const r=!!t.transform?.deps?.some((l,c)=>l!==this.prevTransformArray[c]),a=t.defaultValues&&!Pt(t.defaultValues,s.defaultValues)&&!this.state.isTouched,i=!Pt(t.defaultState,s.defaultState)&&!this.state.isTouched;!a&&!i&&!r||Ue(()=>{this.baseStore.setState(()=>Us(Object.assign({},this.state,i?t.defaultState:{},a?{values:t.defaultValues}:{},r?{_force_re_eval:!this.state._force_re_eval}:{})))})},this.reset=(t,s)=>{const{fieldMeta:r}=this.state,a=this.resetFieldMeta(r);t&&!s?.keepDefaultValues&&(this.options={...this.options,defaultValues:t}),this.baseStore.setState(()=>Us({...this.options.defaultState,values:t??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:a}))},this.validateAllFields=async t=>{const s=[];return Ue(()=>{Object.values(this.fieldInfo).forEach(a=>{if(!a.instance)return;const i=a.instance;s.push(Promise.resolve().then(()=>i.validate(t,{skipFormValidation:!0}))),a.instance.state.meta.isTouched||a.instance.setMeta(l=>({...l,isTouched:!0}))})}),(await Promise.all(s)).flat()},this.validateArrayFieldsStartingFrom=async(t,s,r)=>{const a=this.getFieldValue(t),i=Array.isArray(a)?Math.max(a.length-1,0):null,l=[`${t}[${s}]`];for(let g=s+1;g<=(i??0);g++)l.push(`${t}[${g}]`);const c=Object.keys(this.fieldInfo).filter(g=>l.some(u=>g.startsWith(u))),f=[];return Ue(()=>{c.forEach(g=>{f.push(Promise.resolve().then(()=>this.validateField(g,r)))})}),(await Promise.all(f)).flat()},this.validateField=(t,s)=>{const r=this.fieldInfo[t]?.instance;return r?(r.state.meta.isTouched||r.setMeta(a=>({...a,isTouched:!0})),r.validate(s)):[]},this.validateSync=t=>{const s=fr(t,{...this.options,form:this,validationLogic:this.options.validationLogic||$t});let r=!1;const a={};return Ue(()=>{for(const c of s){if(!c.validate)continue;const f=this.runValidator({validate:c.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:h,fieldErrors:g}=Zn(f),u=nn(c.cause);for(const m of Object.keys(this.state.fieldMeta)){const p=this.getFieldMeta(m);if(!p)continue;const{errorMap:b,errorSourceMap:y}=p,k=g?.[m],{newErrorValue:S,newSource:w}=ii({newFormValidatorError:k,isPreviousErrorFromFormValidator:y?.[u]==="form",previousErrorValue:b?.[u]});w==="form"&&(a[m]={...a[m],[u]:k}),b?.[u]!==S&&this.setFieldMeta(m,C=>({...C,errorMap:{...C.errorMap,[u]:S},errorSourceMap:{...C.errorSourceMap,[u]:w}}))}this.state.errorMap?.[u]!==h&&this.baseStore.setState(m=>({...m,errorMap:{...m.errorMap,[u]:h}})),(h||g)&&(r=!0)}const i=nn("submit");this.state.errorMap?.[i]&&t!=="submit"&&!r&&this.baseStore.setState(c=>({...c,errorMap:{...c.errorMap,[i]:void 0}}));const l=nn("server");this.state.errorMap?.[l]&&t!=="server"&&!r&&this.baseStore.setState(c=>({...c,errorMap:{...c.errorMap,[l]:void 0}}))}),{hasErrored:r,fieldsErrorMap:a}},this.validateAsync=async t=>{const s=hr(t,{...this.options,form:this,validationLogic:this.options.validationLogic||$t});this.state.isFormValidating||this.baseStore.setState(c=>({...c,isFormValidating:!0}));const r=[];let a;for(const c of s){if(!c.validate)continue;const f=nn(c.cause);this.state.validationMetaMap[f]?.lastAbortController.abort();const g=new AbortController;this.state.validationMetaMap[f]={lastAbortController:g},r.push(new Promise(async u=>{let m;try{m=await new Promise((k,S)=>{setTimeout(async()=>{if(g.signal.aborted)return k(void 0);try{k(await this.runValidator({validate:c.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:g.signal},type:"validateAsync"}))}catch(w){S(w)}},c.debounceMs)})}catch(k){m=k}const{formError:p,fieldErrors:b}=Zn(m);b&&(a=a?{...a,...b}:b);const y=nn(c.cause);for(const k of Object.keys(this.state.fieldMeta)){const S=this.getFieldMeta(k);if(!S)continue;const{errorMap:w,errorSourceMap:C}=S,P=a?.[k],{newErrorValue:x,newSource:O}=ii({newFormValidatorError:P,isPreviousErrorFromFormValidator:C?.[y]==="form",previousErrorValue:w?.[y]});w?.[y]!==x&&this.setFieldMeta(k,M=>({...M,errorMap:{...M.errorMap,[y]:x},errorSourceMap:{...M.errorSourceMap,[y]:O}}))}this.baseStore.setState(k=>({...k,errorMap:{...k.errorMap,[y]:p}})),u(a?{fieldErrors:a,errorMapKey:y}:void 0)}))}let i=[];const l={};if(r.length){i=await Promise.all(r);for(const c of i)if(c?.fieldErrors){const{errorMapKey:f}=c;for(const[h,g]of Object.entries(c.fieldErrors)){const m={...l[h]||{},[f]:g};l[h]=m}}}return this.baseStore.setState(c=>({...c,isFormValidating:!1})),l},this.validate=t=>{const{hasErrored:s,fieldsErrorMap:r}=this.validateSync(t);return s&&!this.options.asyncAlways?r:this.validateAsync(t)},this.getFieldValue=t=>St(this.state.values,t),this.getFieldMeta=t=>this.state.fieldMeta[t],this.getFieldInfo=t=>this.fieldInfo[t]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(t,s)=>{this.baseStore.setState(r=>({...r,fieldMetaBase:{...r.fieldMetaBase,[t]:Mn(s,r.fieldMetaBase[t])}}))},this.resetFieldMeta=t=>Object.keys(t).reduce((s,r)=>{const a=r;return s[a]=ns,s},{}),this.setFieldValue=(t,s,r)=>{const a=r?.dontUpdateMeta??!1;Ue(()=>{a||this.setFieldMeta(t,i=>({...i,isTouched:!0,isDirty:!0,errorMap:{...i?.errorMap,onMount:void 0}})),this.baseStore.setState(i=>({...i,values:Pn(i.values,t,s)}))})},this.deleteField=t=>{const r=[...Object.keys(this.fieldInfo).filter(a=>{const i=t.toString();return a!==i&&a.startsWith(i)}),t];this.baseStore.setState(a=>{const i={...a};return r.forEach(l=>{i.values=y1(i.values,l),delete this.fieldInfo[l],delete i.fieldMetaBase[l]}),i})},this.pushFieldValue=(t,s,r)=>{this.setFieldValue(t,a=>[...Array.isArray(a)?a:[],s],r),this.validateField(t,"change")},this.insertFieldValue=async(t,s,r,a)=>{this.setFieldValue(t,i=>[...i.slice(0,s),r,...i.slice(s)],a),await this.validateField(t,"change"),Nn(this).handleArrayFieldMetaShift(t,s,"insert"),await this.validateArrayFieldsStartingFrom(t,s,"change")},this.replaceFieldValue=async(t,s,r,a)=>{this.setFieldValue(t,i=>i.map((l,c)=>c===s?r:l),a),await this.validateField(t,"change"),await this.validateArrayFieldsStartingFrom(t,s,"change")},this.removeFieldValue=async(t,s,r)=>{const a=this.getFieldValue(t),i=Array.isArray(a)?Math.max(a.length-1,0):null;if(this.setFieldValue(t,l=>l.filter((c,f)=>f!==s),r),Nn(this).handleArrayFieldMetaShift(t,s,"remove"),i!==null){const l=`${t}[${i}]`;this.deleteField(l)}await this.validateField(t,"change"),await this.validateArrayFieldsStartingFrom(t,s,"change")},this.swapFieldValues=(t,s,r,a)=>{this.setFieldValue(t,i=>{const l=i[s],c=i[r];return Pn(Pn(i,`${s}`,c),`${r}`,l)},a),Nn(this).handleArrayFieldMetaShift(t,s,"swap",r),this.validateField(t,"change"),this.validateField(`${t}[${s}]`,"change"),this.validateField(`${t}[${r}]`,"change")},this.moveFieldValues=(t,s,r,a)=>{this.setFieldValue(t,i=>{const l=[...i];return l.splice(r,0,l.splice(s,1)[0]),l},a),Nn(this).handleArrayFieldMetaShift(t,s,"move",r),this.validateField(t,"change"),this.validateField(`${t}[${s}]`,"change"),this.validateField(`${t}[${r}]`,"change")},this.clearFieldValues=(t,s)=>{const r=this.getFieldValue(t),a=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(t,[],s),a!==null)for(let i=0;i<=a;i++){const l=`${t}[${i}]`;this.deleteField(l)}this.validateField(t,"change")},this.resetField=t=>{this.baseStore.setState(s=>({...s,fieldMetaBase:{...s.fieldMetaBase,[t]:ns},values:this.options.defaultValues?Pn(s.values,t,St(this.options.defaultValues,t)):s.values}))},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((t,[s,r])=>(Object.keys(r).length&&r.errors.length&&(t[s]={errors:r.errors,errorMap:r.errorMap}),t),{})}),this.parseValuesWithSchema=t=>Ht.validate({value:this.state.values,validationSource:"form"},t),this.parseValuesWithSchemaAsync=t=>Ht.validateAsync({value:this.state.values,validationSource:"form"},t),this.baseStore=new Wc(Us({...n?.defaultState,values:n?.defaultValues??n?.defaultState?.values})),this.fieldMetaDerived=new Kn({deps:[this.baseStore],fn:({prevDepVals:t,currDepVals:s,prevVal:r})=>{const a=r,i=t?.[0],l=s[0];let c=0;const f={};for(const h of Object.keys(l.fieldMetaBase)){const g=l.fieldMetaBase[h],u=i?.fieldMetaBase[h],m=a?.[h],p=St(l.values,h);let b=m?.errors;if(!u||g.errorMap!==u.errorMap){b=Object.values(g.errorMap??{}).filter(C=>C!==void 0);const w=this.getFieldInfo(h)?.instance;w&&!w.options.disableErrorFlat&&(b=b?.flat(1))}const y=!M1(b??[]),k=!g.isDirty,S=Pt(p,St(this.options.defaultValues,h))||Pt(p,this.getFieldInfo(h)?.instance?.options.defaultValue);if(m&&m.isPristine===k&&m.isValid===y&&m.isDefaultValue===S&&m.errors===b&&g===u){f[h]=m,c++;continue}f[h]={...g,errors:b,isPristine:k,isValid:y,isDefaultValue:S}}return Object.keys(l.fieldMetaBase).length&&a&&c===Object.keys(l.fieldMetaBase).length?a:f}}),this.store=new Kn({deps:[this.baseStore,this.fieldMetaDerived],fn:({prevDepVals:t,currDepVals:s,prevVal:r})=>{const a=r,i=t?.[0],l=s[0],c=s[1],f=Object.values(c).filter(Boolean),h=f.some(E=>E.isValidating),g=f.every(E=>E.isValid),u=f.some(E=>E.isTouched),m=f.some(E=>E.isBlurred),p=f.every(E=>E.isDefaultValue),b=u&&l.errorMap?.onMount,y=f.some(E=>E.isDirty),k=!y,S=!!(l.errorMap?.onMount||f.some(E=>E?.errorMap?.onMount)),w=!!h;let C=a?.errors??[];(!i||l.errorMap!==i.errorMap)&&(C=Object.values(l.errorMap).reduce((E,V)=>V===void 0?E:V&&pr(V)?(E.push(V.form),E):(E.push(V),E),[]));const P=C.length===0,x=g&&P,O=this.options.canSubmitWhenInvalid??!1,M=l.submissionAttempts===0&&!u&&!S||!w&&!l.isSubmitting&&x||O;let D=l.errorMap;if(b&&(C=C.filter(E=>E!==l.errorMap.onMount),D=Object.assign(D,{onMount:void 0})),a&&i&&a.errorMap===D&&a.fieldMeta===this.fieldMetaDerived.state&&a.errors===C&&a.isFieldsValidating===h&&a.isFieldsValid===g&&a.isFormValid===P&&a.isValid===x&&a.canSubmit===M&&a.isTouched===u&&a.isBlurred===m&&a.isPristine===k&&a.isDefaultValue===p&&a.isDirty===y&&Pt(i,l))return a;let F={...l,errorMap:D,fieldMeta:this.fieldMetaDerived.state,errors:C,isFieldsValidating:h,isFieldsValid:g,isFormValid:P,isValid:x,canSubmit:M,isTouched:u,isBlurred:m,isPristine:k,isDefaultValue:p,isDirty:y};const I=this.options.transform?.deps??[];if(I.length!==this.prevTransformArray.length||I.some((E,V)=>E!==this.prevTransformArray[V])){const E=Object.assign({},this,{state:F});this.options.transform?.fn(E),F=E.state,this.prevTransformArray=I}return F}}),this.handleSubmit=this.handleSubmit.bind(this),this.update(n||{})}get state(){return this.store.state}get formId(){return this.options.formId}runValidator(n){return hl(n.validate)?Ht[n.type](n.value,n.validate):n.validate(n.value)}async handleSubmit(n){if(this.baseStore.setState(r=>({...r,isSubmitted:!1,submissionAttempts:r.submissionAttempts+1,isSubmitSuccessful:!1})),Ue(()=>{Object.values(this.fieldInfo).forEach(r=>{r.instance&&(r.instance.state.meta.isTouched||r.instance.setMeta(a=>({...a,isTouched:!0})))})}),!this.state.canSubmit)return;const t=n??this.options.onSubmitMeta;this.baseStore.setState(r=>({...r,isSubmitting:!0}));const s=()=>{this.baseStore.setState(r=>({...r,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){s(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}if(await this.validate("submit"),!this.state.isValid){s(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}Ue(()=>{Object.values(this.fieldInfo).forEach(r=>{r.instance?.options.listeners?.onSubmit?.({value:r.instance.state.value,fieldApi:r.instance})})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),Ue(()=>{this.baseStore.setState(r=>({...r,isSubmitted:!0,isSubmitSuccessful:!0})),s()})}catch(r){throw this.baseStore.setState(a=>({...a,isSubmitSuccessful:!1})),s(),r}}setErrorMap(n){Ue(()=>{Object.entries(n).forEach(([t,s])=>{const r=t;if(pr(s)){const{formError:a,fieldErrors:i}=Zn(s);for(const l of Object.keys(this.fieldInfo))this.getFieldMeta(l)&&this.setFieldMeta(l,f=>({...f,errorMap:{...f.errorMap,[r]:i?.[l]},errorSourceMap:{...f.errorSourceMap,[r]:"form"}}));this.baseStore.setState(l=>({...l,errorMap:{...l.errorMap,[r]:a}}))}else this.baseStore.setState(a=>({...a,errorMap:{...a.errorMap,[r]:s}}))})})}}function Zn(e){if(e){if(pr(e)){const n=Zn(e.form).formError,t=e.fields;return{formError:n,fieldErrors:t}}return{formError:e}}return{formError:void 0}}function nn(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class F1{constructor(n){this.options={},this.mount=()=>{const t=this.store.mount();this.options.defaultValue!==void 0&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const s=this.getInfo();s.instance=this,this.update(this.options);const{onMount:r}=this.options.validators||{};if(r){const a=this.runValidator({validate:r,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});a&&this.setMeta(i=>({...i,errorMap:{...i?.errorMap,onMount:a},errorSourceMap:{...i?.errorSourceMap,onMount:"field"}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),t},this.update=t=>{this.options=t;const s=this.name!==t.name;if(this.name=t.name,this.state.value===void 0){const r=St(t.form.options.defaultValues,t.name),a=t.defaultValue??r;s?this.setValue(i=>i||a,{dontUpdateMeta:!0}):a!==void 0&&this.setValue(a,{dontUpdateMeta:!0})}this.form.getFieldMeta(this.name)===void 0&&this.setMeta(this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(t,s)=>{this.form.setFieldValue(this.name,t,s),this.triggerOnChangeListener(),this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=t=>this.form.setFieldMeta(this.name,t),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(t,s)=>{this.form.pushFieldValue(this.name,t,s),this.triggerOnChangeListener()},this.insertValue=(t,s,r)=>{this.form.insertFieldValue(this.name,t,s,r),this.triggerOnChangeListener()},this.replaceValue=(t,s,r)=>{this.form.replaceFieldValue(this.name,t,s,r),this.triggerOnChangeListener()},this.removeValue=(t,s)=>{this.form.removeFieldValue(this.name,t,s),this.triggerOnChangeListener()},this.swapValues=(t,s,r)=>{this.form.swapFieldValues(this.name,t,s,r),this.triggerOnChangeListener()},this.moveValue=(t,s,r)=>{this.form.moveFieldValues(this.name,t,s,r),this.triggerOnChangeListener()},this.clearValues=t=>{this.form.clearFieldValues(this.name,t),this.triggerOnChangeListener()},this.getLinkedFields=t=>{const s=Object.values(this.form.fieldInfo),r=[];for(const a of s){if(!a.instance)continue;const{onChangeListenTo:i,onBlurListenTo:l}=a.instance.options.validators||{};t==="change"&&i?.includes(this.name)&&r.push(a.instance),t==="blur"&&l?.includes(this.name)&&r.push(a.instance)}return r},this.validateSync=(t,s)=>{const r=fr(t,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||$t}),i=this.getLinkedFields(t).reduce((f,h)=>{const g=fr(t,{...h.options,form:h.form,validationLogic:h.form.options.validationLogic||$t});return g.forEach(u=>{u.field=h}),f.concat(g)},[]);let l=!1;Ue(()=>{const f=(h,g)=>{const u=Dn(g.cause),m=g.validate?ci(h.runValidator({validate:g.validate,value:{value:h.store.state.value,validationSource:"field",fieldApi:h},type:"validate"})):void 0,p=s[u],{newErrorValue:b,newSource:y}=oi({formLevelError:p,fieldLevelError:m});h.state.meta.errorMap?.[u]!==b&&h.setMeta(k=>({...k,errorMap:{...k.errorMap,[u]:b},errorSourceMap:{...k.errorSourceMap,[u]:y}})),b&&(l=!0)};for(const h of r)f(this,h);for(const h of i)h.validate&&f(h.field,h)});const c=Dn("submit");return this.state.meta.errorMap?.[c]&&t!=="submit"&&!l&&this.setMeta(f=>({...f,errorMap:{...f.errorMap,[c]:void 0},errorSourceMap:{...f.errorSourceMap,[c]:void 0}})),{hasErrored:l}},this.validateAsync=async(t,s)=>{const r=hr(t,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||$t}),a=await s,i=this.getLinkedFields(t),l=i.reduce((u,m)=>{const p=hr(t,{...m.options,form:m.form,validationLogic:m.form.options.validationLogic||$t});return p.forEach(b=>{b.field=m}),u.concat(p)},[]);this.state.meta.isValidating||this.setMeta(u=>({...u,isValidating:!0}));for(const u of i)u.setMeta(m=>({...m,isValidating:!0}));const c=[],f=[],h=(u,m,p)=>{const b=Dn(m.cause);u.getInfo().validationMetaMap[b]?.lastAbortController.abort();const k=new AbortController;this.getInfo().validationMetaMap[b]={lastAbortController:k},p.push(new Promise(async S=>{let w;try{w=await new Promise((M,D)=>{this.timeoutIds.validations[m.cause]&&clearTimeout(this.timeoutIds.validations[m.cause]),this.timeoutIds.validations[m.cause]=setTimeout(async()=>{if(k.signal.aborted)return M(void 0);try{M(await this.runValidator({validate:m.validate,value:{value:u.store.state.value,fieldApi:u,signal:k.signal,validationSource:"field"},type:"validateAsync"}))}catch(F){D(F)}},m.debounceMs)})}catch(M){w=M}if(k.signal.aborted)return S(void 0);const C=ci(w),P=a[this.name]?.[b],{newErrorValue:x,newSource:O}=oi({formLevelError:P,fieldLevelError:C});u.setMeta(M=>({...M,errorMap:{...M?.errorMap,[b]:x},errorSourceMap:{...M.errorSourceMap,[b]:O}})),S(x)}))};for(const u of r)u.validate&&h(this,u,c);for(const u of l)u.validate&&h(u.field,u,f);let g=[];(c.length||f.length)&&(g=await Promise.all(c),await Promise.all(f)),this.setMeta(u=>({...u,isValidating:!1}));for(const u of i)u.setMeta(m=>({...m,isValidating:!1}));return g.filter(Boolean)},this.validate=(t,s)=>{if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:r}=s?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(t),{hasErrored:a}=this.validateSync(t,r[this.name]??{});if(a&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[Dn(t)]?.lastAbortController.abort(),this.state.meta.errors;const i=s?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(t);return this.validateAsync(t,i)},this.handleChange=t=>{this.setValue(t)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(s=>({...s,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(s=>({...s,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.parseValueWithSchema=t=>Ht.validate({value:this.state.value,validationSource:"field"},t),this.parseValueWithSchemaAsync=t=>Ht.validateAsync({value:this.state.value,validationSource:"field"},t),this.form=n.form,this.name=n.name,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=new Kn({deps:[this.form.store],fn:()=>{const t=this.form.getFieldValue(this.name),s=this.form.getFieldMeta(this.name)??{...ns,...n.defaultMeta};return{value:t,meta:s}}}),this.options=n}get state(){return this.store.state}runValidator(n){return hl(n.validate)?Ht[n.type](n.value,n.validate):n.validate(n.value)}setErrorMap(n){this.setMeta(t=>({...t,errorMap:{...t.errorMap,...n}}))}triggerOnBlurListener(){const n=this.form.options.listeners?.onBlurDebounceMs;n&&n>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},n)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});const t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})}triggerOnChangeListener(){const n=this.form.options.listeners?.onChangeDebounceMs;n&&n>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},n)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});const t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})}}function ci(e){if(e)return e}function Dn(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class ss{constructor(n){if(this.getFormFieldName=t=>{if(typeof this.fieldsMap=="string")return ai(this.fieldsMap,t);const s=Ts(t)[0];if(typeof s!="string")return"";const r=t.slice(s.length),a=this.fieldsMap[s];return ai(a,r)},this.mount=()=>this.store.mount(),this.validateArrayFieldsStartingFrom=async(t,s,r)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(t),s,r),this.validateField=(t,s)=>this.form.validateField(this.getFormFieldName(t),s),this.getFieldValue=t=>this.form.getFieldValue(this.getFormFieldName(t)),this.getFieldMeta=t=>this.form.getFieldMeta(this.getFormFieldName(t)),this.setFieldMeta=(t,s)=>this.form.setFieldMeta(this.getFormFieldName(t),s),this.setFieldValue=(t,s,r)=>this.form.setFieldValue(this.getFormFieldName(t),s,r),this.deleteField=t=>this.form.deleteField(this.getFormFieldName(t)),this.pushFieldValue=(t,s,r)=>this.form.pushFieldValue(this.getFormFieldName(t),s,r),this.insertFieldValue=async(t,s,r,a)=>this.form.insertFieldValue(this.getFormFieldName(t),s,r,a),this.replaceFieldValue=async(t,s,r,a)=>this.form.replaceFieldValue(this.getFormFieldName(t),s,r,a),this.removeFieldValue=async(t,s,r)=>this.form.removeFieldValue(this.getFormFieldName(t),s,r),this.swapFieldValues=(t,s,r,a)=>this.form.swapFieldValues(this.getFormFieldName(t),s,r,a),this.moveFieldValues=(t,s,r,a)=>this.form.moveFieldValues(this.getFormFieldName(t),s,r,a),this.clearFieldValues=(t,s)=>this.form.clearFieldValues(this.getFormFieldName(t),s),this.resetField=t=>this.form.resetField(this.getFormFieldName(t)),this.validateAllFields=t=>this.form.validateAllFields(t),n.form instanceof ss){const t=n.form;if(this.form=t.form,typeof n.fields=="string")this.fieldsMap=t.getFormFieldName(n.fields);else{const s={...n.fields};for(const r in s)s[r]=t.getFormFieldName(s[r]);this.fieldsMap=s}}else this.form=n.form,this.fieldsMap=n.fields;this.store=new Kn({deps:[this.form.store],fn:({currDepVals:t})=>{const s=t[0];let r;if(typeof this.fieldsMap=="string")r=St(s.values,this.fieldsMap);else{r={};const a=this.fieldsMap;for(const i in a)r[i]=St(s.values,a[i])}return{values:r}}})}get state(){return this.store.state}async handleSubmit(n){return this.form.handleSubmit(n)}}const vn=typeof window<"u"?o.useLayoutEffect:o.useEffect;function O1(e){const[n]=o.useState(()=>{const s=new F1({...e,form:e.form,name:e.name});return s.Field=pl,s});return vn(n.mount,[n]),vn(()=>{n.update(e)}),xe(n.store,e.mode==="array"?t=>[t.meta,Object.keys(t.value??[]).length]:void 0),n}const pl=({children:e,...n})=>{const t=O1(n),s=o.useMemo(()=>Mn(e,t),[e,t,t.state.value,t.state.meta]);return d.jsx(d.Fragment,{children:s})};function R1({form:e,selector:n,children:t}){const s=xe(e.store,n);return Mn(t,s)}function I1(e){const[n]=o.useState(()=>{const t=new T1(e),s=t;return s.Field=function(a){return d.jsx(pl,{...a,form:t})},s.Subscribe=function(a){return d.jsx(R1,{form:t,selector:a.selector,children:a.children})},s});return vn(n.mount,[]),vn(()=>{n.update(e)}),n}function A1({lens:e,selector:n,children:t}){const s=xe(e.store,n);return Mn(t,s)}function V1(e){const[n]=o.useState(()=>{const t=new ss(e),s=e.form instanceof ss?e.form.form:e.form,r=t;return r.AppForm=function(i){return d.jsx(s.AppForm,{...i})},r.AppField=function({name:i,...l}){return d.jsx(s.AppField,{name:n.getFormFieldName(i),...l})},r.Field=function({name:i,...l}){return d.jsx(s.Field,{name:n.getFormFieldName(i),...l})},r.Subscribe=function(i){return d.jsx(A1,{lens:n,selector:i.selector,children:i.children})},Object.assign(r,{...e.formComponents})});return vn(n.mount,[n]),n}const ui=o.createContext(null),di=o.createContext(null);function P1(){function e(){const t=o.useContext(ui);if(!t)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return t}function n(){const t=o.useContext(di);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}return{fieldContext:ui,useFieldContext:e,useFormContext:n,formContext:di}}function ma({fieldComponents:e,fieldContext:n,formContext:t,formComponents:s}){function r(l){const c=I1(l),f=o.useMemo(()=>({children:m})=>d.jsx(t.Provider,{value:c,children:m}),[c]),h=o.useMemo(()=>({children:m,...p})=>d.jsx(c.Field,{...p,children:b=>d.jsx(n.Provider,{value:b,children:m(Object.assign(b,e))})}),[c]);return o.useMemo(()=>Object.assign(c,{AppField:h,AppForm:f,...s}),[c,h,f])}function a({render:l,props:c}){return f=>l({...c,...f})}function i({render:l,props:c,defaultValues:f}){return function(g){const u=o.useMemo(()=>({form:g.form,fields:g.fields,defaultValues:f,formComponents:s}),[g.form,g.fields]),m=V1(u);return l({...c,...g,group:m})}}return{useAppForm:r,withForm:a,withFieldGroup:i}}function ga(e){return d.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[d.jsx("title",{children:"Tooltip positioner arrow"}),d.jsx("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"fill-gray-100 dark:fill-slate-900"}),d.jsx("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"fill-gray-200 dark:fill-slate-900"}),d.jsx("path",{d:"M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z",className:"fill-gray-300 dark:fill-slate-900"})]})}const{fieldContext:ba,useFieldContext:Xt,formContext:va,useFormContext:j1}=P1();function N1({id:e,name:n,label:t,...s}){const r=Xt();return d.jsxs("fieldset",{children:[d.jsx("legend",{className:"sr-only",children:n}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"flex h-6 shrink-0 items-center",children:d.jsx("div",{className:"group grid size-4 grid-cols-1",children:d.jsx(nf,{...s,id:e,name:n,checked:r.state.value||!1,onBlur:r.handleBlur,onChange:r.handleChange,className:"group col-start-1 row-start-1 appearance-none rounded-sm border border-gray-300 dark:border-slate-800 bg-white dark:bg-slate-700 checked:border-indigo-600 data-[checked]:border-indigo-600 checked:bg-indigo-600 data-[checked]:bg-indigo-600 indeterminate:border-indigo-600 indeterminate:bg-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:border-gray-300 disabled:bg-gray-100 disabled:checked:bg-gray-100 forced-colors:appearance-auto size-5 inline-flex items-center justify-center",children:d.jsx(it,{className:"group-data-checked:opacity-100 stroke-white text-white opacity-0 size-4","aria-hidden":"true"})})})}),d.jsx("div",{className:"text-sm/6 mt-1",children:d.jsx("label",{htmlFor:n||e,className:"font-medium text-gray-900 dark:text-white",children:t})})]})]})}function Ct(...e){return e.filter(Boolean).join(" ")}function rs(){return d.jsx("div",{className:"flex items-center justify-center",children:d.jsx("div",{className:"w-6 h-6 border-4 border-gray-600 rounded-full animate-spin border-t-transparent"})})}function ml({status:e,tooltip:n,children:t}){const s=j1();return d.jsx(s.Subscribe,{selector:r=>({canSubmit:r.canSubmit,isSubmitting:r.isSubmitting,valid:r.isValid&&r.errors.length===0,dirty:r.isDirty}),children:({canSubmit:r,isSubmitting:a,valid:i,dirty:l})=>n?d.jsx(pa,{delay:300,closeDelay:1e3,children:d.jsxs(ia,{disabled:n.disabled||!1,children:[d.jsx(ca,{type:"submit",disabled:!r||!i||!l||a,"data-state":e,className:Ct("rounded-md bg-indigo-600 dark:bg-indigo-500 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 dark:hover:bg-indigo-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500 inline-flex items-center gap-x-2 cursor-pointer","disabled:bg-gray-400 disabled:text-gray-900 disabled:hover:bg-gray-400 disabled:focus-visible:outline-gray-400 disabled:cursor-not-allowed","data-[state=error]:bg-red-600 data-[state=error]:hover:bg-red-500 data-[state=error]:focus-visible:bg-red-500 data-[state=success]:focus-visible:bg-green-500","data-[state=success]:bg-green-600 data-[state=success]:hover:bg-green-500"),children:e==="submitting"?d.jsx(rs,{}):e==="success"?d.jsxs(d.Fragment,{children:[d.jsx(it,{className:"size-5 text-white","aria-hidden":"true"}),t]}):e==="error"?d.jsxs(d.Fragment,{children:[d.jsx(Jn,{className:"size-5 text-white","aria-hidden":"true"}),"Error"]}):t}),d.jsx(ua,{children:d.jsx(da,{side:"top",sideOffset:10,children:d.jsxs(fa,{className:"box-border text-sm flex flex-col px-2 py-3 rounded-lg bg-gray-100 dark:bg-slate-900 transform-content data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 w-fit max-w-xs",children:[d.jsx(ha,{className:"flex data-[side=top]:-bottom-2 data-[side=top]:rotate-180 data-[side=bottom]:-top-2 data-[side=bottom]:rotate-0 data-[side=left]:-right-3 data-[side=left]:rotate-90 data-[side=right]:-left-3 data-[side=right]:-rotate-90",children:d.jsx(ga,{})}),d.jsx("span",{className:"text-xs text-gray-700 dark:text-white whitespace-break-spaces w-full",children:n.content})]})})})]})}):d.jsx("button",{type:"submit",disabled:!r||!i||!l||a,"data-state":e,className:Ct("rounded-md bg-indigo-600 dark:bg-indigo-500 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 dark:hover:bg-indigo-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500 inline-flex items-center gap-x-2 cursor-pointer","disabled:bg-gray-400 disabled:text-gray-900 disabled:hover:bg-gray-400 disabled:focus-visible:outline-gray-400 disabled:cursor-not-allowed","data-[state=error]:bg-red-600 data-[state=error]:hover:bg-red-500 data-[state=error]:focus-visible:bg-red-500 data-[state=success]:focus-visible:bg-green-500","data-[state=success]:bg-green-600 data-[state=success]:hover:bg-green-500"),children:e==="submitting"?d.jsx(rs,{}):e==="success"?d.jsxs(d.Fragment,{children:[d.jsx(it,{className:"size-5 text-white","aria-hidden":"true"}),t]}):e==="error"?d.jsxs(d.Fragment,{children:[d.jsx(Jn,{className:"size-5 text-white","aria-hidden":"true"}),"Error"]}):t})})}function Fs({id:e,errors:n}){return d.jsx("div",{id:e,className:"mt-2 flex flex-col gap-y-1 w-full",children:n.map((t,s)=>{const r=`${e}__errorMessage__${s}`;return d.jsx("div",{className:"text-sm text-red-600 dark:text-red-500 w-full",children:typeof t=="string"?t:t.message},r)})})}function gl({id:e,label:n,hint:t,...s}){const r=Xt(),a=xe(r.store,c=>c.meta.errors),i=xe(r.store,c=>c.meta.isTouched),l=a.length>0&&i;return d.jsxs("div",{children:[n!=null?d.jsxs("label",{htmlFor:s.name,className:"block text-sm/6 font-medium text-gray-900 dark:text-white",children:[n,s.required?"*":""]}):null,d.jsxs("div",{className:Ct("grid grid-cols-1",n!=null?"mt-2":"mt-0"),children:[d.jsx("div",{"data-state":l?"invalid":void 0,className:"col-start-1 row-start-1 flex items-center rounded-md bg-white dark:bg-white/5 pl-3 outline -outline-offset-1 outline-gray-300 dark:outline-white/10 data-[state=invalid]:outline-red-300 dark:data-[state=invalid]:outline-red-600 focus-within:outline-2 focus-within:-outline-offset-2 focus-within:outline-indigo-600 dark:focus-within:outline-indigo-500 data-[state=invalid]:focus-within:outline-red-600 dark:data-[state=invalid]:focus-within:outline-red-400",children:d.jsx(N0,{...s,value:r.state.value,onBlur:r.handleBlur,onChange:c=>{r.handleChange(c.target.value),s.onChange?.(c)},"data-state":l?"invalid":void 0,"aria-invalid":l?"true":void 0,"aria-describedby":l?`${e}-invalid`:t!=null?`${e}-hint`:void 0,className:"block min-w-0 grow py-1.5 pl-1 pr-3 data-[state=invalid]:pr-10 text-base text-gray-900 dark:text-white data-[state=invalid]:text-red-900 dark:data-[state=invalid]:text-red-700 placeholder:text-gray-400 dark:placeholder:text-gray-500 data-[state=invalid]:placeholder:text-red-700 dark:data-[state=invalid]:placeholder:text-red-400 focus:outline sm:text-sm/6 focus-visible:outline-none"})}),l?d.jsx(Fs,{id:`${e}-invalid`,errors:a}):null,t!=null&&!l?d.jsx("p",{id:`${e}-hint`,className:"mt-3 text-sm/6 text-gray-400",children:t}):null]})]})}function Pe({children:e,...n}){return d.jsx("span",{...n,className:"text-xs inline font-light text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-slate-600 ring-gray-500/10 rounded-md px-1.5 py-0.5 whitespace-nowrap ring-1 ring-inset",children:e})}const D1=Ie({spaceId:Ut,name:Ut}),{useAppForm:L1}=ma({fieldComponents:{SchemaSpaceSelect:H1},formComponents:{SubmitButton:ml},fieldContext:ba,formContext:va});function $1({open:e,setOpen:n,spaceSubmitted:t}){const{setAppSchemaSpace:s}=Bi(),r=o.useId(),i=L1({defaultValues:{spaceId:"",name:""},validators:{onChange:Zi(D1)},onSubmit({value:c}){const f={id:st(c.spaceId),name:c.name};s(f),t(f)}}),l=xe(i.store,c=>c.values.name);return d.jsxs(v0,{open:e,onClose:n,className:"relative z-10",children:[d.jsx(b0,{transition:!0,className:"fixed inset-0 bg-gray-500/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in dark:bg-gray-900/50"}),d.jsx("form",{noValidate:!0,className:"fixed inset-0 z-10 w-screen overflow-y-auto",onSubmit:c=>{c.preventDefault(),c.stopPropagation(),i.handleSubmit()},children:d.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:d.jsxs(Yo,{transition:!0,className:"relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:my-8 sm:w-full sm:max-w-lg sm:p-6 data-closed:sm:translate-y-0 data-closed:sm:scale-95 dark:bg-gray-800 dark:outline dark:-outline-offset-1 dark:outline-white/10",children:[d.jsx("div",{className:"absolute top-0 right-0 hidden pt-4 pr-4 sm:block",children:d.jsxs("button",{type:"button",onClick:()=>n(!1),className:"rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-2 focus:outline-offset-2 focus:outline-indigo-600 dark:bg-gray-800 dark:hover:text-gray-300 dark:focus:outline-white",children:[d.jsx("span",{className:"sr-only",children:"Close"}),d.jsx(Zr,{"aria-hidden":"true",className:"size-6"})]})}),d.jsxs("div",{className:"sm:flex sm:items-start",children:[d.jsx("div",{className:"mx-auto flex size-12 shrink-0 items-center justify-center rounded-full bg-yellow-100 sm:mx-0 sm:size-10 dark:bg-yellow-500/10",children:d.jsx(Br,{"aria-hidden":"true",className:"size-6 text-yellow-600 dark:text-yellow-400"})}),d.jsxs("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[d.jsx(Qo,{as:"h3",className:"text-base font-semibold text-gray-900 dark:text-white",children:"Select Space"}),d.jsx("div",{className:"mt-2 flex flex-col gap-y-4 w-full",children:d.jsx(i.AppField,{name:"spaceId",children:c=>d.jsx(c.SchemaSpaceSelect,{id:r,name:"spaceId",spaceSelected:f=>{i.setFieldValue("name",f.name||f.id),i.setFieldValue("spaceId",f.id)}})})})]})]}),d.jsxs("div",{className:"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse sm:gap-x-2",children:[d.jsx(i.AppForm,{children:d.jsxs(i.SubmitButton,{status:"idle",children:["Select Space ",d.jsx(Pe,{children:l})," & Publish"]})}),d.jsx("button",{type:"button",onClick:()=>{i.reset(void 0,{keepDefaultValues:!0}),n(!1)},className:"mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-xs inset-ring-1 inset-ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",children:"Cancel"})]})]})})})]})}function H1({id:e,name:n,spaceSelected:t}){const{redirectToConnect:s}=yr(),{authenticated:r}=Ui(),{data:a=[],isPending:i}=Ou({mode:"public"}),l=Xt(),c=xe(l.store,u=>u.value),f=xe(l.store,u=>u.meta.errors),h=xe(l.store,u=>u.meta.isTouched),g=f.length>0&&h;return r?!i&&a.length===0?d.jsxs("div",{className:"w-full flex flex-col gap-y-2",children:[d.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Schemas need to be published to a public Space you have granted access to this app"}),d.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300",children:"Reconnect to Geo connect and connect public spaces"}),d.jsx("button",{type:"button",className:"rounded-full bg-slate-900 flex items-center justify-center px-3 py-1.5 text-sm font-semibold text-white shadow-xs ring-1 ring-white/10 ring-inset hover:bg-white/10 cursor-pointer w-full",onClick:()=>s({storage:localStorage,connectUrl:"https://connect.geobrowser.io/",successUrl:`${window.location.origin}/authenticate-callback`,redirectFn(u){window.location.href=u.toString()}}),children:"Connect Spaces"})]}):d.jsxs("div",{className:"relative flex flex-col gap-y-2 w-full",children:[d.jsxs("fieldset",{id:e,name:n,"aria-label":"App Schema Space",onBlur:l.handleBlur,className:"relative -space-y-px rounded-md bg-white dark:bg-gray-800/50 w-full flex flex-col gap-y-2",children:[d.jsx("legend",{className:"mt-1 text-sm/6 text-gray-600 dark:text-gray-400",children:"Select the Space to publish your Hypergraph shema to."}),a.map(u=>d.jsxs("label",{"aria-label":u.name||u.id,"aria-description":`space-${u.id}`,className:"group flex border border-gray-200 p-4 first:rounded-tl-md first:rounded-tr-md last:rounded-br-md last:rounded-bl-md focus:outline-hidden has-checked:relative has-checked:border-indigo-200 has-checked:bg-indigo-50 dark:border-gray-700 dark:has-checked:border-indigo-800 dark:has-checked:bg-indigo-500/10 w-full cursor-pointer",children:[d.jsx("input",{value:u.id,checked:u.id===c,onChange:m=>{m.target.checked&&(l.handleChange(u.id),t(u))},name:n,type:"radio",className:"relative mt-0.5 size-4 shrink-0 appearance-none rounded-full border border-gray-300 bg-white before:absolute before:inset-1 before:rounded-full before:bg-white not-checked:before:hidden checked:border-indigo-600 checked:bg-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:border-gray-300 disabled:bg-gray-100 disabled:before:bg-gray-400 dark:border-white/10 dark:bg-white/5 dark:checked:border-indigo-500 dark:checked:bg-indigo-500 dark:focus-visible:outline-indigo-500 dark:disabled:border-white/5 dark:disabled:bg-white/10 dark:disabled:before:bg-white/20 forced-colors:appearance-auto forced-colors:before:hidden"}),d.jsxs("span",{className:"ml-3 flex flex-col gap-y-1",children:[d.jsx("span",{className:"flex items-center gap-x-2 text-sm font-medium text-gray-900 group-has-checked:text-indigo-900 dark:text-white dark:group-has-checked:text-indigo-300",children:u.name||u.id}),d.jsx("span",{className:"block text-sm text-gray-500 group-has-checked:text-indigo-700 dark:text-gray-400 dark:group-has-checked:text-indigo-300/75",children:u.name!=null?d.jsx(Pe,{children:u.id}):null})]})]},u.id))]}),g?d.jsx(Fs,{id:`${e}-invalid`,errors:f}):null]}):d.jsx("button",{type:"button",className:"rounded-full bg-slate-900 flex items-center justify-center px-3 py-1.5 text-sm font-semibold text-white shadow-xs ring-1 ring-white/10 ring-inset hover:bg-white/10 cursor-pointer w-full",onClick:()=>s({storage:localStorage,connectUrl:"https://connect.geobrowser.io/",successUrl:`${window.location.origin}/authenticate-callback`,redirectFn(u){window.location.href=u.toString()}}),children:"Sign in to Geo Account"})}function _1(e){return d.jsx("span",{className:"hidden dark:inline-block",children:d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"hidden dark:inline-block",...e,children:[d.jsx("title",{children:"Published to Knowledge Graph"}),d.jsxs("g",{clipPath:"url(#clip0_59284_4458)",children:[d.jsx("circle",{cx:"8.0032",cy:"1.75",r:"1.25",stroke:"white"}),d.jsx("circle",{cx:"8.0032",cy:"14.25",r:"1.25",stroke:"white"}),d.jsx("path",{d:"M7.99641 13.255L8.0032 2.75",stroke:"white"}),d.jsx("circle",{cx:"13.4159",cy:"5.125",r:"1.25",transform:"rotate(60 13.4159 5.125)",stroke:"white"}),d.jsx("circle",{cx:"2.59055",cy:"11.375",r:"1.25",transform:"rotate(60 2.59055 11.375)",stroke:"white"}),d.jsx("path",{d:"M3.44885 10.8716L12.5498 5.625",stroke:"white"}),d.jsx("circle",{cx:"13.4159",cy:"11.375",r:"1.25",transform:"rotate(120 13.4159 11.375)",stroke:"white"}),d.jsx("circle",{cx:"2.59055",cy:"5.125",r:"1.25",transform:"rotate(120 2.59055 5.125)",stroke:"white"}),d.jsx("path",{d:"M3.45564 5.61662L12.5498 10.875",stroke:"white"})]}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_59284_4458",children:d.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})})}function B1(e){return d.jsx("span",{className:"inline-block dark:hidden",children:d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"inline-block dark:hidden",...e,children:[d.jsx("title",{children:"Published to Knowledge Graph"}),d.jsxs("g",{clipPath:"url(#clip0_59285_4572)",children:[d.jsx("circle",{cx:"8.0032",cy:"1.75",r:"1.25",stroke:"#2A2A2A"}),d.jsx("circle",{cx:"8.0032",cy:"14.25",r:"1.25",stroke:"#2A2A2A"}),d.jsx("path",{d:"M7.99641 13.255L8.0032 2.75",stroke:"#2A2A2A"}),d.jsx("circle",{cx:"13.4159",cy:"5.125",r:"1.25",transform:"rotate(60 13.4159 5.125)",stroke:"#2A2A2A"}),d.jsx("circle",{cx:"2.59055",cy:"11.375",r:"1.25",transform:"rotate(60 2.59055 11.375)",stroke:"#2A2A2A"}),d.jsx("path",{d:"M3.44885 10.8716L12.5498 5.625",stroke:"#2A2A2A"}),d.jsx("circle",{cx:"13.4159",cy:"11.375",r:"1.25",transform:"rotate(120 13.4159 11.375)",stroke:"#2A2A2A"}),d.jsx("circle",{cx:"2.59055",cy:"5.125",r:"1.25",transform:"rotate(120 2.59055 5.125)",stroke:"#2A2A2A"}),d.jsx("path",{d:"M3.45564 5.61662L12.5498 10.875",stroke:"#2A2A2A"})]}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_59285_4572",children:d.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})})}function bl(e){return d.jsxs(d.Fragment,{children:[d.jsx(_1,{...e}),d.jsx(B1,{...e})]})}const Z1={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SchemaBrowserTypes"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"first"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"typesList"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"Variable",name:{kind:"Name",value:"first"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"properties"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"dataType"}},{kind:"Field",name:{kind:"Name",value:"relationValueTypes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"properties"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"dataType"}}]}}]}}]}}]}}]}}]},U1={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"TypeSearch"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"first"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",alias:{kind:"Name",value:"typesList"},name:{kind:"Name",value:"search"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}},{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"Variable",name:{kind:"Name",value:"first"}}},{kind:"Argument",name:{kind:"Name",value:"filter"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"backlinksExist"},value:{kind:"BooleanValue",value:!0}},{kind:"ObjectField",name:{kind:"Name",value:"typeIds"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"in"},value:{kind:"ListValue",values:[{kind:"StringValue",value:"e7d737c5-3676-4c60-9fa1-6aa64a8c90ad",block:!1}]}}]}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"properties"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"dataType"}},{kind:"Field",name:{kind:"Name",value:"relationValueTypes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"properties"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"dataType"}}]}}]}}]}}]}}]}}]},z1={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"Properties"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"first"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"properties"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"Variable",name:{kind:"Name",value:"first"}}},{kind:"Argument",name:{kind:"Name",value:"filter"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"or"},value:{kind:"ListValue",values:[{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"name"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"includesInsensitive"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}}]}}]},{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"description"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"includesInsensitive"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}}]}}]}]}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"dataType"}},{kind:"Field",name:{kind:"Name",value:"relationValueTypes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"properties"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"dataType"}},{kind:"Field",name:{kind:"Name",value:"name"}}]}}]}}]}}]}}]},G1={"\n query SchemaBrowserTypes($first: Int) {\n typesList(first: $first) {\n id\n name\n description\n properties {\n id\n name\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n name\n dataType\n }\n }\n }\n }\n }\n":Z1,'\n query TypeSearch($query: String!, $first: Int) {\n typesList: search(\n query: $query\n first: $first\n filter: {backlinksExist: true, typeIds: {in: ["e7d737c5-3676-4c60-9fa1-6aa64a8c90ad"]}}\n ) {\n id\n name\n description\n properties {\n id\n name\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n name\n dataType\n }\n }\n }\n }\n }\n':U1,"\n query Properties($query: String, $first: Int) {\n properties(\n first: $first\n filter: {or: [{name: {includesInsensitive: $query}}, {description: {includesInsensitive: $query}}]}\n ) {\n id\n name\n description\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n name\n }\n }\n }\n }\n":z1};function ya(e){return G1[e]??{}}const q1=ya(`
|
|
14
|
+
query SchemaBrowserTypes($first: Int) {
|
|
15
|
+
typesList(first: $first) {
|
|
16
|
+
id
|
|
17
|
+
name
|
|
18
|
+
description
|
|
19
|
+
properties {
|
|
20
|
+
id
|
|
21
|
+
name
|
|
22
|
+
dataType
|
|
23
|
+
relationValueTypes {
|
|
24
|
+
id
|
|
25
|
+
name
|
|
26
|
+
description
|
|
27
|
+
properties {
|
|
28
|
+
id
|
|
29
|
+
name
|
|
30
|
+
dataType
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`),K1=ya(`
|
|
37
|
+
query TypeSearch($query: String!, $first: Int) {
|
|
38
|
+
typesList: search(
|
|
39
|
+
query: $query
|
|
40
|
+
first: $first
|
|
41
|
+
filter: {backlinksExist: true, typeIds: {in: ["e7d737c5-3676-4c60-9fa1-6aa64a8c90ad"]}}
|
|
42
|
+
) {
|
|
43
|
+
id
|
|
44
|
+
name
|
|
45
|
+
description
|
|
46
|
+
properties {
|
|
47
|
+
id
|
|
48
|
+
name
|
|
49
|
+
dataType
|
|
50
|
+
relationValueTypes {
|
|
51
|
+
id
|
|
52
|
+
name
|
|
53
|
+
description
|
|
54
|
+
properties {
|
|
55
|
+
id
|
|
56
|
+
name
|
|
57
|
+
dataType
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`);async function W1(e=null,n=100){try{return e?await Js.request(K1,{query:e,first:n}):await Js.request(q1,{first:n})}catch{return console.error("failure fetching schema types"),{__typename:"Query",typesList:[]}}}const vl=Ie({id:vs,dataType:br("STRING","NUMBER","BOOLEAN","TIME","POINT","RELATION"),name:Ut}),Y1=Ie({id:vs,name:Ut,description:_t(Ut),properties:_t(ht(vl))}),yl=Ie({...vl.fields,relationValueTypes:ht(Y1)}),Q1=Ie({id:vs,name:Ut,properties:ht(yl)});Q1.pipe(vr(Ie({slug:Le})));const X1=zi(Gi,e=>e.name||e.id);function J1(e){const n=ae(e.properties??[],ge(t=>t!=null),et("",(t,s)=>`${t}${s.name}`));return`${e.name||""}${n}`.toLowerCase()}const eh=e=>({queryKey:["Hypergraph","Typesync","Studio","Schema","types",e],async queryFn(){return await W1(e.query,e.first||void 0).then(n=>n.typesList??[]).then(n=>ae(n,ge(t=>t!=null&&t.name!=null),ve(t=>{const s=ae(t.properties??[],ge(i=>i!=null&&i.name!=null),ve(i=>({id:i.id,dataType:i.dataType,name:i.name,relationValueTypes:ae(i.relationValueTypes??[],ge(l=>l!=null&&l.name!=null),ve(l=>({id:l.id,name:l.name,description:l.description||null,properties:ae(l.properties??[],ge(c=>c.name!=null),ve(c=>({id:c.id,dataType:c.dataType,name:c.name})))})))}))),r={id:t.id,name:t.name,properties:s},a=J1(r);return{...r,slug:a}}),qi(X1)))}});function xl(e={query:null,first:100},n={}){return $r({...eh(e),...n})}const th=ya(`
|
|
64
|
+
query Properties($query: String, $first: Int) {
|
|
65
|
+
properties(
|
|
66
|
+
first: $first
|
|
67
|
+
filter: {or: [{name: {includesInsensitive: $query}}, {description: {includesInsensitive: $query}}]}
|
|
68
|
+
) {
|
|
69
|
+
id
|
|
70
|
+
name
|
|
71
|
+
description
|
|
72
|
+
dataType
|
|
73
|
+
relationValueTypes {
|
|
74
|
+
id
|
|
75
|
+
name
|
|
76
|
+
description
|
|
77
|
+
properties {
|
|
78
|
+
id
|
|
79
|
+
dataType
|
|
80
|
+
name
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`);async function nh(e=null,n=100){try{return await Js.request(th,{query:e,first:n})}catch{return console.error("failure fetching schema types"),{__typename:"Query",properties:[]}}}yl.pipe(vr(Ie({description:_t(Le),slug:Yc})));const sh=zi(Gi,e=>e.name||e.id),rh=e=>({queryKey:["Hypergraph","Typesync","Studio","Schema","properties",e],async queryFn(){return await nh(e.query,e.first||void 0).then(n=>n.properties??[]).then(n=>ae(n,ge(t=>t.name!=null),ve(t=>{const s=`${t.dataType}${t.name||""}${t.id}`.toLowerCase();return{id:t.id,dataType:t.dataType,name:t.name,description:t.description||null,relationValueTypes:ae(t.relationValueTypes??[],ge(a=>a!=null&&a.name!=null),ve(a=>({id:a.id,name:a.name,description:a.description||null,properties:ae(a.properties??[],ge(i=>i.name!=null),ve(i=>({id:i.id,dataType:i.dataType,name:i.name})))}))),slug:s}}),qi(sh)))}});function ah(e={query:null,first:100},n={}){return $r({...rh(e),...n})}function yt(e,n){switch(e){case"BOOLEAN":return"Boolean";case"NUMBER":return"Number";case"POINT":return"Point";case"TIME":return"Date";case"RELATION":return`Relation(${n})`;default:return"String"}}const{useAppForm:ih}=ma({fieldComponents:{TextField:gl},formComponents:{},fieldContext:ba,formContext:va});function oh({typeSelected:e}){const[n,t]=o.useState(""),s=ih({defaultValues:{search:""},asyncDebounceMs:300}),{data:r,isLoading:a}=xl({query:nt(n)?Mt(n):null,first:100},{refetchOnMount:!1,refetchOnWindowFocus:!1}),i=o.useId();return d.jsxs("div",{className:"flex flex-col gap-y-6",children:[d.jsxs("div",{className:"border-b border-gray-200 dark:border-white/20 pb-5 h-20",children:[d.jsxs("h3",{className:"text-sm/6 font-semibold text-gray-900 dark:text-white flex items-center gap-x-3",children:["Schema Browser",a?d.jsx(rs,{}):null]}),d.jsx("p",{className:"mt-2 max-w-4xl text-sm text-gray-500 dark:text-gray-200",children:"Browse existing schemas/types from the Knowledge Graph to add to your schema."})]}),d.jsxs("div",{className:"bg-gray-100 dark:bg-slate-900 rounded-lg flex flex-col gap-y-3 pt-2",children:[d.jsx("div",{className:"px-3 mt-2",children:d.jsx(s.AppField,{name:"search",listeners:{onChangeDebounceMs:300,onChange({value:l}){t(l)}},children:l=>d.jsx(l.TextField,{id:i,name:"search",type:"search",placeholder:"Search Knowledge Graph types..."})})}),d.jsx("ul",{className:"px-4 divide-y divide-gray-100 dark:divide-gray-700 overflow-y-auto h-[500px] 2xl:h-[850px]",children:(r??[]).map(l=>{const c=ge(l.properties??[],f=>f!=null);return d.jsxs(V0,{as:"li",className:"py-3 flex flex-col gap-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-x-6",children:[d.jsx(Jo,{as:"div","data-interactive":"clickable",className:"min-w-0 data-[interactive=clickable]:cursor-pointer group",children:d.jsxs("div",{className:"flex items-center gap-x-2",children:[d.jsx(Mo,{className:"size-4 hidden group-data-open:flex","aria-hidden":"true"}),d.jsx(Co,{className:"size-4 flex group-data-open:hidden","aria-hidden":"true"}),d.jsx("p",{className:"text-sm/6 font-semibold text-gray-900 dark:text-white",children:l.name||l.id}),d.jsx("div",{className:"hidden 2xl:block",children:d.jsx(Pe,{children:l.id})}),d.jsx("div",{className:"block 2xl:hidden",children:d.jsx(Pe,{children:`${l.id.substring(0,6)}...${l.id.substring(l.id.length-6,l.id.length)}`})})]})}),d.jsx("div",{className:"flex flex-none items-center justify-end",children:d.jsx("button",{type:"button",className:"rounded-md bg-white dark:bg-black p-2 cursor-pointer text-sm font-semibold text-gray-900 dark:text-white shadow-xs ring-1 ring-gray-300 dark:ring-black/15 ring-inset hover:bg-gray-50 dark:hover:bg-slate-950 inline-flex flex-col items-center justify-center",onClick:()=>e(l),children:d.jsx(es,{className:"size-5 text-gray-400 dark:text-gray-200 group-data-focus:text-gray-500 dark:group-data-focus:text-gray-200","aria-hidden":"true"})})})]}),d.jsx(el,{as:"div",transition:!0,className:"w-full origin-top transition duration-200 ease-out data-closed:-translate-y-6 data-closed:opacity-0 py-1.5 flex flex-col gap-y-1",children:d.jsx("ul",{className:"w-full pl-6 pr-3 divide-y divide-gray-300 dark:divide-gray-800",children:c.map(f=>d.jsxs("li",{className:"w-full text-xs py-1.5 flex items-center gap-x-2 list-disc",children:[f.name||f.id,f.dataType!=null?d.jsx(Pe,{children:yt(f.dataType,f.name||f.id)}):null]},f.id))})})]},l.id)})})]})]})}var zs,fi;function lh(){if(fi)return zs;fi=1;var e="Expected a function",n=NaN,t="[object Symbol]",s=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,i=/^0o[0-7]+$/i,l=parseInt,c=typeof Fn=="object"&&Fn&&Fn.Object===Object&&Fn,f=typeof self=="object"&&self&&self.Object===Object&&self,h=c||f||Function("return this")(),g=Object.prototype,u=g.toString,m=Math.max,p=Math.min,b=function(){return h.Date.now()};function y(P,x,O){var M,D,F,I,T,E,V=0,j=!1,K=!1,L=!0;if(typeof P!="function")throw new TypeError(e);x=C(x)||0,k(O)&&(j=!!O.leading,K="maxWait"in O,F=K?m(C(O.maxWait)||0,x):F,L="trailing"in O?!!O.trailing:L);function N(R){var $=M,_=D;return M=D=void 0,V=R,I=P.apply(_,$),I}function Z(R){return V=R,T=setTimeout(z,x),j?N(R):I}function q(R){var $=R-E,_=R-V,G=x-$;return K?p(G,F-_):G}function Y(R){var $=R-E,_=R-V;return E===void 0||$>=x||$<0||K&&_>=F}function z(){var R=b();if(Y(R))return H(R);T=setTimeout(z,q(R))}function H(R){return T=void 0,L&&M?N(R):(M=D=void 0,I)}function B(){T!==void 0&&clearTimeout(T),V=0,M=E=D=T=void 0}function J(){return T===void 0?I:H(b())}function A(){var R=b(),$=Y(R);if(M=arguments,D=this,E=R,$){if(T===void 0)return Z(E);if(K)return T=setTimeout(z,x),N(E)}return T===void 0&&(T=setTimeout(z,x)),I}return A.cancel=B,A.flush=J,A}function k(P){var x=typeof P;return!!P&&(x=="object"||x=="function")}function S(P){return!!P&&typeof P=="object"}function w(P){return typeof P=="symbol"||S(P)&&u.call(P)==t}function C(P){if(typeof P=="number")return P;if(w(P))return n;if(k(P)){var x=typeof P.valueOf=="function"?P.valueOf():P;P=k(x)?x+"":x}if(typeof P!="string")return P===0?P:+P;P=P.replace(s,"");var O=a.test(P);return O||i.test(P)?l(P.slice(2),O?2:8):r.test(P)?n:+P}return zs=y,zs}var ch=lh();const wl=Qc(ch);function uh({id:e,label:n,propertySelected:t,...s}){const r=Xt(),a=xe(r.store,p=>p.value),i=xe(r.store,p=>p.meta.errors),l=xe(r.store,p=>p.meta.isTouched),c=i.length>0&&l,[f,h]=o.useState(""),g=wl(p=>{h(p)},300),{data:u}=ah({query:nt(f)?Mt(f):null,first:50},{refetchOnMount:!1,refetchOnWindowFocus:!1}),m=u??[];return d.jsxs(Ho,{value:a,onChange:p=>{if(p==null){r.handleChange("");return}if(typeof p=="string"){r.handleChange(p);return}r.handleChange(p.name||p.id),t(p)},onClose:()=>g(""),immediate:!0,children:[n!=null?d.jsxs(wn,{htmlFor:s.name||e,className:"block text-sm/6 font-medium text-gray-900 dark:text-white",children:[n,s.required?"*":""]}):null,d.jsxs("div",{className:Ct("grid grid-cols-1 relative",n!=null?"mt-2":"mt-0"),children:[d.jsx(Wr,{className:"block min-w-0 grow py-1.5 pr-12 data-[state=invalid]:pr-10 text-base bg-white dark:bg-white/5 pl-3 outline -outline-offset-1 outline-gray-300 dark:outline-white/10 rounded-md text-gray-900 dark:text-white data-[state=invalid]:text-red-900 dark:data-[state=invalid]:text-red-700 placeholder:text-gray-400 dark:placeholder:text-gray-500 data-[state=invalid]:placeholder:text-red-700 dark:data-[state=invalid]:placeholder:text-red-400 focus:outline sm:text-sm/6 focus-visible:outline-none",onChange:p=>{const b=p.target.value;g(b),r.handleChange(b)},onBlur:()=>h(""),displayValue:p=>p}),d.jsx(Kr,{className:"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-hidden cursor-pointer",children:d.jsx(xs,{className:"size-5 text-gray-400 dark:text-gray-50","aria-hidden":"true"})}),m.length>0||nt(f)?d.jsxs(Yr,{className:"absolute z-10 mt-10 max-h-60 w-fit max-w-lg 2xl:max-w-xl overflow-y-auto overflow-x-hidden rounded-md bg-white dark:bg-slate-700 py-1 text-base shadow-lg ring-1 ring-black/5 dark:ring-black/10 focus:outline-hidden sm:text-sm",children:[m.map(p=>d.jsxs(bn,{value:p,"data-selected":a===p.name||a===p.id?!0:void 0,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:[d.jsxs("div",{className:"flex-auto flex flex-col gap-y-1",children:[d.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[d.jsxs("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-100 group-data-focus:text-gray-900 dark:group-data-focus:text-white flex items-center gap-x-1.5",children:[p.name||p.id,d.jsx(Pe,{children:yt(p.dataType,p.name||p.id)})]}),d.jsx("p",{className:"hidden 2xl:block 2xl:w-fit",children:d.jsx(Pe,{children:p.id})}),d.jsx("p",{className:"w-fit block 2xl:hidden",children:d.jsx(Pe,{children:Xc(p.id)})})]}),d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-300 group-data-focus:text-gray-700 dark:group-data-focus:text-gray-50",children:p.description})]}),d.jsx("span",{className:"absolute inset-y-0 right-0 hidden items-center pr-4 text-indigo-600 group-data-focus:text-white group-data-selected:flex",children:d.jsx(it,{className:"size-5","aria-hidden":"true"})})]},p.id)),nt(f)?d.jsx(bn,{value:f,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden border-t border-gray-300 dark:border-white/10",children:d.jsxs("span",{className:"flex items-center gap-x-1.5 truncate group-data-selected:font-semibold",children:["New Property: ",d.jsx(Pe,{children:f})]})},"user_entered"):null]}):null]}),c?d.jsx(Fs,{id:`${e}-invalid`,errors:i}):null]})}function hi({status:e}){const n=wh[e||"typesync_ui"];return d.jsx(pa,{delay:500,closeDelay:500,children:d.jsxs(ia,{children:[d.jsx(ca,{"aria-label":e||void 0,children:d.jsx(dh,{status:e})}),d.jsx(ua,{children:d.jsx(da,{side:"top",sideOffset:10,children:d.jsxs(fa,{className:"box-border text-sm flex flex-col px-2 py-3 rounded-lg bg-gray-100 dark:bg-slate-900 transform-content data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 w-fit max-w-xs",children:[d.jsx(ha,{className:"flex data-[side=top]:-bottom-2 data-[side=top]:rotate-180 data-[side=bottom]:-top-2 data-[side=bottom]:rotate-0 data-[side=left]:-right-3 data-[side=left]:rotate-90 data-[side=right]:-left-3 data-[side=right]:-rotate-90",children:d.jsx(ga,{})}),d.jsx("span",{className:"text-xs text-gray-700 dark:text-white whitespace-break-spaces w-full",children:n})]})})})]})})}function dh({status:e}){return e==="published"?d.jsx(bl,{className:"size-4 text-inherit","aria-hidden":"true"}):e==="published_not_synced"?d.jsx(xh,{className:"size-4 text-inherit","aria-hidden":"true"}):e==="synced"?d.jsx(bh,{className:"size-4 text-inherit","aria-hidden":"true"}):d.jsx(ph,{className:"size-4 text-inherit","aria-hidden":"true"})}function fh(e){return d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[d.jsx("title",{children:"Exists in the Typesync UI | Light Mode"}),d.jsxs("g",{clipPath:"url(#clip0_59285_4556)",children:[d.jsx("path",{d:"M2 15.0588V14.3091C2 14.029 2.23019 13.8035 2.5103 13.8092V13.8092C2.78237 13.8148 3 14.037 3 14.3091V15H3.63191C3.90805 15 4.13191 15.2239 4.13191 15.5V15.5C4.13191 15.7761 3.90805 16 3.63191 16H2.92308C2.41328 16 2 15.5786 2 15.0588ZM7.01683 15C7.29297 15 7.51683 15.2239 7.51683 15.5V15.5C7.51683 15.7761 7.29297 16 7.01683 16H5.59916C5.32302 16 5.09916 15.7761 5.09916 15.5V15.5C5.09916 15.2239 5.32302 15 5.59916 15H7.01683ZM10.4008 15C10.677 15 10.9008 15.2239 10.9008 15.5V15.5C10.9008 15.7761 10.677 16 10.4008 16H8.98317C8.70703 16 8.48317 15.7761 8.48317 15.5V15.5C8.48317 15.2239 8.70703 15 8.98317 15H10.4008ZM13 15V14.3244C13 14.0483 13.2239 13.8244 13.5 13.8244V13.8244C13.7761 13.8244 14 14.0483 14 14.3244V15.0588C14 15.5786 13.5867 16 13.0769 16H12.3681C12.0919 16 11.8681 15.7761 11.8681 15.5V15.5C11.8681 15.2239 12.0919 15 12.3681 15H13ZM13.4897 10.3772C13.7698 10.3715 14 10.597 14 10.8771V12.3466C14 12.6187 13.7824 12.8409 13.5103 12.8465V12.8465C13.2302 12.8523 13 12.6268 13 12.3466V10.8771C13 10.605 13.2176 10.3829 13.4897 10.3772V10.3772ZM2.5 10.2693C2.77614 10.2693 3 10.4932 3 10.7693V12.2895C3 12.5657 2.77614 12.7895 2.5 12.7895V12.7895C2.22386 12.7895 2 12.5657 2 12.2895V10.7693C2 10.4932 2.22386 10.2693 2.5 10.2693V10.2693ZM13.4409 6.93133C13.7462 6.91964 14 7.16393 14 7.46939V8.86135C14 9.15072 13.7713 9.38835 13.4821 9.39942V9.39942C13.1769 9.4111 12.9231 9.16681 12.9231 8.86135V7.46939C12.9231 7.18002 13.1518 6.9424 13.4409 6.93133V6.93133ZM2.5103 6.75041C2.78237 6.75602 3 6.97817 3 7.2503V8.77031C3 9.05048 2.76981 9.27598 2.4897 9.2702V9.2702C2.21763 9.2646 2 9.04244 2 8.77031V7.2503C2 6.97013 2.23019 6.74463 2.5103 6.75041V6.75041ZM13 4.6875C13 4.5446 13.0133 4.40913 12.9038 4.31985L12.5418 4.02492C12.3444 3.86411 12.3122 3.57483 12.4694 3.37453V3.37453C12.6307 3.16885 12.9295 3.13568 13.1321 3.30096L13.4808 3.58548C13.809 3.85336 14 4.25884 14 4.6875V5.42188C14 5.69802 13.7761 5.92188 13.5 5.92188V5.92188C13.2239 5.92188 13 5.69802 13 5.42187V4.6875ZM2.5 3.21048C2.77614 3.21048 3 3.43434 3 3.71048V5.2307C3 5.50684 2.77614 5.7307 2.5 5.7307V5.7307C2.22386 5.7307 2 5.50684 2 5.2307V3.71048C2 3.43434 2.22386 3.21048 2.5 3.21048V3.21048ZM11.8346 2.24245C12.0319 2.40333 12.064 2.69258 11.9069 2.89288V2.89288C11.7455 3.09859 11.4467 3.13178 11.2441 2.96649L10.5409 2.39283C10.3398 2.22878 10.3071 1.93395 10.4672 1.72978V1.72978V1.72978C10.6251 1.52795 10.918 1.49516 11.1166 1.65707L11.8346 2.24245ZM2 0.941176C2 0.421379 2.41328 1.13692e-08 2.92308 0H3.4363C3.71244 0 3.9363 0.223858 3.9363 0.5V0.5C3.9363 0.776142 3.71244 1 3.4363 1H2.92308V1.73975C2.92308 1.99465 2.71644 2.20129 2.46154 2.20129V2.20129C2.20664 2.20129 2 1.99465 2 1.73975V0.941176ZM8.59946 0C8.9138 4.16766e-05 9.21848 0.109521 9.46394 0.309743L9.82608 0.604764C10.0234 0.765522 10.0556 1.05471 9.89852 1.25496V1.25496C9.73712 1.46066 9.43828 1.49374 9.2358 1.32832L8.88792 1.04412C8.80613 0.977403 8.7042 1.00004 8.59946 1H8.08534C7.80919 1 7.58534 0.776142 7.58534 0.5V0.5C7.58534 0.223858 7.80919 0 8.08534 0H8.59946ZM6.27494 0C6.55108 0 6.77494 0.223858 6.77494 0.5V0.5C6.77494 0.776142 6.55108 1 6.27494 1H5.2476C4.97145 1 4.7476 0.776142 4.7476 0.5V0.5C4.7476 0.223858 4.97145 0 5.2476 0H6.27494Z",fill:"#2A2A2A"}),d.jsx("path",{d:"M8.01689 0L8.00154 4.99847C8.00069 5.27521 8.2248 5.5 8.50154 5.5H14",stroke:"#2A2A2A"})]}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_59285_4556",children:d.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function hh(e){return d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[d.jsx("title",{children:"Exists in the Typesync UI | Dark Mode"}),d.jsxs("g",{clipPath:"url(#clip0_59284_4447)",children:[d.jsx("path",{d:"M2 15.0588V14.3091C2 14.029 2.23019 13.8035 2.5103 13.8092V13.8092C2.78237 13.8148 3 14.037 3 14.3091V15H3.63191C3.90805 15 4.13191 15.2239 4.13191 15.5V15.5C4.13191 15.7761 3.90805 16 3.63191 16H2.92308C2.41328 16 2 15.5786 2 15.0588ZM7.01683 15C7.29297 15 7.51683 15.2239 7.51683 15.5V15.5C7.51683 15.7761 7.29297 16 7.01683 16H5.59916C5.32302 16 5.09916 15.7761 5.09916 15.5V15.5C5.09916 15.2239 5.32302 15 5.59916 15H7.01683ZM10.4008 15C10.677 15 10.9008 15.2239 10.9008 15.5V15.5C10.9008 15.7761 10.677 16 10.4008 16H8.98317C8.70703 16 8.48317 15.7761 8.48317 15.5V15.5C8.48317 15.2239 8.70703 15 8.98317 15H10.4008ZM13 15V14.3244C13 14.0483 13.2239 13.8244 13.5 13.8244V13.8244C13.7761 13.8244 14 14.0483 14 14.3244V15.0588C14 15.5786 13.5867 16 13.0769 16H12.3681C12.0919 16 11.8681 15.7761 11.8681 15.5V15.5C11.8681 15.2239 12.0919 15 12.3681 15H13ZM13.4897 10.3772C13.7698 10.3715 14 10.597 14 10.8771V12.3466C14 12.6187 13.7824 12.8409 13.5103 12.8465V12.8465C13.2302 12.8523 13 12.6268 13 12.3466V10.8771C13 10.605 13.2176 10.3829 13.4897 10.3772V10.3772ZM2.5 10.2693C2.77614 10.2693 3 10.4932 3 10.7693V12.2895C3 12.5657 2.77614 12.7895 2.5 12.7895V12.7895C2.22386 12.7895 2 12.5657 2 12.2895V10.7693C2 10.4932 2.22386 10.2693 2.5 10.2693V10.2693ZM13.4409 6.93133C13.7462 6.91964 14 7.16393 14 7.46939V8.86135C14 9.15072 13.7713 9.38835 13.4821 9.39942V9.39942C13.1769 9.4111 12.9231 9.16681 12.9231 8.86135V7.46939C12.9231 7.18002 13.1518 6.9424 13.4409 6.93133V6.93133ZM2.5103 6.75041C2.78237 6.75602 3 6.97817 3 7.2503V8.77031C3 9.05048 2.76981 9.27598 2.4897 9.2702V9.2702C2.21763 9.2646 2 9.04244 2 8.77031V7.2503C2 6.97013 2.23019 6.74463 2.5103 6.75041V6.75041ZM13 4.6875C13 4.5446 13.0133 4.40913 12.9038 4.31985L12.5418 4.02492C12.3444 3.86411 12.3122 3.57483 12.4694 3.37453V3.37453C12.6307 3.16885 12.9295 3.13568 13.1321 3.30096L13.4808 3.58548C13.809 3.85336 14 4.25884 14 4.6875V5.42188C14 5.69802 13.7761 5.92188 13.5 5.92188V5.92188C13.2239 5.92188 13 5.69802 13 5.42187V4.6875ZM2.5 3.21048C2.77614 3.21048 3 3.43434 3 3.71048V5.2307C3 5.50684 2.77614 5.7307 2.5 5.7307V5.7307C2.22386 5.7307 2 5.50684 2 5.2307V3.71048C2 3.43434 2.22386 3.21048 2.5 3.21048V3.21048ZM11.8346 2.24245C12.0319 2.40333 12.064 2.69258 11.9069 2.89288V2.89288C11.7455 3.09859 11.4467 3.13178 11.2441 2.96649L10.5409 2.39283C10.3398 2.22878 10.3071 1.93395 10.4672 1.72978V1.72978V1.72978C10.6251 1.52795 10.918 1.49516 11.1166 1.65707L11.8346 2.24245ZM2 0.941176C2 0.421379 2.41328 1.13692e-08 2.92308 0H3.4363C3.71244 0 3.9363 0.223858 3.9363 0.5V0.5C3.9363 0.776142 3.71244 1 3.4363 1H2.92308V1.73975C2.92308 1.99465 2.71644 2.20129 2.46154 2.20129V2.20129C2.20664 2.20129 2 1.99465 2 1.73975V0.941176ZM8.59946 0C8.9138 4.16766e-05 9.21848 0.109521 9.46394 0.309743L9.82608 0.604764C10.0234 0.765522 10.0556 1.05471 9.89852 1.25496V1.25496C9.73712 1.46066 9.43828 1.49374 9.2358 1.32832L8.88792 1.04412C8.80613 0.977403 8.7042 1.00004 8.59946 1H8.08534C7.80919 1 7.58534 0.776142 7.58534 0.5V0.5C7.58534 0.223858 7.80919 0 8.08534 0H8.59946ZM6.27494 0C6.55108 0 6.77494 0.223858 6.77494 0.5V0.5C6.77494 0.776142 6.55108 1 6.27494 1H5.2476C4.97145 1 4.7476 0.776142 4.7476 0.5V0.5C4.7476 0.223858 4.97145 0 5.2476 0H6.27494Z",fill:"white"}),d.jsx("path",{d:"M8.01689 0L8.00154 4.99847C8.00069 5.27521 8.2248 5.5 8.50154 5.5H14",stroke:"white"})]}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_59284_4447",children:d.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function ph(e){return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hidden dark:inline-block",children:d.jsx(hh,{...e})}),d.jsx("span",{className:"inline-block dark:hidden",children:d.jsx(fh,{...e})})]})}function mh(e){return d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[d.jsx("title",{children:"Synced to the schema file, requires publishing | Light Mode"}),d.jsxs("g",{clipPath:"url(#clip0_59285_4566)",children:[d.jsx("path",{d:"M8 5V0.5H9L13.5 4.5V5H8Z",fill:"#2A2A2A"}),d.jsx("path",{d:"M3.5 0.5H8.61621C8.73973 0.5 8.85936 0.545299 8.95117 0.62793L13.335 4.57324C13.4403 4.66805 13.5 4.8036 13.5 4.94531V14.5C13.5 15.0523 13.0523 15.5 12.5 15.5H3.5C2.94772 15.5 2.5 15.0523 2.5 14.5V1.5C2.5 0.947715 2.94772 0.5 3.5 0.5Z",stroke:"#2A2A2A"}),d.jsx("path",{d:"M7.67993 12.0595H8.86631C8.99425 12.4899 9.37807 12.7109 9.88984 12.7109C10.4249 12.7109 10.7738 12.5015 10.7738 12.0944C10.7738 11.8153 10.5993 11.6641 10.169 11.5594L9.09893 11.3035C8.36617 11.129 7.81951 10.7336 7.81951 9.88451C7.81951 8.95402 8.64531 8.26778 9.77353 8.26778C10.9832 8.26778 11.6694 8.84934 11.8439 9.79146H10.704C10.5993 9.45416 10.2969 9.22154 9.7619 9.22154C9.35481 9.22154 8.93609 9.40763 8.93609 9.81472C8.93609 10.0473 9.09893 10.1985 9.47112 10.2916L10.5644 10.5475C11.4484 10.7568 11.8904 11.257 11.8904 12.013C11.8904 13.0365 11.0413 13.6646 9.87821 13.6646C8.66858 13.6646 7.83114 13.0598 7.67993 12.0595Z",fill:"#2A2A2A"}),d.jsx("path",{d:"M4.81418 12.1526V9.34949H4V8.3841H4.81418V7H5.97729V8.3841H7.1404V9.34949H5.97729V12.0246C5.97729 12.4434 6.20991 12.6295 6.59374 12.6295C6.82636 12.6295 7.09388 12.5364 7.25671 12.4201V13.4785C7.05898 13.5948 6.74494 13.6646 6.38438 13.6646C5.46552 13.6646 4.81418 13.1761 4.81418 12.1526Z",fill:"#2A2A2A"}),d.jsx("path",{d:"M8.01689 0L8.00169 4.49831C8.00076 4.77511 8.22489 5 8.50169 5H13.75",stroke:"#2A2A2A"})]}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_59285_4566",children:d.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function gh(e){return d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[d.jsx("title",{children:"Synced to the schema file, requires publishing | Dark Mode"}),d.jsxs("g",{clipPath:"url(#clip0_59288_4647)",children:[d.jsx("path",{d:"M8 5V0.5H9L13.5 4.5V5H8Z",fill:"white"}),d.jsx("path",{d:"M3.5 0.5H8.61621C8.73973 0.5 8.85936 0.545299 8.95117 0.62793L13.335 4.57324C13.4403 4.66805 13.5 4.8036 13.5 4.94531V14.5C13.5 15.0523 13.0523 15.5 12.5 15.5H3.5C2.94772 15.5 2.5 15.0523 2.5 14.5V1.5C2.5 0.947715 2.94772 0.5 3.5 0.5Z",stroke:"white"}),d.jsx("path",{d:"M7.67993 12.0595H8.86631C8.99425 12.4899 9.37807 12.7109 9.88984 12.7109C10.4249 12.7109 10.7738 12.5015 10.7738 12.0944C10.7738 11.8153 10.5993 11.6641 10.169 11.5594L9.09893 11.3035C8.36617 11.129 7.81951 10.7336 7.81951 9.88451C7.81951 8.95402 8.64531 8.26778 9.77353 8.26778C10.9832 8.26778 11.6694 8.84934 11.8439 9.79146H10.704C10.5993 9.45416 10.2969 9.22154 9.7619 9.22154C9.35481 9.22154 8.93609 9.40763 8.93609 9.81472C8.93609 10.0473 9.09893 10.1985 9.47112 10.2916L10.5644 10.5475C11.4484 10.7568 11.8904 11.257 11.8904 12.013C11.8904 13.0365 11.0413 13.6646 9.87821 13.6646C8.66858 13.6646 7.83114 13.0598 7.67993 12.0595Z",fill:"white"}),d.jsx("path",{d:"M4.81418 12.1526V9.34949H4V8.3841H4.81418V7H5.97729V8.3841H7.1404V9.34949H5.97729V12.0246C5.97729 12.4434 6.20991 12.6295 6.59374 12.6295C6.82636 12.6295 7.09388 12.5364 7.25671 12.4201V13.4785C7.05898 13.5948 6.74494 13.6646 6.38438 13.6646C5.46552 13.6646 4.81418 13.1761 4.81418 12.1526Z",fill:"white"}),d.jsx("path",{d:"M8.01689 0L8.00169 4.49831C8.00076 4.77511 8.22489 5 8.50169 5H13.75",stroke:"white"})]}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_59288_4647",children:d.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function bh(e){return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hidden dark:inline-block",children:d.jsx(gh,{...e})}),d.jsx("span",{className:"inline-block dark:hidden",children:d.jsx(mh,{...e})})]})}function vh(e){return d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[d.jsx("title",{children:"Published to the Knowledge Graph, but requires syncing to the schema file | Light Mode"}),d.jsx("path",{d:"M14.0291 8.02593C14.0291 4.53221 11.2275 1.7 7.77153 1.7C5.64507 1.7 3.76635 2.77226 2.63557 4.41111",stroke:"#2A2A2A","stroke-linecap":"round"}),d.jsx("path",{d:"M14.0291 8.47779L15.37 7.12223",stroke:"#2A2A2A","stroke-linecap":"round"}),d.jsx("path",{d:"M14.0291 8.47779L12.6882 7.12223",stroke:"#2A2A2A","stroke-linecap":"round"}),d.jsx("path",{d:"M1.96091 7.97407C1.96091 11.4678 4.76252 14.3 8.21848 14.3C10.3449 14.3 12.2237 13.2277 13.3544 11.5889",stroke:"#2A2A2A","stroke-linecap":"round"}),d.jsx("path",{d:"M1.96091 7.52222L0.620003 8.87778",stroke:"#2A2A2A","stroke-linecap":"round"}),d.jsx("path",{d:"M1.96091 7.52222L3.30182 8.87778",stroke:"#2A2A2A","stroke-linecap":"round"}),d.jsx("path",{d:"M6 4.5H8.11621C8.23973 4.5 8.35936 4.5453 8.45117 4.62793L10.335 6.32324C10.4403 6.41805 10.5 6.5536 10.5 6.69531V11C10.5 11.2761 10.2761 11.5 10 11.5H6C5.72386 11.5 5.5 11.2761 5.5 11V5C5.5 4.72386 5.72386 4.5 6 4.5Z",stroke:"#2A2A2A"}),d.jsx("path",{d:"M8 6.5V4.5L10.5 7H8.5C8.22386 7 8 6.77614 8 6.5Z",fill:"#2A2A2A"})]})}function yh(e){return d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[d.jsx("title",{children:"Published to the Knowledge Graph, but requires syncing to the schema file | Dark Mode"}),d.jsx("path",{d:"M14.0291 8.02593C14.0291 4.53221 11.2275 1.7 7.77153 1.7C5.64507 1.7 3.76635 2.77226 2.63557 4.41111",stroke:"white","stroke-linecap":"round"}),d.jsx("path",{d:"M14.0291 8.47779L15.37 7.12223",stroke:"white","stroke-linecap":"round"}),d.jsx("path",{d:"M14.0291 8.47779L12.6882 7.12223",stroke:"white","stroke-linecap":"round"}),d.jsx("path",{d:"M1.96091 7.97407C1.96091 11.4678 4.76252 14.3 8.21848 14.3C10.3449 14.3 12.2237 13.2277 13.3544 11.5889",stroke:"white","stroke-linecap":"round"}),d.jsx("path",{d:"M1.96091 7.52222L0.620003 8.87778",stroke:"white","stroke-linecap":"round"}),d.jsx("path",{d:"M1.96091 7.52222L3.30182 8.87778",stroke:"white","stroke-linecap":"round"}),d.jsx("path",{d:"M6 4.5H8.11621C8.23973 4.5 8.35936 4.5453 8.45117 4.62793L10.335 6.32324C10.4403 6.41805 10.5 6.5536 10.5 6.69531V11C10.5 11.2761 10.2761 11.5 10 11.5H6C5.72386 11.5 5.5 11.2761 5.5 11V5C5.5 4.72386 5.72386 4.5 6 4.5Z",stroke:"white"}),d.jsx("path",{d:"M8 6.5V4.5L10.5 7H8.5C8.22386 7 8 6.77614 8 6.5Z",fill:"white"})]})}function xh(e){return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hidden dark:inline-block",children:d.jsx(yh,{...e})}),d.jsx("span",{className:"inline-block dark:hidden",children:d.jsx(vh,{...e})})]})}const wh={published:"Published to the Knowledge Graph",synced:"Synced with the schema file, but needs published",typesync_ui:"Requires syncing to the schema file",published_not_synced:"Published to the Knowledge Graph, but requires syncing to the schema file"};function Eh({id:e,label:n,typeSelected:t,...s}){const r=Xt(),a=xe(r.store,p=>p.value),i=xe(r.store,p=>p.meta.errors),l=xe(r.store,p=>p.meta.isTouched),c=i.length>0&&l,[f,h]=o.useState(""),g=wl(p=>{h(p)},300),{data:u}=xl({query:nt(f)?Mt(f):null,first:50},{refetchOnMount:!1,refetchOnWindowFocus:!1}),m=u??[];return d.jsxs(Ho,{value:a,onChange:p=>{if(p==null){r.handleChange("");return}if(typeof p=="string"){r.handleChange(p);return}r.handleChange(p.name||p.id),t(p)},onClose:()=>{g("")},immediate:!0,children:[n!=null?d.jsxs(wn,{htmlFor:s.name||e,className:"block text-sm/6 font-medium text-gray-900 dark:text-white",children:[n,s.required?"*":""]}):null,d.jsxs("div",{className:Ct("grid grid-cols-1 relative",n!=null?"mt-2":"mt-0"),children:[d.jsx(Wr,{className:"block min-w-0 grow py-1.5 pr-12 data-[state=invalid]:pr-10 text-base bg-white dark:bg-white/5 pl-3 outline -outline-offset-1 outline-gray-300 dark:outline-white/10 rounded-md text-gray-900 dark:text-white data-[state=invalid]:text-red-900 dark:data-[state=invalid]:text-red-700 placeholder:text-gray-400 dark:placeholder:text-gray-500 data-[state=invalid]:placeholder:text-red-700 dark:data-[state=invalid]:placeholder:text-red-400 focus:outline sm:text-sm/6 focus-visible:outline-none",onChange:p=>{const b=p.target.value;g(b),r.handleChange(b)},onBlur:()=>h(""),displayValue:p=>p,type:"search"}),d.jsx(Kr,{className:"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-hidden cursor-pointer",children:d.jsx(xs,{className:"size-5 text-gray-400 dark:text-gray-50","aria-hidden":"true"})}),m.length>0||nt(f)?d.jsxs(Yr,{className:"absolute z-10 mt-10 max-h-60 w-fit min-w-md 2xl:min-w-xl overflow-auto rounded-md bg-white dark:bg-slate-700 py-1 text-base shadow-lg ring-1 ring-black/5 dark:ring-black/10 focus:outline-hidden sm:text-sm",children:[m.map(p=>d.jsxs(bn,{value:p,"data-selected":a===p.name||a===p.id?!0:void 0,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:[d.jsxs("span",{className:"flex items-center gap-x-1.5 truncate group-data-selected:font-semibold",children:[p.name||p.id,d.jsx(Pe,{children:p.id})]}),d.jsx("span",{className:"absolute inset-y-0 right-0 hidden items-center pr-4 text-indigo-600 group-data-focus:text-white group-data-selected:flex",children:d.jsx(it,{className:"size-5","aria-hidden":"true"})})]},p.id)),nt(f)?d.jsx(bn,{value:f,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:d.jsxs("span",{className:"flex items-center gap-x-1.5 truncate group-data-selected:font-semibold",children:["New Type: ",d.jsx(Pe,{children:f})]})},"user_entered"):null]}):null]}),c?d.jsx(Fs,{id:`${e}-invalid`,errors:i}):null]})}class jt extends is("/hypergraph/typesync/models/TypeOption")({id:Le,name:Le}){}class Sh extends is("/hypergraph/typesync/models/RelationTypeOption")({...jt.fields,relationType:Le}){}const kh=[jt.make({id:"DefaultEntityString",name:"String"}),jt.make({id:"DefaultEntityNumber",name:"Number"}),jt.make({id:"DefaultEntityBoolean",name:"Boolean"}),jt.make({id:"DefaultEntityDate",name:"Date"}),jt.make({id:"DefaultEntityPoint",name:"Point"})];function Mh({id:e,name:n,schemaTypes:t=[],disabled:s=!1,relationTypeSelected:r}){const a=Xt(),i=ae(t,ge(l=>nt(l.type)),ve(l=>Sh.make({id:`Relation(${l.type})`,name:`Relation(${l.type})`,relationType:l.type})));return d.jsxs(e1,{as:"div",id:e,name:n,value:a.state.value,onBlur:a.handleBlur,disabled:s,onChange:l=>{if(l){if(typeof l=="string"){a.handleChange(l);return}a.handleChange(l.name),r(l.relationType)}},children:[d.jsx(wn,{className:"sr-only",children:"Prop type"}),d.jsxs("div",{className:"relative",children:[d.jsxs(al,{className:"grid w-full cursor-default grid-cols-1 rounded-md bg-white dark:bg-slate-900 disabled:bg-gray-100 dark:disabled:bg-slate-700 py-1.5 pr-2 pl-3 text-left text-white outline-1 -outline-offset-1 outline-gray-500 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 disabled:cursor-not-allowed",children:[d.jsx("span",{className:"col-start-1 row-start-1 truncate pr-6 text-gray-950 dark:text-white",children:a.state.value}),s?null:d.jsx(xs,{"aria-hidden":"true",className:"col-start-1 row-start-1 size-5 self-center justify-self-end text-gray-300 dark:text-gray-50 sm:size-4"})]}),d.jsxs(il,{transition:!0,className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-gray-50 dark:bg-slate-800 py-1 text-base shadow-lg ring-1 ring-gray-200 dark:ring-black/5 focus:outline-hidden data-leave:transition data-leave:duration-100 data-leave:ease-in data-closed:data-leave:opacity-0 sm:text-sm",children:[kh.map(l=>d.jsxs(ur,{value:l.name,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-800 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:[d.jsx("span",{className:"block truncate font-normal group-data-selected:font-semibold",children:l.name}),d.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600 group-not-data-selected:hidden group-data-focus:text-white",children:d.jsx(it,{"aria-hidden":"true",className:"size-5"})})]},l.id)),i.map((l,c)=>d.jsxs(ur,{value:l,className:Ct("group relative cursor-default py-2 pr-9 pl-3 text-gray-800 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",c===0?"border-t border-gray-400 dark:border-white/10":""),children:[d.jsx("span",{className:"block truncate font-normal group-data-selected:font-semibold",children:l.name}),d.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600 group-not-data-selected:hidden group-data-focus:text-white",children:d.jsx(it,{"aria-hidden":"true",className:"size-5"})})]},l.id))]})]})]})}const Ch=as(Jc(En));function Th(e,n){switch(n.type){case"FETCHING":return{...e,status:"fetching",error:null};case"ERROR":return{...e,error:n.payload,status:"error"};case"SUCCESS":return{...e,data:n.payload,status:"success"};case"RESET":return{...e,data:{types:[]},error:void 0,status:"idle"};default:return e}}function Fh({enabled:e=!0,onError:n,onSuccess:t,retry:s=!0,retryDelay:r=1e3}={}){const[a,i]=o.useReducer(Th,{data:{types:[]},error:void 0,status:"idle"}),l=o.useRef(null),c=o.useRef(null),f=o.useRef(!0),h=o.useRef({onSuccess:t,onError:n,retry:s,retryDelay:r,enabled:e});o.useEffect(()=>{h.current={onSuccess:t,onError:n,retry:s,retryDelay:r,enabled:e}});const g=o.useCallback(()=>{l.current&&(l.current.close(),l.current=null),c.current&&clearTimeout(c.current)},[]),u=o.useCallback(()=>{if(g(),!!h.current.enabled&&f.current){i({type:"FETCHING"});try{const m=new EventSource("http://localhost:3000/api/v1/schema/events"),p=y=>{if(f.current)try{const k=Ch(y.data);i({type:"SUCCESS",payload:k}),h.current.onSuccess?.(k)}catch(k){const S=k instanceof Error?k:new Error("Failed to parse SSE data");i({type:"ERROR",payload:S}),h.current.onError?.(S)}},b=()=>{if(!f.current)return;const y=new Error("SSE connection error");i({type:"ERROR",payload:y}),h.current.onError?.(y),g(),h.current.retry&&h.current.enabled&&(c.current=setTimeout(u,h.current.retryDelay))};m.addEventListener("message",p),m.addEventListener("error",b),l.current=m}catch(m){if(!f.current)return;const p=m instanceof Error?m:new Error("Failed to create SSE connection");i({type:"ERROR",payload:p}),h.current.onError?.(p)}}},[g]);return o.useEffect(()=>(f.current=!0,u(),()=>{f.current=!1,g()}),[u,g]),o.useEffect(()=>{e?u():g()},[e,u,g]),{data:a.data,error:a.error,isLoading:a.status==="fetching",isError:a.status==="error",isSuccess:a.status==="success",refetch:u}}const Oh=as(En);Ie({schema:En,space:vs});function Rh(e={}){const{getSmartSessionClient:n}=yr();return oo({mutationKey:["Hypergraph","Typesync","Studio","Mapping","sync"],async mutationFn(t){try{const s=await n();if(!s)throw new Error("Missing smartSessionClient");const[r,a]=lu(t.schema);await $u({ops:a.map(c=>c),space:t.space,name:"Schema Publish updates",walletClient:s});const i=await fetch("http://localhost:3000/api/v1/mapping/sync",{method:"POST",body:JSON.stringify({schema:t.schema,mapping:r}),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(i.status!==200)throw new Error(`Failure posting Typesync Hypergraph Schema [${i.status}]`);const l=await i.json();return Oh(l)}catch(s){throw console.error("Failure syncing Typesync Hypergraph Schema to schema.ts file",{err:s}),s}},...e})}const Ih=as(En),Ah={mutationKey:["Hypergraph","Typesync","Studio","Schema","sync"],async mutationFn(e){try{const n=await fetch("http://localhost:3000/api/v1/schema/sync",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(n.status!==200)throw new Error(`Failure posting Typesync Hypergraph Schema [${n.status}]`);const t=await n.json();return Ih(t)}catch(n){throw console.error("Failure syncing Typesync Hypergraph Schema to schema.ts file",{err:n}),n}}};function Vh(e={}){return oo({...Ah,...e})}const{useAppForm:Ph}=ma({fieldComponents:{Checkbox:N1,PropertyCombobox:uh,TextField:gl,TypeCombobox:Eh,TypeSelect:Mh},formComponents:{SubmitButton:ml},fieldContext:ba,formContext:va});function Nh(){const{authenticated:e}=Ui(),[n,t]=o.useState(!1),{spaceId:s}=Bi(),{data:r}=Fh(),a=Ld(),{mutateAsync:i,isError:l,isPending:c,isSuccess:f,reset:h}=Vh({onError(x){a.add({title:"Failure syncing Schema to file",description:x.message})}}),{mutateAsync:g,reset:u,status:m}=Rh({onError(x){a.add({title:"Failure publishing Schema to Knowledge Graph",description:x.message})}}),p=Ph({defaultValues:r,validators:{onChangeAsyncDebounceMs:100,onChange:Zi(En)},async onSubmit({value:x,formApi:O}){await i(x).then(M=>{setTimeout(async()=>{O.reset(M),h()},1500)})}}),b=xe(p.store,x=>ae(x.values.types,ge(O=>nt(O.name)),ve((O,M)=>({type:O.name,knowledgeGraphId:O.knowledgeGraphId,schemaTypeIdx:M})))),y=ae(b,ve(x=>x.type),et(new Set,(x,O)=>x.add(O))),k=xe(p.store,x=>x.values),S=xe(p.store,x=>x.isDirty&&On(x.values.types,O=>O.status==="published_not_synced"||O.status==null||On(O.properties,M=>M.status==="published_not_synced"||M.status==null))),w=xe(p.store,x=>On(x.values.types,O=>O.status==="synced"||On(O.properties,M=>M.status==="synced"))),C=(x,O=[])=>{const M=[...O];function D(I){return Aa(ge(M,({name:T})=>T===I.name))>0&&!y.has(I.name)}const F=ae(x.properties,ge(I=>I.dataType==="RELATION"),ge(I=>!D({name:I.name})));for(const I of F){if(eu(I.relationValueTypes)){M.push({name:I.name,knowledgeGraphId:null,properties:[],status:null});continue}const T=I.relationValueTypes[0];if(D({name:T.name}))continue;M.push({name:T.name,knowledgeGraphId:T.id,status:"published_not_synced",properties:ve(T.properties??[],V=>{const j=yt(V.dataType,V.name);return dt(j)?{name:V.name,knowledgeGraphId:V.id,dataType:j,relationType:V.name,status:"published_not_synced"}:{name:V.name,knowledgeGraphId:V.id,dataType:j,status:"published_not_synced"}})});const E=C({...T,properties:ae(T.properties??[],ge(V=>V!=null),ve(V=>({...V,relationValueTypes:[]})))},M);for(const V of E)D({name:V.name})||M.push(V)}return et(M,[],(I,T)=>{const E=tu(I,({name:V})=>V===T.name);return nu(E)&&I.push(T),I})},P=(x,O=[])=>{const M=[...O];function D(F){return Aa(ge(M,({name:I})=>I===F.name))>0&&!y.has(F.name)}for(const F of ge(x.relationValueTypes,I=>I!=null)){if(F.name==null||D({name:F.name}))continue;const I=ae(F.properties??[],ge(T=>T.name!=null),ve(T=>{const E=T.name,V=yt(T.dataType,E);return dt(V)?(D({name:E})||M.push({name:E,knowledgeGraphId:null,properties:[],status:null}),{name:E,knowledgeGraphId:T.id,dataType:V,relationType:E,status:"published_not_synced"}):{name:E,knowledgeGraphId:T.id,dataType:V,status:"published_not_synced"}}));M.push({name:F.name,knowledgeGraphId:F.id,status:"published_not_synced",properties:I})}return M};return d.jsxs("form",{noValidate:!0,"aria-disabled":c?"true":void 0,onSubmit:x=>{x.preventDefault(),x.stopPropagation(),p.handleSubmit()},className:"px-4",children:[d.jsx(p.AppField,{name:"types",mode:"array",children:x=>d.jsxs("div",{className:"grid grid-cols-2 2xl:grid-cols-5 gap-x-4 2xl:gap-x-8 h-full",children:[d.jsx("div",{className:"w-full flex flex-col gap-y-4 pb-10 2xl:col-span-2 h-full",children:d.jsx(oh,{typeSelected:O=>{if(O.name==null)return;const M=C(O),D=rr.make({name:O.name,knowledgeGraphId:O.id,status:"published_not_synced",properties:(O.properties??[]).filter(F=>F!=null).map(F=>{const I=yt(F.dataType,F.name||F.id);return dt(I)?{name:F.name||F.id,knowledgeGraphId:F.id,dataType:I,relationType:F.name||F.id,status:"published_not_synced"}:{name:F.name||F.id,knowledgeGraphId:F.id,dataType:I,status:"published_not_synced"}})});if(x.state.value.length===1){const F=x.state.value[0],I=F.properties;if(Yn(F.name)&&I.length===1&&Yn(F.properties[0].name)){Ds(M,{onEmpty(){x.replaceValue(0,D)},onNonEmpty(T){Rn(T,(E,V)=>{if(V===0){x.replaceValue(0,{name:E.name,knowledgeGraphId:E.knowledgeGraphId,properties:E.properties});return}x.pushValue(E)}),x.pushValue(D)}});return}}Ds(M,{onEmpty(){x.pushValue(D)},onNonEmpty(F){Rn(F,I=>{x.pushValue({name:I.name,knowledgeGraphId:I.knowledgeGraphId,properties:I.properties})}),x.pushValue(D)}})}})}),d.jsxs("div",{className:"w-full flex flex-col gap-y-4 pb-10 2xl:col-span-3",children:[d.jsxs("div",{className:"border-b border-gray-200 dark:border-white/20 pb-5 h-20",children:[d.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Schema"}),d.jsxs("p",{className:"mt-2 max-w-4xl text-sm text-gray-500 dark:text-gray-200",children:["This is parsed from the Hypergraph Schema defined in your ",d.jsx(Pe,{children:"schema.ts"})]})]}),d.jsxs("div",{children:[x.state.value.map((O,M)=>{const D=`createSchemaForm__type[${M}]`;return d.jsxs("div",{className:"border-l-2 border-indigo-600 dark:border-indigo-400 pl-2 py-2 flex flex-col gap-y-4",children:[d.jsxs("div",{className:"flex items-start justify-between gap-x-3",children:[d.jsx("div",{className:"h-16 w-8 flex flex-col items-center justify-end",children:d.jsx(hi,{status:O.status})}),d.jsx("div",{className:"flex-1 shrink-0",children:d.jsx(p.AppField,{name:`types[${M}].name`,children:F=>d.jsx(F.TypeCombobox,{id:`types[${M}].name`,name:`types[${M}].name`,required:!0,label:"Type Name",typeSelected:I=>{const T=C(I),E=rr.make({name:I.name,knowledgeGraphId:I.id,status:"published_not_synced",properties:(I.properties??[]).filter(V=>V!=null).map(V=>{const j=yt(V.dataType,V.name||V.id);return dt(j)?{name:V.name||V.id,knowledgeGraphId:V.id,dataType:j,relationType:V.name||V.id,status:"published_not_synced"}:{name:V.name||V.id,knowledgeGraphId:V.id,dataType:j,status:"published_not_synced"}})});Ds(T,{onEmpty(){x.replaceValue(M,E)},onNonEmpty(V){Rn(V,j=>{x.pushValue({name:j.name,knowledgeGraphId:j.knowledgeGraphId,properties:j.properties})}),x.replaceValue(M,E)}})}})})}),d.jsx("button",{type:"button",className:"min-w-fit rounded-md bg-transparent p-2 shadow-xs hover:bg-gray-100 dark:hover:bg-white/10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600 cursor-pointer mt-8 text-red-700 dark:text-red-400 disabled:text-gray-400 disabled:cursor-not-allowed disabled:hover:bg-transparent",onClick:()=>x.removeValue(M),disabled:x.state.value.length===1,children:d.jsx(lr,{"aria-hidden":"true",className:"size-5"})})]}),d.jsx(p.AppField,{name:`types[${M}].properties`,mode:"array",children:F=>d.jsxs("div",{className:"flex flex-col gap-y-1 pl-2 ml-1 border-l border-indigo-300",children:[d.jsx("h4",{className:"text-md font-mono text-gray-800 dark:text-gray-200",children:"Properties"}),d.jsxs("div",{className:"w-full flex flex-col gap-y-2",children:[F.state.value.map((I,T)=>{const E=`createAppForm__type[${M}]__prop[${T}]`;return d.jsxs("div",{className:"grid grid-cols-11 gap-2",children:[d.jsxs("div",{className:"col-span-5 flex items-start gap-x-1",children:[d.jsx("div",{className:"w-8 h-full flex flex-col items-center justify-center",children:d.jsx(hi,{status:I.status})}),d.jsx("div",{className:"w-full",children:d.jsx(p.AppField,{name:`types[${M}].properties[${T}].name`,children:V=>d.jsx(V.PropertyCombobox,{id:`types[${M}].properties[${T}].name`,name:`types[${M}].properties[${T}].name`,required:!0,propertySelected:j=>{const K=yt(j.dataType,j.name||j.id),L={name:j.name||j.id,knowledgeGraphId:j.id,status:"published_not_synced",dataType:K,...dt(K)?{relationType:j.name||j.id}:{}};if(j.dataType==="RELATION"){const N=P(j);Rn(N,Z=>{x.pushValue({name:Z.name,knowledgeGraphId:Z.knowledgeGraphId,properties:Z.properties})}),F.replaceValue(T,L);return}F.replaceValue(T,L)}})})})]}),d.jsx("div",{className:"col-span-3 2xl:col-span-4",children:d.jsx(p.AppField,{name:`types[${M}].properties[${T}].dataType`,children:V=>d.jsx(V.TypeSelect,{id:`types[${M}].properties[${T}].dataType`,name:`types[${M}].properties[${T}].dataType`,schemaTypes:ge(b,j=>j.type!==O.name),disabled:I.knowledgeGraphId!=null,relationTypeSelected:j=>F.replaceValue(T,{...F.state.value[T],relationType:j})})})}),d.jsx("div",{className:"col-span-2 2xl:col-span-1",children:d.jsx(p.AppField,{name:`types[${M}].properties[${T}].optional`,children:V=>d.jsx(V.Checkbox,{id:`types[${M}].properties[${T}].optional`,name:`types[${M}].properties[${T}].optional`,label:"Optional"})})}),d.jsx("div",{className:"col-span-1 flex items-start justify-end h-full",children:d.jsx("button",{type:"button",className:"min-w-fit rounded-md bg-transparent p-2 text-white shadow-xs hover:bg-gray-100 dark:hover:bg-white/10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600 cursor-pointer",onClick:()=>F.removeValue(T),children:d.jsx(lr,{"aria-hidden":"true",className:"size-5 text-red-700 dark:text-red-400"})})})]},E)}),d.jsx("div",{className:"w-full flex items-center justify-end mt-1",children:d.jsxs("button",{type:"button",className:"inline-flex items-center gap-x-1.5 text-sm/4 font-semibold text-gray-900 dark:text-white cursor-pointer hover:bg-gray-100 dark:hover:bg-white/10 rounded-md px-2 py-1.5",onClick:()=>F.pushValue({name:"",knowledgeGraphId:null,dataType:"String",status:null}),children:[d.jsx(es,{"aria-hidden":"true",className:"-ml-0.5 size-4"}),"Add Property"]})})]})]})})]},D)}),d.jsxs("div",{className:"w-full flex items-center justify-between border-t border-gray-500 dark:border-gray-400 mt-4 pt-2",children:[d.jsxs("button",{type:"button",className:"inline-flex items-center gap-x-1.5 text-sm/6 font-semibold text-gray-600 dark:text-gray-200 cursor-pointer hover:bg-gray-100 dark:hover:bg-white/10 rounded-md px-2 py-1.5",onClick:()=>{p.resetField("types")},children:[d.jsx(ko,{"aria-hidden":"true",className:"-ml-0.5 size-4"}),"Reset"]}),d.jsxs("button",{type:"button",className:"inline-flex items-center gap-x-1.5 text-sm/6 font-semibold text-gray-900 dark:text-white cursor-pointer hover:bg-gray-100 dark:hover:bg-white/10 rounded-md px-2 py-1.5",onClick:()=>x.pushValue({name:"",knowledgeGraphId:null,status:null,properties:[{name:"",knowledgeGraphId:null,dataType:"String",status:null}]}),children:[d.jsx(es,{"aria-hidden":"true",className:"-ml-0.5 size-5"}),"Add Type"]})]})]}),d.jsxs("div",{className:"mt-6 flex items-center justify-end gap-x-6 bg-white dark:bg-inherit p-4 rounded-lg",children:[d.jsx(p.AppForm,{children:d.jsxs(p.SubmitButton,{status:c?"submitting":l?"error":f?"success":"idle",children:["Sync with ",d.jsx(Pe,{children:"schema.ts"})]})}),d.jsx(pa,{delay:300,closeDelay:1e3,children:d.jsxs(ia,{children:[d.jsx(ca,{type:"button",disabled:!w||!e,"data-state":m==="pending"?"submitting":m==="error"?"error":m==="success"?"success":"idle",className:Ct("rounded-md bg-indigo-600 dark:bg-indigo-500 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 dark:hover:bg-indigo-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500 inline-flex items-center gap-x-2 cursor-pointer","disabled:bg-gray-400 disabled:text-gray-900 disabled:hover:bg-gray-400 disabled:focus-visible:outline-gray-400 disabled:cursor-not-allowed","data-[state=error]:bg-red-600 data-[state=error]:hover:bg-red-500 data-[state=error]:focus-visible:bg-red-500 data-[state=success]:focus-visible:bg-green-500","data-[state=success]:bg-green-600 data-[state=success]:hover:bg-green-500"),onClick:async()=>{if(!(!e||!w||S)){if(!s){t(!0);return}await g({schema:k,space:s}).then(O=>{setTimeout(async()=>{p.reset(O,{keepDefaultValues:!1}),u()},1500)})}},children:m==="pending"?d.jsxs(d.Fragment,{children:[d.jsx(rs,{}),"Publishing Schema"]}):m==="success"?d.jsxs(d.Fragment,{children:[d.jsx(it,{className:"size-5 text-white","aria-hidden":"true"}),"Schema Published"]}):m==="error"?d.jsxs(d.Fragment,{children:[d.jsx(Jn,{className:"size-5 text-white","aria-hidden":"true"}),"Error"]}):d.jsxs(d.Fragment,{children:[d.jsx(bl,{className:"size-5","aria-hidden":"true"}),"Publish Schema"]})}),d.jsx(ua,{children:d.jsx(da,{side:"top",sideOffset:10,children:d.jsxs(fa,{className:"box-border text-sm flex flex-col px-2 py-3 rounded-lg bg-gray-100 dark:bg-slate-900 transform-content data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 w-fit max-w-xs",children:[d.jsx(ha,{className:"flex data-[side=top]:-bottom-2 data-[side=top]:rotate-180 data-[side=bottom]:-top-2 data-[side=bottom]:rotate-0 data-[side=left]:-right-3 data-[side=left]:rotate-90 data-[side=right]:-left-3 data-[side=right]:-rotate-90",children:d.jsx(ga,{})}),d.jsx("span",{className:"text-xs text-gray-700 dark:text-white whitespace-break-spaces w-full",children:e?S?"Please sync your Schema to the schema.ts file first. Then Publish to the Knowledge Graph":w?"Publish your Schema changes to the Knowledge Graph":"Add types/properties to your Schema and sync with your schema file before Publishing to the Knowledge Graph":"Must be authenticated to Publish"})]})})})]})})]})]})]})}),d.jsx($1,{open:n,setOpen:t,spaceSubmitted:async x=>{t(!1),await g({schema:k,space:x.id}).then(O=>{setTimeout(async()=>{p.reset(O,{keepDefaultValues:!1}),u()},1500)})}}),d.jsx(rd,{className:"fixed z-10 w-sm mx-0 my-auto bottom-4 md:bottom-8 right-4 md:right-8 left-auto top-auto",children:a.toasts.map(x=>d.jsx(md,{toast:x,className:"pointer-events-auto w-full max-w-md rounded-lg bg-white shadow-lg outline-1 outline-black/5 transition data-closed:opacity-0 data-enter:transform data-enter:duration-300 data-enter:ease-out data-closed:data-enter:translate-y-2 data-leave:duration-100 data-leave:ease-in data-closed:data-enter:sm:translate-x-2 data-closed:data-enter:sm:translate-y-0 dark:bg-gray-800 dark:-outline-offset-1 dark:outline-white/10 p-4",children:d.jsx("div",{className:"p-4",children:d.jsxs("div",{className:"flex items-start",children:[d.jsx("div",{className:"shrink-0",children:d.jsx(Br,{"aria-hidden":"true",className:"size-6 text-red-400"})}),d.jsxs("div",{className:"ml-3 w-0 flex-1 pt-0.5",children:[d.jsx(bd,{className:"text-sm font-medium text-gray-900 dark:text-white"}),d.jsx(gd,{className:"mt-1 text-sm text-gray-500 dark:text-gray-400"})]}),d.jsx("div",{className:"ml-4 flex shrink-0",children:d.jsx(Ed,{"aria-label":"Close",className:"inline-flex rounded-md text-gray-400 hover:text-gray-500 focus:outline-2 focus:outline-offset-2 focus:outline-red-600 dark:hover:text-white dark:focus:outline-red-500",children:d.jsx(Zr,{className:"size-4","aria-hidden":"true"})})})]})})},x.id))})]})}export{Nh as component};
|