1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{1562:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>G});var s=a(5155),n=a(2115),i=a(4624),r=a(2085),o=a(2596),c=a(9688);function d(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,c.QP)((0,o.$)(t))}let l=(0,r.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function m(e){let{className:t,variant:a,size:n,asChild:r=!1,...o}=e,c=r?i.DX:"button";return(0,s.jsx)(c,{"data-slot":"button",className:d(l({variant:a,size:n,className:t})),...o})}function h(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card",className:d("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...a})}function u(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card-header",className:d("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function p(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card-title",className:d("leading-none font-semibold",t),...a})}function g(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card-description",className:d("text-muted-foreground text-sm",t),...a})}function f(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"card-content",className:d("px-6",t),...a})}function w(e){let{className:t,type:a,...n}=e;return(0,s.jsx)("input",{type:a,"data-slot":"input",className:d("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n})}var b=a(7073);function x(e){let{className:t,...a}=e;return(0,s.jsx)(b.b,{"data-slot":"label",className:d("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...a})}var v=a(9869),y=a(1154),j=a(646),N=a(7809),k=a(3786),S=a(9785),T=a(4835);let C=0,F=new Map,M=e=>{if(F.has(e))return;let t=setTimeout(()=>{F.delete(e),I({type:"REMOVE_TOAST",toastId:e})},1e6);F.set(e,t)},U=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:a}=t;
1return a?M(a):e.toasts.forEach(e=>{M(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===a||void 0===a?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},E=[],A={toasts:[]};function I(e){A=U(A,e),E.forEach(e=>{e(A)})}function O(e){let{...t}=e,a=(C=(C+1)%Number.MAX_SAFE_INTEGER).toString(),s=()=>I({type:"DISMISS_TOAST",toastId:a});return I({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||s()}}}),{id:a,dismiss:s,update:e=>I({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function _(){let[e,t]=n.useState(A);return n.useEffect(()=>(E.push(t),()=>{let e=E.indexOf(t);e>-1&&E.splice(e,1)}),[e]),{...e,toast:O,dismiss:e=>I({type:"DISMISS_TOAST",toastId:e})}}function L(){let[e,t]=(0,n.useState)({address:null,isConnected:!1,chainId:null}),[a,s]=(0,n.useState)(!1),{toast:i}=_(),r="0x221";(0,n.useEffect)(()=>(o(),window.ethereum&&(window.ethereum.on("accountsChanged",c),window.ethereum.on("chainChanged",d)),()=>{window.ethereum&&(window.ethereum.removeListener("accountsChanged",c),window.ethereum.removeListener("chainChanged",d))}),[]);let o=async()=>{if(window.ethereum)try{let e=await window.ethereum.request({method:"eth_accounts"}),a=await window.ethereum.request({method:"eth_chainId"});e.length>0&&t({address:e[0],isConnected:!0,chainId:a})}catch(e){console.error("Error checking connection:",e)}},c=e=>{e.length>0?t(t=>({...t,address:e[0],isConnected:!0})):t({address:null,isConnected:!1,chainId:null})},d=e=>{t(t=>({...t,chainId:e}))},l=async()=>{if(!window.ethereum){i({title:"MetaMask not found",description:"Please install MetaMask to connect your wallet",variant:"destructive"});return}s(!0);try{let e=await window.ethereum.request({method:"eth_requestAccounts"}),a=await window.ethereum.request({method:"eth_chainId"});t({address:e[0],isConnected:!0,chainId:a}),a!==r&&await m(),i({title:"Wallet Connected",description:"Successfully connected to MetaMask"})}catch(e){console.error("Error connecting wallet:",e),i({title:"Connection Failed",description:e.message||"Failed to connect wallet",variant:"destructive"})}finally{s(!1)}},m=async()=>{try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})}catch(e){if(4902===e.code)try{await window.ethereum.request({method:"wallet_addEthereumChain",params:[{chainId:r,chainName:"Flow EVM Testnet",nativeCurrency:{name:"FLOW",symbol:"FLOW",decimals:18},rpcUrls:["https://testnet.evm.nodes.onflow.org"],blockExplorerUrls:["https://evm-testnet.flowscan.org"]}]})}catch(e){console.error("Error adding Flow EVM network:",e)}}};return{address:e.address,isConnected:e.isConnected,chainId:e.chainId,isConnecting:a,connectWallet:l,disconnectWallet:()=>{t({address:null,isConnected:!1,chainId:null})},switchToFlowEVM:m}}function P(){let{address:e,isConnected:t,isConnecting:a,connectWallet:n,disconnectWallet:i}=L();return(0,s.jsxs)(h,{children:[(0,s.jsxs)(u,{children:[(0,s.jsxs)(p,{className:"flex items-center gap-2",children:[(0,s.jsx)(S.A,{className:"h-5 w-5"}),"MetaMask Wallet"]}),(0,s.jsx)(g,{children:t?"Your wallet is connected and ready to mint NFTs on Flow EVM":"Connect your MetaMask wallet to mint food NFTs"})]}),(0,s.jsx)(f,{children:t?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"p-3 bg-green-50 border border-green-200 rounded-lg",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-green-800",children:"Connected to Flow EVM"}),(0,s.jsx)("p",{className:"text-sm text-green-600 font-mono",children:e})]}),(0,s.jsxs)(m,{onClick:i,variant:"outline",className:"w-full bg-transparent",children:[(0,s.jsx)(T.A,{className:"mr-2 h-4 w-4"}),"Disconnect Wallet"]})]}):(0,s.jsx)(m,{onClick:n,disabled:a,className:"w-full",children:a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(y.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Connecting..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(S.A,{className:"mr-2 h-4 w-4"}),"Connect MetaMask"]})})})]})}var R=a(7386),D=a(7105),B=a(1681);let V=["function mintFoodNFT(address to, string name, string description, string imageUrl, string tokenURI) public returns (uint256)","function totalSupply() public view returns (uint256)","function name() public view returns (string)","function symbol() public view returns (string)","function owner() public view returns (address)"];async function q(e,t,a,s){try{let n="0x344f59f3270a57ac589cce3a23b9f75bb665e0be31f4ed4cb238ed5e03d9318b";if(!n)throw Error("Sponsor private key not configured");let i=new R.FR("https://mainnet.evm.nodes.onflow.org"),r=new D.u(n,i),o=new B.NZ("0x1E9Fb7136a368dd3e52a1b99ED722e4993d9526E",V,r),c=await o.mintFoodNFT(s,e,t,a,'{"name":"'.concat(e,'","description":"').concat(t,'","image":"').concat(a,'"}')),d=await c.wait(),l="".concat("https://evm.flowscan.io","/tx/").concat(d.hash);return{success:!0,tokenId:"1",explorerUrl:l}}catch(e){return{success:!1,error:e.message}}}
1function G(){let[e,t]=(0,n.useState)(null),[a,i]=(0,n.useState)(null),[r,o]=(0,n.useState)([]),[c,d]=(0,n.useState)(!1),[l,b]=(0,n.useState)({}),[S,T]=(0,n.useState)({}),{address:C,isConnected:F}=L(),{toast:M}=_(),U=e=>{let t=e.toLowerCase();return t.includes("brooklan")||t.includes("classic burger")||t.includes("s.s.b.u")?[{name:"Classic Burger",description:"American cheese, special sauce, lettuce, tomato, onion, pickles",imageUrl:"https://images.unsplash.com/photo-1568901346375-23c9450c58cd?w=400&h=300&fit=crop"},{name:"S.S.B.U",description:"2 patties, blue cheese cheddar cheese, bacon, chipotle mayo, BBQ sauce",imageUrl:"https://images.unsplash.com/photo-1571091718767-18b5b1457add?w=400&h=300&fit=crop"},{name:"Simple & Clean (Vegan Burger)",description:"Teriyaki sauce, sliced cucumbers, shaved carrots, vegan sriracha mayo",imageUrl:"https://images.unsplash.com/photo-1525059696034-4967a729002e?w=400&h=300&fit=crop"},{name:"Double Detroit Smash Burger",description:"2 smash patties, monterey jack, jalapeno relish, chipotle mayo",imageUrl:"https://images.unsplash.com/photo-1594212699903-ec8a3eca50f5?w=400&h=300&fit=crop"},{name:"Honey Chicken Sandwich",description:"Fried chicken tenders with pickled cabbage, garlic aioli, and topped off with hot honey",imageUrl:"https://images.unsplash.com/photo-1606755962773-d324e2dabd3f?w=400&h=300&fit=crop"},{name:"B.L.T.",description:"Thick cut bacon, lettuce, tomato",imageUrl:"https://images.unsplash.com/photo-1553909489-cd47e0ef937f?w=400&h=300&fit=crop"},{name:"Grilled Cheese",description:"Gooey monterey jack and sharp cheddar",imageUrl:"https://images.unsplash.com/photo-1528736235302-52922df5c122?w=400&h=300&fit=crop"},{name:"Chicken Tenders",description:"Served with two of our homemade sauces",imageUrl:"https://images.unsplash.com/photo-1562967914602-bb080dd4f877?w=400&h=300&fit=crop"},{name:"Quesadilla",description:"Gooey monterey jack and our homemade pico de gallo",imageUrl:"https://images.unsplash.com/photo-1565299624946-b28f40a0ca4b?w=400&h=300&fit=crop"},{name:"Buffalo Chicken Tacos",description:"3 Tacos - grilled chicken, buffalo sauce, blue cheese dressing, cabbage",imageUrl:"https://images.unsplash.com/photo-1565299507177-bb080dd4f877?w=400&h=300&fit=crop"},{name:"Caesar Salad",description:"Romaine, homemade dressing, sourdough croutons, and shaved parmesan cheese",imageUrl:"https://images.unsplash.com/photo-1546793665062-69928b1d9587?w=400&h=300&fit=crop"},{name:"Fried Pickles",description:"Hand-breaded in-house, served with chipotle mayo and ranch",imageUrl:"https://images.unsplash.com/photo-1573080496219-bb080dd4f877?w=400&h=300&fit=crop"},{name:"Chopped Cheese Fries",description:"Burger patty with melted american, special sauce, and jalapenos",imageUrl:"https://images.unsplash.com/photo-1573080496219-bb080dd4f877?w=400&h=300&fit=crop"},{name:"Hand Cut Fries",description:"Ask about making them cajun!",imageUrl:"https://images.unsplash.com/photo-1573080496219-bb080dd4f877?w=400&h=300&fit=crop"},{name:"Fried Oreos",description:"Served with chocolate dipping sauce",imageUrl:"https://images.unsplash.com/photo-1578985545062-69928b1d9587?w=400&h=300&fit=crop"}]:t.includes("black flag lemonade")||t.includes("galacta")||t.includes("yoshi")?[{name:"BLACK FLAG LEMONADE",description:"Rum, Lemon Juice, Simple Syrup",imageUrl:"https://images.unsplash.com/photo-1621263764928-df1444c5e859?w=400&h=300&fit=crop"},{name:"Princess on the Peach",description:"Peach Schnapps, Vodka, Orange Juice, Cranberry",imageUrl:"https://images.unsplash.com/photo-1544145945857-3bc16c4c7d1b?w=400&h=300&fit=crop"},{name:"Yoshi's Bender",description:"Midori, Vodka, Lemon Juice",imageUrl:"https://images.unsplash.com/photo-1514362545857-3bc16c4c7d1b?w=400&h=300&fit=crop"},{name:"FALCON PUNCH",description:"Rum, Pineapple, Orange Juice, Lime, Grenadine",imageUrl:"https://images.unsplash.com/photo-1536935338788-46ad1756a187?w=400&h=300&fit=crop"},{name:"TWILIGHT PRINCESS",description:"Makers Mark, Lemon Juice, Raspberry",imageUrl:"https://images.unsplash.com/photo-1470337458703-005eec06c04b?w=400&h=300&fit=crop"},{name:"XP MARTINI",description:"Tequila, Cold Brew, Coffee Liquor, Oatmilk, Simple Syrup",imageUrl:"https://images.unsplash.com/photo-1514933651103-46ad1756a187?w=400&h=300&fit=crop"},{name:"SUPER MONKEY BALL 2",description:"Rum, Lime Juice, Banana Liquor, Cinnamon, Bitters",
1imageUrl:"https://images.unsplash.com/photo-1551538827-9c037cb4f32a?w=400&h=300&fit=crop"},{name:"GALACTA'S FAVORITE",description:"Gin, Lime, Blueberry Syrup, Simple Syrup",imageUrl:"https://images.unsplash.com/photo-1541746972996-4e0b0f93e586?w=400&h=300&fit=crop"},{name:"SLURM!",description:"Rum, Lemon Juice, Blue Curacao, Midori, Honey",imageUrl:"https://images.unsplash.com/photo-1609951651556-5334e2706168?w=400&h=300&fit=crop"}]:null},E=async()=>{if(e){d(!0);try{let t=await new Promise(t=>{let a=new FileReader;a.onload=e=>{var a;return t(null===(a=e.target)||void 0===a?void 0:a.result)},a.readAsDataURL(e)}),a=await fetch("/api/extract-text",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:t})}),s=await a.json();if(!s.success)throw Error("Failed to extract menu text");let n=U(s.text);if(n)o(n),M({title:"Menu Recognized!",description:"Loaded ".concat(n.length," items from our curated database")});else{let e=s.text.split("\n").filter(e=>e.trim().length>0),t=[];e.forEach(e=>{let a=e.trim();if(a.length>3&&!a.match(/^\$?\d+\.?\d*$/)&&!a.match(/^(menu|appetizers|entrees|desserts|drinks)$/i)){let e=a.split(/\s{2,}|\t/),s=e[0].replace(/\$?\d+\.?\d*$/,"").trim(),n=e[1]||void 0;s.length>2&&t.push({name:s,description:n})}});let a=await fetch("/api/find-food-images",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({menuItems:t})}),n=await a.json();if(!n.success)throw Error("Failed to find food images");o(n.images),M({title:"Menu Processed!",description:"Found ".concat(n.images.length," food items with images")})}}catch(e){console.error("Error processing menu:",e),M({title:"Processing Failed",description:e.message||"Failed to process menu image",variant:"destructive"})}finally{d(!1)}}},A=async e=>{if(!C){M({title:"Wallet not connected",description:"Please connect your MetaMask wallet first",variant:"destructive"});return}let t=e.name;b(e=>({...e,[t]:!0}));try{let a=await q(e.name,e.description,e.imageUrl,C);if(a.success&&a.tokenId&&a.explorerUrl)T(e=>({...e,[t]:{tokenId:a.tokenId,explorerUrl:a.explorerUrl}})),M({title:"NFT Minted Successfully!",description:"Your ".concat(e.name," NFT has been minted! Token ID: ").concat(a.tokenId)});else throw Error(a.error||"Minting failed")}catch(e){console.error("Minting failed:",e),M({title:"Minting Failed",description:e.message||"There was an error minting your NFT. Please try again.",variant:"destructive"})}finally{b(e=>({...e,[t]:!1}))}};return(0,s.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-orange-50 to-red-50 p-4",children:(0,s.jsxs)("div",{className:"max-w-4xl mx-auto space-y-8",children:[(0,s.jsxs)("div",{className:"text-center space-y-4",children:[(0,s.jsx)("h1",{className:"text-4xl font-bold text-gray-900",children:"Menu NFT Generator"}),(0,s.jsx)("p",{className:"text-lg text-gray-600",children:"Upload your menu image and mint NFTs of your favorite dishes on Flow EVM Mainnet"})]}),(0,s.jsx)(P,{}),(0,s.jsxs)(h,{className:"w-full",children:[(0,s.jsxs)(u,{children:[(0,s.jsxs)(p,{className:"flex items-center gap-2",children:[(0,s.jsx)(v.A,{className:"h-5 w-5"}),"Upload & Process Menu"]}),(0,s.jsx)(g,{children:"Upload your menu image and we'll find matching food images instantly"})]}),(0,s.jsxs)(f,{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid w-full max-w-sm items-center gap-1.5",children:[(0,s.jsx)(x,{htmlFor:"menu-image",children:"Menu Image"}),(0,s.jsx)(w,{id:"menu-image",type:"file",accept:"image/*",onChange:e=>{var a;let s=null===(a=e.target.files)||void 0===a?void 0:a[0];if(s&&s.type.startsWith("image/")){t(s);let e=new FileReader;e.onload=e=>{var t;i(null===(t=e.target)||void 0===t?void 0:t.result)},e.readAsDataURL(s)}},className:"cursor-pointer"})]}),a&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"border rounded-lg p-4",children:(0,s.jsx)("img",{src:a||"/placeholder.svg",alt:"Menu preview",className:"max-w-full h-auto max-h-96 mx-auto rounded"})}),(0,s.jsx)(m,{onClick:E,disabled:c,className:"w-full",children:c?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(y.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing Menu..."]}):"Process Menu & Find Food Images"})]})]})]}),r.length>0&&(0,s.jsxs)(h,{children:[(0,s.jsxs)(u,{children:[(0,s.jsx)(p,{children:"Your Menu Items"}),(0,s.jsxs)(g,{children:["Ready to mint as NFTs on Flow EVM Mainnet",F&&" - Click 'Order This' to mint!"]})]}),(0,s.jsx)(f,{children:(0,s.jsx)("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:r.map((e,t)=>{let a=e.name,n=l[a]||!1,i=S[a];return(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border overflow-hidden",children:[(0,s.jsx)("img",{src:e.imageUrl||"/placeholder.svg",alt:e.name,className:"w-full h-48 object-cover"}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("h3",{className:"font-semibold text-gray-900 mb-2",children:e.name}),(0,s.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:e.description}),F&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(m,{onClick:()=>A(e),disabled:n||!!i,className:"w-full ".concat(i?"bg-green-600 hover:bg-green-700":"bg-orange-600 hover:bg-orange-700"),
1children:n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(y.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Minting NFT..."]}):i?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(j.A,{className:"mr-2 h-4 w-4"}),"NFT Minted!"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.A,{className:"mr-2 h-4 w-4"}),"Order This"]})}),i&&(0,s.jsxs)(m,{variant:"outline",size:"sm",className:"w-full bg-transparent",onClick:()=>window.open(i.explorerUrl,"_blank"),children:[(0,s.jsx)(k.A,{className:"mr-2 h-4 w-4"}),"View NFT on Chain"]})]})]})]},t)})})})]})]})})}},4176:(e,t,a)=>{Promise.resolve().then(a.bind(a,1562))}},e=>{var t=t=>e(e.s=t);e.O(0,[143,441,684,358],()=>t(4176)),_N_E=e.O()}]);
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.