;(function(){function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._item_1i1ve_1{background-color:var(--music-list-item-background-color);margin:.26667rem .37333rem;padding:.26667rem;padding-bottom:0;border-radius:.24rem}._item_1i1ve_1 ._header_1i1ve_8{display:flex;align-items:center;border-bottom:.02667rem solid var(--music-list-item-border-color);padding-bottom:.32rem}._item_1i1ve_1 ._header_1i1ve_8 ._mate_1i1ve_14{display:flex;flex:1;align-items:center}._item_1i1ve_1 ._header_1i1ve_8 ._mate_1i1ve_14 ._icon_1i1ve_19{width:1.06667rem;height:1.06667rem}._item_1i1ve_1 ._header_1i1ve_8 ._mate_1i1ve_14 ._info_1i1ve_23{margin-left:.37333rem;flex:1;margin-right:.37333rem;word-break:break-all}._item_1i1ve_1 ._header_1i1ve_8 ._mate_1i1ve_14 ._info_1i1ve_23>h4{color:var(--music-list-item-title-color);font-size:.37333rem;font-weight:600}._item_1i1ve_1 ._header_1i1ve_8 ._mate_1i1ve_14 ._info_1i1ve_23>p{color:var(--music-list-item-mate-color);line-height:.45333rem}._item_1i1ve_1 ._header_1i1ve_8 ._btn_1i1ve_38{width:1.44rem;height:.58667rem;font-size:.32rem;border-radius:.29333rem;padding:0;border:none}._item_1i1ve_1 ._header_1i1ve_8 ._btn_1i1ve_38._vip_1i1ve_46{background-color:var(--music-list-item-vip-bg);color:var(--music-list-item-vip-color)}._item_1i1ve_1 ._header_1i1ve_8 ._btn_1i1ve_38._free_1i1ve_50{background-color:var(--music-list-item-free-bg);color:var(--music-list-item-free-color)}._item_1i1ve_1 ._header_1i1ve_8 ._btn_1i1ve_38._charge_1i1ve_54{background-color:var(--music-list-item-charge-bg);color:var(--music-list-item-charge-color)}._item_1i1ve_1 ._footer_1i1ve_58{display:flex;align-items:center;justify-content:space-between}._item_1i1ve_1 ._footer_1i1ve_58 ._user_1i1ve_63{display:flex;align-items:center;padding:0 .26667rem;margin-right:.13333rem}._item_1i1ve_1 ._footer_1i1ve_58 ._user_1i1ve_63 ._userIcon_1i1ve_69{width:.53333rem;height:.53333rem;margin-right:.21333rem}._item_1i1ve_1 ._footer_1i1ve_58 ._user_1i1ve_63>p{margin-right:.21333rem}._item_1i1ve_1 ._footer_1i1ve_58 ._favorite_1i1ve_77{font-size:.42667rem}._item_1i1ve_1 ._footer_1i1ve_58 ._tags_1i1ve_80{display:flex;align-items:center;--van-tag-default-color: #fff1de;--van-tag-text-color: #ff8c00}\n";document.head.appendChild(__vite_style__);System.register(['./vendor-legacy.031e1374.js','./index-legacy.f25f109a4.js','./index-legacy.f25f109a10.js','./index-legacy.6e10cd37.js','./init-user-icon-legacy.6fbc494f.js','./favorite-legacy.403f54ea.js','./index-legacy.1cd7b6bb.js'],function(exports){'use strict';var defineComponent,ref,createVNode,Image,Button,Icon,Tag,isVNode,classNames,MusicIcon,InitUserIcon,FavoriteIcon,request;return{setters:[function(module){defineComponent=module.d;ref=module.V;createVNode=module.a;Image=module.I;Button=module.B;Icon=module.u;Tag=module.z;isVNode=module.x;},function(){},function(){},function(module){classNames=module.c;},function(module){MusicIcon=module.M;InitUserIcon=module.I;},function(module){FavoriteIcon=module.F;},function(module){request=module.r;}],execute:function execute(){var FavoritedIcon=exports('F',"./assets/favorited.3ea1df17.svg");var item="_item_1i1ve_1";var header="_header_1i1ve_8";var mate="_mate_1i1ve_14";var icon="_icon_1i1ve_19";var info="_info_1i1ve_23";var btn="_btn_1i1ve_38";var vip="_vip_1i1ve_46";var free="_free_1i1ve_50";var charge="_charge_1i1ve_54";var footer="_footer_1i1ve_58";var user="_user_1i1ve_63";var userIcon="_userIcon_1i1ve_69";var favorite="_favorite_1i1ve_77";var tags="_tags_1i1ve_80";var styles={item:item,header:header,mate:mate,icon:icon,info:info,btn:btn,vip:vip,free:free,charge:charge,footer:footer,user:user,userIcon:userIcon,favorite:favorite,tags:tags};function _isSlot(s){return typeof s==='function'||Object.prototype.toString.call(s)==='[object Object]'&&!isVNode(s);}var chargeTypes={CHARGE:'点播',FREE:'免费',VIP:'VIP'};var Item=exports('I',defineComponent({name:'MusicItem',props:{data:{type:Object,default:{}},onClick:{type:Function}},emits:['favorite'],setup:function setup(_ref,_ref2){var _onClick=_ref.onClick,data=_ref.data;var emit=_ref2.emit;// const data = props.data
// console.log(props, emit)
var favorite=ref(data.favorite);var favoriteLoading=ref(false);var toggleFavorite=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(evt){return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:evt.stopPropagation();favoriteLoading.value=true;_context.prev=2;_context.next=5;return request.post('/api-student/music/sheet/favorite/'+data.id);case 5:favorite.value=!favorite.value;_context.next=10;break;case 8:_context.prev=8;_context.t0=_context["catch"](2);case 10:favoriteLoading.value=false;emit('favorite');case 12:case"end":return _context.stop();}}},_callee,null,[[2,8]]);}));return function toggleFavorite(_x){return _ref3.apply(this,arguments);};}();return function(){return createVNode("div",{"class":styles.item,"onClick":function onClick(){_onClick===null||_onClick===void 0?void 0:_onClick(data);}},[createVNode("header",{"class":styles.header},[createVNode("div",{"class":styles.mate},[createVNode(Image,{"src":MusicIcon,"round":true,"class":styles.icon},null),createVNode("div",{"class":styles.info},[createVNode("h4",{"class":"van-multi-ellipsis--l2"},[data.musicSheetName]),createVNode("p",null,[data.composer])])]),createVNode("div",{"class":styles.buttons},[createVNode(Button,{"class":classNames(styles.btn,styles[data.chargeType.toLocaleLowerCase()])},{default:function _default(){return[chargeTypes[data.chargeType],createVNode(Icon,{"name":"arrow"},null)];}})])]),createVNode("footer",{"class":styles.footer},[createVNode("div",{"class":styles.user},[createVNode(Image,{"round":true,"src":data.addUserAvatar||InitUserIcon,"class":styles.userIcon},null),createVNode("p",null,[data.addName]),createVNode("div",{"class":styles.tags},[(data.subjectNames||'').split(',').map(function(item){return createVNode(Tag,null,_isSlot(item)?item:{default:function _default(){return[item];}});})])]),createVNode("div",{"class":styles.icons},[createVNode(Button,{"style":{border:'none'},"onClick":toggleFavorite,"loading":favoriteLoading.value},{default:function _default(){return[createVNode(Icon,{"class":styles.favorite,"name":favorite.value?FavoritedIcon:FavoriteIcon},null)];}})])])]);};}}));}};});})();
