import './async-Djx13DAD.js';
import { b as spread_props, l as await_block, e as ensure_array_like, g as attr_style, d as attr_class, j as stringify, k as clsx, c as bind_props } from './index-B7gr0Dsc.js';
import { G } from './Block-2-03Azgw.js';
import './MarkdownCode.svelte_svelte_type_style_lang-DJRtJayx.js';
import './2-CeYbpaU1.js';
import { g } from './utils.svelte-D8Xdzglu.js';
import v from './Example2-Bga9nSuW.js';
import { e as escape_html } from './escaping-CBnpiEl5.js';
import './context-BZS6UlnY.js';
import './uneval-DjLoL4oF.js';
import './clone-BLo8hHdj.js';
import './prism-python-BaDPvmdn.js';
import './index5-BoOEKc6P.js';
import './dev-fallback-Bc5Ork7Y.js';

function K(b,n){b.component(s$1=>{let{components:_,component_props:w,load_component:x,headers:a,samples:d,sample_labels:h=null,value:u=null,root:k,proxy_url:E,samples_per_page:f=10,onclick:L,onselect:Q,layout:J=null}=n,P=E?`/proxy=${E}file=`:`${k}/file=`,z=-1,N=(_.length<2||h!==null)&&J!=="table",v$1=h?h.map(o=>[o]):d??[],g=0,H=v$1.length>f,M=H?v$1.slice(g*f,(g+1)*f):v$1.slice(),j=Math.ceil(v$1.length/f),O=(()=>{if(!H)return [];let o=[];return [0,g,j-1].forEach(e=>{for(let l=e-2;l<=e+2;l++)l>=0&&l<j&&!o.includes(l)&&(o.length>0&&l-o[o.length-1]>1&&o.push(-1),o.push(l));}),o})(),y=[];async function S(o){const e=JSON.parse(o);y=await Promise.all(e&&e.map(async l=>await Promise.all(l.map(async(p,i)=>({value:p,component:x(_[i],"example")})))));}let A=JSON.stringify(M||[]);await_block(s$1,S(A),()=>{},o=>{if(N){s$1.push("<!--[-->"),s$1.push('<div class="gallery svelte-16f20a1"><!--[-->');const e=ensure_array_like(M);for(let l=0,p=e.length;l<p;l++){let i=e[l];i[0]!=null?(s$1.push("<!--[-->"),s$1.push('<button class="gallery-item svelte-16f20a1">'),h?(s$1.push("<!--[-->"),v(s$1,{value:i[0],selected:z===l,type:"gallery"})):(s$1.push("<!--[!-->"),y.length?(s$1.push("<!--[-->"),await_block(s$1,y[0][0].component,()=>{},c=>{s$1.push("<!---->"),s$1.push("<!---->"),c.default?.(s$1,spread_props([w[0],{value:i[0],samples_dir:P,type:"gallery",selected:z===l,index:l,root:k}])),s$1.push("<!---->"),s$1.push("<!---->");}),s$1.push("<!--]-->")):s$1.push("<!--[!-->"),s$1.push("<!--]-->")),s$1.push("<!--]--></button>")):s$1.push("<!--[!-->"),s$1.push("<!--]-->");}s$1.push("<!--]--></div>");}else {if(s$1.push("<!--[!-->"),M.length>0){s$1.push("<!--[-->"),s$1.push('<div class="table-wrap svelte-16f20a1"><table tabindex="0" role="grid" class="svelte-16f20a1"><thead><tr class="tr-head svelte-16f20a1"><!--[-->');const e=ensure_array_like(a);for(let p=0,i=e.length;p<i;p++){let c=e[p];s$1.push(`<th class="svelte-16f20a1">${escape_html(c)}</th>`);}s$1.push("<!--]--></tr></thead><tbody><!--[-->");const l=ensure_array_like(y);for(let p=0,i=l.length;p<i;p++){let c=l[p];s$1.push('<tr class="tr-body svelte-16f20a1"><!--[-->');const G=ensure_array_like(c);for(let m=0,C=G.length;m<C;m++){let{value:D,component:I}=G[m];const B=_[m];B!==void 0?(s$1.push("<!--[-->"),s$1.push(`<td${attr_style(`max-width: ${stringify(B==="textbox"?"35ch":"auto")}`)}${attr_class(clsx(B),"svelte-16f20a1")}>`),await_block(s$1,I,()=>{},R=>{s$1.push("<!---->"),R.default?.(s$1,spread_props([w[m],{value:D,samples_dir:P,type:"table",selected:z===p,index:p,root:k}])),s$1.push("<!---->");}),s$1.push("<!--]--></td>")):s$1.push("<!--[!-->"),s$1.push("<!--]-->");}s$1.push("<!--]--></tr>");}s$1.push("<!--]--></tbody></table></div>");}else s$1.push("<!--[!-->");s$1.push("<!--]-->");}if(s$1.push("<!--]--> "),H){s$1.push("<!--[-->"),s$1.push('<div class="paginate svelte-16f20a1">Pages: <!--[-->');const e=ensure_array_like(O);for(let l=0,p=e.length;l<p;l++){let i=e[l];i===-1?(s$1.push("<!--[-->"),s$1.push("<div>...</div>")):(s$1.push("<!--[!-->"),s$1.push(`<button${attr_class("svelte-16f20a1",void 0,{"current-page":g===i})}>${escape_html(i+1)}</button>`)),s$1.push("<!--]-->");}s$1.push("<!--]--></div>");}else s$1.push("<!--[!-->");s$1.push("<!--]-->");}),s$1.push("<!--]-->"),bind_props(n,{value:u});});}function ps(b,n){b.component(s$1=>{let{$$slots:_,$$events:w,...x}=n;const a=new g(x);let d=a.props.samples??[];G(s$1,{visible:a.shared.visible,padding:false,elem_id:a.shared.elem_id,elem_classes:a.shared.elem_classes,scale:a.shared.scale,min_width:a.shared.min_width,allow_overflow:false,container:false,children:h=>{a.shared.show_label?(h.push("<!--[-->"),h.push(`<div class="label svelte-bnxc4d"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32" class="svelte-bnxc4d"><path fill="currentColor" d="M10 6h18v2H10zm0 18h18v2H10zm0-9h18v2H10zm-6 0h2v2H4zm0-9h2v2H4zm0 18h2v2H4z"></path></svg> ${escape_html(a.shared.label||"Examples")}</div>`)):h.push("<!--[!-->"),h.push("<!--]--> "),K(h,spread_props([{onclick:u=>(a.props.value=u.index,a.dispatch("click",a.props.value)),onselect:u=>a.dispatch("select",u),load_component:a.shared.load_component,samples:d},a.props])),h.push("<!---->");},$$slots:{default:true}});});}

export { ps as default };
//# sourceMappingURL=Index45-Bs1AhFUB.js.map
