import{S as I,i as Q,s as U,d as h,o as B,Z,v as z,P as F,Q as G,y as R,a3 as C,a4 as D,q as H,e as w,g as T,h as v,w as j,b,c as k,f as p,_ as J,$ as K,a0 as L,D as M,E as V,u as W,a5 as X,k as N,l as Y,n as x}from"./index.1327b829.js";const y="mnt/c/Users/islam/dev/gradio-repos/gradio/ui/packages/tabs/src/Tabs.svelte";function P(o,e,r){const c=o.slice();return c[9]=e[r],c[11]=r,c}function O(o){let e,r=o[9].name+"",c,i,d,n;function a(){return o[7](o[9])}const s={c:function(){e=v("button"),c=N(r),i=j(),b(e,"class","px-4 pb-2 pt-1.5 border-transparent text-gray-400 hover:text-gray-700 -mb-[2px] border-2 border-b-0"),k(e,y,38,4,1135)},m:function(u,l){w(u,e,l),p(e,c),p(e,i),d||(n=Y(e,"click",a,!1,!1,!1),d=!0)},p:function(u,l){o=u},d:function(u){u&&T(e),d=!1,n()}};return h("SvelteRegisterBlock",{block:s,id:O.name,type:"else",source:"(38:3) {:else}",ctx:o}),s}function A(o){let e,r=o[9].name+"",c,i;const d={c:function(){e=v("button"),c=N(r),i=j(),b(e,"class","bg-white px-4 pb-2 pt-1.5 rounded-t-lg border-gray-200 -mb-[2px] border-2 border-b-0"),k(e,y,32,4,980)},m:function(a,s){w(a,e,s),p(e,c),p(e,i)},p:x,d:function(a){a&&T(e)}};return h("SvelteRegisterBlock",{block:d,id:A.name,type:"if",source:"(32:3) {#if t.id === $selected_tab}",ctx:o}),d}function S(o){let e;function r(n,a){return n[9].id===n[1]?A:O}let c=r(o),i=c(o);const d={c:function(){i.c(),e=H()},m:function(a,s){i.m(a,s),w(a,e,s)},p:function(a,s){c===(c=r(a))&&i?i.p(a,s):(i.d(1),i=c(a),i&&(i.c(),i.m(e.parentNode,e)))},d:function(a){i.d(a),a&&T(e)}};return h("SvelteRegisterBlock",{block:d,id:S.name,type:"each",source:"(31:2) {#each tabs as t, i}",ctx:o}),d}function E(o){let e,r,c,i,d=o[2];B(d);let n=[];for(let u=0;u<d.length;u+=1)n[u]=S(P(o,d,u));const a=o[6].default,s=Z(a,o,o[5],null),f={c:function(){e=v("div"),r=v("div");for(let l=0;l<n.length;l+=1)n[l].c();c=j(),s&&s.c(),b(r,"class","flex border-b-2 dark:border-gray-700"),k(r,y,29,1,870),b(e,"class","tabs flex flex-col my-4"),b(e,"id",o[0]),k(e,y,28,0,818)},l:function(l){throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option")},m:function(l,_){w(l,e,_),p(e,r);for(let t=0;t<n.length;t+=1)n[t].m(r,null);p(e,c),s&&s.m(e,null),i=!0},p:function(l,[_]){if(_&22){d=l[2],B(d);let t;for(t=0;t<d.length;t+=1){const m=P(l,d,t);n[t]?n[t].p(m,_):(n[t]=S(m),n[t].c(),n[t].m(r,null))}for(;t<n.length;t+=1)n[t].d(1);n.length=d.length}s&&s.p&&(!i||_&32)&&J(s,a,l,l[5],i?L(a,l[5],_,null):K(l[5]),null),(!i||_&1)&&b(e,"id",l[0])},i:function(l){i||(M(s,l),i=!0)},o:function(l){V(s,l),i=!1},d:function(l){l&&T(e),W(n,l),s&&s.d(l)}};return h("SvelteRegisterBlock",{block:f,id:E.name,type:"component",source:"",ctx:o}),f}const q={};function $(o,e,r){let c,{$$slots:i={},$$scope:d}=e;z("Tabs",i,["default"]);let{elem_id:n=""}=e;const a=[],s=D(!1);F(s,"selected_tab"),G(o,s,t=>r(1,c=t));const f=R();C(q,{register_tab:t=>{a.push({name:t.name,id:t.id}),s.update(m=>m||t.id)},unregister_tab:t=>{const m=a.findIndex(g=>g.id===t.id);a.splice(m,1),s.update(g=>g===t.id?a[m]?.id||a[a.length-1]?.id:g)},selected_tab:s});function u(t){X(s,c=t,c),f("change")}const l=["elem_id"];Object.keys(e).forEach(t=>{!~l.indexOf(t)&&t.slice(0,2)!=="$$"&&t!=="slot"&&console.warn(`<Tabs> was created with unknown prop '${t}'`)});const _=t=>u(t.id);return o.$$set=t=>{"elem_id"in t&&r(0,n=t.elem_id),"$$scope"in t&&r(5,d=t.$$scope)},o.$capture_state=()=>({TABS:q,setContext:C,createEventDispatcher:R,writable:D,elem_id:n,tabs:a,selected_tab:s,dispatch:f,handle_click:u,$selected_tab:c}),o.$inject_state=t=>{"elem_id"in t&&r(0,n=t.elem_id)},e&&"$$inject"in e&&o.$inject_state(e.$$inject),[n,c,a,s,u,d,i,_]}class te extends I{constructor(e){super(e),Q(this,e,$,E,U,{elem_id:0}),h("SvelteRegisterComponent",{component:this,tagName:"Tabs",options:e,id:E.name})}get elem_id(){throw new Error("<Tabs>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'")}set elem_id(e){throw new Error("<Tabs>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'")}}export{te as T,q as a};
