import{fnstate as e,fntemplate as l,h as a}from"./fntags.min.js";let o=e([],(e=>e.id));function t(e){return Math.round(1e3*Math.random())%e}const s=["pretty","large","big","small","tall","short","long","handsome","plain","quaint","clean","elegant","easy","angry","crazy","helpful","mushy","odd","unsightly","adorable","important","inexpensive","cheap","expensive","fancy"],n=["red","yellow","blue","green","pink","brown","purple","brown","white","black","orange"],r=["table","chair","house","bbq","desk","car","pony","cookie","sandwich","burger","pizza","mouse","keyboard"];let d=1;function c(e){const l=new Array(e);for(let a=0;a<e;a++)l[a]={id:d++,label:`${s[t(s.length)]} ${n[t(n.length)]} ${r[t(r.length)]}`};return l}const i=(e,l,o)=>a("div",{class:"col-sm-6 smallpad"},a("button",{id:e,type:"button",class:"btn btn-primary btn-block",onclick:o},l)),p=l((e=>a("tr",{id:e("id"),class:e("rowClass"),onclick:e("rowClick")},a("td",{class:"col-md-1"},e("id")),a("td",{class:"col-md-4"},a("a",{class:"lbl"},e("label"))),a("td",{class:"col-md-1"},a("a",a("span",{onclick:e("removeRow"),class:"glyphicon glyphicon-remove","aria-hidden":"true"}))),a("td",{class:"col-md-6"}))));document.body.append(a("div",{class:"container"},a("div",{class:"jumbotron"},a("div",{class:"row"},a("div",{class:"col-md-6"},a("h1","fntags keyed")),a("div",{class:"col-md-6"},a("div",{class:"row"},i("run","Create 1,000 rows",(()=>o(c(1e3)))),i("runlots","Create 10,000 rows",(()=>o(c(1e4)))),i("add","Append 1,000 rows",(()=>o(o().concat(c(1e3))))),i("update","Update every 10th row",(()=>{let e=o();for(let l=0;l<e.length;l+=10){let a=e[l],o=a();o.label+=" !!!",a(o)}})),i("clear","Clear",(()=>o([]))),i("swaprows","Swap Rows",(()=>{const e=o();if(e.length>998){const l=e[1];e[1]=e[998],e[998]=l}o(e)})))))),a("table",{class:"table table-hover table-striped test-data"},o.bindChildren(a("tbody"),(e=>p({id:e().id,label:e.bindAs((()=>e().label)),rowClass:e.bindSelectAttr((()=>o.selected()===e().id?"danger":"")),rowClick:()=>o.select(e().id),removeRow:l=>{l.stopPropagation(),o(o().filter((l=>l().id!==e().id)))}})))),a("span",{class:"preloadicon glyphicon glyphicon-remove","aria-hidden":"true"})));