text: (function(t){function e(e){for(var o,c,s=e[0],i=e[1],l=e[2],d=0,b=[];d<s.length;d++)c=s[d],Object.prototype.hasOwnProperty.call(r,c)&&r[c]&&b.push(r[c][0]),r[c]=0;for(o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o]);u&&u(e);while(b.length)b.shift()();return a.push.apply(a,l||[]),n()}function n(){for(var t,e=0;e<a.length;e++){for(var n=a[e],o=!0,s=1;s<n.length;s++){var i=n[s];0!==r[i]&&(o=!1)}o&&(a.splice(e--,1),t=c(c.s=n[0]))}return t}var o={},r={app:0},a=[];function c(e){if(o[e])return o[e].exports;var n=o[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,c),n.l=!0,n.exports}c.m=t,c.c=o,c.d=function(t,e,n){c.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},c.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},c.t=function(t,e){if(1&e&&(t=c(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(c.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)c.d(n,o,function(e){return t[e]}.bind(null,o));return n},c.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return c.d(e,"a",e),e},c.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},c.p="/";var s=window["webpackJsonp"]=window["webpackJsonp"]||[],i=s.push.bind(s);s.push=e,s=s.slice();for(var l=0;l<s.length;l++)e(s[l]);var u=i;a.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("56d7")},"0492":function(t,e,n){"use strict";n("9202")},"0f3a":function(t,e,n){"use strict";n("bc0f")},1028:function(t,e,n){"use strict";n("5eaa")},1363:function(t,e,n){},1870:function(t,e,n){},3327:function(t,e,n){"use strict";n("73cc")},3434:function(t,e,n){"use strict";n("7d7a")},"41c7":function(t,e,n){},"41eb":function(t,e,n){},"4eb5":function(t,e,n){},"4f0e":function(t,e,n){},"56d7":function(t,e,n){"use strict";n.r(e);n("e260"),n("e6cf"),n("cca6"),n("a79d");var o=n("7a23"),r=(n("ac1f"),n("841c"),n("498a"),Object(o["u"])("data-v-848b5cde"));Object(o["k"])("data-v-848b5cde");var a={class:"page-nav"},c={key:0,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},s=Object(o["h"])("path",{d:"M4 22h-4v-4h4v4zm0-12h-4v4h4v-4zm0-8h-4v4h4v-4zm3 0v4h17v-4h-17zm0 12h17v-4h-17v4zm0 8h17v-4h-17v4z"},null,-1),i={key:1,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},l=Object(o["h"])("path",{d:"M11 11h-11v-11h11v11zm13 0h-11v-11h11v11zm-13 13h-11v-11h11v11zm13 0h-11v-11h11v11z"},null,-1),u={key:0,class:"fallback"},d={key:1,class:"container"},b={key:0,class:"table-container"},h=Object(o["h"])("thead",null,[Object(o["h"])("tr",null,[Object(o["h"])("th",null,"书名"),Object(o["h"])("th",null,"作者"),Object(o["h"])("th",null,"出版社"),Object(o["h"])("th",null,"出版年"),Object(o["h"])("th",null,"页数"),Object(o["h"])("th",null,"剩余"),Object(o["h"])("th",null,"总量"),Object(o["h"])("th",null,"ISBN")])],-1);Object(o["j"])();var f=r((function(t,e,n,f,j,m){var O=Object(o["n"])("top-bar"),p=Object(o["n"])("author-tool"),v=Object(o["n"])("tag-tool"),g=Object(o["n"])("search-bar"),w=Object(o["n"])("pagination"),k=Object(o["n"])("book-item");return Object(o["i"])(),Object(o["d"])(o["a"],null,[Object(o["h"])(O,{user:j.user,onLogin:e[1]||(e[1]=function(t){return j.user=t}),onRegister:e[2]||(e[2]=function(t){return j.user=t}),onLogout:e[3]||(e[3]=function(t){return j.user={class:"guest"}})},null,8,["user"]),Object(o["h"])(g,{"onSubmit-search":e[5]||(e[5]=function(t){return m.search(t)})},{default:r((function(){return[Object(o["h"])(p,{large:!0,"toggle-search":!0,"toggle-count":!0,"toggle-add":"guest"!==j.user.class&&"user"!==j.user.class,"toggle-delete":"guest"!==j.user.class&&"user"!==j.user.class,"onAuthors-changed":e[4]||(e[4]=function(t){return j.authors=t})},null,8,["toggle-add","toggle-delete"]),Object(o["h"])(v,{large:!0,"toggle-search":!0,"toggle-count":!0,"toggle-add":"guest"!==j.user.class&&"user"!==j.user.class,"toggle-delete":"guest"!==j.user.class&&"user"!==j.user.class},null,8,["toggle-add","toggle-delete"])]})),_:1}),Object(o["h"])("div",a,[Object(o["h"])(w,{total:j.totalPages,"onPage-updated":e[6]||(e[6]=function(t){return j.currentPage=t})},null,8,["total"]),Object(o["h"])("button",{class:"change-view",type:"button",onClick:e[7]||(e[7]=function(t){return j.listview=!j.listview})},[j.listview?(Object(o["i"])(),Object(o["d"])("svg",i,[l])):(Object(o["i"])(),Object(o["d"])("svg",c,[s]))])]),j.fallback.trim().length>0?(Object(o["i"])(),Object(o["d"])("div",u,[Object(o["h"])("h1",null,Object(o["o"])(j.fallback),1)])):(Object(o["i"])(),Object(o["d"])("div",d,[j.listview?(Object(o["i"])(),Object(o["d"])("div",b,[Object(o["h"])("table",null,[h,Object(o["h"])("tbody",null,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(j.books,(function(t){return Object(o["i"])(),Object(o["d"])(k,{key:t.bid,bookdata:t,userclass:j.user.class,listview:!0},null,8,["bookdata","userclass"])})),128))])])])):(Object(o["i"])(!0),Object(o["d"])(o["a"],{key:1},Object(o["l"])(j.books,(function(t){return Object(o["i"])(),Object(o["d"])(k,{key:t.bid,bookdata:t,userclass:j.user.class},null,8,["bookdata","userclass"])})),128))]))],64)})),j=(n("4de4"),n("d81d"),n("d3b7"),n("3ca3"),n("ddb0"),n("2b3d"),Object(o["u"])("data-v-56c9b7ac"));Object(o["k"])("data-v-56c9b7ac");var m=Object(o["h"])("p",null," ",-1),O={class:"modal"},p={class:"header"},v={class:"left"},g={class:"tag-box"},w={class:"author-box"},k={class:"right"},_=Object(o["h"])("h5",null,"简介",-1),y={id:"book_intro"},x={class:"book-props"},C={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},T=Object(o["h"])("path",{d:"M18.363 8.464l1.433 1.431-12.67 12.669-7.125 1.436 1.439-7.127 12.665-12.668 1.431 1.431-12.255 12.224-.726 3.584 3.584-.723 12.224-12.257zm-.056-8.464l-2.815 2.817 5.691 5.692 2.817-2.821-5.693-5.688zm-12.318 18.718l11.313-11.316-.705-.707-11.313 11.314.705.709z"},null,-1),B={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},S=Object(o["h"])("path",{d:"M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z"},null,-1),I={class:"footer"};Object(o["j"])();var P=j((function(t,e,n,r,a,c){var s=Object(o["n"])("author-tool"),i=Object(o["n"])("card"),l=Object(o["n"])("tag-tool"),u=Object(o["n"])("material-button");return Object(o["i"])(),Object(o["d"])(o["a"],null,[n.listview?(Object(o["i"])(),Object(o["d"])("tr",{key:0,onClick:e[1]||(e[1]=function(t){return a.show_modal=!0})},[Object(o["h"])("td",null,Object(o["o"])(n.bookdata.title),1),Object(o["h"])("td",null,[Object(o["h"])(s,{bid:n.bookdata.bid,textview:!0},null,8,["bid"])]),(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(a.columns,(function(t,e){return Object(o["i"])(),Object(o["d"])("td",{key:e},[Object(o["h"])("span",null,Object(o["o"])(n.bookdata[t.val]),1)])})),128))])):(Object(o["i"])(),Object(o["d"])(i,{key:1,onClick:e[2]||(e[2]=function(t){return a.show_modal=!0}),"data-image":a.cover.src},{header:j((function(){return[Object(o["h"])("h1",null,Object(o["o"])(a.book_props.title.val),1)]})),content:j((function(){return[m]})),_:1},8,["data-image"])),(Object(o["i"])(),Object(o["d"])(o["b"],{to:"#app"},[Object(o["s"])(Object(o["h"])("div",{class:["modal_mask",{shown:a.show_modal}],onClick:e[6]||(e[6]=function(t){return a.show_modal=!1})},[Object(o["h"])("div",O,[Object(o["h"])("div",{class:"book",onClick:e[5]||(e[5]=Object(o["t"])((function(){}),["stop"]))},[Object(o["h"])("span",{class:"btn_close",onClick:e[3]||(e[3]=function(t){return a.show_modal=!1})},"×"),Object(o["h"])("div",p,[Object(o["h"])("div",v,[Object(o["h"])("img",{src:a.cover.src,alt:a.cover.alt,onClick:e[4]||(e[4]=function(){return c.changeCover.apply(c,arguments)})},null,8,["src","alt"]),Object(o["h"])("div",g,[Object(o["h"])(l,{"toggle-add":"user"!==n.userclass&&"guest"!==n.userclass,bid:n.bookdata.bid,"toggle-delete":"guest"!==n.userclass&&"user"!==n.userclass},null,8,["toggle-add","bid","toggle-delete"])]),Object(o["h"])("div",w,[Object(o["h"])(s,{"toggle-add":"user"!==n.userclass&&"guest"!==n.userclass,bid:n.bookdata.bid,"toggle-delete":"guest"!==n.userclass&&"user"!==n.userclass},null,8,["toggle-add","bid","toggle-delete"])])]),Object(o["h"])("div",k,[_,Object(o["h"])("div",y,Object(o["o"])(a.book_intro),1)])]),Object(o["h"])("div",x,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(a.book_props,(function(t,e,r){return Object(o["i"])(),Object(o["d"])("div",{class:"input_group",key:r},[Object(o["h"])("label",{for:e},Object(o["o"])(t.label),9,["for"]),Object(o["s"])(Object(o["h"])("input",{type:t.type,"onUpdate:modelValue":function(e){return t.val=e},name:e,disabled:t.disabled},null,8,["type","onUpdate:modelValue","name","disabled"]),[[o["p"],t.val]]),"guest"!==n.userclass&&"user"!==n.userclass?(Object(o["i"])(),Object(o["d"])("button",{key:0,class:["btn_edit",{active:!t.disabled}],onClick:function(n){return c.onBtnEditClicked(t,e)}},[t.disabled?(Object(o["i"])(),Object(o["d"])("svg",C,[T])):(Object(o["i"])(),Object(o["d"])("svg",B,[S]))],10,["onClick"])):Object(o["e"])("",!0)])})),128))]),Object(o["h"])("div",I,[c.can_delete?(Object(o["i"])(),Object(o["d"])(u,{key:0,class:"btn_remove",content:"删除",onClick:c.deleteBook},null,8,["onClick"])):Object(o["e"])("",!0),Object(o["h"])(u,{class:"btn_borrow",disabled:!c.can_borrow,content:"借阅",onClick:c.borrowBook},null,8,["disabled","onClick"])])])])],2),[[o["r"],a.show_modal]])]))],64)})),M=(n("96cf"),n("1da1")),$=Object(o["u"])("data-v-516f2dda");Object(o["k"])("data-v-516f2dda");var A={class:"card-info"};Object(o["j"])();var N=$((function(t,e,n,r,a,c){return Object(o["i"])(),Object(o["d"])("div",{class:"card-wrap",onMousemove:e[1]||(e[1]=function(){return c.handleMouseMove.apply(c,arguments)}),onMouseenter:e[2]||(e[2]=function(){return c.handleMouseEnter.apply(c,arguments)}),onMouseleave:e[3]||(e[3]=function(){return c.handleMouseLeave.apply(c,arguments)}),ref:"card"},[Object(o["h"])("div",{class:"card",style:c.cardStyle},[Object(o["h"])("img",{src:n.dataImage,class:"card-bg",style:[c.cardBgTransform]},null,12,["src"]),Object(o["h"])("div",A,[Object(o["m"])(t.$slots,"header"),Object(o["m"])(t.$slots,"content")])],4)],544)})),F=(n("99af"),{name:"Card",mounted:function(){this.width=this.$refs.card.offsetWidth,this.height=this.$refs.card.offsetHeight},props:{dataImage:String},data:function(){return{width:0,height:0,mouseX:0,mouseY:0,mouseLeaveDelay:null}},computed:{mousePX:function(){return this.mouseX/this.width},mousePY:function(){return this.mouseY/this.height},cardStyle:function(){var t=30*this.mousePX,e=-30*this.mousePY;return{transform:"rotateY(".concat(t,"deg) rotateX(").concat(e,"deg)")}},cardBgTransform:function(){var t=-40*this.mousePX,e=-40*this.mousePY;return{transform:"translateX(".concat(t,"px) translateY(").concat(e,"px)")}}},methods:{handleMouseMove:function(t){this.mouseX=t.pageX-this.$refs.card.offsetLeft-this.width/2,this.mouseY=t.pageY-this.$refs.card.offsetTop-this.height/2},handleMouseEnter:function(){clearTimeout(this.mouseLeaveDelay)},handleMouseLeave:function(){this.mouseX=0,this.mouseY=0}}});n("3434");F.render=N,F.__scopeId="data-v-516f2dda";var D=F,E=Object(o["u"])("data-v-b27755c6");Object(o["k"])("data-v-b27755c6");var U={key:1,class:"material-button"};Object(o["j"])();var L=E((function(t,e,n,r,a,c){return n.isInput?(Object(o["i"])(),Object(o["d"])("input",{key:0,class:"material-button",type:"submit",value:n.content},null,8,["value"])):(Object(o["i"])(),Object(o["d"])("button",U,Object(o["o"])(n.content),1))})),z={name:"MaterialButton",props:{isInput:Boolean,content:String}};n("0492");z.render=L,z.__scopeId="data-v-b27755c6";var R=z,G=(n("b0c0"),n("b64b"),Object(o["u"])("data-v-22224b2a"));Object(o["k"])("data-v-22224b2a");var V={key:0},J={class:"header"},X={key:0,class:"title"},Y=Object(o["h"])("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"#00b0ff"},[Object(o["h"])("path",{d:"M24 10h-10v-10h-4v10h-10v4h10v10h4v-10h10z"})],-1),q={key:0,class:"spliter"},K={class:"content"},H={key:0,class:"bcount"},Z=Object(o["h"])("div",{class:"footer"},null,-1),W={class:"dropdown-container"},Q={key:0,class:"dropdown"},tt={key:0,class:"check status"},et={key:1,class:"cross status"},nt={key:2};Object(o["j"])();var ot=G((function(t,e,n,r,a,c){var s=Object(o["n"])("search-bar"),i=Object(o["n"])("material-button"),l=Object(o["n"])("modal");return n.textview?(Object(o["i"])(),Object(o["d"])("span",V,Object(o["o"])(c.textContent),1)):(Object(o["i"])(),Object(o["d"])(o["a"],{key:1},[Object(o["h"])("div",{class:["container",{small:!n.large}]},[Object(o["h"])("div",J,[!0!==n.hideTitle?(Object(o["i"])(),Object(o["d"])("span",X,"标签")):Object(o["e"])("",!0),n.toggleSearch?(Object(o["i"])(),Object(o["d"])(s,{key:1,class:"searchbar","search-text":a.searchText,"onUpdate:search-text":e[1]||(e[1]=function(t){return a.searchText=t})},null,8,["search-text"])):Object(o["e"])("",!0),n.toggleAdd?(Object(o["i"])(),Object(o["d"])("button",{key:2,type:"button",class:"add-new",onClick:e[2]||(e[2]=function(t){return a.show_modal_add=!0})},[Y])):Object(o["e"])("",!0)]),n.large?(Object(o["i"])(),Object(o["d"])("div",q)):Object(o["e"])("",!0),Object(o["h"])("div",K,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(void 0===n.bid?c.allTags:a.tags,(function(t,e){return Object(o["i"])(),Object(o["d"])("div",{class:["tag",{active:t.active&&void 0===n.bid}],key:e,onClick:function(e){return c.onClickTag(t)}},[Object(o["g"])(Object(o["o"])(t.name)+" ",1),n.toggleCount?(Object(o["i"])(),Object(o["d"])("span",H,Object(o["o"])(t.bcount),1)):Object(o["e"])("",!0),n.toggleDelete?(Object(o["i"])(),Object(o["d"])("span",{key:1,class:"close",onClick:Object(o["t"])((function(e){return c.removeTag(t.tid)}),["stop"])},"×",8,["onClick"])):Object(o["e"])("",!0)],10,["onClick"])})),128))]),Z],2),n.toggleAdd?(Object(o["i"])(),Object(o["d"])(l,{key:0,class:"modal-add small","show-modal":a.show_modal_add,onClose:e[6]||(e[6]=function(t){return a.show_modal_add=!1}),title:"新建标签"},{footer:G((function(){return[Object(o["h"])(i,{type:"submit",form:"new-tag-form",content:a.submiting?"submiting":"submit"},null,8,["content"])]})),default:G((function(){return[Object(o["h"])("form",{class:"form",id:"new-tag-form",onSubmit:e[5]||(e[5]=Object(o["t"])((function(){return c.submitNewTag.apply(c,arguments)}),["stop","prevent"]))},[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(Object.keys(a.new_tag_form).sort(),(function(t){return Object(o["i"])(),Object(o["d"])("div",{class:["form-control",{success:!0===a.new_tag_form[t].valid,error:!1===a.new_tag_form[t].valid}],key:a.new_tag_form[t].order},[Object(o["h"])("label",{for:t},Object(o["o"])(a.new_tag_form[t].label_name),9,["for"]),Object(o["s"])(Object(o["h"])("input",{type:a.new_tag_form[t].type,name:t,"onUpdate:modelValue":function(e){return a.new_tag_form[t].value=e},onFocus:e[3]||(e[3]=function(t){return a.focus=!0}),onFocusout:e[4]||(e[4]=function(){return c.inputFocusout.apply(c,arguments)}),autocomplete:"off"},null,40,["type","name","onUpdate:modelValue"]),[[o["p"],a.new_tag_form[t].value]]),Object(o["h"])("div",W,[void 0!==n.bid&&!0===a.focus?(Object(o["i"])(),Object(o["d"])("div",Q,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(c.dropdownItems,(function(e,n){return Object(o["i"])(),Object(o["d"])("div",{class:"dropdown-item",key:n,onClick:function(){a.focus=!1,a.new_tag_form[t].value=e.name}},Object(o["o"])(e.name),9,["onClick"])})),128))])):Object(o["e"])("",!0)]),!0===a.new_tag_form[t].valid?(Object(o["i"])(),Object(o["d"])("span",tt,"✔️")):Object(o["e"])("",!0),!1===a.new_tag_form[t].valid?(Object(o["i"])(),Object(o["d"])("span",et,"❌")):Object(o["e"])("",!0),!1===a.new_tag_form[t].valid?(Object(o["i"])(),Object(o["d"])("small",nt,Object(o["o"])(a.new_tag_form[t].err),1)):Object(o["e"])("",!0)],2)})),128))],32)]})),_:1},8,["show-modal"])):Object(o["e"])("",!0)],64))})),rt=(n("a15b"),n("a9e3"),n("4d63"),n("25f0"),n("2909")),at=Object(o["u"])("data-v-3716e019");Object(o["k"])("data-v-3716e019");var ct=Object(o["h"])("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",class:"svg-search",width:"20",fill:"orangered"},[Object(o["h"])("path",{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})],-1);Object(o["j"])();var st=at((function(t,e,n,r,a,c){return Object(o["i"])(),Object(o["d"])("form",{class:["search-box",{expand:c.expand}],onSubmit:e[5]||(e[5]=Object(o["t"])((function(){}),["prevent"]))},[Object(o["h"])("input",{type:"text",name:"",class:"search-txt",placeholder:"Type to search",value:n.searchText,onInput:e[1]||(e[1]=function(e){return t.$emit("update:search-text",e.target.value)}),ref:"search",onFocusin:e[2]||(e[2]=function(){return c.onFocusin.apply(c,arguments)}),onFocusout:e[3]||(e[3]=function(){return c.onFocusout.apply(c,arguments)})},null,40,["value"]),Object(o["m"])(t.$slots,"default"),Object(o["h"])("span",{class:"search-btn",href:"#",onClick:e[4]||(e[4]=function(e){return t.$emit("submit")})},[ct])],34)})),it={name:"CollapseSearchBox",props:{searchText:String},data:function(){return{hasFocus:!1}},computed:{expand:function(){return this.searchText&&this.searchText.length>0||this.hasFocus}},methods:{onFocusin:function(){this.hasFocus=!0,this.$emit("focusin",!0)},onFocusout:function(){this.hasFocus=!1}}};n("8477");it.render=st,it.__scopeId="data-v-3716e019";var lt=it,ut=Object(o["u"])("data-v-495a16dc");Object(o["k"])("data-v-495a16dc");var dt={class:"modal"},bt={class:"header"},ht={class:"title"},ft={class:"btn-close-wrapper"},jt={class:"content"},mt={class:"footer"};Object(o["j"])();var Ot=ut((function(t,e,n,r,a,c){return c.show_modal?(Object(o["i"])(),Object(o["d"])("div",{key:0,class:"modal-mask",onClick:e[3]||(e[3]=function(e){return t.$emit("close")})},[Object(o["h"])("div",dt,[Object(o["h"])("div",{class:"modal-body",onClick:e[2]||(e[2]=Object(o["t"])((function(){}),["stop"]))},[Object(o["h"])("div",bt,[Object(o["h"])("h5",ht,Object(o["o"])(n.title),1),Object(o["m"])(t.$slots,"header"),Object(o["h"])("div",ft,[Object(o["h"])("span",{class:"btn-close",onClick:e[1]||(e[1]=function(e){return t.$emit("close")})}," × ")])]),Object(o["h"])("div",jt,[Object(o["m"])(t.$slots,"default")]),Object(o["h"])("div",mt,[Object(o["m"])(t.$slots,"footer")])])])])):Object(o["e"])("",!0)})),pt={name:"Modal",props:{showModal:Boolean,title:String},computed:{show_modal:function(){return this.showModal}}};n("e2a2");pt.render=Ot,pt.__scopeId="data-v-495a16dc";var vt=pt,gt={name:"TagTool",components:{SearchBar:lt,Modal:vt,MaterialButton:R},props:{large:Boolean,toggleSearch:Boolean,toggleAdd:Boolean,toggleCount:Boolean,toggleDelete:Boolean,hideTitle:Boolean,bid:Number,textview:Boolean},data:function(){return{tags:[],new_tag_form:{name:{order:1,label_name:"标签名",type:"text",focus:!1,value:"",err:""}},show_modal_add:!1,searchText:"",submiting:!1,focus:!1}},watch:{searchText:function(t){if(t=t.trim(),t){var e=RegExp(t),n=this.$root.tags.filter((function(t){return t.active})),o=this.$root.tags.filter((function(t){return!t.active})),r=o.filter((function(t){return e.test(t.name)})),a=o.filter((function(t){return!e.test(t.name)}));this.$root.tags=[].concat(Object(rt["a"])(n),Object(rt["a"])(r),Object(rt["a"])(a))}}},computed:{dropdownItems:function(){if(!(this.new_tag_form.name.value.trim().length<=0)){try{var t=new RegExp(this.new_tag_form.name.value.trim())}catch(n){return}var e=this.allTags.filter((function(e){return t.test(e.name)}));return console.log(e),e}},allTags:function(){return this.$root.tags},textContent:function(){return this.tags.map((function(t){return t.name})).join(";")}},methods:{onClickTag:function(t){void 0===this.bid&&(t.active=!t.active,this.$root.tags=[].concat(Object(rt["a"])(this.$root.tags.filter((function(t){return t.active}))),Object(rt["a"])(this.$root.tags.filter((function(t){return!t.active})))))},inputFocusout:function(){var t=this;setTimeout((function(){return t.focus=!1}),200)},fetchTags:function(){var t=this;void 0!==this.bid?fetch("/api/tag/list/".concat(this.bid||""),{method:"GET"}).then((function(t){return t.json()})).then((function(e){e.ok&&(t.tags=e.data)})).catch((function(t){return console.log(t)})):this.$root.tags=this.$root.tags.map((function(t){return t.active=!1,t}))},submitNewTag:function(t){var e=this;if(void 0===this.bid){var n=new FormData(t.target),o=this.new_tag_form.name;o.value=o.value.trim(),o.value.length<=0?(o.valid=!1,o.err="标签名不可为空"):this.$root.tags.filter((function(t){return t.name===o.value})).length>0?(o.valid=!1,o.err="标签已存在"):(o.valid=!0,o.err=""),o.valid&&(this.submiting=!0,fetch("/api/tag/new",{method:"POST",body:n}).then((function(t){return t.json()})).then((function(t){t.ok?e.$root.tags.push(t.data):(o.valid=!1,o.err=t.msg),e.submiting=!1})).catch((function(t){console.log(t),o.valid=!1,o.err="网络错误",e.submiting=!1})))}else{var r=this.new_tag_form.name;if(r.value=r.value.trim(),r.value.length<=0)r.valid=!1,r.err="标签名不可为空";else if(this.tags.filter((function(t){return t.name===r.value})).length>0)r.valid=!1,r.err="标签已存在";else if(this.$root.tags.filter((function(t){return t.name===r.value})).length<=0)r.valid=!1,r.err="标签不存在";else{var a=this.$root.tags.filter((function(t){return t.name===r.value}))[0].tid;this.submiting=!0,fetch("/api/tag/add/".concat(a,"/").concat(this.bid),{method:"POST"}).then((function(t){return t.json()})).then((function(t){if(t.ok){r.valid=!0;var n=e.$root.tags.filter((function(t){return t.name===r.value}))[0];n.bcount++,e.tags.push(n),setTimeout((function(){e.show_modal_add=!1,delete r.valid,r.err="",r.value=""}),500)}else r.valid=!1,r.err=t.msg;e.submiting=!1})).catch((function(t){console.log(t),r.valid=!1,r.err="网络错误",e.submiting=!1}))}}},removeTag:function(t){var e=this;confirm("删除标签?")&&fetch("/api/tag/del/".concat(t,"/").concat(this.bid||""),{method:"POST"}).then((function(t){return t.json()})).then((function(t){t.ok?void 0!==e.bid?(e.tags=e.tags.filter((function(e){return e.tid!==t.data.tid})),e.$root.tags.filter((function(e){return e.tid===t.data.tid}))[0].bcount--):e.$root.tags=e.$root.tags.filter((function(e){return e.tid!==t.data.tid})):alert(t.msg)})).catch((function(t){return console.log(t)}))}},created:function(){this.fetchTags()},unmounted:function(){void 0===this.bid&&(this.$root.tags=this.$root.tags.map((function(t){return t.active=!1,t})))}};n("3327");gt.render=ot,gt.__scopeId="data-v-22224b2a";var wt=gt,kt=Object(o["u"])("data-v-0954e9cf");Object(o["k"])("data-v-0954e9cf");var _t={key:0,class:"authortext"},yt={class:"header"},xt={key:0,class:"title"},Ct={key:0,class:"dropdown-container collapse"},Tt={class:"dropdown"},Bt=Object(o["h"])("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"#00b0ff"},[Object(o["h"])("path",{d:"M24 10h-10v-10h-4v10h-10v4h10v10h4v-10h10z"})],-1),St={key:0,class:"spliter"},It={class:"content"},Pt={key:0,class:"bcount"},Mt=Object(o["h"])("div",{class:"footer"},null,-1),$t={key:0,class:"dropdown-container"},At={class:"dropdown"},Nt={key:1,class:"check status"},Ft={key:2,class:"cross status"},Dt={key:3};Object(o["j"])();var Et=kt((function(t,e,n,r,a,c){var s=Object(o["n"])("search-bar"),i=Object(o["n"])("material-button"),l=Object(o["n"])("modal");return n.textview?(Object(o["i"])(),Object(o["d"])("span",_t,Object(o["o"])(c.textContent),1)):(Object(o["i"])(),Object(o["d"])(o["a"],{key:1},[Object(o["h"])("div",{class:["container",{small:!n.large}]},[Object(o["h"])("div",yt,[!0!==n.hideTitle?(Object(o["i"])(),Object(o["d"])("span",xt,"作者")):Object(o["e"])("",!0),n.toggleSearch?(Object(o["i"])(),Object(o["d"])(s,{key:1,class:"searchbar",onFocusin:e[1]||(e[1]=function(t){return a.searchfocus=!0}),onFocusout:c.inputFocusout,"search-text":a.inputSearchAuthorName,"onUpdate:search-text":e[2]||(e[2]=function(t){return a.inputSearchAuthorName=t}),onSubmit:c.chooseAuthor},{default:kt((function(){return[!0===a.searchfocus?(Object(o["i"])(),Object(o["d"])("div",Ct,[Object(o["h"])("div",Tt,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(a.dropdownItems,(function(t,e){return Object(o["i"])(),Object(o["d"])("div",{class:"dropdown-item",key:e,onClick:function(){a.searchfocus=!1,a.inputSearchAuthorName=t.name}},Object(o["o"])(t.name),9,["onClick"])})),128))])])):Object(o["e"])("",!0)]})),_:1},8,["onFocusout","search-text","onSubmit"])):Object(o["e"])("",!0),n.toggleAdd?(Object(o["i"])(),Object(o["d"])("button",{key:2,type:"button",class:"add-new",onClick:e[3]||(e[3]=function(t){return a.show_modal_add=!0})},[Bt])):Object(o["e"])("",!0)]),n.large?(Object(o["i"])(),Object(o["d"])("div",St)):Object(o["e"])("",!0),Object(o["h"])("div",It,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(a.authors,(function(t,e){return Object(o["i"])(),Object(o["d"])("div",{class:"item",key:e,onClick:function(e){return c.unchooseAuthor(t.aid)}},[Object(o["g"])(Object(o["o"])(t.name)+" ",1),n.toggleCount?(Object(o["i"])(),Object(o["d"])("span",Pt,Object(o["o"])(t.bcount),1)):Object(o["e"])("",!0),n.toggleDelete?(Object(o["i"])(),Object(o["d"])("span",{key:1,class:"close",onClick:Object(o["t"])((function(e){return c.removeAuthor(t.aid)}),["stop"])},"×",8,["onClick"])):Object(o["e"])("",!0)],8,["onClick"])})),128))]),Mt],2),n.toggleAdd?(Object(o["i"])(),Object(o["d"])(l,{key:0,class:"modal-add small","show-modal":a.show_modal_add,onClose:e[7]||(e[7]=function(t){return a.show_modal_add=!1}),title:"新建作者"},{footer:kt((function(){return[Object(o["h"])(i,{type:"submit",form:"new-author-form",content:a.submiting?"submiting":"submit"},null,8,["content"])]})),default:kt((function(){return[Object(o["h"])("form",{class:"form",id:"new-author-form",onSubmit:e[6]||(e[6]=Object(o["t"])((function(){return c.submitNewAuthor.apply(c,arguments)}),["prevent"]))},[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(Object.keys(a.new_author_form).sort(),(function(t){return Object(o["i"])(),Object(o["d"])("div",{class:["form-control",{success:!0===a.new_author_form[t].valid,error:!1===a.new_author_form[t].valid}],key:a.new_author_form[t].order},[Object(o["h"])("label",{for:t},Object(o["o"])(a.new_author_form[t].label_name),9,["for"]),Object(o["s"])(Object(o["h"])("input",{type:a.new_author_form[t].type,name:t,"onUpdate:modelValue":function(e){return a.new_author_form[t].value=e},onFocus:e[4]||(e[4]=function(t){return a.inputfocus=!0}),onFocusout:e[5]||(e[5]=function(){return c.inputFocusout.apply(c,arguments)}),autocomplete:"off"},null,40,["type","name","onUpdate:modelValue"]),[[o["p"],a.new_author_form[t].value]]),!0===a.inputfocus?(Object(o["i"])(),Object(o["d"])("div",$t,[Object(o["h"])("div",At,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(a.dropdownItems,(function(e,n){return Object(o["i"])(),Object(o["d"])("div",{class:"dropdown-item",key:n,onClick:function(){a.inputfocus=!1,a.new_author_form[t].value=e.name}},Object(o["o"])(e.name),9,["onClick"])})),128))])])):Object(o["e"])("",!0),!0===a.new_author_form[t].valid?(Object(o["i"])(),Object(o["d"])("span",Nt,"✔️")):Object(o["e"])("",!0),!1===a.new_author_form[t].valid?(Object(o["i"])(),Object(o["d"])("span",Ft,"❌")):Object(o["e"])("",!0),!1===a.new_author_form[t].valid?(Object(o["i"])(),Object(o["d"])("small",Dt,Object(o["o"])(a.new_author_form[t].err),1)):Object(o["e"])("",!0)],2)})),128))],32)]})),_:1},8,["show-modal"])):Object(o["e"])("",!0)],64))})),Ut={name:"AuthorTool",components:{SearchBar:lt,Modal:vt,MaterialButton:R},props:{large:Boolean,toggleSearch:Boolean,toggleAdd:Boolean,toggleCount:Boolean,toggleDelete:Boolean,hideTitle:Boolean,bid:Number,textview:Boolean},data:function(){return{authors:[],new_author_form:{name:{order:1,label_name:"作者名",type:"text",value:"",err:""}},dropdownItems:[],show_modal_add:!1,submiting:!1,searchfocus:!1,inputfocus:!1,inputSearchAuthorName:""}},computed:{inputAuthorName:function(){return this.new_author_form.name.value},textContent:function(){return this.authors.map((function(t){return t.name})).join(";")}},watch:{inputAuthorName:function(t){var e=this;if(t.trim().length<=0)return this.inputfocus=!1,void(this.dropdownItems=[]);t.trim().length<=0||this.dropdownItems.filter((function(e){return t===e.name})).length>0||("number"===typeof this.timeoutID&&clearTimeout(this.timeoutID),this.timeoutID=setTimeout((function(){fetch("/api/author/search/".concat(t.trim()),{method:"GET"}).then((function(t){return t.json()})).then((function(t){t.ok&&e.inputAuthorName.trim().length>0&&(e.dropdownItems=t.data)})).catch((function(t){console.log(t)}))}),1e3))},inputSearchAuthorName:function(t){var e=this;if(t.trim().length<=0)return this.searchfocus=!1,void(this.dropdownItems=[]);t.trim().length<=0||this.dropdownItems.filter((function(e){return t===e.name})).length>0||("number"===typeof this.timeoutID&&clearTimeout(this.timeoutID),this.timeoutID=setTimeout((function(){fetch("/api/author/search/".concat(t.trim()),{method:"GET"}).then((function(t){return t.json()})).then((function(t){t.ok&&e.inputSearchAuthorName.trim().length>0&&(e.dropdownItems=t.data)})).catch((function(t){console.log(t)}))}),1e3))}},methods:{chooseAuthor:function(){var t=this.inputSearchAuthorName;this.dropdownItems.filter((function(e){return e.name===t.trim()})).length>0&&this.authors.filter((function(e){return e.name===t.trim()})).length<=0&&(this.authors.push(this.dropdownItems.filter((function(e){return e.name===t.trim()}))[0]),this.$emit("authors-changed",this.authors),this.inputSearchAuthorName="",this.dropdownItems=[],this.inputfocus=!1,this.searchfocus=!1)},unchooseAuthor:function(t){void 0===this.bid&&(this.authors=this.authors.filter((function(e){return e.aid!==t})),this.$emit("authors-changed",this.authors))},inputFocusout:function(){var t=this;setTimeout((function(){t.inputfocus=!1,t.searchfocus=!1}),200)},fetchAuthors:function(){var t=this;void 0!==this.bid&&fetch("/api/author/list/".concat(this.bid),{method:"GET"}).then((function(t){return t.json()})).then((function(e){e.ok&&(t.authors=e.data)})).catch((function(t){return console.log(t)}))},submitNewAuthor:function(t){var e=this;if(void 0===this.bid){var n=new FormData(t.target),o=this.new_author_form.name;o.value=o.value.trim(),o.value.length<=0?(o.valid=!1,o.err="作者名不可为空"):(o.valid=!0,o.err=""),o.valid&&(this.submiting=!0,fetch("/api/author/new",{method:"POST",body:n}).then((function(t){return t.json()})).then((function(t){t.ok||(o.valid=!1,o.err=t.msg),e.submiting=!1})).catch((function(t){console.log(t),o.valid=!1,o.err="网络错误",e.submiting=!1})))}else{var r=this.new_author_form.name;if(r.value=r.value.trim(),r.value.length<=0)r.valid=!1,r.err="作者名不可为空";else if(this.dropdownItems.filter((function(t){return t.name===r.value})).length<=0)r.valid=!1,r.err="作者不存在";else{this.submiting=!0;var a=this.dropdownItems.filter((function(t){return t.name===r.value}))[0];fetch("/api/author/add/".concat(a.aid,"/").concat(this.bid),{method:"POST"}).then((function(t){return t.json()})).then((function(t){t.ok?(e.authors.push(a),r.valid=!0,setTimeout((function(){e.show_modal_add=!1,delete r.valid,r.err="",r.value=""}),500)):(r.valid=!1,r.err=t.msg),e.submiting=!1})).catch((function(t){console.log(t),r.valid=!1,r.err="网络错误",e.submiting=!1}))}}},removeAuthor:function(t){var e=this;confirm("删除作者?")&&fetch("/api/author/del/".concat(t,"/").concat(this.bid||""),{method:"POST"}).then((function(t){return t.json()})).then((function(t){t.ok?e.authors=e.authors.filter((function(e){return e.aid!==t.data.aid})):alert(t.msg)})).catch((function(t){return console.log(t)}))}},created:function(){this.fetchAuthors()}};n("1028");Ut.render=Et,Ut.__scopeId="data-v-0954e9cf";var Lt=Ut,zt={name:"BookItem",components:{Card:D,MaterialButton:R,TagTool:wt,AuthorTool:Lt},props:{bookdata:Object,userclass:String,listview:Boolean},created:function(){this.fetchCover()},data:function(){return{show_modal:!1,cover:{src:this.bookdata.cover||"/cover.png",alt:"cover"},columns:[{name:"出版社",val:"pub"},{name:"出版年",val:"year"},{name:"页数",val:"page"},{name:"剩余",val:"rem"},{name:"总数",val:"total"},{name:"ISBN",val:"isbn"}],book_intro:this.bookdata.intro,book_props:{title:{label:"书名",val:this.bookdata.title||"title",type:"text",disabled:!0},pub:{label:"出版社",val:this.bookdata.pub||"",type:"text",disabled:!0},isbn:{label:"ISBN",val:this.bookdata.isbn||"isbn",type:"text",disabled:!0},year:{label:"出版年",val:this.bookdata.year||0,type:"number",disabled:!0},page:{label:"页数",val:this.bookdata.page||0,type:"number",disabled:!0},rem:{label:"余量",val:this.bookdata.rem||0,type:"number",disabled:!0},total:{label:"总数",val:this.bookdata.total||0,type:"number",disabled:!0}}}},computed:{can_delete:function(){return"user"!==this.userclass&&"guest"!==this.userclass},can_borrow:function(){return"guest"!==this.userclass&&this.bookdata.rem>0}},methods:{changeCover:function(){var t=this;return Object(M["a"])(regeneratorRuntime.mark((function e(){var n,o,r,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if("guest"!==t.userclass&&"user"!==t.userclass){e.next=2;break}return e.abrupt("return");case 2:if(n=prompt("图片url:"),n){e.next=5;break}return e.abrupt("return");case 5:return o=new FormData,e.prev=6,n=new URL("https://cors-anywhere.herokuapp.com/".concat(n)),e.next=10,fetch(n,{method:"GET",referrer:""});case 10:return r=e.sent,e.next=13,r.blob();case 13:r=e.sent,console.log(r),o.append("cover",r,"cover"),e.next=22;break;case 18:return e.prev=18,e.t0=e["catch"](6),alert("Failed to fetch image"),e.abrupt("return");case 22:return e.next=24,fetch("/api/book/".concat(t.bookdata.bid,"/setcover"),{method:"POST",body:o});case 24:return a=e.sent,e.next=27,a.json();case 27:a=e.sent,a.ok?t.cover.src=a.data.cover:console.log(a.err);case 29:case"end":return e.stop()}}),e,null,[[6,18]])})))()},fetchCover:function(){var t=this;return Object(M["a"])(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,fetch("/api/book/".concat(t.bookdata.bid,"/cover"),{method:"get"});case 2:return n=e.sent,e.next=5,n.json();case 5:n=e.sent,n.ok&&(t.cover.src=n.data.cover||"/cover.png");case 7:case"end":return e.stop()}}),e)})))()},borrowBook:function(){confirm("申请借阅 「".concat(this.bookdata.title,"」 ?"))&&fetch("/api/borrow/".concat(this.bookdata.bid),{method:"POST"}).then((function(t){return t.json()})).catch((function(t){return alert("Failed: "+JSON.stringify(t))}))},deleteBook:function(){var t=this;confirm("删除 「".concat(this.bookdata.title,"」"))&&fetch("/api/book/del/".concat(this.bookdata.bid),{method:"POST"}).then((function(t){return t.json()})).then((function(e){e.ok&&(t.$root.books=t.$root.books.filter((function(e){return e.bid!==t.bookdata.bid})))})).catch((function(t){return alert("Failed: "+JSON.stringify(t))}))},onBtnEditClicked:function(t,e){var n=this;if(!0===t.disabled)t.disabled=!1;else{t.disabled=!0;var o=this.$root.books.filter((function(t){return t.bid===n.bookdata.bid}))[0];if(t.val==o[e])return;var r=new FormData;r.append(e,t.val),fetch("/api/book/".concat(this.bookdata.bid,"/set"),{method:"POST",body:r}).then((function(t){return t.json()})).then((function(t){t.ok?o[e]=t.data[e]:console.log(t.msg),n.updateBook()})).catch((function(t){return console.log(t)}))}},updateBook:function(){this.book_props={title:{label:"书名",val:this.bookdata.title||"title",type:"text",disabled:!0},pub:{label:"出版社",val:this.bookdata.pub||"",type:"text",disabled:!0},isbn:{label:"ISBN",val:this.bookdata.isbn||"isbn",type:"text",disabled:!0},year:{label:"出版年",val:this.bookdata.year||0,type:"number",disabled:!0},page:{label:"页数",val:this.bookdata.page||0,type:"number",disabled:!0},rem:{label:"余量",val:this.bookdata.rem||0,type:"number",disabled:!0},total:{label:"总数",val:this.bookdata.total||0,type:"number",disabled:!0}}}}};n("b3e9");zt.render=P,zt.__scopeId="data-v-56c9b7ac";var Rt=zt,Gt=Object(o["u"])("data-v-151df2b5");Object(o["k"])("data-v-151df2b5");var Vt={class:"sm"},Jt=Object(o["h"])("a",{class:"logo"},[Object(o["g"])("BOOkMs "),Object(o["h"])("small",null,"图书借阅管理系统")],-1),Xt=Object(o["h"])("span",{class:"hamburger"},null,-1),Yt=Object(o["g"])(" 登出 "),qt=Object(o["h"])("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[Object(o["h"])("path",{d:"M16 9v-4l8 7-8 7v-4h-8v-6h8zm-2 10v-.083c-1.178.685-2.542 1.083-4 1.083-4.411 0-8-3.589-8-8s3.589-8 8-8c1.458 0 2.822.398 4 1.083v-2.245c-1.226-.536-2.577-.838-4-.838-5.522 0-10 4.477-10 10s4.478 10 10 10c1.423 0 2.774-.302 4-.838v-2.162z"})],-1),Kt={key:0,class:"check"},Ht={key:1,class:"cross"},Zt={key:2},Wt={key:0,class:"check"},Qt={key:1,class:"cross"},te={key:2};Object(o["j"])();var ee=Gt((function(t,e,n,r,a,c){var s=Object(o["n"])("material-button"),i=Object(o["n"])("modal"),l=Object(o["n"])("modal-new-book"),u=Object(o["n"])("userprofile"),d=Object(o["n"])("borrow-table"),b=Object(o["n"])("pending-table"),h=Object(o["n"])("user-table");return Object(o["i"])(),Object(o["d"])(o["a"],null,[Object(o["h"])("nav",null,[Object(o["h"])("div",Vt,[Jt,Object(o["h"])("button",{class:"toggle",type:"button",onClick:e[1]||(e[1]=function(t){return a.navExpand=!a.navExpand})},[Xt])]),"guest"===n.user.class?(Object(o["i"])(),Object(o["d"])("div",{key:0,class:["button-group",{expand:a.navExpand}]},[Object(o["h"])("button",{class:"button",onClick:e[2]||(e[2]=function(t){return a.toggle_login_modal=!0})}," 登录 "),Object(o["h"])("button",{class:"button",onClick:e[3]||(e[3]=function(t){return a.toggle_register_modal=!0})}," 注册 ")],2)):(Object(o["i"])(),Object(o["d"])("div",{key:1,class:["button-group",{expand:a.navExpand}]},[Object(o["h"])("button",{class:["button",{lgm:"admin"===n.user.class}],onClick:e[4]||(e[4]=function(t){return a.showUserprofile=!a.showUserprofile})},Object(o["o"])(n.user.name),3),Object(o["h"])("button",{class:"button",onClick:e[5]||(e[5]=function(t){return a.showBorrowTable=!a.showBorrowTable})}," 借阅📚 "),"admin"===n.user.class?(Object(o["i"])(),Object(o["d"])(o["a"],{key:0},[Object(o["h"])("button",{class:"button",onClick:e[6]||(e[6]=function(t){return a.showPendingTable=!a.showPendingTable})}," 审核⏳ "),Object(o["h"])("button",{class:"button",onClick:e[7]||(e[7]=function(t){return a.showUserTable=!0})}," 用户👥 "),Object(o["h"])("button",{class:"button",onClick:e[8]||(e[8]=function(t){return a.toggle_newbook_modal=!a.toggle_newbook_modal})}," 新书➕ ")],64)):Object(o["e"])("",!0),Object(o["h"])("button",{class:"button",onClick:e[9]||(e[9]=function(){return c.logout.apply(c,arguments)})},[Yt,qt])],2))]),"guest"===n.user.class?(Object(o["i"])(),Object(o["d"])(i,{key:0,class:"modal-login small",title:"登录","show-modal":a.toggle_login_modal,onClose:e[11]||(e[11]=function(t){return a.toggle_login_modal=!1})},{footer:Gt((function(){return[Object(o["h"])(s,{type:"submit",form:"login-form",content:a.submiting?"登录中":"登录",disabled:a.submiting},null,8,["content","disabled"])]})),default:Gt((function(){return[Object(o["h"])("form",{class:"form",id:"login-form",onSubmit:e[10]||(e[10]=Object(o["t"])((function(){return c.login.apply(c,arguments)}),["prevent"]))},[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(Object.keys(a.login_form).sort((function(t,e){return a.login_form[t].order-a.login_form[e].order})),(function(t){return Object(o["i"])(),Object(o["d"])("div",{class:["form-control",{success:!0===a.login_form[t].valid,error:!1===a.login_form[t].valid}],key:a.login_form[t].order},[Object(o["h"])("label",{for:t},Object(o["o"])(a.login_form[t].label_name),9,["for"]),Object(o["s"])(Object(o["h"])("input",{type:a.login_form[t].type,name:t,"onUpdate:modelValue":function(e){return a.login_form[t].value=e},autocomplete:"off"},null,8,["type","name","onUpdate:modelValue"]),[[o["p"],a.login_form[t].value]]),!0===a.login_form[t].valid?(Object(o["i"])(),Object(o["d"])("span",Kt,"✔️")):Object(o["e"])("",!0),!1===a.login_form[t].valid?(Object(o["i"])(),Object(o["d"])("span",Ht,"❌")):Object(o["e"])("",!0),!1===a.login_form[t].valid?(Object(o["i"])(),Object(o["d"])("small",Zt,Object(o["o"])(a.login_form[t].err),1)):Object(o["e"])("",!0)],2)})),128))],32)]})),_:1},8,["show-modal"])):Object(o["e"])("",!0),"guest"===n.user.class?(Object(o["i"])(),Object(o["d"])(i,{key:1,class:"modal-register small",title:"注册","show-modal":a.toggle_register_modal,onClose:e[13]||(e[13]=function(t){return a.toggle_register_modal=!1})},{footer:Gt((function(){return[Object(o["h"])(s,{type:"submit",form:"register-form",content:a.submiting?"注册中":"注册",disabled:a.submiting},null,8,["content","disabled"])]})),default:Gt((function(){return[Object(o["h"])("form",{class:"form",id:"register-form",onSubmit:e[12]||(e[12]=Object(o["t"])((function(){return c.register.apply(c,arguments)}),["prevent"]))},[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(Object.keys(a.register_form).sort((function(t,e){return a.register_form[t].order-a.register_form[e].order})),(function(t){return Object(o["i"])(),Object(o["d"])("div",{class:["form-control",{success:!0===a.register_form[t].valid,error:!1===a.register_form[t].valid}],key:a.register_form[t].order},[Object(o["h"])("label",{for:t},Object(o["o"])(a.register_form[t].label_name),9,["for"]),Object(o["s"])(Object(o["h"])("input",{type:a.register_form[t].type,name:t,"onUpdate:modelValue":function(e){return a.register_form[t].value=e},autocomplete:"password"===t?"new-password":"off"},null,8,["type","name","onUpdate:modelValue","autocomplete"]),[[o["p"],a.register_form[t].value]]),!0===a.register_form[t].valid?(Object(o["i"])(),Object(o["d"])("span",Wt,"✔️")):Object(o["e"])("",!0),!1===a.register_form[t].valid?(Object(o["i"])(),Object(o["d"])("span",Qt,"❌")):Object(o["e"])("",!0),!1===a.register_form[t].valid?(Object(o["i"])(),Object(o["d"])("small",te,Object(o["o"])(a.register_form[t].err),1)):Object(o["e"])("",!0)],2)})),128))],32)]})),_:1},8,["show-modal"])):Object(o["e"])("",!0),Object(o["h"])(l,{"show-modal":a.toggle_newbook_modal,onClose:e[14]||(e[14]=function(t){return a.toggle_newbook_modal=!1})},null,8,["show-modal"]),a.showUserprofile?(Object(o["i"])(),Object(o["d"])(u,{key:2,show:a.showUserprofile,onClose:e[15]||(e[15]=function(t){return a.showUserprofile=!1})},null,8,["show"])):Object(o["e"])("",!0),a.showBorrowTable?(Object(o["i"])(),Object(o["d"])(d,{key:3,show:a.showBorrowTable,onClose:e[16]||(e[16]=function(t){return a.showBorrowTable=!1})},null,8,["show"])):Object(o["e"])("",!0),a.showPendingTable?(Object(o["i"])(),Object(o["d"])(b,{key:4,show:a.showPendingTable,onClose:e[17]||(e[17]=function(t){return a.showPendingTable=!1})},null,8,["show"])):Object(o["e"])("",!0),a.showUserTable?(Object(o["i"])(),Object(o["d"])(h,{key:5,show:a.showUserTable,onClose:e[18]||(e[18]=function(t){return a.showUserTable=!1})},null,8,["show"])):Object(o["e"])("",!0)],64)})),ne=n("b85c"),oe=Object(o["u"])("data-v-314e65fb");Object(o["k"])("data-v-314e65fb");var re={key:0,class:"check status"},ae={key:1,class:"cross status"},ce={key:2},se={class:"form-control"},ie=Object(o["h"])("label",{for:"intro"},"简介",-1),le=Object(o["h"])("textarea",{name:"intro",rows:"5",class:"input"},null,-1),ue={key:0,class:"check status"},de={key:1,class:"cross status"},be={key:2},he=Object(o["f"])('<div class="form-control" data-v-314e65fb><label for="cover" data-v-314e65fb>封面</label><div class="input-group input" data-v-314e65fb><input name="cover" type="file" data-v-314e65fb><div data-v-314e65fb>或 </div><input type="text" name="cover_url" placeholder="图片URL" autocomplete="off" data-v-314e65fb></div></div>',1),fe={class:"form-control"},je=Object(o["g"])("标签 "),me=Object(o["h"])("path",{d:"M0 7.33l2.829-2.83 9.175 9.339 9.167-9.339 2.829 2.83-11.996 12.17z"},null,-1),Oe={class:"input"},pe={class:"form-control"},ve=Object(o["h"])("label",null,"作者",-1),ge={class:"input"};Object(o["j"])();var we=oe((function(t,e,n,r,a,c){var s=Object(o["n"])("tag-tool"),i=Object(o["n"])("collapse"),l=Object(o["n"])("author-tool"),u=Object(o["n"])("material-button"),d=Object(o["n"])("modal");return Object(o["i"])(),Object(o["d"])(d,{class:"large",title:"新书","show-modal":n.showModal},{footer:oe((function(){return[Object(o["h"])(u,{content:"提交",onClick:c.submitNewBook,disabled:a.submiting},null,8,["onClick","disabled"])]})),default:oe((function(){return[Object(o["h"])("form",{class:"form",onSubmit:e[3]||(e[3]=Object(o["t"])((function(){}),["prevent","stop"])),ref:"form"},[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(Object.keys(a.newbook_form).sort((function(t,e){return a.newbook_form[t].order-a.newbook_form[e].order})),(function(t){return Object(o["i"])(),Object(o["d"])("div",{class:["form-control",{success:!0===a.newbook_form[t].valid,error:!1===a.newbook_form[t].valid}],key:a.newbook_form[t].order},[Object(o["h"])("label",{for:t},Object(o["o"])(a.newbook_form[t].label_name),9,["for"]),Object(o["s"])(Object(o["h"])("input",{class:"input",type:a.newbook_form[t].type,name:t,"onUpdate:modelValue":function(e){return a.newbook_form[t].value=e},autocomplete:"off"},null,8,["type","name","onUpdate:modelValue"]),[[o["p"],a.newbook_form[t].value]]),!0===a.newbook_form[t].valid?(Object(o["i"])(),Object(o["d"])("span",re,"✔️")):Object(o["e"])("",!0),!1===a.newbook_form[t].valid?(Object(o["i"])(),Object(o["d"])("span",ae,"❌")):Object(o["e"])("",!0),!1===a.newbook_form[t].valid?(Object(o["i"])(),Object(o["d"])("small",ce,Object(o["o"])(a.newbook_form[t].err),1)):Object(o["e"])("",!0)],2)})),128)),Object(o["h"])("div",se,[ie,le,!0===a.intro.valid?(Object(o["i"])(),Object(o["d"])("span",ue,"✔️")):Object(o["e"])("",!0),!1===a.intro.valid?(Object(o["i"])(),Object(o["d"])("span",de,"❌")):Object(o["e"])("",!0),!1===a.intro.valid?(Object(o["i"])(),Object(o["d"])("small",be,Object(o["o"])(a.intro.err),1)):Object(o["e"])("",!0)]),he,Object(o["h"])("div",fe,[Object(o["h"])("label",null,[je,Object(o["h"])("span",{class:"expand-collapse",onClick:e[1]||(e[1]=function(t){return a.expandCollapseTags=!a.expandCollapseTags})},[(Object(o["i"])(),Object(o["d"])("svg",{xmlns:"http://www.w3.org/2000/svg",class:{expand:a.expandCollapseTags},viewBox:"0 0 24 24"},[me],2))])]),Object(o["h"])(i,{"is-expand":a.expandCollapseTags},{default:oe((function(){return[Object(o["h"])("div",Oe,[Object(o["h"])(s,{large:!0,"hide-title":!0,"toggle-search":!0,"toggle-add":!0})])]})),_:1},8,["is-expand"])]),Object(o["h"])("div",pe,[ve,Object(o["h"])("div",ge,[Object(o["h"])(l,{large:!0,"hide-title":!0,"toggle-search":!0,"toggle-add":!0,"onAuthors-changed":e[2]||(e[2]=function(t){return a.authors=t})})])])],544)]})),_:1},8,["show-modal"])})),ke=(n("aff5"),n("3835")),_e=Object(o["u"])("data-v-32a43e68"),ye=_e((function(t,e,n,r,a,c){return Object(o["i"])(),Object(o["d"])("div",{class:["collapse-container",{expand:c.expand}],ref:"cont"},[Object(o["m"])(t.$slots,"default")],2)})),xe={name:"Collapse",props:{isExpand:Boolean},computed:{expand:function(){return!0===this.isExpand?this.expandContent(this.$refs.cont):!1===this.isExpand&&this.collapseContent(this.$refs.cont),this.isExpand}},methods:{expandContent:function(t){if(void 0!==t){var e=t.scrollHeight;t.style.height=e+"px",t.addEventListener("transitionend",(function e(){t.removeEventListener("transitionend",e)}))}},collapseContent:function(t){if(void 0!==t){var e=t.scrollHeight,n=t.style.transition;t.style.transition="",requestAnimationFrame((function(){t.style.height=e+"px",t.style.transition=n,requestAnimationFrame((function(){t.style.height="0px"}))}))}}}};n("d3c3");xe.render=ye,xe.__scopeId="data-v-32a43e68";var Ce=xe,Te={name:"NewBookForm",components:{Modal:vt,TagTool:wt,AuthorTool:Lt,Collapse:Ce,MaterialButton:R},props:{showModal:Boolean},data:function(){return{expandCollapseTags:!1,submiting:!1,authors:[],newbook_form:{title:{order:1,label_name:"书名",value:"",type:"text",err:""},pub:{order:2,label_name:"出版社",value:"",type:"text",err:""},isbn:{order:3,label_name:"ISBN",value:"",type:"text",err:""},year:{order:5,label_name:"出版年",value:"",type:"number",err:""},page:{order:4,label_name:"页数",value:"",type:"number",err:""},total:{order:6,label_name:"总数",value:"",type:"number",err:""}},intro:{label_name:"简介",value:"",err:""}}},methods:{submitNewBook:function(){var t=this;return Object(M["a"])(regeneratorRuntime.mark((function e(){var n,o,r,a,c,s,i,l,u,d,b,h,f,j,m,O,p,v,g,w,k,_,y,x,C;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:n=new FormData(t.$refs.form),o=!0,r=Object(ne["a"])(n.entries()),e.prev=3,r.s();case 5:if((a=r.n()).done){e.next=37;break}c=Object(ke["a"])(a.value,2),s=c[0],i=c[1],e.t0=s,e.next="title"===e.t0?10:"pub"===e.t0?13:"isbn"===e.t0?16:"year"===e.t0?19:"page"===e.t0?23:"total"===e.t0?27:"intro"===e.t0?31:34;break;case 10:return l=t.newbook_form[s],i.trim().length<=0?(l.valid=!1,l.err="书名不可为空",o=!1):l.valid=!0,e.abrupt("break",35);case 13:return u=t.newbook_form[s],i.trim().length<=0?(u.valid=!1,u.err="出版社名不可为空",o=!1):u.valid=!0,e.abrupt("break",35);case 16:return d=t.newbook_form[s],/^(?=(?:\D*\d){10}(?:(?:\D*\d){3})?$)[\d-]+$/.test(i)?d.valid=!0:(d.valid=!1,d.err="ISBN 10 或 13",o=!1),e.abrupt("break",35);case 19:return b=t.newbook_form[s],h=parseInt(i),h>=1e3&&h<=parseInt((new Date).getFullYear())?b.valid=!0:(b.valid=!1,b.err="这合适吗¿",o=!1),e.abrupt("break",35);case 23:return f=t.newbook_form[s],j=parseInt(i),j>0&&j<Number.MAX_SAFE_INTEGER?f.valid=!0:(f.valid=!1,f.err="这合适吗¿",o=!1),e.abrupt("break",35);case 27:return m=t.newbook_form[s],O=parseInt(i),O>=0&&O<Number.MAX_SAFE_INTEGER?m.valid=!0:(m.valid=!1,m.err="这合适吗¿",o=!1),e.abrupt("break",35);case 31:return p=t.intro,i.length<500?p.valid=!0:(p.valid=!1,p.err="简介不多于500字",o=!1),e.abrupt("break",35);case 34:return e.abrupt("break",35);case 35:e.next=5;break;case 37:e.next=42;break;case 39:e.prev=39,e.t1=e["catch"](3),r.e(e.t1);case 42:return e.prev=42,r.f(),e.finish(42);case 45:if(!o){e.next=83;break}if(v=t.$root.tags.filter((function(t){return!0===t.active})).map((function(t){return t.tid})),g=t.authors.map((function(t){return t.aid})),n.append("tags",JSON.stringify(v)),n.append("authors",JSON.stringify(g)),t.submiting=!0,w=n.get("cover_url"),!w){e.next=68;break}return e.prev=53,w=new URL("https://cors-anywhere.herokuapp.com/".concat(w)),e.next=57,fetch(w,{method:"GET",referrer:""});case 57:return k=e.sent,e.next=60,k.blob();case 60:k=e.sent,console.log(k),n.set("cover",k,"cover"),e.next=68;break;case 65:e.prev=65,e.t2=e["catch"](53),console.log("url invalid");case 68:return e.prev=68,e.next=71,fetch("/api/book/new",{method:"POST",body:n});case 71:return _=e.sent,e.next=74,_.json();case 74:if(_=e.sent,_.ok)for(alert("成功"),y=0,x=Object.keys(t.newbook_form);y<x.length;y++)C=x[y],delete t.newbook_form[C].valid,t.newbook_form[C].err="",t.newbook_form[C].value="",delete t.intro.valid,t.intro.value="";else alert("Failed : ".concat(JSON.stringify(_.err)));e.next=82;break;case 78:e.prev=78,e.t3=e["catch"](68),console.log(e.t3),alert("网络错误");case 82:t.submiting=!1;case 83:case"end":return e.stop()}}),e,null,[[3,39,42,45],[53,65],[68,78]])})))()}}};n("b98e");Te.render=we,Te.__scopeId="data-v-314e65fb";var Be=Te,Se=Object(o["u"])("data-v-0edb6234");Object(o["k"])("data-v-0edb6234");var Ie={class:"container-userprofile"},Pe=Object(o["h"])("td",null,"UID",-1),Me=Object(o["h"])("td",null,"用户名",-1),$e=Object(o["h"])("td",null,"邮箱",-1),Ae=Object(o["h"])("td",null,"借阅数",-1),Ne=Object(o["h"])("td",null,"权限",-1),Fe={key:0,class:"check"},De={key:1,class:"cross"},Ee={key:2};Object(o["j"])();var Ue=Se((function(t,e,n,r,a,c){var s=Object(o["n"])("material-button"),i=Object(o["n"])("modal");return Object(o["i"])(),Object(o["d"])(o["a"],null,[(Object(o["i"])(),Object(o["d"])(o["b"],{to:"#app"},[Object(o["h"])(i,{"show-modal":n.show,class:"large",title:a.title,onClose:e[2]||(e[2]=function(e){return t.$emit("close")})},{footer:Se((function(){return[Object(o["h"])(s,{content:"修改密码",onClick:e[1]||(e[1]=function(t){return a.showChpswModal=!0})})]})),default:Se((function(){return[Object(o["h"])("div",Ie,[Object(o["h"])("table",null,[Object(o["h"])("tbody",null,[Object(o["h"])("tr",null,[Pe,Object(o["h"])("td",null,Object(o["o"])(a.user.uid),1)]),Object(o["h"])("tr",null,[Me,Object(o["h"])("td",null,Object(o["o"])(a.user.name),1)]),Object(o["h"])("tr",null,[$e,Object(o["h"])("td",null,Object(o["o"])(a.user.email),1)]),Object(o["h"])("tr",null,[Ae,Object(o["h"])("td",null,Object(o["o"])(a.user.count),1)]),Object(o["h"])("tr",null,[Ne,Object(o["h"])("td",null,Object(o["o"])(a.user.class),1)])])])])]})),_:1},8,["show-modal","title"])])),(Object(o["i"])(),Object(o["d"])(o["b"],{to:"#app"},[a.showChpswModal?(Object(o["i"])(),Object(o["d"])(i,{key:0,title:"修改密码","show-modal":a.showChpswModal,class:"small",onClose:e[4]||(e[4]=function(t){return a.showChpswModal=!1})},{footer:Se((function(){return[Object(o["h"])(s,{content:"确认",onClick:c.changePassword},null,8,["onClick"])]})),default:Se((function(){return[Object(o["h"])("form",{ref:"form",class:"form",onSubmit:e[3]||(e[3]=Object(o["t"])((function(){}),["prevent","stop"]))},[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(Object.keys(a.inputItems).sort((function(t,e){return a.inputItems[t].order-a.inputItems[e].order})),(function(t){return Object(o["i"])(),Object(o["d"])("div",{class:["form-control",{success:!0===a.inputItems[t].valid,error:!1===a.inputItems[t].valid}],key:a.inputItems[t].order},[Object(o["h"])("label",{for:t},Object(o["o"])(a.inputItems[t].label_name),9,["for"]),Object(o["s"])(Object(o["h"])("input",{type:a.inputItems[t].type,name:t,"onUpdate:modelValue":function(e){return a.inputItems[t].value=e},autocomplete:"password"===t?"new-password":"off"},null,8,["type","name","onUpdate:modelValue","autocomplete"]),[[o["p"],a.inputItems[t].value]]),!0===a.inputItems[t].valid?(Object(o["i"])(),Object(o["d"])("span",Fe,"✔️")):Object(o["e"])("",!0),!1===a.inputItems[t].valid?(Object(o["i"])(),Object(o["d"])("span",De,"❌")):Object(o["e"])("",!0),!1===a.inputItems[t].valid?(Object(o["i"])(),Object(o["d"])("small",Ee,Object(o["o"])(a.inputItems[t].err),1)):Object(o["e"])("",!0)],2)})),128))],544)]})),_:1},8,["show-modal"])):Object(o["e"])("",!0)]))],64)})),Le={name:"Userprofile",props:{show:Boolean},components:{Modal:vt,MaterialButton:R},data:function(){return{user:{uid:-1,name:"",email:"",count:"",class:""},title:"Loading",showChpswModal:!1,inputItems:{password0:{order:1,label_name:"原密码",type:"password",value:"",err:""},password:{order:2,label_name:"新密码",type:"password",value:"",err:""},password1:{order:3,label_name:"确认密码",type:"password",value:"",err:""}}}},created:function(){this.fetchData()},watch:{show:function(t){!0===t?this.fetchData():this.title="Loading"}},methods:{fetchData:function(){var t=this;fetch("/api/user",{method:"GET"}).then((function(t){return t.json()})).then((function(e){e.ok&&(t.user=e.data,t.title="".concat(e.data.name," 详细信息"))})).catch((function(t){return console.log(t)}))},changePassword:function(){var t=this,e=this.inputItems.password0,n=this.inputItems.password,o=this.inputItems.password1,r=!0;if(e.value.length<=0?(e.valid=!1,e.err="请输入原密码",r=!1):(e.valid=!0,e.err=""),n.value.length<8?(n.valid=!1,n.err="密码至少8位",r=!1):(n.valid=!0,n.err=""),o.value!==n.value?(o.valid=!1,o.err="密码不匹配",r=!1):(o.valid=!0,o.err=""),r){var a=new FormData(this.$refs.form);fetch("/user/chpsw",{method:"POST",body:a}).then((function(t){return t.json()})).then((function(e){if(console.log(e),e.ok)t.showChpswModal=!1;else if(e.err){var n,o=Object(ne["a"])(e.err);try{for(o.s();!(n=o.n()).done;){var r=n.value;t.inputItems[r.param].valid=!1,t.inputItems[r.param].err=r.msg}}catch(a){o.e(a)}finally{o.f()}}else console.log(e)})).catch((function(t){console.log(t)}))}}}};n("8ea4");Le.render=Ue,Le.__scopeId="data-v-0edb6234";var ze=Le,Re=Object(o["u"])("data-v-6ab8f606");Object(o["k"])("data-v-6ab8f606");var Ge={class:"table-container"},Ve=Object(o["h"])("th",null,"#",-1),Je=Object(o["h"])("th",null,null,-1);Object(o["j"])();var Xe=Re((function(t,e,n,r,a,c){var s=Object(o["n"])("modal");return Object(o["i"])(),Object(o["d"])(s,{"show-modal":n.show,class:"auto",title:a.title},{default:Re((function(){return[Object(o["h"])("div",Ge,[Object(o["h"])("table",null,[Object(o["h"])("thead",null,[Object(o["h"])("tr",null,[Ve,Object(o["h"])("th",{onClick:e[1]||(e[1]=function(t){return c.sortTable("title")})},"书名"),Object(o["h"])("th",{onClick:e[2]||(e[2]=function(t){return c.sortTable("stime")})},"借书时间"),Object(o["h"])("th",{onClick:e[3]||(e[3]=function(t){return c.sortTable("ddl")})},"应还时间"),Object(o["h"])("th",{onClick:e[4]||(e[4]=function(t){return c.sortTable("status")})},"状态"),Je])]),Object(o["h"])("tbody",null,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(a.rows,(function(t,e){return Object(o["i"])(),Object(o["d"])("tr",{key:e},[Object(o["h"])("td",null,Object(o["o"])(e),1),Object(o["h"])("td",null,Object(o["o"])(t.title),1),Object(o["h"])("td",null,Object(o["o"])(t.stime),1),Object(o["h"])("td",null,Object(o["o"])(t.ddl),1),Object(o["h"])("td",null,[Object(o["h"])("span",{class:["status",t.status]},Object(o["o"])(t.status),3)]),Object(o["h"])("td",null,["returned"!==t.status&&"pending_return"!==t.status?(Object(o["i"])(),Object(o["d"])("button",{key:0,class:"button",onClick:function(e){return c.returnBook(t.brid)}}," 还书 ",8,["onClick"])):Object(o["e"])("",!0)])])})),128))])])])]})),_:1},8,["show-modal","title"])})),Ye={name:"BorrowTable",props:{show:Boolean},components:{Modal:vt},data:function(){return{rows:[],title:"Loading",ascending:!1,sortColumn:""}},watch:{show:function(t){!0===t?this.fetchData():this.title="Loading"}},created:function(){this.fetchData()},methods:{fetchData:function(){var t=this;fetch("/api/borrow/list",{method:"GET"}).then((function(t){return t.json()})).then((function(e){e.ok&&(t.rows=e.data,t.title="".concat(t.$root.user.name," 借阅信息"))})).catch((function(t){return console.log(t)}))},sortTable:function(t){this.sortColumn===t?this.ascending=!this.ascending:(this.ascending=!0,this.sortColumn=t);var e=this.ascending;this.rows.sort((function(n,o){return n[t]>o[t]?e?1:-1:n[t]<o[t]?e?-1:1:0}))},returnBook:function(t){var e=this;fetch("/api/return/".concat(t),{method:"POST"}).then((function(t){return t.json()})).then((function(n){n.ok&&(n.data.brid?e.rows.filter((function(e){return e.brid===t}))[0].status="pending_return":e.rows=e.rows.filter((function(e){return e.brid!==t})))})).catch((function(t){return console.log(t)}))}}};n("71b1");Ye.render=Xe,Ye.__scopeId="data-v-6ab8f606";var qe=Ye,Ke=Object(o["u"])("data-v-5e883b87");Object(o["k"])("data-v-5e883b87");var He={class:"table-container"},Ze=Object(o["h"])("th",null,"#",-1),We=Object(o["h"])("th",null,null,-1);Object(o["j"])();var Qe=Ke((function(t,e,n,r,a,c){var s=Object(o["n"])("modal");return Object(o["i"])(),Object(o["d"])(s,{"show-modal":n.show,class:"auto",title:a.title},{default:Ke((function(){return[Object(o["h"])("div",He,[Object(o["h"])("table",null,[Object(o["h"])("thead",null,[Object(o["h"])("tr",null,[Ze,Object(o["h"])("th",{onClick:e[1]||(e[1]=function(t){return c.sortTable("username")})},"用户名"),Object(o["h"])("th",{onClick:e[2]||(e[2]=function(t){return c.sortTable("title")})},"书名"),Object(o["h"])("th",{onClick:e[3]||(e[3]=function(t){return c.sortTable("stime")})},"借书时间"),Object(o["h"])("th",{onClick:e[4]||(e[4]=function(t){return c.sortTable("ddl")})},"应还时间"),Object(o["h"])("th",{onClick:e[5]||(e[5]=function(t){return c.sortTable("status")})},"状态"),We])]),Object(o["h"])("tbody",null,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(a.rows,(function(t,e){return Object(o["i"])(),Object(o["d"])("tr",{key:e},[Object(o["h"])("td",null,Object(o["o"])(e),1),Object(o["h"])("td",null,Object(o["o"])(t.username),1),Object(o["h"])("td",null,Object(o["o"])(t.title),1),Object(o["h"])("td",null,Object(o["o"])(t.stime),1),Object(o["h"])("td",null,Object(o["o"])(t.ddl),1),Object(o["h"])("td",null,[Object(o["h"])("span",{class:["status",t.status]},Object(o["o"])(t.status),3)]),Object(o["h"])("td",null,[Object(o["h"])("button",{class:"button",onClick:function(e){return c.acceptRequest(t.brid)}}," 同意 ",8,["onClick"]),Object(o["h"])("button",{class:"button",onClick:function(e){return c.rejectRequest(t.brid)}}," 拒绝 ",8,["onClick"])])])})),128))])])])]})),_:1},8,["show-modal","title"])})),tn={name:"PendingTable",props:{show:Boolean},components:{Modal:vt},data:function(){return{rows:[],title:"Loading",ascending:!1,sortColumn:""}},created:function(){this.fetchData()},watch:{show:function(t){!0===t?this.fetchData():this.title="Loading"}},methods:{fetchData:function(){var t=this;fetch("/api/borrow/pending/",{method:"GET"}).then((function(t){return t.json()})).then((function(e){e.ok&&(t.rows=e.data,t.title="待审核")})).catch((function(t){return console.log(t)}))},sortTable:function(t){this.sortColumn===t?this.ascending=!this.ascending:(this.ascending=!0,this.sortColumn=t);var e=this.ascending;this.rows.sort((function(n,o){return n[t]>o[t]?e?1:-1:n[t]<o[t]?e?-1:1:0}))},acceptRequest:function(t){var e=this;fetch("/api/borrow/accept/".concat(t),{method:"POST"}).then((function(t){return t.json()})).then((function(n){n.ok&&(e.rows=e.rows.filter((function(e){return e.brid!==t})))})).catch((function(t){return console.log(t)}))},rejectRequest:function(t){var e=this;fetch("/api/borrow/reject/".concat(t),{method:"POST"}).then((function(t){return t.json()})).then((function(n){n.ok&&(e.rows=e.rows.filter((function(e){return e.brid!==t})))})).catch((function(t){return console.log(t)}))}}};n("7c41");tn.render=Qe,tn.__scopeId="data-v-5e883b87";var en=tn,nn=Object(o["u"])("data-v-42a0356f");Object(o["k"])("data-v-42a0356f");var on={class:"table-container"},rn={key:1};Object(o["j"])();var an=nn((function(t,e,n,r,a,c){var s=Object(o["n"])("modal");return Object(o["i"])(),Object(o["d"])(s,{"show-modal":n.show,class:"auto",title:a.title},{default:nn((function(){return[Object(o["h"])("div",on,[Object(o["h"])("table",null,[Object(o["h"])("thead",null,[Object(o["h"])("tr",null,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(c.columns,(function(t,e){return Object(o["i"])(),Object(o["d"])("th",{key:e,onClick:function(e){return c.sortBy(t)},class:{active:a.sortKey==t}},[Object(o["g"])(Object(o["o"])(t)+" ",1),Object(o["h"])("span",{class:["arrow",a.sortOrders[t]>0?"asc":"dsc"]},null,2)],10,["onClick"])})),128))])]),Object(o["h"])("tbody",null,[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(c.filteredRows,(function(t,e){return Object(o["i"])(),Object(o["d"])("tr",{key:e},[(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(c.columns,(function(e,n){return Object(o["i"])(),Object(o["d"])("td",{key:n},["class"===e?(Object(o["i"])(),Object(o["d"])("span",{key:0,class:["class",t[e]],onClick:function(e){return c.setClass(t.uid)}},Object(o["o"])(t[e]),11,["onClick"])):(Object(o["i"])(),Object(o["d"])("span",rn,Object(o["o"])(t[e]),1))])})),128))])})),128))])])])]})),_:1},8,["show-modal","title"])})),cn=(n("4160"),n("c975"),n("fb6a"),n("45fc"),n("159b"),{name:"UserTable",components:{Modal:vt},props:{show:Boolean},data:function(){return{rows:[],title:"Loading",sortKey:"uid",filterKey:"",sortOrders:{}}},computed:{columns:function(){return Object.keys(this.rows[0]||{})},filteredRows:function(){var t=this.sortKey,e=this.filterKey.trim(),n=this.sortOrders[t]||1,o=this.rows;return e.length>0&&(o=o.filter((function(t){return Object.keys(t).some((function(n){return String(t[n]).toLowerCase().indexOf(e)>-1}))}))),t&&(o=o.slice().sort((function(e,o){return e=e[t],o=o[t],(e===o?0:e>o?1:-1)*n}))),o}},watch:{show:function(t){!0===t?this.fetchData():this.title="Loading"}},created:function(){this.fetchData()},methods:{fetchData:function(){var t=this;fetch("/api/user/list",{method:"GET"}).then((function(t){return t.json()})).then((function(e){e.ok&&(t.rows=e.data,t.title="用户",t.columns.forEach((function(e){return t.sortOrders[e]=1})))})).catch((function(t){return console.log(t)}))},sortBy:function(t){this.sortKey=t,this.sortOrders[t]=-1*this.sortOrders[t]},setClass:function(t){var e=this,n=prompt("账号类型 in ('admin', 'user', 'guest')");fetch("/api/user/setclass/".concat(t,"/").concat(n),{method:"POST"}).then((function(t){return t.json()})).then((function(n){n.ok&&(e.rows.filter((function(e){return e.uid===t}))[0].class=n.data.class)})).catch((function(t){return alert("ERR: "+JSON.stringify(t))}))}}});n("cfbf");cn.render=an,cn.__scopeId="data-v-42a0356f";var sn=cn,ln={name:"TopNavBar",components:{Modal:vt,MaterialButton:R,ModalNewBook:Be,Userprofile:ze,BorrowTable:qe,PendingTable:en,UserTable:sn},props:{user:Object},emits:["login","logout"],data:function(){return{showUserprofile:!1,showBorrowTable:!1,showUserTable:!1,showPendingTable:!1,toggle_login_modal:!1,toggle_register_modal:!1,toggle_newbook_modal:!1,navExpand:!1,login_form:{username:{order:1,label_name:"用户名",type:"text",value:"",err:""},password:{order:2,label_name:"密码",type:"password",value:"",err:""}},register_form:{username:{order:1,label_name:"用户名",type:"text",value:"",err:""},email:{order:2,label_name:"邮箱",type:"email",value:"",err:""},password:{order:3,label_name:"密码",type:"password",value:"",err:""},password1:{order:4,label_name:"确认密码",type:"password",value:"",err:""}},submiting:!1}},methods:{login:function(t){var e=this,n=this.login_form.username,o=!0;n.value.trim().length<=0?(n.valid=!1,n.err="用户名为空",o=!1):(n.valid=!0,n.err="");var r=this.login_form.password;if(r.value.length<=0?(r.valid=!1,r.err="密码为空",o=!1):(r.valid=!0,r.err=""),o){var a=new FormData(t.target);this.submiting=!0,fetch("/user/login",{method:"POST",body:a}).then((function(t){return t.json()})).then((function(t){t.ok?(e.$emit("login",t.data),e.toggle_login_modal=!1):(e.login_form[t.err.key].valid=!1,e.login_form[t.err.key].err=t.err.msg),e.submiting=!1})).catch((function(t){console.log(t),e.submiting=!1}))}},register:function(t){var e=this,n=this.register_form.username,o=this.register_form.email,r=this.register_form.password,a=this.register_form.password1,c=!0;if(n.value.trim().length<=0?(n.valid=!1,n.err="用户名为空",c=!1):(n.valid=!0,n.err=""),r.value.length<8?(r.valid=!1,r.err="密码至少8位",c=!1):(r.valid=!0,r.err=""),a.value!==r.value?(a.valid=!1,a.err="密码不匹配",c=!1):(a.valid=!0,a.err=""),/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(o.value)?(o.valid=!0,o.err=""):(o.valid=!1,o.err="邮箱不合法",c=!1),c){var s=new FormData(t.target);this.submiting=!0,fetch("/user/register",{method:"POST",body:s}).then((function(t){return t.json()})).then((function(t){if(t.ok)e.$emit("register",t.data),e.toggle_register_modal=!1;else if(t.err){var n,o=Object(ne["a"])(t.err);try{for(o.s();!(n=o.n()).done;){var r=n.value;e.register_form[r.param].valid=!1,e.register_form[r.param].err=r.msg}}catch(a){o.e(a)}finally{o.f()}}else console.log(t);e.submiting=!1})).catch((function(t){console.log(t),e.submiting=!1}))}},logout:function(t){var e=this;t.target.disabled=!0,fetch("/user/logout",{method:"POST"}).then((function(t){return t.json()})).then((function(n){n.ok&&e.$emit("logout"),t.target.disabled=!1})).catch((function(e){console.log(e),t.target.disabled=!1}))}}};n("c043");ln.render=ee,ln.__scopeId="data-v-151df2b5";var un=ln,dn=Object(o["u"])("data-v-65baf182");Object(o["k"])("data-v-65baf182");var bn={class:"search-input-wrapper"},hn=Object(o["h"])("label",{class:"search-label",for:"stext"},"搜索",-1),fn=Object(o["h"])("span",{class:"spliter"},null,-1),jn=Object(o["h"])("button",{type:"submit",class:"btn-go"},[Object(o["h"])("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",class:"svg-search"},[Object(o["h"])("path",{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})])],-1),mn=Object(o["h"])("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",class:"svg-down-arrow"},[Object(o["h"])("polyline",{points:"6 9 12 15 18 9"})],-1);Object(o["j"])();var On=dn((function(t,e,n,r,a,c){var s=Object(o["n"])("collapse");return Object(o["i"])(),Object(o["d"])("form",{class:"search-form",onSubmit:e[3]||(e[3]=Object(o["t"])((function(e){return t.$emit("submit-search",a.searchText)}),["stop","prevent"]))},[Object(o["h"])("div",bn,[hn,Object(o["s"])(Object(o["h"])("input",{class:"search-input",type:"search",placeholder:"书名/ISBN",name:"stext","onUpdate:modelValue":e[1]||(e[1]=function(t){return a.searchText=t}),autocomplete:"off"},null,512),[[o["q"],a.searchText]]),fn,jn,Object(o["h"])("button",{type:"button",class:["btn-expand",{expand:a.filter_expend}],onClick:e[2]||(e[2]=function(t){return a.filter_expend=!a.filter_expend})},[mn],2),Object(o["h"])(s,{class:"filter-collapse","is-expand":a.filter_expend},{default:dn((function(){return[Object(o["m"])(t.$slots,"default")]})),_:3},8,["is-expand"])])],32)})),pn={name:"Searchbar",components:{Collapse:Ce},data:function(){return{filter_expend:!1,searchText:""}},mounted:function(){}};n("ac78");pn.render=On,pn.__scopeId="data-v-65baf182";var vn=pn,gn=Object(o["u"])("data-v-58f7d3ee");Object(o["k"])("data-v-58f7d3ee");var wn={class:"page"},kn=Object(o["h"])("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[Object(o["h"])("path",{d:"M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"})],-1),_n={key:1,class:"page__dots"},yn={key:2,class:"page__dots"},xn=Object(o["h"])("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[Object(o["h"])("path",{d:"M7.33 24l-2.83-2.829 9.339-9.175-9.339-9.167 2.83-2.829 12.17 11.996z"})],-1);Object(o["j"])();var Cn=gn((function(t,e,n,r,a,c){return Object(o["i"])(),Object(o["d"])("ul",wn,[Object(o["h"])("li",{class:["page__btn",{active:1!=a.currentPage}],onClick:e[1]||(e[1]=function(t){return a.currentPage--})},[kn],2),a.currentPage>3&&n.total>7?(Object(o["i"])(),Object(o["d"])("li",{key:0,class:"page__numbers",onClick:e[2]||(e[2]=function(t){return a.currentPage=1})}," 1 ")):Object(o["e"])("",!0),n.total>7&&a.currentPage>3?(Object(o["i"])(),Object(o["d"])("li",_n,"...")):Object(o["e"])("",!0),(Object(o["i"])(!0),Object(o["d"])(o["a"],null,Object(o["l"])(c.displayedPages,(function(t,e){return Object(o["i"])(),Object(o["d"])("li",{class:["page__numbers",{active:a.currentPage===t}],key:e,onClick:function(e){return a.currentPage=t}},Object(o["o"])(t),11,["onClick"])})),128)),a.currentPage<n.total-2&&n.total>7?(Object(o["i"])(),Object(o["d"])("li",yn," ... ")):Object(o["e"])("",!0),a.currentPage<n.total-2&&n.total>7?(Object(o["i"])(),Object(o["d"])("li",{key:3,class:"page__numbers",onClick:e[3]||(e[3]=function(t){return a.currentPage=n.total})},Object(o["o"])(n.total),1)):Object(o["e"])("",!0),Object(o["h"])("li",{class:["page__btn",{active:a.currentPage<n.total}],onClick:e[4]||(e[4]=function(t){return a.currentPage++})},[xn],2)])})),Tn=(n("a630"),{name:"Pagination",props:{total:Number},data:function(){return{currentPage:1}},methods:{},computed:{displayedPages:function(){var t=this;return this.total<=7?Array.from({length:this.total},(function(t,e){return e+1})):this.currentPage<=3?Array.from({length:5},(function(t,e){return e+1})):this.currentPage<this.total-2?Array.from({length:3},(function(e,n){return t.currentPage+n-1})):Array.from({length:5},(function(e,n){return t.total-4+n}))}},watch:{currentPage:function(){this.$emit("page-updated",this.currentPage)}}});n("0f3a");Tn.render=Cn,Tn.__scopeId="data-v-58f7d3ee";var Bn=Tn,Sn={name:"App",components:{BookItem:Rt,TopBar:un,SearchBar:vn,TagTool:wt,AuthorTool:Lt,Pagination:Bn},data:function(){return{fallback:"loading",user:{class:"guest"},books:[],tags:[{tid:1,name:"我列开来1",bcount:233}],authors:[],totalPages:1,currentPage:1,searchText:"",filter_expanded:!1,listview:!1}},created:function(){this.checkLogin(),this.fetchData()},methods:{fetchData:function(){var t=this;this.fallback="Loading",fetch("/api/book/list",{method:"GET"}).then((function(t){return t.json()})).then((function(e){e.ok?(t.books=e.data.books,t.totalPages=e.data.count,t.fallback=""):(alert("failed"),console.log(e))})).catch((function(e){console.log(e),t.fallback=JSON.stringify(e)})),fetch("/api/tag/list",{method:"GET"}).then((function(t){return t.json()})).then((function(e){e.ok?t.tags=e.data:(alert("failed"),console.log(e))})).catch((function(t){return console.log(t)}))},checkLogin:function(){var t=this;fetch("/user/login",{method:"POST"}).then((function(t){return t.json()})).then((function(e){e.ok&&(t.user=e.data)})).catch((function(t){return console.log(t)}))},search:function(t){var e=this;this.searchText=t;var n=new URL("/api/book/list",window.location.origin),o={authors:JSON.stringify(this.authors.map((function(t){return t.aid}))),tags:JSON.stringify(this.tags.filter((function(t){return t.active})).map((function(t){return t.tid}))),s_text:t,pno:this.currentPage};n.search=new URLSearchParams(o),this.fallback="Loading",fetch(n,{method:"GET"}).then((function(t){return t.json()})).then((function(t){t.ok?(e.books=t.data.books,e.totalPages=parseInt(t.data.count),console.log(e.totalPages),e.fallback=""):(alert("failed"),console.log(t))})).catch((function(t){console.log(t),e.fallback=JSON.stringify(t)}))}},watch:{currentPage:function(){this.search()}}};n("9cdc"),n("dec8");Sn.render=f,Sn.__scopeId="data-v-848b5cde";var In=Sn;Object(o["c"])(In).mount("#app")},"5eaa":function(t,e,n){},"71b1":function(t,e,n){"use strict";n("e61d")},"73cc":function(t,e,n){},7474:function(t,e,n){},"7c41":function(t,e,n){"use strict";n("41eb")},"7d7a":function(t,e,n){},8477:function(t,e,n){"use strict";n("1363")},"891d":function(t,e,n){},"89a2":function(t,e,n){},"8d6d":function(t,e,n){},"8ea4":function(t,e,n){"use strict";n("e952")},9202:function(t,e,n){},"9cdc":function(t,e,n){"use strict";n("c701")},ac78:function(t,e,n){"use strict";n("1870")},b3e9:function(t,e,n){"use strict";n("4f0e")},b98e:function(t,e,n){"use strict";n("4eb5")},bc0f:function(t,e,n){},c043:function(t,e,n){"use strict";n("7474")},c701:function(t,e,n){},cfbf:function(t,e,n){"use strict";n("89a2")},d3c3:function(t,e,n){"use strict";n("8d6d")},dec8:function(t,e,n){"use strict";n("41c7")},e2a2:function(t,e,n){"use strict";n("891d")},e61d:function(t,e,n){},e952:function(t,e,n){}});
  //# sourceMappingURL=app.30b0477f.js.map