Spaces:
Running
Running
gradio-demo
/
gradio-env
/lib
/python3.11
/site-packages
/gradio
/templates
/frontend
/assets
/Dropdown-BJOE3R5S.js
import{a as ie}from"./index-DtO3d7FT.js";/* empty css */import{B as De}from"./BlockTitle-BgPPySHJ.js";import"./MarkdownCode.svelte_svelte_type_style_lang-CF3ptt4z.js";import{D as Ee}from"./DropdownArrow-DYWFcSFn.js";import"./index-CKzrTzGp.js";const{SvelteComponent:Ce,add_render_callback:ge,append:X,attr:E,binding_callbacks:re,check_outros:Te,create_bidirectional_transition:ue,destroy_each:qe,detach:P,element:Y,empty:Se,ensure_array_like:fe,flush:J,group_outros:Ne,init:Be,insert:Q,listen:Z,prevent_default:ze,run_all:we,safe_not_equal:Ue,set_data:He,set_style:z,space:ee,text:Je,toggle_class:B,transition_in:x,transition_out:_e}=window.__gradio__svelte__internal,{createEventDispatcher:Le}=window.__gradio__svelte__internal;function ce(l,t,e){const f=l.slice();return f[28]=t[e],f}function he(l){let t,e,f,h,u,r=fe(l[1]),n=[];for(let s=0;s<r.length;s+=1)n[s]=ae(ce(l,r,s));return{c(){t=Y("ul");for(let s=0;s<n.length;s+=1)n[s].c();E(t,"class","options svelte-y6qw75"),E(t,"role","listbox"),z(t,"top",l[9]),z(t,"bottom",l[10]),z(t,"max-height",`calc(${l[11]}px - var(--window-padding))`),z(t,"width",l[8]+"px")},m(s,w){Q(s,t,w);for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(t,null);l[24](t),f=!0,h||(u=[Z(t,"mousedown",ze(l[22])),Z(t,"scroll",l[23])],h=!0)},p(s,w){if(w&307){r=fe(s[1]);let o;for(o=0;o<r.length;o+=1){const a=ce(s,r,o);n[o]?n[o].p(a,w):(n[o]=ae(a),n[o].c(),n[o].m(t,null))}for(;o<n.length;o+=1)n[o].d(1);n.length=r.length}w&512&&z(t,"top",s[9]),w&1024&&z(t,"bottom",s[10]),w&2048&&z(t,"max-height",`calc(${s[11]}px - var(--window-padding))`),w&256&&z(t,"width",s[8]+"px")},i(s){f||(s&&ge(()=>{f&&(e||(e=ue(t,ie,{duration:200,y:5},!0)),e.run(1))}),f=!0)},o(s){s&&(e||(e=ue(t,ie,{duration:200,y:5},!1)),e.run(0)),f=!1},d(s){s&&P(t),qe(n,s),l[24](null),s&&e&&e.end(),h=!1,we(u)}}}function ae(l){let t,e,f,h=l[0][l[28]][0]+"",u,r,n,s,w;return{c(){t=Y("li"),e=Y("span"),e.textContent="✓",f=ee(),u=Je(h),r=ee(),E(e,"class","inner-item svelte-y6qw75"),B(e,"hide",!l[4].includes(l[28])),E(t,"class","item svelte-y6qw75"),E(t,"data-index",n=l[28]),E(t,"aria-label",s=l[0][l[28]][0]),E(t,"data-testid","dropdown-option"),E(t,"role","option"),E(t,"aria-selected",w=l[4].includes(l[28])),B(t,"selected",l[4].includes(l[28])),B(t,"active",l[28]===l[5]),B(t,"bg-gray-100",l[28]===l[5]),B(t,"dark:bg-gray-600",l[28]===l[5]),z(t,"width",l[8]+"px")},m(o,a){Q(o,t,a),X(t,e),X(t,f),X(t,u),X(t,r)},p(o,a){a&18&&B(e,"hide",!o[4].includes(o[28])),a&3&&h!==(h=o[0][o[28]][0]+"")&&He(u,h),a&2&&n!==(n=o[28])&&E(t,"data-index",n),a&3&&s!==(s=o[0][o[28]][0])&&E(t,"aria-label",s),a&18&&w!==(w=o[4].includes(o[28]))&&E(t,"aria-selected",w),a&18&&B(t,"selected",o[4].includes(o[28])),a&34&&B(t,"active",o[28]===o[5]),a&34&&B(t,"bg-gray-100",o[28]===o[5]),a&34&&B(t,"dark:bg-gray-600",o[28]===o[5]),a&256&&z(t,"width",o[8]+"px")},d(o){o&&P(t)}}}function Re(l){let t,e,f,h,u;ge(l[20]);let r=l[2]&&!l[3]&&he(l);return{c(){t=Y("div"),e=ee(),r&&r.c(),f=Se(),E(t,"class","reference")},m(n,s){Q(n,t,s),l[21](t),Q(n,e,s),r&&r.m(n,s),Q(n,f,s),h||(u=[Z(window,"scroll",l[14]),Z(window,"resize",l[20])],h=!0)},p(n,[s]){n[2]&&!n[3]?r?(r.p(n,s),s&12&&x(r,1)):(r=he(n),r.c(),x(r,1),r.m(f.parentNode,f)):r&&(Ne(),_e(r,1,1,()=>{r=null}),Te())},i(n){x(r)},o(n){_e(r)},d(n){n&&(P(t),P(e),P(f)),l[21](null),r&&r.d(n),h=!1,we(u)}}}function Ie(l,t,e){let{choices:f}=t,{filtered_indices:h}=t,{show_options:u=!1}=t,{disabled:r=!1}=t,{selected_indices:n=[]}=t,{active_index:s=null}=t,{remember_scroll:w=!1}=t,o,a,k,y,C,m,i,c,O,p,g=0;function U(){const{top:d,bottom:G}=C.getBoundingClientRect();e(17,o=d),e(18,a=p-G)}let q=null;function T(){u&&(q!==null&&clearTimeout(q),q=setTimeout(()=>{U(),q=null},10))}function A(){m?.scrollTo?.(0,g)}const b=Le();function S(){e(12,p=window.innerHeight)}function H(d){re[d?"unshift":"push"](()=>{C=d,e(6,C)})}const V=d=>b("change",d),v=d=>e(13,g=d.currentTarget.scrollTop);function F(d){re[d?"unshift":"push"](()=>{m=d,e(7,m)})}return l.$$set=d=>{"choices"in d&&e(0,f=d.choices),"filtered_indices"in d&&e(1,h=d.filtered_indices),"show_options"in d&&e(2,u=d.show_options),"disabled"in d&&e(3,r=d.disabled),"selected_indices"in d&&e(4,n=d.selected_indices),"active_index"in d&&e(5,s=d.active_index),"remember_scroll"in d&&e(16,w=d.remember_scroll)},l.$$.update=()=>{if(l.$$.dirty&983252){if(u&&C){if(w)A();else if(m&&n.length>0){let G=m.querySelectorAll("li");for(const W of Array.from(G))if(W.getAttribute("data-index")===n[0].toString()){m?.scrollTo?.(0,W.offsetTop);break}}U();const d=C.parentElement?.getBoundingClientRect();e(19,k=d?.height||0),e(8,y=d?.width||0)}a>o?(e(9,i=`${o}px`),e(11,O=a),e(10,c=null)):(e(10,c=`${a+k}px`),e(11,O=o-k),e(9,i=null))}},[f,h,u,r,n,s,C,m,y,i,c,O,p,g,T,b,w,o,a,k,S,H,V,v,F]}class je extends Ce{constructor(t){super(),Be(this,t,Ie,Re,Ue,{choices:0,filtered_indices:1,show_options:2,disabled:3,selected_indices:4,active_index:5,remember_scroll:16})}get choices(){return this.$$.ctx[0]}set choices(t){this.$$set({choices:t}),J()}get filtered_indices(){return this.$$.ctx[1]}set filtered_indices(t){this.$$set({filtered_indices:t}),J()}get show_options(){return this.$$.ctx[2]}set show_options(t){this.$$set({show_options:t}),J()}get disabled(){return this.$$.ctx[3]}set disabled(t){this.$$set({disabled:t}),J()}get selected_indices(){return this.$$.ctx[4]}set selected_indices(t){this.$$set({selected_indices:t}),J()}get active_index(){return this.$$.ctx[5]}set active_index(t){this.$$set({active_index:t}),J()}get remember_scroll(){return this.$$.ctx[16]}set remember_scroll(t){this.$$set({remember_scroll:t}),J()}}function Fe(l,t){return(l%t+t)%t}function de(l,t){return l.reduce((e,f,h)=>((!t||f[0].toLowerCase().includes(t.toLowerCase()))&&e.push(h),e),[])}function Ge(l,t,e){l("change",t),e||l("input")}function Ke(l,t,e){if(l.key==="Escape")return[!1,t];if((l.key==="ArrowDown"||l.key==="ArrowUp")&&e.length>0)if(t===null)t=l.key==="ArrowDown"?e[0]:e[e.length-1];else{const f=e.indexOf(t),h=l.key==="ArrowUp"?-1:1;t=e[Fe(f+h,e.length)]}return[!0,t]}const{SvelteComponent:Me,append:L,attr:D,binding_callbacks:Pe,check_outros:Qe,create_component:te,destroy_component:le,detach:se,element:I,flush:N,group_outros:Ve,init:We,insert:oe,listen:K,mount_component:ne,run_all:Xe,safe_not_equal:Ye,set_data:Ze,set_input_value:me,space:$,text:ve,toggle_class:R,transition_in:j,transition_out:M}=window.__gradio__svelte__internal,{createEventDispatcher:xe,afterUpdate:$e}=window.__gradio__svelte__internal;function et(l){let t;return{c(){t=ve(l[0])},m(e,f){oe(e,t,f)},p(e,f){f[0]&1&&Ze(t,e[0])},d(e){e&&se(t)}}}function be(l){let t,e,f;return e=new Ee({}),{c(){t=I("div"),te(e.$$.fragment),D(t,"class","icon-wrap svelte-1hfxrpf")},m(h,u){oe(h,t,u),ne(e,t,null),f=!0},i(h){f||(j(e.$$.fragment,h),f=!0)},o(h){M(e.$$.fragment,h),f=!1},d(h){h&&se(t),le(e)}}}function tt(l){let t,e,f,h,u,r,n,s,w,o,a,k,y,C;e=new De({props:{root:l[8],show_label:l[4],info:l[1],$$slots:{default:[et]},$$scope:{ctx:l}}});let m=!l[3]&&be();return a=new je({props:{show_options:l[13],choices:l[2],filtered_indices:l[11],disabled:l[3],selected_indices:l[12]===null?[]:[l[12]],active_index:l[15]}}),a.$on("change",l[17]),{c(){t=I("div"),te(e.$$.fragment),f=$(),h=I("div"),u=I("div"),r=I("div"),n=I("input"),w=$(),m&&m.c(),o=$(),te(a.$$.fragment),D(n,"role","listbox"),D(n,"aria-controls","dropdown-options"),D(n,"aria-expanded",l[13]),D(n,"aria-label",l[0]),D(n,"class","border-none svelte-1hfxrpf"),n.disabled=l[3],D(n,"autocomplete","off"),n.readOnly=s=!l[7],R(n,"subdued",!l[14].includes(l[10])&&!l[6]),D(r,"class","secondary-wrap svelte-1hfxrpf"),D(u,"class","wrap-inner svelte-1hfxrpf"),R(u,"show_options",l[13]),D(h,"class","wrap svelte-1hfxrpf"),D(t,"class","svelte-1hfxrpf"),R(t,"container",l[5])},m(i,c){oe(i,t,c),ne(e,t,null),L(t,f),L(t,h),L(h,u),L(u,r),L(r,n),me(n,l[10]),l[30](n),L(r,w),m&&m.m(r,null),L(h,o),ne(a,h,null),k=!0,y||(C=[K(n,"input",l[29]),K(n,"keydown",l[20]),K(n,"keyup",l[31]),K(n,"blur",l[19]),K(n,"focus",l[18])],y=!0)},p(i,c){const O={};c[0]&256&&(O.root=i[8]),c[0]&16&&(O.show_label=i[4]),c[0]&2&&(O.info=i[1]),c[0]&1|c[1]&16&&(O.$$scope={dirty:c,ctx:i}),e.$set(O),(!k||c[0]&8192)&&D(n,"aria-expanded",i[13]),(!k||c[0]&1)&&D(n,"aria-label",i[0]),(!k||c[0]&8)&&(n.disabled=i[3]),(!k||c[0]&128&&s!==(s=!i[7]))&&(n.readOnly=s),c[0]&1024&&n.value!==i[10]&&me(n,i[10]),(!k||c[0]&17472)&&R(n,"subdued",!i[14].includes(i[10])&&!i[6]),i[3]?m&&(Ve(),M(m,1,1,()=>{m=null}),Qe()):m?c[0]&8&&j(m,1):(m=be(),m.c(),j(m,1),m.m(r,null)),(!k||c[0]&8192)&&R(u,"show_options",i[13]);const p={};c[0]&8192&&(p.show_options=i[13]),c[0]&4&&(p.choices=i[2]),c[0]&2048&&(p.filtered_indices=i[11]),c[0]&8&&(p.disabled=i[3]),c[0]&4096&&(p.selected_indices=i[12]===null?[]:[i[12]]),c[0]&32768&&(p.active_index=i[15]),a.$set(p),(!k||c[0]&32)&&R(t,"container",i[5])},i(i){k||(j(e.$$.fragment,i),j(m),j(a.$$.fragment,i),k=!0)},o(i){M(e.$$.fragment,i),M(m),M(a.$$.fragment,i),k=!1},d(i){i&&se(t),le(e),l[30](null),m&&m.d(),le(a),y=!1,Xe(C)}}}function lt(l,t,e){let{label:f}=t,{info:h=void 0}=t,{value:u=void 0}=t,r,{value_is_output:n=!1}=t,{choices:s}=t,w,{disabled:o=!1}=t,{show_label:a}=t,{container:k=!0}=t,{allow_custom_value:y=!1}=t,{filterable:C=!0}=t,{root:m}=t,i,c=!1,O,p,g="",U="",q=!1,T=[],A=null,b=null,S;const H=xe();u&&(S=s.map(_=>_[1]).indexOf(u),b=S,b===-1?(r=u,b=null):([g,r]=s[b],U=g),F());function V(){e(14,O=s.map(_=>_[0])),e(25,p=s.map(_=>_[1]))}const v=typeof window<"u";function F(){V(),u===void 0||Array.isArray(u)&&u.length===0?(e(10,g=""),e(12,b=null)):p.includes(u)?(e(10,g=O[p.indexOf(u)]),e(12,b=p.indexOf(u))):y?(e(10,g=u),e(12,b=null)):(e(10,g=""),e(12,b=null)),e(28,S=b)}function d(_){if(e(12,b=parseInt(_.detail.target.dataset.index)),isNaN(b)){e(12,b=null);return}e(13,c=!1),e(15,A=null),i.blur()}function G(_){e(11,T=s.map((nt,Ae)=>Ae)),e(13,c=!0),H("focus")}function W(){y?e(21,u=g):e(10,g=O[p.indexOf(u)]),e(13,c=!1),e(15,A=null),H("blur")}function pe(_){e(13,[c,A]=Ke(_,A,T),c,(e(15,A),e(2,s),e(24,w),e(6,y),e(10,g),e(11,T),e(9,i),e(26,U),e(12,b),e(28,S),e(27,q),e(25,p))),_.key==="Enter"&&(A!==null?(e(12,b=A),e(13,c=!1),i.blur(),e(15,A=null)):O.includes(g)?(e(12,b=O.indexOf(g)),e(13,c=!1),e(15,A=null),i.blur()):y&&(e(21,u=g),e(12,b=null),e(13,c=!1),e(15,A=null),i.blur()))}$e(()=>{e(22,n=!1),e(27,q=!0)});function ke(){g=this.value,e(10,g),e(12,b),e(28,S),e(27,q),e(2,s),e(25,p)}function ye(_){Pe[_?"unshift":"push"](()=>{i=_,e(9,i)})}const Oe=_=>H("key_up",{key:_.key,input_value:g});return l.$$set=_=>{"label"in _&&e(0,f=_.label),"info"in _&&e(1,h=_.info),"value"in _&&e(21,u=_.value),"value_is_output"in _&&e(22,n=_.value_is_output),"choices"in _&&e(2,s=_.choices),"disabled"in _&&e(3,o=_.disabled),"show_label"in _&&e(4,a=_.show_label),"container"in _&&e(5,k=_.container),"allow_custom_value"in _&&e(6,y=_.allow_custom_value),"filterable"in _&&e(7,C=_.filterable),"root"in _&&e(8,m=_.root)},l.$$.update=()=>{l.$$.dirty[0]&436211716&&b!==S&&b!==null&&q&&(e(10,[g,u]=s[b],g,(e(21,u),e(12,b),e(28,S),e(27,q),e(2,s),e(25,p))),e(28,S=b),H("select",{index:b,value:p[b],selected:!0})),l.$$.dirty[0]&14680064&&JSON.stringify(r)!==JSON.stringify(u)&&(F(),Ge(H,u,n),e(23,r=u)),l.$$.dirty[0]&4&&V(),l.$$.dirty[0]&16780868&&s!==w&&(y||F(),e(24,w=s),e(11,T=de(s,g)),!y&&T.length>0&&e(15,A=T[0]),v&&i===document.activeElement&&e(13,c=!0)),l.$$.dirty[0]&67112004&&g!==U&&(e(11,T=de(s,g)),e(26,U=g),!y&&T.length>0&&e(15,A=T[0]))},[f,h,s,o,a,k,y,C,m,i,g,T,b,c,O,A,H,d,G,W,pe,u,n,r,w,p,U,q,S,ke,ye,Oe]}class _t extends Me{constructor(t){super(),We(this,t,lt,tt,Ye,{label:0,info:1,value:21,value_is_output:22,choices:2,disabled:3,show_label:4,container:5,allow_custom_value:6,filterable:7,root:8},null,[-1,-1])}get label(){return this.$$.ctx[0]}set label(t){this.$$set({label:t}),N()}get info(){return this.$$.ctx[1]}set info(t){this.$$set({info:t}),N()}get value(){return this.$$.ctx[21]}set value(t){this.$$set({value:t}),N()}get value_is_output(){return this.$$.ctx[22]}set value_is_output(t){this.$$set({value_is_output:t}),N()}get choices(){return this.$$.ctx[2]}set choices(t){this.$$set({choices:t}),N()}get disabled(){return this.$$.ctx[3]}set disabled(t){this.$$set({disabled:t}),N()}get show_label(){return this.$$.ctx[4]}set show_label(t){this.$$set({show_label:t}),N()}get container(){return this.$$.ctx[5]}set container(t){this.$$set({container:t}),N()}get allow_custom_value(){return this.$$.ctx[6]}set allow_custom_value(t){this.$$set({allow_custom_value:t}),N()}get filterable(){return this.$$.ctx[7]}set filterable(t){this.$$set({filterable:t}),N()}get root(){return this.$$.ctx[8]}set root(t){this.$$set({root:t}),N()}}export{je as D,Ge as a,Ke as b,_t as c,de as h}; | |
//# sourceMappingURL=Dropdown-BJOE3R5S.js.map | |