1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[857],{9679:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/cardImport",function(){return r(22180)}])},13027:(e,t,r)=>{"use strict";var o=r(28153),n={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},c={};function i(e){return o.isMemo(e)?s:c[e.$$typeof]||n}c[o.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},c[o.Memo]=s;var u=Object.defineProperty,l=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,r,o){if("string"!=typeof r){if(m){var n=p(r);n&&n!==m&&e(t,n,o)}var s=l(r);d&&(s=s.concat(d(r)));for(var c=i(t),y=i(r),h=0;h<s.length;++h){var b=s[h];if(!a[b]&&!(o&&o[b])&&!(y&&y[b])&&!(c&&c[b])){var S=f(r,b);try{u(t,b,S)}catch(e){}}}}return t}},18208:(e,t,r)=>{"use strict";e.exports=r(67382)},22180:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__N_SSP:()=>T,default:()=>E});var o=r(75038),n=r(34719),a=r(76430),s=r(98381),c=r(40120),i=r(89532),u=r(98610),l=r(2477);let d=({cards:e})=>{let t=(0,s.useRouter)();return(0,o.jsxs)("button",{onClick:()=>{l.A.save(e);let r=JSON.stringify(i.M.getState().deck);u.Ay.set("sandboxDeck",r),t.push("/sandbox")},children:[(0,o.jsx)(c.A,{name:"lab",size:"massive"}),"Import to Sandbox"]})};var f=r(15918),p=r(50017),m=r(82185),y=r(85785),h=r(21159),b=r(41944),S=r(32921),v=r(76975),g=r(68835),x=r(26975),_=r(7648),k=r(69133),j=r(99027),$=r.n(j);let C=({cards:e})=>{let t=(0,s.useRouter)(),[{tbId:r}]=(0,f.A)(["tbId"]),[n,i]=(0,a.useState)(!1),[u,l]=(0,a.useState)(null),[d,j]=(0,a.useState)("auto"),[C,w]=(0,a.useState)(!1),[A,N]=(0,a.useState)(!1),[D,I]=(0,m.dN)(p.Te,p.Jv),O=()=>{if(!Number(r))return t.push(`/login?redirectTo=/cardImport?c=${encodeURIComponent(`${t.query.c}`)}`);i(!0),D()},T=()=>{I(),i(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{onClick:O,children:[(0,o.jsx)(c.A,{name:"plus",size:"massive"}),"Add to Your Decks"]}),(0,o.jsxs)(v.A,{closeButton:!0,open:n,onOpen:O,onClose:T,modalClassName:$().modal,children:[(0,o.jsx)("h2",{children:"Add Cards to a Deck"}),(0,o.jsx)(S.A,{header:"Select deck",onDeckSelected:e=>l(e),className:$().marginBottom}),(0,o.jsx)(_.A,{triggerWrapperClassName:$().fullWidth,header:"Category options",disabled:!u,value:d,placeholder:"Select category option",options:[{id:"auto",label:"Auto select categories",onClick:()=>j("auto")},{id:"Maybeboard",label:"Maybeboard",onClick:()=>j("Maybeboard")},{id:"Sideboard",label:"Sideboard",onClick:()=>j("Sideboard")}]}),(0,o.jsx)(x.A,{disabled:!u,label:"Mark with a color label as imported",onChange:()=>N(!A),checked:A}),(0,o.jsx)(g.A,{disabled:!u||C,icon:"plus",color:"green",onClick:()=>{if(!u)return;i(!0);let t={name:"Imported",color:"#f0bf2f"},r=e.map(e=>({...e,modifier:e.options[0],categories:"auto"===d?[]:[d],colorLabel:A?t:y.BW}));return w(!0),b.A.add(u,r).then(()=>{h.A.create(`${r.length} card(s) added to deck`,"Deck service","success"),T()}).catch(e=>h.A.create(e)).finally(()=>w(!1))},children:C?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(k.A,{size:"xSmall"})," Adding to deck"]}):(0,o.jsx)(o.Fragment,{children:"Add to Deck"})})]})]})};var w=r(47777),A=r(6016);let N=()=>({type:A.i8,payload:void 0}),D=({cards:e})=>{let t=(0,s.useRouter)(),[{tbId:r}]=(0,f.A)(["tbId"]),[n,i]=(0,a.useState)(!1),[u]=(0,m.dN)(N),d=()=>{if(!Number(r))return t.push(`/login?redirectTo=/cardImport?c=${encodeURIComponent(`${t.query.c}`)}`);i(!0),l.A.save(e,void 0,!0)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{onClick:d,children:[(0,o.jsx)(c.A,{name:"file outline",size:"massive"}),"Create New Deck"]}),(0,o.jsxs)(v.A,{open:n,closeButton:!0,onOpen:d,onClose:()=>{i(!1),u()},children:[(0,o.jsx)("h3",{children:"New Deck"}),(0,o.jsx)(w.A,{createDeckWithCards:!0})]})]})};var I=r(44482),O=r.n(I),T=!0;let E=({cards:e,brokenQueryString:t})=>{let r=e.reduce((e,t)=>
1e+=t.qty,0);return(0,o.jsxs)(n.A,{title:"Import Cards",robots:"noindex",className:O().container,children:[(0,o.jsxs)("div",{className:O().message,children:["We found ",e.length," unique cards ",r!==e.length?`(${r} total cards)`:""]}),t&&(0,o.jsx)("div",{className:O().noCardsFound,children:"No cards were found because the card lookup request failed. This probably means that the import URL was incorrect in some way, or cards in the request do not exist on Archidekt. If this problem is consistent, feel free to copy the URL and send it to the archidekt team via the forums, discord, or any other method of contact."}),(0,o.jsxs)("div",{className:O().content,children:[(0,o.jsx)(d,{cards:e}),(0,o.jsx)(C,{cards:e}),(0,o.jsx)(D,{cards:e})]})]})}},22448:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});function o(e,t){if(!e)throw Error("Invariant failed")}},28153:(e,t,r)=>{"use strict";e.exports=r(68053)},32921:(e,t,r)=>{"use strict";r.d(t,{A:()=>p});var o=r(75038),n=r(76430),a=r(90274),s=r.n(a),c=r(15918),i=r(81639),u=r(36601),l=r(36603),d=r(88121),f=r.n(d);let p=({onDeckSelected:e,header:t,placeholder:r,className:a})=>{let[{tbId:d}
1]=(0,c.A)(["tbId"]),[p,m]=(0,n.useState)(null),[y,h]=(0,n.useState)(""),[b,S]=(0,n.useState)(!1),[v,g]=(0,n.useState)([]),x=async e=>{let t={};e&&(t.deckName=e);let r=`/api/users/${d}/decksWithCard/?${i.stringify(t)}`;u.A.get(r).then(e=>g(e.decks)).finally(()=>S(!1))},_=(0,n.useRef)(s()(x,500)).current,k=(0,n.useRef)(null),j=e=>{h(e||""),S(!0),_(e)},$=v.map(e=>({label:e.name,id:`${e.id}`,value:e.id}));return(0,o.jsxs)(o.Fragment,{children:[t&&(0,o.jsx)("label",{className:f().header,children:t}),(0,o.jsx)(l.A,{ref:k,placeholder:r||"Select a deck...",loading:b,options:$,onChange:t=>{let r=v.find(e=>`${e.id}`==`${t}`);r&&(m(r.id),h(r.name||""),e(r.id,r.tags||[]))},onSearchChange:j,onFocus:()=>{k?.current?.select(),$.length||j()},value:y,triggerClassName:f().deckSearchDropdown,containerClassName:a})]})}},44482:e=>{e.exports={container:"cardImport_container__qZT7c",message:"cardImport_message__c_QLR",content:"cardImport_content__cHOri",noCardsFound:"cardImport_noCardsFound__VBdB2"}},51845:(e,t,r)=>{"use strict";var o=r(76430),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=o.useState,s=o.useEffect,c=o.useLayoutEffect,i=o.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}var l="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),o=a({inst:{value:r,getSnapshot:t}}),n=o[0].inst,l=o[1];return c(function(){n.value=r,n.getSnapshot=t,u(n)&&l({inst:n})},[e,r,t]),s(function(){return u(n)&&l({inst:n}),e(function(){u(n)&&l({inst:n})})},[e]),i(r),r};t.useSyncExternalStore=void 0!==o.useSyncExternalStore?o.useSyncExternalStore:l},67382:(e,t,r)=>{"use strict";var o=r(76430),n=r(80806),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=n.useSyncExternalStore,c=o.useRef,i=o.useEffect,u=o.useMemo,l=o.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,o,n){var d=c(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;var p=s(e,(d=u(function(){function e(e){if(!i){if(i=!0,s=e,e=o(e),void 0!==n&&f.hasValue){var t=f.value;if(n(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var r=o(e);return void 0!==n&&n(t,r)?(s=e,t):(s=e,c=r)}var s,c,i=!1,u=void 0===r?null:r;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,r,o,n]))[0],d[1]);return i(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}},68053:(e,t)=>{"use strict";var r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,n=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,c=r?Symbol.for("react.profiler"):60114,i=r?Symbol.for("react.provider"):60109,u=r?Symbol.for("react.context"):60110,l=r?Symbol.for("react.async_mode"):60111,d=r?Symbol.for("react.concurrent_mode"):60111,f=r?Symbol.for("react.forward_ref"):60112,p=r?Symbol.for("react.suspense"):60113,m=r?Symbol.for("react.suspense_list"):60120,y=r?Symbol.for("react.memo"):60115,h=r?Symbol.for("react.lazy"):60116,b=r?Symbol.for("react.block"):60121,S=r?Symbol.for("react.fundamental"):60117,v=r?Symbol.for("react.responder"):60118,g=r?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case l:case d:case a:case c:case s:case p:return e;default:switch(e=e&&e.$$typeof){case u:case f:case h:case y:case i:return e;default:return t}}case n:return t}}}function _(e){return x(e)===d}t.AsyncMode=l,t.ConcurrentMode=d,t.ContextConsumer=u,t.ContextProvider=i,t.Element=o,t.ForwardRef=f,t.Fragment=a,t.Lazy=h,t.Memo=y,t.Portal=n,t.Profiler=c,t.StrictMode=s,t.Suspense=p,t.isAsyncMode=function(e){return _(e)||x(e)===l},t.isConcurrentMode=_,t.isContextConsumer=function(e){return x(e)===u},t.isContextProvider=function(e){return x(e)===i},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return x(e)===f},t.isFragment=function(e){return x(e)===a},t.isLazy=function(e){return x(e)===h},t.isMemo=function(e){return x(e)===y},t.isPortal=function(e){return x(e)===n},t.isProfiler=function(e){return x(e)===c},t.isStrictMode=function(e){return x(e)===s},t.isSuspense=function(e){return x(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===c||e===s||e===p||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===i||e.$$typeof===u||e.$$typeof===f||e.$$typeof===S||e.$$typeof===v||e.$$typeof===g||e.$$typeof===b)},t.typeOf=x},80806:(e,t,r)=>{"use strict";e.exports=r(51845)},88121:e=>{e.exports={deckSearchDropdown:"deckTypeahead_deckSearchDropdown__mfrkK",categoryDropdown:"deckTypeahead_categoryDropdown__TG14g",header:"deckTypeahead_header__MIsVi"}},99027:e=>{e.exports={modal:"importToDeckButton_modal__cxHvh",marginBottom:"importToDeckButton_marginBottom___wBX5",fullWidth:"importToDeckButton_fullWidth__sFFw3"}}},e=>{e.O(0,[9128,5385,1270,7777,636,6593,8792],()=>e(e.s=9679)),_N_E=e.O()}]); 2//# sourceMappingURL=cardImport-16eb0e2a7b01ae50.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.