"use strict";(()=>{var r={};r.id=1245,r.ids=[1245],r.modules={20399:r=>{r.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:r=>{r.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},29790:(r,e,t)=>{t.r(e),t.d(e,{originalPathname:()=>m,patchFetch:()=>y,requestAsyncStorage:()=>l,routeModule:()=>c,serverHooks:()=>f,staticGenerationAsyncStorage:()=>d});var n={};t.r(n),t.d(n,{GET:()=>p});var i=t(49303),s=t(88716),o=t(60670),a=t(87070),u=t(69644);async function p(){try{let r=(await (0,u.kl)()||[]).map(r=>({id:r.id,name:r.name,type:r.type}));return a.NextResponse.json({stores:r})}catch(r){return a.NextResponse.json({error:r?.message||"Failed to load Printful stores."},{status:500})}}let c=new i.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/printful/stores/route",pathname:"/api/printful/stores",filename:"route",bundlePath:"app/api/printful/stores/route"},resolvedPagePath:"/root/ShiftedOffRoad/app/api/printful/stores/route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:l,staticGenerationAsyncStorage:d,serverHooks:f}=c,m="/api/printful/stores/route";function y(){return(0,o.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:d})}},69644:(r,e,t)=>{async function n(r,e){let t=await fetch(`https://api.printful.com${r}`,{...e,headers:{...function(){let r=process.env.PRINTFUL_ACCESS_TOKEN;if(!r)throw Error("Missing PRINTFUL_ACCESS_TOKEN.");let e={Authorization:`Bearer ${r}`,"Content-Type":"application/json"},t=process.env.PRINTFUL_STORE_ID;return t&&(e["X-PF-Store-Id"]=t),e}(),...e?.headers||{}}}),n=await t.json();if(!t.ok)throw Error(n?.error?.message||n?.error||n?.result?.error||`Printful request failed (${t.status})`);return n.result}async function i(r=20,e=0){let t=new URLSearchParams({limit:String(r),offset:String(e)}),i=await n(`/store/products?${t.toString()}`);return Array.isArray(i)?i:i?.items&&Array.isArray(i.items)?i.items:[]}async function s(){return n("/stores")}async function o(){return n("/oauth/scopes")}async function a(r){return n("/store/products",{method:"POST",body:JSON.stringify(r)})}function u(r){if(!r||!r.sync_product)return null;let e=r.sync_variants?.[0],t=e?.retail_price?Number(e.retail_price):NaN,n=Number.isFinite(t)?Math.round(100*t):null;return{id:String(r.sync_product.id),stripeProductId:String(r.sync_product.id),stripePriceId:e?.id?String(e.id):null,name:r.sync_product.name,description:null,unitAmount:n,currency:e?.currency??null,thumbnailUrl:r.sync_product.thumbnail_url??null}}t.d(e,{E3:()=>i,Pi:()=>u,kl:()=>s,lr:()=>a,zw:()=>o})}};var e=require("../../../../webpack-runtime.js");e.C(r);var t=r=>e(e.s=r),n=e.X(0,[9276,5972],()=>t(29790));module.exports=n})();