-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1 lines (1 loc) · 30.2 KB
/
index.html
1
<!doctype html><html lang=vi translate=no><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Phân loại sinh học</title><link rel=icon href=./icon.png><link rel=preconnect href=https://en.wikipedia.org><link rel=preconnect href=https://vi.wikipedia.org><link rel=dns-prefetch href=https://cdn.jsdelivr.net><script src=https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js></script><script src=https://cdn.jsdelivr.net/npm/mithril@2.2.2/mithril.min.js></script><style>@font-face{font-family:"PragmataPro Mono";src:url("assets/fonts/PragmataPro-Mono-R.woff2")}*,:after,:before{box-sizing:border-box}html{height:100%}body{height:100%;margin:0;font-family:sans-serif;font-size:16px;overflow:hidden;background:#282739;color:#fff;color-scheme:dark;user-select:none;cursor:default}.life{color:#4081eb}.domain{color:#4081eb}.kingdom{color:#4081eb}.phylum{color:#f75b94}.class{color:#f88f52}.order{color:#78c7df}.family{color:#5ece85}.tribe{color:#d391dd}.genus{color:#e2c08d}.species{color:#fff}.subspecies{color:#fff}.loading{height:100%;display:flex;flex-direction:column;gap:16px;justify-content:center;align-items:center}.main{height:100%}.scroll{height:100%;overflow-x:hidden;overflow-y:auto}.height{width:0;margin-top:-100vh;pointer-events:none}.lines{height:100%;margin:0;padding-left:64px}.line{height:18px;display:flex;align-items:center;font-family:PragmataPro Mono,monospace;white-space:pre;tab-size:2}.lineFind>.node{border-radius:0;outline:2px solid #f9d87d}.indent{height:18px}.node{height:100%;margin-top:8px;padding:0 6px;border-radius:4px;display:inline-flex;align-items:center;font-family:sans-serif}.nodeName{cursor:pointer}.nodeDash{margin-left:8px;color:#8e95a1}.nodeTextEn{margin-left:6px;font-family:sans-serif;font-style:italic;color:#8e95a1}.nodeTextVi{margin-left:6px;font-family:sans-serif;font-style:italic;color:#a3a190}.nodeTextEn+.nodeTextVi:before{content:"\b7";margin-right:6px}.nodeTextEnCopy{display:inline-block;gap:6px;text-decoration:underline;text-decoration-skip-ink:none;cursor:copy}.nodeTextEnCopy:not(:first-child){margin-left:6px}.nodeTextEnCopyIsDuplicateTextEn{color:#ab5b78}.nodeImg{min-width:6px;min-height:6px;max-width:16px;max-height:16px;margin-left:8px;padding:1px;background:#fff;cursor:pointer}.nodeImg+.nodeImg{margin-left:4px}.bcrums{position:absolute;left:64px;top:0}.bcrum{position:absolute;pointer-events:none}.bcrum>.line:first-child{border-radius:0;background:#282739}.bcrum>.line:nth-child(2)>.indent{clip-path:inset(0 0 .8ex 0);background:#282739}.bcrum>.line:nth-child(2)>.indent:has(+ .node){clip-path:inset(0 .12ch .8ex 0)}.bcrum>.line:nth-child(2)>.node{display:none}.bcrum>.line>.node{background:#282739;pointer-events:auto}.infos{position:absolute;right:16px;bottom:0;padding:16px 24px;border-radius:8px 4px 4px 4px;display:grid;grid-template-columns:repeat(3,auto);gap:4px 16px;background:#fff;color:#000}.modfCountIncr{color:#16a34a}.modfCountDecr{color:#db2777}.lang{position:absolute;right:22px;bottom:6px;width:30px;padding:6px;border-radius:6px 4px 4px 4px;text-align:center;background:#2cb3e6;color:#0c4a6e;cursor:pointer}.langIsVi{background:#f472b6;color:#831843}.find{position:absolute;top:0;right:16px;width:300px;padding:6px;border-radius:4px 4px 4px 8px;display:flex;align-items:center;background:#fff;color:#000}.findInput{width:0;height:24px;padding:0 8px;border:0;flex-grow:1;font:inherit;background:inherit;color:inherit;outline:0}.findCount{margin:0 8px 0;font-size:14px;color:#888}.findButton{width:28px;margin-left:4px;border-radius:4px;display:flex;justify-content:center;align-items:center;align-self:stretch;font-family:PragmataPro Mono,monospace;cursor:pointer}.findButton:hover{background:rgba(0,119,221,.2)}.findButtonOn{color:#07d}.findClose{font-weight:700;color:#e43}.findClose:hover{background:rgba(238,68,51,.2)}.popup{max-width:min-content;border-radius:8px;text-align:center;overflow:hidden;color:#000;box-shadow:1px 2px 12px 1px rgba(0,0,0,.533);pointer-events:none;z-index:100}.popupBody{width:328px;padding:8px 4px;border-radius:8px;display:flex;flex-direction:column;background:#f1f5f9;animation:popup 50ms forwards}.popupIsTrinomial .popupName{font-size:15px}.popupIsTwoImage{width:652px}.popupName{position:relative;padding:2px 8px 4px;display:flex;justify-content:center;align-items:center;font-weight:700;white-space:nowrap}.popupIcon{position:absolute;left:8px;width:24px;height:24px;padding:3px;border-radius:6px;box-sizing:content-box;background:center/24px no-repeat #1f2937}.popupRank{position:absolute;right:8px;color:#5e6570;font-size:11px}.popupTextEn,.popupTextVi{padding:0 8px 1px;font-family:sans-serif;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;color:#333}.popupGenders{margin-top:6px;display:flex;justify-content:center;column-gap:4px}.popupGender{width:100%;display:flex;flex-direction:column;align-self:stretch}.popupPicture{position:relative;width:320px;border-radius:6px;display:flex;justify-content:center;align-items:center;flex-grow:1;overflow:hidden}.popupPicture:after{content:"";position:absolute;inset:0;border-radius:6px;box-shadow:inset 0 0 16px 1px rgba(0,0,0,.2);pointer-events:none}.popupBgImg{position:absolute;left:0;top:0;width:100%;height:100%;display:block;object-fit:cover;filter:blur(24px) saturate(2)}.popupImg{max-width:320px;max-height:240px;display:block;background:#fff;filter:contrast(1.1) saturate(1.1);image-rendering:-webkit-optimize-contrast;z-index:0}.popupImgCover{width:100%;height:100%;object-fit:cover}.popupGenderText{margin-top:2px;margin-bottom:-1px;padding:0 8px;font-size:14px;color:#333}.popupSummary{padding:0 8px;line-height:1.35}.popupSummary:not(:empty){margin-top:6px}.popupSummary>p{margin:0;text-align:justify!important}.popupSummary a{text-decoration:none;color:inherit}@-moz-keyframes popup{from{transform:scale(.96)}to{transform:scale(1)}}@-webkit-keyframes popup{from{transform:scale(.96)}to{transform:scale(1)}}@-o-keyframes popup{from{transform:scale(.96)}to{transform:scale(1)}}@keyframes popup{from{transform:scale(.96)}to{transform:scale(1)}}</style><div class=loading><img src=./icon.png height=64> Đang phân loại...</div><script>!async function(){var e,t,i,n,s,o,a,l,r,c,h,p,u,d,g,f,b,v,w;for(u in null==(e=localStorage).taxonFindExact&&(e.taxonFindExact=""),null==e.taxonFindCase&&(e.taxonFindCase="1"),null==e.taxonInfoLv&&(e.taxonInfoLv="0"),null==e.taxonRightClickAction&&(e.taxonRightClickAction="k"),null==e.taxonPopupLang&&(e.taxonPopupLang="en"),t=18,i=[],n={},s=[["life",0,1],["domain",1,2],["kingdom",2,5],["phylum",5,10],["class",10,16],["order",16,24],["family",24,29],["tribe",29,32],["genus",32,38],["species",38,40],["subspecies",40,43]],o=[["",""],["Domain","Vực"],["Kingdom","Giới"],["Subkingdom","Phân giới"],["Infrakingdom","Thứ giới"],["Superphylum","Liên ngành"],["Phylum","Ngành"],["Subphylum","Phân ngành"],["Infraphylum","Thứ ngành"],["Parvphylum","Tiểu ngành"],["Superclass","Liên lớp"],["Class","Lớp"],["Subclass","Phân lớp"],["Infraclass","Thứ lớp"],["Parvclass","Tiểu lớp"],["Legion","Đoàn"],["Supercohort","Liên đội"],["Cohort","Đội"],["Megaorder","Tổng bộ"],["Superorder","Liên bộ"],["Order","Bộ"],["Suborder","Phân bộ"],["Infraorder","Thứ bộ"],["Parvorder","Tiểu bộ"],["Section","Đoạn"],["Subsection","Phân đoạn"],["Superfamily","Liên họ"],["Family","Họ"],["Subfamily","Phân họ"],["Supertribe","Liên tông"],["Tribe","Tông"],["Subtribe","Phân tông"],["Genus","Chi"],["Subgenus","Phân chi"],["Section","Mục"],["Subsection","Phân mục"],["Series","Loạt"],["Subseries","Phân loạt"],["Superspecies","Liên loài"],["Species","Loài"],[["Subspecies","Subsp."],["Phân loài","Ph.loài"]],[["Variety","Var."],"Thứ"],["Form","Dạng"]],a="localhost"===(l=location.hostname)||"127.0.0.1"===l,r=new Intl.NumberFormat("en"),c=void 0,2,h=+localStorage.taxonInfoLv,p={taxon:{label:"Tổng số mục",lv:1},family:{label:"Tổng số họ"},genus:{label:"Tổng số chi"},species:{label:"Tổng số loài",lv:1},speciesSubsp:{label:"Tổng số phân loài hoặc loài",lv:1},speciesSubspExists:{label:"Phân loài hoặc loài còn tồn tại"},speciesSubspExtinct:{label:"Phân loài hoặc loài tuyệt chủng"},speciesSubspHasEnName:{label:"Phân loài và loài có tên tiếng Anh"},speciesSubspHasViName:{label:"Phân loài và loài có tên tiếng Việt"},speciesSubspHasImg:{label:"Phân loài hoặc loài có hình ảnh",lv:1},img:{label:"Tổng số hình ảnh",lv:1}})null==(d=p[u]).lv&&(d.lv=2);g=async function(){var e,t,o,a,l,r,h,u,d,g,m,f,b,v,w,x,y,k,E,C,S,L,T,N,I,P,K,F,A,V,D,j,G,_,W,H,B,M,O,R,z=e=>{if("\\"!==e)return e},$=e=>{var t,i,n,s,o,a,l,r;if(i=(t=e.split(" ; "))[0],n=t[1],"?"!==i){switch("."===n&&(n=void 0),s=i[0],i=i.substring(1),s){case"-":i="https://i.imgur.com/"+i+"m.png";break;case"/":"/"===i[0]?i="https:"+i+".jpg":("~"===i[0]?(o="en",i=i.substring(1)):o="commons",a=i.split(".").at(-1),i="https://upload.wikimedia.org/wikipedia/"+o+"/thumb/"+i[0]+"/"+i+"/320px-"+i[0]+"."+a);break;case":":l=(t=h.exec(i))[1],i=t[2],a=t[3],i="https://"+(l=l?"inaturalist-open-data.s3.amazonaws.com":"static.inaturalist.org")+"/photos/"+i+"/medium."+(a=u[a]);break;case"@":i="https://live.staticflickr.com/"+i+"_e.jpg";break;case"%":i="https://www.biolib.cz/IMG/GAL/"+i+".jpg";break;case"~":i=(t=g.exec(i))[1],o=t[2],i="https://bugguide.net/images/"+(o=m[o])+"/"+i.substring(0,3)+"/"+i.substring(3,6)+"/"+i+".jpg";break;case"^":"^"===i[0]?(r="tools/uploadphoto/uploads",i=i.substring(1)):r="images/species",i="https://d1iraxgbwuhpbw.cloudfront.net/"+r+"/"+i+".jpg";break;case"+":i="https://cdn.download.ams.birds.cornell.edu/api/v1/asset/"+i+"/320";break;case"$":i="https://reptile-database.reptarium.cz/content/photo_"+i+".jpg";break;case"<":i="https://www.fishwisepro.com/pics/JPG/"+i+".jpg";break;case">":t=i.split("/"),i="https://biogeodb.stri.si.edu/"+t[0]+"/resources/img/images/species/"+(i=t[1])+".jpg";break;case"=":i="https://cdn.jsdelivr.net/gh/tientq64/taimg/"+i+".webp";break;case"!":i="https://i.pinimg.com/564x/"+i+".jpg";break;case"&":i="https://images.marinespecies.org/thumbs/"+i+".jpg?w=320";break;case"*":a=d[i.at(-1)],i="https://images.reeflifesurvey.com/0/species_"+(i=i.slice(0,-1))+".w400.h266."+a;break;default:i="h"+i}return[i,n]}},J=e=>e[0]>=T,q=e=>e[0]<T;for(v in e=(e=await(await fetch("tree.taxon")).text()).split("\n"),o=[t=[0,"Life",!1,[void 0,"/Sự_sống"],[],"Life","Sự sống"]],a=/^(\t*)(.+?)(\*)?(?: ([\\/].*?))?(?: \|([-a-z\d]+?))?(?: (!))?$/,l=/^([-/:@%~^+$<>=!&*?]|https?:\/\/)/,r=/(?=[\\/])/,h=/^(:?)(\d+)([epJEPu]?)$/,u={"":"jpg",e:"jpeg",p:"png",J:"JPG",E:"JPEG",P:"PNG",u:""},d={j:"jpg",J:"JPG"},g=/^([A-Z\d]+)([r]?)$/,m={"":"cache",r:"raw"},i=[],n={},f=0,b=-1,w=p)w[v].count=0;for(v=0,x=e.length;v<x;++v)y=void 0,k=void 0,E=void 0,C=(w=e[v].split(" # "))[0],S=w[1],L=w[2],w=a.exec(C),T=w[1],N=w[2],I=w[3],P=w[4],K=w[5],F=w[6],T=T.length+1,"_"===N&&(N=" "),P&&(P=P.split(r).map(z)),S&&(l.test(S)&&(L=S,S=void 0),S&&(k=(w=S.split(/\ ?\| /))[0],E=w[1]),L&&(y=L.split(" | ").map($))),A=[T,N],I&&(A[2]=!0),P&&(A[3]=P),k&&(A[5]=k),E&&(A[6]=E),y&&(A[7]=y),K&&(A[8]=K),F&&(A[9]=!0),o.some(J)&&(o=o.filter(q)),((V=o[o.length-1])[4]||(V[4]=[])).push(A),o.push(A);for(D=(e,t,s,o,a,l,r,h,u)=>{var d,g,m,v,w,x,y,k,E,C,S,L,T,N,I,P,K,F,A,V;if(d=e[0],g=e[1],m=e[2],v=e[3],w=e[4],x=e[5],y=e[6],k=e[7],E=e[8],C=e[9],m&&(a=!0),s>=0?(S=d-s-1,L=a?(l+(r&&"╍╍".repeat(S)+"╍┓"||" ".repeat(S)+" ┋")).replace(/\ (?=[╍━┓])/,"╹").replace(/┃(?=[━┓])/,"┣"):(l+(r&&"━━".repeat(S)+"━┓"||" ".repeat(S)+" ┃")).replace(/\ (?=[╍━┓])/,"┗").replace(/[┃┋](?=[━┓])/,"┣")):L=" ┃",L=null!=n[L]?n[L]:n[L]=f++,d>=39?(T=41===d?o+" var. "+g:o+" "+g,39===d&&p.species.count++,x&&p.speciesSubspHasEnName.count++,y&&p.speciesSubspHasViName.count++,w||(p.speciesSubsp.count++,k&&p.speciesSubspHasImg.count++,a&&p.speciesSubspExtinct.count++)):32===d?p.genus.count++:27===d&&p.family.count++,N={index:++b,lv:d,name:g,chrs:L},x&&(N.textEn=x),y&&(N.textVi=y),c&&c<39&&w&&w[0][0]>c&&(N.isShowChildsCount=!0),k&&(N.imgs=k,p.img.count+=k.length),a&&(N.extinct=a),v&&(N.disam=v),T&&(N.fullName=T),E&&(N.icon=E),C&&(N.isDuplicateTextEn=C),t&&(N.parent=t),i.push(N),w)for(N.childsCount=w.length,l+=" ".repeat(S)+(h?" ":a||u?" ┋":" ┃"),(d<34||d>38)&&("?"!==g&&" "!==g?o=33===d?o+" ("+g+")":T||g:32===d&&(o='"'+o+'"')),I=w.length-1,P=0,K=w.length;P<K;++P)F=P,A=w[P],D(A,N,d,o,a,l,!F,F===I,null!=(V=w[F+1])?V[2]:void 0)},D(t,void 0,-1,"",!1,"",!0,!0),v=0,x=(n=Object.keys(n)).length;v<x;++v){for(j=v,_=[],W=(G=n[v]).length/2,H="",B=0,M=(w=s).length;B<M&&W>(O=w[B])[1];++B)H+=R=G.substring(2*O[1],2*O[2]),R.trimEnd()?(H=H.replace(/\ /g,"\t"),_.push(H),H=""):_.push(void 0);n[j]=_}p.taxon.count=i.length,p.speciesSubspExists.count=p.speciesSubsp.count-p.speciesSubspExtinct.count,c&&(i=i.filter((e=>e.lv<=c)))},await g(),f=(new Date).setHours(0,0,0,0);try{b=JSON.parse(localStorage.taxonModfCounts)}catch(e){for(v in e,b={},p)d=p[v],b[v]=d.count}if(f===+localStorage.taxonModfTime)for(v in p)(d=p[v]).modfCount=d.count-b[v];else{for(v in p)d=p[v],b[v]=d.count,d.modfCount=0;localStorage.taxonModfTime=f,localStorage.taxonModfCounts=JSON.stringify(b)}w={oninit:function(){var e,t;for(e in this)"function"==typeof(t=this[e])&&(this[e]=t.bind(this));this.lines=[],this.start=void 0,this.len=0,this.finding=!1,this.findVal="",this.findLines=[],this.findIndex=0,this.findExact=!!localStorage.taxonFindExact,this.findCase=!!localStorage.taxonFindCase,this.findTimo=void 0,this.code=void 0,this.isKeyDown=!0,this.hoveredLine=void 0,this.popper=void 0,this.abortCtrler=void 0,this.rightClickAction=localStorage.taxonRightClickAction,this.popupLang=localStorage.taxonPopupLang},oncreate:function(){heightEl.style.height=i.length*t+"px",addEventListener("keydown",this.onkeydown),addEventListener("keyup",this.onkeyup),addEventListener("mousedown",this.onmousedown),addEventListener("blur",this.onblur),addEventListener("resize",this.onresize),scrollEl.scrollTop=+localStorage.taxonTop||0,this.onresize()},class:function(...e){var t,i,n,s,o,a;for(t=[],i=0,n=e.length;i<n;++i)if(s=e[i],Array.isArray(s))t.push((o=this.class).apply.apply(o,s));else if(s instanceof Object)for(a in s)s[a]&&t.push(a);else null!=s&&t.push(s);return t.join(" ")},getRankName:function(e){return s.find((t=>t[2]>e))[0]},getRankTexts:function(e,t,i){var n;return n=o[e][Number("vi"===t)],Array.isArray(n)?n[+i]:n},find:function(e){null!=e?this.findVal=e:e=this.findVal,this.finding||(this.finding=!0,m.redraw.sync(),findInputEl.select()),findInputEl.focus(),this.findTimo&&clearTimeout(this.findTimo),this.findTimo=setTimeout((()=>{this.findTimo=void 0,(e=e.trim()).length>1?(this.findCase||(e=e.toLowerCase()),this.findLines=i.filter((t=>{var i,n,s;return i=null!=(n=t.textVi)?n:"",s=this.getFullNameNoSubgenus(t),Number.isFinite(i)&&(i=""),this.findCase||(s=s.toLowerCase(),i=i.toLowerCase()),this.findExact?e===s||e===i:s.includes(e)||i.includes(e)})),this.findIndex>=this.findLines.length&&(this.findIndex=this.findLines.length-1)):this.findLines=[],this.findLines.length&&this.findGo(),m.redraw()}),100),m.redraw()},findGo:function(e){var i;null==e&&(e=0),this.findLines.length&&(this.findIndex=((this.findIndex+e)%(i=this.findLines.length)+i)%i,scrollEl.scrollTop=(this.findLines[this.findIndex].index-4)*t,this.scroll())},toggleFindExact:function(){this.findExact=!this.findExact,localStorage.taxonFindExact=this.findExact?"1":"",this.find()},toggleFindCase:function(){this.findCase=!this.findCase,localStorage.taxonFindCase=this.findCase?"1":"",this.find()},togglePopupLang:function(){this.popupLang="vi"===this.popupLang?"en":"vi",localStorage.taxonPopupLang=this.popupLang},closeFind:function(){this.finding&&(this.finding=!1,this.findLines=[],this.fetchTextEnCopyLines(),m.redraw())},openGoogleCommonName:function(e){var t,i,n;return t=this.getFullNameNoSubgenus(e),i=e.index,n=function(){switch(!1){case!e.textVi:return 0;case!e.imgs:return 1;default:return 2}}(),window.open("https://google.com/search?q="+t+"+common+name&row="+i+"&copiedType="+n,"_blank")},getSiblingLines:function(e,t,n){var s,o,a,l;for(null==t&&(t=10),null==n&&(n=()=>!0),s=[],o=i.indexOf(e);!(!(a=i[o])||s.length>=t||a.lv<e.lv);)a.lv===e.lv&&""!==(l=a.name)&&"?"!==l&&n(a)&&s.push(a),o++;return s},mousedownImg:function(e,t){var i,n,s,o,a;if(i=t.target,n=e[0],1===t.which){switch(!1){case!n.includes("upload.wikimedia.org"):s=10*Math.round(i.naturalWidth/i.naturalHeight*80),n=n.replace(/\/320px-/,"/"+s+"px-");break;case!n.includes("static.inaturalist.org"):case!n.includes("inaturalist-open-data.s3.amazonaws.com"):n=n.replace("/medium.","/large.");break;case!n.includes("live.staticflickr.com"):n=n.replace("_e.","_b.");break;case!n.includes("cdn.download.ams.birds.cornell.edu"):n=n.replace(/\d+$/,"1800");break;case!n.includes("images.marinespecies.org"):n=n.replace("?w=320","?w=1200");break;case!n.includes("i.pinimg.com"):n=n.replace("564x","originals");break;case!n.includes("reeflifesurvey.com"):n=n.replace(".w400.h266","");break;case!n.includes("i.imgur.com"):"Delete"===this.code?(n="".replace.call(n,/(?<=:\/\/)i\.|m\.\w+$/g,""),n+="?_taxonDelete=1"):n=n.replace(/m(?=\.\w+$)/,"r");break;case!n.includes("cdn.jsdelivr.net/gh/tientq64/taimg"):o=(a=n.split("/"))[a.length-1],n="https://github.com/tientq64/taimg/"+("Delete"===this.code?"delete":"blob")+"/main/"+o}window.open(n,"_blank")}},mousedownName:function(e,t){var i,n,s,o,l,r;if(""!==(i=e.name)&&"?"!==i)switch(t.which){case 1:a?(n=t.altKey?"vi":"en",s=this.getWikiPageName(e,n),window.open("https://"+n+".wikipedia.org/wiki/"+s,"_blank")):(s=this.getWikiPageName(e,"vi"),window.open("https://vi.wikipedia.org/wiki/"+s,"_blank"));break;case 2:if(t.preventDefault(),o=this.getFullNameNoSubgenus(e),t.altKey)l=a?o:e.name;else if(t.ctrlKey){if(a)for(let t=0,i=(r=this.getSiblingLines(e,10,(e=>!e.textEn&&!e.isDuplicateTextEn))).length;t<i;++t)c.call(this,t,r[t])}else a?this.openGoogleCommonName(e):l=o;if(l)try{navigator.clipboard.writeText(l)}catch(e){alert(e.message)}}function c(e,t){setTimeout((()=>{this.openGoogleCommonName(t)}),500*e)}},contextmenuName:function(e,t){var i,n,s,o,l,r,c,h;if(t.preventDefault(),a){if(""!==(i=e.name)&&"?"!==i)if(t.ctrlKey)for(s=0,o=(n=this.getSiblingLines(e,10)).length;s<o;++s)l=n[s],r=this.getFullNameNoSubgenus(l),this.windowOpenByAction("k",r);else r=this.getFullNameNoSubgenus(e),c=function(){switch(!1){case!t.altKey:return"g";case"KeyB"!==this.code:return"b";case"KeyL"!==this.code:return"l";case"KeyH"!==this.code:return"h";case"KeyE"!==this.code:return"e";case"KeyS"!==this.code:return"s";case"KeyN"!==this.code:return"n";case"KeyK"!==this.code:return"k";case"KeyR"!==this.code:return"r";default:return this.rightClickAction}}.call(this),this.windowOpenByAction(c,r)}else h=this.getWikiPageName(e,"en"),window.open("https://en.wikipedia.org/wiki/"+h,"_blank")},windowOpenByAction:async function(e,t){var i,n,s,o;switch(e){case"g":window.open("https://google.com/search?tbm=isch&q="+t,"_blank");break;case"b":window.open("https://bugguide.net/index.php?q=search&keys="+t);break;case"l":window.open("https://www.biolib.cz/en/formsearch/?string="+t+"&searchgallery=1&action=execute");break;case"h":n=(i=t.split(" "))[0],(s=i[1])?window.open("https://fishbase.us/photos/ThumbnailsSummary.php?Genus="+n+"&Species="+s,"_blank"):window.open("http://fishbase.us/Nomenclature/ValidNameList.php?syng="+n+"&crit2=CONTAINS&crit1=EQUAL");break;case"e":o=async e=>{var t,i;if(i=(t=await(await fetch("https://api.ebird.org/v2/ref/taxon/find?key=jfekjedvescr&q="+e)).json()).find((t=>t.name.includes(e)))||t[0])return window.open("https://ebird.org/species/"+i.code),!0},await o(t)||line.textEn&&await o(line.textEn);break;case"s":t=t.toLowerCase().replace(/\ /g,"-"),window.open("https://www.seriouslyfish.com/species/"+t);break;case"n":window.open("https://inaturalist.org/taxa/search?view=list&q="+t);break;case"k":window.open("https://www.flickr.com/search/?text="+t);break;case"r":window.open("https://repfocus.dk/"+t+".html")}},getAbbrWordName:function(e){var t;return'"'===(t=e[0])?'"'+e[1]+'."':t+"."},mouseenterName:async function(e,t,i){var n,s,o,a,l,r,c,h,p;"?"!==(n=e.name)&&" "!==n&&(this.hoveredLine=e,(s=e.imgs)&&(s=s.slice(0,2)),328,o=Boolean(s&&s[0]&&s[1]),a=this.getFullNameNoSubgenus(e),l=this.getIcon(e),r="",c=()=>{var e;popupEl.offsetHeight>innerHeight-4&&(e=r.split(" ")).length>2?(r=e.slice(0,-1).join(" ").concat("..."),summaryEl.innerHTML=r,c()):this.popper.update()},h=e=>{var t;if(null==e&&(e=0),!o&&(224,nameEl.offsetWidth>224))switch((t=a.split(" ")).length){case 4:switch(e){case 0:a=t[0]+" "+this.getAbbrWordName(t[1])+" "+t[2]+" "+t[3],nameEl.textContent=a,h(1);break;case 1:a=this.getAbbrWordName(t[0])+" "+t[1]+" "+t[2]+" "+t[3],nameEl.textContent=a}break;case 3:switch(e){case 0:a=t[0]+" "+this.getAbbrWordName(t[1])+" "+t[2],nameEl.textContent=a,h(1);break;case 1:a=this.getAbbrWordName(t[0])+" "+t[1]+" "+t[2],nameEl.textContent=a}break;case 2:a=this.getAbbrWordName(t[0])+" "+t[1],nameEl.textContent=a}},p={view:t=>m(".popupBody",{class:this.class({popupIsTrinomial:e.lv>39,popupIsTwoImage:o}),style:{minWidth:"328px"}},m(".popupName",l?m(".popupIcon",{style:{backgroundImage:"url(https://cdn-icons-png.flaticon.com/24/"+l.slice(0,-3)+"/"+l+".png)"}}):void 0,m("#nameEl",a),m(".popupRank",this.getRankTexts(e.lv,this.popupLang,!0))),e.textEn?m(".popupTextEn",e.textEn):void 0,e.textVi&&isNaN(e.textVi)?m(".popupTextVi",e.textVi):void 0,s?m(".popupGenders",{class:this.class({popupGendersTwoImg:o})},s.map(((e,t)=>{if(e)return m(".popupGender",m(".popupPicture",m("img.popupBgImg",{src:e[0]}),m("img.popupImg",{src:e[0],onload:e=>{var t,i,n,s;i=(t=e.target).width,n=t.height,(i<320&&n<240||!o&&1.233<(s=i/n)&&s<1.333)&&t.classList.add("popupImgCover"),this.popper&&c()},onerror:()=>{this.popper&&this.popper.update()}})),2===s.length||s.some((function(e){return null!=e?e[1]:void 0}))?m(".popupGenderText",2===s.length?t?"Cái":"Đực":void 0,e[1]?2===s.length?" – "+e[1]:e[1]:void 0):void 0)}))):void 0,m(".popupSummary#summaryEl",{translate:!0}))},m.mount(popupEl,p),this.popper?this.popper.update():this.popper=Popper.createPopper(i.target,popupEl,{placement:t?"bottom":"left",modifiers:[{name:"offset",options:{offset:t&&[0,0]||[0,21]}},{name:"preventOverflow",options:{padding:2}}]}),h(),r=(await this.fetchWiki(e)).summary,this.popper&&(r=r?r.replace(/<br \/>/g,"").replace(/(?<!\.)\.\.(?!\.)/g,"."):"Không có dữ liệu",summaryEl.innerHTML=r,c()))},mouseleaveName:function(){this.hoveredLine&&(this.hoveredLine=void 0,this.abortCtrler&&(this.abortCtrler.abort(),this.abortCtrler=void 0),this.popper.destroy(),this.popper=void 0,m.mount(popupEl))},onclickTextEnCopy:async function(e,t,i){var n,s;e.textEnCopy=t,n=e.index;try{(s=await navigator.clipboard.readText())&&(s+="\n"),s+=n+"|kDDVKETwoTIKUZ2RYmima|",s+=await async function(){switch(!1){case!e.textVi:return" "+t;case!e.imgs:return" "+t+" #";default:return" # "+t}}(),await navigator.clipboard.writeText(s)}catch(e){alert(e.message)}},getFullNameNoSubgenus:function(e){return(e.fullName||e.name).replace(/\ \(.+?\)/,"")},getIcon:function(e){if(e)return e.icon?e.icon:this.getIcon(e.parent)},getParents:function(e){var t;for(t=[];e=e.parent;)t.push(e);return t},getWikiPageName:function(e,t){var i,n,s,o;switch((i=e.disam)&&(n=i[Number("vi"===t)])&&(s=n[0],n=n.substring(1)),o=(o=this.getFullNameNoSubgenus(e)).replace(/\ /g,"_"),s){case"/":return n||"_";case"\\":return o+"_("+n+")";default:return o}},fetchWiki:async function(e,t){var i,n,s,o,l,r,c,h,p,u,d,g,m,f,b,v,w,x,y;try{if(i=t?"en":this.popupLang,n=this.getWikiPageName(e,i),s={},t||(null!=(o=this.abortCtrler)&&o.abort(),this.abortCtrler=new AbortController,s.signal=this.abortCtrler.signal),l=await(await fetch("https://"+i+".wikipedia.org/api/rest_v1/page/summary/"+n,s)).json(),t||(this.abortCtrler=void 0),r=l.extract_html,"standard"===l.type){for(c=l.title.replace(/\ \(.+?\)/,""),p=[h=e.fullName||e.name],(u=this.getFullNameNoSubgenus(e))!==h&&p.push(u),d=e;d=d.parent;)p.push(this.getFullNameNoSubgenus(d));for(g=[c],(m=r.match(/<b>.+?<\/b>/g))&&g.push.apply(g,m),f=0,b=g.length;f<b;++f)c=g[f],(v=/<(\w+)[^>]*>(.+?)<\/\1>/.exec(c))&&(c=v[2]),!(c=c.replace(/,/g,"").trim())||p.includes(c)||c.includes(". ")||(c=c[0].toUpperCase()+c.substring(1),null==w&&(w=[]),w.includes(c)||w.push(c))}if("standard"!==l.type&&!a||!r)throw null;x=/<p>(.+?)<\/p>/su.exec(r)[0].replace(/\n+/g," ").replace(/^<p><b>(.+?)<\/b><\/p>$/u,"<p>$1</p>")}catch(e){e,x=""}if(y={summary:x,titles:w},!t)return y;t(e,y)},fetchTextEnCopyLines:function(){var e,t,i,n,s=(e,t)=>{var i;(i=(null!=t?t:{}).titles)&&(i=i.map((e=>e.replace(/’/g,"'")))),e.textEnCopy=i||!1,e.isDuplicateTextEn&&(e.textEnCopy||(e.textEnCopy=['""'])),m.redraw()};for(e=0,i=(t=this.lines).length;e<i;++e)(n=t[e]).lv>=0&&1!==n.childsCount&&void 0===n.textEn&&void 0===n.textEnCopy&&(n.textEnCopy="...",this.fetchWiki(n,s))},scroll:function(){var e,n,s;n=(e=Math.round(scrollEl.scrollTop))-e%t,linesEl.style.transform="translateY("+n+"px)",localStorage.taxonTop=e,(s=Math.floor(e/t))===this.start&&this.lines.length===this.len||(this.start=s,this.lines=i.slice(s,s+this.len),a&&(this.finding||this.fetchTextEnCopyLines()),m.redraw()),this.mouseleaveName()},onscroll:function(e){e.redraw=!1,this.scroll()},onwheel:function(e){e.redraw=!1,e.altKey&&(e.preventDefault(),scrollEl.scrollTop+=5*e.deltaY)},onkeydown:function(e){var t;if(!e.repeat&&1!==(t=e.location)&&2!==t&&(document.activeElement===document.body,this.isKeyDown=!0,this.code=e.code,"KeyF"===this.code))e.ctrlKey&&e.preventDefault()},onkeyup:async function(e){var n,s,o,l,r,p,u,d;if(this.isKeyDown){switch(n=document.activeElement===document.body,s=e.ctrlKey,e.shiftKey,o=e.altKey,this.code){case"KeyF":n&&this.find();break;case"KeyX":this.finding&&o&&this.toggleFindExact();break;case"KeyC":this.finding&&o&&this.toggleFindCase();break;case"KeyI":n&&(l=e.shiftKey?2:1,h=h&&h===l?0:l,localStorage.taxonInfoLv=h,m.redraw());break;case"KeyA":n&&(s||a&&(r=prompt("Nhập hành động khi bấm chuột phải:\ng) google\nc) google (common name)\nb) bugguide\nl) biolib\nh) fishbase\ne) ebird\ns) seriouslyfish\nn) inaturalist\nk) flickr (mặc định)\nr) repfocus",this.rightClickAction))&&(this.rightClickAction=r,localStorage.taxonRightClickAction=r));break;case"KeyT":n&&(s||a&&(p=+prompt("Rank tối đa được hiển thị:\n1) vực 2) giới 3) phân giới 4) thứ giới\n5) liên ngành 6) ngành 7) phân ngành 8) thứ ngành\n9) tiểu ngành 10) liên lớp 11) lớp 12) phân lớp\n13) thứ lớp 14) tiểu lớp 15) đoàn 16) liên đội\n17) đội 18) tổng bộ 19) liên bộ 20) bộ\n21) phân bộ 22) thứ bộ 23) tiểu bộ 24) đoạn\n25) phân đoạn 26) liên họ 27) họ 28) phân họ\n29) liên tông 30) tông 31) phân tông 32) chi\n33) phân chi 34) mục 35) phân mục 36) loạt\n37) phân loạt 38) liên loài 39) loài 40) phân loài\n41) thứ 42) dạng"))&&(c=p,this.lines=[],u=scrollEl.scrollTop,await g(),heightEl.style.height=i.length*t+"px",this.scroll(),m.redraw.sync(),u>(d=i.length*t-scrollEl.offsetHeight)&&(u=d),scrollEl.scrollTop=u));break;case"KeyV":n&&(s||(this.togglePopupLang(),this.hoveredLine&&this.mouseenterName(this.hoveredLine)));break;case"KeyE":if(a)try{await navigator.clipboard.writeText("")}catch(e){alert(e.message)}break;case"Digit1":n&&(s||a&&window.open("diff"));break;case"Escape":this.finding&&this.closeFind()}this.code=void 0,this.isKeyDown=!1,m.redraw()}},onmousedown:function(e){this.isKeyDown=!1},onblur:function(e){this.code=void 0,this.isKeyDown=!1},onresize:function(){this.len=Math.ceil(innerHeight/t)+1,this.scroll(),m.redraw()},lineView:function(e,t,i,o){var a;return m(".line",{key:e.index,class:this.class({lineFind:this.finding&&e===this.findLines[this.findIndex]})},n[e.chrs].map(((e,t)=>m(".indent",{class:s[t][0]},e))),m(".node",{style:{width:o?18*(o.lv-e.lv)+"px":void 0,background:" "===e.name?"#0000":void 0,overflow:o?"hidden":void 0,zIndex:i}},m(".nodeName",{class:this.getRankName(e.lv),onmouseenter:this.mouseenterName.bind(void 0,e,t),onmouseleave:this.mouseleaveName,onmousedown:this.mousedownName.bind(void 0,e),oncontextmenu:this.contextmenuName.bind(void 0,e)}," "===e.name?"--":e.name),e.textEn||e.textVi||e.textEnCopy&&"..."!==e.textEnCopy?m(".nodeDash","—"):void 0,e.textEn?m(".nodeTextEn",e.textEn):void 0,e.textEnCopy?Array.isArray(e.textEnCopy)?m(".nodeTextEn",e.textEnCopy.map((t=>m(".nodeTextEnCopy",{class:e.isDuplicateTextEn?"nodeTextEnCopyIsDuplicateTextEn":void 0,onclick:this.onclickTextEnCopy.bind(void 0,e,t)},t)))):m(".nodeTextEn",e.textEnCopy):void 0,e.textVi?m(".nodeTextVi",e.textVi):void 0,e.isShowChildsCount?m(".nodeTextVi","("+e.childsCount+")"):void 0,null!=(a=e.imgs)?a.map(((e,t)=>{if(e&&t<2)return m("img.nodeImg",{src:e[0],onmousedown:this.mousedownImg.bind(void 0,e)})})):void 0))},view:function(){var e;return m(".main",m(".scroll#scrollEl",{onwheel:this.onwheel,onscroll:this.onscroll},m(".lines#linesEl",this.lines.map((e=>this.lineView(e,!1,void 0,void 0)))),m(".height#heightEl")),this.lines[1]&&!c?m(".bcrums",this.getParents(this.lines[1]).map(((e,t,n)=>{var s;return s=n[t-1],m(".bcrum",{key:e.index},this.lineView(e,!0,o.length-t,s),this.lineView(i[e.index+1],!0,void 0,s))}))):void 0,h?m(".infos",function(){var t,i,n=[];for(t in i=p)e=i[t],h>=e.lv&&n.push(m.fragment(m(".info",e.label),m(".info",r.format(e.count)),m(".info",e.modfCount?m(".modfCount",{class:e.modfCount>0?"modfCountIncr":"modfCountDecr"},"("+(e.modfCount>0?"+":"")+r.format(e.modfCount)+")"):void 0)));return n}(),m(".info","Ngôn ngữ popup"),m(".info",this.popupLang)):m(".lang",{class:"vi"===this.popupLang?"langIsVi":void 0,title:"Ngôn ngữ trong phần mô tả",onclick:()=>{this.togglePopupLang()}},this.popupLang),this.finding?m(".find",m("input.findInput#findInputEl",{placeholder:"Tìm kiếm",autocomplete:"off",value:this.findVal,oninput:e=>{this.find(e.target.value)},onkeydown:e=>{"Enter"===e.key&&this.findGo(e.shiftKey?-1:1)}}),m(".findCount",(this.findLines.length&&this.findIndex+1||0)+"/"+this.findLines.length),m(".findButton",{class:this.findExact?"findButtonOn":void 0,title:"Tìm chính xác",onclick:this.toggleFindExact},'""'),m(".findButton",{class:this.findCase?"findButtonOn":void 0,title:"Phân biệt hoa-thường",onclick:this.toggleFindCase},"Aa"),m(".findButton.findClose",{title:"Đóng",onclick:this.closeFind},"⨉")):void 0,m(".popup#popupEl"))}},m.mount(document.body,w)}()</script>