PageSourceSearch

https://snapcards.ai/_next/static/chunks/app/(app)/export/%5BdeckId%5D/page-3e157142e14f7145.js

js snapcards.ai collected 2026-10-05 14:40:50 UTC 15,163 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[295],{654:(e,t,r)=>{"use strict";r.d(t,{C:()=>d,GettingStartedChecklist:()=>c});var s=r(5155),a=r(2115),o=r(8500),i=r.n(o),n=r(9239);let d="snapcards-onboarding";function l(e){try{localStorage.setItem(d,JSON.stringify(e))}catch{}}function c({hasDecks:e,hasStudied:t,firstDeckId:r}){let o,[c,h]=(0,a.useState)({dismissed:!1,completed:{}}),[x,u]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let r=function(){try{let e=localStorage.getItem(d);if(e)return JSON.parse(e)}catch{}return{dismissed:!1,completed:{}}}();e&&(r.completed.uploaded=!0),t&&(r.completed.studied=!0),l(r),h(r),u(!0)},[e,t]);let m=(o=r?`/study/${r}`:"/upload",[{key:"uploaded",label:"Upload your first document",description:"Drop a PDF or Word doc and watch AI turn it into flashcards",href:"/upload",cta:"Upload Notes",icon:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,s.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,s.jsx)("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]})},{key:"studied",label:"Complete your first study session",description:"Flip through cards with spaced repetition",href:o,cta:"Study Deck",icon:(0,s.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("polygon",{points:"6 3 20 12 6 21 6 3"})})}]);if(!x||c.dismissed)return null;let p=m.filter(e=>c.completed[e.key]).length;if(p===m.length)return null;let g=p/m.length*100;return(0,s.jsxs)("div",{className:"bg-white border-2 border-border-thick rounded-xl shadow-brutal p-5 sm:p-6",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4 mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"font-display text-base font-bold",children:"Get started with SnapCards"}),(0,s.jsxs)("p",{className:"font-body text-xs text-border-thick/50 mt-0.5",children:[p," of ",m.length," steps completed"]})]}),(0,s.jsx)("button",{onClick:()=>{let e={...c,dismissed:!0};l(e),h(e)},className:"text-border-thick/30 hover:text-border-thick/60 focus-visible:outline-2 focus-visible:outline-primary transition-colors cursor-pointer p-3 -m-2","aria-label":"Dismiss getting started checklist",children:(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,s.jsx)("path",{d:"M1 1l12 12M13 1L1 13"})})})]}),(0,s.jsx)("div",{className:"h-1.5 bg-retro-gray/30 rounded-full mb-5 border border-border-thick/10",children:(0,s.jsx)("div",{className:"h-full bg-primary rounded-full transition-all duration-500",style:{width:`${g}%`}})}),(0,s.jsx)("div",{className:"space-y-3",children:m.map(e=>{let t=c.completed[e.key];return(0,s.jsxs)("div",{className:"flex items-center gap-3.5 p-3 rounded-lg border-2 transition-all "+(t?"border-success/30 bg-success/5":"border-border-thick/15 bg-white hover:border-primary/30"),children:[(0,s.jsx)("div",{className:"w-7 h-7 rounded-full border-2 flex items-center justify-center shrink-0 transition-colors duration-200 "+(t?"bg-success border-success text-white":"border-border-thick/20 bg-white"),children:t?(0,s.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("polyline",{points:"20 6 9 17 4 12"})}):(0,s.jsx)("span",{className:"text-border-thick/20",children:e.icon})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"font-display text-sm font-semibold "+(t?"text-border-thick/50 line-through":""),children:e.label}),(0,s.jsx)("p",{className:"font-body text-xs text-border-thick/50 mt-0.5",children:e.description})]}),!t&&(0,s.jsx)(i(),{href:e.href,className:"shrink-0",onClick:()=>{var t;let r;return t=e.key,void(l(r={...c,completed:{...c.completed,[t]:!0}}),h(r))},children:(0,s.jsx)(n.$,{size:"sm",variant:"ghost",className:"text-xs",children:e.cta})})]},e.key)})})]})}},2827:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>p});var s=r(5155),a=r(2115),o=r(3321),i=r(9239),n=r(8132),d=r(5160),l=r(1442),c=r(654),h=r(4193),x=r(4057),u=r(7913);function m(){try{let e=localStorage.getItem(c.C),t=e?JSON.parse(e):{dismissed:!1,completed:{}};t.completed.exported=!0,localStorage.setItem(c.C,JSON.stringify(t))}catch{}}function p(){let{deckId:e}=(0,o.useParams)(),t=(0,o.useRouter)(),[c,p]=(0,a.useState)(null),[g,f]=(0,a.useState)([]),[b,k]=(0,a.useState)(!0),[j,y]=(0,a.useState)("idle"),[v,w]=(0,a.useState)("idle"),[N,C]=(0,a.useState)("free"),[L,S]=(0,a.useState)(!1);(0,a.useEffect)(()=>{!async function(){let[r,s]=await Promise.all([fetch(`/api/decks/${e}`),fetch("/api/settings/profile")]);if(!r.ok)return t.push("/dashboard");let a=await r.json();p(a.deck),f(a.cards),s.ok&&C((await s.json()).subscription_tier??"free"),k(!1)}()},[e,t]);let E=(0,a.useCallback)(async()=>
1{if(c){w("generating");try{let t=await fetch(`/api/export/csv/${e}`);if(!t.ok)throw Error("Export failed");let r=await t.blob(),s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=`${c.title.replace(/[^a-zA-Z0-9]/g,"_")}.csv`,a.click(),URL.revokeObjectURL(s),w("done"),(0,h.i1)(e,"csv",g.length),m()}catch(t){w("error"),(0,h.BX)(e,"csv",t instanceof Error?t.message:"CSV export failed")}}},[c,e,g]),P=(0,a.useCallback)(async()=>{if(c&&0!==g.length){y("generating");try{let{generateApkg:t}=await Promise.all([r.e(1243),r.e(3737)]).then(r.bind(r,3737)),s=await t(c.title,g.map(e=>({question:e.question,answer:e.answer}))),a=new Blob([s.buffer],{type:"application/octet-stream"}),o=URL.createObjectURL(a),i=document.createElement("a");i.href=o,i.download=`${c.title.replace(/[^a-zA-Z0-9]/g,"_")}.apkg`,i.click(),URL.revokeObjectURL(o),y("done"),(0,h.i1)(e,"anki",g.length),m()}catch(t){y("error"),(0,h.BX)(e,"anki",t instanceof Error?t.message:"Anki export failed")}}},[c,g]);return b||!c?(0,s.jsxs)("div",{className:"max-w-2xl mx-auto space-y-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full bg-primary animate-pulse"}),(0,s.jsx)("p",{className:"font-display text-xs font-bold uppercase tracking-widest text-border-thick/50",children:"Loading export..."})]}),(0,s.jsx)("div",{className:"skeleton-shimmer rounded-xl border-2 border-border-thick/20 h-32 mx-auto max-w-xs"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsx)("div",{className:"skeleton-shimmer rounded-xl border-2 border-border-thick/20 h-40"}),(0,s.jsx)("div",{className:"skeleton-shimmer rounded-xl border-2 border-border-thick/20 h-40",style:{animationDelay:"0.15s"}})]})]}):(0,s.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,s.jsxs)("div",{className:"text-center mb-10",children:[(0,s.jsx)(d.E,{variant:"success",className:"mb-4",children:"Export Ready"}),(0,s.jsxs)("h1",{className:"font-display text-4xl md:text-5xl font-bold leading-none tracking-tight uppercase",children:["Export ",(0,s.jsx)("span",{className:"text-primary",children:"Deck"})]}),(0,s.jsxs)("p",{className:"font-body text-sm text-border-thick/60 mt-3",children:[c.title," — ",g.length," cards"]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mb-8",children:[(0,x.oR)(N)?(0,s.jsxs)("button",{onClick:P,disabled:"generating"===j,className:(0,l.cn)("flex flex-col items-center gap-3 p-8 bg-white border-2 border-border-thick rounded-xl shadow-brutal-sm","hover:shadow-brutal hover:-translate-x-[2px] hover:-translate-y-[2px]","active:translate-x-[2px] active:translate-y-[2px] active:shadow-none","transition-all duration-100 cursor-pointer","disabled:opacity-50 disabled:cursor-not-allowed","done"===j&&"border-success bg-success/10"),children:[(0,s.jsx)("div",{className:"w-12 h-12 flex items-center justify-center bg-primary/10 border-2 border-primary/20 rounded-lg",children:(0,s.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-primary",children:[(0,s.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,s.jsx)("polyline",{points:"7 10 12 15 17 10"}),(0,s.jsx)("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]})}),(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("p",{className:"font-display text-base font-bold",children:"Export for Anki"}),(0,s.jsxs)("p",{className:"font-body text-xs text-border-thick/50 mt-1 flex items-center justify-center gap-1.5",children:["generating"===j&&(0,s.jsxs)("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"generating"===j?"Generating .apkg...":"done"===j?"Downloaded!":"error"===j?"Export failed — try again":"Download .apkg for desktop"]}),"generating"===j&&(0,s.jsx)("p",{className:"font-body text-xs text-border-thick/30 mt-1",children:"This may take a few seconds"})]})]}):(0,s.jsxs)("div",{onClick:()=>{(0,h.k5)("anki_export",N),(0,h.Dq)("export"),S(!0)},className:(0,l.cn)("relative flex flex-col items-center gap-3 p-8 bg-white border-2 border-border-thick/40 rounded-xl","cursor-default opacity-70"),children:[(0,s.jsx)("div",{className:"w-12 h-12 flex items-center justify-center bg-border-thick/5 border-2 border-border-thick/20 rounded-lg",children:(0,s.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-border-thick/40",children:[(0,s.jsx)("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),(0,s.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("p",{className:"font-display text-base font-bold",children:"Export for Anki"}),(0,s.jsx)("p",{className:"font-body text-xs text-border-thick/40 mt-1",children:"Pro feature"})]}),(0,s.jsx)(i.$,{onClick:e=>{e.stopPropagation(),(0,h.Dq)("export"),S(!0)},size:"sm",className:"mt-1",children:"Upgrade to Pro"})]}),(0,s.jsxs)("button",{onClick:E,disabled:"generating"===v,className:(0,l.cn)("flex flex-col items-center gap-3 p-8 bg-white border-2 border-border-thick rounded-xl shadow-brutal-sm","hover:shadow-brutal hover:-translate-x-[2px] hover:-translate-y-[2px]","active:translate-x-[2px] active:translate-y-[2px] active:shadow-none","transition-all duration-100 cursor-pointer","disabled:opacity-50 disabled:cursor-not-allowed","done"===v&&"border-success bg-success/10"),children:[(0,s.jsx)("div",{className:"w-12 h-12 flex items-center justify-center bg-safety-orange/10 border-2 border-safety-orange/20 rounded-lg",children:(0,s.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-safety-orange",children:[(0,s.jsx)("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),(0,s.jsx)("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),(0,s.jsx)("path",{d:"M10 13H8"}),(0,s.jsx)("path",{d:"M16 17H8"}),(0,s.jsx)("path",{d:"M16 13h-2"})]})}),(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("p",{className:"font-display text-base font-bold",children:"Export as CSV"}),(0,s.jsxs)("p",{className:"font-body text-xs text-border-thick/50 mt-1 flex items-center justify-center gap-1.5",children:["generating"===v&&(0,s.jsxs)("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"generating"===v?"Generating...":"done"===v?"Downloaded!":"error"===v?"Export failed — try again":"Simple spreadsheet format"]})]})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap justify-center gap-4 pt-6 border-t border-retro-gray",children:[(0,s.jsxs)(i.$,{variant:"ghost",size:"sm",onClick:()=>t.push((0,n.dN)(e)),children:[(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-1.5",children:(0,s.jsx)("polygon",{points:"6 3 20 12 6 21 6 3"})}),"Start Studying"]}),(0,s.jsxs)(i.$,{variant:"ghost",size:"sm",onClick:()=>t.push(`/deck/${e}`),children:[(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-1.5",children:(0,s.jsx)("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"})}),"Edit Deck"]}),(0,s.jsxs)(i.$,{variant:"ghost",size:"sm",onClick:()=>t.push("/upload"),children:[(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-1.5",children:[(0,s.jsx)("path",{d:"M5 12h14"}),(0,s.jsx)("path",{d:"M12 5v14"})]}),"Create Another"]})]}),(0,s.jsx)(u.k,{open:L,onClose:()=>S(!1),location:"export"})]})}},3321:(e,t,r)=>{"use strict";var s=r(4645);r.o(s,"useParams")&&r.d(t,{useParams:function(){return s.useParams}}),r.o(s,"usePathname")&&r.d(t,{usePathname:function(){return s.usePathname}}),r.o(s,"useRouter")&&r.d(t,{useRouter:function(){return s.useRouter}}),r.o(s,"useSearchParams")&&r.d(t,{useSearchParams:function(){return s.useSearchParams}})},5160:(e,t,r)=>{"use strict";r.d(t,{E:()=>n});var s=r(5155),a=r(1442),o=r(2115);let i={default:"bg-retro-gray/50 text-border-thick",primary:"bg-primary/10 text-primary",secondary:"bg-safety-orange/10 text-safety-orange",success:"bg-success/10 text-success",warning:"bg-warning/10 text-warning",danger:"bg-danger/10 text-danger"},n=(0,o.forwardRef)(({className:e,variant:t="default",...r},o)=>(0,s.jsx)("span",{ref:o,className:(0,a.cn)("inline-flex items-center rounded-full border border-border-thick/20 px-2.5 py-0.5","font-display text-xs font-semibold tracking-wide",i[t],e),...r}));n.displayName="Badge"},8132:(e,t,r)=>{"use strict";r.d(t,{J6:()=>l,Ol:()=>n,dN:()=>d,tj:()=>i});var s=r(2115);let a="snapcards_study_mode",o="studymodechange";function i(){return"mcq"===localStorage.getItem(a)?"mcq":"flashcard"}
1function n(){let[e,t]=(0,s.useState)("flashcard");return(0,s.useEffect)(()=>{t(i());let e=e=>t(e.detail);return window.addEventListener(o,e),()=>window.removeEventListener(o,e)},[]),[e,e=>{t(e),i()!==e&&(localStorage.setItem(a,e),window.dispatchEvent(new CustomEvent(o,{detail:e})))}]}function d(e,t){return"mcq"===(t??i())?`/study/${e}?mode=mcq`:`/study/${e}`}function l(e){return"mcq"===(e??i())?"/study/due?mode=mcq":"/study/due"}},9948:(e,t,r)=>{Promise.resolve().then(r.bind(r,2827))}},e=>{e.O(0,[8500,7913,8441,3139,7358],()=>e(e.s=9948)),_N_E=e.O()}]);
2//# sourceMappingURL=page-3e157142e14f7145.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.