1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bd08cbeb-e4d0-4574-9a24-6e42ee23ec66",e._sentryDebugIdIdentifier="sentry-dbid-bd08cbeb-e4d0-4574-9a24-6e42ee23ec66")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5900],{13960:(e,t,a)=>{a.d(t,{R:()=>c,SubscriptionProvider:()=>d});var r=a(95155),s=a(65312),n=a(6982),l=a(12115);function i(e,t){return"active"===e||"on_trial"===e||"cancelled"===e&&!!t&&new Date(t)>new Date}let o=(0,l.createContext)(void 0),d=e=>{let{children:t}=e,[a,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[f,p]=(0,l.useState)(!1),[x,v]=(0,l.useState)(null),[g,w]=(0,l.useState)(null),[b,y]=(0,l.useState)(null),[j,_]=(0,l.useState)(null),[k,N]=(0,l.useState)(!1),[S,C]=(0,l.useState)(0),[D,A]=(0,l.useState)(!1),[E,M]=(0,l.useState)(!0),[P,G]=(0,l.useState)(null),R=(0,l.useRef)(0),T=(0,l.useRef)(null),F=()=>{let e="peppngdnnhjpchacodkdadojgnafepdd";"undefined"!=typeof chrome&&chrome.runtime&&e&&chrome.runtime.sendMessage(e,"LOGIN").catch(e=>{console.warn("[SubscriptionProvider] Could not reach extension:",e)})},I=e=>{if(null===T.current||T.current===e){T.current=e;return}T.current=e,e&&(0,n.A)("Pro unlocked â your dataset features are live","success"),F()},L=()=>{d(!1),p(!1),v(null),w(null),u(null),h(null),y(null),_(null),N(!1),C(0),A(!1)},U=(0,l.useCallback)(async()=>{R.current=Date.now(),M(!0),G(null);let e=await (0,s.U)();try{var t,a;let{data:{user:r},error:s}=await e.auth.getUser();if(s||!r){L();return}let[{data:n,error:l},{data:o,error:c}]=await Promise.all([e.from("subscriptions").select("status, lemonsqueezy_subscription_id, plan_name, ends_at, renews_at, variant_id").eq("user_id",r.id).maybeSingle(),e.from("app_trials").select("expires_at").eq("user_id",r.id).maybeSingle()]);if(l&&"PGRST116"!==l.code)throw Error(l.message);if(c&&"PGRST116"!==c.code)throw Error(c.message);let m=null!==(t=null==o?void 0:o.expires_at)&&void 0!==t?t:null,f=null!=m&&new Date(m).getTime()>Date.now(),x=f?Math.ceil((new Date(m).getTime()-Date.now())/864e5):0;N(f&&!(n&&i(n.status,n.ends_at))),C(x),A(null!=m);let g=!!n&&i(n.status,n.ends_at),b=g||f;n?(u(n.status),h(n.plan_name),y(n.ends_at),_(n.renews_at),v(g?n.lemonsqueezy_subscription_id:null),w(null!==(a=n.variant_id)&&void 0!==a?a:null)):(u(f?"on_trial":null),h(f?"Pro":null),y(m),_(null),v(null),w(null)),d(b),p(b),I(b)}catch(e){console.error("Failed to fetch subscription status:",e),G(e instanceof Error?e.message:"An unknown error occurred while fetching subscription status"),L()}finally{M(!1)}},[]),q=(0,l.useCallback)(async()=>{try{var e;let t=await fetch("/api/start-trial",{method:"POST"}),a=await t.json().catch(()=>({}));if(t.ok&&(null==a?void 0:a.ok))return await U(),F(),(0,n.A)("Your 7-day Pro trial is live â no card needed","success"),{ok:!0};return{ok:!1,reason:null!==(e=null==a?void 0:a.reason)&&void 0!==e?e:"unknown"}}catch(e){return console.error("[SubscriptionProvider] startTrial failed:",e),{ok:!1,reason:"network"}}},[U]);return(0,l.useEffect)(()=>{U()},[U]),(0,l.useEffect)(()=>{let e=()=>{Date.now()-R.current<5e3||U()},t=()=>{"visible"===document.visibilityState&&e()};return window.addEventListener("focus",e),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",t)}},[U]),(0,r.jsx)(o.Provider,{value:{hasActiveAccess:a,subStatus:c,planName:m,endsAt:b,renewsAt:j,isProSub:f,lemonsqueezySubscriptionId:x,variantId:g,isLoading:E,error:P,refetchSubscription:U,isTrial:k,trialDaysLeft:S,trialUsed:D,startTrial:q},children:t})},c=()=>{let e=(0,l.useContext)(o);if(void 0===e)throw Error("useSubscription must be used within a SubscriptionProvider");return e}},55900:(e,t,a)=>{a.r(t),a.d(t,{default:()=>D});var r=a(95155),s=a(12115),n=a(75143),l=a(50402),i=a(78266),o=a(54165),d=a(30285),c=a(62523),u=a(85057),m=a(22346),h=a(66424),f=a(24944),p=a(48021),x=a(62525),v=a(84616),g=a(51154),w=a(40719),b=a(79536),y=a(65312),j=a(13960),_=a(86416),k=a(6982),N=a(35695);function S(e){return{id:crypto.randomUUID(),name:"Column ".concat(e+1),fakerMethod:""}}
1function C(e){let{col:t,onNameChange:a,onMethodChange:s,onDelete:n}=e,{attributes:o,listeners:u,setNodeRef:m,transform:h,transition:f,isDragging:v}=(0,l.gl)({id:t.id}),g={transform:i.Ks.Transform.toString(h),transition:f,opacity:v?.5:1};return(0,r.jsxs)("div",{ref:m,style:g,className:"flex items-center gap-2 bg-card px-2 py-2 transition-colors hover:bg-muted/30",children:[(0,r.jsx)("button",{className:"cursor-grab hover:cursor-grabbing text-muted-foreground hover:text-foreground shrink-0 p-0.5",...o,...u,"aria-label":"Drag to reorder",children:(0,r.jsx)(p.A,{className:"h-4 w-4"})}),(0,r.jsx)(c.p,{value:t.name,onChange:e=>a(t.id,e.target.value),placeholder:"Column name",className:"h-10 text-sm flex-1 min-w-0"}),(0,r.jsx)("div",{className:"shrink-0",children:(0,r.jsx)(w.v,{selectedType:t.fakerMethod||void 0,onTypeSelect:e=>s(t.id,e)})}),(0,r.jsx)(d.$,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:()=>n(t.id),"aria-label":"Remove column",children:(0,r.jsx)(x.A,{className:"h-4 w-4"})})]})}function D(e){let{open:t,onOpenChange:a}=e,i=(0,N.useRouter)(),{isProSub:p}=(0,j.R)(),x=p?_.AV.Pro.rows:_.AV.Free.rows,[w,D]=(0,s.useState)("Generated Dataset"),[A,E]=(0,s.useState)([S(0)]),[M,P]=(0,s.useState)(10),[G,R]=(0,s.use
1State)(!1),[T,F]=(0,s.useState)(0),I=(0,n.FR)((0,n.MS)(n.AN),(0,n.MS)(n.uN,{coordinateGetter:l.JR})),L=(0,s.useCallback)((e,t)=>E(a=>a.map(a=>a.id===e?{...a,name:t}:a)),[]),U=(0,s.useCallback)((e,t)=>E(a=>a.map(a=>a.id===e?{...a,fakerMethod:t}:a)),[]),q=(0,s.useCallback)(e=>E(t=>t.filter(t=>t.id!==e)),[]),z=()=>{D("Generated Dataset"),E([S(0)]),P(10),F(0)},O=e=>{G||(e||z(),a(e))},$=async()=>{let e=A.filter(e=>e.name.trim()&&e.fakerMethod);if(0===e.length){(0,k.A)("Add at least one column with a data type selected.","warning");return}let t=Math.min(M,x);R(!0),F(0);let r=(0,y.U)(),{data:s,error:n}=await r.rpc("can_create_dataset");if(n){(0,k.A)("Couldn't verify your dataset limit. Please try again.","error"),R(!1);return}if(!s){(0,k.A)("Dataset limit reached. Free plan allows 3 datasets. Upgrade to Pro for unlimited.","error"),R(!1);return}let l=e.map((e,t)=>({id:e.id,label:e.name.trim(),dataType:"faker",fakerMethod:e.fakerMethod,enabled:!0,order:t}));try{var o,d;let s=(await (0,b.OD)(l,{format:"csv",rowCount:t,filename:""},e=>F(e))).map(e=>e.map(String)),n=e.map(e=>e.name.trim()),c=w.trim()||"Generated Dataset",{data:u,error:m}=await r.from("datasets").insert({name:c,columns:n}).select("id").single();if(m||!u){let e=(null==m?void 0:m.code)==="23505"?'A dataset named "'.concat(c,'" already exists. Choose a different name.'):(null==m?void 0:null===(o=m.message)||void 0===o?void 0:o.includes("dataset_limit_reached"))?"Dataset limit reached. Free plan allows 3 datasets. Upgrade to Pro for unlimited.":"Error creating dataset.";(0,k.A)(e,"error"),R(!1);return}let{error:h}=await r.rpc("save_dataset_rows",{p_dataset_id:u.id,p_rows:s});if(h){let e=(null===(d=h.message)||void 0===d?void 0:d.includes("dataset_row_limit_exceeded"))?"Row limit reached (".concat(x," rows max on your plan)."):"Dataset created but rows failed to save.";(0,k.A)(e,"error"),R(!1);return}(0,k.A)("Dataset generated successfully","success"),z(),a(!1),i.push("/datasets/".concat(u.id))}catch(e){console.error("Generation error:",e),(0,k.A)("Error generating data. Check column configurations.","error")}finally{R(!1),F(0)}};return(0,r.jsx)(o.lG,{open:t,onOpenChange:O,children:(0,r.jsxs)(o.Cf,{className:"max-w-2xl max-h-[90vh] flex flex-col gap-0 p-0",children:[(0,r.jsx)("div",{className:"px-6 pt-6 pb-4",children:(0,r.jsxs)(o.c7,{children:[(0,r.jsx)(o.L3,{children:"Generate Dataset"}),(0,r.jsx)(o.rr,{children:"Define columns and pick a data type for each. Rows are generated using your configured types."})]})}),(0,r.jsx)(m.w,{}),(0,r.jsx)(h.F,{className:"flex-1",style:{maxHeight:"calc(90vh - 220px)"},children:(0,r.jsxs)("div",{className:"px-6 py-4 space-y-5",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)(u.Label,{htmlFor:"gen-name",children:"Dataset name"}),(0,r.jsx)(c.p,{id:"gen-name",value:w,onChange:e=>D(e.target.value),placeholder:"Generated Dataset"})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)(u.Label,{htmlFor:"gen-rows",children:["Number of rows"," ",(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(max ",x.toLocaleString(),")"]})]}),(0,r.jsx)(c.p,{id:"gen-rows",type:"number",min:1,max:x,value:M,onChange:e=>P(Math.min(x,Math.max(1,parseInt(e.target.value)||1))),inputMode:"numeric"})]})]}),(0,r.jsx)(m.w,{}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)(u.Label,{className:"text-sm font-medium",children:"Columns"}),(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border",children:(0,r.jsx)(n.Mp,{sensors:I,collisionDetection:n.fp,onDragEnd:e=>{let{active:t,over:a}=e;t.id!==(null==a?void 0:a.id)&&E(e=>{let r=e.findIndex(e=>e.id===t.id),s=e.findIndex(e=>e.id===(null==a?void 0:a.id));return(0,l.be)(e,r,s)})},children:(0,r.jsx)(l.gB,{items:A.map(e=>e.id),strategy:l._G,children:(0,r.jsx)("div",{className:"divide-y",children:A.map(e=>(0,r.jsx)(C,{col:e,onNameChange:L,onMethodChange:U,onDelete:q},e.id))})})})}),(0,r.jsxs)(d.$,{variant:"outline",size:"sm",onClick:()=>E(e=>[...e,S(e.length)]),className:"w-full border-dashed",children:[(0,r.jsx)(v.A,{className:"mr-2 h-4 w-4"}),"Add column"]})]})]})}),G&&(0,r.jsxs)("div",{className:"px-6 pb-3",children:[(0,r.jsxs)("div",{className:"flex justify-between text-xs text-muted-foreground mb-1",children:[(0,r.jsx)("span",{children:"Generatingâ¦"}),(0,r.jsxs)("span",{children:[Math.round(T),"%"]})]}),(0,r.jsx)(f.k,{value:T,className:"h-1.5"})]}),(0,r.jsx)(m.w,{}),(0,r.jsxs)(o.Es,{className:"px-6 py-4",children:[(0,r.jsx)(d.$,{variant:"outline",onClick:()=>O(!1),disabled:G,children:"Cancel"}),(0,r.jsx)(d.$,{onClick:$,disabled:G||A.every(e=>!e.fakerMethod),className:"min-w-[120px]",children:G?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(g.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Generatingâ¦"]}):"Generate"})]})]})})}},86416:(e,t,a)=>{a.d(t,{AV:()=>s,bP:()=>r});let r={monthly:6.99,yearly:69,yearlyNote:"2 months free"},s={Free:{datasets:3,rows:50},Pro:{datasets:Number.MAX_SAFE_INTEGER,rows:1e4}}}}]);
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.