PageSourceSearch

https://utaitedb.net/assets/SongCreate-C1AJjRmO.js

js utaitedb.net collected 2026-09-24 18:56:02 UTC 12,543 bytes, 1 lines download raw bytes

1var L=Object.defineProperty;var P=(i,s,t)=>s in i?L(i,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[s]=t;var r=(i,s,t)=>P(i,typeof s!="symbol"?s+"":s,t);import{R as E,ae as O,a as n,j as e,m as D,b9 as x,l as _,as as T,E as j,b8 as S,d as U,i as m,a6 as B,o as g,f as y,k,D as I,t as H,bh as F,aB as M,bf as z,am as q,s as G,bG as J,b_ as W,F as b,C as V,ao as w,ci as $}from"./index-gMe9H88Y.js";import{A as v,B as K,L as Q}from"./Layout-DlAsL32I.js";import{A as X}from"./ArtistAutoComplete-Ep57U86W.js";import{M as Y}from"./Markdown-C9rHC8pJ.js";import{A}from"./ArtistLink-ctkVIaf-.js";import{N as Z}from"./NotificationIcon-DJ1nRmu8.js";import{D as C}from"./DuplicateEntriesMessage-B287iR8H.js";import{d as ee}from"./DropdownList-CiILYt3d.js";import{S as ie}from"./SongLockingAutoComplete-CnwW6Wtz.js";import{E as te}from"./EntryLink-7W9067Uz.js";import{H as se}from"./HelpLabel-DmO0PB3V.js";import{R as N}from"./RequiredField-DISpXC4a.js";import{S as ae}from"./SaveBtn-DZ_aSsjs.js";import{V as ne}from"./ValidationSummaryPanel-B0-SR33a.js";import{a as re}from"./ui-DbMe5zwn.js";import{S as le}from"./SongHelper-l_NuUKuJ.js";import{C as R}from"./ContentLanguageSelection-iqORDso9.js";import{t as oe}from"./EntryToolTip-BigGEChL.js";import{g as pe}from"./utils-functions-Bh68SegF.js";import"./EntryAutoComplete-8EfM9cl2.js";import"./ArtistTypeLabel-CXdTI52A.js";import"./useRegionNames-DhhjBNOm.js";import"./UserKnownLanguageContract-BtVDpNfN.js";import"./EventCategory-Oz7AF5r9.js";import"./SongListFeaturedCategory-C71n0qTw.js";import"./SongAutoComplete-DY253s6y.js";import"./LockingAutoComplete-HYsl-YYA.js";import"./QTipToolTip-BpO7xCMj.js";import"./useWillUnmount-DtH49aY0.js";import"./useEventCallback-Bh-wTfTs.js";import"./UrlHelper-BVd1y15x.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};i.__faroBundleId_vocadb_frontend="1774128384054d7495f5124"}catch{}})();const ce=E.memo(({coverArtists:i})=>{const{t:s}=O(["ViewRes"]);return n(v,{children:[e(Z,{})," ",s("ViewRes:EntryCreate.FoundCoverArtist"),e("ul",{children:i.map((t,c)=>n("li",{children:[e(A,{artist:t}),t.additionalNames&&e("div",{children:e("span",{children:t.additionalNames})})]},c))})]})});var he=Object.defineProperty,de=Object.getOwnPropertyDescriptor,o=(i,s,t,c)=>{for(var d=c>1?void 0:c?de(s,t):s,h=i.length-1,u;h>=0;h--)(u=i[h])&&(d=(c?u(s,t,d):u(d))||d);return c&&d&&he(s,t,d),d};class l{constructor(s,t,c,d,h){r(this,"artists",[]);r(this,"draft",!1);r(this,"dupeEntries",[]);r(this,"errors");r(this,"nameOriginal","");r(this,"nameRomaji","");r(this,"nameEnglish","");r(this,"originalVersion");r(this,"pv1","");r(this,"pv2","");r(this,"songType",T.Original);r(this,"songTypeTag");r(this,"submitting",!1);r(this,"getSongTypeTag",async s=>{const t=await this.tagRepo.getEntryTypeTag({entryType:U.Song,subType:s,lang:this.values.languagePreference});m(()=>{this.songTypeTag=t})});r(this,"getArtistIds",()=>this.artists.map(s=>s.id));r(this,"_checkDuplicates",async(s=!1)=>{const t=this.nameOriginal,c=this.nameRomaji,d=this.nameEnglish,h=this.pv1,u=this.pv2,a=this.getArtistIds(),p=await this.songRepo.findDuplicate({params:{term:[t,c,d],pv:[h,u],artistIds:a,getPVInfo:s}});m(()=>{if(this.dupeEntries=p.matches,p.title&&!this.hasName&&(p.titleLanguage==="English"?this.nameEnglish=p.title:this.nameOriginal=p.title),p.songType&&p.songType!=="Unspecified"&&this.songType===T.Original&&(this.songType=p.songType),p.artists&&this.artists.length===0)for(const f of p.artists)this.artists.push(f)})});r(this,"checkDuplicates",()=>this._checkDuplicates(!1));r(this,"checkDuplicatesAndPV",()=>this._checkDuplicates(!0));r(this,"addArtist",async s=>{if(!s)return;const t=await this.artistRepo.getOne({id:s,lang:this.values.languagePreference});m(()=>{this.artists.push(t)}),await this.checkDuplicates()});r(this,"removeArtist",s=>{B(this.artists,s)});r(this,"selectOriginal",async s=>{const t=await this.songRepo.getOne({id:s.entry.id,lang:this.values.languagePreference});m(()=>{this.originalVersion.id=t.id})});r(this,"submit",async s=>{this.submitting=!0;try{return await this.songRepo.create(s,{artists:this.artists.map(c=>({artist:c})),draft:this.draft,names:[].concat(this.nameOriginal?{language:R.Japanese,value:this.nameOriginal}:[],this.nameRomaji?{language:R.Romaji,value:this.nameRomaji}:[],this.nameEnglish?{language:R.English,value:this.nameEnglish}:[]),originalVersion:this.originalVersion.entry,pvUrls:[this.pv1],reprintPVUrl:this.pv2,songType:this.songType})}catch(t){throw t.response&&m(()=>{this.errors=void 0,t.response.status===400&&(this.errors=t.response.data.errors)}),t}finally{m(()=>{this.submitting=!1})}});this.values=s,this.songRepo=t,this.artistRepo=c,this.tagRepo=d,D(this),this.originalVersion=new x(u=>t.getOne({id:u,lang:s.languagePreference}
1)),h&&(this.nameOriginal=h.nameOriginal||"",this.nameRomaji=h.nameRomaji||"",this.nameEnglish=h.nameEnglish||"",this.pv1=h.pvUrl||"",this.pv2=h.reprintPVUrl||"",this.artists=h.artists||[]),this.pv1&&this.checkDuplicatesAndPV(),_(()=>this.songType,this.getSongTypeTag),this.getSongTypeTag(this.songType)}get canHaveOriginalVersion(){return this.songType!==T.Original}get hasName(){return this.nameOriginal.length>0||this.nameRomaji.length>0||this.nameEnglish.length>0}get isDuplicatePV(){return this.dupeEntries.some(s=>s.matchProperty==="PV")}get originalSongSuggestions(){return!this.dupeEntries||this.dupeEntries.length===0?[]:this.dupeEntries.take(3)}get songTypeName(){var s;return(s=this.songTypeTag)==null?void 0:s.name}get songTypeInfo(){var s;return(s=this.songTypeTag)==null?void 0:s.description}get songTypeTagUrl(){return j.details_tag_contract(this.songTypeTag)}get coverArtists(){return this.artists.filter(s=>s.artistType===S.CoverArtist)}}o([g],l.prototype,"artists",2);o([g],l.prototype,"draft",2);o([g],l.prototype,"dupeEntries",2);o([g],l.prototype,"errors",2);o([g],l.prototype,"nameOriginal",2);o([g],l.prototype,"nameRomaji",2);o([g],l.prototype,"nameEnglish",2);o([g],l.prototype,"pv1",2);o([g],l.prototype,"pv2",2);o([g],l.prototype,"songType",2);o([g],l.prototype,"songTypeTag",2);o([g],l.prototype,"submitting",2);o([y],l.prototype,"canHaveOriginalVersion",1);o([y],l.prototype,"hasName",1);o([y],l.prototype,"isDuplicatePV",1);o([y],l.prototype,"originalSongSuggestions",1);o([y],l.prototype,"songTypeName",1);o([y],l.prototype,"songTypeInfo",1);o([y],l.prototype,"songTypeTagUrl",1);o([y],l.prototype,"coverArtists",1);o([k],l.prototype,"removeArtist",2);o([k],l.prototype,"submit",2);const me=q(({songCreateStore:i})=>{const s=G(),{t,ready:c}=O(["ViewRes","ViewRes.Song"]),{t:d}=J(),h=t("ViewRes.Song:Create.SubmitSong"),u=W();return e(Q,{pageTitle:h,ready:c,title:h,parents:e(b,{children:e(K.Item,{linkAs:w,linkProps:{to:"/Song"},children:t("ViewRes:Shared.Songs")})}),children:n("form",{onSubmit:async a=>{a.preventDefault();try{const p=await $.getToken(),f=await i.submit(p);u(`/Song/Edit/${f}`)}catch(p){throw re(p.response&&p.response.status?pe(p.response.status):t("ViewRes.Song:Create.UnableToCreateSong")),p}},children:[i.errors&&e(ne,{message:t("ViewRes.Song:Create.UnableToCreateSong"),errors:i.errors}),n("div",{className:"row-fluid",children:[n("div",{className:"span5 well well-transparent",children:[i.isDuplicatePV&&e(v,{variant:"danger",children:t("ViewRes.Song:Create.DuplicatePV")}),e("div",{className:"editor-label",children:e("label",{htmlFor:"pvUrl",children:t("ViewRes.Song:Create.OriginalPV")})}),e("div",{className:"editor-field",children:e("input",{type:"text",id:"pvUrl",value:i.pv1,onChange:a=>m(()=>{i.pv1=a.target.value}),onBlur:i.checkDuplicatesAndPV,className:"span8",maxLength:255,size:30})}),s.canViewOtherPVs&&n(b,{children:[e("div",{className:"editor-label",children:e("label",{htmlFor:"reprintPVUrl",children:t("ViewRes.Song:Create.ReprintPV")})}),e("div",{className:"editor-field",children:e("input",{type:"text",id:"reprintPVUrl",value:i.pv2,onChange:a=>m(()=>{i.pv2=a.target.value}),onBlur:i.checkDuplicates,className:"span8",maxLength:255,size:30})})]}),n("div",{className:"editor-label",children:[t("ViewRes:EntryCreate.Name")," ",e(N,{})]}),n("div",{className:"editor-field",children:[i.errors&&i.errors.names&&e("span",{className:"field-validation-error",children:i.errors.names[0]}),e("table",{children:n("tbody",{children:[n("tr",{children:[e("td",{className:"formLabel",children:e("label",{htmlFor:"nameOriginal",children:t("ViewRes:EntryCreate.NonEnglishName")})}),e("td",{children:e("input",{type:"text",id:"nameOriginal",value:i.nameOriginal,onChange:a=>m(()=>{i.nameOriginal=a.target.value}),onBlur:i.checkDuplicates,className:"span12",maxLength:255,size:40})})]}),n("tr",{children:[e("td",{className:"formLabel",children:e("label",{htmlFor:"nameRomaji",children:t("ViewRes:EntryCreate.RomajiName")})}),e("td",{children:e("input",{type:"text",id:"nameRomaji",value:i.nameRomaji,onChange:a=>m(()=>{i.nameRomaji=a.target.value}),onBlur:i.checkDuplicates,className:"span12",maxLength:255,size:40})})]}),n("tr",{children:[e("td",{className:"formLabel",children:e("label",{htmlFor:"nameEnglish",children:t("ViewRes:EntryCreate.EnglishName")})}),e("td",{children:e("input",{type:"text",id:"nameEnglish",value:i.nameEnglish,onChange:a=>m(()=>{i.nameEnglish=a.target.value}),onBlur:i.checkDuplicates,className:"span12",maxLength:255,size:40})})]})]})})]}),e("div",{className:"editor-label",children:e("label",{htmlFor:"songType",children:t("ViewRes.Song:Create.SongType")})}),e("div",{className:"editor-field",children:e(ee,{id:"songType",value:i.songType,onCh
1ange:a=>m(()=>{i.songType=a.target.value})})}),i.canHaveOriginalVersion&&n(b,{children:[e("div",{className:"editor-label",children:e(se,{label:t("ViewRes.Song:Edit.BaOriginalVersion"),dangerouslySetInnerHTML:{__html:t("ViewRes.Song:Edit.BaOriginalVersionHelp")}})}),n("div",{className:"editor-field",children:[e("div",{style:{display:"inline-block"},className:"input-append",children:e(ie,{basicEntryLinkStore:i.originalVersion,songTypes:le.originalVersionTypes})}),i.originalVersion.isEmpty&&i.originalSongSuggestions.length>0&&n("div",{children:[e("h4",{children:t("ViewRes.Song:Create.OriginalSuggestionsTitle")}),e("table",{children:e("tbody",{children:i.originalSongSuggestions.map((a,p)=>n("tr",{children:[n("td",{children:[e(te,{entry:a.entry,tooltip:!0,children:a.entry.name.displayName})," ","(",e("span",{children:a.entry.entryTypeName}),")",a.entry.artistString&&e("div",{children:e("span",{children:a.entry.artistString})})]}),e("td",{style:{maxWidth:"150px"},children:e(V,{className:"textLink acceptLink",href:"#",onClick:()=>i.selectOriginal(a),children:t("ViewRes.Song:Create.Select")})})]},p))})})]})]})]}),n("div",{className:"editor-label",children:[e("span",{children:t("ViewRes.Song:Create.ArtistsInfo")})," ",e(N,{}),e("br",{}),e("span",{className:"extraInfo",children:t("ViewRes.Song:Create.ArtistDesc")})]}),n("div",{className:"editor-field",children:[i.errors&&i.errors.artists&&e("span",{className:"field-validation-error",children:i.errors.artists[0]}),e("table",{children:e("tbody",{children:i.artists.map((a,p)=>n("tr",{children:[e("td",{children:e(A,{artist:a,tooltip:!0,typeLabel:!0})}),e("td",{children:e(V,{onClick:()=>i.removeArtist(a),href:"#",className:"textLink removeLink",children:t("ViewRes:Shared.Remove")})})]},p))})}),e("br",{}),e(X,{type:"text",properties:{acceptSelection:i.addArtist,height:300},maxLength:128,placeholder:t("ViewRes:Shared.Search"),className:"span8"})]}),e("br",{}),e("p",{children:n("label",{className:"checkbox",children:[e("input",{type:"checkbox",checked:i.draft,onChange:a=>m(()=>{i.draft=a.target.checked})}),t("ViewRes.Song:Create.Draft")]})}),e("br",{}),e(ae,{submitting:i.submitting,children:t("ViewRes:Shared.Save")})]}),n("div",{className:"span4",children:[e(v,{variant:"info",className:"pre-line",children:e("span",{dangerouslySetInnerHTML:{__html:d("SongRes.NewSongInfo")}})}),n(v,{variant:"info",children:[e("p",{children:t("ViewRes.Song:Create.NoArtistsToName")}),e("p",{children:t("ViewRes.Song:Create.NameHelp")}),e("p",{children:t("ViewRes.Song:Create.ArtistHelp")})]}),i.coverArtists.length>0&&!i.canHaveOriginalVersion&&e(ce,{coverArtists:i.coverArtists}),e(C,{dupeEntries:i.dupeEntries}),i.songTypeInfo&&n(v,{variant:"info",children:[e("h3",{children:e(w,{to:i.songTypeTagUrl,children:i.songTypeName})}),e(Y,{children:oe(i.songTypeInfo,{length:500})})]})]})]})]})})}),We=()=>{const i=I(),[s]=H(),t=s.get("pvUrl"),[c]=E.useState(()=>new l(i.values,F,M,z,{pvUrl:t??""}));return e(me,{songCreateStore:c})};export{We as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.