From aa526fc33d463b39d9c9fabb4b1424a893be3454 Mon Sep 17 00:00:00 2001 From: Max Krieger Date: Fri, 12 Apr 2024 00:08:37 -0700 Subject: [PATCH] Updates --- .../{TrainingWorker-361b2a15.js => TrainingWorker-e437badb.js} | 2 +- assets/{index-acffbbda.js => index-85b021e0.js} | 2 +- index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename assets/{TrainingWorker-361b2a15.js => TrainingWorker-e437badb.js} (99%) rename assets/{index-acffbbda.js => index-85b021e0.js} (99%) diff --git a/assets/TrainingWorker-361b2a15.js b/assets/TrainingWorker-e437badb.js similarity index 99% rename from assets/TrainingWorker-361b2a15.js rename to assets/TrainingWorker-e437badb.js index 74a70a5..e3e73fa 100644 --- a/assets/TrainingWorker-361b2a15.js +++ b/assets/TrainingWorker-e437badb.js @@ -20293,4 +20293,4 @@ __p += '`),ae&&(ht+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+ht+`return __p -}`;var Jt=QE(function(){return me(D,Tt+"return "+ht).apply(e,O)});if(Jt.source=ht,V0(Jt))throw Jt;return Jt}function Kot(c){return be(c).toLowerCase()}function qot(c){return be(c).toUpperCase()}function jot(c,p,y){if(c=be(c),c&&(y||p===e))return lT(c);if(!c||!(p=_s(p)))return c;var $=br(c),S=br(p),D=uT($,S),O=cT($,S)+1;return di($,D,O).join("")}function Xot(c,p,y){if(c=be(c),c&&(y||p===e))return c.slice(0,dT(c)+1);if(!c||!(p=_s(p)))return c;var $=br(c),S=cT($,br(p))+1;return di($,0,S).join("")}function Yot(c,p,y){if(c=be(c),c&&(y||p===e))return c.replace(Vy,"");if(!c||!(p=_s(p)))return c;var $=br(c),S=uT($,br(p));return di($,S).join("")}function Zot(c,p){var y=F,$=P;if(Ge(p)){var S="separator"in p?p.separator:S;y="length"in p?jt(p.length):y,$="omission"in p?_s(p.omission):$}c=be(c);var D=c.length;if(yl(c)){var O=br(c);D=O.length}if(y>=D)return c;var M=y-wl($);if(M<1)return $;var H=O?di(O,0,M).join(""):c.slice(0,M);if(S===e)return H+$;if(O&&(M+=H.length-M),U0(S)){if(c.slice(M).search(S)){var it,at=H;for(S.global||(S=o0(S.source,be(_N.exec(S))+"g")),S.lastIndex=0;it=S.exec(at);)var ht=it.index;H=H.slice(0,ht===e?M:ht)}}else if(c.indexOf(_s(S),M)!=M){var wt=H.lastIndexOf(S);wt>-1&&(H=H.slice(0,wt))}return H+$}function Jot(c){return c=be(c),c&&aQ.test(c)?c.replace(NN,ktt):c}var Qot=Nl(function(c,p,y){return c+(y?" ":"")+p.toUpperCase()}),K0=tE("toUpperCase");function JE(c,p,y){return c=be(c),p=y?e:p,p===e?wtt(c)?Ttt(c):htt(c):c.match(p)||[]}var QE=Qt(function(c,p){try{return Ts(c,e,p)}catch(y){return V0(y)?y:new Gt(y)}}),tit=yo(function(c,p){return Ys(p,function(y){y=Kr(y),xo(c,y,z0(c[y],c))}),c});function eit(c){var p=c==null?0:c.length,y=Lt();return c=p?Ue(c,function($){if(typeof $[1]!="function")throw new Zs(i);return[y($[0]),$[1]]}):[],Qt(function($){for(var S=-1;++SZ)return[];var y=lt,$=Vn(c,lt);p=Lt(p),c-=lt;for(var S=n0($,p);++y0||p<0)?new ee(y):(c<0?y=y.takeRight(-c):c&&(y=y.drop(c)),p!==e&&(p=jt(p),y=p<0?y.dropRight(-p):y.take(p-c)),y)},ee.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},ee.prototype.toArray=function(){return this.take(lt)},Gr(ee.prototype,function(c,p){var y=/^(?:filter|find|map|reject)|While$/.test(p),$=/^(?:head|last)$/.test(p),S=_[$?"take"+(p=="last"?"Right":""):p],D=$||/^find/.test(p);S&&(_.prototype[p]=function(){var O=this.__wrapped__,M=$?[1]:arguments,H=O instanceof ee,it=M[0],at=H||Kt(O),ht=function(te){var ae=S.apply(_,ii([te],M));return $&&wt?ae[0]:ae};at&&y&&typeof it=="function"&&it.length!=1&&(H=at=!1);var wt=this.__chain__,Tt=!!this.__actions__.length,Mt=D&&!wt,Jt=H&&!Tt;if(!D&&at){O=Jt?O:new ee(this);var Bt=c.apply(O,M);return Bt.__actions__.push({func:Lp,args:[ht],thisArg:e}),new Js(Bt,wt)}return Mt&&Jt?c.apply(this,M):(Bt=this.thru(ht),Mt?$?Bt.value()[0]:Bt.value():Bt)})}),Ys(["pop","push","shift","sort","splice","unshift"],function(c){var p=lp[c],y=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",$=/^(?:pop|shift)$/.test(c);_.prototype[c]=function(){var S=arguments;if($&&!this.__chain__){var D=this.value();return p.apply(Kt(D)?D:[],S)}return this[y](function(O){return p.apply(Kt(O)?O:[],S)})}}),Gr(ee.prototype,function(c,p){var y=_[p];if(y){var $=y.name+"";we.call($l,$)||($l[$]=[]),$l[$].push({name:p,func:y})}}),$l[Ep(e,w).name]=[{name:"wrapper",func:e}],ee.prototype.clone=Ytt,ee.prototype.reverse=Ztt,ee.prototype.value=Jtt,_.prototype.at=Est,_.prototype.chain=_st,_.prototype.commit=Rst,_.prototype.next=Ast,_.prototype.plant=Fst,_.prototype.reverse=Ost,_.prototype.toJSON=_.prototype.valueOf=_.prototype.value=Lst,_.prototype.first=_.prototype.head,Gc&&(_.prototype[Gc]=Dst),_},vl=Ett();ca?((ca.exports=vl)._=vl,jy._=vl):_n._=vl}).call($e)}(Qf,Qf.exports);var fo=Qf.exports,xN={},Ty={},tp=$e&&$e.__assign||function(){return tp=Object.assign||function(n){for(var t,e=1,s=arguments.length;e0&&o[o.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]0&&o[o.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]=this.options.numOfAttempts},enumerable:!0,configurable:!0}),n.prototype.applyDelay=function(){return Oy(this,void 0,void 0,function(){var t;return Ly(this,function(e){switch(e.label){case 0:return t=UJ.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return e.sent(),[2]}})})},n}();const qJ="text-embedding-ada-002";function Vr(n){postMessage(n)}class jJ{constructor(){$o(this,"cache",{})}addToCache(t){this.cache={...this.cache,...t}}getCache(){return this.cache}getCachedEmbedding(t){if(!(t in this.cache))throw new Error(`Text not cached in embedding ${t}}`);return this.cache[t]}async bulkEmbed(t,e,s=qJ){Vr({type:"embeddingProgress",progress:0}),si.info("Bulk embedding...");const r=[...new Set(t.flatMap(a=>[a.text_1,a.text_2]))],o=await mN.embeddings.bulkGet(r.map(a=>[a,s])),i=[];for(let a=0;a0){si.info(`Fetching ${i.length} embeddings`);const a=fo.chunk(i,150);for(let l=0;lfetch("https://api.openai.com/v1/embeddings",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({model:s,input:u})})),d=await h.json();if(h.status!==200)throw si.error(d),new Error(`Failed to fetch embeddings: ${d.error.message}`);const f=d.data.map(m=>({embedding:m.embedding,text:u[m.index],dateCreated:new Date,model:s}));await mN.embeddings.bulkPut(f),f.forEach(m=>{this.cache[m.text]=m.embedding}),Vr({type:"embeddingProgress",progress:l/a.length})}si.info("Done fetching")}else si.info("No embeddings to fetch")}}function bN(n){const t=[];for(const i of fo.range(-1e3,1e3,1)){const a=i/1e3;let l=0;for(const[h,d]of n){let f;h>a?f=1:f=-1,f===d&&(l+=1)}const u=l/n.length;t.push(u)}const e=fo.max(t),s=t.length,r=Math.sqrt(e*(1-e)/s),o=`${(e*100).toFixed(1)}% ± ${(1.96*r*100).toFixed(1)}%`;return{accuracy:e,se:r,message:o}}function yN(n,t){return t?n.matMul(t):n}async function wN(n,t){const e=X(()=>O$(yN(n.e1,t),yN(n.e2,t)).mul(-1).arraySync());return fo.zip(e,n.labels.arraySync())}function Py(n,t,e,s){return X(()=>{const r=Lg(n,s),o=Lg(t,s),i=r.matMul(e),a=o.matMul(e);return O$(i,a).mul(-1)})}function My(n,t){return n.sub(t).square().mean()}const XJ=(n,t,e,s)=>function(o){const i=Py(t,e,o,n);return My(i,s)};async function*YJ(n,t,e){const s=n.tfDataset.shuffle(n.tfDataset.size).batch(t.batchSize);let r=1/0;const o=e.clone().variable();for(let i=0;i{X(()=>{const{e1:u,e2:h,labels:d}=l,m=DD(XJ(t.dropoutFraction,u,h,d))(o);o.assign(o.sub(m.mul(t.learningRate)))})});const a=X(()=>{const l=Py(n.e1,n.e2,o,t.dropoutFraction);return My(l,n.labels).dataSync()[0]});a{const{e1:a,e2:l,labels:u}=i;r.minimize(()=>My(Py(a,l,e,t.dropoutFraction),u),!1,[e])}),yield o}function JJ(n,t){return zw([n,t]).variable()}function QJ(n,t,e){switch(t.optimizer){case"gradient":return YJ(n,t,e);case"adamax":return ZJ(n,t,e)}}function vN(n,t){const e=[],s=[],r=[];for(const{text_1:m,text_2:g,label:x}of n){const b=t.getCachedEmbedding(m),w=t.getCachedEmbedding(g);e.push(b),s.push(w),r.push(x)}const o=Uu(e),i=Uu(s),a=jn(r),l=ab(e),u=ab(s),h=ab(r),d=oz({e1:l,e2:u,labels:h}),f=o.shape[1];return{e1:o,e2:i,labels:a,embeddingSize:f,tfDataset:d}}function CN(n){return n.length===0?1:n.reduce((t,e)=>t*e)}function IN(n,t,e){for(let s=0;s{try{switch(n.data.type){case"initializeLocalDataset":await gl.embedLocalPairings(n.data.pairings,n.data.apiKey,n.data.parameters.embeddingModel),await gl.initDatasets({pairings:n.data.pairings,parameters:n.data.parameters});break;case"initializeExampleDataset":await gl.fetchPrecomputedEmbeddings(n.data.cacheUrl),await gl.initDatasets({pairings:n.data.pairings,parameters:n.data.parameters});break;case"train":await gl.train(n.data.parameters);break;case"getEmbeddingCache":Vr({type:"dumpEmbeddingCache",cache:gl.getEmbeddingCache()});break;default:throw new Error("Unknown message type "+n.data)}}catch(t){console.log("bar",t),Vr({type:"error",message:t.toString()})}})})(); +}`;var Jt=QE(function(){return me(D,Tt+"return "+ht).apply(e,O)});if(Jt.source=ht,V0(Jt))throw Jt;return Jt}function Kot(c){return be(c).toLowerCase()}function qot(c){return be(c).toUpperCase()}function jot(c,p,y){if(c=be(c),c&&(y||p===e))return lT(c);if(!c||!(p=_s(p)))return c;var $=br(c),S=br(p),D=uT($,S),O=cT($,S)+1;return di($,D,O).join("")}function Xot(c,p,y){if(c=be(c),c&&(y||p===e))return c.slice(0,dT(c)+1);if(!c||!(p=_s(p)))return c;var $=br(c),S=cT($,br(p))+1;return di($,0,S).join("")}function Yot(c,p,y){if(c=be(c),c&&(y||p===e))return c.replace(Vy,"");if(!c||!(p=_s(p)))return c;var $=br(c),S=uT($,br(p));return di($,S).join("")}function Zot(c,p){var y=F,$=P;if(Ge(p)){var S="separator"in p?p.separator:S;y="length"in p?jt(p.length):y,$="omission"in p?_s(p.omission):$}c=be(c);var D=c.length;if(yl(c)){var O=br(c);D=O.length}if(y>=D)return c;var M=y-wl($);if(M<1)return $;var H=O?di(O,0,M).join(""):c.slice(0,M);if(S===e)return H+$;if(O&&(M+=H.length-M),U0(S)){if(c.slice(M).search(S)){var it,at=H;for(S.global||(S=o0(S.source,be(_N.exec(S))+"g")),S.lastIndex=0;it=S.exec(at);)var ht=it.index;H=H.slice(0,ht===e?M:ht)}}else if(c.indexOf(_s(S),M)!=M){var wt=H.lastIndexOf(S);wt>-1&&(H=H.slice(0,wt))}return H+$}function Jot(c){return c=be(c),c&&aQ.test(c)?c.replace(NN,ktt):c}var Qot=Nl(function(c,p,y){return c+(y?" ":"")+p.toUpperCase()}),K0=tE("toUpperCase");function JE(c,p,y){return c=be(c),p=y?e:p,p===e?wtt(c)?Ttt(c):htt(c):c.match(p)||[]}var QE=Qt(function(c,p){try{return Ts(c,e,p)}catch(y){return V0(y)?y:new Gt(y)}}),tit=yo(function(c,p){return Ys(p,function(y){y=Kr(y),xo(c,y,z0(c[y],c))}),c});function eit(c){var p=c==null?0:c.length,y=Lt();return c=p?Ue(c,function($){if(typeof $[1]!="function")throw new Zs(i);return[y($[0]),$[1]]}):[],Qt(function($){for(var S=-1;++SZ)return[];var y=lt,$=Vn(c,lt);p=Lt(p),c-=lt;for(var S=n0($,p);++y0||p<0)?new ee(y):(c<0?y=y.takeRight(-c):c&&(y=y.drop(c)),p!==e&&(p=jt(p),y=p<0?y.dropRight(-p):y.take(p-c)),y)},ee.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},ee.prototype.toArray=function(){return this.take(lt)},Gr(ee.prototype,function(c,p){var y=/^(?:filter|find|map|reject)|While$/.test(p),$=/^(?:head|last)$/.test(p),S=_[$?"take"+(p=="last"?"Right":""):p],D=$||/^find/.test(p);S&&(_.prototype[p]=function(){var O=this.__wrapped__,M=$?[1]:arguments,H=O instanceof ee,it=M[0],at=H||Kt(O),ht=function(te){var ae=S.apply(_,ii([te],M));return $&&wt?ae[0]:ae};at&&y&&typeof it=="function"&&it.length!=1&&(H=at=!1);var wt=this.__chain__,Tt=!!this.__actions__.length,Mt=D&&!wt,Jt=H&&!Tt;if(!D&&at){O=Jt?O:new ee(this);var Bt=c.apply(O,M);return Bt.__actions__.push({func:Lp,args:[ht],thisArg:e}),new Js(Bt,wt)}return Mt&&Jt?c.apply(this,M):(Bt=this.thru(ht),Mt?$?Bt.value()[0]:Bt.value():Bt)})}),Ys(["pop","push","shift","sort","splice","unshift"],function(c){var p=lp[c],y=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",$=/^(?:pop|shift)$/.test(c);_.prototype[c]=function(){var S=arguments;if($&&!this.__chain__){var D=this.value();return p.apply(Kt(D)?D:[],S)}return this[y](function(O){return p.apply(Kt(O)?O:[],S)})}}),Gr(ee.prototype,function(c,p){var y=_[p];if(y){var $=y.name+"";we.call($l,$)||($l[$]=[]),$l[$].push({name:p,func:y})}}),$l[Ep(e,w).name]=[{name:"wrapper",func:e}],ee.prototype.clone=Ytt,ee.prototype.reverse=Ztt,ee.prototype.value=Jtt,_.prototype.at=Est,_.prototype.chain=_st,_.prototype.commit=Rst,_.prototype.next=Ast,_.prototype.plant=Fst,_.prototype.reverse=Ost,_.prototype.toJSON=_.prototype.valueOf=_.prototype.value=Lst,_.prototype.first=_.prototype.head,Gc&&(_.prototype[Gc]=Dst),_},vl=Ett();ca?((ca.exports=vl)._=vl,jy._=vl):_n._=vl}).call($e)}(Qf,Qf.exports);var fo=Qf.exports,xN={},Ty={},tp=$e&&$e.__assign||function(){return tp=Object.assign||function(n){for(var t,e=1,s=arguments.length;e0&&o[o.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]0&&o[o.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]=this.options.numOfAttempts},enumerable:!0,configurable:!0}),n.prototype.applyDelay=function(){return Oy(this,void 0,void 0,function(){var t;return Ly(this,function(e){switch(e.label){case 0:return t=UJ.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return e.sent(),[2]}})})},n}();const qJ="text-embedding-ada-002";function Vr(n){postMessage(n)}class jJ{constructor(){$o(this,"cache",{})}addToCache(t){this.cache={...this.cache,...t}}getCache(){return this.cache}getCachedEmbedding(t){if(!(t in this.cache))throw new Error(`Text not cached in embedding ${t}}`);return this.cache[t]}async bulkEmbed(t,e,s=qJ){Vr({type:"embeddingProgress",progress:0}),si.info("Bulk embedding...");const r=[...new Set(t.flatMap(a=>[a.text_1,a.text_2]))],o=await mN.embeddings.bulkGet(r.map(a=>[a,s])),i=[];for(let a=0;a0){si.info(`Fetching ${i.length} embeddings`);const a=fo.chunk(i,150);for(let l=0;lfetch("https://api.openai.com/v1/embeddings",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({model:s,input:u})})),d=await h.json();if(h.status!==200)throw si.error(d),new Error(`Failed to fetch embeddings: ${d.error.message}`);const f=d.data.map(m=>({embedding:m.embedding,text:u[m.index],dateCreated:new Date,model:s}));await mN.embeddings.bulkPut(f),f.forEach(m=>{this.cache[m.text]=m.embedding}),Vr({type:"embeddingProgress",progress:l/a.length})}si.info("Done fetching")}else si.info("No embeddings to fetch")}}function bN(n){const t=[];for(const i of fo.range(-1e3,1e3,1)){const a=i/1e3;let l=0;for(const[h,d]of n){let f;h>a?f=1:f=-1,f===d&&(l+=1)}const u=l/n.length;t.push(u)}const e=fo.max(t),s=t.length,r=Math.sqrt(e*(1-e)/s),o=`${(e*100).toFixed(1)}% ± ${(1.96*r*100).toFixed(1)}%`;return{accuracy:e,se:r,message:o}}function yN(n,t){return t?n.matMul(t):n}async function wN(n,t){const e=X(()=>O$(yN(n.e1,t),yN(n.e2,t)).mul(-1).arraySync());return fo.zip(e,n.labels.arraySync())}function Py(n,t,e,s){return X(()=>{const r=Lg(n,s),o=Lg(t,s),i=r.matMul(e),a=o.matMul(e);return O$(i,a).mul(-1)})}function My(n,t){return n.sub(t).square().mean()}const XJ=(n,t,e,s)=>function(o){const i=Py(t,e,o,n);return My(i,s)};async function*YJ(n,t,e){const s=n.tfDataset.shuffle(n.tfDataset.size).batch(t.batchSize);let r=1/0;const o=e.clone().variable();for(let i=0;i{X(()=>{const{e1:u,e2:h,labels:d}=l,m=DD(XJ(t.dropoutFraction,u,h,d))(o);o.assign(o.sub(m.mul(t.learningRate)))})});const a=X(()=>{const l=Py(n.e1,n.e2,o,t.dropoutFraction);return My(l,n.labels).dataSync()[0]});a{const{e1:a,e2:l,labels:u}=i;r.minimize(()=>My(Py(a,l,e,t.dropoutFraction),u),!1,[e])}),yield o}function JJ(n,t){return zw([n,t]).variable()}function QJ(n,t,e){switch(t.optimizer){case"gradient":return YJ(n,t,e);case"adamax":return ZJ(n,t,e)}}function vN(n,t){const e=[],s=[],r=[];for(const{text_1:m,text_2:g,label:x}of n){const b=t.getCachedEmbedding(m),w=t.getCachedEmbedding(g);e.push(b),s.push(w),r.push(x)}const o=Uu(e),i=Uu(s),a=jn(r),l=ab(e),u=ab(s),h=ab(r),d=oz({e1:l,e2:u,labels:h}),f=o.shape[1];return{e1:o,e2:i,labels:a,embeddingSize:f,tfDataset:d}}function CN(n){return n.length===0?1:n.reduce((t,e)=>t*e)}function IN(n,t,e){for(let s=0;s{try{switch(n.data.type){case"initializeLocalDataset":await gl.embedLocalPairings(n.data.pairings,n.data.apiKey,n.data.parameters.embeddingModel),await gl.initDatasets({pairings:n.data.pairings,parameters:n.data.parameters});break;case"initializeExampleDataset":await gl.fetchPrecomputedEmbeddings(n.data.cacheUrl),await gl.initDatasets({pairings:n.data.pairings,parameters:n.data.parameters});break;case"train":await gl.train(n.data.parameters);break;case"getEmbeddingCache":Vr({type:"dumpEmbeddingCache",cache:gl.getEmbeddingCache()});break;default:throw new Error("Unknown message type "+n.data)}}catch(t){Vr({type:"error",message:t.toString()})}})})(); diff --git a/assets/index-acffbbda.js b/assets/index-85b021e0.js similarity index 99% rename from assets/index-acffbbda.js rename to assets/index-85b021e0.js index aefeec6..02881a7 100644 --- a/assets/index-acffbbda.js +++ b/assets/index-85b021e0.js @@ -149,7 +149,7 @@ License: MIT `)},Kz=function(n){var S=n.noRelative,D=n.noImportant,$=n.gapMode,ie=$===void 0?"margin":$,pe=ht.useMemo(function(){return Yz(ie)},[ie]);return ht.createElement(Zz,{styles:Xz(pe,!S,ie,D?"":"!important")})},wA=!1;if(typeof window<"u")try{var Ex=Object.defineProperty({},"passive",{get:function(){return wA=!0,!0}});window.addEventListener("test",Ex,Ex),window.removeEventListener("test",Ex,Ex)}catch{wA=!1}var _0=wA?{passive:!1}:!1,Jz=function(n){return n.tagName==="TEXTAREA"},g9=function(n,S){var D=window.getComputedStyle(n);return D[S]!=="hidden"&&!(D.overflowY===D.overflowX&&!Jz(n)&&D[S]==="visible")},Qz=function(n){return g9(n,"overflowY")},qz=function(n){return g9(n,"overflowX")},GE=function(n,S){var D=S;do{typeof ShadowRoot<"u"&&D instanceof ShadowRoot&&(D=D.host);var $=y9(n,D);if($){var ie=m9(n,D),pe=ie[1],z=ie[2];if(pe>z)return!0}D=D.parentNode}while(D&&D!==document.body);return!1},eN=function(n){var S=n.scrollTop,D=n.scrollHeight,$=n.clientHeight;return[S,D,$]},tN=function(n){var S=n.scrollLeft,D=n.scrollWidth,$=n.clientWidth;return[S,D,$]},y9=function(n,S){return n==="v"?Qz(S):qz(S)},m9=function(n,S){return n==="v"?eN(S):tN(S)},rN=function(n,S){return n==="h"&&S==="rtl"?-1:1},nN=function(n,S,D,$,ie){var pe=rN(n,window.getComputedStyle(S).direction),z=pe*$,O=D.target,e=S.contains(O),p=!1,P=z>0,a=0,C=0;do{var x=m9(n,O),d=x[0],g=x[1],t=x[2],r=g-t-pe*d;(d||r)&&y9(n,O)&&(a+=r,C+=d),O=O.parentNode}while(!e&&O!==document.body||e&&(S.contains(O)||S===O));return(P&&(ie&&a===0||!ie&&z>a)||!P&&(ie&&C===0||!ie&&-z>C))&&(p=!0),p},Cx=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},WE=function(n){return[n.deltaX,n.deltaY]},$E=function(n){return n&&"current"in n?n.current:n},aN=function(n,S){return n[0]===S[0]&&n[1]===S[1]},iN=function(n){return` .block-interactivity-`.concat(n,` {pointer-events: none;} .allow-interactivity-`).concat(n,` {pointer-events: all;} -`)},oN=0,D0=[];function sN(n){var S=ht.useRef([]),D=ht.useRef([0,0]),$=ht.useRef(),ie=ht.useState(oN++)[0],pe=ht.useState(function(){return p9()})[0],z=ht.useRef(n);ht.useEffect(function(){z.current=n},[n]),ht.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(ie));var g=eA([n.lockRef.current],(n.shards||[]).map($E),!0).filter(Boolean);return g.forEach(function(t){return t.classList.add("allow-interactivity-".concat(ie))}),function(){document.body.classList.remove("block-interactivity-".concat(ie)),g.forEach(function(t){return t.classList.remove("allow-interactivity-".concat(ie))})}}},[n.inert,n.lockRef.current,n.shards]);var O=ht.useCallback(function(g,t){if("touches"in g&&g.touches.length===2)return!z.current.allowPinchZoom;var r=Cx(g),o=D.current,i="deltaX"in g?g.deltaX:o[0]-r[0],u="deltaY"in g?g.deltaY:o[1]-r[1],h,c=g.target,b=Math.abs(i)>Math.abs(u)?"h":"v";if("touches"in g&&b==="h"&&c.type==="range")return!1;var f=GE(b,c);if(!f)return!0;if(f?h=b:(h=b==="v"?"h":"v",f=GE(b,c)),!f)return!1;if(!$.current&&"changedTouches"in g&&(i||u)&&($.current=h),!h)return!0;var m=$.current||h;return nN(m,t,g,m==="h"?i:u,!0)},[]),e=ht.useCallback(function(g){var t=g;if(!(!D0.length||D0[D0.length-1]!==pe)){var r="deltaY"in t?WE(t):Cx(t),o=S.current.filter(function(h){return h.name===t.type&&h.target===t.target&&aN(h.delta,r)})[0];if(o&&o.should){t.cancelable&&t.preventDefault();return}if(!o){var i=(z.current.shards||[]).map($E).filter(Boolean).filter(function(h){return h.contains(t.target)}),u=i.length>0?O(t,i[0]):!z.current.noIsolation;u&&t.cancelable&&t.preventDefault()}}},[]),p=ht.useCallback(function(g,t,r,o){var i={name:g,delta:t,target:r,should:o};S.current.push(i),setTimeout(function(){S.current=S.current.filter(function(u){return u!==i})},1)},[]),P=ht.useCallback(function(g){D.current=Cx(g),$.current=void 0},[]),a=ht.useCallback(function(g){p(g.type,WE(g),g.target,O(g,n.lockRef.current))},[]),C=ht.useCallback(function(g){p(g.type,Cx(g),g.target,O(g,n.lockRef.current))},[]);ht.useEffect(function(){return D0.push(pe),n.setCallbacks({onScrollCapture:a,onWheelCapture:a,onTouchMoveCapture:C}),document.addEventListener("wheel",e,_0),document.addEventListener("touchmove",e,_0),document.addEventListener("touchstart",P,_0),function(){D0=D0.filter(function(g){return g!==pe}),document.removeEventListener("wheel",e,_0),document.removeEventListener("touchmove",e,_0),document.removeEventListener("touchstart",P,_0)}},[]);var x=n.removeScrollBar,d=n.inert;return ht.createElement(ht.Fragment,null,d?ht.createElement(pe,{styles:iN(ie)}):null,x?ht.createElement(Kz,{gapMode:"margin"}):null)}const lN=Nz(v9,sN);var x9=ht.forwardRef(function(n,S){return ht.createElement(Sb,Yh({},n,{ref:S,sideCar:lN}))});x9.classNames=Sb.classNames;const sS=x9,TA=["Enter"," "],uN=["ArrowDown","PageUp","Home"],b9=["ArrowUp","PageDown","End"],fN=[...uN,...b9],cN={ltr:[...TA,"ArrowRight"],rtl:[...TA,"ArrowLeft"]},hN={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Mb="Menu",[Sm,dN,vN]=bb(Mb),[e0,w9]=Bc(Mb,[vN,Cg,f9]),lS=Cg(),T9=f9(),[pN,t0]=e0(Mb),[gN,Bm]=e0(Mb),yN=n=>{const{__scopeMenu:S,open:D=!1,children:$,dir:ie,onOpenChange:pe,modal:z=!0}=n,O=lS(S),[e,p]=ht.useState(null),P=ht.useRef(!1),a=Ns(pe),C=yb(ie);return ht.useEffect(()=>{const x=()=>{P.current=!0,document.addEventListener("pointerdown",d,{capture:!0,once:!0}),document.addEventListener("pointermove",d,{capture:!0,once:!0})},d=()=>P.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",d,{capture:!0}),document.removeEventListener("pointermove",d,{capture:!0})}},[]),ht.createElement(rS,O,ht.createElement(pN,{scope:S,open:D,onOpenChange:a,content:e,onContentChange:p},ht.createElement(gN,{scope:S,onClose:ht.useCallback(()=>a(!1),[a]),isUsingKeyboardRef:P,dir:C,modal:z},$)))},A9=ht.forwardRef((n,S)=>{const{__scopeMenu:D,...$}=n,ie=lS(D);return ht.createElement(nS,ga({},ie,$,{ref:S}))}),S9="MenuPortal",[mN,M9]=e0(S9,{forceMount:void 0}),xN=n=>{const{__scopeMenu:S,forceMount:D,children:$,container:ie}=n,pe=t0(S9,S);return ht.createElement(mN,{scope:S,forceMount:D},ht.createElement(Mf,{present:D||pe.open},ht.createElement(Ab,{asChild:!0,container:ie},$)))},xh="MenuContent",[bN,uS]=e0(xh),wN=ht.forwardRef((n,S)=>{const D=M9(xh,n.__scopeMenu),{forceMount:$=D.forceMount,...ie}=n,pe=t0(xh,n.__scopeMenu),z=Bm(xh,n.__scopeMenu);return ht.createElement(Sm.Provider,{scope:n.__scopeMenu},ht.createElement(Mf,{present:$||pe.open},ht.createElement(Sm.Slot,{scope:n.__scopeMenu},z.modal?ht.createElement(TN,ga({},ie,{ref:S})):ht.createElement(AN,ga({},ie,{ref:S})))))}),TN=ht.forwardRef((n,S)=>{const D=t0(xh,n.__scopeMenu),$=ht.useRef(null),ie=so(S,$);return ht.useEffect(()=>{const pe=$.current;if(pe)return oS(pe)},[]),ht.createElement(fS,ga({},n,{ref:ie,trapFocus:D.open,disableOutsidePointerEvents:D.open,disableOutsideScroll:!0,onFocusOutside:Ja(n.onFocusOutside,pe=>pe.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>D.onOpenChange(!1)}))}),AN=ht.forwardRef((n,S)=>{const D=t0(xh,n.__scopeMenu);return ht.createElement(fS,ga({},n,{ref:S,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>D.onOpenChange(!1)}))}),fS=ht.forwardRef((n,S)=>{const{__scopeMenu:D,loop:$=!1,trapFocus:ie,onOpenAutoFocus:pe,onCloseAutoFocus:z,disableOutsidePointerEvents:O,onEntryFocus:e,onEscapeKeyDown:p,onPointerDownOutside:P,onFocusOutside:a,onInteractOutside:C,onDismiss:x,disableOutsideScroll:d,...g}=n,t=t0(xh,D),r=Bm(xh,D),o=lS(D),i=T9(D),u=dN(D),[h,c]=ht.useState(null),b=ht.useRef(null),f=so(S,b,t.onContentChange),m=ht.useRef(0),v=ht.useRef(""),l=ht.useRef(0),y=ht.useRef(null),E=ht.useRef("right"),A=ht.useRef(0),R=d?sS:ht.Fragment,w=d?{as:Yv,allowPinchZoom:!0}:void 0,L=s=>{var _,T;const B=v.current+s,F=u().filter(G=>!G.disabled),W=document.activeElement,N=(_=F.find(G=>G.ref.current===W))===null||_===void 0?void 0:_.textValue,V=F.map(G=>G.textValue),H=BN(V,B,N),U=(T=F.find(G=>G.textValue===H))===null||T===void 0?void 0:T.ref.current;(function G(Y){v.current=Y,window.clearTimeout(m.current),Y!==""&&(m.current=window.setTimeout(()=>G(""),1e3))})(B),U&&setTimeout(()=>U.focus())};ht.useEffect(()=>()=>window.clearTimeout(m.current),[]),Z4();const M=ht.useCallback(s=>{var _,T;return E.current===((_=y.current)===null||_===void 0?void 0:_.side)&&HN(s,(T=y.current)===null||T===void 0?void 0:T.area)},[]);return ht.createElement(bN,{scope:D,searchRef:v,onItemEnter:ht.useCallback(s=>{M(s)&&s.preventDefault()},[M]),onItemLeave:ht.useCallback(s=>{var _;M(s)||((_=b.current)===null||_===void 0||_.focus(),c(null))},[M]),onTriggerLeave:ht.useCallback(s=>{M(s)&&s.preventDefault()},[M]),pointerGraceTimerRef:l,onPointerGraceIntentChange:ht.useCallback(s=>{y.current=s},[])},ht.createElement(R,w,ht.createElement(X4,{asChild:!0,trapped:ie,onMountAutoFocus:Ja(pe,s=>{var _;s.preventDefault(),(_=b.current)===null||_===void 0||_.focus()}),onUnmountAutoFocus:z},ht.createElement(zm,{asChild:!0,disableOutsidePointerEvents:O,onEscapeKeyDown:p,onPointerDownOutside:P,onFocusOutside:a,onInteractOutside:C,onDismiss:x},ht.createElement(Mz,ga({asChild:!0},i,{dir:r.dir,orientation:"vertical",loop:$,currentTabStopId:h,onCurrentTabStopIdChange:c,onEntryFocus:Ja(e,s=>{r.isUsingKeyboardRef.current||s.preventDefault()})}),ht.createElement(aS,ga({role:"menu","aria-orientation":"vertical","data-state":R9(t.open),"data-radix-menu-content":"",dir:r.dir},o,g,{ref:f,style:{outline:"none",...g.style},onKeyDown:Ja(g.onKeyDown,s=>{const T=s.target.closest("[data-radix-menu-content]")===s.currentTarget,B=s.ctrlKey||s.altKey||s.metaKey,F=s.key.length===1;T&&(s.key==="Tab"&&s.preventDefault(),!B&&F&&L(s.key));const W=b.current;if(s.target!==W||!fN.includes(s.key))return;s.preventDefault();const V=u().filter(H=>!H.disabled).map(H=>H.ref.current);b9.includes(s.key)&&V.reverse(),zN(V)}),onBlur:Ja(n.onBlur,s=>{s.currentTarget.contains(s.target)||(window.clearTimeout(m.current),v.current="")}),onPointerMove:Ja(n.onPointerMove,Mm(s=>{const _=s.target,T=A.current!==s.clientX;if(s.currentTarget.contains(_)&&T){const B=s.clientX>A.current?"right":"left";E.current=B,A.current=s.clientX}}))})))))))}),SN=ht.forwardRef((n,S)=>{const{__scopeMenu:D,...$}=n;return ht.createElement(Ci.div,ga({},$,{ref:S}))}),AA="MenuItem",jE="menu.itemSelect",cS=ht.forwardRef((n,S)=>{const{disabled:D=!1,onSelect:$,...ie}=n,pe=ht.useRef(null),z=Bm(AA,n.__scopeMenu),O=uS(AA,n.__scopeMenu),e=so(S,pe),p=ht.useRef(!1),P=()=>{const a=pe.current;if(!D&&a){const C=new CustomEvent(jE,{bubbles:!0,cancelable:!0});a.addEventListener(jE,x=>$==null?void 0:$(x),{once:!0}),$4(a,C),C.defaultPrevented?p.current=!1:z.onClose()}};return ht.createElement(E9,ga({},ie,{ref:e,disabled:D,onClick:Ja(n.onClick,P),onPointerDown:a=>{var C;(C=n.onPointerDown)===null||C===void 0||C.call(n,a),p.current=!0},onPointerUp:Ja(n.onPointerUp,a=>{var C;p.current||(C=a.currentTarget)===null||C===void 0||C.click()}),onKeyDown:Ja(n.onKeyDown,a=>{const C=O.searchRef.current!=="";D||C&&a.key===" "||TA.includes(a.key)&&(a.currentTarget.click(),a.preventDefault())})}))}),E9=ht.forwardRef((n,S)=>{const{__scopeMenu:D,disabled:$=!1,textValue:ie,...pe}=n,z=uS(AA,D),O=T9(D),e=ht.useRef(null),p=so(S,e),[P,a]=ht.useState(!1),[C,x]=ht.useState("");return ht.useEffect(()=>{const d=e.current;if(d){var g;x(((g=d.textContent)!==null&&g!==void 0?g:"").trim())}},[pe.children]),ht.createElement(Sm.ItemSlot,{scope:D,disabled:$,textValue:ie??C},ht.createElement(Ez,ga({asChild:!0},O,{focusable:!$}),ht.createElement(Ci.div,ga({role:"menuitem","data-highlighted":P?"":void 0,"aria-disabled":$||void 0,"data-disabled":$?"":void 0},pe,{ref:p,onPointerMove:Ja(n.onPointerMove,Mm(d=>{$?z.onItemLeave(d):(z.onItemEnter(d),d.defaultPrevented||d.currentTarget.focus())})),onPointerLeave:Ja(n.onPointerLeave,Mm(d=>z.onItemLeave(d))),onFocus:Ja(n.onFocus,()=>a(!0)),onBlur:Ja(n.onBlur,()=>a(!1))}))))}),MN=ht.forwardRef((n,S)=>{const{checked:D=!1,onCheckedChange:$,...ie}=n;return ht.createElement(P9,{scope:n.__scopeMenu,checked:D},ht.createElement(cS,ga({role:"menuitemcheckbox","aria-checked":$2(D)?"mixed":D},ie,{ref:S,"data-state":hS(D),onSelect:Ja(ie.onSelect,()=>$==null?void 0:$($2(D)?!0:!D),{checkForDefaultPrevented:!1})})))}),EN="MenuRadioGroup",[HV,CN]=e0(EN,{value:void 0,onValueChange:()=>{}}),PN="MenuRadioItem",LN=ht.forwardRef((n,S)=>{const{value:D,...$}=n,ie=CN(PN,n.__scopeMenu),pe=D===ie.value;return ht.createElement(P9,{scope:n.__scopeMenu,checked:pe},ht.createElement(cS,ga({role:"menuitemradio","aria-checked":pe},$,{ref:S,"data-state":hS(pe),onSelect:Ja($.onSelect,()=>{var z;return(z=ie.onValueChange)===null||z===void 0?void 0:z.call(ie,D)},{checkForDefaultPrevented:!1})})))}),C9="MenuItemIndicator",[P9,RN]=e0(C9,{checked:!1}),_N=ht.forwardRef((n,S)=>{const{__scopeMenu:D,forceMount:$,...ie}=n,pe=RN(C9,D);return ht.createElement(Mf,{present:$||$2(pe.checked)||pe.checked===!0},ht.createElement(Ci.span,ga({},ie,{ref:S,"data-state":hS(pe.checked)})))}),DN=ht.forwardRef((n,S)=>{const{__scopeMenu:D,...$}=n;return ht.createElement(Ci.div,ga({role:"separator","aria-orientation":"horizontal"},$,{ref:S}))}),IN="MenuSub",[VV,L9]=e0(IN),Px="MenuSubTrigger",kN=ht.forwardRef((n,S)=>{const D=t0(Px,n.__scopeMenu),$=Bm(Px,n.__scopeMenu),ie=L9(Px,n.__scopeMenu),pe=uS(Px,n.__scopeMenu),z=ht.useRef(null),{pointerGraceTimerRef:O,onPointerGraceIntentChange:e}=pe,p={__scopeMenu:n.__scopeMenu},P=ht.useCallback(()=>{z.current&&window.clearTimeout(z.current),z.current=null},[]);return ht.useEffect(()=>P,[P]),ht.useEffect(()=>{const a=O.current;return()=>{window.clearTimeout(a),e(null)}},[O,e]),ht.createElement(A9,ga({asChild:!0},p),ht.createElement(E9,ga({id:ie.triggerId,"aria-haspopup":"menu","aria-expanded":D.open,"aria-controls":ie.contentId,"data-state":R9(D.open)},n,{ref:pb(S,ie.onTriggerChange),onClick:a=>{var C;(C=n.onClick)===null||C===void 0||C.call(n,a),!(n.disabled||a.defaultPrevented)&&(a.currentTarget.focus(),D.open||D.onOpenChange(!0))},onPointerMove:Ja(n.onPointerMove,Mm(a=>{pe.onItemEnter(a),!a.defaultPrevented&&!n.disabled&&!D.open&&!z.current&&(pe.onPointerGraceIntentChange(null),z.current=window.setTimeout(()=>{D.onOpenChange(!0),P()},100))})),onPointerLeave:Ja(n.onPointerLeave,Mm(a=>{var C;P();const x=(C=D.content)===null||C===void 0?void 0:C.getBoundingClientRect();if(x){var d;const g=(d=D.content)===null||d===void 0?void 0:d.dataset.side,t=g==="right",r=t?-5:5,o=x[t?"left":"right"],i=x[t?"right":"left"];pe.onPointerGraceIntentChange({area:[{x:a.clientX+r,y:a.clientY},{x:o,y:x.top},{x:i,y:x.top},{x:i,y:x.bottom},{x:o,y:x.bottom}],side:g}),window.clearTimeout(O.current),O.current=window.setTimeout(()=>pe.onPointerGraceIntentChange(null),300)}else{if(pe.onTriggerLeave(a),a.defaultPrevented)return;pe.onPointerGraceIntentChange(null)}})),onKeyDown:Ja(n.onKeyDown,a=>{const C=pe.searchRef.current!=="";if(!(n.disabled||C&&a.key===" ")&&cN[$.dir].includes(a.key)){var x;D.onOpenChange(!0),(x=D.content)===null||x===void 0||x.focus(),a.preventDefault()}})})))}),FN="MenuSubContent",ON=ht.forwardRef((n,S)=>{const D=M9(xh,n.__scopeMenu),{forceMount:$=D.forceMount,...ie}=n,pe=t0(xh,n.__scopeMenu),z=Bm(xh,n.__scopeMenu),O=L9(FN,n.__scopeMenu),e=ht.useRef(null),p=so(S,e);return ht.createElement(Sm.Provider,{scope:n.__scopeMenu},ht.createElement(Mf,{present:$||pe.open},ht.createElement(Sm.Slot,{scope:n.__scopeMenu},ht.createElement(fS,ga({id:O.contentId,"aria-labelledby":O.triggerId},ie,{ref:p,align:"start",side:z.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:P=>{var a;z.isUsingKeyboardRef.current&&((a=e.current)===null||a===void 0||a.focus()),P.preventDefault()},onCloseAutoFocus:P=>P.preventDefault(),onFocusOutside:Ja(n.onFocusOutside,P=>{P.target!==O.trigger&&pe.onOpenChange(!1)}),onEscapeKeyDown:Ja(n.onEscapeKeyDown,P=>{z.onClose(),P.preventDefault()}),onKeyDown:Ja(n.onKeyDown,P=>{const a=P.currentTarget.contains(P.target),C=hN[z.dir].includes(P.key);if(a&&C){var x;pe.onOpenChange(!1),(x=O.trigger)===null||x===void 0||x.focus(),P.preventDefault()}})})))))});function R9(n){return n?"open":"closed"}function $2(n){return n==="indeterminate"}function hS(n){return $2(n)?"indeterminate":n?"checked":"unchecked"}function zN(n){const S=document.activeElement;for(const D of n)if(D===S||(D.focus(),document.activeElement!==S))return}function NN(n,S){return n.map((D,$)=>n[(S+$)%n.length])}function BN(n,S,D){const ie=S.length>1&&Array.from(S).every(p=>p===S[0])?S[0]:S,pe=D?n.indexOf(D):-1;let z=NN(n,Math.max(pe,0));ie.length===1&&(z=z.filter(p=>p!==D));const e=z.find(p=>p.toLowerCase().startsWith(ie.toLowerCase()));return e!==D?e:void 0}function UN(n,S){const{x:D,y:$}=n;let ie=!1;for(let pe=0,z=S.length-1;pe$!=P>$&&D<(p-O)*($-e)/(P-e)+O&&(ie=!ie)}return ie}function HN(n,S){if(!S)return!1;const D={x:n.clientX,y:n.clientY};return UN(D,S)}function Mm(n){return S=>S.pointerType==="mouse"?n(S):void 0}const VN=yN,GN=A9,WN=xN,$N=wN,jN=SN,YN=cS,ZN=MN,XN=LN,KN=_N,JN=DN,QN=kN,qN=ON,_9="DropdownMenu",[eB,GV]=Bc(_9,[w9]),Hc=w9(),[tB,D9]=eB(_9),rB=n=>{const{__scopeDropdownMenu:S,children:D,dir:$,open:ie,defaultOpen:pe,onOpenChange:z,modal:O=!0}=n,e=Hc(S),p=ht.useRef(null),[P=!1,a]=Xv({prop:ie,defaultProp:pe,onChange:z});return ht.createElement(tB,{scope:S,triggerId:kd(),triggerRef:p,contentId:kd(),open:P,onOpenChange:a,onOpenToggle:ht.useCallback(()=>a(C=>!C),[a]),modal:O},ht.createElement(VN,ga({},e,{open:P,onOpenChange:a,dir:$,modal:O}),D))},nB="DropdownMenuTrigger",aB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,disabled:$=!1,...ie}=n,pe=D9(nB,D),z=Hc(D);return ht.createElement(GN,ga({asChild:!0},z),ht.createElement(Ci.button,ga({type:"button",id:pe.triggerId,"aria-haspopup":"menu","aria-expanded":pe.open,"aria-controls":pe.open?pe.contentId:void 0,"data-state":pe.open?"open":"closed","data-disabled":$?"":void 0,disabled:$},ie,{ref:pb(S,pe.triggerRef),onPointerDown:Ja(n.onPointerDown,O=>{!$&&O.button===0&&O.ctrlKey===!1&&(pe.onOpenToggle(),pe.open||O.preventDefault())}),onKeyDown:Ja(n.onKeyDown,O=>{$||(["Enter"," "].includes(O.key)&&pe.onOpenToggle(),O.key==="ArrowDown"&&pe.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(O.key)&&O.preventDefault())})})))}),iB=n=>{const{__scopeDropdownMenu:S,...D}=n,$=Hc(S);return ht.createElement(WN,ga({},$,D))},oB="DropdownMenuContent",sB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=D9(oB,D),pe=Hc(D),z=ht.useRef(!1);return ht.createElement($N,ga({id:ie.contentId,"aria-labelledby":ie.triggerId},pe,$,{ref:S,onCloseAutoFocus:Ja(n.onCloseAutoFocus,O=>{var e;z.current||(e=ie.triggerRef.current)===null||e===void 0||e.focus(),z.current=!1,O.preventDefault()}),onInteractOutside:Ja(n.onInteractOutside,O=>{const e=O.detail.originalEvent,p=e.button===0&&e.ctrlKey===!0,P=e.button===2||p;(!ie.modal||P)&&(z.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),lB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(jN,ga({},ie,$,{ref:S}))}),uB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(YN,ga({},ie,$,{ref:S}))}),fB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(ZN,ga({},ie,$,{ref:S}))}),cB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(XN,ga({},ie,$,{ref:S}))}),hB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(KN,ga({},ie,$,{ref:S}))}),dB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(JN,ga({},ie,$,{ref:S}))}),vB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(QN,ga({},ie,$,{ref:S}))}),pB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(qN,ga({},ie,$,{ref:S,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),gB=rB,yB=aB,mB=iB,I9=sB,k9=lB,F9=uB,O9=fB,z9=cB,N9=hB,B9=dB,U9=vB,H9=pB;function Um(n,S){if(n==null)return{};var D={},$=Object.keys(n),ie,pe;for(pe=0;pe<$.length;pe++)ie=$[pe],!(S.indexOf(ie)>=0)&&(D[ie]=n[ie]);return D}var xB=["color"],bB=ht.forwardRef(function(n,S){var D=n.color,$=D===void 0?"currentColor":D,ie=Um(n,xB);return ht.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie,{ref:S}),ht.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:$,fillRule:"evenodd",clipRule:"evenodd"}))}),wB=["color"],V9=ht.forwardRef(function(n,S){var D=n.color,$=D===void 0?"currentColor":D,ie=Um(n,wB);return ht.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie,{ref:S}),ht.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:$,fillRule:"evenodd",clipRule:"evenodd"}))}),TB=["color"],AB=ht.forwardRef(function(n,S){var D=n.color,$=D===void 0?"currentColor":D,ie=Um(n,TB);return ht.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie,{ref:S}),ht.createElement("path",{d:"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",fill:$,fillRule:"evenodd",clipRule:"evenodd"}))}),SB=["color"],G9=ht.forwardRef(function(n,S){var D=n.color,$=D===void 0?"currentColor":D,ie=Um(n,SB);return ht.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie,{ref:S}),ht.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:$,fillRule:"evenodd",clipRule:"evenodd"}))}),MB=["color"],EB=ht.forwardRef(function(n,S){var D=n.color,$=D===void 0?"currentColor":D,ie=Um(n,MB);return ht.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie,{ref:S}),ht.createElement("path",{d:"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",fill:$}))});const W9=gB,$9=yB,CB=ht.forwardRef(({className:n,inset:S,children:D,...$},ie)=>qt.jsxs(U9,{ref:ie,className:Ni("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",S&&"pl-8",n),...$,children:[D,qt.jsx(AB,{className:"ml-auto h-4 w-4"})]}));CB.displayName=U9.displayName;const PB=ht.forwardRef(({className:n,...S},D)=>qt.jsx(H9,{ref:D,className:Ni("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...S}));PB.displayName=H9.displayName;const dS=ht.forwardRef(({className:n,sideOffset:S=4,...D},$)=>qt.jsx(mB,{children:qt.jsx(I9,{ref:$,sideOffset:S,className:Ni("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...D})}));dS.displayName=I9.displayName;const j2=ht.forwardRef(({className:n,inset:S,...D},$)=>qt.jsx(F9,{ref:$,className:Ni("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",S&&"pl-8",n),...D}));j2.displayName=F9.displayName;const LB=ht.forwardRef(({className:n,children:S,checked:D,...$},ie)=>qt.jsxs(O9,{ref:ie,className:Ni("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),checked:D,...$,children:[qt.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:qt.jsx(N9,{children:qt.jsx(V9,{className:"h-4 w-4"})})}),S]}));LB.displayName=O9.displayName;const RB=ht.forwardRef(({className:n,children:S,...D},$)=>qt.jsxs(z9,{ref:$,className:Ni("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...D,children:[qt.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:qt.jsx(N9,{children:qt.jsx(EB,{className:"h-4 w-4 fill-current"})})}),S]}));RB.displayName=z9.displayName;const _B=ht.forwardRef(({className:n,inset:S,...D},$)=>qt.jsx(k9,{ref:$,className:Ni("px-2 py-1.5 text-sm font-semibold",S&&"pl-8",n),...D}));_B.displayName=k9.displayName;const DB=ht.forwardRef(({className:n,...S},D)=>qt.jsx(B9,{ref:D,className:Ni("-mx-1 my-1 h-px bg-muted",n),...S}));DB.displayName=B9.displayName;const j9="Dialog",[Y9,WV]=Bc(j9),[IB,Ah]=Y9(j9),kB=n=>{const{__scopeDialog:S,children:D,open:$,defaultOpen:ie,onOpenChange:pe,modal:z=!0}=n,O=ht.useRef(null),e=ht.useRef(null),[p=!1,P]=Xv({prop:$,defaultProp:ie,onChange:pe});return ht.createElement(IB,{scope:S,triggerRef:O,contentRef:e,contentId:kd(),titleId:kd(),descriptionId:kd(),open:p,onOpenChange:P,onOpenToggle:ht.useCallback(()=>P(a=>!a),[P]),modal:z},D)},FB="DialogTrigger",OB=ht.forwardRef((n,S)=>{const{__scopeDialog:D,...$}=n,ie=Ah(FB,D),pe=so(S,ie.triggerRef);return ht.createElement(Ci.button,ga({type:"button","aria-haspopup":"dialog","aria-expanded":ie.open,"aria-controls":ie.contentId,"data-state":vS(ie.open)},$,{ref:pe,onClick:Ja(n.onClick,ie.onOpenToggle)}))}),Z9="DialogPortal",[zB,X9]=Y9(Z9,{forceMount:void 0}),NB=n=>{const{__scopeDialog:S,forceMount:D,children:$,container:ie}=n,pe=Ah(Z9,S);return ht.createElement(zB,{scope:S,forceMount:D},ht.Children.map($,z=>ht.createElement(Mf,{present:D||pe.open},ht.createElement(Ab,{asChild:!0,container:ie},z))))},SA="DialogOverlay",BB=ht.forwardRef((n,S)=>{const D=X9(SA,n.__scopeDialog),{forceMount:$=D.forceMount,...ie}=n,pe=Ah(SA,n.__scopeDialog);return pe.modal?ht.createElement(Mf,{present:$||pe.open},ht.createElement(UB,ga({},ie,{ref:S}))):null}),UB=ht.forwardRef((n,S)=>{const{__scopeDialog:D,...$}=n,ie=Ah(SA,D);return ht.createElement(sS,{as:Yv,allowPinchZoom:!0,shards:[ie.contentRef]},ht.createElement(Ci.div,ga({"data-state":vS(ie.open)},$,{ref:S,style:{pointerEvents:"auto",...$.style}})))}),Em="DialogContent",HB=ht.forwardRef((n,S)=>{const D=X9(Em,n.__scopeDialog),{forceMount:$=D.forceMount,...ie}=n,pe=Ah(Em,n.__scopeDialog);return ht.createElement(Mf,{present:$||pe.open},pe.modal?ht.createElement(VB,ga({},ie,{ref:S})):ht.createElement(GB,ga({},ie,{ref:S})))}),VB=ht.forwardRef((n,S)=>{const D=Ah(Em,n.__scopeDialog),$=ht.useRef(null),ie=so(S,D.contentRef,$);return ht.useEffect(()=>{const pe=$.current;if(pe)return oS(pe)},[]),ht.createElement(K9,ga({},n,{ref:ie,trapFocus:D.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ja(n.onCloseAutoFocus,pe=>{var z;pe.preventDefault(),(z=D.triggerRef.current)===null||z===void 0||z.focus()}),onPointerDownOutside:Ja(n.onPointerDownOutside,pe=>{const z=pe.detail.originalEvent,O=z.button===0&&z.ctrlKey===!0;(z.button===2||O)&&pe.preventDefault()}),onFocusOutside:Ja(n.onFocusOutside,pe=>pe.preventDefault())}))}),GB=ht.forwardRef((n,S)=>{const D=Ah(Em,n.__scopeDialog),$=ht.useRef(!1),ie=ht.useRef(!1);return ht.createElement(K9,ga({},n,{ref:S,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:pe=>{var z;if((z=n.onCloseAutoFocus)===null||z===void 0||z.call(n,pe),!pe.defaultPrevented){var O;$.current||(O=D.triggerRef.current)===null||O===void 0||O.focus(),pe.preventDefault()}$.current=!1,ie.current=!1},onInteractOutside:pe=>{var z,O;(z=n.onInteractOutside)===null||z===void 0||z.call(n,pe),pe.defaultPrevented||($.current=!0,pe.detail.originalEvent.type==="pointerdown"&&(ie.current=!0));const e=pe.target;((O=D.triggerRef.current)===null||O===void 0?void 0:O.contains(e))&&pe.preventDefault(),pe.detail.originalEvent.type==="focusin"&&ie.current&&pe.preventDefault()}}))}),K9=ht.forwardRef((n,S)=>{const{__scopeDialog:D,trapFocus:$,onOpenAutoFocus:ie,onCloseAutoFocus:pe,...z}=n,O=Ah(Em,D),e=ht.useRef(null),p=so(S,e);return Z4(),ht.createElement(ht.Fragment,null,ht.createElement(X4,{asChild:!0,loop:!0,trapped:$,onMountAutoFocus:ie,onUnmountAutoFocus:pe},ht.createElement(zm,ga({role:"dialog",id:O.contentId,"aria-describedby":O.descriptionId,"aria-labelledby":O.titleId,"data-state":vS(O.open)},z,{ref:p,onDismiss:()=>O.onOpenChange(!1)}))),!1)}),WB="DialogTitle",$B=ht.forwardRef((n,S)=>{const{__scopeDialog:D,...$}=n,ie=Ah(WB,D);return ht.createElement(Ci.h2,ga({id:ie.titleId},$,{ref:S}))}),jB="DialogDescription",YB=ht.forwardRef((n,S)=>{const{__scopeDialog:D,...$}=n,ie=Ah(jB,D);return ht.createElement(Ci.p,ga({id:ie.descriptionId},$,{ref:S}))}),ZB="DialogClose",J9=ht.forwardRef((n,S)=>{const{__scopeDialog:D,...$}=n,ie=Ah(ZB,D);return ht.createElement(Ci.button,ga({type:"button"},$,{ref:S,onClick:Ja(n.onClick,()=>ie.onOpenChange(!1))}))});function vS(n){return n?"open":"closed"}const XB=kB,KB=OB,JB=NB,Q9=BB,q9=HB,eP=$B,tP=YB,QB=J9,dg=XB,vg=KB,qB=JB,rP=ht.forwardRef(({className:n,...S},D)=>qt.jsx(Q9,{ref:D,className:Ni("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...S}));rP.displayName=Q9.displayName;const Yp=ht.forwardRef(({className:n,children:S,...D},$)=>qt.jsxs(qB,{children:[qt.jsx(rP,{}),qt.jsxs(q9,{ref:$,className:Ni("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",n),...D,children:[S,qt.jsxs(QB,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[qt.jsx(G9,{className:"h-4 w-4"}),qt.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Yp.displayName=q9.displayName;const Zp=({className:n,...S})=>qt.jsx("div",{className:Ni("flex flex-col space-y-1.5 text-center sm:text-left",n),...S});Zp.displayName="DialogHeader";const pS=({className:n,...S})=>qt.jsx("div",{className:Ni("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...S});pS.displayName="DialogFooter";const Eb=ht.forwardRef(({className:n,...S},D)=>qt.jsx(eP,{ref:D,className:Ni("text-lg font-semibold leading-none tracking-tight",n),...S}));Eb.displayName=eP.displayName;const nP=ht.forwardRef(({className:n,...S},D)=>qt.jsx(tP,{ref:D,className:Ni("text-sm text-muted-foreground",n),...S}));nP.displayName=tP.displayName;const Qf=ht.forwardRef(({className:n,type:S,...D},$)=>qt.jsx("input",{type:S,className:Ni("flex h-9 w-full rounded-md border border-input bg-slate-700 px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 text-white",n),ref:$,...D}));Qf.displayName="Input";const eU=ht.forwardRef((n,S)=>ht.createElement(Ci.label,ga({},n,{ref:S,onMouseDown:D=>{var $;($=n.onMouseDown)===null||$===void 0||$.call(n,D),!D.defaultPrevented&&D.detail>1&&D.preventDefault()}}))),aP=eU,tU=B4("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),bh=ht.forwardRef(({className:n,...S},D)=>qt.jsx(aP,{ref:D,className:Ni(tU(),n),...S}));bh.displayName=aP.displayName;function iP(n){const S=ht.useRef({value:n,previous:n});return ht.useMemo(()=>(S.current.value!==n&&(S.current.previous=S.current.value,S.current.value=n),S.current.previous),[n])}const oP="Switch",[rU,$V]=Bc(oP),[nU,aU]=rU(oP),iU=ht.forwardRef((n,S)=>{const{__scopeSwitch:D,name:$,checked:ie,defaultChecked:pe,required:z,disabled:O,value:e="on",onCheckedChange:p,...P}=n,[a,C]=ht.useState(null),x=so(S,o=>C(o)),d=ht.useRef(!1),g=a?!!a.closest("form"):!0,[t=!1,r]=Xv({prop:ie,defaultProp:pe,onChange:p});return ht.createElement(nU,{scope:D,checked:t,disabled:O},ht.createElement(Ci.button,ga({type:"button",role:"switch","aria-checked":t,"aria-required":z,"data-state":sP(t),"data-disabled":O?"":void 0,disabled:O,value:e},P,{ref:x,onClick:Ja(n.onClick,o=>{r(i=>!i),g&&(d.current=o.isPropagationStopped(),d.current||o.stopPropagation())})})),g&&ht.createElement(lU,{control:a,bubbles:!d.current,name:$,value:e,checked:t,required:z,disabled:O,style:{transform:"translateX(-100%)"}}))}),oU="SwitchThumb",sU=ht.forwardRef((n,S)=>{const{__scopeSwitch:D,...$}=n,ie=aU(oU,D);return ht.createElement(Ci.span,ga({"data-state":sP(ie.checked),"data-disabled":ie.disabled?"":void 0},$,{ref:S}))}),lU=n=>{const{control:S,checked:D,bubbles:$=!0,...ie}=n,pe=ht.useRef(null),z=iP(D),O=n9(S);return ht.useEffect(()=>{const e=pe.current,p=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(p,"checked").set;if(z!==D&&a){const C=new Event("click",{bubbles:$});a.call(e,D),e.dispatchEvent(C)}},[z,D,$]),ht.createElement("input",ga({type:"checkbox","aria-hidden":!0,defaultChecked:D},ie,{tabIndex:-1,ref:pe,style:{...n.style,...O,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function sP(n){return n?"checked":"unchecked"}const lP=iU,uU=sU,Cb=ht.forwardRef(({className:n,...S},D)=>qt.jsx(lP,{className:Ni("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n),...S,ref:D,children:qt.jsx(uU,{className:Ni("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Cb.displayName=lP.displayName;var uP={exports:{}};(function(n){(function(S,D){n.exports?n.exports=D():S.log=D()})(Cv,function(){var S=function(){},D="undefined",$=typeof window!==D&&typeof window.navigator!==D&&/Trident\/|MSIE /.test(window.navigator.userAgent),ie=["trace","debug","info","warn","error"];function pe(g,t){var r=g[t];if(typeof r.bind=="function")return r.bind(g);try{return Function.prototype.bind.call(r,g)}catch{return function(){return Function.prototype.apply.apply(r,[g,arguments])}}}function z(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function O(g){return g==="debug"&&(g="log"),typeof console===D?!1:g==="trace"&&$?z:console[g]!==void 0?pe(console,g):console.log!==void 0?pe(console,"log"):S}function e(g,t){for(var r=0;r=0&&m<=o.levels.SILENT){if(i=m,v!==!1&&h(m),e.call(o,m,g),typeof console===D&&m{this.worker.removeEventListener("message",D)}}terminate(){MA.info("Terminating worker"),this.worker.terminate()}}const dU=Jh(null),fP=Jh({type:"uninitialized"});function vU(){const{toast:n}=Sg(),S=cb(fP);return ht.useCallback(D=>{D.type==="embeddingProgress"?S({type:"embeddingProgress",progress:D.progress}):D.type==="initialPerformance"?S({type:"pretrained",pretrainingPerformance:D.performance}):D.type==="fetchingStatus"?S({type:"fetchingEmbeddings"}):D.type==="error"?n({title:"Error",description:D.message,variant:"destructive"}):D.type==="dumpEmbeddingCache"?Mk(D.cache):D.type==="doneTraining"?S($=>$.type==="training"?{type:"doneTraining",performanceHistory:$.performanceHistory,currentPerformance:$.currentPerformance,pretrainingPerformance:$.pretrainingPerformance,bestMatrix:{matrixNpy:D.matrixNpy,shape:D.shape}}:$):D.type==="updatedPerformance"&&S($=>$.type==="training"?{type:"training",currentEpoch:D.epoch,performanceHistory:[...$.performanceHistory,{test:D.performance.testAccuracyAndSE,train:D.performance.trainAccuracyAndSE}],currentPerformance:D.performance,pretrainingPerformance:$.pretrainingPerformance}:$.type==="trainingStarted"?{type:"training",currentEpoch:D.epoch,performanceHistory:[],currentPerformance:D.performance,pretrainingPerformance:$.pretrainingPerformance}:$)},[S,n])}function Hm(){const[n,S]=Gp(dU),[D,$]=Gp(fP),ie=vU(),pe=ht.useCallback(()=>{n&&n.terminate();const C=new hU;return S(C),C.addListener(ie),C},[ie,S,n]),z=ht.useCallback(C=>{pe().sendMessage({type:"initializeLocalDataset",...C})},[pe]),O=ht.useCallback(C=>{pe().sendMessage({type:"initializeExampleDataset",...C})},[pe]),e=ht.useCallback(C=>{if(!n)throw new Error("Worker not initialized");n.sendMessage({type:"train",parameters:C}),$(x=>x.type==="pretrained"||x.type==="doneTraining"?{type:"trainingStarted",currentEpoch:0,pretrainingPerformance:x.pretrainingPerformance}:x)},[n,$]),p=ht.useCallback(()=>{if(!n)throw new Error("Worker not initialized");n.sendMessage({type:"getEmbeddingCache"})},[n]),P=ht.useCallback(()=>{if(!n)throw new Error("Worker not initialized");n.terminate(),$({type:"uninitialized"})},[n,$]),a=ht.useCallback(()=>{n&&n.terminate(),$({type:"uninitialized"})},[n,$]);return D.type==="uninitialized"?{type:"uninitialized",initializeLocal:z,initializeExample:O}:D.type==="fetchingEmbeddings"||D.type==="embeddingProgress"?{...D,reset:a}:D.type==="pretrained"?{type:"pretrained",train:e,pretrainingPerformance:D.pretrainingPerformance,downloadEmbeddings:p,reset:a}:D.type==="trainingStarted"?{...D,downloadEmbeddings:p,reset:a}:D.type==="training"?{...D,downloadEmbeddings:p,stop:P,reset:a}:{...D,downloadEmbeddings:p,train:e,reset:a}}function cP(){const n=Hm();return ht.useCallback(()=>{n.type!=="uninitialized"&&n.reset()},[n])}function pU({row:n}){const S=cP(),D=n.original,[$,ie]=ht.useState(!1),[pe,z]=ht.useState(!1),[O,e]=ht.useState(!1),[p,P]=ht.useState(D.text_1),[a,C]=ht.useState(D.text_2),[x,d]=ht.useState(D.label),g=ht.useCallback(async()=>{p===""||a===""||(await Th.pair.update(D.id,{text_1:p,text_2:a,label:x}),ie(!1),e(!1),S())},[p,a,x,D,S]),t=ht.useCallback(async()=>{await Th.pair.delete(D.id),z(!1),e(!1),S()},[D,S]);return qt.jsxs(W9,{open:O,onOpenChange:e,modal:!1,children:[qt.jsx($9,{asChild:!0,children:qt.jsx(ds,{variant:"ghost",className:"h-8 w-8 p-0",children:qt.jsx(eO,{className:"h-4 w-4"})})}),qt.jsxs(dS,{align:"end",children:[qt.jsxs(dg,{open:$,onOpenChange:ie,children:[qt.jsx(vg,{asChild:!0,children:qt.jsx(j2,{onSelect:r=>r.preventDefault(),children:"Edit"})}),qt.jsxs(Yp,{className:"sm:max-w-[425px]",children:[qt.jsx(Zp,{className:"text-white",children:"Edit Row"}),qt.jsxs("div",{className:"text-white",children:[qt.jsxs("div",{className:"my-4",children:[qt.jsx(bh,{htmlFor:"text_1",children:"text_1"}),qt.jsx(Qf,{type:"text",className:"text-white mt-1",id:"text_1",placeholder:"text_1",value:p,onChange:r=>P(r.target.value)})]}),qt.jsxs("div",{className:"my-4",children:[qt.jsx(bh,{htmlFor:"text_2",children:"text_2"}),qt.jsx(Qf,{id:"text_2",type:"text",className:"text-white mt-1",placeholder:"text_2",value:a,onChange:r=>C(r.target.value)})]}),qt.jsxs("div",{className:"my-4 flex items-center space-x-2",children:[qt.jsx(Cb,{id:"label",checked:x===1,onCheckedChange:r=>d(r?1:-1)}),qt.jsxs(bh,{htmlFor:"label",children:["Currently ",x===1?"Positive":"Negative"]})]}),qt.jsx(ds,{onClick:g,children:"save"})]})]})]}),qt.jsxs(dg,{open:pe,onOpenChange:z,children:[qt.jsx(vg,{asChild:!0,children:qt.jsx(j2,{onSelect:r=>r.preventDefault(),children:"Delete"})}),qt.jsxs(Yp,{className:"max-w-[425px]",children:[qt.jsxs(Zp,{className:"text-white",children:['Delete "',D.text_1.substring(0,20),'"?']}),qt.jsxs("div",{className:"flex justify-end space-x-3",children:[qt.jsx(ds,{variant:"destructive",onClick:t,children:"Delete"}),qt.jsx(ds,{variant:"outline",className:"text-white",onClick:()=>z(!1),children:"Cancel"})]})]})]})]})]})}function gU({onAddPairing:n,onDownload:S}){const[D,$]=ht.useState(""),[ie,pe]=ht.useState(""),[z,O]=ht.useState(1),[e,p]=ht.useState(!1),P=ht.useCallback(()=>{D===""||ie===""||(n({text_1:D,text_2:ie,label:z}),p(!1))},[n,D,ie,z]);function a(C){C.key==="Enter"&&P()}return qt.jsx("div",{className:"flex items-center space-x-2 py-4",children:qt.jsxs(dg,{open:e,onOpenChange:p,children:[qt.jsx(vg,{asChild:!0,children:qt.jsxs(ds,{variant:"outline",className:"flex items-center",children:[qt.jsx(tO,{size:18,className:"mr-2"})," Create Row"]})}),qt.jsxs(ds,{variant:"outline",className:"flex items-center",onClick:S,children:[qt.jsx(Y4,{size:18,className:"mr-2"})," Download JSON"]}),qt.jsxs(Yp,{className:"sm:max-w-[425px]",children:[qt.jsx(Zp,{className:"text-white",children:"Create Row"}),qt.jsxs("div",{className:"text-white",children:[qt.jsx(bh,{htmlFor:"text_1",children:"text_1"}),qt.jsx(Qf,{placeholder:"text_1",id:"text_1",value:D,onChange:C=>$(C.target.value),onKeyDown:a}),qt.jsx(bh,{htmlFor:"text_2",children:"text_2"}),qt.jsx(Qf,{placeholder:"text_2",id:"text_2",value:ie,onChange:C=>pe(C.target.value),onKeyDown:a}),qt.jsxs("div",{className:"my-4 flex items-center space-x-2",children:[qt.jsx(Cb,{id:"label",checked:z===1,onCheckedChange:C=>O(C?1:-1)}),qt.jsxs(bh,{htmlFor:"label",children:["Currently ",z===1?"Positive":"Negative"]})]})]}),qt.jsx(pS,{children:qt.jsx(ds,{onClick:P,type:"submit",children:"save"})})]})]})})}var EA={exports:{}};const yU=cL(ZD);(function(n,S){(function(D,$){$(S,yU,ht)})(Cv,function(D,$,ie){function pe(P){return P&&typeof P=="object"&&"default"in P?P:{default:P}}var z=pe(ie);function O(P,a,C){var x,d;typeof P=="function"?(x=a||[],d=C):(x=[],d=a);var g=z.default.useRef({hasResult:!1,result:d,error:null}),t=z.default.useReducer(function(i){return i+1},0);t[0];var r=t[1],o=z.default.useMemo(function(){var i=typeof P=="function"?P():P;if(!i||typeof i.subscribe!="function")throw P===i?new TypeError("Given argument to useObservable() was neither a valid observable nor a function."):new TypeError("Observable factory given to useObservable() did not return a valid observable.");if(!g.current.hasResult&&typeof window<"u"&&(typeof i.hasValue!="function"||i.hasValue()))if(typeof i.getValue=="function")g.current.result=i.getValue(),g.current.hasResult=!0;else{var u=i.subscribe(function(h){g.current.result=h,g.current.hasResult=!0});typeof u=="function"?u():u.unsubscribe()}return i},x);if(z.default.useDebugValue(g.current.result),z.default.useEffect(function(){var i=o.subscribe(function(u){var h=g.current;(h.error!==null||h.result!==u)&&(h.error=null,h.result=u,h.hasResult=!0,r())},function(u){var h=g.current;h.error!==u&&(h.error=u,r())});return typeof i=="function"?i:i.unsubscribe.bind(i)},x),g.current.error)throw g.current.error;return g.current.result}function e(P,a,C){return O(function(){return $.liveQuery(P)},a||[],C)}function p(P,a,C){if(!P)throw new TypeError("Invalid arguments to usePermissions(): undefined or null");var x;if(arguments.length>=3){if(!("transaction"in P))throw new TypeError("Invalid arguments to usePermission(db, table, obj): 1st arg must be a Dexie instance");if(typeof a!="string")throw new TypeError("Invalid arguments to usePermission(db, table, obj): 2nd arg must be string");if(!C||typeof C!="object")throw new TypeError("Invalid arguments to usePermission(db, table, obj): 3rd arg must be an object");x=P}else{if(P instanceof $.Dexie)throw new TypeError("Invalid arguments to usePermission(db, table, obj): Missing table and obj arguments.");if(typeof P.table=="function"&&typeof P.db=="object")x=P.db,C=P,a=P.table();else throw new TypeError("Invalid arguments to usePermissions(). Expected usePermissions(entity: DexieCloudEntity) or usePermissions(db: Dexie, table: string, obj: DexieCloudObject)")}if(!("cloud"in x))throw new Error("usePermissions() is only for Dexie Cloud but there's no dexie-cloud-addon active in given db.");if(!("permissions"in x.cloud))throw new Error("usePermissions() requires a newer version of dexie-cloud-addon. Please upgrade it.");return O(function(){return x.cloud.permissions(C,a)},[C.realmId,C.owner,a])}D.useLiveQuery=e,D.useObservable=O,D.usePermissions=p,Object.defineProperty(D,"__esModule",{value:!0})})})(EA,EA.exports);var Vm=EA.exports;function mU(n){return ht.useCallback(()=>{if(!n)return;const S=n.map(({text_1:z,text_2:O,label:e})=>({text_1:z,text_2:O,label:e})),D=JSON.stringify(S,null,2),$=new Blob([D],{type:"application/json"}),ie=URL.createObjectURL($),pe=document.createElement("a");pe.href=ie,pe.download="data.json",pe.click()},[n])}function xU(){const n=Bd(qh),S=Vm.useLiveQuery(async()=>n.type==="local"?await Th.pair.where("dataset").equals(n.id).toArray():[],[n]),D=cP(),$=ht.useCallback(async z=>{n.type==="local"&&(await Th.pair.bulkAdd(z.map(O=>({...O,dataset:n.id,dateCreated:new Date}))),D())},[n,D]),ie=mU(S??[]);return(S==null?void 0:S.length)===0?qt.jsx(zk,{addRows:$}):qt.jsx("div",{children:qt.jsx(W7,{buttons:qt.jsx(gU,{onAddPairing:z=>$([z]),onDownload:ie}),columns:[{accessorKey:"text_1",header:"text_1",size:1/3},{accessorKey:"text_2",header:"text_2",size:1/3},{accessorKey:"label",header:"label",size:1/4},{id:"actions",cell:pU}],data:S||[]})})}function gS(){const n=Bd(qh),S=Vm.useLiveQuery(async()=>n.type==="local"?await Th.pair.where("dataset").equals(n.id).toArray():null,[n]),D=n.type==="example"?n.pairings:null;return S||D||[]}function bU(){const n=gS();return qt.jsx(W7,{buttons:qt.jsx("div",{}),columns:[{accessorKey:"text_1",header:"text_1",size:1/3},{accessorKey:"text_2",header:"text_2",size:1/3},{accessorKey:"label",header:"label",size:1/4}],data:n})}function wU(){const n=Bd(qh);return qt.jsxs("div",{className:Zh,children:[qt.jsx("h1",{className:"text-2xl",children:"Dataset"}),qt.jsxs("p",{className:"text-slate-300 text-l my-2",children:["To train a bias matrix, provide 100+ text pairs you want to be"," ",qt.jsx("span",{className:"text-white",children:"close together (1)"})," or"," ",qt.jsx("span",{className:"text-white",children:"far apart (-1)"})," in the resultant embedding space."]}),n.type==="local"?qt.jsx(xU,{}):qt.jsx(bU,{})]})}const hP={dropoutFraction:.2,learningRate:.01,epochs:30,batchSize:10,targetEmbeddingSize:1536,optimizer:"adamax",generateSyntheticNegatives:!0,testSplitFraction:.5,embeddingModel:aD},TU=Jh(hP);function Pb(){const n=Bd(qh),[S,D]=Gp(TU),$=Vm.useLiveQuery(async()=>{if(n.type==="local"){const O=await Th.dataset.get(n.id);if(O)return O.trainingParams}return null},[n]),ie=ht.useCallback(async(O,e)=>{n.type==="local"&&$&&await Th.dataset.update(n.id,{trainingParams:{...$,[O]:e}})},[n,$]),pe=ht.useCallback((O,e)=>{D(p=>({...p,[O]:e}))},[D]),z=n.type==="local";return[z&&$?$:S,z?ie:pe]}const dP="Progress",Lb=100,[AU,jV]=Bc(dP),[SU,MU]=AU(dP),vP=ht.forwardRef((n,S)=>{const{__scopeProgress:D,value:$,max:ie,getValueLabel:pe=PU,...z}=n,O=CA(ie)?ie:Lb,e=gP($,O)?$:null,p=Y2(e)?pe(e,O):void 0;return ht.createElement(SU,{scope:D,value:e,max:O},ht.createElement(Ci.div,ga({"aria-valuemax":O,"aria-valuemin":0,"aria-valuenow":Y2(e)?e:void 0,"aria-valuetext":p,role:"progressbar","data-state":pP(e,O),"data-value":e??void 0,"data-max":O},z,{ref:S})))});vP.propTypes={max(n,S,D){const $=n[S],ie=String($);return $&&!CA($)?new Error(LU(ie,D)):null},value(n,S,D){const $=n[S],ie=String($),pe=CA(n.max)?n.max:Lb;return $!=null&&!gP($,pe)?new Error(RU(ie,D)):null}};const EU="ProgressIndicator",CU=ht.forwardRef((n,S)=>{var D;const{__scopeProgress:$,...ie}=n,pe=MU(EU,$);return ht.createElement(Ci.div,ga({"data-state":pP(pe.value,pe.max),"data-value":(D=pe.value)!==null&&D!==void 0?D:void 0,"data-max":pe.max},ie,{ref:S}))});function PU(n,S){return`${Math.round(n/S*100)}%`}function pP(n,S){return n==null?"indeterminate":n===S?"complete":"loading"}function Y2(n){return typeof n=="number"}function CA(n){return Y2(n)&&!isNaN(n)&&n>0}function gP(n,S){return Y2(n)&&!isNaN(n)&&n<=S&&n>=0}function LU(n,S){return`Invalid prop \`max\` of value \`${n}\` supplied to \`${S}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Lb}\`.`}function RU(n,S){return`Invalid prop \`value\` of value \`${n}\` supplied to \`${S}\`. The \`value\` prop must be: +`)},oN=0,D0=[];function sN(n){var S=ht.useRef([]),D=ht.useRef([0,0]),$=ht.useRef(),ie=ht.useState(oN++)[0],pe=ht.useState(function(){return p9()})[0],z=ht.useRef(n);ht.useEffect(function(){z.current=n},[n]),ht.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(ie));var g=eA([n.lockRef.current],(n.shards||[]).map($E),!0).filter(Boolean);return g.forEach(function(t){return t.classList.add("allow-interactivity-".concat(ie))}),function(){document.body.classList.remove("block-interactivity-".concat(ie)),g.forEach(function(t){return t.classList.remove("allow-interactivity-".concat(ie))})}}},[n.inert,n.lockRef.current,n.shards]);var O=ht.useCallback(function(g,t){if("touches"in g&&g.touches.length===2)return!z.current.allowPinchZoom;var r=Cx(g),o=D.current,i="deltaX"in g?g.deltaX:o[0]-r[0],u="deltaY"in g?g.deltaY:o[1]-r[1],h,c=g.target,b=Math.abs(i)>Math.abs(u)?"h":"v";if("touches"in g&&b==="h"&&c.type==="range")return!1;var f=GE(b,c);if(!f)return!0;if(f?h=b:(h=b==="v"?"h":"v",f=GE(b,c)),!f)return!1;if(!$.current&&"changedTouches"in g&&(i||u)&&($.current=h),!h)return!0;var m=$.current||h;return nN(m,t,g,m==="h"?i:u,!0)},[]),e=ht.useCallback(function(g){var t=g;if(!(!D0.length||D0[D0.length-1]!==pe)){var r="deltaY"in t?WE(t):Cx(t),o=S.current.filter(function(h){return h.name===t.type&&h.target===t.target&&aN(h.delta,r)})[0];if(o&&o.should){t.cancelable&&t.preventDefault();return}if(!o){var i=(z.current.shards||[]).map($E).filter(Boolean).filter(function(h){return h.contains(t.target)}),u=i.length>0?O(t,i[0]):!z.current.noIsolation;u&&t.cancelable&&t.preventDefault()}}},[]),p=ht.useCallback(function(g,t,r,o){var i={name:g,delta:t,target:r,should:o};S.current.push(i),setTimeout(function(){S.current=S.current.filter(function(u){return u!==i})},1)},[]),P=ht.useCallback(function(g){D.current=Cx(g),$.current=void 0},[]),a=ht.useCallback(function(g){p(g.type,WE(g),g.target,O(g,n.lockRef.current))},[]),C=ht.useCallback(function(g){p(g.type,Cx(g),g.target,O(g,n.lockRef.current))},[]);ht.useEffect(function(){return D0.push(pe),n.setCallbacks({onScrollCapture:a,onWheelCapture:a,onTouchMoveCapture:C}),document.addEventListener("wheel",e,_0),document.addEventListener("touchmove",e,_0),document.addEventListener("touchstart",P,_0),function(){D0=D0.filter(function(g){return g!==pe}),document.removeEventListener("wheel",e,_0),document.removeEventListener("touchmove",e,_0),document.removeEventListener("touchstart",P,_0)}},[]);var x=n.removeScrollBar,d=n.inert;return ht.createElement(ht.Fragment,null,d?ht.createElement(pe,{styles:iN(ie)}):null,x?ht.createElement(Kz,{gapMode:"margin"}):null)}const lN=Nz(v9,sN);var x9=ht.forwardRef(function(n,S){return ht.createElement(Sb,Yh({},n,{ref:S,sideCar:lN}))});x9.classNames=Sb.classNames;const sS=x9,TA=["Enter"," "],uN=["ArrowDown","PageUp","Home"],b9=["ArrowUp","PageDown","End"],fN=[...uN,...b9],cN={ltr:[...TA,"ArrowRight"],rtl:[...TA,"ArrowLeft"]},hN={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Mb="Menu",[Sm,dN,vN]=bb(Mb),[e0,w9]=Bc(Mb,[vN,Cg,f9]),lS=Cg(),T9=f9(),[pN,t0]=e0(Mb),[gN,Bm]=e0(Mb),yN=n=>{const{__scopeMenu:S,open:D=!1,children:$,dir:ie,onOpenChange:pe,modal:z=!0}=n,O=lS(S),[e,p]=ht.useState(null),P=ht.useRef(!1),a=Ns(pe),C=yb(ie);return ht.useEffect(()=>{const x=()=>{P.current=!0,document.addEventListener("pointerdown",d,{capture:!0,once:!0}),document.addEventListener("pointermove",d,{capture:!0,once:!0})},d=()=>P.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",d,{capture:!0}),document.removeEventListener("pointermove",d,{capture:!0})}},[]),ht.createElement(rS,O,ht.createElement(pN,{scope:S,open:D,onOpenChange:a,content:e,onContentChange:p},ht.createElement(gN,{scope:S,onClose:ht.useCallback(()=>a(!1),[a]),isUsingKeyboardRef:P,dir:C,modal:z},$)))},A9=ht.forwardRef((n,S)=>{const{__scopeMenu:D,...$}=n,ie=lS(D);return ht.createElement(nS,ga({},ie,$,{ref:S}))}),S9="MenuPortal",[mN,M9]=e0(S9,{forceMount:void 0}),xN=n=>{const{__scopeMenu:S,forceMount:D,children:$,container:ie}=n,pe=t0(S9,S);return ht.createElement(mN,{scope:S,forceMount:D},ht.createElement(Mf,{present:D||pe.open},ht.createElement(Ab,{asChild:!0,container:ie},$)))},xh="MenuContent",[bN,uS]=e0(xh),wN=ht.forwardRef((n,S)=>{const D=M9(xh,n.__scopeMenu),{forceMount:$=D.forceMount,...ie}=n,pe=t0(xh,n.__scopeMenu),z=Bm(xh,n.__scopeMenu);return ht.createElement(Sm.Provider,{scope:n.__scopeMenu},ht.createElement(Mf,{present:$||pe.open},ht.createElement(Sm.Slot,{scope:n.__scopeMenu},z.modal?ht.createElement(TN,ga({},ie,{ref:S})):ht.createElement(AN,ga({},ie,{ref:S})))))}),TN=ht.forwardRef((n,S)=>{const D=t0(xh,n.__scopeMenu),$=ht.useRef(null),ie=so(S,$);return ht.useEffect(()=>{const pe=$.current;if(pe)return oS(pe)},[]),ht.createElement(fS,ga({},n,{ref:ie,trapFocus:D.open,disableOutsidePointerEvents:D.open,disableOutsideScroll:!0,onFocusOutside:Ja(n.onFocusOutside,pe=>pe.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>D.onOpenChange(!1)}))}),AN=ht.forwardRef((n,S)=>{const D=t0(xh,n.__scopeMenu);return ht.createElement(fS,ga({},n,{ref:S,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>D.onOpenChange(!1)}))}),fS=ht.forwardRef((n,S)=>{const{__scopeMenu:D,loop:$=!1,trapFocus:ie,onOpenAutoFocus:pe,onCloseAutoFocus:z,disableOutsidePointerEvents:O,onEntryFocus:e,onEscapeKeyDown:p,onPointerDownOutside:P,onFocusOutside:a,onInteractOutside:C,onDismiss:x,disableOutsideScroll:d,...g}=n,t=t0(xh,D),r=Bm(xh,D),o=lS(D),i=T9(D),u=dN(D),[h,c]=ht.useState(null),b=ht.useRef(null),f=so(S,b,t.onContentChange),m=ht.useRef(0),v=ht.useRef(""),l=ht.useRef(0),y=ht.useRef(null),E=ht.useRef("right"),A=ht.useRef(0),R=d?sS:ht.Fragment,w=d?{as:Yv,allowPinchZoom:!0}:void 0,L=s=>{var _,T;const B=v.current+s,F=u().filter(G=>!G.disabled),W=document.activeElement,N=(_=F.find(G=>G.ref.current===W))===null||_===void 0?void 0:_.textValue,V=F.map(G=>G.textValue),H=BN(V,B,N),U=(T=F.find(G=>G.textValue===H))===null||T===void 0?void 0:T.ref.current;(function G(Y){v.current=Y,window.clearTimeout(m.current),Y!==""&&(m.current=window.setTimeout(()=>G(""),1e3))})(B),U&&setTimeout(()=>U.focus())};ht.useEffect(()=>()=>window.clearTimeout(m.current),[]),Z4();const M=ht.useCallback(s=>{var _,T;return E.current===((_=y.current)===null||_===void 0?void 0:_.side)&&HN(s,(T=y.current)===null||T===void 0?void 0:T.area)},[]);return ht.createElement(bN,{scope:D,searchRef:v,onItemEnter:ht.useCallback(s=>{M(s)&&s.preventDefault()},[M]),onItemLeave:ht.useCallback(s=>{var _;M(s)||((_=b.current)===null||_===void 0||_.focus(),c(null))},[M]),onTriggerLeave:ht.useCallback(s=>{M(s)&&s.preventDefault()},[M]),pointerGraceTimerRef:l,onPointerGraceIntentChange:ht.useCallback(s=>{y.current=s},[])},ht.createElement(R,w,ht.createElement(X4,{asChild:!0,trapped:ie,onMountAutoFocus:Ja(pe,s=>{var _;s.preventDefault(),(_=b.current)===null||_===void 0||_.focus()}),onUnmountAutoFocus:z},ht.createElement(zm,{asChild:!0,disableOutsidePointerEvents:O,onEscapeKeyDown:p,onPointerDownOutside:P,onFocusOutside:a,onInteractOutside:C,onDismiss:x},ht.createElement(Mz,ga({asChild:!0},i,{dir:r.dir,orientation:"vertical",loop:$,currentTabStopId:h,onCurrentTabStopIdChange:c,onEntryFocus:Ja(e,s=>{r.isUsingKeyboardRef.current||s.preventDefault()})}),ht.createElement(aS,ga({role:"menu","aria-orientation":"vertical","data-state":R9(t.open),"data-radix-menu-content":"",dir:r.dir},o,g,{ref:f,style:{outline:"none",...g.style},onKeyDown:Ja(g.onKeyDown,s=>{const T=s.target.closest("[data-radix-menu-content]")===s.currentTarget,B=s.ctrlKey||s.altKey||s.metaKey,F=s.key.length===1;T&&(s.key==="Tab"&&s.preventDefault(),!B&&F&&L(s.key));const W=b.current;if(s.target!==W||!fN.includes(s.key))return;s.preventDefault();const V=u().filter(H=>!H.disabled).map(H=>H.ref.current);b9.includes(s.key)&&V.reverse(),zN(V)}),onBlur:Ja(n.onBlur,s=>{s.currentTarget.contains(s.target)||(window.clearTimeout(m.current),v.current="")}),onPointerMove:Ja(n.onPointerMove,Mm(s=>{const _=s.target,T=A.current!==s.clientX;if(s.currentTarget.contains(_)&&T){const B=s.clientX>A.current?"right":"left";E.current=B,A.current=s.clientX}}))})))))))}),SN=ht.forwardRef((n,S)=>{const{__scopeMenu:D,...$}=n;return ht.createElement(Ci.div,ga({},$,{ref:S}))}),AA="MenuItem",jE="menu.itemSelect",cS=ht.forwardRef((n,S)=>{const{disabled:D=!1,onSelect:$,...ie}=n,pe=ht.useRef(null),z=Bm(AA,n.__scopeMenu),O=uS(AA,n.__scopeMenu),e=so(S,pe),p=ht.useRef(!1),P=()=>{const a=pe.current;if(!D&&a){const C=new CustomEvent(jE,{bubbles:!0,cancelable:!0});a.addEventListener(jE,x=>$==null?void 0:$(x),{once:!0}),$4(a,C),C.defaultPrevented?p.current=!1:z.onClose()}};return ht.createElement(E9,ga({},ie,{ref:e,disabled:D,onClick:Ja(n.onClick,P),onPointerDown:a=>{var C;(C=n.onPointerDown)===null||C===void 0||C.call(n,a),p.current=!0},onPointerUp:Ja(n.onPointerUp,a=>{var C;p.current||(C=a.currentTarget)===null||C===void 0||C.click()}),onKeyDown:Ja(n.onKeyDown,a=>{const C=O.searchRef.current!=="";D||C&&a.key===" "||TA.includes(a.key)&&(a.currentTarget.click(),a.preventDefault())})}))}),E9=ht.forwardRef((n,S)=>{const{__scopeMenu:D,disabled:$=!1,textValue:ie,...pe}=n,z=uS(AA,D),O=T9(D),e=ht.useRef(null),p=so(S,e),[P,a]=ht.useState(!1),[C,x]=ht.useState("");return ht.useEffect(()=>{const d=e.current;if(d){var g;x(((g=d.textContent)!==null&&g!==void 0?g:"").trim())}},[pe.children]),ht.createElement(Sm.ItemSlot,{scope:D,disabled:$,textValue:ie??C},ht.createElement(Ez,ga({asChild:!0},O,{focusable:!$}),ht.createElement(Ci.div,ga({role:"menuitem","data-highlighted":P?"":void 0,"aria-disabled":$||void 0,"data-disabled":$?"":void 0},pe,{ref:p,onPointerMove:Ja(n.onPointerMove,Mm(d=>{$?z.onItemLeave(d):(z.onItemEnter(d),d.defaultPrevented||d.currentTarget.focus())})),onPointerLeave:Ja(n.onPointerLeave,Mm(d=>z.onItemLeave(d))),onFocus:Ja(n.onFocus,()=>a(!0)),onBlur:Ja(n.onBlur,()=>a(!1))}))))}),MN=ht.forwardRef((n,S)=>{const{checked:D=!1,onCheckedChange:$,...ie}=n;return ht.createElement(P9,{scope:n.__scopeMenu,checked:D},ht.createElement(cS,ga({role:"menuitemcheckbox","aria-checked":$2(D)?"mixed":D},ie,{ref:S,"data-state":hS(D),onSelect:Ja(ie.onSelect,()=>$==null?void 0:$($2(D)?!0:!D),{checkForDefaultPrevented:!1})})))}),EN="MenuRadioGroup",[HV,CN]=e0(EN,{value:void 0,onValueChange:()=>{}}),PN="MenuRadioItem",LN=ht.forwardRef((n,S)=>{const{value:D,...$}=n,ie=CN(PN,n.__scopeMenu),pe=D===ie.value;return ht.createElement(P9,{scope:n.__scopeMenu,checked:pe},ht.createElement(cS,ga({role:"menuitemradio","aria-checked":pe},$,{ref:S,"data-state":hS(pe),onSelect:Ja($.onSelect,()=>{var z;return(z=ie.onValueChange)===null||z===void 0?void 0:z.call(ie,D)},{checkForDefaultPrevented:!1})})))}),C9="MenuItemIndicator",[P9,RN]=e0(C9,{checked:!1}),_N=ht.forwardRef((n,S)=>{const{__scopeMenu:D,forceMount:$,...ie}=n,pe=RN(C9,D);return ht.createElement(Mf,{present:$||$2(pe.checked)||pe.checked===!0},ht.createElement(Ci.span,ga({},ie,{ref:S,"data-state":hS(pe.checked)})))}),DN=ht.forwardRef((n,S)=>{const{__scopeMenu:D,...$}=n;return ht.createElement(Ci.div,ga({role:"separator","aria-orientation":"horizontal"},$,{ref:S}))}),IN="MenuSub",[VV,L9]=e0(IN),Px="MenuSubTrigger",kN=ht.forwardRef((n,S)=>{const D=t0(Px,n.__scopeMenu),$=Bm(Px,n.__scopeMenu),ie=L9(Px,n.__scopeMenu),pe=uS(Px,n.__scopeMenu),z=ht.useRef(null),{pointerGraceTimerRef:O,onPointerGraceIntentChange:e}=pe,p={__scopeMenu:n.__scopeMenu},P=ht.useCallback(()=>{z.current&&window.clearTimeout(z.current),z.current=null},[]);return ht.useEffect(()=>P,[P]),ht.useEffect(()=>{const a=O.current;return()=>{window.clearTimeout(a),e(null)}},[O,e]),ht.createElement(A9,ga({asChild:!0},p),ht.createElement(E9,ga({id:ie.triggerId,"aria-haspopup":"menu","aria-expanded":D.open,"aria-controls":ie.contentId,"data-state":R9(D.open)},n,{ref:pb(S,ie.onTriggerChange),onClick:a=>{var C;(C=n.onClick)===null||C===void 0||C.call(n,a),!(n.disabled||a.defaultPrevented)&&(a.currentTarget.focus(),D.open||D.onOpenChange(!0))},onPointerMove:Ja(n.onPointerMove,Mm(a=>{pe.onItemEnter(a),!a.defaultPrevented&&!n.disabled&&!D.open&&!z.current&&(pe.onPointerGraceIntentChange(null),z.current=window.setTimeout(()=>{D.onOpenChange(!0),P()},100))})),onPointerLeave:Ja(n.onPointerLeave,Mm(a=>{var C;P();const x=(C=D.content)===null||C===void 0?void 0:C.getBoundingClientRect();if(x){var d;const g=(d=D.content)===null||d===void 0?void 0:d.dataset.side,t=g==="right",r=t?-5:5,o=x[t?"left":"right"],i=x[t?"right":"left"];pe.onPointerGraceIntentChange({area:[{x:a.clientX+r,y:a.clientY},{x:o,y:x.top},{x:i,y:x.top},{x:i,y:x.bottom},{x:o,y:x.bottom}],side:g}),window.clearTimeout(O.current),O.current=window.setTimeout(()=>pe.onPointerGraceIntentChange(null),300)}else{if(pe.onTriggerLeave(a),a.defaultPrevented)return;pe.onPointerGraceIntentChange(null)}})),onKeyDown:Ja(n.onKeyDown,a=>{const C=pe.searchRef.current!=="";if(!(n.disabled||C&&a.key===" ")&&cN[$.dir].includes(a.key)){var x;D.onOpenChange(!0),(x=D.content)===null||x===void 0||x.focus(),a.preventDefault()}})})))}),FN="MenuSubContent",ON=ht.forwardRef((n,S)=>{const D=M9(xh,n.__scopeMenu),{forceMount:$=D.forceMount,...ie}=n,pe=t0(xh,n.__scopeMenu),z=Bm(xh,n.__scopeMenu),O=L9(FN,n.__scopeMenu),e=ht.useRef(null),p=so(S,e);return ht.createElement(Sm.Provider,{scope:n.__scopeMenu},ht.createElement(Mf,{present:$||pe.open},ht.createElement(Sm.Slot,{scope:n.__scopeMenu},ht.createElement(fS,ga({id:O.contentId,"aria-labelledby":O.triggerId},ie,{ref:p,align:"start",side:z.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:P=>{var a;z.isUsingKeyboardRef.current&&((a=e.current)===null||a===void 0||a.focus()),P.preventDefault()},onCloseAutoFocus:P=>P.preventDefault(),onFocusOutside:Ja(n.onFocusOutside,P=>{P.target!==O.trigger&&pe.onOpenChange(!1)}),onEscapeKeyDown:Ja(n.onEscapeKeyDown,P=>{z.onClose(),P.preventDefault()}),onKeyDown:Ja(n.onKeyDown,P=>{const a=P.currentTarget.contains(P.target),C=hN[z.dir].includes(P.key);if(a&&C){var x;pe.onOpenChange(!1),(x=O.trigger)===null||x===void 0||x.focus(),P.preventDefault()}})})))))});function R9(n){return n?"open":"closed"}function $2(n){return n==="indeterminate"}function hS(n){return $2(n)?"indeterminate":n?"checked":"unchecked"}function zN(n){const S=document.activeElement;for(const D of n)if(D===S||(D.focus(),document.activeElement!==S))return}function NN(n,S){return n.map((D,$)=>n[(S+$)%n.length])}function BN(n,S,D){const ie=S.length>1&&Array.from(S).every(p=>p===S[0])?S[0]:S,pe=D?n.indexOf(D):-1;let z=NN(n,Math.max(pe,0));ie.length===1&&(z=z.filter(p=>p!==D));const e=z.find(p=>p.toLowerCase().startsWith(ie.toLowerCase()));return e!==D?e:void 0}function UN(n,S){const{x:D,y:$}=n;let ie=!1;for(let pe=0,z=S.length-1;pe$!=P>$&&D<(p-O)*($-e)/(P-e)+O&&(ie=!ie)}return ie}function HN(n,S){if(!S)return!1;const D={x:n.clientX,y:n.clientY};return UN(D,S)}function Mm(n){return S=>S.pointerType==="mouse"?n(S):void 0}const VN=yN,GN=A9,WN=xN,$N=wN,jN=SN,YN=cS,ZN=MN,XN=LN,KN=_N,JN=DN,QN=kN,qN=ON,_9="DropdownMenu",[eB,GV]=Bc(_9,[w9]),Hc=w9(),[tB,D9]=eB(_9),rB=n=>{const{__scopeDropdownMenu:S,children:D,dir:$,open:ie,defaultOpen:pe,onOpenChange:z,modal:O=!0}=n,e=Hc(S),p=ht.useRef(null),[P=!1,a]=Xv({prop:ie,defaultProp:pe,onChange:z});return ht.createElement(tB,{scope:S,triggerId:kd(),triggerRef:p,contentId:kd(),open:P,onOpenChange:a,onOpenToggle:ht.useCallback(()=>a(C=>!C),[a]),modal:O},ht.createElement(VN,ga({},e,{open:P,onOpenChange:a,dir:$,modal:O}),D))},nB="DropdownMenuTrigger",aB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,disabled:$=!1,...ie}=n,pe=D9(nB,D),z=Hc(D);return ht.createElement(GN,ga({asChild:!0},z),ht.createElement(Ci.button,ga({type:"button",id:pe.triggerId,"aria-haspopup":"menu","aria-expanded":pe.open,"aria-controls":pe.open?pe.contentId:void 0,"data-state":pe.open?"open":"closed","data-disabled":$?"":void 0,disabled:$},ie,{ref:pb(S,pe.triggerRef),onPointerDown:Ja(n.onPointerDown,O=>{!$&&O.button===0&&O.ctrlKey===!1&&(pe.onOpenToggle(),pe.open||O.preventDefault())}),onKeyDown:Ja(n.onKeyDown,O=>{$||(["Enter"," "].includes(O.key)&&pe.onOpenToggle(),O.key==="ArrowDown"&&pe.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(O.key)&&O.preventDefault())})})))}),iB=n=>{const{__scopeDropdownMenu:S,...D}=n,$=Hc(S);return ht.createElement(WN,ga({},$,D))},oB="DropdownMenuContent",sB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=D9(oB,D),pe=Hc(D),z=ht.useRef(!1);return ht.createElement($N,ga({id:ie.contentId,"aria-labelledby":ie.triggerId},pe,$,{ref:S,onCloseAutoFocus:Ja(n.onCloseAutoFocus,O=>{var e;z.current||(e=ie.triggerRef.current)===null||e===void 0||e.focus(),z.current=!1,O.preventDefault()}),onInteractOutside:Ja(n.onInteractOutside,O=>{const e=O.detail.originalEvent,p=e.button===0&&e.ctrlKey===!0,P=e.button===2||p;(!ie.modal||P)&&(z.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),lB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(jN,ga({},ie,$,{ref:S}))}),uB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(YN,ga({},ie,$,{ref:S}))}),fB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(ZN,ga({},ie,$,{ref:S}))}),cB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(XN,ga({},ie,$,{ref:S}))}),hB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(KN,ga({},ie,$,{ref:S}))}),dB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(JN,ga({},ie,$,{ref:S}))}),vB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(QN,ga({},ie,$,{ref:S}))}),pB=ht.forwardRef((n,S)=>{const{__scopeDropdownMenu:D,...$}=n,ie=Hc(D);return ht.createElement(qN,ga({},ie,$,{ref:S,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),gB=rB,yB=aB,mB=iB,I9=sB,k9=lB,F9=uB,O9=fB,z9=cB,N9=hB,B9=dB,U9=vB,H9=pB;function Um(n,S){if(n==null)return{};var D={},$=Object.keys(n),ie,pe;for(pe=0;pe<$.length;pe++)ie=$[pe],!(S.indexOf(ie)>=0)&&(D[ie]=n[ie]);return D}var xB=["color"],bB=ht.forwardRef(function(n,S){var D=n.color,$=D===void 0?"currentColor":D,ie=Um(n,xB);return ht.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie,{ref:S}),ht.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:$,fillRule:"evenodd",clipRule:"evenodd"}))}),wB=["color"],V9=ht.forwardRef(function(n,S){var D=n.color,$=D===void 0?"currentColor":D,ie=Um(n,wB);return ht.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie,{ref:S}),ht.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:$,fillRule:"evenodd",clipRule:"evenodd"}))}),TB=["color"],AB=ht.forwardRef(function(n,S){var D=n.color,$=D===void 0?"currentColor":D,ie=Um(n,TB);return ht.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie,{ref:S}),ht.createElement("path",{d:"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",fill:$,fillRule:"evenodd",clipRule:"evenodd"}))}),SB=["color"],G9=ht.forwardRef(function(n,S){var D=n.color,$=D===void 0?"currentColor":D,ie=Um(n,SB);return ht.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie,{ref:S}),ht.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:$,fillRule:"evenodd",clipRule:"evenodd"}))}),MB=["color"],EB=ht.forwardRef(function(n,S){var D=n.color,$=D===void 0?"currentColor":D,ie=Um(n,MB);return ht.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie,{ref:S}),ht.createElement("path",{d:"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",fill:$}))});const W9=gB,$9=yB,CB=ht.forwardRef(({className:n,inset:S,children:D,...$},ie)=>qt.jsxs(U9,{ref:ie,className:Ni("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",S&&"pl-8",n),...$,children:[D,qt.jsx(AB,{className:"ml-auto h-4 w-4"})]}));CB.displayName=U9.displayName;const PB=ht.forwardRef(({className:n,...S},D)=>qt.jsx(H9,{ref:D,className:Ni("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...S}));PB.displayName=H9.displayName;const dS=ht.forwardRef(({className:n,sideOffset:S=4,...D},$)=>qt.jsx(mB,{children:qt.jsx(I9,{ref:$,sideOffset:S,className:Ni("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...D})}));dS.displayName=I9.displayName;const j2=ht.forwardRef(({className:n,inset:S,...D},$)=>qt.jsx(F9,{ref:$,className:Ni("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",S&&"pl-8",n),...D}));j2.displayName=F9.displayName;const LB=ht.forwardRef(({className:n,children:S,checked:D,...$},ie)=>qt.jsxs(O9,{ref:ie,className:Ni("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),checked:D,...$,children:[qt.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:qt.jsx(N9,{children:qt.jsx(V9,{className:"h-4 w-4"})})}),S]}));LB.displayName=O9.displayName;const RB=ht.forwardRef(({className:n,children:S,...D},$)=>qt.jsxs(z9,{ref:$,className:Ni("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...D,children:[qt.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:qt.jsx(N9,{children:qt.jsx(EB,{className:"h-4 w-4 fill-current"})})}),S]}));RB.displayName=z9.displayName;const _B=ht.forwardRef(({className:n,inset:S,...D},$)=>qt.jsx(k9,{ref:$,className:Ni("px-2 py-1.5 text-sm font-semibold",S&&"pl-8",n),...D}));_B.displayName=k9.displayName;const DB=ht.forwardRef(({className:n,...S},D)=>qt.jsx(B9,{ref:D,className:Ni("-mx-1 my-1 h-px bg-muted",n),...S}));DB.displayName=B9.displayName;const j9="Dialog",[Y9,WV]=Bc(j9),[IB,Ah]=Y9(j9),kB=n=>{const{__scopeDialog:S,children:D,open:$,defaultOpen:ie,onOpenChange:pe,modal:z=!0}=n,O=ht.useRef(null),e=ht.useRef(null),[p=!1,P]=Xv({prop:$,defaultProp:ie,onChange:pe});return ht.createElement(IB,{scope:S,triggerRef:O,contentRef:e,contentId:kd(),titleId:kd(),descriptionId:kd(),open:p,onOpenChange:P,onOpenToggle:ht.useCallback(()=>P(a=>!a),[P]),modal:z},D)},FB="DialogTrigger",OB=ht.forwardRef((n,S)=>{const{__scopeDialog:D,...$}=n,ie=Ah(FB,D),pe=so(S,ie.triggerRef);return ht.createElement(Ci.button,ga({type:"button","aria-haspopup":"dialog","aria-expanded":ie.open,"aria-controls":ie.contentId,"data-state":vS(ie.open)},$,{ref:pe,onClick:Ja(n.onClick,ie.onOpenToggle)}))}),Z9="DialogPortal",[zB,X9]=Y9(Z9,{forceMount:void 0}),NB=n=>{const{__scopeDialog:S,forceMount:D,children:$,container:ie}=n,pe=Ah(Z9,S);return ht.createElement(zB,{scope:S,forceMount:D},ht.Children.map($,z=>ht.createElement(Mf,{present:D||pe.open},ht.createElement(Ab,{asChild:!0,container:ie},z))))},SA="DialogOverlay",BB=ht.forwardRef((n,S)=>{const D=X9(SA,n.__scopeDialog),{forceMount:$=D.forceMount,...ie}=n,pe=Ah(SA,n.__scopeDialog);return pe.modal?ht.createElement(Mf,{present:$||pe.open},ht.createElement(UB,ga({},ie,{ref:S}))):null}),UB=ht.forwardRef((n,S)=>{const{__scopeDialog:D,...$}=n,ie=Ah(SA,D);return ht.createElement(sS,{as:Yv,allowPinchZoom:!0,shards:[ie.contentRef]},ht.createElement(Ci.div,ga({"data-state":vS(ie.open)},$,{ref:S,style:{pointerEvents:"auto",...$.style}})))}),Em="DialogContent",HB=ht.forwardRef((n,S)=>{const D=X9(Em,n.__scopeDialog),{forceMount:$=D.forceMount,...ie}=n,pe=Ah(Em,n.__scopeDialog);return ht.createElement(Mf,{present:$||pe.open},pe.modal?ht.createElement(VB,ga({},ie,{ref:S})):ht.createElement(GB,ga({},ie,{ref:S})))}),VB=ht.forwardRef((n,S)=>{const D=Ah(Em,n.__scopeDialog),$=ht.useRef(null),ie=so(S,D.contentRef,$);return ht.useEffect(()=>{const pe=$.current;if(pe)return oS(pe)},[]),ht.createElement(K9,ga({},n,{ref:ie,trapFocus:D.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ja(n.onCloseAutoFocus,pe=>{var z;pe.preventDefault(),(z=D.triggerRef.current)===null||z===void 0||z.focus()}),onPointerDownOutside:Ja(n.onPointerDownOutside,pe=>{const z=pe.detail.originalEvent,O=z.button===0&&z.ctrlKey===!0;(z.button===2||O)&&pe.preventDefault()}),onFocusOutside:Ja(n.onFocusOutside,pe=>pe.preventDefault())}))}),GB=ht.forwardRef((n,S)=>{const D=Ah(Em,n.__scopeDialog),$=ht.useRef(!1),ie=ht.useRef(!1);return ht.createElement(K9,ga({},n,{ref:S,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:pe=>{var z;if((z=n.onCloseAutoFocus)===null||z===void 0||z.call(n,pe),!pe.defaultPrevented){var O;$.current||(O=D.triggerRef.current)===null||O===void 0||O.focus(),pe.preventDefault()}$.current=!1,ie.current=!1},onInteractOutside:pe=>{var z,O;(z=n.onInteractOutside)===null||z===void 0||z.call(n,pe),pe.defaultPrevented||($.current=!0,pe.detail.originalEvent.type==="pointerdown"&&(ie.current=!0));const e=pe.target;((O=D.triggerRef.current)===null||O===void 0?void 0:O.contains(e))&&pe.preventDefault(),pe.detail.originalEvent.type==="focusin"&&ie.current&&pe.preventDefault()}}))}),K9=ht.forwardRef((n,S)=>{const{__scopeDialog:D,trapFocus:$,onOpenAutoFocus:ie,onCloseAutoFocus:pe,...z}=n,O=Ah(Em,D),e=ht.useRef(null),p=so(S,e);return Z4(),ht.createElement(ht.Fragment,null,ht.createElement(X4,{asChild:!0,loop:!0,trapped:$,onMountAutoFocus:ie,onUnmountAutoFocus:pe},ht.createElement(zm,ga({role:"dialog",id:O.contentId,"aria-describedby":O.descriptionId,"aria-labelledby":O.titleId,"data-state":vS(O.open)},z,{ref:p,onDismiss:()=>O.onOpenChange(!1)}))),!1)}),WB="DialogTitle",$B=ht.forwardRef((n,S)=>{const{__scopeDialog:D,...$}=n,ie=Ah(WB,D);return ht.createElement(Ci.h2,ga({id:ie.titleId},$,{ref:S}))}),jB="DialogDescription",YB=ht.forwardRef((n,S)=>{const{__scopeDialog:D,...$}=n,ie=Ah(jB,D);return ht.createElement(Ci.p,ga({id:ie.descriptionId},$,{ref:S}))}),ZB="DialogClose",J9=ht.forwardRef((n,S)=>{const{__scopeDialog:D,...$}=n,ie=Ah(ZB,D);return ht.createElement(Ci.button,ga({type:"button"},$,{ref:S,onClick:Ja(n.onClick,()=>ie.onOpenChange(!1))}))});function vS(n){return n?"open":"closed"}const XB=kB,KB=OB,JB=NB,Q9=BB,q9=HB,eP=$B,tP=YB,QB=J9,dg=XB,vg=KB,qB=JB,rP=ht.forwardRef(({className:n,...S},D)=>qt.jsx(Q9,{ref:D,className:Ni("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...S}));rP.displayName=Q9.displayName;const Yp=ht.forwardRef(({className:n,children:S,...D},$)=>qt.jsxs(qB,{children:[qt.jsx(rP,{}),qt.jsxs(q9,{ref:$,className:Ni("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",n),...D,children:[S,qt.jsxs(QB,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[qt.jsx(G9,{className:"h-4 w-4"}),qt.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Yp.displayName=q9.displayName;const Zp=({className:n,...S})=>qt.jsx("div",{className:Ni("flex flex-col space-y-1.5 text-center sm:text-left",n),...S});Zp.displayName="DialogHeader";const pS=({className:n,...S})=>qt.jsx("div",{className:Ni("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...S});pS.displayName="DialogFooter";const Eb=ht.forwardRef(({className:n,...S},D)=>qt.jsx(eP,{ref:D,className:Ni("text-lg font-semibold leading-none tracking-tight",n),...S}));Eb.displayName=eP.displayName;const nP=ht.forwardRef(({className:n,...S},D)=>qt.jsx(tP,{ref:D,className:Ni("text-sm text-muted-foreground",n),...S}));nP.displayName=tP.displayName;const Qf=ht.forwardRef(({className:n,type:S,...D},$)=>qt.jsx("input",{type:S,className:Ni("flex h-9 w-full rounded-md border border-input bg-slate-700 px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 text-white",n),ref:$,...D}));Qf.displayName="Input";const eU=ht.forwardRef((n,S)=>ht.createElement(Ci.label,ga({},n,{ref:S,onMouseDown:D=>{var $;($=n.onMouseDown)===null||$===void 0||$.call(n,D),!D.defaultPrevented&&D.detail>1&&D.preventDefault()}}))),aP=eU,tU=B4("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),bh=ht.forwardRef(({className:n,...S},D)=>qt.jsx(aP,{ref:D,className:Ni(tU(),n),...S}));bh.displayName=aP.displayName;function iP(n){const S=ht.useRef({value:n,previous:n});return ht.useMemo(()=>(S.current.value!==n&&(S.current.previous=S.current.value,S.current.value=n),S.current.previous),[n])}const oP="Switch",[rU,$V]=Bc(oP),[nU,aU]=rU(oP),iU=ht.forwardRef((n,S)=>{const{__scopeSwitch:D,name:$,checked:ie,defaultChecked:pe,required:z,disabled:O,value:e="on",onCheckedChange:p,...P}=n,[a,C]=ht.useState(null),x=so(S,o=>C(o)),d=ht.useRef(!1),g=a?!!a.closest("form"):!0,[t=!1,r]=Xv({prop:ie,defaultProp:pe,onChange:p});return ht.createElement(nU,{scope:D,checked:t,disabled:O},ht.createElement(Ci.button,ga({type:"button",role:"switch","aria-checked":t,"aria-required":z,"data-state":sP(t),"data-disabled":O?"":void 0,disabled:O,value:e},P,{ref:x,onClick:Ja(n.onClick,o=>{r(i=>!i),g&&(d.current=o.isPropagationStopped(),d.current||o.stopPropagation())})})),g&&ht.createElement(lU,{control:a,bubbles:!d.current,name:$,value:e,checked:t,required:z,disabled:O,style:{transform:"translateX(-100%)"}}))}),oU="SwitchThumb",sU=ht.forwardRef((n,S)=>{const{__scopeSwitch:D,...$}=n,ie=aU(oU,D);return ht.createElement(Ci.span,ga({"data-state":sP(ie.checked),"data-disabled":ie.disabled?"":void 0},$,{ref:S}))}),lU=n=>{const{control:S,checked:D,bubbles:$=!0,...ie}=n,pe=ht.useRef(null),z=iP(D),O=n9(S);return ht.useEffect(()=>{const e=pe.current,p=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(p,"checked").set;if(z!==D&&a){const C=new Event("click",{bubbles:$});a.call(e,D),e.dispatchEvent(C)}},[z,D,$]),ht.createElement("input",ga({type:"checkbox","aria-hidden":!0,defaultChecked:D},ie,{tabIndex:-1,ref:pe,style:{...n.style,...O,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function sP(n){return n?"checked":"unchecked"}const lP=iU,uU=sU,Cb=ht.forwardRef(({className:n,...S},D)=>qt.jsx(lP,{className:Ni("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n),...S,ref:D,children:qt.jsx(uU,{className:Ni("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Cb.displayName=lP.displayName;var uP={exports:{}};(function(n){(function(S,D){n.exports?n.exports=D():S.log=D()})(Cv,function(){var S=function(){},D="undefined",$=typeof window!==D&&typeof window.navigator!==D&&/Trident\/|MSIE /.test(window.navigator.userAgent),ie=["trace","debug","info","warn","error"];function pe(g,t){var r=g[t];if(typeof r.bind=="function")return r.bind(g);try{return Function.prototype.bind.call(r,g)}catch{return function(){return Function.prototype.apply.apply(r,[g,arguments])}}}function z(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function O(g){return g==="debug"&&(g="log"),typeof console===D?!1:g==="trace"&&$?z:console[g]!==void 0?pe(console,g):console.log!==void 0?pe(console,"log"):S}function e(g,t){for(var r=0;r=0&&m<=o.levels.SILENT){if(i=m,v!==!1&&h(m),e.call(o,m,g),typeof console===D&&m{this.worker.removeEventListener("message",D)}}terminate(){MA.info("Terminating worker"),this.worker.terminate()}}const dU=Jh(null),fP=Jh({type:"uninitialized"});function vU(){const{toast:n}=Sg(),S=cb(fP);return ht.useCallback(D=>{D.type==="embeddingProgress"?S({type:"embeddingProgress",progress:D.progress}):D.type==="initialPerformance"?S({type:"pretrained",pretrainingPerformance:D.performance}):D.type==="fetchingStatus"?S({type:"fetchingEmbeddings"}):D.type==="error"?n({title:"Error",description:D.message,variant:"destructive"}):D.type==="dumpEmbeddingCache"?Mk(D.cache):D.type==="doneTraining"?S($=>$.type==="training"?{type:"doneTraining",performanceHistory:$.performanceHistory,currentPerformance:$.currentPerformance,pretrainingPerformance:$.pretrainingPerformance,bestMatrix:{matrixNpy:D.matrixNpy,shape:D.shape}}:$):D.type==="updatedPerformance"&&S($=>$.type==="training"?{type:"training",currentEpoch:D.epoch,performanceHistory:[...$.performanceHistory,{test:D.performance.testAccuracyAndSE,train:D.performance.trainAccuracyAndSE}],currentPerformance:D.performance,pretrainingPerformance:$.pretrainingPerformance}:$.type==="trainingStarted"?{type:"training",currentEpoch:D.epoch,performanceHistory:[],currentPerformance:D.performance,pretrainingPerformance:$.pretrainingPerformance}:$)},[S,n])}function Hm(){const[n,S]=Gp(dU),[D,$]=Gp(fP),ie=vU(),pe=ht.useCallback(()=>{n&&n.terminate();const C=new hU;return S(C),C.addListener(ie),C},[ie,S,n]),z=ht.useCallback(C=>{pe().sendMessage({type:"initializeLocalDataset",...C})},[pe]),O=ht.useCallback(C=>{pe().sendMessage({type:"initializeExampleDataset",...C})},[pe]),e=ht.useCallback(C=>{if(!n)throw new Error("Worker not initialized");n.sendMessage({type:"train",parameters:C}),$(x=>x.type==="pretrained"||x.type==="doneTraining"?{type:"trainingStarted",currentEpoch:0,pretrainingPerformance:x.pretrainingPerformance}:x)},[n,$]),p=ht.useCallback(()=>{if(!n)throw new Error("Worker not initialized");n.sendMessage({type:"getEmbeddingCache"})},[n]),P=ht.useCallback(()=>{if(!n)throw new Error("Worker not initialized");n.terminate(),$({type:"uninitialized"})},[n,$]),a=ht.useCallback(()=>{n&&n.terminate(),$({type:"uninitialized"})},[n,$]);return D.type==="uninitialized"?{type:"uninitialized",initializeLocal:z,initializeExample:O}:D.type==="fetchingEmbeddings"||D.type==="embeddingProgress"?{...D,reset:a}:D.type==="pretrained"?{type:"pretrained",train:e,pretrainingPerformance:D.pretrainingPerformance,downloadEmbeddings:p,reset:a}:D.type==="trainingStarted"?{...D,downloadEmbeddings:p,reset:a}:D.type==="training"?{...D,downloadEmbeddings:p,stop:P,reset:a}:{...D,downloadEmbeddings:p,train:e,reset:a}}function cP(){const n=Hm();return ht.useCallback(()=>{n.type!=="uninitialized"&&n.reset()},[n])}function pU({row:n}){const S=cP(),D=n.original,[$,ie]=ht.useState(!1),[pe,z]=ht.useState(!1),[O,e]=ht.useState(!1),[p,P]=ht.useState(D.text_1),[a,C]=ht.useState(D.text_2),[x,d]=ht.useState(D.label),g=ht.useCallback(async()=>{p===""||a===""||(await Th.pair.update(D.id,{text_1:p,text_2:a,label:x}),ie(!1),e(!1),S())},[p,a,x,D,S]),t=ht.useCallback(async()=>{await Th.pair.delete(D.id),z(!1),e(!1),S()},[D,S]);return qt.jsxs(W9,{open:O,onOpenChange:e,modal:!1,children:[qt.jsx($9,{asChild:!0,children:qt.jsx(ds,{variant:"ghost",className:"h-8 w-8 p-0",children:qt.jsx(eO,{className:"h-4 w-4"})})}),qt.jsxs(dS,{align:"end",children:[qt.jsxs(dg,{open:$,onOpenChange:ie,children:[qt.jsx(vg,{asChild:!0,children:qt.jsx(j2,{onSelect:r=>r.preventDefault(),children:"Edit"})}),qt.jsxs(Yp,{className:"sm:max-w-[425px]",children:[qt.jsx(Zp,{className:"text-white",children:"Edit Row"}),qt.jsxs("div",{className:"text-white",children:[qt.jsxs("div",{className:"my-4",children:[qt.jsx(bh,{htmlFor:"text_1",children:"text_1"}),qt.jsx(Qf,{type:"text",className:"text-white mt-1",id:"text_1",placeholder:"text_1",value:p,onChange:r=>P(r.target.value)})]}),qt.jsxs("div",{className:"my-4",children:[qt.jsx(bh,{htmlFor:"text_2",children:"text_2"}),qt.jsx(Qf,{id:"text_2",type:"text",className:"text-white mt-1",placeholder:"text_2",value:a,onChange:r=>C(r.target.value)})]}),qt.jsxs("div",{className:"my-4 flex items-center space-x-2",children:[qt.jsx(Cb,{id:"label",checked:x===1,onCheckedChange:r=>d(r?1:-1)}),qt.jsxs(bh,{htmlFor:"label",children:["Currently ",x===1?"Positive":"Negative"]})]}),qt.jsx(ds,{onClick:g,children:"save"})]})]})]}),qt.jsxs(dg,{open:pe,onOpenChange:z,children:[qt.jsx(vg,{asChild:!0,children:qt.jsx(j2,{onSelect:r=>r.preventDefault(),children:"Delete"})}),qt.jsxs(Yp,{className:"max-w-[425px]",children:[qt.jsxs(Zp,{className:"text-white",children:['Delete "',D.text_1.substring(0,20),'"?']}),qt.jsxs("div",{className:"flex justify-end space-x-3",children:[qt.jsx(ds,{variant:"destructive",onClick:t,children:"Delete"}),qt.jsx(ds,{variant:"outline",className:"text-white",onClick:()=>z(!1),children:"Cancel"})]})]})]})]})]})}function gU({onAddPairing:n,onDownload:S}){const[D,$]=ht.useState(""),[ie,pe]=ht.useState(""),[z,O]=ht.useState(1),[e,p]=ht.useState(!1),P=ht.useCallback(()=>{D===""||ie===""||(n({text_1:D,text_2:ie,label:z}),p(!1))},[n,D,ie,z]);function a(C){C.key==="Enter"&&P()}return qt.jsx("div",{className:"flex items-center space-x-2 py-4",children:qt.jsxs(dg,{open:e,onOpenChange:p,children:[qt.jsx(vg,{asChild:!0,children:qt.jsxs(ds,{variant:"outline",className:"flex items-center",children:[qt.jsx(tO,{size:18,className:"mr-2"})," Create Row"]})}),qt.jsxs(ds,{variant:"outline",className:"flex items-center",onClick:S,children:[qt.jsx(Y4,{size:18,className:"mr-2"})," Download JSON"]}),qt.jsxs(Yp,{className:"sm:max-w-[425px]",children:[qt.jsx(Zp,{className:"text-white",children:"Create Row"}),qt.jsxs("div",{className:"text-white",children:[qt.jsx(bh,{htmlFor:"text_1",children:"text_1"}),qt.jsx(Qf,{placeholder:"text_1",id:"text_1",value:D,onChange:C=>$(C.target.value),onKeyDown:a}),qt.jsx(bh,{htmlFor:"text_2",children:"text_2"}),qt.jsx(Qf,{placeholder:"text_2",id:"text_2",value:ie,onChange:C=>pe(C.target.value),onKeyDown:a}),qt.jsxs("div",{className:"my-4 flex items-center space-x-2",children:[qt.jsx(Cb,{id:"label",checked:z===1,onCheckedChange:C=>O(C?1:-1)}),qt.jsxs(bh,{htmlFor:"label",children:["Currently ",z===1?"Positive":"Negative"]})]})]}),qt.jsx(pS,{children:qt.jsx(ds,{onClick:P,type:"submit",children:"save"})})]})]})})}var EA={exports:{}};const yU=cL(ZD);(function(n,S){(function(D,$){$(S,yU,ht)})(Cv,function(D,$,ie){function pe(P){return P&&typeof P=="object"&&"default"in P?P:{default:P}}var z=pe(ie);function O(P,a,C){var x,d;typeof P=="function"?(x=a||[],d=C):(x=[],d=a);var g=z.default.useRef({hasResult:!1,result:d,error:null}),t=z.default.useReducer(function(i){return i+1},0);t[0];var r=t[1],o=z.default.useMemo(function(){var i=typeof P=="function"?P():P;if(!i||typeof i.subscribe!="function")throw P===i?new TypeError("Given argument to useObservable() was neither a valid observable nor a function."):new TypeError("Observable factory given to useObservable() did not return a valid observable.");if(!g.current.hasResult&&typeof window<"u"&&(typeof i.hasValue!="function"||i.hasValue()))if(typeof i.getValue=="function")g.current.result=i.getValue(),g.current.hasResult=!0;else{var u=i.subscribe(function(h){g.current.result=h,g.current.hasResult=!0});typeof u=="function"?u():u.unsubscribe()}return i},x);if(z.default.useDebugValue(g.current.result),z.default.useEffect(function(){var i=o.subscribe(function(u){var h=g.current;(h.error!==null||h.result!==u)&&(h.error=null,h.result=u,h.hasResult=!0,r())},function(u){var h=g.current;h.error!==u&&(h.error=u,r())});return typeof i=="function"?i:i.unsubscribe.bind(i)},x),g.current.error)throw g.current.error;return g.current.result}function e(P,a,C){return O(function(){return $.liveQuery(P)},a||[],C)}function p(P,a,C){if(!P)throw new TypeError("Invalid arguments to usePermissions(): undefined or null");var x;if(arguments.length>=3){if(!("transaction"in P))throw new TypeError("Invalid arguments to usePermission(db, table, obj): 1st arg must be a Dexie instance");if(typeof a!="string")throw new TypeError("Invalid arguments to usePermission(db, table, obj): 2nd arg must be string");if(!C||typeof C!="object")throw new TypeError("Invalid arguments to usePermission(db, table, obj): 3rd arg must be an object");x=P}else{if(P instanceof $.Dexie)throw new TypeError("Invalid arguments to usePermission(db, table, obj): Missing table and obj arguments.");if(typeof P.table=="function"&&typeof P.db=="object")x=P.db,C=P,a=P.table();else throw new TypeError("Invalid arguments to usePermissions(). Expected usePermissions(entity: DexieCloudEntity) or usePermissions(db: Dexie, table: string, obj: DexieCloudObject)")}if(!("cloud"in x))throw new Error("usePermissions() is only for Dexie Cloud but there's no dexie-cloud-addon active in given db.");if(!("permissions"in x.cloud))throw new Error("usePermissions() requires a newer version of dexie-cloud-addon. Please upgrade it.");return O(function(){return x.cloud.permissions(C,a)},[C.realmId,C.owner,a])}D.useLiveQuery=e,D.useObservable=O,D.usePermissions=p,Object.defineProperty(D,"__esModule",{value:!0})})})(EA,EA.exports);var Vm=EA.exports;function mU(n){return ht.useCallback(()=>{if(!n)return;const S=n.map(({text_1:z,text_2:O,label:e})=>({text_1:z,text_2:O,label:e})),D=JSON.stringify(S,null,2),$=new Blob([D],{type:"application/json"}),ie=URL.createObjectURL($),pe=document.createElement("a");pe.href=ie,pe.download="data.json",pe.click()},[n])}function xU(){const n=Bd(qh),S=Vm.useLiveQuery(async()=>n.type==="local"?await Th.pair.where("dataset").equals(n.id).toArray():[],[n]),D=cP(),$=ht.useCallback(async z=>{n.type==="local"&&(await Th.pair.bulkAdd(z.map(O=>({...O,dataset:n.id,dateCreated:new Date}))),D())},[n,D]),ie=mU(S??[]);return(S==null?void 0:S.length)===0?qt.jsx(zk,{addRows:$}):qt.jsx("div",{children:qt.jsx(W7,{buttons:qt.jsx(gU,{onAddPairing:z=>$([z]),onDownload:ie}),columns:[{accessorKey:"text_1",header:"text_1",size:1/3},{accessorKey:"text_2",header:"text_2",size:1/3},{accessorKey:"label",header:"label",size:1/4},{id:"actions",cell:pU}],data:S||[]})})}function gS(){const n=Bd(qh),S=Vm.useLiveQuery(async()=>n.type==="local"?await Th.pair.where("dataset").equals(n.id).toArray():null,[n]),D=n.type==="example"?n.pairings:null;return S||D||[]}function bU(){const n=gS();return qt.jsx(W7,{buttons:qt.jsx("div",{}),columns:[{accessorKey:"text_1",header:"text_1",size:1/3},{accessorKey:"text_2",header:"text_2",size:1/3},{accessorKey:"label",header:"label",size:1/4}],data:n})}function wU(){const n=Bd(qh);return qt.jsxs("div",{className:Zh,children:[qt.jsx("h1",{className:"text-2xl",children:"Dataset"}),qt.jsxs("p",{className:"text-slate-300 text-l my-2",children:["To train a bias matrix, provide 100+ text pairs you want to be"," ",qt.jsx("span",{className:"text-white",children:"close together (1)"})," or"," ",qt.jsx("span",{className:"text-white",children:"far apart (-1)"})," in the resultant embedding space."]}),n.type==="local"?qt.jsx(xU,{}):qt.jsx(bU,{})]})}const hP={dropoutFraction:.2,learningRate:.01,epochs:30,batchSize:10,targetEmbeddingSize:1536,optimizer:"adamax",generateSyntheticNegatives:!0,testSplitFraction:.5,embeddingModel:aD},TU=Jh(hP);function Pb(){const n=Bd(qh),[S,D]=Gp(TU),$=Vm.useLiveQuery(async()=>{if(n.type==="local"){const O=await Th.dataset.get(n.id);if(O)return O.trainingParams}return null},[n]),ie=ht.useCallback(async(O,e)=>{n.type==="local"&&$&&await Th.dataset.update(n.id,{trainingParams:{...$,[O]:e}})},[n,$]),pe=ht.useCallback((O,e)=>{D(p=>({...p,[O]:e}))},[D]),z=n.type==="local";return[z&&$?$:S,z?ie:pe]}const dP="Progress",Lb=100,[AU,jV]=Bc(dP),[SU,MU]=AU(dP),vP=ht.forwardRef((n,S)=>{const{__scopeProgress:D,value:$,max:ie,getValueLabel:pe=PU,...z}=n,O=CA(ie)?ie:Lb,e=gP($,O)?$:null,p=Y2(e)?pe(e,O):void 0;return ht.createElement(SU,{scope:D,value:e,max:O},ht.createElement(Ci.div,ga({"aria-valuemax":O,"aria-valuemin":0,"aria-valuenow":Y2(e)?e:void 0,"aria-valuetext":p,role:"progressbar","data-state":pP(e,O),"data-value":e??void 0,"data-max":O},z,{ref:S})))});vP.propTypes={max(n,S,D){const $=n[S],ie=String($);return $&&!CA($)?new Error(LU(ie,D)):null},value(n,S,D){const $=n[S],ie=String($),pe=CA(n.max)?n.max:Lb;return $!=null&&!gP($,pe)?new Error(RU(ie,D)):null}};const EU="ProgressIndicator",CU=ht.forwardRef((n,S)=>{var D;const{__scopeProgress:$,...ie}=n,pe=MU(EU,$);return ht.createElement(Ci.div,ga({"data-state":pP(pe.value,pe.max),"data-value":(D=pe.value)!==null&&D!==void 0?D:void 0,"data-max":pe.max},ie,{ref:S}))});function PU(n,S){return`${Math.round(n/S*100)}%`}function pP(n,S){return n==null?"indeterminate":n===S?"complete":"loading"}function Y2(n){return typeof n=="number"}function CA(n){return Y2(n)&&!isNaN(n)&&n>0}function gP(n,S){return Y2(n)&&!isNaN(n)&&n<=S&&n>=0}function LU(n,S){return`Invalid prop \`max\` of value \`${n}\` supplied to \`${S}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Lb}\`.`}function RU(n,S){return`Invalid prop \`value\` of value \`${n}\` supplied to \`${S}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${Lb} if no \`max\` prop is set) - \`null\` if the progress is indeterminate. diff --git a/index.html b/index.html index fa20f09..7911021 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ content="https://a9.io/spaceshifter/card.png" /> Spaceshifter - +