(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[720],{69277:function(e,l,i){Promise.resolve().then(i.bind(i,24814))},24814:function(e,l,i){"use strict";i.r(l);var n=i(57437),o=i(2265),t=i(32081),d=i(43402),u=i(16869),r=i(86854),s=i(66310),c=i(33068),a=i(24033),p=i(30713),v=i(65746);l.default=()=>{var e;let{Paragraph:l}=t.Typography,i=(0,a.useSearchParams)(),{trigger:_}=(0,c.Z)("/v1/upload/streamers",u.wG),{data:m,error:h,isLoading:y,mutate:g}=(0,p.ZP)(()=>i.get("id")?"/v1/upload/streamers/".concat(i.get("id")):null,u._i),f=(0,a.useRouter)(),{typeTree:x,isError:b}=(0,v.JB)(),j=(0,o.useRef)(),[w,k]=(0,o.useState)("inset");if((0,o.useEffect)(()=>{let e=(0,s.ql)(s.f.lg,{match:()=>{k("left")},unmatch:()=>{k("top")}});return()=>e()},[]),h||b)return(0,n.jsx)("div",{children:null==h?void 0:h.message});if(y)return(0,n.jsx)("div",{children:"Loading..."});if(!m||!x)return null;let E={...m,tid:[null===(e=x.find(e=>e.children.some(e=>e.id===(null==m?void 0:m.tid))))||void 0===e?void 0:e.value,m.tid],sound:(1===m.dolby?["dolby"]:[]).concat(1===m.hires?["hires"]:[]),interaction:(1===m.up_close_danmu?["up_close_danmu"]:[]).concat(1===m.up_close_reply?["up_close_reply"]:[]).concat(1===m.up_selection_reply?["up_selection_reply"]:[]),open_elec:1===m.open_elec,no_reprint:1===m.no_reprint,isDtime:!!m.dtime};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{display:"flex",flexDirection:"row-reverse",paddingRight:12},children:(0,n.jsx)(t.zx,{onClick:async()=>{var e,i,o,d,u,r,s,c,a;let p=await (null===(e=j.current)||void 0===e?void 0:e.validate());try{let e={template_name:null==p?void 0:p.template_name,user_cookie:null==p?void 0:p.user_cookie,copyright:null==p?void 0:p.copyright,id:null==p?void 0:p.id,source:null!==(i=null==p?void 0:p.source)&&void 0!==i?i:"",tid:null==p?void 0:p.tid[1],cover_path:null!==(o=null==p?void 0:p.cover_path)&&void 0!==o?o:"",title:null!==(d=null==p?void 0:p.title)&&void 0!==d?d:"",description:null!==(u=null==p?void 0:p.description)&&void 0!==u?u:"",dynamic:null!==(r=null==p?void 0:p.dynamic)&&void 0!==r?r:"",tags:null!==(s=null==p?void 0:p.tags)&&void 0!==s?s:[],dolby:(null==p?void 0:p.sound.includes("dolby"))?1:0,hires:(null==p?void 0:p.sound.includes("hires"))?1:0,up_selection_reply:(null==p?void 0:p.interaction.includes("up_selection_reply"))?1:0,up_close_reply:(null==p?void 0:p.interaction.includes("up_close_reply"))?1:0,up_close_danmu:(null==p?void 0:p.interaction.includes("up_close_danmu"))?1:0,open_elec:(null==p?void 0:p.open_elec)?1:0,no_reprint:(null==p?void 0:p.no_reprint)?1:0,mission_id:null==p?void 0:p.mission_id,dtime:(null==p?void 0:p.isDtime)?null==p?void 0:p.dtime:null,credits:null!==(c=null==p?void 0:p.credits)&&void 0!==c?c:null,uploader:null!==(a=null==p?void 0:p.uploader)&&void 0!==a?a:null},l=await _(e);await g(l),t.FN.success("更新成功"),f.push("/upload-manager")}catch(e){t.P_.error({title:"创建失败",content:(0,n.jsx)(l,{style:{maxWidth:450},children:e.message}),style:{width:"min-content"}})}},type:"primary",icon:(0,n.jsx)(d.Z,{size:"large"}),theme:"solid",style:{marginTop:12,marginRight:4},children:"保存模板"})}),(0,n.jsx)(t.Form,{initValues:E,style:{paddingLeft:30,paddingBottom:40},getFormApi:e=>j.current=e,autoScrollToError:!0,component:r.Z,labelWidth:"180px",labelPosition:w})]})}}},function(e){e.O(0,[835,713,151,971,472,744],function(){return e(e.s=69277)}),_N_E=e.O()}]);