1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3841],{16014:e=>{e.exports={container:"importMiscManager_container__IYHV5",header:"importMiscManager_header__dA09H",accordionContent:"importMiscManager_accordionContent__HDzE4",lineInfo:"importMiscManager_lineInfo__eBhLM",accordionTrigger:"importMiscManager_accordionTrigger__ZBr0A",rawData:"importMiscManager_rawData__qANsJ",errors:"importMiscManager_errors__iGCvJ",optionsMenu:"importMiscManager_optionsMenu__9ozvJ"}},19528:e=>{e.exports={bar:"progressLoadingBar_bar__7zUT7",progress:"progressLoadingBar_progress__hva9n",move:"progressLoadingBar_move__rRQ5z",text:"progressLoadingBar_text__x5VTd"}},22533:(e,n,o)=>{"use strict";o.d(n,{A:()=>s});var a=o(75038);o(76430);var r=o(43746),t=o.n(r);let i={blue:t().blue,green:t().green,red:t().red,yellow:t().yellow,orange:t().orange},s=({color:e,header:n,content:o,list:r})=>{let s=e?i[e]:"";return(0,a.jsxs)("div",{className:`${t().message} ${s}`,children:[n&&(0,a.jsx)("div",{className:t().header,children:n}),o&&(0,a.jsx)("p",{className:t().content,children:o}),r&&(0,a.jsx)("ul",{children:r.map((e,n)=>(0,a.jsx)("li",{children:e},n))})]})}},24831:(e,n,o)=>{"use strict";o.d(n,{A:()=>l});var a=o(75038);o(76430);var r=o(40120),t=o(8682),i=o(66508),s=o.n(i);let l=({id:e,value:n,options:o,onChange:i,trigger:l=null,menuClassName:d,triggerClassName:c,wrapperClassName:p,labelClassName:u,disabled:m,label:h,placeholder:g,noIcon:_})=>(0,a.jsxs)(t.A,{disabled:m,triggerClassName:p,menuClassName:d,options:o.map(e=>({label:e.label,onClick:()=>i(e.value)})),children:[h&&(0,a.jsx)("label",{className:s().labelClassName,htmlFor:e,children:h}),l||(0,a.jsxs)("button",{id:e,className:`${s().trigger} ${c}`,disabled:m,children:[o.find(e=>e.value===n)?.label||n||g,!_&&(0,a.jsx)(r.A,{name:"triangle down"})]})]})},40962:e=>{e.exports={container:"textForm_container__0pkmj"}},43746:e=>{e.exports={message:"message_message__OOkpZ",header:"message_header__2aitY",content:"message_content__5g5XJ",red:"message_red__gfBEF",green:"message_green__tGO0d",blue:"message_blue__aA_ek",orange:"message_orange__QRQVf",yellow:"message_yellow__zwm8o"}},51587:(e,n,o)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/collections/import",function(){return o(78452)}])},65748:(e,n,o)=>{"use strict";o.d(n,{A:()=>i});var a=o(75038);o(76430);var r=o(19528),t=o.n(r);let i=({label:e,completionPercentage:n,className:o=""})=>(0,a.jsxs)("div",{className:`${t().bar} ${o}`,children:[(0,a.jsx)("div",{className:t().progress,style:{width:`${100*n}%`}}),(0,a.jsx)("span",{className:t().text,children:e})]})},66508:e=>{e.exports={trigger:"dropdown_trigger__dAeyh"}},67486:e=>{e.exports={controls:"csvV2Form_controls__5l96i",columnHeaders:"csvV2Form_columnHeaders__AJLkG",headerOption:"csvV2Form_headerOption___XHJf",option:"csvV2Form_option__RahGW",optionRemoveButton:"csvV2Form_optionRemoveButton__739xm",optionTrigger:"csvV2Form_optionTrigger__VguYC",optionDragHandle:"csvV2Form_optionDragHandle__mqsls",dropdownOptionWrapper:"csvV2Form_dropdownOptionWrapper__B6hgt",ambiguousUploadWarning:"csvV2Form_ambiguousUploadWarning___smk2",predefinedDescription:"csvV2Form_predefinedDescription__xmpZk",rowExample:"csvV2Form_rowExample__IzKjL",example:"csvV2Form_example__VItyt",extras:"csvV2Form_extras__ddeFP",submit:"csvV2Form_submit__HyNV2",extraOptionDropdown:"csvV2Form_extraOptionDropdown__JHf_1",extraOptionDropdownTrigger:"csvV2Form_extraOptionDropdownTrigger__0eTPg",predefinedColumnsOptions:"csvV2Form_predefinedColumnsOptions__oLy5Z",extraOptionMenu:"csvV2Form_extraOptionMenu__MvtcU",predefinedColumnsMenu:"csvV2Form_predefinedColumnsMenu__ZTwGX",overrideMenuContainer:"csvV2Form_overrideMenuContainer__G0pfn",predefinedColumnsSetButton:"csvV2Form_predefinedColumnsSetButton__fntwW",fileDropzone:"csvV2Form_fileDropzone__uI9e6"}},73964:e=>{e.exports={flex:"import_flex__8ZE0F",container:"import_container__PdaQB",headers:"import_headers__2eOw9",content:"import_content__4kix1",tabContainer:"import_tabContainer__AuG_N",tabButton:"import_tabButton__An8PZ",forms:"import_forms__ipQ_7"}},78452:(e,n,o)=>{"use strict";o.r(n),o.d(n,{__N_SSP:()=>Z,default:()=>q});var a=o(75038),r=o(76430),t=o(15918),i=o(92910),s=o(79761),l=o(78732),d=o(69433),c=o(9866),p=o(21159),u=o(84126),m=o(24831),h=o(15938),g=o(8682),_=o(68835),x=o(79400),f=o(16014),v=o.n(f);let j=({response:e,onClearResponse:n})=>{let o=e.filter(e=>e.imported).sort((e,n)=>e.lineNumber-n.lineNumber),r=e.filter(e=>e.notFound).sort((e,n)=>e.lineNumber-n.lineNumber),t=e.filter(e=>e.ambiguous).sort((e,n)=>e.lineNumber-n.lineNumber);return(0,a.jsxs)("div",{className:v().container,children:[(0,a.jsxs)("div",{className:v().header,children:[(0,a.jsx)("h3",{children:"Upload Status"}),(0,a.jsx)(_.A,{color:"red",onClick:n,children:"Clear upload output"})]}),(0,a.jsx)(b,{label:"Not found",lineGroup:r}),(0,a.jsx)(b,{label:"Ambiguous",lineGroup:t}),(0,a.jsx)(b,{label:"Successful imports",lineGroup:o})]})},b=({label:e,lineGroup:n})=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:v().header,children:[(0,a.jsx)("h4",{children:e}),(0,a.jsx)(g.A,{menuClassName:v().optionsMenu,options:[{icon:"download",label:"Download CSV",onClick:()=>{let o=n.map(e=>e.raw).join("");try{let n=`${e.toLowerCase().replace(" ","_")}.csv`;(0,x.R)(n,o)}catch{p.A.create("Unable to download file","Collection Import","error")}}},{icon:"copy outline",label:"Copy to clipboard",onClick:()=>{let e=n.map(e=>e.raw).join("");try{navigator.clipboard.writeText(e),p.A.create("Copied data to clipboard","Collection Import","success")}catch{p.A.create("Unable to copy text","Collection Import","error")}}}],children:(0,a.jsx)(_.A,{icon:"download",children:"Export"})})]}),(0,a.jsx)(h.A,{label:`Details: (${n.length})`,className:v().accordionTrigger,children:(0,a.jsx)("div",{className:v().accordionContent,children:n.map((e,n)=>(0,a.jsxs)("div",{className:v().lineInfo,children:[(0,a.jsxs)("div",{className:v().rawData,children:[(0,a.jsxs)("div",{children:["Line number: ",e.lineNumber]}),(0,a.jsxs)("div",{children:["Raw data: ",e.raw]})]}),(0,a.jsxs)("div",{className:v().status,children:[(0,a.jsxs)("div",{children:["Imported: ",e.imported?"Yes":"No"]}),(0,a.jsxs)("div",{children:["Ambiguous: ",e.ambiguous?"Yes":"No"]}),(0,a.jsxs)("div",{children:["Not Found: ",e.notFound?"Yes":"No"]})]}),!!e.errors.length&&(0,a.jsxs)("div",{className:v().errors,children:[(0,a.jsxs)("div",{children:["Errors (",e.errors.length,")"]}),(0,a.jsx)("ul",{children:e.errors.map((e,n)=>(0,a.jsx)("li",{children:e},n))})]})]},n))})})]});var C=o(65748),N=o(40120),w=o(85785),A=o(8052),y=o(77552),k=o(67486),M=o.n(k);let S=({})=>{let[e,n]=(0,r.useState)(),[o,t]=(0,r.useState)([]),[i,s]=(0,l.Mj)(y.Gl,[]),[h,g]=(0,r.useState)(!0),[x,f]=(0,r.useState)(A.$z.EN),[v,b]=(0,r.useState)(A.UW.NM),[k,S]=(0,r.useState)(w.$p.Paper),[F,O]=(0,r.useState)(!0),[D,V]=(0,r.useState)(),[I,B]=(0,r.useState)([]),[T,U]=(0,r.useState)(!1),[$,E]=(0,r.useState)(0),[W,z]=(0,r.useState)(0),G=(e,n,a)=>{let r=n+1,t={chunk:r,chunkSize:y.OZ,ifFound:"add",skip:h,defaultGame:k,defaultLanguage:x,defaultCondition:v,skipAmbiguousImports:F};T||U(!0),z(r),u.A.importCsvV2(e[n],t,o).then(r=>{let t=[...a,...r.data];if(n!==e.length-1)return G(e,n+1,t);B(t),p.A.create("We've finished uploading your collection.","Upload Complete","success"),z(0),U(!1),s(o)}).catch(e=>{console.error(e);let n=e.error||"Something went wrong while uploading your collection.";p.A.create(n,"Upload Failed","error"),z(0),U(!1)})},L=y.f2[e||""]||"",H=o.includes("uid")||o.includes("oracleCard__name")&&o.includes("collectorNumber")&&(o.includes("edition__editionname")||o.includes("edition__editioncode"));return(0,a.jsxs)("div",{className:M().container,children:[(0,a.jsxs)("div",{className:M().controls,children:[(0,a.jsxs)(_.A,{icon:"circle-plus",color:"blue",disabled:o.length>19,onClick:()=>{let e=y.be.find(e=>!o.includes(e.value))?.value||"ignore";t([...o,e])},children:["Add manual column (",o.length,")"]}),(0,a.jsx)("h4",{children:"or"}),(0,a.jsxs)("div",{className:M().overrideMenuContainer,children:[(0,a.jsx)(m.A,{placeholder:"Use formatting from...",triggerClassName:M().predefinedColumnsOptions,menuClassName:M().predefinedColumnsMenu,value:e,options:y.vo,onChange:n}),(0,a.jsx)(_.A,{color:"green",icon:"arrow right",disabled:!e,onClick:()=>
1{if(e){if("cached"!==e)return t(y.fU[e]);if(!i||!Array.isArray(i))return p.A.create("Unable to use cached column layout due to the cache not being what we expected. Please select a different option.","CSV Importer","warning");if(!i.length)return p.A.create("The cached column layout had no columns!","CSV Importer","warning");t(i)}},className:M().predefinedColumnsSetButton,children:"Set columns"})]})]}),(0,a.jsx)("div",{className:M().columnHeaders,children:o.map((e,n)=>(0,a.jsxs)("div",{className:M().headerOption,children:[(0,a.jsx)(m.A,{wrapperClassName:M().dropdownOptionWrapper,triggerClassName:M().optionTrigger,onChange:e=>t(o.map((o,a)=>a===n?e:o)),value:o[n],options:y.be}),(0,a.jsx)("button",{className:M().optionRemoveButton,onClick:()=>t(o.filter((e,o)=>o!==n)),children:(0,a.jsx)(N.A,{name:"trash"})})]},n))}),!!L&&(0,a.jsx)("div",{className:M().predefinedDescription,children:L}),!!o.length&&(0,a.jsxs)("div",{className:M().rowExample,children:[(0,a.jsx)("h3",{children:"Example row from CSV"}),(0,a.jsx)("div",{className:M().example,children:o.map((e,n)=>(0,a.jsxs)("div",{children:[y.bz[e],","]},n))})]}),!H&&!!o.length&&(0,a.jsxs)("div",{className:M().ambiguousUploadWarning,children:[(0,a.jsx)("h3",{children:"Ambiguous Upload Warning"}),(0,a.jsx)("p",{children:"An upload should contain at least one of the following combinations of columns to reduce printing ambiguity."}),(0,a.jsxs)("ul",{children:[(0,a.jsx)("li",{children:"Scryfall ID"}),(0,a.jsx)("li",{children:"Card name, set name, collector number"}),(0,a.jsx)("li",{children:"Card name, set code, collector number"})]}),(0,a.jsx)("p",{children:"By default, we will skip importing any cards that do not have that data in the import file. Below, you can select to instead import ambiguous cards with the âUnsureâ tag. In those instances, we will choose the most recent ânormalâ printing of a cardâ."})]}),(0,a.jsxs)("div",{className:M().extras,children:[(0,a.jsx)("h3",{children:"Extra Options"}),(0,a.jsx)(m.A,{label:"Skip first line",id:"skip-first-line",wrapperClassName:M().extraOptionDropdown,triggerClassName:M().extraOptionDropdownTrigger,menuClassName:M().extraOptionMenu,value:h,options:[{label:"Yes",value:!0},{label:"No",value:!1}],onChange:g}),(0,a.jsx)(m.A,{label:"Default language",id:"language-options",wrapperClassName:M().extraOptionDropdown,triggerClassName:M().extraOptionDropdownTrigger,menuClassName:M().extraOptionMenu,value:x,options:y.mN,onChange:f,disabled:o.includes("language")}),(0,a.jsx)(m.A,{label:"Default condition",id:"condition-options",wrapperClassName:M().extraOptionDropdown,triggerClassName:M().extraOptionDropdownTrigger,menuClassName:M().extraOptionMenu,value:v,options:y.Bh,onChange:b,disabled:o.includes("condition")}),(0,a.jsx)(m.A,{label:"Default collection type",id:"collection-type-options",wrapperClassName:M().extraOptionDropdown,triggerClassName:M().extraOptionDropdownTrigger,menuClassName:M().extraOptionMenu,value:k,options:y.aB,onChange:S}),(0,a.jsx)(m.A,{label:"When a printing is ambiguous...",id:"ambiguous-printing-options",wrapperClassName:M().extraOptionDropdown,triggerClassName:M().extraOptionDropdownTrigger,menuClassName:M().extraOptionMenu,value:F,options:y.ws,onChange:O})]}),(0,a.jsxs)("div",{className:M().submit,children:[(0,a.jsx)(c.A,{onDrop:(e,n)=>e.length?V(e[0]):null,onDropRejected:()=>p.A.create("Unable to process file. Check your file size, is it less than 2Mb?","Collection Import","error"),accept:".csv",multiple:!1,maxSize:5e6,className:M().fileDropzone,children:D?(0,a.jsxs)("p",{children:["File name: ",(0,a.jsx)("i",{children:D.name})]}):(0,a.jsxs)("p",{children:["Drop a CSV file here, or click to select a file to upload. ",(0,a.jsx)("b",{children:"(Max 5MB)"})]})}),(0,a.jsx)(_.A,{disabled:!D||T||!!I.length||!o.length,color:"green",onClick:()=>{if(!D)return;d.A.signalEvent("Importing a CSV v2");let e=new FileReader;e.onabort=()=>console.log("file reading was aborted"),e.onerror=()=>console.log("file reading has failed"),e.onload=()=>{let n=[],o=e.result,a=o.split("\r"),r=o.split("\n"),t=a.length>r.length?a:r;for(let e=0;e<t.length;e+=y.OZ){let o=new Blob([...t.slice(e,e+y.OZ).join("\n")],{type:"text/csv"});n.push(o)}E(n.length),G(n,0,[])},D&&e.readAsText(D)},children:"Upload"})]}),!!D&&!o.length&&(0,a.jsx)("div",{className:M().ambiguousUploadWarning,children:"You have no columns defined. Define some columns before attempting to upload."}),T&&(0,a.jsx)(C.A,{completionPercentage:W/$,label:`Uploading chunk ${W} of ${$}`}),!!I.length&&!T&&(0,a.jsx)(j,{response:I,onClearResponse:()=>B([])})]})};var F=o(98381),O=o(81639),D=o(82185),V=o(47853),I=o(26975),B=o(7648);let T=({setParentState:e,text:n,formState:o,dek:r})=>(0,a.jsx)(h.A,{label:"Advanced options",children:(0,a.jsxs)(a.Fragment,{children:[!r&&!n&&(0,a.jsx)(I.A,{label:"Skip first line of csv (column labels)",checked:o.skip,onChange:()=>e({skip:!o.skip})}),(0,a.jsx)(B.A,{inlineHeader:!0,header:"If we find the exact card already in your collection (same edition):",options:[{id:"add",onClick:()=>e({ifFound:"add"}),label:"Add quantities together"},{id:"ignore",onClick:()=>e({ifFound:"ignore"}),label:"ignore the new card"},{id:"replace",onClick:()=>e({ifFound:"replace"}),label:"replace the old card"}],value:o.ifFound}),!r&&(0,a.jsx)(B.A,{inlineHeader:!0,header:"Default Language:",options:A.h2.map(n=>({id:`${n.value}`,label:n.content,onClick:()=>e({defaultLanguage:n.value})})),value:o.defaultLanguage}),!r&&(0,a.jsx)(B.A,{inlineHeader:!0,header:"Default Condition:",value:o.defaultCondition,options:A.yn.map(n=>({id:`${n.value}`,label:n.content,onClick:()=>e({defaultCondition:n.value})}))}),(0,a.jsx)(B.A,{inlineHeader:!0,header:"Default Game:",options:Object.keys(w.$p).map(n=>({id:`${w.$p[n]}`,label:n,onClick:()=>e({defaultGame:w.$p[n]})})),value:`${o.defaultGame}`})]})});var U=o(22533);let $=({textErrors:e})=>
1{if(!e)return null;let{notFound:n,notSure:o}=e;return(0,a.jsxs)(a.Fragment,{children:[!!o.length&&(0,a.jsx)(U.A,{color:"yellow",header:"We weren't sure about the exact edition of the following lines. We added them with the 'Unsure' tag so you can set the correct edition.",list:o}),!!n.length&&(0,a.jsx)(U.A,{color:"red",header:"We couldn't identify a card name in the following lines:",list:n})]})};var E=o(550),W=o(75249),z=o(40962),G=o.n(z);let L=()=>{let[{tbId:e}]=(0,t.A)(["tbId"]),[n,o]=(0,D.zU)(V.UK,V.yx),[i,s]=(0,r.useState)(""),[l,c]=(0,r.useState)(),[m,h]=(0,r.useState)(!1),g=(0,F.useRouter)(),x=Number(g.query.collectionGame)||w.$p.Paper,[f,v]=(0,r.useState)({ifFound:"add",defaultLanguage:A.$z.EN,defaultCondition:A.UW.NM,defaultGame:x}),j=a=>{a.preventDefault(),d.A.signalEvent("Importing with the TextArea."),h(!0),u.A.importText(i,f).then(a=>{c(a),p.A.create("We've finished uploading your collection.","Upload Complete","success"),o({loading:!0,collection:[]}),u.A.rawList(g.query.userId||e,`?${O.stringify(g.query)}`).then(n).catch(p.A.create).finally(()=>o({loading:!1}))}).catch(p.A.create).finally(()=>h(!1))};return(0,a.jsxs)("form",{onSubmit:j,className:G().container,children:[(0,a.jsx)(T,{text:!0,formState:f,setParentState:e=>v({...f,...e})}),(0,a.jsx)(E.A,{onChange:s,placeholder:`We accept any of these formats. The main requirement is that a there has to be exactly one card name per line and if a quantity is included, it must come first. 2 3 4 Snapcaster Mage 4 5 1x Sol Ring (C17) 6 7 1 Black Lotus Alpha M/P 8 9 Angus Mackenzie (Legends) NM Italian 10 `}),(0,a.jsx)($,{textErrors:l}),(0,a.jsx)(_.A,{disabled:!i||m,color:"green",onClick:j,children:"Submit"}),m&&(0,a.jsx)(W.A,{})]})};var H=o(97930),R=o(73964),P=o.n(R),Z=!0;let q=({})=>{let[e,n]=(0,r.useState)("csvV2"),[{tbId:o}]=(0,t.A)(["tbId"]);return(0,a.jsx)(s.A,{title:"Collection import",description:"Import cards to your Archidekt collection",children:(0,a.jsx)("div",{className:P().container,children:(0,a.jsxs)("div",{className:P().content,children:[(0,a.jsxs)("div",{className:P().headers,children:[(0,a.jsx)("h1",{children:"Collection Import"}),(0,a.jsxs)(i.A,{href:`/collection/v2/${o}`,children:[(0,a.jsx)(N.A,{name:"arrow left"})," Back to collection"]})]}),(0,a.jsx)(H.A,{className:P().tabContainer,optionsClassName:P().tabButton,options:[{label:"CSV (recommended)",onClick:()=>n("csvV2"),selected:"csvV2"===e},{label:"Text",onClick:()=>n("text"),selected:"text"===e}]}),(0,a.jsxs)("div",{className:P().forms,children:["csvV2"===e&&(0,a.jsx)(S,{}),"text"===e&&(0,a.jsx)(L,{})]})]})})})}},79400:(e,n,o)=>{"use strict";o.d(n,{R:()=>a}),o(23305);let a=(e,n)=>{let o=document.body;if(o){let a=document.createElement("a");a.setAttribute("href","data:pdf/plain;charset=utf-8,"+encodeURIComponent(n)),a.setAttribute("download",e),a.style.display="none",o.appendChild(a),a.click(),o.removeChild(a)}}}},e=>{e.O(0,[8732,636,6593,8792],()=>e(e.s=51587)),_N_E=e.O()}]); 11//# sourceMappingURL=import-b684d4f0fa9504a5.js.map
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.