1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Patch360Viewer-B9sbEqeL.js","assets/index-DGIQy-Di.js","assets/index-Dy6lxwh7.css","assets/pricing-8QahN4-B.js","assets/firstOrderCoupon-B1QH775H.js","assets/OrderModal-YkT0WyFg.js","assets/confetti.module-D_RVyC63.js","assets/samples-BvVsYfUw.js","assets/quotePrefill-COxhBSgQ.js","assets/patchTypeDisplay-Ba0TTjQ0.js","assets/quoteScreen-CsErdbKa.js","assets/customFields-DfzlS-Y4.js","assets/inches-DEj62_ef.js","assets/UnitToggle-Crtn6nwD.js","assets/pantonePalette-Cr135vo9.js","assets/paletteLimits-D6HtWkBt.js","assets/benefitPills-Dky7IZ7Z.js","assets/CurrencyEstimate-C9wIwmAC.js","assets/Patch360Viewer-DJd1t-4H.css"])))=>i.map(i=>d[i]); 2import{av as mo,a as Te,z as In,aw as si,r as h,j as e,c as go,an as yn,am as Ya,H as Pe,I as Ln,ax as fo,ay as da,x as yo,u as bo,y as rt,az as oi,aA as wo,aB as ko,aC as xo,aD as vo,aE as So,aF as jo,aG as _o,d as Za,aH as Li,aI as To,aJ as Fn,b as Io,aK as Lo,aL as Co,aM as Ao,aN as No,aO as Ro,aP as Eo,aQ as Po,aR as Bo,_ as Oo,aS as $o,p as Mo,ap as Fo,e as Ss,Q as js,aT as Do,f as Qn,s as zo,h as Ho,aU as Wo,aV as Uo}from"./index-DGIQy-Di.js";import{t as li,m as Go,n as _s,P as Gt,o as Cr,p as ci,c as _r,q as Ts,a as qo,i as Ci,u as Is}from"./pricing-8QahN4-B.js";import{F as Ut}from"./firstOrderCoupon-B1QH775H.js";import Vo from"./OrderModal-YkT0WyFg.js";import{e as Ko,a as Yo}from"./pantonePalette-Cr135vo9.js";import{P as Ai}from"./paletteLimits-D6HtWkBt.js";import{d as Qo,W as Jo,a as Qa,s as Zo,S as Xo,p as zr,b as Wr}from"./inches-DEj62_ef.js";import{i as el}from"./quoteScreen-CsErdbKa.js";import{a as Ls,c as tl,O as Dn,o as bn,h as al,r as rl,b as Cn}from"./customFields-DfzlS-Y4.js";import{c as nl}from"./benefitPills-Dky7IZ7Z.js";import{U as Cs}from"./UnitToggle-Crtn6nwD.js";import{C as Ni}from"./CurrencyEstimate-C9wIwmAC.js";import{s as il,a as Ri,c as sl,d as ol}from"./samples-BvVsYfUw.js";import{c as ll}from"./quotePrefill-COxhBSgQ.js";const cl={label:"YMCA",emoji:"ð",colors:"any color, vibrant, rich full-color palette with multiple hues",mandatoryElements:"IMPORTANT: The design must be a rich, colorful, detailed illustration filling the entire patch - like a painted scene or picture postc
2ard. Include a tiny subtle Y logo or small 'YMCA' wordmark tucked into a corner or border taking up less than 5% of the total design area. The Y/YMCA branding must NOT be the focal point - the illustrated scene IS the focal point",shapeHint:"circle or shield",imagery:"ONE illustrated scene chosen to match THIS specific event or program â pick only what fits the user's actual event. YMCA runs a huge range: aquatics/swim meets (pool, swimmers), sports leagues (basketball, soccer, flag football), after-school & youth programs, day-camp play, gymnastics/dance, holiday & family events, community service projects, fundraisers, awards nights, etc. Use the imagery that belongs to the described event. Do NOT default to a campfire, bonfire, river, or rafting scene â those belong only when the event is explicitly a sleepaway camp-out or a whitewater/river trip. Always a full colorful detailed illustration, not just icons.",typography:"sans-serif, clean and modern, very readable, text should complement the illustration not dominate it",mood:"community-oriented, energetic, youth-friendly, welcoming, fun, kids oriented, family, richly illustrated, colorful and scenic like a picture postc
2ard",textPlacement:"event name in a small arc or banner at top; tiny YMCA mark in corner or woven into border; current year at bottom arc - text elements should be secondary to the illustration"},dl={label:"Law Enforcement",emoji:"ð¡ï¸",colors:"navy blue, gold/yellow, silver, red, black, white - authoritative badge palette with one strong accent color from the department (e.g. red for fire, navy for police)",mandatoryElements:"Badge-style form factor - shield, star, or Maltese cross. Bold outlined border, authoritative typography. When department is a fire service, include a Maltese cross, flames, axe, or ladder. When police or sheriff, include a star, eagle, or thin blue/gold line. When private security, include a shield with company mark and strong border - never a direct copy of a government insignia",shapeHint:"shield or star",imagery:"eagle, shield, star, Maltese cross, scales of justice, flames, fire axe/ladder, city skyline, laurel wreath, thin-line stripe, lock, badge star - pick imagery appropriate to the specific force (police vs fire vs security)",typography:"bold serif or block capitals, highly authoritative, heavy weight",mood:"official, heroic, service, authoritative, institutional, protective, brotherhood",textPlacement:"department or company name in the top arc, city/state or station number in the bottom arc, badge number or motto in the center"},hl={label:"Scouts",emoji:"ðï¸",colors:"olive green, khaki, navy blue, gold/yellow, red, white",mandatoryElements:"fleur-de-lis or trefoil symbol, rope border motif, merit badge ring",shapeHint:"circle or octagon",imagery:"campfire, tent, eagle, compass, pine trees, knot, stars",typography:"bold serif or block sans-serif, classic and sturdy",mood:"heritage, adventure, achievement, outdoor tradition",textPlacement:"troop number top arc, event or location name bottom arc"},ul={label:"Police",emoji:"ð",colors:"navy blue, gold/yellow, silver, white, black",mandatoryElements:"shield or star badge shape, eagle or city seal at top",shapeHint:"shield or star",imagery:"eagle, scales of justice, city skyline, thin blue line, badge star, laurel wreath",typography:"bold serif or block capitals, highly authoritative",mood:"official, professional, authoritative, institutional",textPlacement:"department name top arc, city/state at bottom, badge number center"},pl={label:"Military",emoji:"ð¦
",colors:"OD green, coyote brown, black, gold, red, white - or full dress uniform colors",mandatoryElements:"eagle, stars, rank insignia or unit crest, bold border",shapeHint:"shield, circle, or rounded rectangle",imagery:"eagle, anchor, crossed rifles, globe, parachute, wings, American flag elements",typography:"block capitals, military stencil or serif, no decorative fonts",mood:"disciplined, patriotic, powerful, precise",textPlacement:"unit name top arc, motto or MOS number at bottom"},ml={label:"Karate",emoji:"ð¥",colors:"red, black, gold/yellow, white",mandatoryElements:"kanji or Asian calligraphy element, strong central graphic",shapeHint:"circle or octagon",imagery:"dragon, tiger, yin-yang, rising sun, fist, flying kick silhouette, Japanese flags",typography:"bold brush-stroke style or clean bold block, may include kanji",mood:"powerful, disciplined, traditional Asian aesthetic, respect",textPlacement:"school/dojo name top, rank or belt level bottom"},gl={label:"Firefighter",emoji:"ð¥",colors:"red, black, gold/yellow, white, silver",mandatoryElements:"maltese cross or Maltese cross with flame, fire department shield or helmet",shapeHint:"shield or Maltese cross",imagery:'flames, fire axe, ladder, helmet, hose, hydrant, "FD" letters',typography:"bold block or serif, strong and heavy weight",mood:"heroic, bold, service, brotherhood",textPlacement:"department name top arc, station number or city bottom arc"},fl={label:"Sports",emoji:"â½",colors:"team colors (vibrant, bold, high contrast)",mandatoryElements:"sport-specific ball or equipment icon, team name, team mascot or animal",shapeHint:"circle or shield",imagery:"sport ball, player silhouette, mascot animal, field/court lines, trophy, laurel",typography:"bold athletic font, strong weight, may have italic slant",mood:"competitive, energetic, pride, team spirit",textPlacement:"team name top arc or center, season year or location at bottom"},yl={label:"Corporate",emoji:"ð¼",colors:"brand colors (clean, professional), navy, gray, gold, white",mandatoryElements:"company logo or initials, clean professional border",shapeHint:"circle, oval, or rectangle",imagery:"abstract logo mark, geometric shapes, minimal icons representing industry",typography:"clean sans-serif, modern, professional weight",mood:"premium, trustworthy, clean, sophisticated",textPlacement:"company name prominent center or top arc, tagline or year at bottom"},bl={label:"Security",emoji:"ð¡ï¸",colors:"navy blue, black, gold/silver, white, red accent",mandatoryElements:"shield shape, company name or initials, strong bold border",shapeHint:"shield or circle",imagery:"shield, eagle, lock, star, key, protective hands, badge, surveillance camera",typography:"bold serif or block caps, authoritative and trustworthy",mood:"professional, protective, reliable, authoritative",textPlacement:'company name top arc, service tagline or "SECURITY" at bottom'}
2,wl={label:"School",emoji:"ð",colors:"school colors (typically two-tone), gold, navy, red, green",mandatoryElements:"school mascot or crest, school initials or name",shapeHint:"shield or circle",imagery:"owl, lion, eagle, torch, book, diploma scroll, academic cap, laurel wreath",typography:"bold serif or strong sans-serif, classic academic style",mood:"academic pride, tradition, achievement",textPlacement:"school name top, class year or motto bottom"},kl={label:"Motorcycle",emoji:"ðï¸",colors:"black, orange, red, silver chrome, white - bold high contrast",mandatoryElements:"eagle wings or skull motif, motorcycle wheel or engine element",shapeHint:"rocker bar shape, diamond, or circle",imagery:"eagle, skull, wings, flame, wheel, lightning bolt, road, custom motorcycle",typography:"heavy gothic or old-english block letters, very bold",mood:"rebellious, freedom, brotherhood, rugged",textPlacement:"club name on top rocker bar, location/chapter on bottom rocker"},xl={label:"Camp",emoji:"ð²",colors:"forest green, brown, sky blue, gold, orange",mandatoryElements:"nature scene or camp icon, camp name",shapeHint:"circle or shield",imagery:"pine trees, mountain, campfire, canoe, lake, sun, moon, wildlife (deer, bear, owl)",typography:"friendly bold sans-serif or rustic slab-serif",mood:"outdoorsy, adventurous, fun, nature-connected",textPlacement:"camp name top arc, year or location at bottom"},vl={label:"Social",emoji:"ð",colors:"bright, celebratory - event-specific palette, warm yellows, pinks, blues",mandatoryElements:"event name prominently featured, theme-appropriate icon",shapeHint:"circle or custom shape",imagery:"confetti, stars, music notes, sport icons, holiday symbols - matches event theme",typography:"friendly rounded sans-serif, fun and upbeat",mood:"celebratory, commemorative, community, fun",textPlacement:"event name top/center, date or location at bottom"},Sl={label:"Other",emoji:"â¦",colors:"bold and high-contrast, appropriate to the subject",mandatoryElements:"clear central graphic, readable text, clean border",shapeHint:"circle",imagery:"relevant to the described theme or organization",typography:"bold sans-serif, clean and legible",mood:"professional, polished, emblem-style",textPlacement:"main text top arc or center, secondary info at bottom"},wn={YMCA:cl,LawEnforcement:dl,Scouts:hl,Police:ul,Military:pl,Karate:ml,Firefighter:gl,Sports:fl,Corporate:yl,Security:bl,School:wl,Motorcycle:kl,Camp:xl,Social:vl,Other:Sl};function Hr(){try{let t=localStorage.getItem("pd_anon_id");return t||(t=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"a-"+Date.now().toString(36)+Math.random().toString(36).slice(2,10),localStorage.setItem("pd_anon_id",t)),t}catch{return null}}let di={userId:null,orgToken:null,getToken:null};function jl(t){di={userId:t&&t.userId||null,orgToken:t&&t.orgToken||null,getToken:t&&typeof t.getToken=="function"?t.getToken:null}}function _l(){return di}const Tl=2500;async function As({timeoutMs:t=Tl}={}){const{userId:a,getToken:s}=di;if(!a||!s||mo())return{};let i=null;try{const o=await Promise.race([Promise.resolve().then(()=>s()),new Promise(l=>{i=setTimeout(()=>l(null),t)})]);return typeof o=="string"&&o?{"X-Clerk-Token":o}:{}}catch{return{}}finally{i&&clearTimeout(i)}}function hi(t){const a=li(t);if(a)return a.description?`${a.label} patch look: ${a.description}. A real manufactured patch in that material`:hi(a.baseLabel);const s=(t||"").toLowerCase();return s.includes("pvc")&&s.includes("3d")?"PVC 3D rubber patch look with deeply sculpted, multi-level raised relief â each color layer sits at a different height with visible beveled edges, soft shadows between layers, and a glossy molded finish (think of a puffy 3D toy character rendered as a patch)":s.includes("pvc")?"PVC 2D rubber patch look with a flat, smooth molded surface â thin raised outlines separating each color region, clean sharp edges, subtle matte rubber sheen, no deep relief or dramatic layer heights (think of a flat silicone luggage tag)":s.includes("woven")?"woven patch look with fine detailed weave texture and smooth flat surface":s.includes("chenille")?"chenille varsity-letter patch look â the design is built from THICK, PLUSH, RAISED LOOPED YARN (the soft fuzzy 3D pile of a letterman-jacket letter) on a felt backing, finished with a chain-stitch or embroidered outline border. Chenille is the COARSEST patch material: it can ONLY form big bold chunky shapes and thick block letters, shown as a few large areas of fuzzy raised pile with clean simple edges. NO fine detail, NO faces or portraits, NO thin lines, NO small text, NO gradients or photo-realism â intricate detail is physically impossible in chenille yarn":s.includes("print")||s.includes("sublim")||s.includes("photo")?"printed / dye-sublimation patch look â flat smooth fabric surface with the design rendered as a photo-quality printed image directly into the polyester base, supporting unlimited colors, smooth gradients, fine detail, and ph
2oto-realistic shading. Crisp merrowed border around the outer edge. No visible thread texture, no satin stitches, no raised dimension on the design itself â the design reads like a high-quality printed photograph integrated into the fabric":"embroidered patch look with visible thread texture and satin stitch detail"}function Il(t){return` MATERIAL FINISH (unchanged by this edit): render the result as a ${hi(t)}. Keep the same physical craft and finish as the reference image â a real manufactured patch, NOT flat vector clip-art, NOT a sticker, NOT a printed illustration of a patch. Keep the patch on a plain flat near-white background; do not lay it on fabric, a garment, or any textured surface.`}const ui=t=>!!(t&&t.success&&t.source==="guidelines");function pi(t){const a=t&&t.houseKit;return!a||typeof a!="object"||ui(t.brandContext)?null:a}const Tr=(t,a)=>Array.isArray(t)?t.filter(s=>typeof s=="string"&&s.trim()).slice(0,a):[];function mi(t){const a=Tr(t&&t.fonts,4),s=Tr(t&&t.rules,10),i=Tr(t&&t.avoid,10);return(a.length?` Lettering: set all text in ${a.join(" or ")}${a.length>1?" (the first is the main font)":""}, or the closest match.`:"")+(s.length?` REQUIRED rules: ${s.join("; ")}.`:"")+(i.length?` NEVER: ${i.join("; ")}.`:"")+(s.length||i.length?" These rules are instructions for how to design the patch: never print the words of these rules on the patch.":"")}function Ns(t){if(!t||typeof t!="object")return"";const a=Tr(t.colors,8),s=mi(t);return!a.length&&!s?"":` 3HOUSE STYLE (the maker's own guidelines):${a.length?` Prefer these house colors where the design has no brand palette of its own: ${a.join(", ")}.`:""}${s}`}function Rs(t){const a=t&&t.brandContext;if(ui(a)){const s=Tr(a.colors,8),i=s.length?` Use these brand colors as the palette: ${s.join(", ")}.`:"",o=mi(a);return!i&&!o?"":` 4BRAND GUIDELINES for "${a.name||"this brand"}" (the customer's own, REQUIRED):${i}${o}`}return Ns(pi(t))}function Ll(t){const a=t&&t.brandContext,s=ui(a)?a:pi(t);if(!s)return[];const i=Tr(s.fonts,4);return(Array.isArray(s.customFonts)?s.customFonts:[]).filter(o=>o&&o.specimenUrl&&i.includes(o.name)).slice(0,2).map(o=>({name:o.name,url:o.specimenUrl}))}const Ei=` 5 6BACKGROUND: place the patch on a single flat NEAR-WHITE studio backdrop (white, off-white, cream or very pale gray), never black or any dark or saturated color, even when the brand or reference uses dark colors. Dark colors belong only inside the patch (its border and artwork). Keep a clear light margin around the whole silhouette, with no shadow, panel, vignette or scenery.`;async function Cl(t){try{const a=await Rl(t),s=document.createElement("canvas");s.width=a.naturalWidth,s.height=a.naturalHeight;const i=s.getContext("2d",{willReadFrequently:!0});i.drawImage(a,0,0);const o=i.getImageData(0,0,s.width,s.height),l=o.data,u=s.width,p=s.height,g=new Map,b=(M,N)=>{const D=(N*u+M)*4,te=l[D],A=l[D+1],v=l[D+2],ge=`${Math.round(te/24)*24},${Math.round(A/24)*24},${Math.round(v/24)*24}`,K=g.get(ge);K?(K.r+=te,K.g+=A,K.b+=v,K.count++):g.set(ge,{r:te,g:A,b:v,count:1})};for(let M=0;M<u;M+=4)b(M,0),b(M,p-1);for(let M=0;M<p;M+=4)b(0,M),b(u-1,M);let y=null,T=0;for(const M of g.values())M.count>T&&(T=M.count,y=M);if(!y)return null;const j=y.r/y.count,P=y.g/y.count,S=y.b/y.count,R=.299*j+.587*P+.114*S;if(R<50)return console.warn("[PatchDesign] removeBackground: dominant edge color is near-black (lum="+R.toFixed(0)+") â preserving outer border, skipping flood-fill."),null;const L=784*3,k=new Uint8Array(u*p),I=[];for(let M=0;M<u;M++)I.push(M,0),I.push(M,p-1);for(let M=1;M<p-1;M++)I.push(0,M),I.push(u-1,M);const E=M=>{const N=l[M],D=l[M+1],te=l[M+2];return(N-j)*(N-j)+(D-P)*(D-P)+(te-S)*(te-S)<=L};let F=0;for(;F<I.length;){const M=I[F++],N=I[F++];if(M<0||M>=u||N<0||N>=p)continue;const D=N*u+M;if(k[D])continue;const te=D*4;E(te)&&(k[D]=1,l[te+3]=0,I.push(M+1,N,M-1,N,M,N+1,M,N-1))}const _=90,Y=170,V=new Uint8Array(u*p);for(let M=1;M<p-1;M++)for(let N=1;N<u-1;N++){const D=M*u+N;if(k[D])continue;const te=D*4;E(te)&&(k[D-1]||k[D+1]||k[D-u]||k[D+u])&&(l[te+3]=Math.min(l[te+3],_),V[D]=1)}for(let M=1;M<p-1;M++)for(let N=1;N<u-1;N++){const D=M*u+N;if(k[D]||V[D])continue;const te=D*4;E(te)&&(V[D-1]||V[D+1]||V[D-u]||V[D+u])&&(l[te+3]=Math.min(l[te+3],Y))}return i.putImageData(o,0,0),s.toDataURL("image/png")}catch(a){return console.warn("[PatchDesign] Flood-fill bg removal error:",a),null}}async function Al(t){const a={croppedDataUrl:t,shape:"",shapeConfidence:"low",hasBusyBackgroun
6d:!1,applied:{cropped:!1,shapeDetected:!1}};if(!t||typeof t!="string")return a;const s=t.match(/^data:(image\/(?:png|jpe?g|webp));base64,(.+)$/i);if(!s)return a;const i=s[1].toLowerCase().replace("jpg","jpeg"),o=s[2];let l;try{l=await kn(t,1024)}catch{l=t}const u=l.match(/^data:(image\/(?:png|jpe?g|webp));base64,(.+)$/i),p=u?u[2]:o,g=u?u[1].toLowerCase().replace("jpg","jpeg"):i;let b;try{const j=await Te("/api/reference-prep",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({imageData:p,mimeType:g})});if(!j.ok)return a;if(b=await j.json().catch(()=>null),!b||b.status!=="ok")return{...a,shape:(b==null?void 0:b.shape)||"",shapeConfidence:(b==null?void 0:b.shapeConfidence)||"low"}}catch(j){return console.warn("[PatchDesign] reference-prep call failed:",j.message),a}let y=t,T=!1;if(b.bbox&&b.hasBusyBackground){const j=(b.bbox.width||0)*(b.bbox.height||0);if(j>0&&j<.9)try{y=await Nl(t,b.bbox),T=!0}catch(P){console.warn("[PatchDesign] reference crop failed:",P.message)}}return{croppedDataUrl:y,shape:b.shape||"",shapeConfidence:b.shapeConfidence||"low",hasBusyBackground:!!b.hasBusyBackground,applied:{cropped:T,shapeDetected:!!b.shape&&b.shape!=="other"&&b.shapeConfidence!=="low"}}}async function Nl(t,a){return await new Promise((s,i)=>{const o=new Image;o.onload=()=>{try{const l=o.naturalWidth||o.width,u=o.naturalHeight||o.height,p=.04,g=Math.max(0,(a.x-p)*l),b=Math.max(0,(a.y-p)*u),y=Math.min(l,(a.x+a.width+p)*l),T=Math.min(u,(a.y+a.height+p)*u),j=Math.round(y-g),P=Math.round(T-b);if(j<=0||P<=0){s(t);return}const S=document.createElement("canvas");S.width=j,S.height=P,S.getContext("2d").drawImage(o,g,b,j,P,0,0,j,P),s(S.toDataURL("image/jpeg",.92))}catch(l){i(l)}},o.onerror=()=>i(new Error("Could not load image for crop")),o.src=t})}function Rl(t){return new Promise((a,s)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>a(i),i.onerror=s,i.src=t})}async function El(t,a,s,i=1,o=[],l=null){if(s){const b=await kn(s,768),y=(await Promise.all((Array.isArray(o)?o:[]).filter(Boolean).slice(0,2).map(_=>kn(_,768).catch(()=>null)))).filter(Boolean),T=(t||"").trim(),j=/^(replicate|copy|reproduce|same|just (this|the (image|reference|logo))|as[- ]?is|exact|exactly)( (this|that|it|the (image|reference|logo|design)))?[.!\s]*$/i,P=(a&&a.shape||"").trim().toLowerCase(),S=!!P,R=S?Ps(P):"",L=S?`IMPORTANT: The patch's outer cut silhouette MUST match BOTH the reference image's outer outline AND the "${P}" shape selected above. These are aligned signals â the customer uploaded a ${P}-shaped reference and confirmed "${P}" in the design rail. Do NOT redraw the outline as a different shape (e.g. converting a shield reference into a star badge).`:"IMPORTANT: The patch's outer cut silhouette MUST match the outer outline of the uploaded reference image â copy whatever shape the reference is (shield, star, hexagon, banner, circle, rocker, etc.). Do NOT redraw the outline as a different shape, and do NOT default to a circle or police-badge star unless the reference itself is that shape. If the reference is a brand logo or wordmark, DIE-CUT the patch to the logo's exact outer contour (its real curves, lobes, and negative space) â do NOT drop the logo into a round, shield, or rectangle frame.",k=R?`${R} 7 8${L}`:L;let I;T.length===0||j.test(T)?I=`${k} 9 10Convert the uploaded reference image into an embroidered patch design. Reproduce the visual content of the reference image as faithfully as possible â preserve its outer silhouette, composition, colors, lettering, and proportions. Render it as a single isolated patch. DO NOT add any words, captions, labels, or text that are not already visible in the reference image itself.${Ei}`:I=`${k} 11 12Convert the uploaded reference image into an embroidered patch design, using it as the primary visual source â preserve its outer silhouette, composition, colors, lettering, and proportions as much as possible. Apply the following user guidance as STYLING and ADJUSTMENT instructions only â do NOT render any of these words as visible text on the patch unless the reference image itself already shows them. User guidance: "${T}"${Ei}`,I+=Rs(a),y.length>0&&(I+=` 13 14MULTIPLE REFERENCES: ${y.length+1} reference images are provided. The FIRST image is the primary anchor â its outer silhouette, layout, and proportions lead the design. Incorporate the key subjects, logos, and elements from the additional ${y.length}
14 reference image(s) into the SAME single patch as a cohesive composition. Do not output a collage, grid, or separate patches â combine everything into one unified emblem.`);const{imageUrl:E,model:F}=await xn(I,b,a,i,y,l);return{imageUrl:E,model:F,originalPrompt:t,enhancedPrompt:I}}const u=Ml(t,a),{imageUrl:p,model:g}=await xn(u,null,a,i,[],l);return{imageUrl:p,model:g,originalPrompt:t,enhancedPrompt:u}}const Pl=new Set(["alabama","alaska","arizona","arkansas","california","colorado","connecticut","delaware","florida","georgia","hawaii","idaho","illinois","indiana","iowa","kansas","kentucky","louisiana","maine","maryland","massachusetts","michigan","minnesota","mississippi","missouri","montana","nebraska","nevada","new hampshire","new jersey","new mexico","new york","north carolina","north dakota","ohio","oklahoma","oregon","pennsylvania","rhode island","south carolina","south dakota","tennessee","texas","utah","vermont","virginia","washington","west virginia","wisconsin","wyoming","district of columbia","puerto rico"]),Bl=new Set(["usa","united states","united states of america","america","canada","mexico","italy","france","spain","portugal","germany","ireland","united kingdom","uk","great britain","britain","england","scotland","wales","japan","australia","new zealand","brazil","india","china","south korea","philippines","vietnam","greece","norway","sweden"]);function Es(t){let a=(t||"").toLowerCase().trim();return a=a.replace(/^(the\s+)?(shape|outline|silhouette|map|state|country|map outline)\s+of\s+/,""),a=a.replace(/^state\s+of\s+/,""),a=a.replace(/^the\s+/,""),a=a.replace(/\s+(shape|outline|silhouette|map|state)$/,""),a.trim()}function Ol(t){const a=Es(t);return Pl.has(a)||Bl.has(a)}function $l(t){return Es(t).replace(/\b\w/g,a=>a.toUpperCase())}function Ps(t){const a=(t||"").toLowerCase().trim(),s=(a||"custom").charAt(0).toUpperCase()+(a||"custom").slice(1);if(!a||a==="free"||a==="freestyle"||a==="free-style"||a==="free style"||a==="custom"||a==="custom shape"||a==="any"||a==="any shape"||a==="surprise"||a==="surprise me")return"Patch outer silhouette: FREE-STYLE / die-cut to the design. Do NOT default to a plain circle, oval, or generic round badge. Cut the patch's outer edge to follow the natural contour of the main subject the customer described â if they described an object, animal, mascot, emblem, or scene, the patch is die-cut to that subject's silhouette; if they named a specific shape (a U.S. state, a logo, a symbol, an outline), match that shape exactly. The artwork fills the silhouette edge-to-edge â it IS the patch, not a drawing floating inside a round frame. Only use a conventional round / shield / rectangle emblem if the customer's request genuinely calls for one.";if(/\b(logo|logos|brandmark|brand mark|wordmark|brand outline|brand shape)\b/.test(a))return"Patch outer silhouette: DIE-CUT TO THE LOGO. The patch's outer cut edge MUST trace the exact outer contour of the brand's logo artwork (the provided or described logo) â its true curves, lobes, negative space, and proportions. Do NOT place the logo inside a circle, shield, or rectangle frame, and do NOT simplify its outline into a generic shape. The finished patch reads as the logo itself, cut out as an embroidered patch.";if(Ol(a)){const o=$l(a);return`Patch outer silhouette: GEOGRAPHIC DIE-CUT â the patch's outer cut edge MUST be an accurate, instantly recognizable outline of ${o} (its real borders/coastline, correctly proportioned, in conventional upright orientation). Do NOT enclose it in a circle, shield, or rectangle, and do NOT abstract the borders into a generic blob. The artwork fills the ${o} silhouette edge-to-edge so the patch unmistakably reads as the shape of ${o}.`}const i=`The artwork composition itself MUST fill that ${a} silhouette edge-to-edge â do NOT design a round emblem and place it inside a ${a} frame, and do NOT leave wide empty borders between the artwork and the silhouette edge. Imagery, text, and supporting motifs must hug, follow, and use the ${a}'s actual edges, corners, and points as design real estate.`;return a==="circle"?"Circular emblem patch â round outer silhouette. Composition is radial: arched text follows the curved border, the central motif sits in the middle, accent elements wrap symmetrically around the rim.":a==="ellipse"?"Oval (ellipse) emblem patch â elongated round silhouette. Composition follows the oval: text arches along the top and bottom curves, the central motif fills the wider middle, accents sit in the narrower ends.":a==="square"?`Square patch â outer silhouette is a square with 4 straight equal sides and 4 sharp corners. ${i} Use the FULL square canvas: extend background scenery and color blocks all the way to the four corners (no empty corner triangles); place primary text on STRAIGHT horizontal lines across the top and bottom edges (NEVER arched along an inner circle); the central motif fills the middle and runs near the side edges. Forbidden: any visible inner circle, oval, or curved frame containing the artwork â the design must read as a square composition, not a circle inside a square.`:a==="rectangle"?`Rectangular patch â outer silhouette is a rectangle with 4 straight sides and 4 sharp corners. ${i} Use the full rectangular canvas: extend background to all 4 corners; place primary text on STRAIGHT horizontal lines across the top and bottom edges (NEVER arched); the central motif spans the wider dimension. Forbidden: any visible inner circle or oval containing the artwork.`:a==="star"?`Star-shaped patch â outer silhouette is a 5-point star, and the artwork fills the entire star outline. ${i}
14 Each of the 5 star points is its own design slot: place an accent icon, color block, decorative shape, or supporting motif inside each point so no point is empty. The central motif sits in the star's body; text wraps along the upper star arms or sits in a banner across the star's middle. Forbidden: a circular emblem floating inside the star with empty star-point regions around it â the star points must be USED, not just outlined.`:a==="shield"?`Shield-shaped patch â outer silhouette is a heraldic shield (flat or curved top, narrowing to a rounded or pointed bottom). ${i} Text arches along the top edge of the shield; an optional chief band runs across the upper portion; the central motif fills the wider upper body; accent elements taper into the narrower bottom point. Forbidden: a circular emblem placed inside the shield outline â the artwork must read as a shield composition.`:a==="crest"?`Crest-shaped patch â heraldic crest silhouette with shaped sides and a defined top and bottom. ${i} Text follows the crest's top contour; the central motif fills the body; accents work along the shaped flanks. Forbidden: a circular emblem inside the crest.`:a==="badge"?`Badge-shaped patch â outer silhouette is a sheriff/police badge style (typically 5-7 point star or shield-with-points). ${i} The points and lobes are design slots â fill each with an accent or text segment. Central motif sits in the badge's body. Forbidden: a circular emblem inside the badge with the points sitting empty.`:a==="hexagon"?`Hexagonal patch â outer silhouette is a 6-sided polygon with straight edges. ${i} Place text on the top straight edge(s) and bottom straight edge(s) â do NOT arch text. Extend artwork into all 6 corners; use the angular geometry as part of the composition. Forbidden: a circular emblem floating inside the hexagon.`:a==="octagon"?`Octagonal patch â outer silhouette is an 8-sided polygon with straight edges. ${i} Place text on the straight top and bottom edges â do NOT arch text. Extend artwork into all 8 corners. Forbidden: a circular emblem inside the octagon.`:a==="heart"?`Heart-shaped patch â outer silhouette is a heart (two upper lobes meeting in a central dip, narrowing to a point at the bottom). ${i} The two upper lobes hold balanced accent imagery; the central motif sits at the visual center; text curves along the heart's upper edges or sits in a banner across the middle/lower body. Forbidden: a circular emblem floating inside the heart outline.`:a==="diamond"?`Diamond-shaped patch (rotated square) â outer silhouette has 4 sharp points (top, bottom, left, right). ${i} Use the 4 points as design slots for accents or text segments; the central motif sits at the middle. Forbidden: a circular emblem inside the diamond.`:a==="triangle"?`Triangular patch â outer silhouette is a triangle with 3 straight sides and 3 corners. ${i} The base edge holds the primary text on a straight horizontal line; the apex holds an accent or peak motif; the central motif sits in the wider lower body. Forbidden: a circular emblem inside the triangle.`:a==="banner"?`Banner / ribbon-shaped patch â long horizontal scroll silhouette, often with notched or fishtail ribbon tails on each end. ${i} The composition is dominated by horizontal text running along the banner's length; small supporting iconography flanks the text on the left and right. Forbidden: a circular emblem inside the banner.`:a==="rocker"?`Rocker-shaped patch â curved arc strip silhouette (motorcycle-club style top or bottom rocker). ${i} Bold text runs along the arc, following the curve smoothly from left to right; minimal supporting iconography flanks the text. Forbidden: a circular emblem â this is a strip, not a round patch.`:`Patch outer silhouette: DIE-CUT to "${s}". The patch's outer cut edge MUST follow the actual contour of a ${a}. ${i} The composition is built around and inside the ${a} outline â not framed by it. Adapt text placement, central motif, and accents to the ${a}'s natural edges, lobes, and points so the artwork reads as a true ${a}-shaped patch and NOT a circular emblem stamped inside a ${a} border.`}function Ml(t,a){const s=a.material||"Embroidered",i=(a.shape||"").trim(),o=a.style||"Social",l=wn[o]||wn.Other,u=hi(s),p=a.width&&a.height?`${a.width}" à ${a.height}"`:'3" à 3"',g=new Set(["YMCA","Scouts","Camp","School","Social","Sports","LawEnforcement","Firefighter","Police"]),b=a.smartFields||{},y=[];b.eventName&&y.push(`text "${b.eventName}" arched across the top`),b.year&&y.push(`text "${b.year}" at the bottom arc`),b.phrase&&y.push(`text "${b.phrase}" prominently displayed`),b.departmentName&&y.push(`text "${b.departmentName}" arched across the top`),b.companyName&&y.push(`text "${b.companyName}" prominently displayed`);const T=new Date().getFullYear();g.has(o)&&!b.year&&!/\b20\d{2}\b/.test(t)&&y.push(`text "${T}" subtly at the bottom arc`);const j=y.length?` 15MANDATORY TEXT on patch (must appear exactly as written): ${y.join(", ")}.`:"",P=Fl(a.brandContext)+Ns(pi(a));let S="";o==="YMCA"?S=' The patch MUST feature a simplified illustrated scene as the main design (like a postage-stamp illustration) â NOT a large Y or YMCA logo. Any YMCA branding (Y mark, "YMCA" wordmark) should only appear as a tiny element (under 5%) tucked into a corner. Do NOT include any Scouting symbols (fleur-de-lis, trefoil). The central focus must be a BOLD, SIMPLIFIED illustration of the activity or event theme â 4-6 chunky shapes, not a detailed photograph.':o==="Scouts"?S=" The patch MUST feature a simplified illustrated scene as the main design (like a postage-stamp illustration) â NOT a large brand/organization logo. A small fleur-de-lis or trefoil may appear as a corner accent (under 5%). Do NOT include any YMCA logo, Y mark, or YMCA wordmark â this is a Scouts patch, not a YMCA patch. The central focus must be a BOLD, SIMPLIFIED illustration of the activity or event theme â 4-6 chunky shapes, not a detailed photograph.":o==="Camp"&&(S=" The patch MUST feature a simplified illustrated scene as the main design (like a postage-stamp illustration) â NOT a large brand/organization logo. Do NOT include any YMCA logo or Y mark. The central focus must be a BOLD, SIMPLIFIED illustration of the camp activity or theme â 4-6 chunky shapes, not a detailed photograph.");const R=a.granularity||"Normal",L=R==="More"?'DETAIL LEVEL â MORE: Allow a richer, more illustrated scene with 5-8 supporting elements, layered composition, and additional texture/pattern where it reads clearly. Still stay above the 0.12" feature floor. Push for a detailed picture-postcard feel rather than a minimal emblem.':R==="Less"?'DETAIL LEVEL â LESS: Strip the design down to 2-3 bold elements maximum. Use large flat shapes, thick outlines, minimal text, no decorative fill patterns. Think classic 3-color iron-on â big, bold, instantly readable from 10 feet. Smallest feature â¥0.25".':"DETAIL LEVEL â NORMAL: Balanced detail â a clear central element plus 2-3 supporting elements, readable from 3-4 feet.",k=parseFloat(a.width)||3,I=parseFloat(a.height)||3,E=Math.max(.2,.13*Math.min(k,I)),F=Math.round(E/I*100),_=Math.max(.6,k-.3),Y=Math.max(4,Math.floor(_/.15)),M=Math.min(k,I)<=3?` SMALL-PATCH RULE: this patch is only ${k}"Ã${I}" â every additional word makes the text smaller and unreadable when stitched. Prefer 1-2 short lines maximum. Drop optional taglines, dates, and decorative wordmarks rather than shrinking the primary text below the floor.`:"",N=((li(s)||{}).baseLabel||s).toLowerCase(),D=N.includes("pvc"),te=N.includes("print")||N.includes("sublim")||N.includes("photo"),A=D||te,v=`STITCHABILITY (CRITICAL): Every feature â¥0.15" in the ${p} patch; primary text â¥${E.toFixed(2)}" tall (â${F}% of patch height â measure on the canvas you render, not in your head). HARD CAP: at most ${Y} characters per line of text on this ${k}"-wide patch; if a phrase doesn't fit, break it across 2 lines or shorten it â NEVER shrink the letters below the floor.${M} HARD CAP: 7 flat colors absolute maximum â merge similar hues into one shade rather than treating them as distinct colors. NO gradients, shading, crosshatching, stippling, drop shadows, or photographic texture. Chunky, bold, simplified shapes with dark outlines â vintage iron-on emblem aesthetic, NOT photorealism. FORBIDDEN: fine linework, tiny facial features, individual hairs/fur/feathers, thin sparkles, filigree, small serifs, intricate floral detail, realistic reflections, tiny background dots. Simplify: face = 4-5 big shapes; tree = chunky silhouette; animal = bold silhouette. Err bigger and bolder.`,ge=N.includes("chenille")?` 16 17CHENILLE CONSTRAINT (overrides the detail level above): render the ENTIRE design as thick plush raised looped chenille yarn on a felt base with a chain-stitch/embroidered border. Chenille can O
17NLY form big bold chunky shapes and thick block letters â reduce the subject to 1-3 massive simplified shapes or a single bold varsity letter / monogram. NO faces, NO portraits, NO photo-realism, NO fine lines, NO small text, NO gradients. If the subject is a person, team, or detailed logo, represent it as a bold mascot silhouette, monogram, or simple icon instead. Every feature at least 0.4" thick.`:"",K=te?`PRINTABILITY: this is a PRINTED / dye-sublimation patch â fine photo-quality detail, smooth gradients, soft shading and unlimited colors are all ALLOWED and encouraged (printed into the fabric, not stitched). Keep text legible: primary text â¥${E.toFixed(2)}" tall, at most ${Y} characters per line on this ${k}"-wide patch; if a phrase doesn't fit, break it across 2 lines or shorten it.${M}`:D?`MOLDABILITY: this is a molded PVC rubber patch â more detail than embroidery is fine: layered depth, beveled edges between color regions and a subtle glossy molded sheen are encouraged; up to ~10 clean colors with soft transitions where the mold steps between layers. Keep shapes bold and moldable (avoid thread-only hair-thin linework). Keep text legible: primary text â¥${E.toFixed(2)}" tall, at most ${Y} characters per line.${M}`:v,Ie=te?"Photo-quality printed emblem â smooth gradients and fine detail allowed, high contrast.":D?"Molded PVC rubber emblem â layered depth and a subtle glossy sheen, bold clean shapes, high contrast.":"Flat vector emblem style, bold outlined shapes, high contrast.",He=A?"":", hard cap 7 total â merge similar hues",Ae=a.brandContext&&a.brandContext.colors&&a.brandContext.colors.length?`Colors (use these exact brand hex codes as the PRIMARY palette${He}): ${a.brandContext.colors.join(", ")} â these are the site's real brand colors and must dominate the patch`:`Colors from: ${l.colors}${A?"":" (hard cap 7 â merge similar hues)"}`;return`${Ps(i)} Patch size: ${p}. Main subject: ${t} â LARGE, DOMINANT, CLEARLY VISIBLE as the central element, sized and laid out to fit the patch silhouette described above. Style: ${o} (${l.mood}). ${u}. ${Ae}. Supporting imagery (keep to 2-3 simplified elements, not a crowded scene): ${l.imagery}. Typography: ${l.typography}. Text placement: ${l.textPlacement} â but text must always conform to the patch silhouette (straight lines on straight-edged shapes, arcs only on curved shapes).${j}${P}${S} 18 19${L} 20 21${K}${ge} 22 23${Ie} BACKGROUND â the area OUTSIDE the patch's die-cut silhouette â MUST be a single flat NEAR-WHITE studio backdrop (pure white, off-white, cream, or very pale gray) and nothing else: absolutely NO black, dark gray, navy, or any dark/saturated fill behind or around the patch, NO dark panel or rounded box, NO drop shadow, NO vignette, NO scenery. Dark or black colors may appear ONLY inside the patch itself (its outlines, merrowed border, and artwork) â NEVER in the surrounding background. This is the single most common mistake: do not place the patch on a black or dark background. The patch's outer border MUST stay fully visible against the light background with at least a 5% margin of clear light background on all four sides; do NOT crop the patch to the canvas edge. 24 25OUTPUT FORMAT: Return exactly ONE patch, centered on a plain NEAR-WHITE background (never black or dark), filling most of the frame but with a clear light-colored margin around the entire silhouette. Do NOT render a lookbook, design sheet, variation grid, side-by-side alternatives, mockup on a shirt, or multiple copies â a single standalone patch only.`}function Fl(t){if(!t||!t.success)return"";const a=[];t.name&&a.push(`the "${t.name}" brand`),t.host&&a.push(`from ${t.host}`);const s=a.length?a.join(" "):"the referenced brand",i=(t.colors||[]).slice(0,5).join(", "),o=i?` Use ONLY these exact brand hex colors as the dominant palette and match them precisely (do not drift to similar shades): ${i}.`:"",l=t.description?` Brand context: ${t.description.slice(0,160)}.`:"",u=t.name?`${t.name}'s`:"the brand's",p=t.source==="guidelines"?mi(t):"";return` 26BRAND MATCH (HIGH PRIORITY): This patch represents ${s}. Recreate ${u} actual logo/emblem as the central, dominant element of the patch â reproduce its real icon, mark and wordmark as faithfully as possible (the brand's true identity, NOT a generic stand-in or reinterpretation).${o}${l}${p} The logo and these exact colors are authoritative â prioritize brand fidelity over decorative embellishment.`}async function kn(t,a){try{return await new Promise(s=>{const i=new Image;i.onload=()=>{let o=i.width,l=i.height;if(o>a||l>a){const g=Math.min(a/o,a/l);o=Math.round(o*g),l=Math.round(l*g)}const u=document.createElement("canvas");u.width=o,u.height=l,u.getContext("2d").drawImage(i,0,0,o,l),s(u.toDataURL("image/jpeg",.85))},i.onerror=()=>s(t),i.src=t})}catch{return t}}async function Dl(t,a,s,i=null,o=1,l=null){if(i&&i.startsWith("data:")){const y=(s==null?void 0:s.granularity)||"Normal",T=y==="More"?' PRESERVE the EXACT overall composition of the reference image: same outer shape, same outer border / ring, same framing, same text and wordmarks (verbatim, same font, same placement), same color palette, same proportions, same crop. Do NOT zoom, crop, or recompose. WITHIN that locked composition, the detail increase must be OBVIOUS at a glance â someone comparing before and after side by side should immediately see a denser, more intricate patch, not hunt for differences. Do ALL of the following: (1) give EVERY major existing element visibly richer internal detail â extra linework, internal segmentation/paneling, and denser apparent thread-stitch texture; (2) add 4-6 NEW theme-appropriate supporting motifs worked into the existing negative space, without overlapping or shrinking the main subject or any text; (3) upgrade plain flat fill areas into subtly patterned or textured fills. Keep every feature above a 0.12" embroidery floor.':y==="Less"?" Simplify the design to 2-3 bold elements maximum: large flat shapes, thick outlines, minimal text, no decorative fill patterns. Think classic 3-color iron-on â big, bold, instantly readable from 10 feet.":"",j=a.trim(),P=/^(remove|delete|clear|erase|get\s*rid\s*of|drop|take\s*out|kill|strip)( the)?\s*(background|surroundings|stuff\s+around|items?\s+around|context|setting|environment|scene|props|extras|decorations?|surrounding\s+elements?)/i.test(j)||/(isolate|just|only).{0,15}(the\s+)?patch\b/i.test(j)||/\b(patch\s*only|clean\s+(white|background|backdrop)|white\s+background|transparent\s+background|no\s+(scene|background|surroundings))/i.test(j)||/\b(remove|delete|erase)\s+everything\s+(around|outside)/i.test(j),S=/^(?:detail|detail\s*level)\s*:\s
26*(more|less|normal)$/i.exec(j),R=S?{more:"Significantly increase the level of detail across this patch design â make it visibly richer and more intricate.",less:"Significantly simplify this patch design â fewer, bolder elements.",normal:"Rebalance this patch to a normal detail level: one clear central element plus 2-3 supporting elements, readable from 3-4 feet."}[S[1].toLowerCase()]:null,k=`${P?"Isolate the patch by itself on a clean solid white background (or off-white #f7f7f5). The patch artwork â its outer silhouette, border / ring, internal illustration, text, wordmarks, and color palette â must remain EXACTLY identical to the reference image. DELETE everything that currently exists OUTSIDE the patch silhouette: any ammunition, bullets, shells, grenades, weapons, knives, helmets, compasses, arrows, banners, ribbons, scrolls, wreaths, frames, props, scenery, leaves, branches, badges, supporting illustrations, shadows, reflections, torn-paper or wood-grain backdrops, or thematic decoration. The final image must show ONLY the patch as a standalone object on a flat blank surface â like a stock catalog product photo of an embroidered patch lying on white paper.":R||j}${T}${Il(s==null?void 0:s.material)}${Rs(s)}`,I=await kn(i,768),{imageUrl:E,model:F}=await xn(k,I,s,o,[],l),_=String(t||"").trim(),Y=_?`${_} 27 28Then edited: ${a.trim()}`:a.trim();return{imageUrl:E,model:F,originalPrompt:a,enhancedPrompt:Y}}if(!t||!String(t).trim()){const y=new Error("Cannot edit: no reference image and no original prompt to anchor the change. Refusing to regenerate from scratch.");throw y.errorCode="GEN-R01",y}const p=await Wl(t,a,s),{imageUrl:g,model:b}=await xn(p,null,s,o,[],l);return{imageUrl:g,model:b,originalPrompt:a,enhancedPrompt:p}}async function xn(t,a,s={},i=1,o=[],l=null){const u=(s==null?void 0:s.style)||"",p={prompt:t,style:u,attemptNumber:i},g=_l();g.userId&&(p.userId=g.userId);const b=Hr();b&&(p.anonId=b),g.orgToken&&(p.orgToken=g.orgToken);const y=parseFloat(s==null?void 0:s.width),T=parseFloat(s==null?void 0:s.height);if(Number.isFinite(y)&&y>0&&(p.widthIn=y),Number.isFinite(T)&&T>0&&(p.heightIn=T),s!=null&&s.material){const _=li(s.material);p.material=_?_.baseLabel:String(s.material),_&&(p.materialNote={name:_.label,description:_.description||""})}if(typeof window<"u"&&window.__PATCHDESIGN_CLIENT_KEY__&&(p.clientKey=window.__PATCHDESIGN_CLIENT_KEY__),a){p.referenceImageUrl=a;const _=a.substring(0,40),Y=a.length;console.log(`[PatchDesign] Sending reference image to API: starts="${_}...", length=${Y}, isDataUrl=${a.startsWith("data:")}`)}else console.log("[PatchDesign] No reference image â text-only generation");const j=(Array.isArray(o)?o:[]).filter(Boolean).slice(0,2),P=Ll(s);P.length>0&&(p.fontReferences=P),j.length>0&&(p.extraReferenceImageUrls=j,console.log(`[PatchDesign] + ${j.length} additional reference image(s)`));const S=typeof window<"u"&&window.__PD_ASYNC_GEN__===!0,R=p.clientKey?{}:await As();if(S&&!p.clientKey)try{const _=await zl(p,R);if(_&&_.imageData)return{imageUrl:`data:${_.mimeType||"image/png"};base64,${_.imageData}`,model:_.model||null}}catch(_){if(_&&_.isSafetyBlock)throw _;console.warn("[PatchDesign] async generation failed â falling back to sync:",_&&_.message)}const L=55e3,k=new AbortController,I=setTimeout(()=>k.abort(),L);if(l)if(l.aborted)try{k.abort()}catch{}else try{l.addEventListener("abort",()=>{try{k.abort()}catch{}},{once:!0})}catch{}let E;try{E=await Te("/api/image-gen",{method:"POST",headers:{"Content-Type":"application/json",...R},body:JSON.stringify(p),signal:k.signal})}catch(_){if(clearTimeout(I),_&&(_.name==="AbortError"||/aborted|timeout/i.test(_.message||""))){const Y=new Error("Generation timed out on the client. The server may have stalled mid-call â please try again.");throw Y.errorCode="GEN-E01",Y.isTimeout=!0,Y}throw _}if(clearTimeout(I),!E.ok){const _=await E.text().catch(()=>"");let Y=_||`HTTP ${E.status}`,V=null,M=null;if(/^\s*(?:<!doctype html|<html\b)/i.test(_))M="GEN-G01",Y=`Azure SWA gateway error (status ${E.status}) â function exceeded ~45s timeout or returned a platform-level 5xx`;else try{const K=JSON.parse(_);K!=null&&K.error&&(Y=K.error),K!=null&&K.geminiErrors&&(V=K.geminiErrors),K!=null&&K.errorCode&&(M=K.errorCode)}catch{}console.error(`[PatchDesign] API non-OK: status=${E.status}`,` 29 error:`,Y,V?`
30 per-model errors:`:"",V||"");const D=`${Y} ${JSON.stringify(V||"")}`.toLowerCase();if(M==="GEN-B01"||D.includes("billing")||D.includes("spending")||D.includes("payment required")||D.includes("api key not valid")||D.includes("api_key_invalid")||D.includes("permission_denied")||D.includes("permission denied")||D.includes("suspended")){const K=new Error("Our image service is at capacity right now â but we don't want you to lose this idea. Email your design description to [email protected] and our team will create it for you within a few hours.");throw K.isBudgetCapped=!0,K.errorCode="GEN-B01",K.technicalDetail=Y,K.geminiErrors=V,K}if(M==="GEN-Q01"){const K=new Error(Y||"Daily design limit reached.");throw K.isRateLimited=!0,K.errorCode="GEN-Q01",K}if(E.status===429||E.status===403||D.includes("spending cap")||D.includes("resource_exhausted")||D.includes("quota")||D.includes("rate limit")||D.includes("billing")||D.includes("payment required")||D.includes("project billing")||D.includes("api_key_invalid")||D.includes("permission_denied")){const K=new Error("Our image service is temporarily limited. Please try again in a few minutes, or email [email protected] if you need a design right now.");throw K.isServiceLimited=!0,K.technicalDetail=Y,K.geminiErrors=V,K}if(M==="GEN-S01"){const K=new Error("That prompt was blocked by our image provider's safety filter. Try rewording â describe the patch theme, colors, and shapes without naming people or sensitive content.");throw K.isSafetyBlock=!0,K.errorCode=M,K.technicalDetail=Y,K.geminiErrors=V,K}const v=V?` (tried ${V.length} model${V.length===1?"":"s"}
30)`:"",ge=new Error(`${Y}${v}`);throw M&&(ge.errorCode=M),V&&(ge.geminiErrors=V),ge}const F=await E.json();if(!F.imageData)throw new Error("No image data from Gemini");return{imageUrl:`data:${F.mimeType||"image/png"};base64,${F.imageData}`,model:F.model||null}}async function zl(t,a={}){const s=await Te("/api/image-gen-start",{method:"POST",headers:{"Content-Type":"application/json",...a},body:JSON.stringify(t)});if(!s.ok)throw new Error(`start failed (${s.status})`);const{jobId:i}=await s.json().catch(()=>({}));if(!i)throw new Error("start returned no jobId");Te("/api/image-gen-run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jobId:i})}).catch(()=>{});const o=15e4,l=Date.now();let u=7e3;for(;Date.now()-l<o;){await new Promise(g=>setTimeout(g,u)),u=1800;let p;try{const g=await Te(`/api/image-gen-status?jobId=${encodeURIComponent(i)}`,{method:"GET"});if(!g.ok)continue;p=await g.json()}catch{continue}if(p&&p.status==="done"&&p.imageData)return p;if(p&&p.status==="error"){const g=new Error(p.error||"generation failed");throw g.errorCode=p.code,p.code==="GEN-S01"&&(g.isSafetyBlock=!0),g}}throw new Error("async generation timed out while polling")}async function Hl(t,a,s){try{if(!t||!t.startsWith("data:"))return{status:"unknown",reason:"No data URL to audit"};const i=t.match(/^data:(image\/[^;]+);base64,(.+)$/);if(!i)return{status:"unknown",reason:"Image URL not in expected data:URL shape"};const o=i[1],l=i[2],u=await Te("/api/legibility-check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({imageData:l,mimeType:o,widthIn:a,heightIn:s})});return u.ok?await u.json():{status:"unknown",reason:`Audit endpoint returned ${u.status}`}}catch(i){return{status:"unknown",reason:i.message}}}async function Wl(t,a,s){const i=s.style||"Social",o=wn[i]||wn.Other,l=s.material||"Embroidered",u=(s.shape||"").trim()||"free-style (keep the existing design's exact outer die-cut silhouette â do NOT reshape it into a circle or generic badge)",p=`You are editing a patch design by modifying its generation prompt. You will receive the ORIGINAL prompt that generated the current design and the user's requested change. Produce a NEW complete prompt that incorporates the change while preserving everything else. 31 32RULES: 331. Start from the original prompt as your base â keep all elements not affected by the change 342. Apply the user's change precisely and prominently 353. CRITICAL TEXT HANDLING: If the user asks to change text, replace the old text with the new text EXACTLY as they wrote it, letter for letter, in quotes 364. If the user asks to change colors, update the color specifications throughout 375. If the user asks to add/remove elements, add/remove them while keeping the rest 386. If the user asks for a style change, adjust the design vocabulary while preserving content 397. Maintain the same patch shape (${u}), material look, and "single isolated patch on a flat NEAR-WHITE empty background (white / off-white / cream / pale gray â NEVER black or any dark color behind or around the patch) â NO scenery, NO backdrop, NO dark panel, NO imagery outside the patch silhouette â clean edges for production extraction" ending. If the user asks to remove a black/dark background, replace the surrounding area with a near-white background while leaving the patch artwork and its border unchanged. 408. PRESERVE the "STITCHABILITY RULES" block from the original prompt verbatim â never drop, shorten, or soften it. It keeps designs embroidery-ready. 419. Keep the prompt under 400 words 4210. Output ONLY the new complete prompt â no explanation 43 44PATCH CONTEXT: 45- Shape: ${u} 46- Style: ${i} 47- Material: ${l} 48- Colors: ${o.colors}`;try{const g=await Te("/api/anthropic",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({systemPrompt:p,message:`ORIGINAL PROMPT: 49${t} 50 51REQUESTED CHANGE: 52${a} 53 54Write the new complete prompt with this change applied.`})});if(!g.ok)throw new Error("API error");return(await g.json()).content||`${t}. Modified: ${a}`}catch{return`${t}. Modified: ${a}`}}const Bs={s1:["Free shipping - US and international, every order.","Built to actually be stitched - no detail a needle can't follow.","Made to your patch type's best practices.","Not a generic AI picture - a real, production-ready patch.","A real person reviews every design before it's made.","Design is free, and production is about 30% cheaper than competitors."],s2:["No meetings, no waiting on a designer.","Embroidered, woven, PVC, or chenille - your call.","It comes out production-ready - no art files to wrangle.","Free shipping - US and international, every order.","Free human expert review to ensure highest quality.","Lowest production prices guaranteed.","Free Express Shipping - fastest turnaround, shipped in 10 days."],s3:["De
54signing is free - you only pay if you order.","About 30% less than traditional patch makers.","Order, and we stitch a sample and email you photos before the run.","Liking where this is going? It is ready whenever you are."],s4:["Love it? Get it made in a couple of clicks.","Shipped in about 10 business days, straight to your door.","Order one as a sample, or a batch for the whole team.","Low minimums - embroidered orders start at just 10.","Outfitting a group? One person designs, one person pays."],photo:"Reading your photo and rebuilding it as a patch.",large:"Picture this on a jacket back or a big bag.",small:"This will look sharp on a cap or a backpack.",tool:["Built to actually be stitched - no detail a needle can't follow.","Made to your patch type's best practices.","Not a generic AI picture - a real, production-ready patch.","No meetings, no waiting on a designer.","It comes out production-ready - no art files to wrangle.","Liking where this is going? It is ready whenever you are.","Love it? Get it made in a couple of clicks."]},Ul={s1:["EnvÃo gratis - EE. UU. e internacional, cada pedido.","Hecho para coserse de verdad
54- sin detalles imposibles.","Según las mejores prácticas de tu tipo de parche.","No es una imagen de IA genérica - un parche real.","Una persona revisa cada diseño antes de producirlo.","Diseñar es gratis, y como 30% más barato que la competencia."],s2:["Sin reuniones, sin esperar a un diseñador.","Bordado, tejido, PVC o chenilla - tú eliges.","Sale listo para producción - sin archivos de arte que pelear.","EnvÃo gratis - EE. UU. e internacional, cada pedido.","Revisión gratis de un experto humano para máxima calidad.","Precios de producción más bajos, garantizado.","EnvÃo exprés gratis - la mayor rapidez, enviado en 10 dÃas."],s3:["Diseñar es gratis - solo pagas si lo ordenas.","Cerca de 30% menos que los fabricantes tradicionales.","Apruebas una prueba gratis antes de fabricar nada.","¿Te gusta cómo va? Está listo cuando tú lo estés."],s4:["¿Te encanta? Mándalo a hacer en un par de clics.","Llega en unos 10 dÃas hábiles, a tu puerta.","Pide uno de muestra, o un lote para todo el equipo.","MÃnimos bajos - los bordados empiezan en solo 10.","¿Equipar a un grupo? Una persona diseña, una persona paga."],photo:"Leyendo tu foto y reconstruyéndola como parche.",large:"ImagÃnalo en la espalda de una chaqueta o un bolso grande.",small:"Se verá genial en una gorra o mochila.",tool:["Hecho para coserse de verdad
54- sin detalles imposibles.","Según las mejores prácticas de tu tipo de parche.","No es una imagen de IA genérica - un parche real.","Sin reuniones, sin esperar a un diseñador.","Sale listo para producción - sin archivos de arte que pelear.","¿Te gusta cómo va? Está listo cuando tú lo estés.","¿Te encanta? Mándalo a hacer en un par de clics."]},Gl={s1:["Weltweit kostenloser Versand â bei jeder Bestellung.","Wirklich stickbar gemacht â kein Detail, dem die Nadel nicht folgt.","Nach den Regeln Ihrer gewählten Aufnäher-Art gefertigt.","Kein generisches KI-Bild â ein echter, produktionsreifer Aufnäher.","Ein Mensch prüft jeden Entwurf, bevor er gefertigt wird.","Gestalten ist gratis, Produktion rund 30 % günstiger als üblich."],s2:["Keine Termine, kein Warten auf eine Grafikagentur.","Gestickt, gewebt, PVC oder Chenille â Sie entscheiden.","Kommt produktionsreif heraus â kein Hantieren mit Druckdateien.","Weltweit kostenloser Versand â bei jeder Bestellung.","Kostenlose fachliche Prüfung für beste Qualität.","Garantiert günstigste Produktionspreise.","Versand inklusive â rund 10 Werktage bis zu Ihnen."],s3:["Gestalten ist kostenlos â Sie zahlen nur, wenn Sie bestellen.","Rund 30 % günstiger als klassische Aufnäher-Hersteller.","Sie geben einen kostenlosen Korrekturabzug frei, bevor gefertigt wird.","Gefällt Ihnen die Richtung? Es ist bereit, wenn Sie es sind."],s4:["Ãberzeugt? Mit zwei Klicks in die Produktion.","Versand in rund 10 Werktagen, direkt zu Ihnen.","Bestellen Sie ein Muster oder gleich für das ganze Team.","Niedrige Mindestmengen â gestickt ab 10 Stück.","Ganze Gruppe ausstatten? Einer gestaltet, einer bezahlt."],photo:"Ihr Foto wird gelesen und als Aufnäher neu aufgebaut.",large:"Stellen Sie sich das auf einem Jackenrücken oder einer groÃen Tasche vor.",small:"Das wirkt richtig gut auf einer Kappe oder einem Rucksack.",tool:["Wirklich stickbar gemacht â kein Detail, dem die Nadel nicht folgt.","Nach den Regeln Ihrer gewählten Aufnäher-Art gefertigt.","Kein generisches
54KI-Bild â ein echter, produktionsreifer Aufnäher.","Keine Termine, kein Warten auf eine Grafikagentur.","Kommt produktionsreif heraus â kein Hantieren mit Druckdateien.","Gefällt Ihnen die Richtung? Es ist bereit, wenn Sie es sind.","Ãberzeugt? Mit zwei Klicks in die Produktion."]},ql={en:Bs,es:Ul,de:Gl};function zn(t,a){const s=t.slice();for(let i=s.length-1;i>0;i--){const o=Math.floor(Math.random()*(i+1)),l=s[i];s[i]=s[o],s[o]=l}return s}function Vl({locale:t,iteration:a,ourOffer:s=!0}={}){const i=ql[t]||Bs;if(!s)return Array.from(new Set(zn(i.tool)));const o=Math.max(1,Number(a)||1);let l;if(o<=1)l=zn(i.s1);else{const u=o===2?i.s2:o===3?i.s3:i.s4;l=zn(u)}return Array.from(new Set(l.filter(Boolean)))}const Kl=JSON.parse(`[{"image":"/patches/applications/hats-1.webp","prompt":"Trucker hat patch, mountain range and sunset, brand name arched, earth tones, 2.5 inch rectangle"},{"image":"/patches/applications/jackets-1.webp","prompt":"Denim jacket back patch, eagle with spread wings and a banner, 10 inch, bold full color"},{"image":"/patches/applications/letterman-jackets-1.webp","prompt":"Chenille varsity letter S with a soccer ball, school colors red and white, 6 inch chest letter"},{"image":"/patches/applications/backpacks-1.webp","prompt":"Backp
54ack patch with a child's name and a rocket, bright primary colors, 3 inch, iron-on"},{"image":"/patches/applications/vests-1.webp","prompt":"Motorcycle club three-piece back set, eagle center, top and bottom rockers, black and orange"},{"image":"/patches/applications/beanies-1.webp","prompt":"Beanie cuff patch, outdoor brand logo, mountain and wordmark, woven, 2.5 inch rectangle"},{"image":"/patches/applications/hoodies-1.webp","prompt":"Hoodie chest patch, streetwear brand wordmark and icon, full color gradient, printed, 4 inch"},{"image":"/patches/applications/jeans-1.webp","prompt":"Denim jacket patch, traditional tattoo rose with a banner, bold outline, 3.5 inch"},{"image":"/patches/applications/hats-2.webp","prompt":"Cap front patch, bold monogram initials in a circle, navy and cream, embroidered"},{"image":"/patches/applications/jackets-2.webp","prompt":"Bomber jacket chest patch, vintage motorcycle and route number, 3.5 inch circular"},{"image":"/patches/applications/letterman-jackets-2.webp","prompt":"Letterman sleeve patch, baseball and year 2025, navy and gold, 3.5 inch"},{"image":"/patches/applications/backpacks-2.webp","prompt":"Tactical daypack PVC patch, subdued compass rose, velcro backing, 3 inch square"},{"image":"/patches/applications/vests-2.webp","prompt":"Scout vest front patch, campfire and pine trees, troop number, 3 inch"},{"image":"/patches/applications/beanies-2.webp","prompt":"Knit hat patch, bold initial monogram, woven, navy and cream, 2 inch circle"},{"image":"/patches/applications/hoodies-2.webp","prompt":"Sleeve patch for a team hoodie, mascot and year, embroidered, 3 inch"},{"image":"/patches/applications/jeans-2.webp","prompt":"Jeans pocket patch, vintage Americana eagle and stars, 2.5 inch, embroidered"},{"image":"/patches/applications/hats-3.webp","prompt":"Outdoor brand hat patch, compass and pine tree, fine text, woven, 2 inch"},{"image":"/patches/applications/jackets-3.webp","prompt":"Canvas jacket sleeve patch, mountain and compass, earth tones, 3 inch shield"},{"image":"/patches/applications/letterman-jackets-3.webp","prompt":"Mascot patch for a letterman jacket, bold eagle head, royal blue and silver, embroidered"},{"image":"/patches/applications/backpacks-3.webp","prompt":"Hiking pack patch, mountain and pine trees, national-park badge style, 3 inch circular"},{"image":"/patches/applications/vests-3.webp","prompt":"Riding club back patch, vintage motorcycle and route shield, 11 inch, red and chrome"},{"image":"/patches/applications/beanies-3.webp","prompt":"Team beanie patch, mascot bear head, school colors, embroidered, 2.25 inch"},{"image":"/patches/applications/hoodies-3.webp","prompt":"Back patch for a merch hoodie, bold illustrated tiger, 9 inch, printed full color"},{"image":"/patches/applications/jeans-3.webp","prompt":"Tote bag denim patch, slogan in retro lettering, sunburst background, printed, 4 inch"},{"image":"/patches/themes/dragon-patch.webp","prompt":"Coiled red dragon wrapped around a katana, circular patch, black and gold border, martial arts academy"},{"image":"/patches/themes/dragon-patch-2.webp","prompt":"Tribal-style black dragon in flight, three colors, hot-cut edge, motorcycle back patch"},{"image":"/patches/themes/dragon-patch-3.webp","prompt":"Friendly cartoon green dragon breathing a small flame, rounded shield shape, kids fantasy camp"},{"image":"/patches/themes/dragon-patch-4.webp","prompt":"Coiled red dragon wrapped around a katana, circular patch, black and gold border, martial arts academy"},{"image":"/patches/themes/skull-patch.webp","prompt":"Subdued tactical death-head skull, gray and black, PVC with velcro backing, 3 inch square"},{"image":"/patches/themes/skull-patch-2.webp","prompt":"Sugar skull with marigolds and rose accents, full color, circular embroidered patch"},{"image":"/patches/themes/skull-patch-3.webp","prompt":"Skull with crossed wrenches, garage crew name banner, black and safety orange"},{"image":"/patches/themes/skull-patch-4.webp","prompt":"Subdued tactical death-head skull, gray and black, PVC with velcro backing, 3 inch square"},{"image":"/patches/themes/eagle-patch.webp","prompt":"Bald eagle head profile in front of a waving American flag, circular patch, full color"},{"image":"/patches/themes/eagle-patch-2.webp","prompt":"Eagle with spread wings clutching arrows and a banner, veteran organization, gold and navy"},{"image":"/patches/themes/eagle-patch-3.webp","prompt":"School mascot golden eagle, bold athletic style, shield shape, royal blue and yellow"},{"image":"/patches/themes/eagle-patch-4.webp","prompt":"Bald eagle head profile in front of a waving American flag, circular patch, full color"},{"image":"/patches/themes/wolf-patch.webp","prompt":"Howling wolf silhouette against a full moon and pine trees, circular patch, navy and silver"},{"image":"/patches/themes/wolf-patch-2.webp","prompt":"Geometric low-poly wolf head, modern look, three colors, hot-cut edge, esports team"},{"image":"/patches/themes/wolf-patch-3.webp","prompt":"Cub scout wolf den patch, friendly cartoon wolf, Pack number banner, blue and gold"},{"image":"/patches/themes/wolf-patch-4.webp","prompt":"Howling wolf silhouette against a full moon and pine trees, circular patch, navy and silver"},{"image":"/patches/themes/phoenix-patch.webp","prompt":"Phoenix rising with wings spread and flames below, gradient orange to gold, circular patch"},{"image":"/patches/themes/phoenix-patch-2.webp","prompt":"Stylized minimal phoenix in three flat colors, modern crest, team comeback season"},{"image":"/patches/themes/phoenix-patch-3.webp","prompt":"Phoenix and flame emblem with a banner for a recovery or alumni group, deep red and cream"},{"image":"/patches/themes/phoenix-patch-4.webp","prompt":"Phoenix rising with wings spread and flames below, gradient orange to gold, circular patch"},{"image":"/patches/themes/snake-patch.webp","prompt":"Coiled rattlesnake ready to strike, Gadsden style, subdued tan and black, PVC velcro patch"},{"image":"/patches/themes/snake-patch-2.webp","prompt":"Cobra with hood flared, tactical team, gray and red, square hot-cut patch"},{"image":"/patches/themes/snake-patch-3.webp","prompt":"Snake wrapped around a dagger, traditional tattoo style, circular embroidered patch"},{"image":"/patches/themes/snake-patch-4.webp","prompt":"Coiled rattlesnake ready to strike, Gadsden style, subdued tan and black, PVC velcro patch"},{"image":"/patches/themes/american-flag-patch.webp","prompt":"Reverse-field American flag, subdued gray and black, PVC with velcro backing, 3.5 by 2 inch"},{"image":"/patches/themes/american-flag-patch-2.webp","prompt":"Full-color American flag with a thin blue line, embroidered, merrowed border"},{"image":"/patches/themes/american-flag-patch-3.webp","prompt":"Distressed American flag with an eagle, vintage red white and blue, circular patch"},{"image":"/patches/themes/american-flag-patch-4.webp","prompt":"Reverse-field American flag, subdued gray and black, PVC with velcro backing, 3.5 by 2 inch"},{"image":"/patches/themes/anchor-patch.webp","prompt":"Anchor wrapped in rope inside a circular rope border, navy and white, sailing club name"},{"image":"/patches/themes/anchor-patch-2.webp","prompt":"Vintage tattoo-style anchor with a banner reading the boat name, red and navy"},{"image":"/patches/themes/anchor-patch-3.webp","prompt":"Minimal modern anchor emblem, two colors, woven patch for a polo collar"},{"image":"/patches/themes/anchor-patch-4.webp","prompt":"Anchor wrapped in rope inside a circular rope border, navy and white, sailing club name"},{"image":"/patches/themes/rose-patch.webp","prompt":"Traditional tattoo-style red rose with green leaves, bold outline, circular embroidered patch"},{"image":"/patches/themes/rose-patch-2.webp","prompt":"Watercolor pink rose with soft gradients, printed patch, minimal modern style"},{"image":"/patches/themes/rose-patch-3.webp","prompt":"Single rose with a banner and a name for a memorial patch, deep red and black"},{"image":"/patches/themes/rose-patch-4.webp","prompt":"Traditional tattoo-style red rose with green leaves, bold outline, circular embroidered patch"},{"image":"/patches/themes/mountain-patch.webp","prompt":"Mountain peak with pine trees and a sunrise, circular badge, place name arched on top, woven"},{"image":"/patches/themes/mountain-patch-2.webp","prompt":"Minimal line-art mountain range, two colors, modern outdoor brand patch"},{"image":"/patches/themes/mountain-patch-3.webp","prompt":"Lake and mountain camp scene with a year, retro 1970s color palette, embroidered"},{"image":"/patches/themes/mountain-patch-4.webp","prompt":"Mountain peak with pine trees and a sunrise, circular badge, place name arched on top, woven"},{"image":"/patches/themes/compass-patch.webp","prompt":"Vintage nautical compass rose with cardinal letters, navy and gold, circular woven patch"},{"image":"/patches/themes/compass-patch-2.webp","prompt":"Minimal modern compass with a mountain inside, two colors, travel brand patch"},{"image":"/patches/themes/compass-patch-3.webp","prompt":"Compass framing a pine forest scene with a motto banner, earth tones, embroidered"},{"image":"/patches/themes/compass-patch-4.webp","prompt":"Vintage nautical compass rose with cardinal letters, navy and gold, circular woven patch"},{"image":"/patches/themes/monogram-patch.webp","prompt":"Interlocking three-letter monogram in a circular laurel wreath, navy and cream, embroidered"},{"image":"/patches/themes/monogram-patch-2.webp","prompt":"Single block varsity letter with a drop shadow, chenille-style look, red and white"},{"image":"/patches/themes/monogram-patch-3.webp","prompt":"Elegant script first name inside a thin gold ring, wedding favor patch, blush and gold"},{"image":"/patches/themes/monogram-patch-4.webp","prompt":"Interlocking three-letter monogram in a circular laurel wreath, navy and cream, embroidered"},{"image":"/patches/themes/usa-250-patch.webp","prompt":"Round USA 250 patch, large '250' over stars and stripes, '1776-2026' banner, red white and blue"},{"image":"/patches/themes/usa-250-patch-2.webp","prompt":"Town 250th celebration patch, eagle and fireworks, city name arc, gold border"},{"image":"/patches/themes/usa-250-patch-3.webp","prompt":"Scout troop America 250 patch, liberty bell and '250 Years', navy and gold, 3 inch"},{"image":"/patches/themes/usa-250-patch-4.webp","prompt":"Round USA 250 patch, large '250' over stars and stripes, '1776-2026' banner, red white and blue"},{"image":"/patches/themes/1776-2026-patch.webp","prompt":"Circular patch with '1776' and '2026' flanking a star, laurel wreath, navy gold and red"},{"image":"/patches/themes/1776-2026-patch-2.webp","prompt":"Shield patch, '1776-2026' over stripes, eagle on top, 250 years banner"},{"image":"/patches/themes/1776-2026-patch-3.webp","prompt":"Vintage patch, '1776 - 2026' with a thirteen-star ring, distressed red white and blue"},{"image":"/patches/themes/1776-2026-patch-4.webp","prompt":"Circular patch with '1776' and '2026' flanking a star, laurel wreath, navy gold and red"},{"image":"/patches/themes/liberty-bell-patch.webp","prompt":"Liberty Bell with '1776-2026' banner, stars above, antique gold and navy, circular patch"},{"image":"/patches/themes/liberty-bell-patch-2.webp","prompt":"Simple Liberty Bell silhouette with thirteen stars, two colors, modern shield patch"},{"image":"/patches/themes/liberty-bell-patch-3.webp","prompt":"Historical society patch, detailed Liberty Bell and laurel, '250 Years of Independence'"},{"image":"/patches/themes/liberty-bell-patch-4.webp","prompt":"Liberty Bell with '1776-2026' banner, stars above, antique gold and navy, circular patch"},{"image":"/patches/themes/betsy-ross-flag-patch.webp","prompt":"Betsy Ross thirteen-star flag in a circle, '1776-2026' banner, classic red white and blue"},{"image":"/patches/themes/betsy-ross-flag-patch-2.webp","prompt":"Waving Betsy Ross flag patch, shield shape, eagle above, antique colors"},{"image":"/patches/themes/betsy-ross-flag-patch-3.webp","prompt":"Round patch, thirteen-star ring with '250' in the center, navy red and cream"},{"image":"/patches/themes/betsy-ross-flag-patch-4.webp","prompt":"Betsy Ross thirteen-star flag in a circle, '1776-2026' banner, classic red white and blue"},{"image":"/patches/themes/statue-of-liberty-patch.webp","prompt":"Statue of Liberty torch and crown, sunrays behind, '1776-2026' banner, teal and gold"},{"image":"/patches/themes/statue-of-liberty-patch-2.webp","prompt":"Lady Liberty silhouette in a circle with thirteen stars, two-tone modern patch"},{"image":"/patches/themes/statue-of-liberty-patch-3.webp","prompt":"Detailed Statue of Liberty with American flag, '250 Years' ar
54c, full color shield"},{"image":"/patches/themes/statue-of-liberty-patch-4.webp","prompt":"Statue of Liberty torch and crown, sunrays behind, '1776-2026' banner, teal and gold"},{"image":"/patches/themes/spirit-of-76-patch.webp","prompt":"Spirit of '76 fife and drum trio silhouette, '1776-2026' banner, antique red white and blue"},{"image":"/patches/themes/spirit-of-76-patch-2.webp","prompt":"Single colonial drummer with flag, circular patch, '250 Years' arc, vintage gold"},{"image":"/patches/themes/spirit-of-76-patch-3.webp","prompt":"Marching band Spirit of '76 patch, shield shape, stars and stripes background"},{"image":"/patches/themes/spirit-of-76-patch-4.webp","prompt":"Spirit of '76 fife and drum trio silhouette, '1776-2026' banner, antique red white and blue"}]`),mn=Kl,Hn={en:"English",es:"Español",de:"Deutsch"},Pi={en:{text:"Choose your language",ok:"Got it"},es:{text:"Elige tu idioma",ok:"Entendido"},de:{text:"Sprache wählen",ok:"Verstanden"}},ln={en:"Language",es:"Idioma",de:"Sprache"},Os="pd_tip_lang_seen";function Yl(){try{return typeof localStorage<"u"&&localStorage.getItem(Os)==="1"}catch{return!0}}function Bi(){try{localStorage.setItem(Os,"1")}catch{}}function Ql(){return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}function Jn(){const t=In(),a=si(),[s,i]=h.useState(!1),[o,l]=h.useState(null),[u,p]=h.useState(!1),g=h.useRef(null);if(h.useEffect(()=>{if(!a||Yl())return;const R=setTimeout(()=>p(!0),600);return()=>clearTimeout(R)},[a]),h.useEffect(()=>{if(!s)return;const R=I=>{g.current&&g.current.contains(I.target)||I.target.closest&&I.target.closest("[data-language-menu]")||i(!1)},L=I=>{I.key==="Escape"&&i(!1)},k=()=>i(!1);return document.addEventListener("mousedown",R),document.addEventListener("keydown",L),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",L),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[s]),!a)return null;const{setLocale:b,allowed:y}=a,T=Pi[t]||Pi.en,j=()=>{p(!1),Bi()},P=()=>{!s&&g.current&&l(g.current.getBoundingClientRect()),i(R=>!R),u&&j()};let S={};if(o&&typeof window<"u"){const R=o.top>window.innerHeight-180,L=Math.max(8,window.innerWidth-o.right);S=R?{bottom:Math.round(window.innerHeight-o.top+6),right:L}:{top:Math.round(o.bottom+6),right:L}}return e.jsxs("span",{style:{position:"relative",display:"inline-flex"},children:[e.jsxs("button",{ref:g,type:"button",onClick:P,"aria-haspopup":"listbox","aria-expanded":s,"aria-label":ln[t]||ln.en,style:{display:"inline-flex",alignItems:"center",gap:5,background:"#fff",border:"1px solid #e2e8f0",borderRadius:8,color:"#475569",fontFamily:"inherit",fontWeight:700,fontSize:"0.72rem",cursor:"pointer",padding:"4px 9px",whiteSpace:"nowrap"},children:[e.jsx(Ql,{}),e.jsx("span",{children:Hn[t]||Hn.en}),e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"#94a3b8",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:s?"rotate(180deg)":"none",transition:"transform .15s"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),u&&e.jsxs("span",{role:"status","data-language-tip":!0,style:{position:"absolute",right:"calc(100% + 10px)",top:"50%",transform:"translateY(-50%)",zIndex:5,display:"inline-flex",alignItems:"center",gap:8,whiteSpace:"nowrap",background:"#1e1b4b",color:"#fff",borderRadius:10,padding:"7px 8px 7px 11px",fontSize:"0.74rem",fontWeight:600,boxShadow:"0 8px 22px rgba(15,23,42,0.28)"},children:[T.text,e.jsx("button",{type:"button",onClick:j,"aria-label":T.ok,title:T.ok,style:{display:"inline-flex",background:"rgba(255,255,255,0.14)",border:"none",color:"#fff",borderRadius:6,padding:3,cursor:"pointer"},children:e.jsx(go,{size:"0.9em"})}),e.jsx("span",{"aria-hidden":"true",style:{position:"absolute",right:-5,top:"calc(50% - 5px)",width:10,height:10,background:"#1e1b4b",transform:"rotate(45deg)"}})]}),s&&o&&yn.createPortal(e.jsx("div",{"data-language-menu":!0,role:"listbox","aria-label":ln[t]||ln.en,style:{position:"fixed",zIndex:2147483e3,...S,background:"#fff",border:"1px solid #e5e7eb",borderRadius:12,boxShadow:"0 16px 40px -10px rgba(15,23,42,0.38)",padding:6,minWidth:150,fontFamily:"-apple-system,Segoe UI,Helvetica,Arial,sans-serif"},children:y.map(R=>{const L=R===t;return e.jsx("button",{type:"button",role:"option","aria-selected":L,lang:R,onClick:()=>{b(R),i(!1),Bi()},style:{display:"block",width:"100%",textAlign:"left",border:"none",cursor:"pointer",borderRadius:8,padding:"8px 11px",background:L?"rgba(124,58,237,0.10)":"transparent",color:"#0f172a",fontFamily:"inherit",fontSize:"0.84rem",fontWeight:L?700:500},children:Hn[R]},R)})}),document.body)]})}const Jl={hero:{title:"KI-Aufnäher-Designer",subtitle:"Produktionsreifer Entwurf, schnell geliefert"},askBar:{label:"Beschreiben Sie Ihren Aufnäher"},reloading:{title:"Wird neu geladen und erneut versuchtâ¦",sub:"Ihre Eingabe und Ihr hochgeladenes Bild sind gespeichert â Sie müssen nichts noch einmal machen."},greeting:{parkerName:"Hallo, ich bin Parker",intro:"Sagen Sie mir, welchen Aufnäher Sie möchten â Stil, Thema, Farben, Text â und ich entwerfe ihn sofort.",uploadLead:"Sie können auch",uploadCta:"eine Skizze oder ein Foto hochladen",gallery:"Brauchen Sie Inspiration? Unsere Galerie finden Sie",galleryHere:"hier",uploadedRef:"Hochgeladene Vorlage:",refAlt:"Vorlage",brandRef:"Referenzmarke:",brandGuidelines:"Markenrichtlinien angewendet"},affordance:{showGuidance:"Optionen anzeigen",designGuidance:"Optionen"},errors:{autoRetrying:(t,a)=>`Wir versuchen es automatisch erneut${t&&a>1?` (Versuch ${t} von ${a})`:""} â Sie müssen nichts tun.`,priorAuto:t=>`Wir haben das bereits ${t} Mal automatisch wiederholt (jeweils mit einem Neuladen der Seite).`,autoRetryIn:t=>`Automatischer neuer Versuch in ${t} sâ¦`,cancel:"Abbrechen",tryAgain:"Erneut versuchen",ref:"Ref.:",reportThis:"Problem melden",reportSubject:t=>`Problem mit dem Aufnäher-Designer${t?" â "+t:""}`,reportBody:t=>`Was passiert ist: 55 56 57Was ich vorhatte: 58 59 60Referenzcode: ${t||"(keiner)"}`},rateLimit:{titleAnon:()=>"Melden Sie sich an für weitere Entwürfe",titleAuth:t=>`Sie haben das heutige Limit erreicht (${t})`,bodyAnon:()=>"",bodyAuth:t=>t?"Ihr Tageskontingent wird um Mitternacht Pacific Time zurückgesetzt. Sollen wir einen davon jetzt fertigen, oder brauchen Sie ein höheres Limit? Wir helfen gern.":"Ihr Tageskontingent wird um Mitternacht Pacific Time zurückgesetzt.",bodySoft:(t,a)=>t>0?`Heute noch ${t} als Gast â mit Anmeldung ${a} zusätzlich.`:`Melden Sie sich an und Sie erhalten heute ${a} weitere Entwürfe.`,titleMonthWarn:t=>t>=90?`Sie sind fast an Ihrem monatlichen Entwurfslimit â ${t} % genutzt`:`Sie nähern sich Ihrem monatlichen Entwurfslimit â ${t} % genutzt`,bodyMonthWarn:(t,a)=>a?`Ihre Entwürfe werden am ${t} zurückgesetzt. Brauchen Sie vorher mehr? Schreiben Sie uns einfach.`:`Ihre Entwürfe werden am ${t} zurückgesetzt.`,titleMonthCap:()=>"Sie haben Ihr monatliches Entwurfslimit erreicht",bodyMonthCap:(t,a)=>a?`Es wird am ${t} zurückgesetzt. Sollen wir einen davon jetzt fertigen, oder brauchen Sie vorher mehr Entwürfe? Schreiben Sie an ${a}, wir kümmern uns darum.`:`Es wird am ${t} zurückgesetzt.`,orDivider:"oder",continueWith:t=>`Weiter mit ${t}`,orderLabel:"Einer gefällt Ihnen schon?",orderCta:"Fertigen lassen",couponNote:"15 % Rabatt auf Ihre erste Bestellung",emailLabel:"Lieber später entscheiden?",emailHint:"Wir schicken Ihnen diese Entwürfe per E-Mail â Sie machen weiter, wann es Ihnen passt.",emailPlaceholder:"[email protected]",emailSendCta:"Entwürfe per E-Mail senden",emailSending:"Wird gesendetâ¦",emailSent:"Gesendet â schauen Sie in Ihr Postfach.",emailError:"Das hat leider nicht geklappt. Noch einmal versuchen?",signInCta:()=>"Anmelden für weitere Entwürfe",emailCta:"Schreiben Sie uns bei Fragen",moreInfo:"Mehr Infos"},loading:{designing:"Ihr Aufnäher wird entworfen",reading:"Ihre V
60orlage wird ausgewertet",stop:"Stopp",signInTitle:"Nutzen Sie die Wartezeit zum Anmelden",signInSub:"Wir speichern jeden Ihrer Entwürfe, damit Sie später weitermachen können â auf jedem Gerät."},wait:{badges:["Weltweit kostenloser Versand","Garantiert günstigster Produktionspreis","Kostenlose fachliche Prüfung"],couponCopy:"Kopieren",couponCopied:"Kopiert",couponCopyHint:"kopieren"},placeholder:{editing:"Ãnderungen beschreiben⦠(z. B. âText ändern in Feuerwehr Musterstadtâ)",refReady:"Anweisungen ergänzen (optional) â oder direkt auf Erzeugen tippen",generating:"Ihr Aufnäher wird erzeugtâ¦",describe:"Beschreiben Sie Ihren Aufnäherâ¦",brand:"Beschreiben Sie einen Aufnäher für {brand}â¦"},typingExamples:["Aufnäher für das Sommerfest der Freiwilligen Feuerwehr 2026","Pfadfinder-Lagerfeuer-Aufnäher mit Kiefern","Karate-Dojo-Aufnäher mit Drache â Black Belt Academy","Vereinswappen mit Adler und Ortsnamen","Feuerwehr-Wappen mit Leiter und Flammen","Aufnäher für den Schützenverein â Jubiläum 2026"],starterPrompts:[{label:"Feuerwehr",prompt:"Aufnäher für die Freiwillige Feuerwehr mit Helm, Leiter und Ortsnamen â Wappenform, Rot und Gold",configPatch:{style:"LawEnforcement",shape:"shield",mainFeature:"Helm und Leiter",eventName:"Freiwillige Feuerwehr"}},{label:"Verein",prompt:"Vereinswappen mit Adler und Ortsnamen â rund, Blau und Gold",configPatch:{style:"Other",shape:"circle",mainFeature:"Adler",eventName:"Verein"}},{label:"Kampfsport",prompt:"Karate-Dojo-Aufnäher mit kraftvollem Drachen und japanischen Schriftzeichen â rund, Schwarz und Karmesinrot",configPatch:{style:"Karate",shape:"circle",mainFeature:"kraftvoller Drache",eventName:"Karate Dojo"}},{label:"Schützenverein",prompt:"Aufnäher für den Schützenverein mit Zielscheibe und Eichenlaub â Wappenform, Grün und Silber",configPatch:{style:"Other",shape:"shield",mainFeature:"Zielscheibe und Eichenlaub",eventName:"Schützenverein"}},{label:"FuÃballverein",prompt:"FuÃball-Vereinswappen mit Flamme und Ball â rund, kräftiges Rot und WeiÃ",configPatch:{style:"Sports",shape:"circle",mainFeature:"Flamme und FuÃball",eventName:"FuÃballverein"}},{label:"Motorradclub",prompt:"GroÃer Rückenaufnäher für einen Motorradclub mit Adlerschwingen und Totenkopf â Rocker-Form, Schwarz und Silber",configPatch:{style:"Motorcycle",shape:"rocker",mainFeature:"Adlerschwingen und Totenkopf",eventName:"Motorradclub"}}],quickEdits:["Farben in Marineblau und Gold ändern","Kräftiger und schlichter machen","Mehr Details im Hintergrund","Text entfernen","Eine andere Form ausprobieren","Schrift gröÃer machen"],actions:{restart:"Erneut versuchen",removeRefImage:"Bild entfernen",refImageAlt:t=>`Referenz ${t}`,uploadTitleReady:"Vorlage bereit",uploadTitleEmpty:"Skizze oder Foto hochladen",uploadTitleMore:"Weitere Vorlage hinzufügen",uploadTitleFull:"Maximal 3 Vorlagen",uploadAria:"Bild hochladen",micTitle:"Beschreiben Sie Ihren Aufnäher laut",micStopTitle:"Aufnahme beenden",micAria:"Spracheingabe starten",micStopAria:"Spracheingabe beenden",micListening:"Ich höre zu â beschreiben Sie Ihren Aufnäherâ¦",micBlocked:"Der Mikrofonzugriff ist blockiert. Ãffnen Sie das Symbol links in der Adressleiste, erlauben Sie das Mikrofon und versuchen Sie es erneut.",micBlockedHelp:"So erlauben Sie es",generateTitle:"Erzeugen (Enter)",generateAria:"Erzeugen",generating:"Wird erzeugtâ¦",generate:"Erzeugen",generateShort:"Los",coachEditThenGenerate:"Text bearbeiten, dann auf Generieren klicken",coachEditThenGenerateShort:"Text bearbeiten, dann auf Los klicken",coachDismiss:"SchlieÃen",help:"Hilfe nötig?",helpTitle:"Sagen Sie einem Menschen, was Sie brauchen â wir übernehmen"},help:{heading:"Sagen Sie uns, was Sie machen möchten â unser Team gestaltet es für Sie, kostenlos",sub:"Wenn der Designer nicht hinkommt, kämpfen Sie nicht weiter â beschreiben Sie den Aufnäher in eigenen Worten, und wir übernehmen ab hier.",needLabel:"Was möchten Sie machen?",needPlaceholder:"z. B. Das Wappen unserer Feuerwehr mit der Wachennummer, so wie es auf unseren Fahrzeugen aussieht â die KI ändert ständig den Text.",emailLabel:"Ihre E-Mail",phoneLabel:"Telefon (optional)",phoneHint:"Nummer angeben, wenn wir lieber anrufen sollen.",attachedNote:"Wir hängen den Entwurf auf dem Bildschirm und diesen Chat an, damit Sie nichts zweimal erklären müssen.",send:"An einen Me
60nschen senden",sending:"Wird gesendetâ¦",error:"Das ging nicht raus â bitte erneut versuchen oder an [email protected] schreiben.",successHeading:"Angekommen â wir kümmern uns",successBody:"Ein Designer aus unserem Team antwortet innerhalb von 2 Arbeitsstunden (werktags). Schauen Sie in Ihr Postfach â eine Kopie ist auch dort.",emailPlaceholder:"[email protected]",phonePlaceholder:"+49 170 1234567",close:"SchlieÃen"},disclaimers:["Dies sind KI-erzeugte Vorschauen. Der fertige Aufnäher aus unserer Produktion ist sauber ausgearbeitet, präzise und produktionsreif.",["Mit dem Erstellen eines Entwurfs stimmen Sie zu, dass dieser (und Fotos des fertigen Aufnähers) in unserem Marketing und unserer Werbung gezeigt werden dürfen, auch in sozialen Netzwerken. Zum Widerspruch schreiben Sie an ",{mail:"[email protected]"},"."]],disclaimerLink:{text:"So verändert sich ein Entwurf in der Produktion",href:"/design-vs-production"},previewNote:"Dies sind KI-erzeugte Vorschauen. Feine Details können auf dem fertigen Aufnäher leicht abweichen.",seeItMade:{title:"So sieht ein Entwurf als fertiger Aufnäher aus",body:"Echte Aufträge im direkten Vergleich: der Entwurf aus diesem Chat und die Druckvorlage aus der Produktion."},trustpilot:{rate:"Bewerten Sie uns auf",aria:"PatchDesign.AI auf Trustpilot bewerten (öffnet in neuem Tab)"},zoom:{hint:"Klicken Sie irgendwo oder drücken Sie Esc zum SchlieÃen",close:"SchlieÃen",alt:"VergröÃerter Aufnäher-Entwurf",threadNote:"Ihr Entwurf ist eine KI-Vorschau. Gesticktes Garn hat physische Grenzen, daher weichen feine Details und exakte Farbverläufe auf dem fertigen Aufnäher leicht ab.",threadNoteShort:"KI-Vorschau â feine Details weichen beim Sticken ab."},toast:{saving:"Wird gespeichertâ¦",saved:"In âMeine Entwürfeâ gespeichert",saveErr:"Speichern fehlgeschlagen â bitte erneut versuchen",saveSignin:"Melden Sie sich an, um Entwürfe in Ihrem Konto zu speichern",downloading:"Wird heruntergeladenâ¦",downloadOk:"In Ihrem Download-Ordner gespeichert",downloadErr:"Download fehlgeschlagen â bitte erneut versuchen",downloadTap:"Tippen, um Ihren Entwurf herunterzuladen",saveBlocked:"Nutzen Sie die Schaltfläche âHerunterladenâ, um Ihren Entwurf zu speichern",saveBlockedSignin:"Zum Herunterladen anmelden",saveBlockedDownload:"Diesen Entwurf herunterladen",saveBlockedTryOn:"Dieses Bild herunterladen"},designCard:{leadPre:"Hier ist Ihr Aufnäher â passen Sie die Optionen an oder tippen Sie auf ",leadPreNoOptions:"Hier ist Ihr Aufnäher â tippen Sie auf ",leadShort:"Hier ist Ihr Aufnäher:",leadShortLink:"Prüfen lassen",leadSend:"Fertigen lassen",leadPost:".",orderThis:"Diesen bestellen",orderThisShort:"Bestellen",continueThis:"Mit diesem weitermachen",continueThisShort:"Bearbeiten",continuingThis:"Dieser wird bearbeitet",showAllDesigns:"Alle Entwürfe und Verlauf anzeigen",otherHistory:"Weitere Entwürfe und Chatverlauf",otherHistoryHint:"öffnen, um andere Versionen zu bearbeiten",earlierDesigns:"Frühere Entwürfe",orderVerb:"Bestellen",editVerb:"Bearbeiten",moreOptions:"Weitere Optionen",earlierPrev:"Frühere Entwürfe anzeigen",earlierNext:"Weitere Entwürfe anzeigen",editHere:"Ãnderungen â Chat unten",editHereAria:"Diesen Entwurf im Chat unten ändern",refining:"Wird überarbeitetâ¦",generatedWith:"Erzeugt mit",tryOnAria:"Trage-Vorschauen",tryOnDisclaimer:"Nur zur Veranschaulichung",tryOnToggle:"Trage-Vorschauen ansehen",tryOnToggleHide:"Trage-Vorschauen ausblenden",zoomAria:"Aufnäher-Entwurf vergröÃern",imageAlt:"Erzeugter Aufnäher",zoomTitle:"VergröÃern",downloadTitle:"PNG herunterladen",downloadTitleAnon:"Anmelden, um das PNG herunterzuladen",downloadAriaAnon:"Zum Herunterladen anmelden",saveTitleAuthed:"In âMeine Entwürfeâ speichern",saveTitleAnon:"Zum Speichern anmelden",saveAria:"Speichern",downloadAria:"Herunterladen",showSettings:"Einstellungen anzeigen",hideSettings:"Einstellungen ausblenden",sendShort:"Senden",sendFull:"Fertigen lassen"},legibility:{failTitle:"Der Text ist möglicherweise zu klein für sauberes Sticken",cautionTitle:"Der Text liegt nah an der Lesbarkeitsgrenze",regenerate:"Mit gröÃerem Text neu erzeugen"},feedback:{prompt:"War das hilfreich?",barAria:"War dieser Entwurf hilfreich?",thumbsUp:"Daumen hoch",thumbsDown:"Daumen runter",thanksUp:"Danke für die Rückmeldung â schön, dass dieser gepasst hat.",thanksDown:"Danke für die Rückmeldung.",thanksNoted:"Danke â notiert.",reasonPlaceholder:"Was hat nicht gepasst? (optional)",skip:"Ãberspringen",send:"Senden",errSave:"Rückmeldung konnte nicht gespeichert werden"},showcase:{madeWith:"Mit diesem Werkzeug erstellt",useThis:"Als Ausgangspunkt verwenden",trust:["Weltweit kostenloser Versand","Garantiert günstigster Produktionspreis","Kostenlose fachliche Prüfung durch Menschen","Versand in 10 Tagen"]},survey:{label:"Rückmeldung an das PatchDesign-Team",labelNeutral:"Kurzes Feedback",ask:"Kurze Frage: Was würde dieses Werkzeug für Sie noch besser machen?",topics:[{id:"not-followed",label:"Es hat meine Anweisungen nicht befolgt"},{id:"unasked-changes",label:"Es hat Dinge geändert, die ich nicht wollte"},{id:"lost-earlier",label:"Schwer, zu einem früheren Entwurf zurückzukommen"}
60,{id:"confusing-controls",label:"Die Bedienelemente waren verwirrend"},{id:"all-good",label:"Nichts â es funktioniert gut"},{id:"other",label:"Etwas anderes"}],otherAsk:"Was würden Sie ändern?",back:"Zurück",note:"Das ändert Ihren Aufnäher nicht â nutzen Sie für Ãnderungen am Entwurf das Chatfeld unten.",placeholder:"Ein Satz genügt â völlig freiwillig.",skip:"Ãberspringen",send:"Senden",done:"Danke â das hilft uns weiter.",editAsk:"Das klingt nach einer Ãnderung an Ihrem Aufnäher, nicht nach Rückmeldung. Soll ich es stattdessen auf Ihren Entwurf anwenden?",editApply:"Auf meinen Entwurf anwenden",editKeep:"Nein â als Rückmeldung senden"},rail:{title:"Optionen",aria:"Optionen",hideTitle:"Einstellungen ausblenden",hideAria:"Einstellungen ausblenden",houseStyle:{label:"Hausstil",on:"Unsere Farben, Schriften und Regeln prägen Ihr Design.",off:"Aus: Ihr Design folgt nur Ihren Wünschen.",paused:"Pausiert, solange {brand} angewendet ist."},lockedBrand:{label:"Marke",applied:"Ihre Markenrichtlinien werden angewendet",staff:"Sie gestalten für diesen Kunden",dead:"Dieser Markenlink ist nicht mehr aktiv. Bitten Sie {tenant} um einen neuen.",fallbackTenant:"den Absender",title:"Aufnäher für {brand}",sub:"Jedes Design folgt den Markenrichtlinien von {brand}. {tenant} fertigt und versendet es.",staffTitle:"Sie gestalten für {brand}",staffSub:"Jedes Design folgt den Markenrichtlinien von {brand}.",kitColors:"Farben",kitLogo:"Logo",kitLogoOnFile:"hinterlegt",kitLettering:"Schrift",setBy:"Festgelegt von {tenant}",starters:{halloween:["Halloween-Teamaufnäher","Ein Halloween-Aufnäher für das Team von {brand}"],holiday:["Weihnachts-Teamaufnäher","Ein Aufnäher zur Weihnachtszeit für das Team von {brand}"],summer:["Sommer-Teamaufnäher","Ein Sommer-Aufnäher für das Team von {brand}"],newYear:["Neujahrs-Teamaufnäher","Ein Neujahrs-Aufnäher für das Team von {brand}"],opening:["Neueröffnung","Ein Aufnäher zur Neueröffnung einer Filiale von {brand}"],service:["Dienstjubiläum","Ein Aufnäher für 5 Jahre im Team von {brand}"],award:["Team-Auszeichnung","Ein Auszeichnungs-Aufnäher für das beste Team von {brand}"]}},labels:{brandRef:"Referenzmarke oder Website",brandRefHint:"Ãbernimmt Markenfarben + Logo",style:"Stil",detail:"Detailgrad",event:"Anlass / Team",eventPlaceholder:"z. B. Sommerfest 2026",mainFeature:"Hauptmotiv",mainFeaturePlaceholder:"z. B. Adler, Drache",type:"Art",size:"GröÃe â Breite à Höhe",shape:"Form",quantity:"Menge",width:"Breite",height:"Höhe",applyTitle:"In den Chat übernehmen",applyEventAria:"Anlass/Team in den Chat übernehmen",applyFeatureAria:"Hauptmotiv in den Chat übernehmen",widthAria:"Breite",heightAria:"Höhe",placement:"Platzierung"},detailOptions:["Weniger","Normal","Mehr"],shape:{round:"Rund",rectangle:"Rechteckig",other:"Andere",roundTitle:"Rund (Kreis oder Ellipse, je nach Breite à Höhe)",rectangleTitle:"Rechteckig (Quadrat oder Rechteck, je nach Breite à Höhe)",otherTitle:"Andere (Stern, Sechseck, Wappen, individuellâ¦)",otherPresetAria:"Vorlage für andere Form",customAria:"Beschreibung der individuellen Form",customPlaceholder:"z. B. Wolke, Blitz, Pfotenabdruck",customOption:"Individuellâ¦"},shapeNames:{circle:"Kreis",ellipse:"Ellipse",square:"Quadrat",rectangle:"Rechteck",star:"Stern",heart:"Herz",hexagon:"Sechseck",octagon:"Achteck",shield:"Wappen",rocker:"Bogen",diamond:"Raute",triangle:"Dreieck",banner:"Banner",badge:"Abzeichen",crest:"Emblem","custom shape":"Individuelle Form"},quantityUnit:"Stk.",customSize:{active:'Feinabstufung 1/16"',switch:'+ Individuell (1/16")',activeTitle:"Zurück zu den StandardgröÃen",switchTitle:'Auf Feinabstufung in 1/16" umschalten'},placementOptions:{none:"Keine ausgewählt",hat:"Kappe","shirt-front":"T-Shirt vorne",polo:"Poloshirt",jacket:"Jacke","small-bag":"Kleine Tasche","large-bag":"GroÃe Tasche","shirt-back":"T-Shirt hinten"},placementFitHint:t=>`bis ${t}`,placementGotIt:"Verstanden",placementClose:"SchlieÃen",placementWarning:(t,a,s)=>`Mit ${t} ist dieser Aufnäher gröÃer als die ${a}, die auf diese Stelle passen (${s}). Wähle eine kleinere GröÃe oder eine gröÃere Platzierung.`,smallPatchWarning:{prefix:"Kleiner Aufnäher â der Text könnte unlesbar werden. Zielen Sie auf ",suffix:".",strong:t=>`höchstens ${t} Zeichen pro Zeile`},rerender:{bodyPrefix:"Dieser Entwurf wurde erstellt für ",bodyMid:". Soll er neu erzeugt werden für ",bodySuffix:"?",button:"Neu erzeugen"},quote:{perPatchSuffix:"/Stk.",totalLabel:"gesamt",send:"Fertigen lassen",preparing:"Prüfung wird vorbereitetâ¦"},instant:{volume:"Menge",backing:"Rückseite",sewOn:"Zum Aufnähen (inklusive)",pay:"Fertigen lassen",perPatch:"pro Aufnäher",starting:"Kasse wird geöffnetâ¦",savings:(t,a)=>`Mengenrabatt von ${t} % / ${a} $`,ctaOffer:t=>`15 % Rabatt mit ${t} an der Kasse, begrenzte Zeit.`,couponCardNote:t=>`${t} â 15 % Rabatt an der Kasse. Begrenzte Zeit, nur Erstbestellung.`,ladderQty:(t,a)=>`${t} Aufnäher zu ${a}`,ladderCoupon:t=>`${t}, Erstbestellung`,ladderPay:"Sie zahlen",quantity:"Menge",ladderPrev:"Kleinere Mengen",ladderNext:"GröÃere Mengen",backingQuote:"Anfrage",backingSetup:t=>`+${t} einmalig`,ladderShipping:"Versand",ladderFree:"Kostenlos",ladderCodeNote:(t,a)=>`${t} wird an der Kasse automatisch angewendet â Sie sparen ${a}. Kein Code nötig.`,ladderLimited:"Begrenzte Zeit, nur Erstbestellung.",reassureSample:"Sie geben Ihren Aufnäher frei, samt Garnwiedergabe im Detail, vor dem Versand.",basePrice:"Basispreis",saveBadge:t=>`-${t} %`,smallBatch:"Kleinserie",more:"mehr",showFewer:"Weniger",prevOptions:"Frühere Optionen",nextOptions:"Weitere Optionen",stepUp:t=>`${t} erhöhen`,stepDown:t=>`${t} verringern`,included:"inklusive",sewOnShort:"Nähen",noBacking:"Ohne Rückseite",noBackingShort:"Keine",reassure:"Sie geben ein echtes Muster frei, samt Garnwiedergabe im Detail, vor der Serienproduktion.",sampleFor:"für",sampleTier:"1 Stück",sampleTierBadge:"Muster",sampleCtaMain:"einen echten Aufnäher",sampleCtaNote:"auf Bestellung gefertigt · nur Fotos, kein Versand",sampleCtaNoteShipped:"auf Bestellung gefertigt · Versand inklusive",sampleDisclaimer:"Das ist ein echter Aufnäher, auf Bestellung auf denselben Produktionsmaschinen gestickt. Sie erhalten Fotos davon per E-Mail; der Aufnäher selbst wird nicht verschickt. Die Gebühr ist nicht erstattungsfähig, aber $30 werden auf Ihre Produktionsbestellung angerechnet.",sampleDisclaimerShipped:"Das ist ein echter Aufnäher, auf Bestellung auf denselben Produktionsmaschinen gestickt und an Sie verschickt. Der Versand ist im Preis enthalten. Die Gebühr ist nicht erstattungsfähig, aber $30 werden auf Ihre Produktionsbestellung angerechnet.",error:"Die Kasse konnte nicht geöffnet werden. Bitte versuchen Sie es erneut.",commentsLabel:"Anmerkungen / besondere Wünsche",commentsPlaceholder:"Besondere Anforderungen, bestimmte Farben, Liefertermin oder Fragen an unser Teamâ¦",typeHintNote:(t,a)=>`Ihre Vorschau zeigt noch ${t}. Geben Sie im Chat weitere Hinweise oder tippen Sie auf Erzeugen, um sie als ${a} zu sehen.`,typeHintGenerate:t=>`Als ${t} erzeugen`,typeHintGuide:"Erst Hinweise geben",typeHintClose:"SchlieÃen",specialOrderSuffix:" â Sonderanfertigung, wir erstellen ein Angebot",specialOrderNote:"Sonderanfertigung â unser Team sendet vor der Abbuchung ein individuelles Angebot.",priceMatchLabel:"Garantiert günstigster Preis",includesPrefix:"Enthält:",incCoverage:"100 % Stickerei",incSample:"ein echtes Muster",incBorder:"jede Randart",incShipping:"Gratisversand",priceMatchAria:"Garantiert günstigster Preis â so funktioniert unsere Preisgarantie",sizeMax:(t,a)=>`${t}-Aufnäher gehen bis ${a} â wir haben das Maximum eingestellt.`,sizeMaxWhy:(t,a,s,i)=>`${t}-Aufnäher werden bis ${a} gefertigt, deshalb haben wir das Maximum eingestellt. GröÃer? ${s} geht bis ${i}.`,sizeMin:(t,a)=>`${t}-Aufnäher beginnen bei ${a} â wir haben das Minimum eingestellt.`,captureTitle:"Fast geschafft",captureSub:"Wohin sollen wir Ihre Bestellbestätigung und die Versandinfos schicken?",freeShip:"Weltweit kostenloser Versand",captureRecap:"Ihre Bestellung",captureEmailLabel:"E-Mail",captureEmailPlaceholder:"[email protected]",captureContinue:"Weiter zur sicheren Kasse",captureBack:"Zurück",captureEmailShort:"E-Mail für Infos zu Ihrer Bestellung",captureClose:"SchlieÃen",captureInvalid:"Bitte geben Sie eine gültige E-Mail-Adresse ein.",importNote:"Be
60i Zustellung können Einfuhrumsatzsteuer und ggf. Zoll anfallen â nicht im Preis enthalten."}},view360:{button:"360°",buttonTitle:"In 360° ansehen: Struktur, Rand und Rückseite",buttonAria:"Diesen Aufnäher in 360 Grad ansehen",title:"360°-Ansicht",close:"SchlieÃen",front:"Vorderseite",back:"Rückseite",spin:"Drehen",pause:"Pause",hint:"Zum Drehen ziehen.",loading:"3D-Ansicht wird erstellt",unavailable:"Die 3D-Ansicht benötigt WebGL, das in diesem Browser deaktiviert ist. Hier eine einfache Drehung.",canvasAria:"Der Aufnäher in 3D, drehend",note:"Eine simulierte Vorschau von Material, Rand und Rückseite Ihrer Auswahl. Fadenstruktur, Stärke und Finish weichen in der Produktion leicht ab.",backs:{"sew-on":"Rückseite zum Aufnähen",rubber:"Glatte Gummi-Rückseite","iron-on":"Rückseite zum Aufbügeln",adhesive:"Selbstklebende Rückseite",hook:"Klett (Hakenseite)","hook-loop":"Klett, Hakenseite mit Flauschteil","button-loop":"Rückseite zum Aufnähen mit Knopfschlaufe",magnet:"Magnet-Rückseite",pin:"Rückseite mit Anstecknadel"}},tryOn:{headerPrefix:"Auf",close:"SchlieÃen",prev:"Zurück",prevAria:"Vorheriges Kleidungsstück",next:"Weiter",nextAria:"Nächstes Kleidungsstück",zoomTitle:"Ansicht vergröÃern",onLabelPrefix:"Ansehen auf",patchOnGarmentAlt:"Aufnäher auf dem Kleidungsstück",header:t=>`Auf ${{"T-Shirt":"dem T-Shirt",Poloshirt:"dem Poloshirt",Kappe:"der Kappe",Tasche:"der Tasche","GroÃe Tasche":"der groÃen Tasche",Jacke:"der Jacke",Langarmshirt:"dem Langarmshirt",Rücken:"dem Rücken"}[t]||t}`,tryAria:t=>`Auf ${t} ansehen`,seeAria:t=>`Auf ${t} ansehen`},share:{title:"Teilen",aria:"Teilen",menuAria:"Optionen zum Teilen",copyLink:"Link kopieren",dismiss:"SchlieÃen",tiles:{instagram:"Instagram",pinterest:"Pinterest",facebook:"Facebook",x:"X",whatsapp:"WhatsApp",gmail:"Gmail",outlook:"Outlook",print:"Drucken"},lead:t=>{const a=(t||"").trim();return a?`Gerade mit PatchDesign.AI entworfen: â${a.length>120?a.slice(0,119)+"â¦":a}â`:"Diesen individuellen Aufnäher habe ich gerade mit PatchDesign.AI entworfen"},pasteHelper:{instagram:{label:"Instagram",title:"Bereit zum Posten auf Instagram",steps:["Wechseln Sie zum Instagram-Tab (oder öffnen Sie die App auf Ihrem Handy).","Tippen Sie auf + (Erstellen) und wählen Sie das Aufnäher-Bild aus Ihrem Download-Ordner.","Fügen Sie den Text im Feld für die Bildunterschrift ein (Strg/Cmd + V).","Tippen Sie auf Teilen."],openLabel:"Instagram öffnen"},facebook:{label:"Facebook",title:"Bereit zum Posten auf Facebook",steps:["Wechseln Sie zum Facebook-Tab â das Teilen-Fenster ist bereits geöffnet.","Falls die Linkvorschau leer bleibt, warten Sie einen Moment oder klicken Sie auf Foto/Video und wählen Sie den Aufnäher aus Ihrem Download-Ordner.","Fügen Sie Ihren Text im Feld âWas machst du gerade?â ein (Strg/Cmd + V).","Klicken Sie auf Posten."],openLabel:"Facebook öffnen"}},pasteHelperReady:{imageSaved:"Bild in Ihrem Download-Ordner gespeichert",captionCopied:"Text und Link in die Zwischenablage kopiert",captionFailed:"Text konnte nicht kopiert werden â nutzen Sie unten âLink kopierenâ"},printSubject:"Schauen Sie sich diesen Aufnäher an, den ich entworfen habe",printTitle:"Aufnäher-Entwurf",shareStatus:{popupBlocked:"Pop-up blockiert â bitte Pop-ups zum Drucken erlauben.",printOpened:"Druckdialog in einem neuen Fenster geöffnet.",printFailed:"Druckdialog konnte nicht geöffnet werden.",pinterestImageReady:"Pinterest geöffnet â Bild aus Ihrem Link übernommen.",xImageReady:"Bild in Downloads gespeichert â fügen Sie es Ihrem Beitrag auf X hinzu.",gmailReady:"Bild in Downloads gespeichert â hängen Sie es an Ihre Gmail-Nachricht an.",outlookReady:"Bild in Downloads gespeichert â hängen Sie es an Ihre Outlook-Nachricht an.",whatsappReady:"Bild in Downloads gespeichert â hängen Sie es in WhatsApp an, falls die Linkvorschau nicht von selbst erscheint.",whatsappBlocked:"Pop-up blockiert. Bild in Downloads gespeichert â bitte öffnen Sie WhatsApp selbst.",whatsappFailed:"WhatsApp konnte nicht geöffnet werden. Nutzen Sie stattdessen âLink kopierenâ.",linkCopied:"Link kopiert. Bild in Downloads gespeichert â fügen Sie es dort an, wo Sie den Link einfügen.",linkCopyManual:"Automatisches Kopieren nicht möglich â halten Sie den Link gedrückt, um ihn zu kopieren.",linkCopyFailed:"Link konnte nicht kopiert werden.",appBlocked:"Pop-up blockiert. Bild in Downloads gespeichert â bitte öffnen Sie die App selbst.",windowFailed:"Das Fenster zum Teilen konnte nicht geöffnet werden.",sharedNative:"Ãber Ihr Gerät geteilt."},titleCore:t=>t?`Individueller Aufnäher: ${t.slice(0,80)}`:"Individueller Aufnäher, entworfen mit PatchDesign.AI",gotIt:"Verstanden",caption:{lead:"Gerade diesen Aufnäher mit PatchDesign.AI entworfen",leadWithPrompt:t=>`Gerade mit PatchDesign.AI entworfen: â${t}â`,xLead:"Gerade diesen Aufnäher entworfen",xLeadWithPrompt:t=>`Gerade diesen Aufnäher entworfen: â${t}â`}},failedGenLead:{label:"Sie möchten nicht warten? Hinterlassen Sie Ihre E-Mail-Adresse, und wir senden den Entwurf, sobald der Dienst wieder läuft:",placeholder:"[email protected]",submit:"Entwurf per E-Mail senden",submitting:"Wird gespeichertâ¦",doneText:"Alles klar â wir senden Ihren Entwurf, sobald der Dienst wieder läuft. Me
60ist innerhalb einer Stunde.",errInvalid:"Bitte geben Sie eine gültige E-Mail-Adresse ein, damit wir den Entwurf senden können.",errSave:"Konnte gerade nicht gespeichert werden â bitte erneut versuchen oder an [email protected] schreiben.",errSaveNeutral:"Konnte gerade nicht gespeichert werden â bitte erneut versuchen."},railChange:"Aktualisiert",confirm:"Bestätigen",visibleStyles:[{key:"YMCA",label:"Jugendarbeit"},{key:"Scouts",label:"Pfadfinder"},{key:"Karate",label:"Kampfsport"},{key:"LawEnforcement",label:"Polizei & Feuerwehr"},{key:"Military",label:"Militär"},{key:"Sports",label:"Sport"},{key:"Motorcycle",label:"Motorradclubs"},{key:"Other",label:"Individuell / Marke"}],patchTypeOptions:[{value:"Embroidered",label:"Gestickt"},{value:"Woven",label:"Gewebt"},{value:"Chenille",label:"Chenille"},{value:"Printed",label:"Gedruckt / Sublimiert"},{value:"PVC 2D",label:"PVC 2D"},{value:"PVC 3D",label:"PVC 3D (erhaben)"}],garmentLabels:{tshirt:"T-Shirt",polo:"Poloshirt",hat:"Kappe",bag:"Tasche","big-bag":"GroÃe Tasche",jacket:"Jacke",longsleeve:"Langarmshirt",backshirt:"Rücken"},brandQuestions:{policeAgency:{ask:"Ist das für eine bestimmte Dienststelle?",yes:"Ja â ich gebe Name/Ort ein",yesNeedsText:"Name der Dienststelle / Ort eingeben",generic:"Allgemeine Behördenoptik"}},shapeQuestion:{ask:"Welche Form soll Ihr Aufnäher haben?",options:{circle:"Kreis",rectangle:"Rechteck",shield:"Wappen",star:"Stern",heart:"Herz",other:"Andereâ¦",surprise:"Ãberraschen Sie mich",otherPlaceholder:"Form eingeben (z. B. Sechseck)"}},chatBubble:{refImagePrompt:"Dieses Referenzbild in einen gestickten Aufnäher-Entwurf umwandeln",editPrefix:"Ãnderung: "},emailDesign:{buttonTitle:"Diesen Entwurf per E-Mail senden",buttonAria:"Diesen Entwurf ohne Anmeldung per E-Mail senden",dialogAria:"Diesen Entwurf per E-Mail senden",heading:"Entwurf per E-Mail senden",body:"Kein Konto nötig. Wir schicken Ihnen den Aufnäher selbst und einen Link, der ihn hier wieder öffnet, bereit zum Weiterbearbeiten.",notReady:"Ihr Entwurf wird noch gespeichert â einen Moment, dann enthält die E-Mail das Bild.",sent:"Gesendet. Sehen Sie in Ihr Postfach.",placeholder:"[email protected]",cancel:"Abbrechen",send:"Senden",sending:"Wird gesendet â¦",close:"SchlieÃen",failed:"Senden fehlgeschlagen. Bitte versuchen Sie es erneut."}},et={en:{hero:{title:"AI Patch Designer",subtitle:"Production ready design, delivered quickly"},askBar:{label:"Describe your patch"},reloading:{title:"Refreshing & retryingâ¦",sub:"Your prompt and uploaded image are saved â no rework needed."},greeting:{parkerName:"Hi, I'm Parker",intro:"Tell me what patch you want â style, theme, colors, text â and I'll design it instantly.",uploadLead:"You can",uploadCta:"upload a sketch or photo",gallery:"Need inspiration? See our gallery",galleryHere:"here",uploadedRef:"Uploaded reference:",refAlt:"Reference",brandRef:"Referenced brand:",brandGuidelines:"Brand guidelines applied"},affordance:{showGuidance:"Show Options",designGuidance:"Options"},errors:{autoRetrying:(t,a)=>`We're trying again automatically${t&&a>1?` (attempt ${t} of ${a})`:""} â no need to do anything.`,priorAuto:t=>`We already auto-retried this ${t} ${t===1?"time":"times"} (refreshing the page each time).`,autoRetryIn:t=>`Auto-retrying in ${t}sâ¦`,cancel:"Cancel",tryAgain:"Try again",ref:"Ref:",reportThis:"Report this",reportSubject:t=>`Issue with patch design tool${t?" â "+t:""}`,reportBody:t=>`What happened: 61 62 63What I was trying to do: 64 65 66Reference code: ${t||"(none)"}`},rateLimit:{titleAnon:()=>"Sign in to unlock more design rounds",titleAuth:t=>`You've hit today's design ceiling (${t})`,bodyAnon:()=>"",bodyAuth:t=>t?"Your daily quota resets at midnight Pacific. Want one of these made now, or need the cap lifted? We've got you.":"Your daily quota resets at midnight Pacific.",bodySoft:(t,a)=>t>0?`${t} more today as a guest â sign in and it's ${a} more on top.`:`Sign in and you get ${a} more designs today.`,titleMonthWarn:t=>t>=90?`You're almost at your monthly design limit â ${t}% used`:`You're approaching your monthly design limit â ${t}% used`,bodyMonthWarn:(t,a)=>a?`Your designs reset on ${t}. Need more before then? Just email us.`:`Your designs reset on ${t}.`,titleMonthCap:()=>"You've reached your monthly design limit",bodyMonthCap:(t,a)=>a?`It resets on ${t}. Want one of these made now, or need more designs before then? Email ${a} and we'll take care of it.`:`It resets on ${t}.`,orDivider:"or",continueWith:t=>`Continue with ${t}`,orderLabel:"Already love one?",orderCta:"Get it made",couponNote:"15% off your first order",emailLabel:"Prefer to decide later?",emailHint:"We'll email these designs to you â pick them back up whenever you're ready.",emailPlaceholder:"[email protected]",emailSendCta:"Email me my designs",emailSending:"Sendingâ¦",emailSent:"Sent â check your inbox.",emailError:"Hmm, that didn't go through. Try again?",signInCta:()=>"Sign in for more designs",emailCta:"Email us with questions",moreInfo:"More info"},loading:{designing:"Designing your patch",reading:"Reading your reference image",stop:"Stop",signInTitle:"Use the wait time to log in",signInSub:"We'll save every design you make, so you can pick up later â on any device."},wait:{badges:["Free global shipping","Lowest production price guaranteed","Free expert review"],couponCopy:"Copy",couponCopied:"Copied",couponCopyHint:"copy"},placeholder:{editing:"Describe changes⦠(e.g. 'change text to Chicago Fire Dept')",refReady:"Add instructions (optional) â or press Generate to convert as-is",generating:"Generating your patchâ¦",describe:"Describe your patchâ¦",brand:"Describe a {brand} patchâ¦"},typingExamples:["YMCA Zoo Lights event patch â Santa Barbara 2026","Boy Scouts campfire patch with pine trees","Karate dojo patch with dragon â Black Belt Academy","Police badge with eagle and city name","Firefighter station shield with maltese cross and flames","Varsity football team patch â Chicago Bears 2026"],starterPrompts:[{label:"YMCA summer camp",prompt:"YMCA summer camp patch with pine trees, lake, and campfire â circle shape, warm earth tones",configPatch:{style:"YMCA",shape:"circle",mainFeature:"pine trees, lake, and campfire",eventName:"YMCA Summer Camp"}},{label:"Police badge",prompt:"Police department badge patch with eagle, city name, and stars â shield shape, navy and gold",configPatch:{style:"LawEnforcement",shape:"shield",mainFeature:"eagle and stars",eventName:"Police Department"}},{label:"Martial arts dragon",prompt:"Karate dojo patch with fierce dragon and Japanese characters â round, black and crimson",configPatch:{style:"Karate",shape:"circle",mainFeature:"fierce dragon",eventName:"Karate Dojo"}},{label:"Military unit",prompt:"Military unit patch with eagle, crossed swords, and Latin motto â shield shape, olive and gold",configPatch:{style:"Military",shape:"shield",mainFeature:"eagle and crossed swords",eventName:"Military Unit"}},{label:"Soccer team",prompt:"Soccer team crest with flame and soccer ball â circle shape, bold red and white",configPatch:{style:"Sports",shape:"circle",mainFeature:"flame and soccer ball",eventName:"Soccer Team"}},{label:"Bike club",prompt:"Motorcycle club back patch with eagle wings and skull â rocker shape, black and silver",configPatch:{style:"Motorcycle",shape:"rocker",mainFeature:"eagle wings and skull",eventName:"Motorcycle Club"}}],quickEdits:["Change the colors to navy and gold","Make it bolder and simpler","Add more detail to the background","Remove the text","Try a different shape","Make the font larger"],actions:{restart:"Try again",removeRefImage:"Remove image",refImageAlt:t=>`Reference ${t}`,uploadTitleReady:"Reference image ready",uploadTitleEmpty:"Upload a sketch or photo",uploadTitleMore:"Add another reference image",uploadTitleFull:"Maximum 3 reference images",uploadAria:"Upload image",micTitle:"Describe your patch out loud",micStopTitle:"Stop listening",micAria:"Start voice input",micStopAria:"Stop voice input",micListening:"Listening â describe your patchâ¦",micBlocked:"Microphone access is blocked. Open the icon at the left of the address bar, allow the microphone, then try again.",micBlockedHelp:"How to allow it",generateTitle:"Generate (Enter)",generateAria:"Generate",generating:"Generatingâ¦",generate:"Generate",generateShort:"Go",coachEditThenGenerate:"Edit the text, then press Generate",coachEditThenGenerateShort:"Edit the text, then press Go",coachDismiss:"Dismiss",help:"Need help?",helpTitle:"Tell a person what you need â we take it from here"},help:{heading:"Tell us what you're trying to make â our team will design it for you, free",sub:"If the designer isn't getting there, stop wrestling with it â describe the patch in your own words and we take it from here.",needLabel:"What are you trying to make?",needPlaceholder:"e.g. Our fire department's shield with the station number, the way it looks on our trucks â the AI keeps changing the text.",emailLabel:"Your email",phoneLabel:"Phone (optional)",phoneHint:"Add a number if you would rather we call.",attachedNote:"We will include the design on screen and this chat so you do not have to explain it twice.",send:"Send to a human",sending:"Sendingâ¦",error:"That did not send â please try again, or email [email protected].",successHeading:"Got it â we're on it",successBody:"A designer on our team will reply within 2 business hours (weekdays). Check your inbox â we sent a copy there too.",emailPlaceholder:"[email protected]",phonePlaceholder:"(555) 555-5555",close:"Close"},disclaimers:["These are AI-generated previews. The final embroidered patch produced by our team will always be polished, precise, and production-perfect.",["By creating a design, you agree it (and photos of the finished patch) may be featured in our marketing and advertising, including social media. To opt out, email ",{mail:"[email protected]"},"."]],disclaimerLink:{text:"See how a design changes in production",href:"/design-vs-production"}
66,previewNote:"These are AI-generated previews. Fine detail can shift slightly on the finished patch.",seeItMade:{title:"See what a design looks like once it is made",body:"Real orders, side by side: the design from this chat and the artwork that went to the machine."},trustpilot:{rate:"Rate us on",aria:"Rate PatchDesign.AI on Trustpilot (opens in new tab)"},zoom:{hint:"Click anywhere or press Esc to close",close:"Close",alt:"Zoomed patch design",threadNote:"Your design is an AI preview. Stitched thread has physical limits, so fine detail and exact shading shift slightly on the finished patch.",threadNoteShort:"AI preview â fine detail may shift once stitched."},toast:{saving:"Savingâ¦",saved:"Saved to My Designs",saveErr:"Save failed â try again",saveSignin:"Sign in to save designs to your account",downloading:"Downloadingâ¦",downloadOk:"Saved to your Downloads",downloadErr:"Download failed â try again",downloadTap:"Tap to download your design",saveBlocked:"Use the Download button to save your design",saveBlockedSignin:"Sign in to download",saveBlockedDownload:"Download this design",saveBlockedTryOn:"Download this image"},designCard:{leadPre:"Here's your patch â tweak Options, or tap ",leadPreNoOptions:"Here's your patch â tap ",leadShort:"Here's your patch:",leadShortLink:"Get a human review",leadSend:"Get It Made",leadPost:".",orderThis:"Order this one",orderThisShort:"Order this",continueThis:"Continue from this one",continueThisShort:"Edit this",continuingThis:"Editing this one",showAllDesigns:"Show all designs and history",otherHistory:"Other designs and chat history",otherHistoryHint:"open to edit other design versions",earlierDesigns:"Earlier designs",orderVerb:"Order",editVerb:"Edit",moreOptions:"More options",earlierPrev:"Show earlier designs",earlierNext:"Show more designs",editHere:"Make changes â chat below",editHereAria:"Make changes to this design in the chat below",refining:"Refiningâ¦",generatedWith:"Generated with",tryOnAria:"Try-on previews",tryOnDisclaimer:"For illustration purposes only",tryOnToggle:"See try-on previews",tryOnToggleHide:"Hide try-on previews",zoomAria:"Zoom patch design",imageAlt:"Generated patch",zoomTitle:"Zoom",downloadTitle:"Download PNG",downloadTitleAnon:"Sign in to download PNG",downloadAriaAnon:"Sign in to download",saveTitleAuthed:"Save to My Designs",saveTitleAnon:"Sign in to save",saveAria:"Save",downloadAria:"Download",showSettings:"Show settings",hideSettings:"Hide settings",sendShort:"Send",sendFull:"Get It Made"},legibility:{failTitle:"Text may be too small to embroider cleanly",cautionTitle:"Text is close to the legibility floor",regenerate:"Regenerate with bigger text"},feedback:{prompt:"Was this helpful?",barAria:"Was this design helpful?",thumbsUp:"Thumbs up",thumbsDown:"Thumbs down",thanksUp:"Thanks for the feedback â glad this one worked.",thanksDown:"Thanks for the feedback.",thanksNoted:"Thanks â noted.",reasonPlaceholder:"What went wrong? (optional)",skip:"Skip",send:"Send",errSave:"Could not save feedback"},showcase:{madeWith:"Made with this tool",useThis:"Use as a starting point",trust:["Free global shipping","Lowest production price guaranteed","Free human expert review","Shipped in 10 days"]},survey:{label:"Feedback for the PatchDesign team",labelNeutral:"Quick feedback",ask:"Quick one: what would make this tool even better for you?",topics:[{id:"not-followed",label:"It didn't follow my instructions"},{id:"unasked-changes",label:"It changed things I did not ask for"},{id:"lost-earlier",label:"Hard to get back to an earlier design"},{id:"confusing-controls",label:"The controls were confusing"},{id:"all-good",label:"Nothing â it works well"},{id:"other",label:"Something else"}],otherAsk:"What would you change?",back:"Back",note:"This does not change your patch â use the chat box below for design changes.",placeholder:"One sentence is plenty â totally optional.",skip:"Skip",send:"Send",done:"Thanks â that helps us improve.",editAsk:"That reads like a change to your patch, not feedback. Want me to apply it to your design instead?",editApply:"Apply to my design",editKeep:"No â send as feedback"},rail:{title:"Options",aria:"Design settings",hideTitle:"Hide settings",hideAria:"Hide settings",houseStyle:{label:"House style",on:"Our colors, fonts and rules shape your design.",off:"Off
66: your design follows only what you ask for.",paused:"Paused while {brand} is applied."},lockedBrand:{label:"Brand",applied:"Your brand guidelines are applied",staff:"Designing for this customer",dead:"This brand link is no longer active. Ask {tenant} for a new one.",fallbackTenant:"the sender",title:"Patches for {brand}",sub:"Every design follows {brand}'s brand guidelines. {tenant} makes and ships it.",staffTitle:"Designing for {brand}",staffSub:"Every design follows {brand}'s brand guidelines.",kitColors:"Colors",kitLogo:"Logo",kitLogoOnFile:"on file",kitLettering:"Lettering",setBy:"Set by {tenant}",starters:{halloween:["Halloween crew patch","A Halloween crew patch for {brand}"],holiday:["Holiday crew patch","A holiday season crew patch for {brand}"],summer:["Summer team patch","A summer team patch for {brand}"],newYear:["New year team patch","A new year team patch for {brand}"],opening:["Grand opening","A grand opening patch for a new {brand} location"],service:["Years-of-service patch","A 5 years of service patch for {brand} team members"],award:["Team award","A team award patch for a top {brand} crew"]}},labels:{brandRef:"Referenced Brand or Website",brandRefHint:"Pulls brand colors + logo",style:"Style",detail:"Detail",event:"Event / Team",eventPlaceholder:"e.g. Zoo Lights 2026",mainFeature:"Main Feature",mainFeaturePlaceholder:"e.g. eagle, dragon",type:"Type",size:"Size â Width à Height",shape:"Shape",quantity:"Quantity",width:"Width",height:"Height",applyTitle:"Apply to chat",applyEventAria:"Apply Event/Team to chat",applyFeatureAria:"Apply Main Feature to chat",widthAria:"Width",heightAria:"Height",placement:"Application / Placement"},detailOptions:["Less","Normal","More"],shape:{round:"Round",rectangle:"Rectangle",other:"Other",roundTitle:"Round (circle or ellipse, based on W x H)",rectangleTitle:"Rectangle (square or rectangle, based on W x H)",otherTitle:"Other (star, hexagon, shield, custom...)",otherPresetAria:"Other shape preset",customAria:"Custom shape description",customPlaceholder:"e.g. cloud, lightning bolt, paw print",customOption:"Custom..."},shapeNames:{circle:"Circle",ellipse:"Ellipse",square:"Square",rectangle:"Rectangle",star:"Star",heart:"Heart",hexagon:"Hexagon",octagon:"Octagon",shield:"Shield",rocker:"Rocker",diamond:"Diamond",triangle:"Triangle",banner:"Banner",badge:"Badge",crest:"Crest","custom shape":"Custom shape"},quantityUnit:"pcs",customSize:{active:'1/16" sizing',switch:"+ Custom (1/16ths)",activeTitle:"Switch back to standard preset sizes",switchTitle:'Switch to 1/16" precision sizing'},placementOptions:{none:"None selected",hat:"Hat","shirt-front":"T-shirt front",polo:"Polo",jacket:"Jacket","small-bag":"Small bag","large-bag":"Large bag","shirt-back":"T-shirt back"},placementFitHint:t=>`up to ${t}`,placementGotIt:"Got it",placementClose:"Close",placementWarning:(t,a,s)=>`At ${t}, this patch is bigger than the ${a} that fits a ${s.toLowerCase()}. Try a smaller size, or pick a larger placement.`,smallPatchWarning:{prefix:"Small patch â text may be illegible. Aim for ",suffix:".",strong:t=>`â¤${t} characters per line`},rerender:{bodyPrefix:"This design was made for ",bodyMid:". Want it re-rendered for ",bodySuffix:"?",button:"Re-render"},quote:{perPatchSuffix:"/patch",totalLabel:"total",send:"Get It Made",preparing:"Preparing reviewâ¦"},instant:{volume:"Quantity",backing:"Backing",sewOn:"Sew-on (included)",pay:"Get It Made",perPatch:"per patch",starting:"Starting checkoutâ¦",savings:(t,a)=>`Volume Savings of ${t}% / $${a}`,ctaOffer:t=>`15% Off with ${t} at Checkout, Limited Time.`,couponCardNote:t=>`${t} â 15% off at checkout. Limited time, first order only.`,ladderQty:(t,a)=>`${t} patches at ${a}`,ladderCoupon:t=>`${t}, first order`,ladderPay:"You pay",quantity:"Quantity",ladderPrev:"Smaller runs",ladderNext:"Larger runs",backingQuote:"Quote",backingSetup:t=>`+${t} setup`,ladderShipping:"Shipping",ladderFree:"Free",ladderCodeNote:(t,a)=>`${t} is applied automatically at checkout â you save ${a}. No code needed.`,ladderLimited:"Limited time, first order only.",basePrice:"Base price",saveBadge:t=>`Save ${t}%`,smallBatch:"Small batch",more:"more",showFewer:"Show fewer",prevOptions:"Show earlier options",nextOptions:"Show later options",stepUp:t=>`Increase ${t}`,stepDown:t=>`Decrease ${t}`,included:"included",sewOnShort:"Sew-on",noBacking:"No backing",noBackingShort:"None",reassure:"You approve a physical sample, including how thread renders fine detail, before the volume run.",reassureSample:"You approve your patch, including how thread renders fine detail, before it ships.",sampleFor:"for",sampleTier:"1 Piece",sampleTierBadge:"Sample",sampleCtaMain:"One Real Patch",sampleCtaNote:"made to order · photos only, not shipped",sampleCtaNoteShipped:"made to order · shipping included",sampleDisclaimer:"This is a real patch, stitched to order on the production machines. You get photos of it by email; the patch itself is not shipped. The fee isn't refundable, but $30 comes back on your production run.",sampleDisclaimerShipped:"This is a real patch, stitched to order on the production machines and mailed to you. Shipping is included in the price. The fee isn't refundable, but $30 comes back on your production run.",error:"Could not start checkout. Please try again.",commentsLabel:"Comments / Special Requests",commentsPlaceholder:"Any special requirements, specific colors, delivery deadline, or questions for our teamâ¦",typeHintNote:(t,a)=>`Your preview is still ${t}. Add any guidance in the chat, or tap Generate to see it as ${a}.`,typeHintGenerate:t=>`Generate as ${t}`,typeHintGuide:"Add guidance first",typeHintClose:"Close",specialOrderSuffix:" â special order, we'll quote",specialOrderNote:"Special order â our team will send a custom quote before charging.",priceMatchLabel:"Lowest price guaranteed",includesPrefix:"Includes",incCoverage:"100% embroidery",incSample:"a real sample",incBorder:"any border style",incShipping:"free shipping",priceMatchAria:"Lowest price guaranteed â see how our price-match works",
66sizeMax:(t,a)=>`${t} patches go up to ${a} â we set it to the maximum.`,sizeMaxWhy:(t,a,s,i)=>`${t} patches are made up to ${a}, so we set it to the maximum. Need it bigger? ${s} goes up to ${i}.`,sizeMin:(t,a)=>`${t} patches start at ${a} â we set it to the minimum.`,captureTitle:"Almost there",captureSub:"Where should we send your order confirmation and shipping updates?",freeShip:"Free global shipping",captureRecap:"Your order",captureEmailLabel:"Email",captureEmailPlaceholder:"[email protected]",captureContinue:"Continue to secure checkout",captureBack:"Back",captureEmailShort:"Email for order updates",captureClose:"Close",captureInvalid:"Please enter a valid email address."}},view360:{button:"360°",buttonTitle:"See it in 360°: the texture, the edge and the back",buttonAria:"See this patch in 360 degrees",title:"360° view",close:"Close",front:"Front",back:"Back",spin:"Spin",pause:"Pause",hint:"Drag to turn it.",loading:"Building the 3D view",unavailable:"The 3D view needs WebGL, which is switched off in this browser. Here is a simple turn instead.",canvasAria:"The patch in 3D, turning",note:"A simulated preview of the material, edge and backing you selected. Thread texture, thickness and finish vary slightly in production.",backs:{"sew-on":"Sew-on back",rubber:"Plain rubber back","iron-on":"Iron-on back",adhesive:"Adhesive back",hook:"Hook backing","hook-loop":"Hook backing, loop piece included","button-loop":"Sew-on back with button loop",magnet:"Magnetic back",pin:"Pin back"}},tryOn:{headerPrefix:"On a",close:"Close",prev:"Previous",prevAria:"Previous garment",next:"Next",nextAria:"Next garment",zoomTitle:"Zoom garment view",onLabelPrefix:"See on",patchOnGarmentAlt:"Patch on garment",header:t=>`On a ${t.toLowerCase()}`,tryAria:t=>`Try on ${t}`,seeAria:t=>`See on ${t}`},share:{title:"Share",aria:"Share",menuAria:"Share options",copyLink:"Copy link",dismiss:"Dismiss",tiles:{instagram:"Instagram",pinterest:"Pinterest",facebook:"Facebook",x:"X",whatsapp:"WhatsApp",gmail:"Gmail",outlook:"Outlook",print:"Print"},lead:t=>{const a=(t||"").trim();return a?`Just designed this with PatchDesign.AI: "${a.length>120?a.slice(0,119)+"â¦":a}"`:"Just designed this custom patch with PatchDesign.AI"},pasteHelper:{instagram:{label:"Instagram",title:"Ready to post on Instagram",steps:["Switch to the Instagram tab (or open the app on your phone).","Tap the + (Create) button and pick the patch image from your Downloads folder.","Paste the caption in the Caption field (Ctrl/Cmd + V).","Tap Share."],openLabel:"Open Instagram"},facebook:{label:"Facebook",title:"Ready to post on Facebook",steps:["Switch to the Facebook tab â the share dialog is already open.","If the link preview is empty, give it a moment to load, or click Photo/Video and pick the patch from your Downloads folder.",'Paste your caption (Ctrl/Cmd + V) in the "Say something" field.',"Click Post."],openLabel:"Open Facebook"}},pasteHelperReady:{imageSaved:"Image saved to your Downloads folder",captionCopied:"Caption + link copied to your clipboard",captionFailed:"Could not copy caption â see Copy link below"},printSubject:"Check out this custom patch I designed",printTitle:"Patch design",shareStatus:{popupBlocked:"Popup blocked - allow popups to print.",printOpened:"Print dialog opened in a new window.",printFailed:"Could not open print dialog.",pinterestImageReady:"Pinterest opened - image attached from your link.",xImageReady:"Image saved to Downloads - attach it to your post on X.",gmailReady:"Image saved to Downloads - attach it to your Gmail draft.",outlookReady:"Image saved to Downloads - attach it to your Outlook draft.",whatsappReady:"Image saved to Downloads â attach it in WhatsApp if the link preview doesn't auto-render.",whatsappBlocked:"Popup blocked. Image saved to Downloads â open WhatsApp manually.",whatsappFailed:"Could not open WhatsApp. Try Copy link instead.",linkCopied:"Link copied. Image saved to Downloads â attach where you paste.",linkCopyManual:"Could not copy automatically â long-press to copy the link.",linkCopyFailed:"Could not copy link.",appBlocked:"Popup blocked. Image saved to Downloads â open the app manually.",windowFailed:"Could not open the share window.",sharedNative:"Shared via your device."},titleCore:t=>t?`Custom patch: ${t.slice(0,80)}`:"Custom patch designed with PatchDesign.AI",gotIt:"Got it",caption:{lead:"Just designed this custom patch with PatchDesign.AI",leadWithPrompt:t=>`Just designed this with PatchDesign.AI: "${t}"`,xLead:"Just designed this custom patch",xLeadWithPrompt:t=>`Just designed this custom patch: "${t}"`}},failedGenLead:{label:"Don't want to wait? Drop your email and we'll send the design when service is back:",placeholder:"[email protected]",submit:"Email me the design",submitting:"Savingâ¦",doneText:"Got it â we'll email your design as soon as service is back. Usually within an hour.",errInvalid:"Enter a valid email so we can send your design.",errSave:"Could not save right now â please try again or email [email protected].",errSaveNeutral:"Could not save right now â please try again."},railChange:"Updated",confirm:"Confirm",visibleStyles:[{key:"YMCA",label:"YMCA"},{key:"Scouts",label:"Scouts"},{key:"Karate",label:"Martial Arts"},{key:"LawEnforcement",label:"Law & Fire"},{key:"Military",label:"Military"},{key:"Sports",label:"Sports"},{key:"Motorcycle",label:"Bike Clubs"},{key:"Other",label:"Custom / Branding"}],patchTypeOptions:[{value:"Embroidered",label:"Embroidered"},{value:"Woven",label:"Woven"},{value:"Chenille",label:"Chenille"},{value:"Printed",label:"Printed / Sublimated"},{value:"PVC 2D",label:"PVC 2D"},{value:"PVC 3D",label:"PVC 3D (Raised)"}],garmentLabels:{tshirt:"T-shirt",polo:"Polo",hat:"Cap",bag:"Bag","big-bag":"Large Bag",jacket:"Jacket",longsleeve:"Long Sleeve",backshirt:"Back"},brandQuestions:{policeAgency:{ask:"Is this for a specific department?",yes:"Yes â I'll type the name/city",yesNeedsText:"Enter department/city name",generic:"Generic law enforcement look"}},shapeQuestion:{ask:"What shape would you like for your patch?",options:{circle:"Circle",rectangle:"Rectangle",shield:"Shield",star:"Star",heart:"Heart",other:"Otherâ¦",surprise:"Surprise me",otherPlaceholder:"Type a shape (e.g. hexagon)"}},chatBubble:{refImagePrompt:"Convert this reference image into an embroidered patch design",editPrefix:"Edit: "},emailDesign:{buttonTitle:"Email this design",buttonAria:"Email this design without signing in",dialogAria:"Email this design",heading:"Email this design",body:"No account needed. We send the patch itself plus a link that reopens it here, ready to keep editing.",notReady:"Still saving your design â give it a moment and the email will include the image.",sent:"Sent. Check your inbox.",placeholder:"[email protected]",cancel:"Cancel",send:"Send",sending:"Sendingâ¦",close:"Close",failed:"Could not send"}},es:{hero:{title:"Diseñador de Parches con IA",subtitle:"Diseño listo para producción, entregado rápido"},askBar:{label:"Describe tu parche"},reloading:{title:"Actualizando e intentando de nuevoâ¦",sub:"Tu descripción y la imagen subida están guardadas â no hay que rehacer nada."},greeting:{parkerName:"Hola, soy Parker",intro:"Cuéntame qué parche quieres â estilo, tema, colores, texto â y lo diseño al instante.",uploadLead:"También puedes",uploadCta:"subir un boceto o foto",gallery:"¿Necesitas inspiración? Mira nuestra galerÃa",galleryHere:"aquÃ",uploadedRef:"Imagen subida:",refAlt:"Referencia",brandRef:"Marc
66a de referencia:",brandGuidelines:"GuÃa de marca aplicada"},affordance:{showGuidance:"Mostrar Opciones",designGuidance:"Opciones"},errors:{autoRetrying:(t,a)=>`Estamos reintentando automáticamente${t&&a>1?` (intento ${t} de ${a})`:""} â no necesitas hacer nada.`,priorAuto:t=>`Ya lo reintentamos automáticamente ${t} ${t===1?"vez":"veces"} (recargando la página cada vez).`,autoRetryIn:t=>`Reintentando en ${t}sâ¦`,cancel:"Cancelar",tryAgain:"Intentar de nuevo",ref:"Ref:",reportThis:"Reportar esto",reportSubject:t=>`Problema con el diseñador de parches${t?" â "+t:""}`,reportBody:t=>`Qué pasó: 67 68 69Qué intentaba hacer: 70 71 72Código de referencia: ${t||"(ninguno)"}`},rateLimit:{titleAnon:()=>"Inicia sesión para desbloquear más rondas de diseño",titleAuth:t=>`Llegaste al tope de hoy (${t} diseños)`,bodyAnon:()=>"",bodyAuth:t=>t?"Tu cuota diaria se reinicia a medianoche del PacÃfico. ¿Quieres que hagamos uno de estos ahora, o necesitas ampliar el lÃmite? Te ayudamos.":"Tu cuota diaria se reinicia a medianoche del PacÃfico.",bodySoft:(t,a)=>t>0?`${t} más hoy como invitado â inicia sesión y son ${a} más.`:`Inicia sesión y tienes ${a} diseños más hoy.`,titleMonthWarn:t=>t>=90?`Estás muy cerca de tu lÃmite mensual de diseños â ${t} % usado`:`Te estás acercando a tu lÃmite mensual de diseños â ${t} % usado`,bodyMonthWarn:(t,a)=>a?`Tus diseños se reinician el ${t}. ¿Necesitas más antes? EscrÃbenos.`:`Tus diseños se reinician el ${t}.`,titleMonthCap:()=>"Llegaste a tu lÃmite mensual de diseños",bodyMonthCap:(t,a)=>a?`Se reinicia el ${t}. ¿Quieres que hagamos uno de estos ahora, o necesitas más diseños antes? Escribe a ${a} y lo resolvemos.`:`Se reinicia el ${t}.`,orDivider:"o",continueWith:t=>`Continuar con ${t}`,orderLabel:"¿Ya te gusta uno?",orderCta:"Mándalo a hacer",couponNote:"15% de descuento en tu primer pedido",emailLabel:"¿Prefieres decidir luego?",emailHint:"Te enviaremos estos diseños por correo â retómalos cuando quieras.",emailPlaceholder:"[email protected]",emailSendCta:"EnvÃame mis diseños",emailSending:"Enviandoâ¦",emailSent:"Enviado â revisa tu correo.",emailError:"No se pudo enviar. ¿Intentar de nuevo?",signInCta:t=>`Inicia sesión para ${t} diseños más`,emailCta:"EscrÃbenos con preguntas",moreInfo:"Más información"},loading:{designing:"Diseñando tu parche",reading:"Leyendo tu imagen de referencia",stop:"Detener",signInTitle:"Aprovecha la espera para iniciar sesión",signInSub:"Guardaremos cada diseño que hagas para que puedas retomarlo después, en cualquier dispositivo."}
72,wait:{badges:["EnvÃo gratis a todo el mundo","Precio de producción más bajo garantizado","Revisión experta gratis"],couponCopy:"Copiar",couponCopied:"Copiado",couponCopyHint:"copiar"},placeholder:{editing:'Describe los cambios⦠(ej. "cambia el texto a Chicago Fire Dept")',refReady:"Agrega instrucciones (opcional) â o toca Generar para convertir tal cual",generating:"Generando tu parcheâ¦",describe:"Describe tu parcheâ¦",brand:"Describe un parche de {brand}â¦"},typingExamples:["Parche del evento YMCA Zoo Lights â Santa Barbara 2026","Parche Boy Scouts con fogata y pinos","Parche de dojo de karate con dragón â Black Belt Academy","Placa de policÃa con águila y nombre de la ciudad","Escudo de bomberos con cruz maltesa y llamas","Parche del equipo varsity de fútbol americano â Chicago Bears 2026"],starterPrompts:[{label:"Campamento de verano YMCA",prompt:"Parche de campamento de verano YMCA con pinos, lago y fogata â forma circular, tonos cálidos terrosos",configPatch:{style:"YMCA",shape:"circle",mainFeature:"pinos, lago y fogata",eventName:"YMCA Summer Camp"}},{label:"Placa de policÃa",prompt:"Parche tipo placa policial con águila, nombre de la ciudad y estrellas â forma de escudo, azul marino y dorado",configPatch:{style:"LawEnforcement",shape:"shield",mainFeature:"águila y estrellas",eventName:"Police Department"}},{label:"Dragón de artes marciales",prompt:"Parche de dojo de karate con dragón fiero y caracteres japoneses â redondo, negro y carmesÃ",configPatch:{style:"Karate",shape:"circle",mainFeature:"dragón fiero",eventName:"Karate Dojo"}},{label:"Unidad militar",prompt:"Parche de unidad militar con águila, espadas cruzadas y lema en latÃn â forma de escudo, oliva y dorado",configPatch:{style:"Military",shape:"shield",mainFeature:"águila y espadas cruzadas",eventName:"Military Unit"}},{label:"Equipo de fútbol",prompt:"Escudo de equipo de fútbol con llama y balón â forma circular, rojo intenso y blanco",configPatch:{style:"Sports",shape:"circle",mainFeature:"llama y balón de fútbol",eventName:"Soccer Team"}},{label:"Club de motociclistas",prompt:"Parche trasero de club de motociclistas con alas de águila y calavera â forma rocker, negro y plata",configPatch:{style:"Motorcycle",shape:"rocker",mainFeature:"alas de águila y calavera",eventName:"Motorcycle Club"}}],quickEdits:["Cambia los colores a azul marino y dorado","Hazlo más simple y atrevido","Agrega más detalle al fondo","Quita el texto","Prueba otra forma","Agranda la tipografÃa"],actions:{restart:"Intentar de nuevo",removeRefImage:"Quitar imagen",refImageAlt:t=>`Referencia ${t}`,uploadTitleReady:"Imagen de referencia lista",uploadTitleEmpty:"Sube un boceto o una foto",uploadTitleMore:"Agregar otra imagen de referencia",uploadTitleFull:"Máximo 3 imágenes de referencia",uploadAria:"Subir imagen",micTitle:"Describe tu parche en voz alta",micStopTitle:"Dejar de escuchar",micAria:"Iniciar entrada por voz",micStopAria:"Detener entrada por voz",micListening:"Escuchando â describe tu parcheâ¦",micBlocked:"El acceso al micrófono está bloqueado. Abre el icono a la izquierda de la barra de direcciones, permite el micrófono e inténtalo de nuevo.",micBlockedHelp:"Cómo permitirlo",generateTitle:"Generar (Enter)",generateAria:"Generar",generating:"Generandoâ¦",generate:"Generar",generateShort:"Ir",coachEditThenGenerate:"Edita el texto y luego pulsa Generar",coachEditThenGenerateShort:"Edita el texto y luego pulsa Ir",coachDismiss:"Cerrar",help:"¿Necesitas ayuda?",helpTitle:"Cuéntale a una persona lo que necesitas â nosotros seguimos desde ahÃ"},help:{heading:"Cuéntanos qué quieres hacer â nuestro equipo lo diseña por ti, gratis",sub:"Si el diseñador no lo logra, no pelees con él â describe el parche con tus palabras y lo tomamos desde aquÃ.",needLabel:"¿Qué quieres hacer?",needPlaceholder:"ej. El escudo de nuestro departamento de bomberos con el número de estación, como se ve en los camiones â la IA sigue cambiando el texto.",emailLabel:"Tu correo",phoneLabel:"Teléfono (opcional)",phoneHint:"Agrega un número si prefieres que te llamemos.",attachedNote:"Incluiremos el diseño en pantalla y este chat para que no tengas que explicarlo dos veces.",send:"Enviar a una persona",sending:"Enviandoâ¦",error:"No se pudo enviar â inténtalo de nuevo o escribe a [email protected].",successHeading:"Listo â nos encargamos",successBody:"Un diseña
72dor de nuestro equipo te responderá en un plazo de 2 horas hábiles (dÃas laborables). Revisa tu correo â también te enviamos una copia.",emailPlaceholder:"[email protected]",phonePlaceholder:"(555) 555-5555",close:"Cerrar"},disclaimers:["Estas son previsualizaciones generadas con IA. El parche bordado final que produce nuestro equipo siempre saldrá pulido, preciso y listo para usarse.",["Al crear un diseño, aceptas que él (y las fotos del parche terminado) puede aparecer en nuestro marketing y publicidad, incluyendo redes sociales. Para excluirte, escrÃbenos a ",{mail:"[email protected]"},"."]],disclaimerLink:{text:"Mira cómo cambia un diseño en producción",href:"/design-vs-production"},previewNote:"Estas son previsualizaciones generadas con IA. El detalle fino puede variar un poco en el parche terminado.",seeItMade:{title:"Mira cómo se ve un diseño ya fabricado",body:"Pedidos reales, lado a lado: el diseño de este chat y el arte que se envió a producción."},trustpilot:{rate:"CalifÃcanos en",aria:"Califica a PatchDesign.AI en Trustpilot (abre en una nueva pestaña)"},zoom:{hint:"Haz clic en cualquier lugar o presiona Esc para cerrar",close:"Cerrar",alt:"Diseño de parche ampliado",threadNote:"Tu diseño es una vista previa generada por IA. El hilo bordado tiene lÃmites fÃsicos, asà que los detalles finos y los tonos exactos varÃan un poco en el parche final.",threadNoteShort:"Vista previa IA: el detalle fino varÃa al bordarlo."},toast:{saving:"Guardandoâ¦",saved:"Guardado en Mis Diseños",saveErr:"No se pudo guardar â inténtalo de nuevo",saveSignin:"Inicia sesión para guardar diseños en tu cuenta",downloading:"Descargandoâ¦",downloadOk:"Guardado en tus Descargas",downloadErr:"No se pudo descargar â inténtalo de nuevo",downloadTap:"Toca para descargar tu diseño",saveBlocked:"Usa el botón Descargar para guardar tu diseño",saveBlockedSignin:"Inicia sesión para descargar",saveBlockedDownload:"Descargar este diseño",saveBlockedTryOn:"Descargar esta imagen"},designCard:{leadPre:"Aquà está tu parche â ajusta las Opciones o toca ",leadPreNoOptions:"Aquà está tu parche â toca ",leadShort:"Aquà está tu parche:",leadShortLink:"Pedir revisión",leadSend:"Crearlo",leadPost:".",orderThis:"Pedir este",orderThisShort:"Pedir este",continueThis:"Continuar desde este",continueThisShort:"Editar este",continuingThis:"Editando este",showAllDesigns:"Ver todos los diseños y el historial",otherHistory:"Otros diseños e historial del chat",otherHistoryHint:"ábrelo para editar otras versiones",earlierDesigns:"Diseños anteriores",orderVerb:"Pedir",editVerb:"Editar",moreOptions:"Más opciones",earlierPrev:"Ver diseños anteriores",earlierNext:"Ver más diseños",editHere:"Hacer cambios â chat abajo",editHereAria:"Haz cambios a este diseño en el chat de abajo",refining:"Refinandoâ¦",generatedWith:"Generado con",tryOnAria:"Vistas previas",tryOnDisclaimer:"Solo con fines ilustrativos",tryOnToggle:"Ver vistas previas",tryOnToggleHide:"Ocultar vistas previas",zoomAria:"Ampliar diseño",imageAlt:"Parche generado",zoomTitle:"Ampliar",downloadTitle:"Descargar PNG",downloadTitleAnon:"Inicia sesión para descargar el PNG",downloadAriaAnon:"Inicia sesión para descargar",saveTitleAuthed:"Guardar en Mis Diseños",saveTitleAnon:"Inicia sesión para guardar",saveAria:"Guardar",downloadAria:"Descargar",showSettings:"Mostrar opciones",hideSettings:"Ocultar opciones",sendShort:"Enviar",sendFull:"Crearlo"},legibility:{failTitle:"El texto puede ser demasiado pequeño para bordarse con claridad",cautionTitle:"El texto está cerca del mÃnimo de legibilidad",regenerate:"Regenerar con texto más grande"},feedback:{prompt:"¿Te sirvió?",barAria:"¿Fue útil este diseño?",thumbsUp:"Me gusta",thumbsDown:"No me gusta",thanksUp:"¡Gracias! Qué bueno que funcionó.",thanksDown:"Gracias por el comentario.",thanksNoted:"Gracias â anotado.",reasonPlaceholder:"¿Qué salió mal? (opcional)",skip:"Saltar",send:"Enviar",errSave:"No pudimos guardar tu comentario"},showcase:{madeWith:"Hecho con esta herramienta",useThis:"Ãsalo como punto de partida",trust:["EnvÃo gratis a todo el mund
72o","Precio de producción más bajo garantizado","Revisión humana experta gratis","Enviado en 10 dÃas"]},survey:{label:"Comentarios para el equipo de PatchDesign",labelNeutral:"Comentarios rápidos",ask:"Una pregunta: ¿qué harÃa esta herramienta aún mejor para ti?",topics:[{id:"not-followed",label:"No siguió mis instrucciones"},{id:"unasked-changes",label:"Cambió cosas que no pedÃ"},{id:"lost-earlier",label:"Cuesta volver a un diseño anterior"},{id:"confusing-controls",label:"Los controles eran confusos"},{id:"all-good",label:"Nada â funciona bien"},{id:"other",label:"Otra cosa"}],otherAsk:"¿Qué cambiarÃas?",back:"Atrás",note:"Esto no cambia tu parche â usa el chat de abajo para modificar el diseño.",placeholder:"Una frase basta â totalmente opcional.",skip:"Saltar",send:"Enviar",done:"Gracias â nos ayuda a mejorar.",editAsk:"Eso parece un cambio a tu parche, no un comentario. ¿Quieres que lo aplique a tu diseño?",editApply:"Aplicar a mi diseño",editKeep:"No â enviar como comentario"},rail:{title:"Opciones",aria:"Opciones de diseño",hideTitle:"Ocultar opciones",hideAria:"Ocultar opciones",houseStyle:{label:"Estilo de la casa",on:"Nuestros colores, fuentes y reglas guÃan tu diseño.",off:"Desactivado: tu diseño sigue solo lo que pides.",paused:"En pausa mientras se aplica {brand}."},lockedBrand:{label:"Marca",applied:"Se aplica la guÃa de tu marca",staff:"Diseñando para este cliente",dead:"Este enlace de marca ya no está activo. Pide uno nuevo a {tenant}.",fallbackTenant:"quien te lo envió",title:"Parches para {brand}",sub:"Cada diseño sigue la guÃa de marca de {brand}. {tenant} lo fabrica y lo envÃa.",staffTitle:"Diseñando para {brand}",staffSub:"Cada diseño sigue la guÃa de marca de {brand}.",kitColors:"Colores",kitLogo:"Logo",kitLogoOnFile:"guardado",kitLettering:"TipografÃa",setBy:"Definido por {tenant}",starters:{halloween:["Parche de Halloween","Un parche de Halloween para el equipo de {brand}"],holiday:["Parche navideño","Un parche de temporada navideña para el equipo de {brand}"],summer:["Parche de verano","Un parche de verano para el equipo de {brand}"],newYear:["Parche de año nuevo","Un parche de año nuevo para el equipo de {brand}"],opening:["Gran inauguración","Un parche de gran inauguración para un nuevo local de {brand}"],service:["Años de servicio","Un parche de 5 años de servicio para el equipo de {brand}"],award:["Premio al equipo","Un parche de premio para el mejor equipo de {brand}"]}},labels:{brandRef:"Marca o Sitio Web de Referencia",brandRefHint:"Extrae colores + logo de la marca",style:"Estilo",detail:"Detalle",event:"Evento / Equipo",eventPlaceholder:"ej. Zoo Lights 2026",mainFeature:"Elemento principal",mainFeaturePlaceholder:"ej. águila, dragón",type:"Tipo",size:"Tamaño â Ancho à Alto",shape:"Forma",quantity:"Cantidad",width:"Ancho",height:"Alto",applyTitle:"Aplicar al chat",applyEventAria:"Aplicar Evento/Equipo al chat",applyFeatureAria:"Aplicar Elemento Principal al chat",widthAria:"Ancho",heightAria:"Alto",placement:"Ubicación de aplicación"},detailOptions:["Menos","Normal","Más"],shape:{round:"Redondo",rectangle:"Rectángulo",other:"Otro",roundTitle:"Redondo (cÃrculo u ovalo, según Ancho à Alto)",rectangleTitle:"Rectángulo (cuadrado o rectángulo, según Ancho à Alto)",otherTitle:"Otro (estrella, hexágono, escudo, personalizado...)",otherPresetAria:"Forma personalizada",customAria:"Descripción de la forma personalizada",customPlaceholder:"ej. nube, rayo, huella",customOption:"Personalizado..."},shapeNames:{circle:"CÃrculo",ellipse:"Elipse",square:"Cuadrado",rectangle:"Rectángulo",star:"Estrella",heart:"Corazón",hexagon:"Hexágono",octagon:"Octágono",shield:"Escudo",rocker:"Arco",diamond:"Rombo",triangle:"Triángulo",banner:"BanderÃn",badge:"Insignia",crest:"Blasón","custom shape":"Forma personalizada"},quantityUnit:"pzas",customSize:{active:'Tamaño en 1/16"',switch:"+ Personalizado (1/16)",activeTitle:"Volver a los tamaños predefinidos",switchTitle:'Cambiar a precisión de 1/16"'}
72,placementOptions:{none:"Ninguna seleccionada",hat:"Gorra","shirt-front":"Camiseta (frente)",polo:"Polo",jacket:"Chaqueta","small-bag":"Bolso pequeño","large-bag":"Bolso grande","shirt-back":"Camiseta (espalda)"},placementFitHint:t=>`hasta ${t}`,placementGotIt:"Entendido",placementClose:"Cerrar",placementWarning:(t,a,s)=>`Con ${t}, este parche supera los ${a} que caben en esa ubicación (${s}). Prueba un tamaño menor o elige una ubicación más grande.`,smallPatchWarning:{prefix:"Parche chico â el texto puede ser ilegible. Apunta a ",suffix:".",strong:t=>`â¤${t} caracteres por lÃnea`},rerender:{bodyPrefix:"Este diseño se hizo para ",bodyMid:". ¿Quieres que lo volvamos a renderizar para ",bodySuffix:"?",button:"Volver a renderizar"},quote:{perPatchSuffix:"/pza",totalLabel:"total",send:"Crearlo",preparing:"Preparando revisiónâ¦"},instant:{volume:"Cantidad",backing:"Respaldo",sewOn:"Cosido (incluido)",pay:"Crearlo",perPatch:"por parche",starting:"Iniciando pagoâ¦",savings:(t,a)=>`Ahorro por volumen del ${t}% / $${a}`,ctaOffer:t=>`15% de descuento con ${t} al pagar, tiempo limitado.`,couponCardNote:t=>`${t} â 15% de descuento al pagar. Tiempo limitado, solo primer pedido.`,ladderQty:(t,a)=>`${t} parches a ${a}`,ladderCoupon:t=>`${t}, primer pedido`,ladderPay:"Pagas",quantity:"Cantidad",ladderPrev:"Tiradas más pequeñas",ladderNext:"Tiradas más grandes",backingQuote:"Cotizar",backingSetup:t=>`+${t} único`,ladderShipping:"EnvÃo",ladderFree:"Gratis",ladderCodeNote:(t,a)=>`${t} se aplica automáticamente al pagar â ahorras ${a}. Sin código.`,ladderLimited:"Tiempo limitado, solo primer pedido.",reassureSample:"Apruebas tu parche, incluido cómo el hilo reproduce el detalle, antes de que se envÃe.",basePrice:"Base",saveBadge:t=>`-${t}%`,smallBatch:"Lote chico",more:"más",showFewer:"Ver menos",prevOptions:"Ver opciones anteriores",nextOptions:"Ver opciones siguientes",stepUp:t=>`Aumentar ${t}`,stepDown:t=>`Reducir ${t}`,included:"incluido",sewOnShort:"Cosido",noBacking:"Sin respaldo",noBackingShort:"Ninguno",reassure:"Apruebas una muestra fÃsica, incluido cómo el hilo reproduce el detalle, antes de la producción.",sampleFor:"por",sampleTier:"1 Pieza",sampleTierBadge:"Muestra",sampleCtaMain:"un parche real",sampleCtaNote:"hecho por encargo · solo fotos, no se envÃa",sampleCtaNoteShipped:"hecho por encargo · envÃo incluido",sampleDisclaimer:"Es un parche real, bordado por encargo en las mismas máquinas de producción. Recibes fotos por correo electrónico; el parche en sà no se envÃa. La tarifa no es reembolsable, pero $30 se descuentan de tu pedido de producción.",sampleDisclaimerShipped:"Es un parche real, bordado por encargo en las mismas máquinas de producción y enviado a ti. El envÃo está incluido en el precio. La tarifa no es reembolsable, pero $30 se descuentan de tu pedido de producción.",error:"No se pudo iniciar el pago. Inténtalo de nuevo.",commentsLabel:"Comentarios / Solicitudes Especiales",commentsPlaceholder:"Cualquier requisito especial, colores especÃficos, fecha de entrega o preguntas para nuestro equipoâ¦",typeHintNote:(t,a)=>`Tu vista previa sigue siendo ${t}. Agrega indicaciones en el chat o toca Generar para verla como ${a}.`,typeHintGenerate:t=>`Generar como ${t}`,typeHintGuide:"Agregar indicaciones primero",typeHintClose:"Cerrar",specialOrderSuffix:" â pedido especial, lo cotizamos",specialOrderNote:"Pedido especial: nuestro equipo enviará una cotización personalizada antes de cobrar.",priceMatchLabel:"Precio más bajo garantizado",includesPrefix:"Incluye",incCoverage:"bordado 100%",incSample:"una muestra real",incBorder:"cualquier tipo de borde",incShipping:"envÃo gratis",priceMatchAria:"Precio más bajo garantizado â cómo funciona nuestra igualación de precios",sizeMax:(t,a)=>`Los parches ${t} miden hasta ${a}: lo ajustamos al máximo.`,sizeMaxWhy:(t,a,s,i)=>`Los parches ${t} se fabrican hasta ${a}, asà que lo ajustamos al máximo. ¿Lo necesitas más grande? ${s} llega hasta ${i}.`,sizeMin:(t,a)=>`Los parches ${t} empiezan en ${a}: lo ajustamos al mÃnimo.`,captureTitle:"Casi listo",captureSub:"¿A dónde enviamos la confirmación de tu pedido y las actualizaciones de envÃo?",freeShip:"EnvÃo gratis a todo el mund
72o",captureRecap:"Tu pedido",captureEmailLabel:"Correo electrónico",captureEmailPlaceholder:"[email protected]",captureContinue:"Continuar al pago seguro",captureBack:"Volver",captureEmailShort:"Correo para avisos de tu pedido",captureClose:"Cerrar",captureInvalid:"Introduce un correo electrónico válido."}},view360:{button:"360°",buttonTitle:"MÃralo en 360°: la textura, el borde y el reverso",buttonAria:"Ver este parche en 360 grados",title:"Vista 360°",close:"Cerrar",front:"Frente",back:"Reverso",spin:"Girar",pause:"Pausa",hint:"Arrastra para girarlo.",loading:"Preparando la vista 3D",unavailable:"La vista 3D necesita WebGL, que está desactivado en este navegador. Aquà tienes un giro sencillo.",canvasAria:"El parche en 3D, girando",note:"Una vista simulada del material, el borde y el respaldo que elegiste. La textura del hilo, el grosor y el acabado varÃan ligeramente en producción.",backs:{"sew-on":"Reverso para coser",rubber:"Reverso de goma liso","iron-on":"Reverso termoadhesivo",adhesive:"Reverso adhesivo",hook:"Respaldo de gancho","hook-loop":"Respaldo de gancho, con pieza de lazo","button-loop":"Reverso para coser con presilla",magnet:"Reverso magnético",pin:"Reverso con pin"}},tryOn:{headerPrefix:"En",close:"Cerrar",prev:"Anterior",prevAria:"Prenda anterior",next:"Siguiente",nextAria:"Prenda siguiente",zoomTitle:"Ampliar vista",onLabelPrefix:"Ver en",patchOnGarmentAlt:"Parche en la prenda",header:t=>`En ${t.toLowerCase()}`,tryAria:t=>`Pruébalo en ${t}`,seeAria:t=>`Ver en ${t}`},share:{title:"Compartir",aria:"Compartir",menuAria:"Opciones para compartir",copyLink:"Copiar enlace",dismiss:"Cerrar",tiles:{instagram:"Instagram",pinterest:"Pinterest",facebook:"Facebook",x:"X",whatsapp:"WhatsApp",gmail:"Gmail",outlook:"Outlook",print:"Imprimir"},lead:t=>{const a=(t||"").trim();return a?`Acabo de diseñar esto con PatchDesign.AI: "${a.length>120?a.slice(0,119)+"â¦":a}"`:"Acabo de diseñar este parche personalizado con PatchDesign.AI"},pasteHelper:{instagram:{label:"Instagram",title:"Listo para publicar en Instagram",steps:["Cambia a la pestaña de Instagram (o abre la app en tu teléfono).","Toca el botón + (Crear) y elige la imagen del parche desde Descargas.","Pega el texto en el campo de descripción (Ctrl/Cmd + V).","Toca Compartir."],openLabel:"Abrir Instagram"},facebook:{label:"Facebook",title:"Listo para publicar en Facebook",steps:["Cambia a la pestaña de Facebook â el cuadro para compartir ya está abierto.","Si la vista previa del enlace está vacÃa, espera un momento o toca Foto/Video y elige el parche desde Descargas.",'Pega tu texto (Ctrl/Cmd + V) en "Di algoâ¦".',"Toca Publicar."],openLabel:"Abrir Facebook"}},pasteHelperReady:{imageSaved:"Imagen guardada en tu carpeta de Descargas",captionCopied:"Texto + enlace copiados al portapapeles",captionFailed:"No pudimos copiar el texto â usa Copiar enlace abajo"},printSubject:"Mira este parche personalizado que diseñé",printTitle:"Diseño de parche",shareStatus:{popupBlocked:"Ventana emergente bloqueada â permite popups para imprimir.",printOpened:"Se abrió el diálogo de impresión en una nueva ventana.",printFailed:"No pudimos abrir el diálogo de impresión.",pinterestImageReady:"Se abrió Pinterest â imagen adjunta desde tu enlace.",xImageReady:"Imagen guardada en Descargas â adjúntala a tu publicación en X.",gmailReady:"Imagen guardada en Descargas â adjúntala a tu borrador de Gmail.",outlookReady:"Imagen guardada en Descargas â adjúntala a tu borrador de Outlook.",whatsappReady:"Imagen guardada en Descargas â adjúntala en WhatsApp si la vista previa del enlace no aparece sola.",whatsappBlocked:"Ventana emergente bloqueada. Imagen guardada en Descargas â abre WhatsApp manualmente.",whatsappFailed:"No se pudo abrir WhatsApp. Prueba con Copiar enlace.",linkCopied:"Enlace copiado. Imagen guardada en Descargas â adjúntala donde pegues el enlace.",linkCopyManual:"No se pudo copiar automáticamente â mantén pulsado el enlace para copiarlo.",linkCopyFailed:"No se pudo copiar el enlace.",appBlocked:"Ventana emergente bloqueada. Imagen guardada en Descargas â abre la app manualmente.",windowFailed:"No se pudo abrir la ventana para compartir.",sharedNative:"Compartido desde tu dispositivo."},titleCore:t=>t?`Parche personalizado: ${t.slice(0,80)}
72`:"Parche personalizado diseñado con PatchDesign.AI",gotIt:"Entendido",caption:{lead:"Acabo de diseñar este parche personalizado con PatchDesign.AI",leadWithPrompt:t=>`Acabo de diseñar esto con PatchDesign.AI: "${t}"`,xLead:"Acabo de diseñar este parche personalizado",xLeadWithPrompt:t=>`Acabo de diseñar este parche personalizado: "${t}"`}},failedGenLead:{label:"¿No quieres esperar? Déjanos tu correo y te enviamos el diseño cuando el servicio regrese:",placeholder:"[email protected]",submit:"EnvÃame el diseño",submitting:"Guardandoâ¦",doneText:"Listo â te enviaremos tu diseño en cuanto el servicio vuelva. Normalmente en menos de una hora.",errInvalid:"Ingresa un correo válido para que podamos enviarte el diseño.",errSave:"No pudimos guardar ahora â inténtalo de nuevo o escrÃbenos a [email protected].",errSaveNeutral:"No pudimos guardar ahora â inténtalo de nuevo."},railChange:"Actualizado",confirm:"Confirmar",visibleStyles:[{key:"YMCA",label:"YMCA"},{key:"Scouts",label:"Scouts"},{key:"Karate",label:"Artes Marciales"},{key:"LawEnforcement",label:"PolicÃa y Bomberos"},{key:"Military",label:"Militar"},{key:"Sports",label:"Deportes"},{key:"Motorcycle",label:"Motociclistas"},{key:"Other",label:"Personalizado / Marca"}],patchTypeOptions:[{value:"Embroidered",label:"Bordado"},{value:"Woven",label:"Tejido"},{value:"Chenille",label:"Chenille"},{value:"Printed",label:"Impreso / Sublimado"},{value:"PVC 2D",label:"PVC 2D"},{value:"PVC 3D",label:"PVC 3D (Relieve)"}],garmentLabels:{tshirt:"Camiseta",polo:"Polo",hat:"Gorra",bag:"Bolsa","big-bag":"Bolsa grande",jacket:"Chaqueta",longsleeve:"Manga larga",backshirt:"Espalda"},brandQuestions:{policeAgency:{ask:"¿Es para una institución especÃfica?",yes:"Sà â escribiré el nombre/ciudad",yesNeedsText:"Escribe el nombre / ciudad",generic:"Aspecto genérico de policÃa"}},shapeQuestion:{ask:"¿Qué forma quieres para tu parche?",options:{circle:"CÃrculo",rectangle:"Rectángulo",shield:"Escudo",star:"Estrella",heart:"Corazón",other:"Otroâ¦",surprise:"Sorpréndeme",otherPlaceholder:"Escribe una forma (p. ej. hexágono)"}},chatBubble:{refImagePrompt:"Convertir esta imagen de referencia en un diseño de parche bordado",editPrefix:"Cambio: "},emailDesign:{buttonTitle:"Enviar este diseño por correo",buttonAria:"Enviar este diseño por correo sin iniciar sesión",dialogAria:"Enviar este diseño por correo",heading:"Enviar este diseño por correo",body:"No necesitas cuenta. Te enviamos el parche y un enlace que lo vuelve a abrir aquÃ, listo para seguir editando.",notReady:"Aún estamos guardando tu diseño â espera un momento y el correo incluirá la imagen.",sent:"Enviado. Revisa tu correo.",placeholder:"[email protected]",cancel:"Cancelar",send:"Enviar",sending:"Enviandoâ¦",close:"Cerrar",failed:"No se pudo enviar. Inténtalo de nuevo."}},de:Jl};function Zl({onClose:t,t:a={},context:s={},defaultNeed:i="",defaultEmail:o=""}){const[l,u]=h.useState(i),[p,g]=h.useState(o),[b,y]=h.useState(""),[T,j]=h.useState(null),P=h.useRef(null),S={heading:"Tell us what you're trying to make â our team will design it for you, free",sub:"If the designer isn't getting there, stop wrestling with it â describe the patch in your own words and we take it from here.",needLabel:"What are you trying to make?",needPlaceholder:"Describe the patch you needâ¦",emailLabel:"Your email",emailPlaceholder:"[email protected]",phoneLabel:"Phone (optional)",phonePlaceholder:"(555) 555-5555",phoneHint:"Add a number if you would rather we call.",attachedNote:"We will include the design on screen and this chat so you do not have to explain it twice.",send:"Send to a human",sending:"Sendingâ¦",error:"That did not send â please try again, or email [email protected].",successHeading:"Got it â we're on it",successBody:"A designer on our team will reply within 2 business hours (weekdays). Check your inbox â we sent a copy there too.",close:"Close",...a};h.useEffect(()=>{const E=setTimeout(()=>{var _;try{(_=P.current)==null||_.focus()}catch{}},60),F=_=>{_.key==="Escape"&&(t==null||t())};return window.addEventListener("keydown",F),()=>{clearTimeout(E),window.removeEventListener("keydown",F)}},[t]);const R=l.trim().length>2&&/.+@.+\..+/.test(p)&&T!=="sending",L=async E=>{if(E.preventDefault(),!!R){j("sending");try{const{displayImageUrl:F,..._}=s;await fo({need:l.trim(),email:p.trim(),phone:b.trim(),..._}),j("success")}catch(F){console.warn("[design-help] send failed:",F&&F.message),j("error")}}},k={fontSize:"0.75rem",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.5px",display:"block",marginBottom:6},I={width:"100%",padding:"10px 12px",border:"1px solid #dbe0e6",borderRadius:10,fontSize:"0.92rem",boxSizing:"border-box",fontFamily:"var(--font-body)",color:"#0f172a",background:"white"};return e.jsx(Ya,{children:e.jsxs(e.Fragment,{children:[e.jsx(Pe.div,{initial:{opacity:0}
72,animate:{opacity:1},exit:{opacity:0},onClick:t,style:{position:"fixed",inset:0,background:"rgba(8,6,24,0.62)",zIndex:4e3}}),e.jsxs(Pe.div,{role:"dialog","aria-modal":"true","aria-label":S.heading,initial:{opacity:0,scale:.94,x:"-50%",y:"calc(-50% + 12px)"},animate:{opacity:1,scale:1,x:"-50%",y:"-50%"},exit:{opacity:0,scale:.94,x:"-50%",y:"-50%"},transition:{type:"spring",duration:.32},style:{position:"fixed",top:"50%",left:"50%",background:"white",borderRadius:18,padding:"28px 24px 24px",maxWidth:400,width:"92vw",zIndex:4001,maxHeight:"90vh",overflowY:"auto",boxShadow:"0 30px 70px -20px rgba(0,0,0,0.5)",color:"#0f172a"},children:[e.jsx("button",{type:"button",onClick:t,"aria-label":S.close,style:{position:"absolute",top:14,right:14,background:"none",border:"none",cursor:"pointer",color:"#94a3b8",padding:6,lineHeight:0},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),T==="success"?e.jsxs("div",{style:{textAlign:"center",padding:"14px 0 6px"},children:[e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:14},children:e.jsxs("svg",{width:"52",height:"52",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"#16a34a"},children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]})}),e.jsx("h2",{style:{fontFamily:"var(--font-heading)",fontSize:"1.3rem",margin:"0 0 10px"},children:S.successHeading}),e.jsx("p",{style:{color:"#475569",lineHeight:1.6,fontSize:"0.94rem",margin:"0 0 22px"},children:S.successBody}),e.jsx("button",{type:"button",onClick:t,style:{padding:"11px 30px",borderRadius:50,background:"var(--color-primary, #7c3aed)",color:"white",border:"none",fontWeight:700,cursor:"pointer",fontFamily:"var(--font-body)",fontSize:"0.92rem"},children:S.close})]}):e.jsxs("form",{onSubmit:L,children:[e.jsxs("h2",{style:{fontFamily:"var(--font-heading)",fontSize:"1.28rem",margin:"0 0 8px",display:"flex",alignItems:"center",gap:10,paddingRight:24},children:[e.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,color:"var(--color-primary, #7c3aed)"},children:e.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5Z"})}),e.jsx("span",{children:S.heading})]}),e.jsx("p",{style:{color:"#475569",fontSize:"0.9rem",lineHeight:1.55,margin:"0 0 20px"},children:S.sub}),(s.designImageUrl||s.transcriptId)&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,background:"#f6f4ff",border:"1px solid #e6e0ff",borderRadius:12,padding:"10px 12px",marginBottom:18},children:[(s.displayImageUrl||s.designImageUrl)&&e.jsx("img",{src:s.displayImageUrl||s.designImageUrl,alt:"",style:{width:42,he
72ight:42,borderRadius:8,objectFit:"cover",flexShrink:0,background:"#fff"}}),e.jsx("p",{style:{margin:0,fontSize:"0.78rem",color:"#5b4a8a",lineHeight:1.45},children:S.attachedNote})]}),e.jsx("label",{htmlFor:"pd-help-need",style:k,children:S.needLabel}),e.jsx("textarea",{id:"pd-help-need",ref:P,required:!0,rows:4,value:l,onChange:E=>u(E.target.value),placeholder:S.needPlaceholder,style:{...I,marginBottom:18,resize:"vertical",lineHeight:1.5}}),e.jsx("label",{htmlFor:"pd-help-email",style:k,children:S.emailLabel}),e.jsx("input",{id:"pd-help-email",type:"email",required:!0,value:p,onChange:E=>g(E.target.value),placeholder:S.emailPlaceholder,style:{...I,marginBottom:18}}),e.jsx("label",{htmlFor:"pd-help-phone",style:k,children:S.phoneLabel}),e.jsx("input",{id:"pd-help-phone",type:"tel",value:b,onChange:E=>y(E.target.value),placeholder:S.phonePlaceholder,style:{...I,marginBottom:6}}),e.jsx("p",{style:{color:"#94a3b8",fontSize:"0.76rem",margin:"0 0 18px"},children:S.phoneHint}),T==="error"&&e.jsx("p",{style:{color:"#dc2626",fontSize:"0.83rem",margin:"0 0 12px"},children:S.error}),e.jsx("button",{type:"submit",disabled:!R,style:{width:"100%",padding:"13px",borderRadius:50,background:R?"linear-gradient(135deg,#7c3aed,#4f46e5)":"#cbd5e1",color:"white",border:"none",fontWeight:800,fontSize:"0.96rem",cursor:R?"pointer":"not-allowed",fontFamily:"var(--font-body)"},children:T==="sending"?S.sending:e.jsxs(e.Fragment,{children:[S.send,e.jsx(Ln,{trailing:!0})]})})]})]})]})})}const Xl=Ut.code,Oi={en:{pct:t=>`${t}%`,dismiss:"Dismiss",doneHeading:"Sent - check your inbox",doneBody:t=>`Your design is on its way. Here's your code for ${t} off your first order:`,keepDesigning:"Keep designing",heading:"Wait - save your design",body:t=>e.jsxs(e.Fragment,{children:["Drop your email and we'll send your patch design - plus ",e.jsxs("strong",{children:[t," off"]})," your first order to make it real."]}),expires:(t,a)=>`${t} off expires in ${a}`,placeholder:"[email protected]",emailAria:"Email",invalid:"Please enter a valid email.",saving:"Savingâ¦",submit:t=>`Save my design + get ${t} off`,noThanks:"No thanks"},es:{dismiss:"Cerrar",doneHeading:"Enviado â revisa tu correo",doneBody:t=>`Tu diseño va en camino. Este es tu código para ${t} de descuento en tu primer pedido:`,keepDesigning:"Seguir diseñando",heading:"Espera â guarda tu diseño",body:t=>e.jsxs(e.Fragment,{children:["Déjanos tu correo y te enviamos tu diseño de parche, más ",e.jsxs("strong",{children:[t," de descuento"]})," en tu primer pedido para hacerlo realidad."]}),expires:(t,a)=>`El ${t} de descuento vence en ${a}`,placeholder:"[email protected]",emailAria:"Correo electrónico",invalid:"Introduce un correo válido.",saving:"Guardandoâ¦",submit:t=>`Guardar mi diseño + ${t} de descuento`,noThanks:"No, gracias"},de:{pct:t=>`${t} %`,dismiss:"SchlieÃen",doneHeading:"Gesendet â sehen Sie in Ihr Postfach",doneBody:t=>`Ihr Entwurf ist unterwegs. Hier ist Ihr Code für ${t} Rabatt auf Ihre erste Bestellung:`,keepDesigning:"Weiter gestalten",heading:"Speichern Sie Ihren Entwurf, bevor Sie gehen",body:t=>e.jsxs(e.Fragment,{children:["Geben Sie Ihre E-Mail-Adresse ein, und wir schicken Ihnen Ihren Aufnäher-Entwurf â dazu ",e.jsxs("strong",{children:[t," Rabatt"]})," auf Ihre erste Bestellung, damit er Wirklichkeit wird."]}),expires:(t,a)=>`${t} Rabatt, gültig noch ${a}`,placeholder:"[email protected]",emailAria:"E-Mail",invalid:"Bitte geben Sie eine gültige E-Mail-Adresse ein.",saving:"Wird gespeichert â¦",submit:t=>`Entwurf speichern + ${t} Rabatt`,noThanks:"Nein, danke"}};function ec({enabled:t,designs:a=[],primaryDataUrl:s="",transcriptId:i="",coupon:o=Xl,couponPct:l=null}){const u=In(),p={...Oi.en,...Oi[u]||{}},g=l||p.pct(Ut.percentOff),[b,y]=h.useState(!1),[T,j]=h.useState(""),[P,S]=h.useState("idle"),[R,L]=h.useState(60),k=h.useCallback(()=>{t&&(sessionStorage.getItem("saveDesignNudgeShown")||(sessionStorage.setItem("saveDesignNudgeShown","1"),y(!0)))},[t]);h.useEffect(()=>{if(!t)return;const _=Y=>{Y.clientY<=0&&k()};return document.addEventListener("mouseleave",_),()=>document.removeEventListener("mouseleave",_)}
72,[t,k]),h.useEffect(()=>{if(!b)return;const _=setInterval(()=>L(Y=>Y>0?Y-1:0),1e3);return()=>clearInterval(_)},[b]);const I=`${String(Math.floor(R/60)).padStart(2,"0")}:${String(R%60).padStart(2,"0")}`;h.useEffect(()=>{if(!t||typeof window.matchMedia!="function"||!window.matchMedia("(pointer: coarse)").matches)return;let _=!1;const Y=()=>{if(document.visibilityState==="hidden"){_=!0;return}_&&k()};return document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)},[t,k]);const E=async _=>{_&&_.preventDefault&&_.preventDefault();const Y=T.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Y)){S("error");return}S("sending");try{const V=await fetch("/api/ai-tool-capture",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:Y,designs:(a||[]).slice(0,6),primaryDataUrl:s||"",transcriptId:i||"",source:"exit-intent"})});if(!V.ok)throw new Error("status "+V.status);S("done")}catch{S("error")}},F={width:"100%",padding:"12px",border:"none",borderRadius:50,background:"linear-gradient(135deg,#7c3aed,#4f46e5)",color:"#fff",fontWeight:700,fontSize:"0.9rem",fontFamily:"inherit",cursor:"pointer"};return e.jsx(Ya,{children:b&&e.jsxs(e.Fragment,{children:[e.jsx(Pe.div,{initial:{opacity:0}
72,animate:{opacity:1},exit:{opacity:0},onClick:()=>y(!1),style:{position:"fixed",inset:0,background:"rgba(7,4,26,0.55)",zIndex:4e3}},"ov"),e.jsxs(Pe.div,{initial:{opacity:0,scale:.9,x:"-50%",y:"-50%"},animate:{opacity:1,scale:1,x:"-50%",y:"-50%"},exit:{opacity:0,scale:.95,x:"-50%",y:"-50%"},transition:{type:"spring",duration:.45,bounce:.25},style:{position:"fixed",top:"50%",left:"50%",background:"#fff",borderRadius:18,padding:"24px 26px",maxWidth:380,width:"calc(100vw - 40px)",zIndex:4001,boxShadow:"0 24px 64px rgba(0,0,0,0.32), 0 0 0 1px rgba(0,0,0,0.04)",fontFamily:"var(--font-body, system-ui, sans-serif)"},children:[e.jsx("button",{onClick:()=>y(!1),"aria-label":p.dismiss,style:{position:"absolute",top:12,right:14,background:"none",border:"none",cursor:"pointer",color:"#bbb",padding:4,lineHeight:0},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),P==="done"?e.jsxs("div",{children:[e.jsx("h3",{style:{margin:"0 0 8px",fontSize:"1.1rem",color:"#1a1333",fontWeight:800},children:p.doneHeading}),e.jsx("p",{style:{margin:"0 0 14px",fontSize:"0.86rem",color:"#555",lineHeight:1.55},children:p.doneBody(g)}),e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:12,borderRadius:12,border:"2px dashed #7c3aed",background:"#f5f1ff",fontFamily:"monospace",fontWeight:800,fontSize:"1.2rem",letterSpacing:"2px",color:"#4f46e5"},children:o}),e.jsx("button",{onClick:()=>y(!1),style:{...F,marginTop:16},children:p.keepDesigning})]}):e.jsxs("div",{children:[e.jsx("h3",{style:{margin:"0 0 6px",fontSize:"1.12rem",color:"#1a1333",fontWeight:800},children:p.heading}),e.jsx("p",{style:{margin:"0 0 12px",fontSize:"0.86rem",color:"#555",lineHeight:1.55},children:p.body(g)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,margin:"0 0 14px",padding:"7px 10px",borderRadius:10,background:"#fff7ed",color:"#b45309",fontSize:"0.78rem",fontWeight:700},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7v5l3 2"})]}),p.expires(g,I)]}),e.jsxs("form",{onSubmit:E,children:[e.jsx("input",{type:"email",value:T,onChange:_=>{j(_.target.value),P==="error"&&S("idle")},placeholder:p.placeholder,"aria-label":p.emailAria,autoFocus:!0,style:{width:"100%",boxSizing:"border-box",padding:"12px 14px",borderRadius:12,border:`1px solid ${P==="error"?"#e11d48":"#ddd"}`,fontSize:"0.92rem",fontFamily:"inherit",outline:"none",marginBottom:P==="error"?6:12}}),P==="error"&&e.jsx("p",{style:{margin:"0 0 10px",color:"#e11d48",fontSize:"0.76rem"},children:p.invalid}),e.jsx("button",{type:"submit",disabled:P==="sending",style:{...F,cursor:P==="sending"?"wait":"pointer",opacity:P==="sending"?.7:1},children:P==="sending"?p.saving:p.submit(g)})]}),e.jsx("button",{onClick:()=>y(!1),style:{marginTop:10,width:"100%",background:"none",border:"none",color:"#999",fontSize:"0.78rem",fontFamily:"inherit",cursor:"pointer"},children:p.noThanks})]})]},"md")]})})}const tc="_page_rk8e7_9",ac="_hero_rk8e7_43",rc="_heroTitle_rk8e7_50",nc="_heroSubtitle_rk8e7_66",ic="_messagesArea_rk8e7_82",sc="_chatEmpty_rk8e7_99",oc="_parkerOrb_rk8e7_155",lc="_parkerOrbPartner_rk8e7_190",cc="_messageRow_rk8e7_225",dc="_messageRowUser_rk8e7_230",hc="_avatar_rk8e7_233",uc="_messageBubble_rk8e7_243",pc="_messageAssistant_rk8e7_252",mc="_messageUser_rk8e7_258",gc="_chatImgThumb_rk8e7_268",fc="_inputWrap_rk8e7_278",yc="_inputBar_rk8e7_291",bc="_refStrip_rk8e7_318",wc="_refThumb_rk8e7_324",kc="_refThumbRemove_rk8e7_344",xc="_uploadIconBtn_rk8e7_365",vc="_uploadCountBadge_rk8e7_382",Sc="_uploadIconBtnReady_rk8e7_424",jc="_micBtnLive_rk8e7_437",_c="_micLive_rk8e7_461",Tc="_micLiveText_rk8e7_487",Ic="_micLiveDot_rk8e7_495",Lc="_micError_rk8e7_508",Cc="_micErrorLink_rk8e7_522",Ac="_chatInput_rk8e7_532",Nc="_inputActions_rk8e7_574",Rc="_inputActionsLeft_rk8e7_581",Ec="_imageActions_rk8e7_598",Pc="_imageActionBtn_rk8e7_620",Bc="_designCard_rk8e7_673",Oc="_designImageBox_rk8e7_609",$c="_designImageBoxLabeled_rk8e7_694",Mc="_sharePopover_rk8e7_703",Fc="_imageActionsLabeled_rk8e7_691",Dc="_designImageColumnLabeled_rk8e7_762",zc="_designThreadNote_rk8e7_763",Hc="_railRow_rk8e7_790",Wc="_rail
72Label_rk8e7_795",Uc="_railLabelShort_rk8e7_811",Gc="_railLabelGearOnly_rk8e7_815",qc="_railLabelHasShort_rk8e7_834",Vc="_railLabelFull_rk8e7_834",Kc="_shareWrapper_rk8e7_847",Yc="_shareGrid_rk8e7_881",Qc="_shareTile_rk8e7_888",Jc="_shareTileLabel_rk8e7_906",Zc="_shareTileIcon_rk8e7_914",Xc="_shareCopyRow_rk8e7_926",ed="_shareStatus_rk8e7_951",td="_shareStatusSuccess_rk8e7_962",ad="_shareStatusIcon_rk8e7_963",rd="_pasteHelper_rk8e7_979",nd="_pasteHelperHeader_rk8e7_1000",id="_pasteHelperIcon_rk8e7_1006",sd="_pasteHelperTitle_rk8e7_1015",od="_pasteHelperClose_rk8e7_1022",ld="_pasteHelperReady_rk8e7_1042",cd="_pasteHelperReadyItem_rk8e7_1053",dd="_pasteHelperSteps_rk8e7_1067",hd="_pasteHelperActions_rk8e7_1082",ud="_pasteHelperPrimary_rk8e7_1087",pd="_pasteHelperSecondary_rk8e7_1088",md="_imageBadge_rk8e7_1146",gd="_view360Btn_rk8e7_1169",fd="_imageBadgeSpinner_rk8e7_1200",yd="_captureSpinner_rk8e7_1211",bd="_disclaimer_rk8e7_1242",wd="_loadingBubble_rk8e7_1255",kd="_loadingTextRainbow_rk8e7_1274",xd="_loadingPercent_rk8e7_1329",vd="_loadingStack_rk8e7_1343",Sd="_loadingProgressTrack_rk8e7_1370",jd="_loadingProgressFill_rk8e7_1377",_d="_loadingBeat_rk8e7_1344",Td="_loadingSignIn_rk8e7_1435",Id="_loadingSignInTitle_rk8e7_1447",Ld="_loadingSignInSub_rk8e7_1454",Cd="_loadingExtras_rk8e7_1473",Ad="_fsShowcase_rk8e7_1500",Nd="_fsTrustItem_rk8e7_1501",Rd="_loadingBadges_rk8e7_1491",Ed="_loadingBadgeWide_rk8e7_1521",Pd="_loadingBadge_rk8e7_1491",Bd="_loadingBadgeCoupon_rk8e7_1558",Od="_loadingBadgeCouponTop_rk8e7_1582",$d="_loadingBadgeCodeWrap_rk8e7_1589",Md="_loadingBadgeCode_rk8e7_1589",Fd="_loadingBadgeCodeHint_rk8e7_1609",Dd="_zoomOverlay_rk8e7_1648",zd="_zoomImage_rk8e7_1659",Hd="_zoomCloseBtn_rk8e7_1666",Wd="_zoomHint_rk8e7_1683",Ud="_sampleNote_rk8e7_1710",Gd="_zoomNote_rk8e7_1755",qd="_refImgPreview_rk8e7_1769",Vd="_refImgLabel_rk8e7_1775",Kd="_brandRefCard_rk8e7_1784",Yd="_brandRefLogo_rk8e7_1796",Qd="_brandRefText_rk8e7_1805",Jd="_brandRefName_rk8e7_1812",Zd="_brandRefHost_rk8e7_1820",Xd="_brandRefSwatches_rk8e7_1827",eh="_brandRefSwatch_rk8e7_1827",th="_startLang_rk8e7_1859",ah="_chatShell_rk8e7_1238",rh="_chatShellEmpty_rk8e7_1916",nh="_emptyLeftCol_rk8e7_1909",ih="_fsShowcaseLabel_rk8e7_1949",sh="_fsShowcaseRow_rk8e7_1958",oh="_fsShowcaseThumb_rk8e7_1962",lh="_fsPromptChips_rk8e7_1992",ch="_fsPromptChip_rk8e7_1992",dh="_fsTrustStrip_rk8e7_2019",hh="_designRow_rk8e7_2051",uh="_designCardLead_rk8e7_2071",ph="_designCardLeadShort_rk8e7_2086",mh="_designCardLeadFull_rk8e7_2091",gh="_designImageColumn_rk8e7_762",fh="_aspectFrame_rk8e7_2223",yh="_aspectFrameLabel_rk8e7_2238",bh="_rerenderChipRail_rk8e7_2261",wh="_rerenderChipRailBody_rk8e7_2279",kh="_rerenderChipRailText_rk8e7_2286",xh="_rerenderChipRailBtn_rk8e7_2291",vh="_designContentRow_rk8e7_2318",Sh="_designContentRowCollapsed_rk8e7_2338",jh="_railReopenInCol_rk8e7_2365",_h="_railReopenGear_rk8e7_2376",Th="_railReopenTri_rk8e7_2428",Ih="_railReopenLabel_rk8e7_2429",Lh="_railReopen_rk8e7_2365",Ch="_designRailHeader_rk8e7_2544",Ah="_designRailHeaderToggle_rk8e7_2553",Nh="_designRailTitle_rk8e7_2568",Rh="_designRailHeaderChevron_rk8e7_2569",Eh="_designRail_rk8e7_2544",Ph="_designRailItem_rk8e7_2601",Bh="_designRailItemShape_rk8e7_2614",Oh="_designRailLabel_rk8e7_2619",$h="_designRailSelect_rk8e7_2628",Mh="_designRailSizeRow_rk8e7_2662",Fh="_designRailSizeX_rk8e7_2671",Dh="_designRailSegmented_rk8e7_2677",zh="_designRailShapeChip_rk8e7_2694",Hh="_designRailShapeOtherWrap_rk8e7_2716",Wh="_designRailInput_rk8e7_2723",Uh="_designRailSegBtn_rk8e7_2726",Gh="_designRailSegBtnActive_rk8e7_2741",qh="_designRailInputWrap_rk8e7_2774",Vh="_designRailInputSend_rk8e7_2784",Kh="_designRailPrice_rk8e7_2807",Yh="_designRailQuoteCard_rk8e7_2822",Qh="_railCta_rk8e7_2819",Jh="_designRailPriceAmount_rk8e7_2861",Zh="_designRailPriceSub_rk8e7_2870",Xh="_designCardCaption_rk8e7_2879",eu="_microSurveyRow_rk8e7_2927",tu="_microSurveyPanel_rk8e7_2915",au="_microSurveyLabel_rk8e7_2959",ru="_microSurveyNote_rk8e7_2967",nu="_microSurveyEcho_rk8e7_2975",iu="_microSurveyCard_rk8e7_2916",su="_microSurveyDone_rk8e7_2998",ou="_microSurveyAsk_rk8e7_3003",lu="_microSurveyInput_rk8e7_3008",cu="_microSurveyActions_rk8e7_3025",du="_microSurveySkipBtn_rk8e7_3030",hu="_microSurveySendBtn_rk8e7_3031",uu="_microSurveyChips_rk8e7_3066",pu="_microSurveyChip_rk8e7_3066",mu="_ioSizeField_rk8e7_3124",gu="_ioSizeWrap_rk8e7_3142",fu="_ioSizeStep_rk8e7_3143",yu="_ioTier_rk8e7_3192",bu="_ioTier
72Sub_rk8e7_3202",wu="_ioTierBadge_rk8e7_3217",ku="_ioTierSel_rk8e7_3223",xu="_ioTierGrid_rk8e7_3229",vu="_ioTierGridTwo_rk8e7_3241",Su="_ioPillGrid_rk8e7_3246",ju="_ioPillGridTwo_rk8e7_3255",_u="_ioOptRow_rk8e7_3264",Tu="_ioArrow_rk8e7_3186",Iu="_ioPill_rk8e7_3246",Lu="_ioPillSel_rk8e7_3342",Cu="_ioPillTall_rk8e7_3352",Au="_ioMore_rk8e7_3400",Nu="_ioOptions_rk8e7_3420",Ru="_ioOptLabel_rk8e7_3380",Eu="_ioOptLabelMid_rk8e7_3437",Pu="_ioSizeNotice_rk8e7_3440",Bu="_ioMoreStack_rk8e7_3450",Ou="_ioRule_rk8e7_3463",$u="_ioColumn_rk8e7_3478",Mu="_ioOptLabelLine_rk8e7_3380",Fu="_ioOptCtrlLine_rk8e7_3516",Du="_designSplit_rk8e7_3624",zu="_instantOrderRoot_rk8e7_3615",Hu="_ioSpec_rk8e7_3643",Wu="_ioBuy_rk8e7_3656",Uu="_ioReassure_rk8e7_3657",Gu="_ioFine_rk8e7_3658",qu="_moreOptionsBlock_rk8e7_3676",Vu="_tryOnDisclosure_rk8e7_3677",Ku="_moreOptionsBar_rk8e7_3723",Yu="_moreOptionsBarOpen_rk8e7_3744",Qu="_moreOptionsLabel_rk8e7_3745",Ju="_moreOptionsGear_rk8e7_3746",Zu="_moreOptionsChevron_rk8e7_3749",Xu="_moreOptionsChevronOpen_rk8e7_3750",ep="_moreOptionsPanel_rk8e7_3751",tp="_shownFieldsBlock_rk8e7_3775",ap="_prevStripLead_rk8e7_3867",rp="_prevStripWrap_rk8e7_3877",np="_prevStrip_rk8e7_3867",ip="_prevItem_rk8e7_3890",sp="_prevItemInner_rk8e7_3896",op="_orderThisRow_rk8e7_3936",lp="_orderThisBtn_rk8e7_3937",cp="_continueThisBtn_rk8e7_3938",dp="_continueThisActive_rk8e7_3939",hp="_prevArrow_rk8e7_3943",up="_prevArrowLeft_rk8e7_3961",pp="_prevArrowRight_rk8e7_3962",mp="_tryOnToggle_rk8e7_4048",gp="_tryOnToggleIcon_rk8e7_4081",fp="_tryOnChevron_rk8e7_4082",yp="_tryOnChevronOpen_rk8e7_4087",bp="_tryOnPanel_rk8e7_4044",wp="_tryOnRow_rk8e7_4094",kp="_tryOnRowFour_rk8e7_4106",xp="_tryOnDisclaimer_rk8e7_4109",vp="_tryOnThumb_rk8e7_4043",Sp="_tryOnThumbInner_rk8e7_4142",jp="_tryOnThumbGarment_rk8e7_4150",_p="_tryOnThumbPatch_rk8e7_4155",Tp="_tryOnThumbLabel_rk8e7_4166",Ip="_tryOnModalOverlay_rk8e7_4176",Lp="_tryOnModalCard_rk8e7_4188",Cp="_tryOnModalHeader_rk8e7_4204",Ap="_tryOnModalClose_rk8e7_4220",Np="_tryOnModalStage_rk8e7_4238",Rp="_tryOnModalCanvas_rk8e7_4250",Ep="_tryOnModalGarment_rk8e7_4261",Pp="_tryOnModalPatch_rk8e7_4266",Bp="_tryOnModalActions_rk8e7_4275",Op="_zoomTryOnStage_rk8e7_4287",$p="_zoomTryOnCanvas_rk8e7_4296",Mp="_zoomTryOnGarment_rk8e7_4301",Fp="_zoomTryOnPatch_rk8e7_4307",Dp="_railChangePill_rk8e7_4318",zp="_newIconBtn_rk8e7_367",Hp="_newIconBtnLabel_rk8e7_4472",Wp="_helpIconBtn_rk8e7_544",Up="_helpIconBtnLabel_rk8e7_4523",Gp="_brandQuestionCard_rk8e7_4536",qp="_brandQuestionAsk_rk8e7_4542",Vp="_brandQuestionOptions_rk8e7_4548",Kp="_brandQuestionBtn_rk8e7_4553",Yp="_brandQuestionInputRow_rk8e7_4588",Qp="_brandQuestionInput_rk8e7_4588",Jp="_brandQuestionSubmit_rk8e7_4626",Zp="_errorCard_rk8e7_4645",Xp="_errorFriendly_rk8e7_4657",em="_errorActions_rk8e7_4666",tm="_errorAutoRetryNote_rk8e7_4678",am="_errorAutoRetryDot_rk8e7_4696",rm="_errorAutoRetrySpinner_rk8e7_4705",nm="_errorRetryBtn_rk8e7_4720",im="_errorCancelBtn_rk8e7_4758",sm="_errorPriorRetriesNote_rk8e7_4790",om="_rateLimitCard_rk8e7_4814",lm="_rateLimitTitle_rk8e7_4826",cm="_rateLimitBody_rk8e7_4836",dm="_rateLimitActions_rk8e7_4845",hm="_rateLimitEmailLink_rk8e7_4852",um="_rateLimitSignin_rk8e7_4874",pm="_rateLimitProviders_rk8e7_1434",mm="_rateLimitProviderBtn_rk8e7_1434",gm="_rateLimitOr_rk8e7_4923",fm="_rateLimitOrder_rk8e7_4947",ym="_rateLimitOrderLabel_rk8e7_4955",bm="_rateLimitOrderBtn_rk8e7_4960",wm="_rateLimitEmailRow_rk8e7_4983",km="_rateLimitEmailLabel_rk8e7_4990",xm="_rateLimitEmailHint_rk8e7_4996",vm="_rateLimitEmailControls_rk8e7_5004",Sm="_rateLimitEmailInput_rk8e7_5009",jm="_rateLimitEmailBtn_rk8e7_5025",_m="_rateLimitEmailError_rk8e7_5039",Tm="_rateLimitEmailSent_rk8e7_5043",Im="_retryReloadOverlay_rk8e7_5073",Lm="_retryReloadCard_rk8e7_5089",Cm="_retryReloadTitle_rk8e7_5100",Am="_retryReloadSub_rk8e7_5105",Nm="_errorReportLink_rk8e7_5115",Rm="_errorCode_rk8e7_5134",Em="_inlineQuoteLink_rk8e7_5154",Pm="_emptyStateRow_rk8e7_1910",Bm="_emptyStateRowFolded_rk8e7_5298",Om="_emptyStateRowTabAtInput_rk8e7_5311",$m="_emptyStateRefPreview_rk8e7_5348",Mm="_styleSelect_rk8e7_5390",Fm="_styleSelectBtn_rk8e7_5394",Dm="_styleSelectIcon_rk8e7_5416",zm="_styleSelectLabel_rk8e7_5425",Hm
72="_styleSelectChev_rk8e7_5431",Wm="_styleSelectMenu_rk8e7_5436",Um="_styleSelectMenuEnd_rk8e7_5455",Gm="_styleSelectItem_rk8e7_5459",qm="_styleSelectItemActive_rk8e7_5479",Vm="_designRailPriceUnit_rk8e7_5511",Km="_parkerOrbFrame_rk8e7_5526",Ym="_parkerOrbFrameIdle_rk8e7_5541",Qm="_avatarFrame_rk8e7_5582",Jm="_avatarFrameBusy_rk8e7_5595",Zm="_sparkle_rk8e7_5624",Xm="_sparkle1_rk8e7_5634",eg="_sparkle2_rk8e7_5635",tg="_sparkle3_rk8e7_5636",ag="_sparkle4_rk8e7_5637",rg="_sparkle5_rk8e7_5638",ng="_tryOnNavBtn_rk8e7_5682",ig="_tryOnNavBtnLeft_rk8e7_5712",sg="_tryOnNavBtnRight_rk8e7_5713",og="_introLine_rk8e7_5880",lg="_inputRowWrap_rk8e7_5891",cg="_inputAurora_rk8e7_5893",dg="_auroraBlob_rk8e7_5902",hg="_auroraBlobA_rk8e7_5930",ug="_auroraBlobB_rk8e7_5936",pg="_auroraBlobC_rk8e7_5942",mg="_generateBtn_rk8e7_367",gg="_generateBtnLabel_rk8e7_6022",fg="_generateBtnArrow_rk8e7_6023",yg="_focusHistoryRow_rk8e7_6265",bg="_focusHistoryIcon_rk8e7_6292",wg="_focusHistoryText_rk8e7_6298",kg="_focusHistoryHint_rk8e7_6305",xg="_exitFocusLine_rk8e7_6328",vg="_exitFocusLink_rk8e7_6332",Sg="_orderThisShort_rk8e7_6355",jg="_orderThisFull_rk8e7_6374",_g="_imageActionBtnEdit_rk8e7_6431",Tg="_inputWrapPulse_rk8e7_6440",Ig="_stickyBuyBar_rk8e7_6469",Lg="_stickyBuyMeta_rk8e7_6500",Cg="_stickyBuyTotal_rk8e7_6506",Ag="_stickyBuyUnit_rk8e7_6518",Ng="_stickyBuySub_rk8e7_6526",Rg="_stickyBuyBtn_rk8e7_6534",Eg="_designLeadAvatar_rk8e7_6566",Pg="_designRowAvatar_rk8e7_6570",Bg="_designThreadNoteShort_rk8e7_6597",Og="_designThreadNoteFull_rk8e7_6599",$g="_inputActionsBusy_rk8e7_6610",Mg="_fsShowcaseRepeat_rk8e7_6636",Fg="_generateBtnLabelShort_rk8e7_6649",Dg="_generateBtnLabelFull_rk8e7_6651",zg="_askBar_rk8e7_6751",Hg="_askBarIcon_rk8e7_6783",Wg="_askBarLabel_rk8e7_6790",Ug="_askBarArrow_rk8e7_6801",Gg="_srOnly_rk8e7_6815",qg="_coachBubble_rk8e7_6847",Vg="_coachBubbleText_rk8e7_6882",Kg="_coachBubbleTextShort_rk8e7_6890",Yg="_coachBubbleTextFull_rk8e7_6892",Qg="_coachBubbleClose_rk8e7_6895",Jg="_ioCommentsBox_rk8e7_545",Zg="_heroTucked_rk8e7_6949",Xg="_messageBubbleOneLine_rk8e7_6950",ef="_ioImageFill_rk8e7_6953",tf="_ioRailCurrency_rk8e7_1166",af="_ioCommentsFit_rk8e7_7062",rf="_ioCommentsChevron_rk8e7_7087",nf="_messageRowOneLine_rk8e7_7106",sf="_typeSelectWrap_rk8e7_7115",of="_typeHint_rk8e7_7120",lf="_typeHintIcon_rk8e7_7148",cf="_typeHintBody_rk8e7_7155",df="_typeHintText_rk8e7_7156",hf="_typeHintActions_rk8e7_7157",uf="_typeHintGenerate_rk8e7_7164",pf="_typeHintGuide_rk8e7_7178",mf="_typeHintClose_rk8e7_7189",gf="_ioColumnOptionsOpen_rk8e7_7228",ff="_styleSelectHint_rk8e7_7237",r={page:tc,hero:ac,heroTitle:rc,heroSubtitle:nc,messagesArea:ic,chatEmpty:sc,parkerOrb:oc,parkerOrbPartner:lc,messageRow:cc,messageRowUser:dc,avatar:hc,messageBubble:uc,messageAssistant:pc,messageUser:mc,chatImgThumb:gc,inputWrap:fc,inputBar:yc,refStrip:bc,refThumb:wc,refThumbRemove:kc,uploadIconBtn:xc,uploadCountBadge:vc,uploadIconBtnReady:Sc,micBtnLive:jc,micLive:_c,micLiveText:Tc,micLiveDot:Ic,micError:Lc,micErrorLink:Cc,chatInput:Ac,inputActions:Nc,inputActionsLeft:Rc,imageActions:Ec,imageActionBtn:Pc,designCard:Bc,designImageBox:Oc,designImageBoxLabeled:$c,sharePopover:Mc,imageActionsLabeled:Fc,designImageColumnLabeled:Dc,designThreadNote:zc,railRow:Hc,railLabel:Wc,railLabelShort:Uc,railLabelGearOnly:Gc,railLabelHasShort:qc,railLabelFull:Vc,shareWrapper:Kc,shareGrid:Yc,shareTile:Qc,shareTileLabel:Jc,shareTileIcon:Zc,shareCopyRow:Xc,shareStatus:ed,shareStatusSuccess:td,shareStatusIcon:ad,pasteHelper:rd,pasteHelperHeader:nd,pasteHelperIcon:id,pasteHelperTitle:sd,pasteHelperClose:od,pasteHelperReady:ld,pasteHelperReadyItem:cd,pasteHelperSteps:dd,pasteHelperActions:hd,pasteHelperPrimary:ud,pasteHelperSecondary:pd,imageBadge:md,view360Btn:gd,imageBadgeSpinner:fd,captureSpinner:yd,disclaimer:bd,loadingBubble:wd,loadingTextRainbow:kd,loadingPercent:xd,loadingStack:vd,loadingProgressTrack:Sd,loadingProgressFill:jd,loadingBeat:_d,loadingSignIn:Td,loadingSignInTitle:Id,loadingSignInSub:Ld,loadingExtras:Cd,fsShowcase:Ad,fsTrustItem:Nd,loadingBadges:Rd,loadingBadgeWide:Ed,loadingBadge:Pd,loadingBadgeCoupon:Bd,loadingBadgeCouponTop:Od,loadingBadgeCodeWrap:$d,loadingBadgeCode:Md,loadingBadgeCodeHint:Fd,zoomOverlay:Dd,zoomImage:zd,zoomCloseBtn:Hd,zoomHint:Wd,sampleNote:Ud,zoomNote:Gd,refImgPreview:qd,refImgLabel:Vd,brandRefCard:Kd,brandRefLogo:Yd,brandRefText:Qd,brandRefName:Jd,brandRefHost:Zd,brandRefSwatches:Xd,brandRefSwatch:eh,startLang:th,chatShell:ah,chatShellEmpty:rh,emptyLeftCol:nh,fsShowcaseLabel:ih,fsShowcaseRow:sh,fsSh
72owcaseThumb:oh,fsPromptChips:lh,fsPromptChip:ch,fsTrustStrip:dh,designRow:hh,designCardLead:uh,designCardLeadShort:ph,designCardLeadFull:mh,designImageColumn:gh,aspectFrame:fh,aspectFrameLabel:yh,rerenderChipRail:bh,rerenderChipRailBody:wh,rerenderChipRailText:kh,rerenderChipRailBtn:xh,designContentRow:vh,designContentRowCollapsed:Sh,railReopenInCol:jh,railReopenGear:_h,railReopenTri:Th,railReopenLabel:Ih,railReopen:Lh,designRailHeader:Ch,designRailHeaderToggle:Ah,designRailTitle:Nh,designRailHeaderChevron:Rh,designRail:Eh,designRailItem:Ph,designRailItemShape:Bh,designRailLabel:Oh,designRailSelect:$h,designRailSizeRow:Mh,designRailSizeX:Fh,designRailSegmented:Dh,designRailShapeChip:zh,designRailShapeOtherWrap:Hh,designRailInput:Wh,designRailSegBtn:Uh,designRailSegBtnActive:Gh,designRailInputWrap:qh,designRailInputSend:Vh,designRailPrice:Kh,designRailQuoteCard:Yh,railCta:Qh,designRailPriceAmount:Jh,designRailPriceSub:Zh,designCardCaption:Xh,microSurveyRow:eu,microSurveyPanel:tu,microSurveyLabel:au,microSurveyNote:ru,microSurveyEcho:nu,microSurveyCard:iu,microSurveyDone:su,microSurveyAsk:ou,microSurveyInput:lu,microSurveyActions:cu,microSurveySkipBtn:du,microSurveySendBtn:hu,microSurveyChips:uu,microSurveyChip:pu,ioSizeField:mu,ioSizeWrap:gu,ioSizeStep:fu,ioTier:yu,ioTierSub:bu,ioTierBadge:wu,ioTierSel:ku,ioTierGrid:xu,ioTierGridTwo:vu,ioPillGrid:Su,ioPillGridTwo:ju,ioOptRow:_u,ioArrow:Tu,ioPill:Iu,ioPillSel:Lu,ioPillTall:Cu,ioMore:Au,ioOptions:Nu,ioOptLabel:Ru,ioOptLabelMid:Eu,ioSizeNotice:Pu,ioMoreStack:Bu,ioRule:Ou,ioColumn:$u,ioOptLabelLine:Mu,ioOptCtrlLine:Fu,designSplit:Du,instantOrderRoot:zu,ioSpec:Hu,ioBuy:Wu,ioReassure:Uu,ioFine:Gu,moreOptionsBlock:qu,tryOnDisclosure:Vu,moreOptionsBar:Ku,moreOptionsBarOpen:Yu,moreOptionsLabel:Qu,moreOptionsGear:Ju,moreOptionsChevron:Zu,moreOptionsChevronOpen:Xu,moreOptionsPanel:ep,shownFieldsBlock:tp,prevStripLead:ap,prevStripWrap:rp,prevStrip:np,prevItem:ip,prevItemInner:sp,orderThisRow:op,orderThisBtn:lp,continueThisBtn:cp,continueThisActive:dp,prevArrow:hp,prevArrowLeft:up,prevArrowRight:pp,tryOnToggle:mp,tryOnToggleIcon:gp,tryOnChevron:fp,tryOnChevronOpen:yp,tryOnPanel:bp,tryOnRow:wp,tryOnRowFour:kp,tryOnDisclaimer:xp,tryOnThumb:vp,tryOnThumbInner:Sp,tryOnThumbGarment:jp,tryOnThumbPatch:_p,tryOnThumbLabel:Tp,tryOnModalOverlay:Ip,tryOnModalCard:Lp,tryOnModalHeader:Cp,tryOnModalClose:Ap,tryOnModalStage:Np,tryOnModalCanvas:Rp,tryOnModalGarment:Ep,tryOnModalPatch:Pp,tryOnModalActions:Bp,zoomTryOnStage:Op,zoomTryOnCanvas:$p,zoomTryOnGarment:Mp,zoomTryOnPatch:Fp,railChangePill:Dp,newIconBtn:zp,newIconBtnLabel:Hp,helpIconBtn:Wp,helpIconBtnLabel:Up,brandQuestionCard:Gp,brandQuestionAsk:qp,brandQuestionOptions:Vp,brandQuestionBtn:Kp,brandQuestionInputRow:Yp,brandQuestionInput:Qp,brandQuestionSubmit:Jp,errorCard:Zp,errorFriendly:Xp,errorActions:em,errorAutoRetryNote:tm,errorAutoRetryDot:am,errorAutoRetrySpinner:rm,errorRetryBtn:nm,errorCancelBtn:im,errorPriorRetriesNote:sm,rateLimitCard:om,rateLimitTitle:lm,rateLimitBody:cm,rateLimitActions:dm,rateLimitEmailLink:hm,rateLimitSignin:um,rateLimitProviders:pm,rateLimitProviderBtn:mm,rateLimitOr:gm,rateLimitOrder:fm,rateLimitOrderLabel:ym,rateLimitOrderBtn:bm,rateLimitEmailRow:wm,rateLimitEmailLabel:km,rateLimitEmailHint:xm,rateLimitEmailControls:vm,rateLimitEmailInput:Sm,rateLimitEmailBtn:jm,rateLimitEmailError:_m,rateLimitEmailSent:Tm,retryReloadOverlay:Im,retryReloadCard:Lm,retryReloadTitle:Cm,retryReloadSub:Am,errorReportLink:Nm,errorCode:Rm,inlineQuoteLink:Em,emptyStateRow:Pm,emptyStateRowFolded:Bm,emptyStateRowTabAtInput:Om,emptyStateRefPreview:$m,styleSelect:Mm,styleSelectBtn:Fm,styleSelectIcon:Dm,styleSelectLabel:zm,styleSelectChev:Hm,styleSelectMenu:Wm,styleSelectMenuEnd:Um,styleSelectItem:Gm,styleSelectItemActive:qm,designRailPriceUnit:Vm,parkerOrbFrame:Km,parkerOrbFrameIdle:Ym,avatarFrame:Qm,avatarFrameBusy:Jm,sparkle:Zm,sparkle1:Xm,sparkle2:eg,sparkle3:tg,sparkle4:ag,sparkle5:rg,tryOnNavBtn:ng,tryOnNavBtnLeft:ig,tryOnNavBtnRight:sg,introLine:og,inputRowWrap:lg,inputAurora:cg,auroraBlob:dg,auroraBlobA:hg,auroraBlobB:ug,auroraBlobC:pg,generateBtn:mg,generateBtnLabel:gg,generateBtnArrow:fg,focusHistoryRow:yg,focusHistoryIcon:bg,focusHistoryText:wg,focusHistoryHint:kg,exitFocusLine:xg,exitFocusLink:vg,orderThisShort:Sg,orderThisFull:jg,imageActionBtnEdit:_g,inputWrapPulse:Tg,stickyBuyBar:Ig,stickyBuyMeta:Lg,stickyBuyTotal:Cg,stickyBuyUnit:Ag,stickyBuySub:Ng,stickyBuyBtn:Rg,designLeadAvatar:Eg,designRowAvatar:Pg,designThreadNoteShort:Bg,designThreadNoteFull:Og,inputA
72ctionsBusy:$g,fsShowcaseRepeat:Mg,generateBtnLabelShort:Fg,generateBtnLabelFull:Dg,askBar:zg,askBarIcon:Hg,askBarLabel:Wg,askBarArrow:Ug,srOnly:Gg,coachBubble:qg,coachBubbleText:Vg,coachBubbleTextShort:Kg,coachBubbleTextFull:Yg,coachBubbleClose:Qg,ioCommentsBox:Jg,heroTucked:Zg,messageBubbleOneLine:Xg,ioImageFill:ef,ioRailCurrency:tf,ioCommentsFit:af,ioCommentsChevron:rf,messageRowOneLine:nf,typeSelectWrap:sf,typeHint:of,typeHintIcon:lf,typeHintBody:cf,typeHintText:df,typeHintActions:hf,typeHintGenerate:uf,typeHintGuide:pf,typeHintClose:mf,ioColumnOptionsOpen:gf,styleSelectHint:ff};function aa(t,a){if(!t||typeof t!="string")return t;const s=t.replace("#",""),i=s.length===3?s.split("").map(y=>y+y).join(""):s,o=parseInt(i,16);if(Number.isNaN(o))return t;let l=o>>16&255,u=o>>8&255,p=o&255;const g=a<0?0:255,b=Math.abs(a)/100;return l=Math.round((g-l)*b)+l,u=Math.round((g-u)*b)+u,p=Math.round((g-p)*b)+p,"#"+[l,u,p].map(y=>y.toString(16).padStart(2,"0")).join("")}function $i(t,a=1){if(!t)return`rgba(140,60,255,${a})`;const s=t.replace("#",""),i=s.length===3?s.split("").map(g=>g+g).join(""):s,o=parseInt(i,16);if(Number.isNaN(o))return`rgba(140,60,255,${a})`;const l=o>>16&255,u=o>>8&255,p=o&255;return`rgba(${l},${u},${p},${a})`}function Mi(t){if(!t)return"140 60 255";const a=t.replace("#",""),s=a.length===3?a.split("").map(p=>p+p).join(""):a,i=parseInt(s,16);if(Number.isNaN(i))return"140 60 255";const o=i>>16&255,l=i>>8&255,u=i&255;return`${o} ${l} ${u}`}function yf(t){if(!t||typeof t!="string")return 1;const a=t.replace("#",""),s=a.length===3?a.split("").map(p=>p+p).join(""):a,i=parseInt(s,16);if(Number.isNaN(i))return 1;const o=(i>>16&255)/255,l=(i>>8&255)/255,u=(i&255)/255;return .2126*o+.7152*l+.0722*u}const bf={"martial-arts":"Karate",ymca:"YMCA",scouting:"Scouts","youth-sports":"Sports",promo:"Corporate","patch-manufacturer":"Corporate","law-enforcement":"LawEnforcement",military:"Military",firefighter:"LawEnforcement",motorcycle:"Motorcycle"};function $s(t){return t&&bf[t]||null}function Ms(){if(typeof window>"u"||typeof document>"u")return!1;if(window.__PD_SDK_MODE__)return!0;try{if(document.querySelector("patch-designer"))return!0}catch{}return!1}function Fi(){if(typeof document>"u")return null;if(Ms()){const t=document.querySelector("patch-designer");if(t)return t}return document.documentElement}function wf({embedMode:t=!1,embedConfig:a=null}={}){h.useEffect(()=>{if(!t||!a)return;const o=Fi();if(!o)return;const l=a.primaryColor,u=a.accentColor,p=a.darkColor,g=a.lightColor;l&&(o.style.setProperty("--color-primary",l),o.style.setProperty("--color-primary-dark",aa(l,-18)),o.style.setProperty("--brand-ink",aa(l,-45)),o.style.setProperty("--brand-ink-deep",aa(l,-65)),o.style.setProperty("--brand-primary-rgb",Mi(l)),o.style.setProperty("--brand-tint-50",aa(l,97)),o.style.setProperty("--brand-tint-100",aa(l,94)),o.style.setProperty("--brand-tint-200",aa(l,88)),o.style.setProperty("--brand-tint-300",aa(l,78))),u&&(o.style.setProperty("--color-accent",u),o.style.setProperty("--brand-accent-rgb",Mi(u))),p&&(o.style.setProperty("--color-navy",p),o.style.setProperty("--brand-bg-0",aa(p,-28)),o.style.setProperty("--brand-bg-1",aa(p,-14)),o.style.setProperty("--brand-bg-2",p),o.style.setProperty("--brand-bg-3",aa(p,-24)),o.style.setProperty("--brand-glow-a",$i(l||p,.28)),o.style.setProperty("--brand-glow-b",$i(u||p,.22))),g&&(o.style.setProperty("--brand-light-bg-0",g),o.style.setProperty("--brand-light-bg-1",aa(g,-3)),o.style.setProperty("--brand-light-bg-2",aa(g,2)))},[t,a]),h.useEffect(()=>{if(!t)return;const o=Ms(),l=Fi();if(!l)return;const u=l.getAttribute("data-theme"),p=a==null?void 0:a.darkColor,b=!!p&&yf(p)<.45?"dark":"light";l.setAttribute("data-theme",b);let y="",T="";return o||(y=document.body.style.backgroundColor,T=document.documentElement.style.backgroundColor,document.body.style.backgroundColor="transparent",document.documentElement.style.backgroundColor="transparent"),()=>{u?l.setAttribute("data-theme",u):l.removeAttribute("data-theme"),o||(document.body.style.backgroundColor=y,document.documentElement.style.backgroundColor=T)}},[t,a==null?void 0:a.darkColor]);const s=t&&((typeof window<"u"?new URLSearchParams(window.location.search).get("client"):null)||a&&a.clientKey)||null;return h.useEffect(()=>{if(!(typeof window>"u"))return t&&s?window.__PATCHDESIGN_CLIENT_KEY__=s:delete window.__PATCHDESIGN_CLIENT_KEY__,()=>{try{delete window.__PATCHDESIGN_CLIENT_KEY__}catch{}}},[t,s]),h.useEffect(()=>{var p;if(!t||!s)return;a&&a.__preview||Te("/api/log-event",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientKey:s,eventType:"view",metadata:{path:window.location.pathname}})}).catch(()=>{});try{(p=window.parent)==null||p.postMessage({type:"patchdesign:view",clientKey:s},"*")}catch{}const o=()=>{var g,b,y,T;try{const j=Math.max(((g=document.body)==null?void 0:g.scrollHeight)||0,((b=document.documentElement)==null?void 0:b.scrollHeight)||0,((y=document.documentElement)==null?void 0:y.offsetHeight)||0);(T=window.parent)==null||T.postMessage({type:"patchdesign:resize",height:j},"*")}catch{}};o();const l=new ResizeObserver(o);l.observe(document.body);const u=setInterval(o,1500);return()=>{l.disconnect(),clearInterval(u)}},[t,s,a&&a.__preview]),{clientKey:s,applySegmentStyle:o=>{if(!t)return;const l=$s(a==null?void 0:a.segment);!l||typeof o!="function"||o(u=>u.style===l?u:{...u,style:l})}}}function kf(t){let a=2166136261;for(let s=0;s<t.length;s++)a^=t.charCodeAt(s),a=a+((a<<1)+(a<<4)+(a<<7)+(a<<8)+(a<<24))>>>0;return a>>>0}function xf(t,a){const s=t&&t.arms||["control"],i=s[0];if(!t||!t.enabled)return{arm:i,assigned:!1};
72const o=typeof a=="string"?a.trim():"";return o?{arm:s[kf(t.id+":"+o)%s.length],assigned:!0}:{arm:i,assigned:!1}}const vf={id:"checkout-popup-v1",enabled:!0,arms:["popup-qty","recap","direct","popup-qty"]},Wn={"popup-qty":{popup:!0,email:!0,tiers:!0},recap:{popup:!0,email:!1,tiers:!1},direct:{popup:!1,email:!1,tiers:!1},popup:{popup:!0,email:!0,tiers:!1},tiers:{popup:!0,email:!1,tiers:!0}};function Sf(t){return Object.prototype.hasOwnProperty.call(Wn,t)?Wn[t]:Wn.popup}function Pa(t){return{draggable:!1,"data-nosave":"",onContextMenu:a=>{a.preventDefault(),typeof t=="function"&&t(a)},onDragStart:a=>{a.preventDefault()}}}const jf="/wm/field.png",_f="/wm/pill.png",Fs=.20586,Ds=.044,zs=.035,Hs=.945,Ws=.45455;function Gb(t,a){const s=t*Ds,i=s*Ws;return{x:Math.round(t*zs-i),y:Math.round(a*Hs-s/2-i),w:Math.round(t*Fs+i*2),h:Math.round(s+i*2)}}let cn=null;function Tf(t){try{return typeof location>"u"||/^(data|blob):/i.test(t)?!1:new URL(t,location.href).origin!==location.origin}catch{return!1}}function vn(t){return new Promise((a,s)=>{const i=new Image;Tf(t)&&(i.crossOrigin="anonymous"),i.onload=()=>a(i),i.onerror=()=>s(new Error(`watermark asset failed: ${t}`)),i.src=t})}function Us(){return cn||(cn=Promise.all([vn(da(jf)),vn(da(_f))]).then(([t,a])=>({field:t,pill:a})).catch(t=>{throw cn=null,t})),cn}function If(t){t&&t.fieldSrc?Gs(t.fieldSrc).catch(()=>{}):Us().catch(()=>{})}const dn=new Map;function Gs(t){if(!dn.has(t)){const a=vn(t).catch(s=>{throw dn.delete(t),s});dn.set(t,a)}return dn.get(t)}async function Lf(t,a){if(!t)return null;try{const s=a&&a.fieldSrc,[i,o]=await Promise.all([vn(t),s?Gs(s).then(I=>({field:I,pill:null})):Us()]),l=i.naturalWidth,u=i.naturalHeight;if(!l||!u)return null;const p=document.createElement("canvas");p.width=l,p.height=u;const g=p.getContext("2d");g.drawImage(i,0,0,l,u);const{field:b,pill:y}=o,T=l/b.naturalWidth,j=b.naturalHeight*T;if(g.save(),a&&a.clip&&(g.globalCompositeOperation="source-atop"),j>=u)g.drawImage(b,0,Math.round((u-j)/2),l,Math.round(j));else for(let I=0;I<u;I+=j)g.drawImage(b,0,Math.round(I),l,Math.round(j));g.restore();const P=l*Ds,S=P*Ws,R=Math.round(l*Fs+S*2),L=Math.round(P+S*2);if(!!y&&!(a&&a.pill===!1)&&R>=8&&L>=4){const I=Math.round(l*zs-S),E=Math.round(u*Hs-P/2-S);g.drawImage(y,Math.max(0,Math.min(I,l-R)),Math.max(0,Math.min(E,u-L)),R,L)}return p.toDataURL("image/png")}catch(s){return console.warn("[previewWatermark] failed:",s&&s.message),null}}function Di({value:t,onChange:a,onUsePresets:s,maxInches:i=12,minInches:o=0,ariaLabel:l="Custom size",compact:u=!1,styles:p={}}){const{whole:g,sixteenths:b}=h.useMemo(()=>Qo(t||0),[t]),y=h.useMemo(()=>Jo.filter(L=>L>=Math.floor(o)&&L<=Math.floor(i)),[o,i]),T=L=>{const k=zi(Number(L),b,o,i);a(Hi(k))},j=L=>{const k=zi(g,Number(L),o,i);a(Hi(k))},P=Qa(Zo(g,b)),S={padding:"6px 8px",borderRadius:8,border:"1px solid #cbd5e1",fontSize:"0.86rem",background:"#ffffff",color:"#0f172a",fontFamily:"inherit",minWidth:56},R={background:"transparent",border:0,color:"#7c3aed",fontSize:"0.72rem",cursor:"pointer",padding:0,textDecoration:"underline"};return e.jsxs("div",{"aria-label":l,style:{display:"inline-flex",flexDirection:"column",gap:u?0:4,...p.container||{}},children:[e.jsxs("div",{style:{display:"inline-flex",gap:4,alignItems:"center"},children:[e.jsx("select",{value:g,onChange:L=>T(L.target.value),"aria-label":l+" whole inches",style:{...S,...p.select||{}},children:y.map(L=>e.jsxs("option",{value:L,children:[L,'"']},L))}),e.jsx("span",{"aria-hidden":!0,style:{fontSize:"0.78rem",color:"#94a3b8"},children:"+"}),e.jsx("select",{value:b,onChange:L=>j(L.target.value),"aria-label":l+" fraction",style:{...S,...p.select||{}},children:Xo.map(L=>e.jsx("option",{value:L.sixteenths,children:L.label},L.sixteenths))})]}),!u&&e.jsxs("div",{style:{display:"inline-flex",gap:8,alignItems:"baseline",fontSize:"0.74rem",color:"#64748b"},children:[e.jsx("strong",{style:{color:"#0f172a",fontWeight:700,...p.summary||{}},children:P}),s&&e.jsx("button",{type:"button",onClick:s,style:{...R,...p.link||{}},children:"Use presets"})]})]})}function zi(t,a,s,i){const o=Number(t||0)+Number(a||0)/16;return o<s?s:o>i?i:o}function Hi(t){return String(parseFloat(Number(t).toFixed(4)))}const va={tshirt:{w:6,h:6},polo:{w:6,h:6},hat:{w:6,h:6},bag:{w:6,h:6},"big-bag":{w:10,h:12},jacket:{w:10,h:12},longsleeve:{w:10,h:12},backshirt:{w:10,h:12}},qs=[{id:"hat",garment:"hat"},{id:"shirt-front",garment:"tshirt"},{id:"polo",garment:"polo",maxIn:{w:4,h:4}},{id:"small-bag",garment:"bag"},{id:"jacket",garment:"jacket"},{id:"large-bag",garment:"big-bag"},{id:"shirt-back",garment:"backshirt"}],Cf=Object.fromEntries(qs.map(t=>[t.id,t]));function gi(t,a,s){const i=Cf[t];if(!i)return null;const o=parseFloat(a),l=parseFloat(s);if(!(o>0)||!(l>0))return null;const u=i.maxIn||va[i.garment],p=.001;return{fits:o<=u.w+p&&l<=u.h+p,maxW:u.w,maxH:u.h,garment:i.garment}}const Wi=Object.freeze(["CustomPatches","PatchDesign","AIPatchDesigner","EmbroideredPatches","PatchMaker"]),Af=new Set(["PatchDesign","AIPatchDesigner"]);function Zn({brandFree:t=!1}={}){return t?Wi.filter(a=>!Af.has(a)):Wi}function Nf(t){return{...t,lead:t.xLead,leadWithPrompt:t.xLeadWithPrompt}}function Rf(t,a,{brandFree:s=!1}={}){const i=(t||"").trim(),o=i?a.leadWithPrompt(i.length>120?i.slice(0,119)+"â¦":i):a.lead,l=Zn({brandFree:s}).map(u=>`#${u}`).join(" ");return{lead:o,full:`${o} ${l}`}}
72const Ef=Object.freeze(["design","p","m","w","h","sh","st","edit"]),fi="pd_";function Pf(t){try{const a=new URL(String(t||""));return a.protocol==="https:"||a.protocol==="http:"?a:null}catch{return null}}function gn(t){const a=Pf(t);if(!a)return"";for(const s of[...a.searchParams.keys()])s.startsWith(fi)&&a.searchParams.delete(s);return a.toString()}function qb({sdk:t=!1,href:a="",pageParam:s="",referrer:i="",originParam:o=""}={}){if(t)return gn(a);const l=gn(s);if(l)return l;const u=gn(i);if(u)return u;const p=String(o||"").trim().toLowerCase();return/^[a-z0-9.-]+\.[a-z]{2,}$/.test(p)?`https://${p}/`:""}function Vs(t,a,{edit:s=!1}={}){const i=gn(t);if(!i)return"";const o=a&&typeof a.url=="string"&&/^https:\/\//i.test(a.url)?a.url:"";if(!o)return i;const l=new URL(i),u=(p,g)=>{g!=null&&String(g)!==""&&l.searchParams.set(fi+p,String(g))};return u("design",o),u("p",a.prompt?String(a.prompt).slice(0,500):""),u("m",a.material),u("w",a.width),u("h",a.height),u("sh",a.shape),u("st",a.style),s&&u("edit","1"),l.toString()}function Vb(t){let a;try{a=new URLSearchParams(String(t||""))}catch{return""}const s=new URLSearchParams;for(const o of Ef){const l=a.get(fi+o);l!=null&&l!==""&&s.set(o,l)}const i=s.toString();return i&&s.get("design")?`?${i}`:""}function Bf({embedMode:t,embedConfig:a,defaultTitle:s,defaultImage:i,defaultAlt:o}){if(!t)return{title:s||"",image:i||"",alt:o||""};const l=a||{};return{title:l.hideGreetingTitle?"":String(l.chatTitle||"").trim(),image:l.hideGreetingImage?"":i||"",alt:o||""}}const Of=["title","intro","submit","successTitle"];function $f(t,a){const s=t&&t.textI18n&&t.textI18n[a];if(!s||typeof s!="object"||!Object.keys(s).length)return t;const i=l=>typeof l=="string"&&s[l.trim()]||l,o={...t};if(o.chatTitle&&(o.chatTitle=i(o.chatTitle)),o.chatSubtitle&&(o.chatSubtitle=i(o.chatSubtitle)),Array.isArray(o.quickPrompts)&&(o.quickPrompts=o.quickPrompts.map(i)),Array.isArray(o.benefitPills)&&(o.benefitPills=o.benefitPills.map(i)),o.quoteScreen&&typeof o.quoteScreen=="object"){const l={...o.quoteScreen};for(const u of Of)l[u]&&(l[u]=i(l[u]));o.quoteScreen=l}return Array.isArray(o.customFields)&&(o.customFields=o.customFields.map(l=>l&&typeof l=="object"?{...l,label:i(l.label),placeholder:l.placeholder?i(l.placeholder):l.placeholder}:l)),o}const Ui="/parker-front-256.webp";function Mf({embedMode:t=!1,embedConfig:a=null,brandPreset:s=null}={}){if(t){const i=a||{},o=String(i.logoText||i.name||"");return i.logoUrl?{src:i.logoUrl,alt:o,custom:!0}:{src:Ui,alt:o,custom:!1}}return s&&s.logoSrc?{src:s.logoSrc,alt:s.logoAlt||"Parker",custom:!0}:{src:Ui,alt:"Parker",custom:!1}}const Ff=25.4/8,Kb=1,Xn={embroidered:{relief:"stitch",reliefDepth:1,gloss:.32,edge:"merrow"},woven:{relief:"weave",reliefDepth:.28,gloss:.22,edge:"merrow"},chenille:{relief:"chenille",reliefDepth:1.7,gloss:.06,edge:"merrow"},printed:{relief:"print",reliefDepth:.12,gloss:.14,edge:"merrow"},"pvc-2d":{relief:"molded-2d",reliefDepth:.85,gloss:.55,edge:"molded"},"pvc-3d":{relief:"molded-3d",reliefDepth:1.7,gloss:.55,edge:"molded"}},Df={"sew-on":{layerMm:0,layerRgb:null},rubber:{layerMm:0,layerRgb:null},"iron-on":{layerMm:.2,layerRgb:[214,205,170]},adhesive:{layerMm:.25,layerRgb:[236,233,224]},hook:{layerMm:1.2,layerRgb:[34,34,38]},"hook-loop":{layerMm:1.2,layerRgb:[34,34,38]},"button-loop":{layerMm:0,layerRgb:null},magnet:{layerMm:1,layerRgb:[58,60,66]},pin:{layerMm:0,layerRgb:null}},Ks=["pvc-2d","pvc-3d"];function zf(t,a){const s=String(t||"").toLowerCase();if(Xn[s])return s;const i=a&&a[t]&&a[t].baseKey;return i&&Xn[i]?i:"embroidered"}function Hf(t,a){const s=Ks.includes(a),i=String(t||"").trim().toLowerCase(),o=s?"rubber":"sew-on";return!i||i==="sew-on"||i==="sew-on backing"||i==="no backing"?o:/hook\s*(&|and|\+)\s*loop|velcro/.test(i)?"hook-loop":i.includes("hook")?"hook":i.includes("iron")?"iron-on":i.includes("peel")||i.includes("adhesive")||i.includes("sticker")?"adhesive":i.includes("button loop")?"button-loop":i.includes("magnet")?"magnet":/\bpins?\b/.test(i)?"pin":o}function Wf({typeKey:t,backing:a="",addOns:s=[],patchTypes:i}={}){const o=zf(t,i),l=Xn[o],u=Hf(a,o),p=Df[u];let g=l.edge;return(s||[]).some(b=>/diecut|die-cut|heat.?cut|laser/i.test(String(b)))&&(g="heat-cut"),{materialKey:o,relief:l.relief,reliefDepth:l.reliefDepth,gloss:l.gloss,edge:g,back:u,backStitched:u==="hook"||u==="hook-loop"?!0:!Ks.includes(o),bodyMm:Ff-p.layerMm,backLayerMm:p.layerMm,backLayerRgb:p.layerRgb}}const Ys=new Set(["Style","Detail","Type","Material","Backing","Shape","Size","Width","Height","Quantity","Event / Team","Main Feature"]),Uf=new Set(["Type","Material","Detail","Backing","Shape","Size","Width","Height"]),Qs={Style:"style",Detail
72:"detail",Type:"type",Shape:"shape",Width:"width",Height:"height",Quantity:"quantity","Event / Team":"event","Main Feature":"mainFeature"},ei=["Less","Normal","More"],ti=t=>t?t.charAt(0).toUpperCase()+t.slice(1):"",Gf=t=>String(t||"").replace(/\s*\([^)]*\)\s*$/,"").trim(),Js=t=>String(t||"").replace(/\s*\([^)]*\)/g,"").split(" / ")[0].trim();function fn(t,a){const s=(a&&a.patchTypeOptions||[]).find(i=>i.value===t);return s&&Js(s.label)||t}function ai(t,a){if(!t)return"";const s=a&&a.rail&&a.rail.shapeNames;return s&&s[t]||ti(t)}function Gi(t,a,s,i){const o=Qs[t],l=o&&s&&s.rail&&s.rail.labels&&s.rail.labels[o]||t,u=a==null?"":String(a);if(t==="Shape")return{label:l,value:ai(u,s)};if(!i||i==="en"||!s)return{label:l,value:u};if(t==="Type")return{label:l,value:fn(u,s)};if(t==="Style"){const p=(s.visibleStyles||[]).find(g=>g.key===u);return{label:l,value:p?p.label:u}}if(t==="Detail"){const p=ei.indexOf(u),g=s.rail&&s.rail.detailOptions;return{label:l,value:p>=0&&g&&g[p]||u}}return{label:l,value:u}}function qi(t,a,s){const i=t||"",o=` â ${a}: `,l=`${a}: `,u=i.lastIndexOf(o),p=u>=0?u+o.length:i.startsWith(l)?l.length:-1;if(p>=0){const g=i.slice(p),b=g.indexOf(" â ");return`${i.slice(0,p)}${s}${b>=0?g.slice(b):""}`}return i.trim()?`${i}${o}${s}`:`${l}${s}`}function qf(t){const a=new Map;for(const i of Ys)a.set(i,i);const s={Type:new Map,Shape:new Map,Style:new Map,Detail:new Map};for(const i of Object.values(t||{})){if(!i)continue;const o=i.rail&&i.rail.labels||{};for(const[g,b]of Object.entries(Qs))o[b]&&a.set(o[b],g);for(const g of i.patchTypeOptions||[])s.Type.set(g.label,g.value),s.Type.set(Gf(g.label),g.value),s.Type.set(Js(g.label),g.value),s.Type.set(g.value,g.value);const l=i.rail&&i.rail.shapeNames||{};for(const[g,b]of Object.entries(l))s.Shape.set(b,ti(g));const u=i.shapeQuestion&&i.shapeQuestion.options||{};for(const g of["circle","rectangle","shield","star","heart"])u[g]&&s.Shape.set(u[g],ti(g));for(const g of i.visibleStyles||[])s.Style.set(g.label,g.key),s.Style.set(g.key,g.key);(i.rail&&i.rail.detailOptions||[]).forEach((g,b)=>{ei[b]&&s.Detail.set(g,ei[b])})}return{labels:a,values:s}}function Vi(t,a){if(!t)return null;const s=String(t).split(/\sâ\s/).map(o=>o.trim()).filter(Boolean);if(s.length===0)return null;const i=[];for(const o of s){const l=o.match(new RegExp("^(\\p{L}[\\p{L}\\s/]*\\p{L}):\\s*(.+)$","u"));if(!l)return null;const u=a&&a.labels?a.labels.get(l[1].trim()):Ys.has(l[1].trim())?l[1].trim():null;if(!u)return null;const p=l[2].trim(),g=a&&a.values&&a.values[u];i.push({label:u,value:g&&g.get(p)||p})}return i}function Ki(t){return!t||t.length===0?!1:t.every(a=>Uf.has(a.label))}const Yi="Convert this reference image into an embroidered patch design",Un="Edit: ";function Qi(t,a){const s=String(t??""),i=a&&a.chatBubble||{};if(s===Yi)return i.refImagePrompt||s;if(s.startsWith(Un)){const o=s.slice(Un.length),l=o===Yi&&i.refImagePrompt||o;return`${i.editPrefix||Un}${l}`}return s}const Zs=[{id:"tshirt",label:"T-shirt",src:"/Try On - Shirt v2.webp",redbox:{cx:.5641,cy:.3049,w:.1227,h:.2332},redboxRealIn:va.tshirt,showWhen:"small"},{id:"polo",label:"Polo",src:"/try-on-polo.webp",redbox:{cx:.5647,cy:.3004,w:.1249,h:.2376},redboxRealIn:va.polo,showWhen:"small",maxWidthIn:4},{id:"hat",label:"Cap",src:"/Hat facing front v2.webp",redbox:{cx:.5055,cy:.2839,w:.1945,h:.3407},redboxRealIn:va.hat,showWhen:"small"},{id:"bag",label:"Bag",src:"/Try On - Bag v2.webp",redbox:{cx:.5382,cy:.3865,w:.1236,h:.2332},redboxRealIn:va.bag,showWhen:"small"},{id:"big-bag",label:"Large Bag",src:"/try-on-big-bag v2.webp",redbox:{cx:.5232,cy:.6078,w:.1955,h:.5919},redboxRealIn:va["big-bag"],showWhen:"large"},{id:"jacket",label:"Jacket",src:"/try-on-jacket v2.webp",redbox:{cx:.5077,cy:.4743,w:.1955,h:.5912},redboxRealIn:va.jacket,showWhen:"large"},{id:"longsleeve",label:"Long Sleeve",src:"/try-on-longsleeve.webp",redbox:{cx:.5015,cy:.4496,w:.2073,h:.4565},redboxRealIn:va.longsleeve,showWhen:"large"},{id:"backshirt",label:"Back",src:"/try-on-back-shirt v2.webp",redbox:{cx:.5077,cy:.4746,w:.1955,h:.5922},redboxRealIn:va.backshirt,showWhen:"large"}],Ji=1.835,Zi=1.077;function An(t,a,s,i){const o=t&&t.redbox,l=t&&t.redboxRealIn;if(!o||!l||!a||!s)return{leftPct:50,topPct:50,widthPct:8,heightPct:8};const u=Math.min(1,i/Ji),p=Math.min(1,Ji/i),g=(1-u)/2;return{leftPct:((1-p)/2+o.cx*p)*100,topPct:(g+o.cy*u)*100,widthPct:a/l.w*o.w*p*100*Zi,heightPct:s/l.h*o.h*u*100*Zi}}function Xs(t,a,s){const i=Math.max(a,s)>6;return t.filter(o=>(o.showWhen==="large"&&i||o.showWhen==="small"&&!i)&&!(o.maxWidthIn&&a>o.maxWidthIn))}function Sn(t){const a=t&&t.design||{};return{widthIn:t&&t.widthIn||parseFloat(a.width)||3,heightIn:t&&t.heightIn||parseFloat(a.height)||3}}const Vf=6;function Kf(t,a){return!t||!a||a.hideQuickPrompts?[]:(Array.isArray(a.quickPrompts)?a.quickPrompts:[]).map(i=>typeof i=="string"?i.trim():i&&typeof i=="object"?String(i.prompt||i.text||i.label||"").trim():"").filter(
72Boolean).slice(0,Vf)}const Yf="/favicon.png?v=5",Qf="/favicon-dark.png?v=5";function eo(t,a){if(typeof document>"u")return;document.querySelectorAll('link[rel~="icon"]').forEach(i=>i.remove());const s=(i,o)=>{const l=document.createElement("link");l.rel="icon",o&&(l.media=o),l.href=i||"data:,",document.head.appendChild(l)};a&&a!==t&&s(a,"(prefers-color-scheme: dark)"),s(t)}function Jf(){eo(Yf,Qf)}const Xi=t=>typeof t=="string"&&/^https:\/\//i.test(t)?t:"";function es(t){if(typeof document>"u")return"";const a=document.title;return document.title=t,a}const Zf="_linkedBrand_1d0s4_7",Xf="_linkedBrandHead_1d0s4_16",ey="_linkedBrandLogo_1d0s4_22",ty="_linkedBrandText_1d0s4_38",ay="_linkedBrandKit_1d0s4_41",ry="_linkedBrandKitItem_1d0s4_52",ny="_linkedBrandSwatches_1d0s4_54",iy="_linkedBrandSetBy_1d0s4_62",ca={linkedBrand:Zf,linkedBrandHead:Xf,linkedBrandLogo:ey,linkedBrandText:ty,linkedBrandKit:ay,linkedBrandKitItem:ry,linkedBrandSwatches:ny,linkedBrandSetBy:iy};function sy({t,brand:a,tenantName:s}){const i=t&&t.rail&&t.rail.lockedBrand||{},o=a.name||"",l=y=>String(y).replace(/\{brand\}/g,o).replace(/\{tenant\}/g,s||i.fallbackTenant||"the sender"),u=(a.colors||[]).slice(0,6),p=(a.fonts||[]).slice(0,2),[g,b]=h.useState(!!a.logoUrl);return e.jsxs("div",{className:ca.linkedBrand,children:[e.jsxs("div",{className:ca.linkedBrandHead,children:[g?e.jsx("img",{src:a.logoUrl,alt:"",className:ca.linkedBrandLogo,onError:()=>b(!1)}):e.jsx("span",{className:ca.linkedBrandLogo,style:{background:u[0]||"#0f6b78"},"aria-hidden":!0,children:o.slice(0,1).toUpperCase()}),e.jsxs("div",{className:ca.linkedBrandText,children:[e.jsx("h2",{children:l(a.staff?i.staffTitle||"Designing for {brand}":i.title||"Patches for {brand}")}),e.jsx("p",{children:l(a.staff?i.staffSub||"Every design follows {brand}'s brand guidelines.":i.sub||"Every design follows {brand}'s brand guidelines. {tenant} makes and ships it.")})]})]}),e.jsxs("div",{className:ca.linkedBrandKit,children:[u.length>0&&e.jsxs("span",{className:ca.linkedBrandKitItem,children:[e.jsx("b",{children:i.kitColors||"Colors"}),e.jsx("span",{className:ca.linkedBrandSwatches,"aria-hidden":!0,children:u.map(y=>e.jsx("i",{style:{background:y}},y))})]}),a.logoUrl&&e.jsxs("span",{className:ca.linkedBrandKitItem,children:[e.jsx("b",{children:i.kitLogo||"Logo"}),i.kitLogoOnFile||"on file"]}),p.length>0&&e.jsxs("span",{className:ca.linkedBrandKitItem,children:[e.jsx("b",{children:i.kitLettering||"Lettering"}),p.join(", ")]}),s&&e.jsxs("span",{className:ca.linkedBrandSetBy,children:[e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4","aria-hidden":!0,children:[e.jsx("rect",{x:"4",y:"11",width:"16",height:"10",rx:"2"}),e.jsx("path",{d:"M8 11V7a4 4 0 0 1 8 0v4"})]}),l(i.setBy||"Set by {tenant}")]})]})]})}function oy(t,a,s=new Date){const i=t&&t.rail&&t.rail.lockedBrand&&t.rail.lockedBrand.starters||{},o=s.getMonth();return[o===8||o===9?i.halloween||["Halloween crew patch","A Halloween crew patch for {brand}"]:o===10||o===11?i.holiday||["Holiday crew patch","A holiday season crew patch for {brand}"]:o>=4&&o<=7?i.summer||["Summer team patch","A summer team patch for {brand}"]:i.newYear||["New year team patch","A new year team patch for {brand}"],i.opening||["Grand opening","A grand opening patch for a new {brand} location"],i.service||["Years-of-service patch","A 5 years of service patch for {brand} team members"],i.award||["Team award","A team award patch for a top {brand} crew"]].map(([p,g])=>({label:p,prompt:String(g).replace(/\{brand\}/g,a)}))}function ly(t,a){const s=String(t||"").trim();return s?[s,String(a||"").trim()].filter(Boolean).join(" | "):""}const cy=h.lazy(()=>Oo(()=>import("./Patch360Viewer-B9sbEqeL.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))),ts="#64748b";function dy(t){return String(t||"").replace(/[.,]00(?=\D*$)/,"")}const as=qf(et),hy="Convert this reference image into an embroidered patch design",uy=[{key:"YMCA",label:"YMCA"},{key:"Scouts",label:"Scouts"},{key:"Karate",label:"Martial Arts"},{key:"LawEnforcement",label:"Law & Fire"},{key:"Military",label:"Military"},{key:"Sports",label:"Sports"},{key:"Motorcycle",label:"Bike Clubs"},{key:"Other",label:"Custom / Branding"}],py=[{value:"Embroidered",label:"Embroidered"},{value:"Woven",label:"Woven"},{value:"Chenille",label:"Chenille"},{value:"Printed",label:"Printed / Sublimated"},{value:"PVC 2D",label:"PVC 2D"},{value:"PVC 3D",label:"PVC 3D (Raised)"}],ri={Embroidered:"embroidered",Woven:"woven",Chenille:"chenille",Printed:"printed","PVC 2D":"pvc-2d","PVC 3D":"pvc-3d"},my=new Set(["circle","ellipse","square","rectangle"]),to=["hexagon","octagon","shield","rocker","diamond","triangle","banner","badge","crest"],gy=new Set(to),hn="custom shape";function Gn(t){return t==="circle"||t==="ellipse"?"round":t==="square"||t==="rectangle"?"rectangle":t?"other":null}function rs(t,a,s,i){const o=parseFloat(a),l=parseFloat(s),u=isFinite(o)&&isFinite(l)&&Math.abs(o-l)<.001;return t==="round"?u?"circle":"ellipse":t==="rectangle"?u?"square":"rectangle":t==="other"?i&&!my.has(i)?i:"hexagon":null}const fy=[25,50,75,100,150,200,300,500,1e3],yy="(?:no|nope|ok|okay|actually|also|and|then|yes|yeah|please|pls|por favor|can you|could you|would you|i want(?: you)?(?: to)?|i'd like|i would like|i need|need|let's|lets
72)",by="(?:make|change|remove|delete|erase|add|put|move|replace|swap|switch|take|turn|use|fix|redo|adjust|resize|rotate|flip|crop|center|centre|shrink|enlarge|show|give|keep|lose|drop|include|write|spell|capitalize|capitalise|bold|recolor|recolour|color|colour|bigger|smaller|more|less|fewer|cambia|cambiar|haz|hacer|quita|quitar|agrega|agregar|añade|anade|pon|poner|mueve|mover|reemplaza|reemplazar|usa|usar|ändere|andere|aendere|ändern|aendern|mach|mache|machen|entferne|entfernen|lösche|loesche|löschen|loeschen|füge|fuege|hinzufügen|hinzufuegen|setze|setzen|verschiebe|verschieben|ersetze|ersetzen|tausche|tauschen|nimm|nehmen|nutze|nutzen|verwende|verwenden|korrigiere|korrigieren|drehe|drehen|vergröÃere|vergroessere|vergröÃern|vergroessern|verkleinere|verkleinern|zentriere|zentrieren|schreibe|schreiben|behalte|behalten)",wy=new RegExp(`^\\s*(?:${yy}\\b[\\s,.!:;-]*)*${by}\\b`,"i");function ky(t){const a=String(t||"").trim();return a?wy.test(a):!1}function xy({styleKey:t,size:a=14}){const s=a,i={width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};switch(t){case"YMCA":return e.jsx("svg",{...i,children:e.jsx("path",{d:"M12 3 L6 12 H10 V21 H14 V12 H18 Z"})});case"Scouts":return e.jsxs("svg",{...i,children:[e.jsx("path",{d:"M3 19 L9 9 L13 15 L16 11 L21 19 Z"}),e.jsx("circle",{cx:"17",cy:"6",r:"1.5"})]});case"Karate":return e.jsx("svg",{...i,children:e.jsx("path",{d:"M13 3 L5 14 H11 L10 21 L19 9 H13 Z"})});case"LawEnforcement":return e.jsxs("svg",{...i,children:[e.jsx("path",{d:"M12 3 L20 6 V12 C20 17 16 20 12 21 C8 20 4 17 4 12 V6 Z"}),e.jsx("path",{d:"M9 12 L11 14 L15 10"})]});case"Military":return e.jsx("svg",{...i,children:e.jsx("path",{d:"M12 3 L14 10 L21 10 L15.5 14 L17.5 21 L12 16.8 L6.5 21 L8.5 14 L3 10 L10 10 Z"})});case"Sports":return e.jsxs("svg",{...i,children:[e.jsx("circle",{cx:"12",cy:"12",r:"8"}),e.jsx("path",{d:"M4 12 H20 M12 4 V20 M6 6 L18 18 M18 6 L6 18"})]});case"Motorcycle":return e.jsxs("svg",{...i,children:[e.jsx("path",{d:"M5 8 L11 14 L5 20"}),e.jsx("path",{d:"M13 8 L19 14 L13 20"})]});case"Other":default:return e.jsxs("svg",{...i,children:[e.jsx("circle",{cx:"6",cy:"12",r:"1.6",fill:"currentColor",stroke:"none"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.6",fill:"currentColor",stroke:"none"}),e.jsx("circle",{cx:"18",cy:"12",r:"1.6",fill:"currentColor",stroke:"none"})]})}}function ns({value:t,onChange:a,options:s,iconFor:i=null,ariaLabel:o}){const[l,u]=h.useState(!1),[p,g]=h.useState(!1),b=h.useRef(null),y=()=>{const S=b.current&&b.current.getBoundingClientRect();S&&g(S.left+300>window.innerWidth-8&&S.right-300>=8),u(R=>!R)};h.useEffect(()=>{if(!l)return;function S(L){b.current&&!b.current.contains(L.target)&&u(!1)}function R(L){L.key==="Escape"&&u(!1)}return document.addEventListener("mousedown",S),document.addEventListener("keydown",R),()=>{document.removeEventListener("mousedown",S),document.removeEventListener("keydown",R)}},[l]);const T=s.find(S=>S.key===t)||s[0],j=S=>i?i(S):e.jsx(xy,{styleKey:S}),P=S=>S.hint?e.jsxs("span",{className:r.styleSelectHint,children:["(",S.hint,")"]}):null;return e.jsxs("div",{className:r.styleSelect,ref:b,children:[e.jsxs("button",{type:"button",className:r.styleSelectBtn,onClick:y,"aria-haspopup":"listbox","aria-expanded":l,"aria-label":o,children:[e.jsx("span",{className:r.styleSelectIcon,children:j(T.key)}),e.jsxs("span",{className:r.styleSelectLabel,children:[T.label,P(T)]}),e.jsx("span",{className:r.styleSelectChev,"aria-hidden":!0,children:e.jsx(Mo,{})})]}),l&&e.jsx("div",{className:`${r.styleSelectMenu} ${p?r.styleSelectMenuEnd:""}`,role:"listbox",children:s.map(S=>e.jsxs("button",{type:"button",role:"option","aria-selected":S.key===t,className:`${r.styleSelectItem} ${S.key===t?r.styleSelectItemActive:""}`,onClick:()=>{a(S.key),u(!1)},children:[e.jsx("span",{className:r.styleSelectIcon,children:j(S.key)}),e.jsxs("span",{children:[S.label,P(S)]})]},S.key))})]})}function vy(t,{paused:a=!1,prefix:s=""}={}){const[i,o]=h.useState(""),l=h.useRef(0),u=h.useRef(0),p=h.useRef("typing");return h.useEffect(()=>{if(a){o(""),u.current=0,p.current="typing";return}if(!t||t.length===0)return;let g;const b=()=>{const y=t[l.current%t.length];if(p.current==="typing"){if(u.current+=1,o(s+y.slice(0,u.current)),u.current>=y.length){p.current="pausing",g=setTimeout(b,1700);return}g=setTimeout(b,55+Math.random()*40)}else p.current==="pausing"?(p.current="deleting",g=setTimeout(b,30)):(u.current-=1,o(s+y.slice(0,Math.max(0,u.current))),u.current<=0&&(p.current="typing",l.current+=1),g=setTimeout(b,22))};return g=setTimeout(b,400),()=>clearTimeout(g)},[t,a,s]),a?i:i||(t!=null&&t[0]?s+t[0].charAt(0):s)}const Sy={1:"gemini-3-pro-image",2:"gemini-3.1-flash-image",3:"gemini-2.5-flash-image"},jy=[{id:"police-agency",match:/\b(police|sheriff|pd|p\.d\.)\b/i,ask:"Is this for a specific department?",options:[{label:"Yes â I'll type the name/city",append:"",needsText:"Enter department/city name",textTemplate:'for the {text} â include "{text}" in the top arc',configPatch:{style:"LawEnforcement"}},{label:"Generic law enforcement look",append:"generic law-enforcement design, no specific agency name",configPatch:{style:"LawEnforcement"}}]}],is={id:"shape",options:[{id:"circle",configPatch:{shape:"circle"},append:"circle / round shape"},{id:"rectangle",configPatch:{shape:"rectangle"},append:"rectangle shape"},{id:"shield",configPatch:{shape:"shield"},append:"shield shape"},{id:"other",needsText:!0,textTemplate:"{text} shape"}]},_y=[{style:"Sports",re:/\b(soccer|football|baseball|basketball|hockey|rugby|lacrosse|volleyball|tennis|softball|golf|gymnastics|sports?|team)\b/i},{style:"Karate",re:/\b(karate|judo|taekwondo|jiu[-\s]?jitsu|kung[-\s]?fu|martial\s?arts?|dojo|bjj|mma)\b/i},{style:"LawEnforcement",re:/\b(police|sheriff|officer|deputy|fire(fighter)?|firefighter|firehouse|ems|paramedic|rescue|law[-\s]?enforcement|pd|fd)\b/i},{style:"Military",re:/\b(military|army|navy|marines?|usmc|air[-\s]?force|usaf|coast[-\s]?guard|infantry|squadron|battalion|veteran)\b/i}
72,{style:"Motorcycle",re:/\b(motorcycle|biker|harley|mc|rocker(\s?patch)?|riders?)\b/i},{style:"YMCA",re:/\b(ymca|the\s+y)\b/i},{style:"Scouts",re:/\b(scouts?|boy\s?scout|girl\s?scout|cub\s?scout|eagle\s?scout|troop|pack|camp(er|fire|site|ground)?)\b/i}],Ty=/(?:with|featuring|of|showing|shows|has)\s+([a-zA-Z][a-zA-Z0-9 ,'&/-]{2,80}?)(?:\s+(?:and|plus|â|-|â¢)\s+|,|\.|$)/i,jn="(\\d+(?:\\.\\d+)?(?:\\s+\\d+\\s*\\/\\s*\\d+)?|\\d+\\s*\\/\\s*\\d+)",_n='(?:\\s*(?:inches?|in\\b|"))?',Iy=new RegExp(jn+_n+"\\s*(?:wide|width)","i"),Ly=new RegExp(jn+_n+"\\s*(?:tall|high|height)","i"),Cy=new RegExp(jn+_n+"\\s*(?:by|x|Ã)\\s*"+jn+_n,"i");function Ay(t){const a={};for(const{style:o,re:l}of _y)if(l.test(t)){a.style=o;break}const s=t.match(Ty);if(s&&s[1]){const o=s[1].trim().replace(/\s+/g," ");o.length>=3&&o.length<=80&&(a.mainFeature=o)}const i=t.match(Cy);if(i){const o=zr(i[1]),l=zr(i[2]);o!=null&&(a.width=String(o)),l!=null&&(a.height=String(l))}else{const o=t.match(Iy);if(o){const u=zr(o[1]);u!=null&&(a.width=String(u))}const l=t.match(Ly);if(l){const u=zr(l[1]);u!=null&&(a.height=String(u))}}return a}function hr(t){if(!t)return"embroidered";const a=_s(t);if(a)return a;const s=t.toLowerCase();return s.includes("pvc")&&s.includes("3d")?"pvc-3d":s.includes("pvc")?"pvc-2d":s.includes("woven")?"woven":s.includes("chenille")?"chenille":s.includes("print")||s.includes("sublim")||s.includes("photo")?"printed":"embroidered"}const jr=t=>!!t&&(t.type==="ref-image"||t.type==="brand-ref");function ss({msg:t,t:a}){const s=Array.isArray(t.colors)?t.colors:[];return e.jsxs("div",{className:r.refImgPreview,children:[e.jsx("span",{className:r.refImgLabel,children:a.greeting.brandRef}),e.jsxs("div",{className:r.brandRefCard,children:[t.logoUrl&&e.jsx("img",{src:t.logoUrl,alt:"",className:r.brandRefLogo,onError:i=>{i.currentTarget.style.display="none"}}),e.jsxs("div",{className:r.brandRefText,children:[e.jsx("span",{className:r.brandRefName,children:t.content||t.host}),t.guidelines?e.jsx("span",{className:r.brandRefHost,children:a.greeting.brandGuidelines||"Brand guidelines applied"}):t.host&&t.host!==t.content&&e.jsx("span",{className:r.brandRefHost,children:t.host}),s.length>0&&e.jsx("span",{className:r.brandRefSwatches,"aria-hidden":!0,children:s.map(i=>e.jsx("span",{className:r.brandRefSwatch,style:{background:i}},i))})]})]})]})}let Ny=0;const os=()=>`d_${Date.now()}_${++Ny}`,qn=t=>Array.isArray(t)?t.map(a=>{const{previewUrl:s,...i}=a,o=typeof a.hostedUrl=="string"&&a.hostedUrl?a.hostedUrl:"";return typeof i.rawUrl=="string"&&i.rawUrl.startsWith("data:")&&(o?i.rawUrl=o:delete i.rawUrl),typeof i.url=="string"&&i.url.startsWith("data:")&&(o?i.url=o:delete i.url),typeof i.content=="string"&&i.content.startsWith("data:")&&(i.content=o||""),i}):[],ls=t=>{if(!t||typeof t!="object")return null;const a=typeof t.url=="string"&&!t.url.startsWith("data:")?t.url:"";return!t.designId&&!a?null:{designId:t.designId||"",url:a,prompt:t.prompt||"",enhancedPrompt:t.enhancedPrompt||""}},Ry=(t,a)=>{if(!t||!Array.isArray(a))return null;const s=t.designId?a.find(o=>o&&o.type==="design"&&o.designId===t.designId):null,i=s&&(s.url||s.hostedUrl)||t.url||"";return i?{designId:t.designId||s&&s.designId||"",url:i,prompt:t.prompt||s&&s.prompt||"",enhancedPrompt:t.enhancedPrompt||s&&s.enhancedPrompt||""}:null},cs=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3.2"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.6a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9v0a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),ao=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.5",y2:"16.5"}),e.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]}),Ey=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),e.jsx("path",{d:"M3 7l9 6 9-6"})]}),yi=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 3v13"}),e.jsx("path",{d:"M6 12l6 6 6-6"}),e.jsx("path",{d:"M4 20h16"})]}),Py=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M6 3h12a1 1 0 0 1 1 1v17l-7-4.5L5 21V4a1 1 0 0 1 1-1z"})}),By=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),e.jsx("line",{x1:"12",y1:"11",x2:"12",y2:"17"}),e.jsx("line",{x1:"9",y1:"14",x2:"15",y2:"14"})]}),ds=()=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),hs=()=>e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Oy=()=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"7 10 12 15 17 10"}),e.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),Vn=()=>e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round","aria-hidden":"true",style:{animation:"patchdesign-spin 0.8s linear infinite"},children:[e.jsx("path",{d:"M21 12a9 9 0 1 1-6.2-8.55"}),e.jsx("style",{children:"@keyframes patchdesign-spin { to { transform: rotate(360deg); } }"})]}),us=()=>e.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"#1877F2"}),e.jsx("path",{fill:"#fff",d:"M13.5 21v-7.5h2.6l.4-3h-3v-1.9c0-.9.2-1.5 1.5-1.5H17V4.6c-.3 0-1.2-.1-2.2-.1-2.2 0-3.7 1.3-3.7 3.8v2.1H8.5v3h2.6V21h2.4z"})]}),$y=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"#E60023","aria-hidden":"true",children:e.jsx("path",{d:"M12 2a10 10 0 0 0-3.6 19.3c-.1-.8-.2-2 0-2.9.2-.8 1.1-4.7 1.1-4.7s-.3-.6-.3-1.4c0-1.3.8-2.3 1.7-2.3.8 0 1.2.6 1.2 1.4 0 .8-.5 2-.8 3.2-.2 1 .5 1.7 1.4 1.7 1.7 0 3-1.8 3-4.4 0-2.3-1.7-3.9-4-3.9-2.8 0-4.4 2.1-4.4 4.2 0 .8.3 1.7.7 2.2.1.1.1.2.1.3 0 .2-.2.7-.2.9 0 .1-.1.2-.3.1-1-.5-1.7-2-1.7-3.2 0-2.6 1.9-5 5.5-5 2.9 0 5.1 2 5.1 4.8 0 2.9-1.8 5.2-4.3 5.2-.8 0-1.6-.4-1.9-.9l-.5 2c-.2.7-.7 1.6-1 2.2A10 10 0 1 0 12 2z"})}),My=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"#ffffff","aria-hidden":"true",children:e.jsx("path",{d:"M17.5 3h3.4l-7.4 8.5L22 21h-6.7l-5.3-6.6L4 21H.6l7.9-9L0 3h6.9l4.8 6 6-6zm-1.2 16h1.9L7.8 5h-2l10.5 14z"})}),Fy=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),Dy=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"#25D366","aria-hidden":"true",children:e.jsx("path",{d:"M19.05 4.91A10 10 0 0 0 4.5 18.69L3 22l3.4-1.48A10 10 0 1 0 19.05 4.91zM12 20.13a8.13 8.13 0 0 1-4.14-1.13l-.3-.18-2.02.88.86-2.07-.2-.31A8.13 8.13 0 1 1 12 20.13zm4.5-6.1c-.25-.13-1.46-.72-1.69-.8-.23-.08-.39-.13-.55.13-.16.25-.63.8-.78.96-.14.16-.29.18-.54.06-.25-.13-1.05-.39-2-1.23-.74-.66-1.24-1.47-1.39-1.72-.14-.25-.02-.39.11-.51.11-.11.25-.29.38-.43.13-.14.16-.25.25-.41.08-.16.04-.31-.02-.43-.06-.
7213-.55-1.32-.75-1.81-.2-.48-.41-.41-.55-.42h-.47c-.16 0-.43.06-.66.31-.23.25-.86.85-.86 2.07s.88 2.4 1 2.56c.13.16 1.74 2.65 4.21 3.71.59.26 1.05.41 1.41.52.59.19 1.13.16 1.55.1.47-.07 1.46-.6 1.66-1.18.21-.58.21-1.07.14-1.18-.06-.11-.23-.18-.48-.31z"})}),zy=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"8",y:"3",width:"12",height:"12",rx:"2",ry:"2"}),e.jsx("path",{d:"M16 8h-9a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-2"}),e.jsx("path",{d:"M9.5 14.5l1.5-1.5"}),e.jsx("path",{d:"M12.5 11.5l1.5-1.5"}),e.jsx("path",{d:"M10 14a1.6 1.6 0 0 0 2.2 0l.6-.6"}),e.jsx("path",{d:"M11.2 11.6l.6-.6a1.6 1.6 0 0 1 2.2 2.2"})]}),ps=()=>e.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("radialGradient",{id:"pdaiIgGrad",cx:"30%",cy:"107%",r:"150%",children:[e.jsx("stop",{offset:"0",stopColor:"#fdf497"}),e.jsx("stop",{offset:"0.05",stopColor:"#fdf497"}),e.jsx("stop",{offset:"0.45",stopColor:"#fd5949"}),e.jsx("stop",{offset:"0.6",stopColor:"#d6249f"}),e.jsx("stop",{offset:"0.9",stopColor:"#285aeb"})]})}),e.jsx("rect",{x:"2.6",y:"2.6",width:"18.8",height:"18.8",rx:"5.4",fill:"none",stroke:"url(#pdaiIgGrad)",strokeWidth:"2"}),e.jsx("circle",{cx:"12",cy:"12",r:"4.2",fill:"none",stroke:"url(#pdaiIgGrad)",strokeWidth:"2"}),e.jsx("circle",{cx:"17.5",cy:"6.5",r:"1",fill:"url(#pdaiIgGrad)"})]}),Kn=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"5 12 10 17 19 7"})}),Hy=()=>e.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2",fill:"#EA4335"}),e.jsx("path",{d:"M3 7l9 7 9-7",fill:"none",stroke:"#ffffff",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("line",{x1:"7",y1:"19",x2:"7",y2:"11",stroke:"#ffffff",strokeWidth:"1.6",strokeLinecap:"round"}),e.jsx("line",{x1:"17",y1:"19",x2:"17",y2:"11",stroke:"#ffffff",strokeWidth:"1.6",strokeLinecap:"round"})]}),Wy=()=>e.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"5",width:"13",height:"14",rx:"1.6",fill:"#0078D4"}),e.jsx("ellipse",{cx:"9.5",cy:"12",rx:"3",ry:"3.8",fill:"none",stroke:"#ffffff",strokeWidth:"1.7"}),e.jsx("path",{d:"M16 9l5-2v10l-5-2z",fill:"#50D9FF"})]}),Uy=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),e.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),e.jsx("rect",{x:"6",y:"14",width:"12",height:"8"})]}),ms={instagram:{label:"Instagram",title:"Ready to post on Instagram",steps:["Switch to the Instagram tab (or open the app on your phone).","Tap the + (Create) button and pick the patch image from your Downloads folder.","Paste the caption in the Caption field (Ctrl/Cmd + V).","Tap Share."],openLabel:"Open Instagram"},facebook:{label:"Facebook",title:"Ready to post on Facebook",steps:["Switch to the Facebook tab â the share dialog is already open.","If the link preview is empty, give it a moment to load, or click Photo/Video and pick the patch from your Downloads folder.",'Paste your caption (Ctrl/Cmd + V) in the "Say something" field.',"Click Post."],openLabel:"Open Facebook"}};function Gy(t,a){if(!t||!a)return"";try{const s=`${t}:${a}`;return typeof window<"u"&&window.btoa?window.btoa(unescape(encodeURIComponent(s))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):Buffer.from(s,"utf-8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch{return""}}function un({userId:t,designId:a,isSaved:s}){var o;const i=typeof window<"u"&&((o=window.location)==null?void 0:o.origin)||"https://patchdesign.ai";if(s&&t&&a){const l=Gy(t,a);if(l)return`${i}/design/${encodeURIComponent(l)}`}return`${i}/ai-tool`}function Yn(){if(typeof window>"u")return{navigate:()=>!1,close:()=>{},blocked:!0};const t=600,a=500,s=Math.round((window.screen.width-t)/2),i=Math.round((window.screen.height-a)/2),o=window.open("about:blank","_blank",`width=${t},height=${a},left=${s},top=${i}`);return{navigate:l=>{if(o&&!o.closed){try{o.location.replace(l)}catch{o.location.href=l}return!0}return window.open(l,"_blank","noopener,noreferrer")?!0:(console.warn("[share-popup] both window.open attempts blocked; aborting to preserve chat tab"),!1)},close:()=>{o&&!o.closed&&o.close()},blocked:!o||o.closed}}async function qy({imageUrl:t,title:a,text:s,url:i}){if(typeof navigator>"u"||!navigator.share)return"unsupported";try{if(t&&navigator.canShare)try{const l=/^https:\/\//i.test(t)?Za(`/api/download-image?url=${encodeURIComponent(t)}&filename=patch.png${Lr()}`):t,u=await fetch(l);if(u.ok){const p=await u.blob(),g=new File([p],"patch.png",{type:p.type||"image/png"}),b={title:a,text:s,url:i,files:[g]};if(navigator.canShare(b))return await navigator.share(b),"shared"}}catch{}return await navigator.share({title:a,text:s,url:i}),"shared"}catch(o){return o&&(o.name==="AbortError"||/aborted|cancel/i.test(o.message||""))?"cancelled":"unsupported"}}let Ir=!0,Ja=null,ni="";const Nn=h.createContext(null);function Vy({t,style:a}){const s=h.useContext(Nn);if(!s||!s.kit)return null;const i=t&&t.rail&&t.rail.houseStyle||{},o=!!s.pausedFor,l=!s.off&&!o,u=Array.isArray(s.kit.colors)?s.kit.colors.slice(0,6):[];return e.jsxs("div",{className:r.designRailItem,"data-rail-field":"house",style:a,children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,cursor:o?"default":"pointer"},children:[e.jsx("span",{className:r.designRailLabel,style:{margin:0},children:i.label||"House style"}),e.jsx("input",{type:"checkbox",role:"switch","aria-label":i.label||"House style",checked:l,disabled:o,onChange:p=>s.setOff(!p.target.checked),style:{width:16,height:16,accentColor:"#10b981",cursor:"inherit"}})]}),u.length>0&&e.jsx("div",{style:{display:"flex",gap:3,marginTop:4,opacity:l?1:.4}
72,"aria-hidden":!0,children:u.map(p=>e.jsx("span",{style:{width:12,height:12,borderRadius:3,background:p,border:"1px solid rgba(0,0,0,0.2)"}},p))}),e.jsx("div",{style:{fontSize:"0.66rem",opacity:.75,marginTop:4,lineHeight:1.35},children:o?String(i.paused||"Paused while {brand} is applied.").replace("{brand}",s.pausedFor):l?i.on:i.off})]})}function Ky({t,style:a}){const s=h.useContext(Nn);if(!s||!s.lockedBrand&&!s.brandLinkDead)return null;const i=t&&t.rail&&t.rail.lockedBrand||{},o=s.lockedBrand;return e.jsxs("div",{className:r.designRailItem,"data-rail-field":"brand",style:a,children:[e.jsx("span",{className:r.designRailLabel,children:i.label||"Brand"}),o?e.jsxs("div",{style:{marginTop:6,padding:"6px 8px",borderRadius:6,background:"rgba(16,185,129,0.10)",border:"1px solid rgba(16,185,129,0.4)",display:"flex",alignItems:"center",gap:8},children:[o.logoUrl&&e.jsx("img",{src:o.logoUrl,alt:"",width:22,height:22,onError:l=>{l.currentTarget.style.display="none"},style:{borderRadius:4,background:"#fff",objectFit:"contain",padding:2,flexShrink:0,border:"1px solid rgba(0,0,0,0.12)"}}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:"0.72rem",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.name}),e.jsx("div",{style:{fontSize:"0.66rem",opacity:.75},children:o.staff?i.staff||"Designing for this customer":i.applied||"Your brand guidelines are applied"}),(o.colors||[]).length>0&&e.jsx("div",{style:{display:"flex",gap:3,marginTop:3},"aria-hidden":!0,children:o.colors.slice(0,6).map(l=>e.jsx("span",{style:{width:12,height:12,borderRadius:3,background:l,border:"1px solid rgba(0,0,0,0.2)"}},l))})]})]}):e.jsx("div",{role:"alert",style:{marginTop:6,fontSize:"0.7rem",lineHeight:1.4,color:"#b91c1c"},children:String(i.dead||"This brand link is no longer active. Ask {tenant} for a new one.").replace("{tenant}",s.tenantName||i.fallbackTenant||"the sender")})]})}function Yy(t,a){return t?(a==null?void 0:a.demoMode)===!0:!0}function Qy(t,a,s){if(!t||!s||(a==null?void 0:a.demoMode)===!0)return null;const i=a==null?void 0:a.watermarkMode,o=String((a==null?void 0:a.watermarkFieldUrl)||"");return i!=="text"&&i!=="logo"||!/^https:\/\//i.test(o)?null:{clientKey:s,version:String((a==null?void 0:a.watermarkVersion)||""),fieldUrl:o}}function Lr(){return Ja?`&wmt=${encodeURIComponent(Ja.clientKey)}`+(Ja.version?`&wmv=${encodeURIComponent(Ja.version)}`:""):Ir?"&wm=1":""}function gs(){if(Ja)return{fieldSrc:Za(`/api/download-image?url=${encodeURIComponent(Ja.fieldUrl)}&inline=1`),pill:!1}}function Jy(t){return!t||!/^https:\/\//i.test(t)||!Ir?t:Za(`/api/download-image?url=${encodeURIComponent(t)}${Lr()}&inline=1&fmt=webp`)}function Ea(t){if(!t)return"";const a=t.url||"";return/^https:\/\//i.test(a)?Jy(a):Ir&&t.previewUrl?t.previewUrl:a}async function dr(t){if(!t)return!1;try{const s=/^https:\/\//i.test(t)?Za(`/api/download-image?url=${encodeURIComponent(t)}&filename=patch-design.png${Lr()}`):t,i=document.createElement("a");return i.href=s,i.download="patch-design.png",i.rel="noopener",document.body.appendChild(i),i.click(),document.body.removeChild(i),!0}catch(a){return console.warn("[downloadDesignImage] failed:",a),!1}}function Zy({design:t,onShareResolveUrl:a,onLogShare:s,t:i,embedMode:o=!1}){var re,me,J,H,We;const l=Z=>{typeof s=="function"&&s(Z)},[u,p]=h.useState(!1),[g,b]=h.useState(null),[y,T]=h.useState(!1),[j,P]=h.useState(null),S=h.useRef(null),R=h.useRef(null),L=h.useRef(null);h.useEffect(()=>{if(!u)return;const Z=se=>{S.current&&!S.current.contains(se.target)&&p(!1)},Q=se=>{se.key==="Escape"&&p(!1)};return document.addEventListener("mousedown",Z),document.addEventListener("keydown",Q),()=>{document.removeEventListener("mousedown",Z),document.removeEventListener("keydown",Q)}},[u]),h.useEffect(()=>{if(g)return clearTimeout(R.current),R.current=setTimeout(()=>b(null),4500),()=>clearTimeout(R.current)},[g]);const[k,I]=h.useState(null);h.useEffect(()=>{if(!u)return;let Z=!1;return a(t).then(Q=>{!Z&&Q&&Q.shareUrl&&I(Q)}).catch(Q=>{console.warn("[share] pre-resolve failed; tile clicks will retry async:",Q&&Q.message)}),()=>{Z=!0}},[u]),h.useEffect(()=>{if(j)return clearTimeout(L.current),L.current=setTimeout(()=>P(null),45e3),()=>clearTimeout(L.current)},[j]),h.useEffect(()=>()=>{clearTimeout(R.current),clearTimeout(L.current)},[]);const E=i&&i.share||et.en.share,F=((re=i==null?void 0:i.share)==null?void 0:re.shareStatus)||et.en.share.shareStatus,_=!!o,Y=_?Nf(E.caption):E.caption,V=_&&!(t.prompt||"").trim()?E.caption.xLead:E.titleCore(t.prompt),{lead:M,full:N}=Rf(t.prompt,Y,{brandFree:_}),D=Zn({brandFree:_}).map(Z=>`#${Z}`).join(" "),te=encodeURIComponent(N),A=encodeURIComponent(Zn({brandFree:_}).join(",")),v=t.prompt&&t.prompt.trim()?E.caption.xLeadWithPrompt(t.prompt.trim().length>120?t.prompt.trim().slice(0,119)+"â¦":t.prompt.trim()):E.caption.xLead,ge=encodeURIComponent(v);function K(){p(Z=>!Z)}async function Ie(){if(y)return;T(!0),l("whatsapp");const Z=typeof navigator<"u"&&/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);if(Z&&k&&k.shareUrl){const se=`${M} ${k.shareUrl}`,oe=`https://wa.me/?text=${encodeURIComponent(se)}`,ne=window.open(oe,"_blank","noopener,noreferrer");dr(k.imageUrl),ne?b({tone:"success",message:F.whatsappReady}
72):window.location.href=oe,T(!1);return}let Q=null;Z||(Q=Yn());try{const{shareUrl:se,imageUrl:oe}=await a(t),ne=`${M} ${se}`;dr(oe);const ce=`https://wa.me/?text=${encodeURIComponent(ne)}`;let $=!1;Z?($=!!window.open(ce,"_blank","noopener,noreferrer"),$||(window.location.href=ce,$=!0)):$=Q.navigate(ce),b($?{tone:"success",message:F.whatsappReady}:{tone:"info",message:F.whatsappBlocked})}catch(se){console.error("[whatsapp-share] failed:",se),Q&&Q.close(),b({tone:"info",message:F.whatsappFailed})}finally{T(!1)}}async function He(){if(!y){T(!0),l("copy-link");try{const{shareUrl:Z,imageUrl:Q}=await a(t);let se=!1;if(navigator.clipboard&&navigator.clipboard.writeText)try{await navigator.clipboard.writeText(Z),se=!0}catch{}if(!se){const oe=document.createElement("textarea");oe.value=Z,oe.style.position="fixed",oe.style.opacity="0",document.body.appendChild(oe),oe.select();try{se=document.execCommand("copy")}catch{}document.body.removeChild(oe)}dr(Q),b({tone:"success",message:se?F.linkCopied:F.linkCopyManual})}catch(Z){console.error("[copy-link] failed:",Z),b({tone:"info",message:F.linkCopyFailed})}finally{T(!1)}}}const Ae=({shareUrl:Z})=>`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(Z)}`,Ke=({shareUrl:Z})=>`https://pinterest.com/pin/create/button/?url=${encodeURIComponent(Z)}&description=${te}`,ye=({shareUrl:Z})=>`https://twitter.com/intent/tweet?url=${encodeURIComponent(Z)}&text=${ge}&hashtags=${A}${_?"":"&via=PatchDesignAI"}`,tt=(Z,Q,se="")=>{if(y)return;T(!0),se&&l(se);const oe=Yn();a(t).then(ne=>{dr(ne.imageUrl);const ce=oe.navigate(Z(ne));b(ce?{tone:"success",message:Q}:{tone:"info",message:F.appBlocked})}).catch(ne=>{console.error("[social-tile] resolve failed:",ne),oe.close(),b({tone:"info",message:F.windowFailed})}).finally(()=>T(!1))};async function Fe(Z){try{if(navigator.clipboard&&navigator.clipboard.writeText)try{return await navigator.clipboard.writeText(Z),!0}catch{}const Q=document.createElement("textarea");Q.value=Z,Q.style.position="fixed",Q.style.opacity="0",document.body.appendChild(Q),Q.select();let se=!1;try{se=document.execCommand("copy")}catch{}return document.body.removeChild(Q),se}catch{return!1}}const ra=()=>typeof navigator<"u"&&/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent||""),be=async(Z,Q)=>{if(y)return;T(!0),Q&&l(Q);const se=ra()&&typeof navigator<"u"&&!!navigator.share;if(se&&k&&k.shareUrl){const ne=`${M} 73 74${k.shareUrl} 75 76${D}`;dr(k.imageUrl),navigator.share({title:V,text:ne,url:k.shareUrl}).then(()=>b({tone:"success",message:F.sharedNative})).catch(ce=>{ce&&(ce.name==="AbortError"||/aborted|cancel/i.test(ce.message||""))||Fe(ne).then($=>{P({platform:Q,targetUrl:Z(k),imageReady:!0,linkCopied:!!$,popupBlocked:!1}),p(!1)})}).finally(()=>T(!1));return}const oe=se?null:Yn();try{const ne=await a(t),ce=`${M} 77 78${ne.shareUrl} 79 80${D}`;if(se){const qe=await qy({imageUrl:ne.imageUrl,title:V,text:ce,url:ne.shareUrl});if(qe==="shared"){b({tone:"success",message:F.sharedNative});return}if(qe==="cancelled")return;dr(ne.imageUrl);const Ct=await Fe(ce);P({platform:Q,targetUrl:Z(ne),imageReady:!0,linkCopied:Ct,popupBlocked:!1}),p(!1);return}dr(ne.imageUrl);const $=await Fe(ce),ee=Z(ne),he=oe.navigate(ee);P({platform:Q,targetUrl:ee,imageReady:!0,linkCopied:$,popupBlocked:!he}),p(!1)}catch(ne){console.error("[social-tile-paste] resolve failed:",ne),oe&&oe.close(),b({tone:"info",message:F.windowFailed})}finally{T(!1)}},U=()=>typeof navigator<"u"&&/Mobi|Android|iPhone|iPad/.test(navigator.userAgent||"")?"instagram://library":"https://www.instagram.com/",De=({shareUrl:Z})=>{const Q=encodeURIComponent(E.printSubject),se=encodeURIComponent(`${M} 81 82${Z} 83 84${D}`);return`https://mail.google.com/mail/?view=cm&fs=1&su=${Q}&body=${se}`},ft=({shareUrl:Z})=>{const Q=encodeURIComponent(E.printSubject),se=encodeURIComponent(`${M} 85 86${Z} 87 88${D}`);return`https://outlook.live.com/mail/0/deeplink/compose?subject=${Q}&body=${se}`};async function pe(){if(!y){T(!0),l("print");try{const{imageUrl:Z}=await a(t);if(!Z)throw new Error("no image url");const Q=window.open("","_blank","width=820,height=920");if(!Q){b({tone:"info",message:F.popupBlocked});return}const se=(V||E.printTitle).replace(/[<>&"]/g,""),oe=String(E.printTitle).replace(/[<>&"]/g,"");Q.document.write(`<!DOCTYPE html><html><head><title>${se}</title><style>html,body{margin:0;padding:0;background:#fff;}
88body{display:flex;align-items:center;justify-content:center;min-height:100vh;}img{max-width:100%;max-height:100vh;object-fit:contain;}@page{margin:1cm;}@media print{body{min-height:auto;}}</style></head><body><img src="${Z}" alt="${oe}" onload="setTimeout(function(){window.focus();window.print();},150)" /><script>window.onafterprint=function(){window.close();};<\/script></body></html>`),Q.document.close(),b({tone:"success",message:F.printOpened})}catch(Z){console.error("[print] failed:",Z),b({tone:"info",message:F.printFailed})}finally{T(!1)}}}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:S,className:r.shareWrapper,children:[e.jsx("button",{type:"button",className:r.imageActionBtn,onClick:K,title:((me=i==null?void 0:i.share)==null?void 0:me.title)||"Share","aria-label":((J=i==null?void 0:i.share)==null?void 0:J.aria)||"Share","aria-haspopup":"menu","aria-expanded":u,disabled:y,children:e.jsx(Fy,{})}),u&&e.jsxs("div",{className:r.sharePopover,role:"menu","aria-label":((H=i==null?void 0:i.share)==null?void 0:H.menuAria)||"Share options",children:[e.jsxs("div",{className:r.shareGrid,children:[e.jsxs("button",{type:"button",className:r.shareTile,onClick:()=>be(U,"instagram"),role:"menuitem",disabled:y,children:[e.jsx("span",{className:r.shareTileIcon,children:e.jsx(ps,{})}),e.jsx("span",{className:r.shareTileLabel,children:"Instagram"})]}),e.jsxs("button",{type:"button",className:r.shareTile,onClick:()=>tt(Ke,F.pinterestImageReady,"pinterest"),role:"menuitem",disabled:y,children:[e.jsx("span",{className:r.shareTileIcon,children:e.jsx($y,{})}),e.jsx("span",{className:r.shareTileLabel,children:"Pinterest"})]}),e.jsxs("button",{type:"button",className:r.shareTile,onClick:()=>be(Ae,"facebook"),role:"menuitem",disabled:y,children:[e.jsx("span",{className:r.shareTileIcon,children:e.jsx(us,{})}),e.jsx("span",{className:r.shareTileLabel,children:"Facebook"})]}),e.jsxs("button",{type:"button",className:r.shareTile,onClick:()=>tt(ye,F.xImageReady,"x"),role:"menuitem",disabled:y,children:[e.jsx("span",{className:r.shareTileIcon,children:e.jsx(My,{})}),e.jsx("span",{className:r.shareTileLabel,children:"X"})]}),e.jsxs("button",{type:"button",className:r.shareTile,onClick:Ie,role:"menuitem",disabled:y,children:[e.jsx("span",{className:r.shareTileIcon,children:e.jsx(Dy,{})}),e.jsx("span",{className:r.shareTileLabel,children:"WhatsApp"})]}),e.jsxs("button",{type:"button",className:r.shareTile,onClick:()=>tt(De,F.gmailReady,"gmail"),role:"menuitem",disabled:y,children:[e.jsx("span",{className:r.shareTileIcon,children:e.jsx(Hy,{})}),e.jsx("span",{className:r.shareTileLabel,children:"Gmail"})]}),e.jsxs("button",{type:"button",className:r.shareTile,onClick:()=>tt(ft,F.outlookReady,"outlook"),role:"menuitem",disabled:y,children:[e.jsx("span",{className:r.shareTileIcon,children:e.jsx(Wy,{})}),e.jsx("span",{className:r.shareTileLabel,children:"Outlook"})]}),e.jsxs("button",{type:"button",className:r.shareTile,onClick:pe,role:"menuitem",disabled:y,children:[e.jsx("span",{className:r.shareTileIcon,children:e.jsx(Uy,{})}),e.jsx("span",{className:r.shareTileLabel,children:E.tiles.print})]})]}),e.jsxs("button",{type:"button",className:r.shareCopyRow,onClick:He,role:"menuitem",disabled:y,children:[e.jsx("span",{className:r.shareTileIcon,children:e.jsx(zy,{})}),e.jsx("span",{children:((We=i==null?void 0:i.share)==null?void 0:We.copyLink)||"Copy link"})]}),g&&e.jsxs("div",{className:`${r.shareStatus} ${g.tone==="success"?r.shareStatusSuccess:""}`,children:[g.tone==="success"&&e.jsx("span",{className:r.shareStatusIcon,children:e.jsx(Kn,{})}),e.jsx("span",{children:g.message})]})]})]}),j&&ms[j.platform]&&(()=>{var oe,ne,ce,$;const Z=((ne=(oe=i==null?void 0:i.share)==null?void 0:oe.pasteHelper)==null?void 0:ne[j.platform])||ms[j.platform],Q=E.pasteHelperReady,se=j.platform==="instagram"?ps:j.platform==="facebook"?us:null;return e.jsxs("div",{className:r.pasteHelper,role:"status","aria-live":"polite",children:[e.jsxs("div",{className:r.pasteHelperHeader,children:[se&&e.jsx("span",{className:r.pasteHelperIcon,children:e.jsx(se,{})}),e.jsx("span",{className:r.pasteHelperTitle,children:Z.title}),e.jsx("button",{type:"button",className:r.pasteHelperClose,onClick:()=>P(null),"aria-label":((ce=i==null?void 0:i.share)==null?void 0:ce.dismiss)||"Dismiss",title:(($=i==null?void 0:i.share)==null?void 0:$.dismiss)||"Dismiss",children:e.jsx(Ur,{})})]}),e.jsxs("div",{className:r.pasteHelperReady,children:[e.jsxs("span",{className:r.pasteHelperReadyItem,children:[e.jsx(Kn,{}),e.jsx("span",{children:Q.imageSaved})]}),e.jsxs("span",{className:r.pasteHelperReadyItem,children:[j.linkCopied?e.jsx(Kn,{}):e.jsx(Ur,{}),e.jsx("span",{children:j.linkCopied?Q.captionCopied:Q.captionFailed})]})]}),e.jsx("ol",{className:r.pasteHelperSteps,children:Z.steps.map((ee,he)=>e.jsx("li",{children:ee},he))}),e.jsxs("div",{className:r.pasteHelperActions,children:[j.popupBlocked&&j.targetUrl&&e.jsx("a",{href:j.targetUrl,target:"_blank",rel:"noopener noreferrer",className:r.pasteHelperPrimary,onClick:()=>{},children:Z.openLabel}),e.jsx("button",{type:"button",className:r.pasteHelperSecondary,onClick:()=>P(null),children:E.gotIt})]})]})})()]})}const ro=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M14.5 4.5l5 5L8 21H3v-5L14.5 4.5z"}),e.jsx("path",{d:"M13 6l5 5"})]}),Ur=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"})]}),Xy=()=>e.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),fs={en:"en-US",es:"es-ES",de:"de-DE"},pn={chrome:"https://support.google.com/chrome/answer/2693767",edge:"https://support.microsoft.com/en-us
88/windows/windows-camera-microphone-and-privacy-a83257bc-e990-d54a-d212-b5e41beba857",safari:"https://support.apple.com/guide/safari/websites-ibrwe2159f50/mac"};function eb(){if(typeof navigator>"u")return pn.chrome;const t=navigator.userAgent||"";return/Edg[A-Z]?\//.test(t)?pn.edge:/Safari/.test(t)&&!/Chrome|Chromium|CriOS|FxiOS|Edg/.test(t)?pn.safari:pn.chrome}const tb=()=>e.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"9",y:"2",width:"6",height:"11",rx:"3"}),e.jsx("path",{d:"M5 10v1a7 7 0 0 0 14 0v-1"}),e.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"22"})]}),no=({size:t=14})=>e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"9 6 15 12 9 18"})}),bi=({size:t=14})=>e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"15 6 9 12 15 18"})});async function ab(t){try{if(!t)return null;const a=await Te(`/api/download-image?url=${encodeURIComponent(t)}`);if(!a||!a.ok)return null;const s=await a.blob();return!s||!s.size||s.size>3e6?null:await new Promise(i=>{const o=new FileReader;o.onload=()=>i(typeof o.result=="string"?o.result:null),o.onerror=()=>i(null),o.readAsDataURL(s)})}catch{return null}}async function rb(t){try{if(!t||!/^https:\/\//i.test(t))return null;const a=await Te(`/api/download-image?url=${encodeURIComponent(t)}`);if(!a||!a.ok)return null;const s=await a.blob();return!s||!s.size||s.size>12e6?null:await new Promise(i=>{const o=new FileReader;o.onload=()=>i(typeof o.result=="string"&&o.result.startsWith("data:image/")?o.result:null),o.onerror=()=>i(null),o.readAsDataURL(s)})}catch{return null}}async function io(t,a){const s=(t||"").trim();if(!a||!s||s.length<2)return null;try{const i=await Te(`/api/customer-brand?key=${encodeURIComponent(a)}&name=${encodeURIComponent(s)}`);if(!i||!i.ok)return null;const o=await i.json();return o&&o.success?o:null}catch{return null}}async function nb(t){try{const a=await Te(`/api/customer-brand?link=${encodeURIComponent(t)}`),s=a&&a.ok?await a.json():null;return s&&s.success?s:{dead:!0}}catch{return{dead:!0}}}async function ys(t,a=""){try{const s=(t||"").trim();if(!s)return null;const i=/^https?:\/\//i.test(s)||!/\s/.test(s)&&/\.[a-z]{2,}$/i.test(s.replace(/\/.*$/,""));if(!i){const p=await io(s,a);if(p)return p}let o;if(i){if(s.length<4)return null;o=`url=${encodeURIComponent(s)}`}else{if(s.length<2||!/[a-z]/i.test(s))return null;o=`name=${encodeURIComponent(s)}`}const l=await Te(`/api/brand-scrape?${o}`);if(!l||!l.ok)return null;const u=await l.json();return u&&u.success?u:null}catch{return null}}function ib(t){const a=String(t||""),s=a.match(/https?:\/\/[^\s<>"')\]]+/i);if(s)return s[0].replace(/[.,;:!?)\]]+$/,"");const i="com|org|net|io|co|ai|app|store|shop|us|biz|info|gov|edu|me|tv|xyz|design|studio|agency|club|team|fit|gym|church|school|uk|ca|au|de|fr|es|it|nl",o=a.match(new RegExp(`\\b((?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+(?:${i}))\\b`,"i"));return o?o[1]:null}function so(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",children:[e.jsx("path",{fill:"#4285F4",d:"M17.64 9.2c0-.64-.06-1.25-.16-1.84H9v3.48h4.84a4.14 4.14 0 0 1-1.8 2.72v2.26h2.92c1.7-1.57 2.68-3.88 2.68-6.62z"}),e.jsx("path",{fill:"#34A853",d:"M9 18c2.43 0 4.47-.8 5.96-2.18l-2.92-2.26c-.8.54-1.84.86-3.04.86-2.34 0-4.32-1.58-5.03-3.7H.96v2.34A9 9 0 0 0 9 18z"}),e.jsx("path",{fill:"#FBBC05",d:"M3.97 10.72a5.4 5.4 0 0 1 0-3.44V4.94H.96a9 9 0 0 0 0 8.12l3.01-2.34z"}),e.jsx("path",{fill:"#EA4335",d:"M9 3.58c1.32 0 2.5.45 3.44 1.35l2.58-2.58A9 9 0 0 0 9 0 9 9 0 0 0 .96 4.94l3.01 2.34C4.68 5.16 6.66 3.58 9 3.58z"})]})}function oo(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fill:"#1877F2",d:"M24 12.07C24 5.4 18.63 0 12 0S0 5.4 0 12.07c0 6.03 4.39 11.
8803 10.13 11.93v-8.44H7.08v-3.49h3.05V9.41c0-3.02 1.79-4.69 4.53-4.69 1.31 0 2.68.24 2.68.24v2.97h-1.51c-1.49 0-1.96.93-1.96 1.89v2.25h3.33l-.53 3.49h-2.8v8.44C19.61 23.1 24 18.1 24 12.07z"})})}function lo(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 23 23","aria-hidden":"true",children:[e.jsx("path",{fill:"#F25022",d:"M0 0h11v11H0z"}),e.jsx("path",{fill:"#7FBA00",d:"M12 0h11v11H12z"}),e.jsx("path",{fill:"#00A4EF",d:"M0 12h11v11H0z"}),e.jsx("path",{fill:"#FFB900",d:"M12 12h11v11H12z"})]})}const sb=4;function bs(t,a){if(!t)return"";const s=new Date(t);if(Number.isNaN(s.getTime()))return"";try{return new Intl.DateTimeFormat(a||"en",{timeZone:"America/Los_Angeles",month:"short",day:"numeric"}).format(s)}catch{return s.toISOString().slice(0,10)}}function ob({msg:t,t:a,embedMode:s,onSignInWith:i,onGetItMade:o,hasDesign:l,designUrls:u,primaryDataUrl:p,transcriptId:g,ourPromises:b=!0}){const y=a.rateLimit,T=t.scope==="month",j=t.kind==="anon",P=j&&!T&&!s,S=j&&!s,R=s?"":t.contactEmail||"[email protected]",[L,k]=h.useState(""),[I,E]=h.useState("idle"),F=async M=>{M&&M.preventDefault&&M.preventDefault();const N=L.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(N)){E("error");return}E("sending");try{const D=await fetch("/api/ai-tool-capture",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:N,designs:(u||[]).slice(0,6),primaryDataUrl:p||"",transcriptId:g||""})});if(!D.ok)throw new Error("bad status "+D.status);E("sent")}catch{E("error")}},_=!!t.soft,Y=T?_?y.bodyMonthWarn(t.monthResetLabel,R):y.bodyMonthCap(t.monthResetLabel,R):_?y.bodySoft?y.bodySoft(t.remaining,t.bonus):"":j?y.bodyAnon(t.bonus):y.bodyAuth(R),V=T?_?y.titleMonthWarn(t.warnPct):y.titleMonthCap():j?y.titleAnon(t.limit):y.titleAuth(t.limit);return e.jsxs("div",{className:`${r.messageBubble} ${r.messageAssistant} ${r.rateLimitCard}`,children:[e.jsx("p",{className:r.rateLimitTitle,children:V}),Y&&e.jsx("p",{className:r.rateLimitBody,children:Y}),P&&e.jsx("div",{className:r.rateLimitSignin,children:e.jsxs("div",{className:r.rateLimitProviders,children:[e.jsxs("button",{type:"button",className:r.rateLimitProviderBtn,onClick:()=>i("oauth_google"),"aria-label":y.continueWith("Google"),title:y.continueWith("Google"),children:[e.jsx(so,{}),e.jsx("span",{children:"Google"})]}),e.jsxs("button",{type:"button",className:r.rateLimitProviderBtn,onClick:()=>i("oauth_facebook"),"aria-label":y.continueWith("Facebook"),title:y.continueWith("Facebook"),children:[e.jsx(oo,{}),e.jsx("span",{children:"Facebook"})]}),e.jsxs("button",{type:"button",className:r.rateLimitProviderBtn,onClick:()=>i("oauth_microsoft"),"aria-label":y.continueWith("Microsoft"),title:y.continueWith("Microsoft"),children:[e.jsx(lo,{}),e.jsx("span",{children:"Microsoft"})]})]})}),P&&(l||!s)&&e.jsx("div",{className:r.rateLimitOr,children:e.jsx("span",{children:y.orDivider})}),l&&e.jsxs("div",{className:r.rateLimitOrder,children:[e.jsx("span",{className:r.rateLimitOrderLabel,children:y.orderLabel}),e.jsxs("button",{type:"button",className:r.rateLimitOrderBtn,onClick:o,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z"}),e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M16 10a4 4 0 0 1-8 0"})]}),e.jsx("span",{children:y.orderCta})]}),b&&y.couponNote&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8,fontSize:"0.78rem"},children:[e.jsx("span",{style:{fontFamily:"ui-monospace, Menlo, monospace",fontWeight:800,letterSpacing:"1px",padding:"3px 9px",borderRadius:6,border:"1.5px dashed currentColor"},children:Ut.code}),e.jsx("span",{style:{opacity:.85},children:y.couponNote})]})]}),S&&(I==="sent"?e.jsxs("p",{className:r.rateLimitEmailSent,children:[e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),y.emailSent]}):e.jsxs("form",{className:r.rateLimitEmailRow,onSubmit:F,children:[e.jsx("span",{className:r.rateLimitEmailLabel,children:y.emailLabel}),y.emailHint&&e.jsx("span",{className:r.rateLimitEmailHint,children:y.emailHint}),e.jsxs("div",{className:r.rateLimitEmailControls,children:[e.jsx("input",{type:"email",inputMode:"email",autoComplete:"email",className:r.rateLimitEmailInput,placeholder:y.emailPlaceholder,value:L,onChange:M=>{k(M.target.value),I==="error"&&E("idle")},"aria-label":y.emailLabel}),e.jsx("button",{type:"submit",className:r.rateLimitEmailBtn,disabled:I==="sending",children:I==="sending"?y.emailSending:y.emailSendCta})]}),I==="error"&&e.jsx("span",{className:r.rateLimitEmailError,children:y.emailError})]})),(!j||T)&&R&&e.jsx("div",{className:r.rateLimitActions,children:e.jsx("a",{href:`mailto:${R}?subject=${encodeURIComponent("Question about PatchDesign.ai")}`,className:r.rateLimitEmailLink,children:y.emailCta})})]})}function lb({embedMode:t=!1,hostPageUrl:a="",embedConfig:s=null,onGeneration:i=null,brandPreset:o=null,belowDisclaimer:l=null,aboveHero:u=null,belowAll:p=null,partnerId:g=null,featureFlags:b={},onSaveToLibrary:y=null,onSubmitForReview:T=null,orgContext:j=null,orgEventName:P="",initialPrompt:S="",initialRefImageUrl:R=""}){var _i,Ti,Ii;const L=In(),k=h.useMemo(()=>$f(s,L),[s,L]);ni=t?String(typeof window<"u"&&new URLSearchParams(window.location.search).get("client")||(k==null?void 0:k.clientKey)||""):"",Ja=Qy(t,k,ni||null),Go(t?k==null?void 0:k.customPatchTypes:[]),Ir=Yy(t,k)||!!Ja;const[I]=yo(),E=h.useRef(null),F=h.useRef(null),_=h.useRef(null),Y=h.useRef(null),V=h.useRef(null),[M,N]=h.useState(!1);h.useEffect(()=>()=>{V.current&&clearTimeout(V.current)},[]);const D=h.useRef(null),[te,A]=h.useState(!1);h.useEffect(()=>()=>{D.current&&clearTimeout(D.current)},[]);const v=et[L]||et.en,ge=o&&((L==="es"?o.seoEs:null)||{title:o.seoT
88itle,description:o.seoDescription,path:o.seoPath}),K={en:{title:"Free AI Patch Generator & Designer | PatchDesign.AI",description:"Free AI patch generator â describe your patch and Parker designs it in seconds. Not just an image generator: every design gets free expert review."},es:{title:"Diseñador de Parches con IA | PatchDesign.AI",description:"Diseñador de Parches con IA en formato chat â describe, diseña, prueba virtualmente y cotiza, todo en una sola conversación."},de:{title:"Aufnäher selbst gestalten mit KI | PatchDesign.AI",description:"Kostenloser KI-Aufnäher-Designer im Chat â beschreiben, entwerfen, virtuell anprobieren und Preis sehen, alles in einem Gespräch."}}[L]||{title:"Free AI Patch Generator & Designer | PatchDesign.AI",description:"Free AI patch generator â describe your patch and Parker designs it in seconds. Not just an image generator: every design gets free expert review."};bo(t?{noindex:!0}:{title:(ge==null?void 0:ge.title)||K.title,description:(ge==null?void 0:ge.description)||K.description,path:(ge==null?void 0:ge.path)||"/ai-tool"});const{clientKey:Ie,applySegmentStyle:He}=wf({embedMode:t,embedConfig:k}),Ae=!(t&&el(k,Ie)),Ke=Ls(t?k:null,!Ae),ye=Ae?[]:nl(k&&k.benefitPills),tt=h.useMemo(()=>ub(t,k),[t,k]),Fe=h.useMemo(()=>Kf(t,k),[t,k]),ra=Mf({embedMode:t,embedConfig:k,brandPreset:o}),be=da(ra.src),U=ra.alt,De=Bf({embedMode:t,embedConfig:k,defaultTitle:v.greeting.parkerName,defaultImage:be,defaultAlt:U});h.useEffect(()=>{Ir&&If(gs())},[]),h.useEffect(()=>{var n,c;if(!(typeof window>"u")&&(j||window.scrollTo(0,0),requestAnimationFrame(()=>{try{F.current&&(F.current.scrollTop=0)}catch{}if(!j)try{window.scrollTo(0,0)}catch{}}),!t))try{(c=(n=rt).toolLoaded)==null||c.call(n,"ai-tool")}catch{}},[t]),h.useEffect(()=>{try{Te("/api/image-gen?keepalive=1",{method:"POST"}).catch(()=>{})}catch{}},[]),(()=>{try{if(typeof window>"u"||typeof sessionStorage>"u")return;const n=new URLSearchParams(window.location.search),c=n.get("fresh")==="1",d=n.get("preview")==="1"&&/^\/embed/.test(window.location.pathname);if(!c&&!d)return;sessionStorage.removeItem("pd_aitool_resume"),sessionStorage.removeItem("pd_aitool_retry_resume")}catch{}})();
88const ft=h.useRef(null),pe=(n,c)=>(ft.current||(ft.current={}),n in ft.current||(ft.current[n]=c()),ft.current[n]),re=pe("retry",()=>{try{if(typeof sessionStorage>"u")return null;const n=sessionStorage.getItem("pd_aitool_retry_resume");if(!n)return null;const c=JSON.parse(n);return!(c!=null&&c.ts)||Date.now()-c.ts>300*1e3?(sessionStorage.removeItem("pd_aitool_retry_resume"),null):c}catch{return null}}),me=(()=>{try{const n=(I.get("design")||"").trim();if(!/^https:\/\//i.test(n))return null;const c=je=>(I.get(je)||"").trim(),d=je=>{const ke=parseFloat(c(je));return isFinite(ke)&&ke>=1&&ke<=13?String(ke):null},m=d("w"),x=d("h"),C=c("m"),B=c("st"),X=c("sh").toLowerCase();return{url:n,prompt:c("p").slice(0,500),material:py.some(je=>je.value===C)||_s(C)?C:"Embroidered",style:uy.some(je=>je.key===B)?B:"Other",shape:/^[a-z0-9][a-z0-9 -]{1,29}$/.test(X)?X:"",width:m||"3",height:x||"3",sizeFromUrl:!!(m||x),edit:I.get("edit")==="1"}}catch{return null}})(),J=pe("signIn",()=>{try{if(typeof sessionStorage>"u"||me||re||R||/^https:\/\//i.test((I.get("refine")||"").trim()))return null;const n=sessionStorage.getItem("pd_aitool_resume");if(!n)return null;const c=JSON.parse(n);return Date.now()-((c==null?void 0:c.savedAt)||0)>1800*1e3?(sessionStorage.removeItem("pd_aitool_resume"),null):c}catch{return null}}),[H,We]=h.useState(()=>{const n={style:"Other",shape:"",backing:"Iron-on",material:"Embroidered",width:"3",height:"3",quantity:150,mainFeature:"",granularity:"Normal",smartFields:{},placement:""};return me?{...n,material:me.material,style:me.style,shape:me.shape,width:me.width,height:me.height}:re!=null&&re.config&&typeof re.config=="object"?{...n,...re.config}:J!=null&&J.config&&typeof J.config=="object"?{...n,...J.config}:n}),Z=oi(),Q=h.useRef(!(re!=null&&re.config)&&!(J!=null&&J.config)&&!(me!=null&&me.sizeFromUrl));h.useEffect(()=>{Z!=="cm"||!Q.current||(We(n=>{if(String(n.width)!=="3"||String(n.height)!=="3")return n;const c=wo("3");return{...n,width:c,height:c}}),Q.current=!1)},[Z]),h.useEffect(()=>{He(We)},[t,k==null?void 0:k.segment]),h.useEffect(()=>{const n=j==null?void 0:j.segment;if(!n)return;const c=$s(n);c&&We(d=>d.style===c?d:{...d,style:c})},[j==null?void 0:j.segment]);const[se]=h.useState(ko),[oe,ne]=h.useState(()=>se.text||S||I.get("prompt")||(J==null?void 0:J.inputValue)||"");h.useEffect(()=>{const n=E.current;!se.focused||!n||(n.focus(),n.setSelectionRange(se.caret,se.caret))},[]);const ce=wb({lang:fs[L]||fs.en,onFinalText:n=>{const c=String(n||"").trim();c&&ne(d=>d&&!/\s$/.test(d)?`${d} ${c}`:`${d}${c}`)}}),[$,ee]=h.useState(()=>{try{if(me){const{url:n,prompt:c,material:d,width:m,height:x,style:C,shape:B}=me;return[{role:"assistant",type:"design",designId:os(),transcriptId:"",url:n,hostedUrl:n,prompt:c,material:d,width:m,height:x,style:C,shape:B,restoredFromLink:!0,configSnapshot:{style:C,shape:B,backing:"Iron-on",material:d,width:m,height:x,quantity:150,mainFeature:"",granularity:"Normal",smartFields:{}}}]}}catch{}try{const n=(I.get("refine")||"").trim();if(/^https:\/\//i.test(n))return[{role:"user",type:"ref-image",content:n,hostedUrl:n}]}catch{}return R?[{role:"user",type:"ref-image",content:R,hostedUrl:R}]:re&&Array.isArray(re.messages)?re.messages:Array.isArray(J==null?void 0:J.messages)?J.messages:[]});h.useEffect(()=>{try{if(typeof window>"u")return;const n=new URL(window.location.href);if(n.searchParams.has("design")){for(const c of["design","edit","m","w","h","sh","st","p"])n.searchParams.delete(c);window.history.replaceState({},"",n.pathname+(n.search||""))}}catch{}},[]);const[he,qe]=h.useState(!1),[Ct,At]=h.useState(0);h.useEffect(()=>{if(!he){At(0);return}const n=Date.now(),c=4e4,d=setInterval(()=>{const m=Date.now()-n,x=Math.min(95,Math.floor(m/c*100));At(x)},150);return()=>clearInterval(d)},[he]);const[Be,pt]=h.useState(()=>{const n=(I.get("refine")||"").trim(),c=/^https:\/\//i.test(n)?n:null;return(re==null?void 0:re.uploadedRefUrl)||(J==null?void 0:J.uploadedRefUrl)||c||R||null}),we=3,[ve,ct]=h.useState(()=>(re==null?void 0:re.extraRefUrls)||(J==null?void 0:J.extraRefUrls)||[]),[ha,yt]=h.useState(!1),[Ve,Je]=h.useState(null),[Ba,ze]=h.useState(!1),[Sa,qt]=h.useState({}),[w,z]=h.useState(()=>me!=null&&me.edit?{url:me.url,prompt:me.prompt}:Ry((re==null?void 0:re.editing)||(J==null?void 0:J.editing),$));h.useEffect(()=>{const n=me!=null&&me.edit?me.url:w&&/^https:\/\//i.test(w.url||"")?w.url:"";if(!n)return;let c=!1;return rb(n).then(d=>{c||!d||z(m=>m&&m.url===n?{...m,url:d}:m)}
88),()=>{c=!0}},[]);const G=h.useRef({}),ae=h.useRef(k);ae.current=k,G.current={messages:$,config:H,uploadedRefUrl:Be,extraRefUrls:ve,editingImage:w,inputValue:oe};const Se=(n,{light:c,heavy:d}={})=>{const m=G.current,x=je=>typeof je=="string"&&je.startsWith("data:"),C={messages:qn(m.messages),config:m.config,uploadedRefUrl:m.uploadedRefUrl||null,extraRefUrls:Array.isArray(m.extraRefUrls)?m.extraRefUrls:[],editing:ls(m.editingImage),inputValue:typeof m.inputValue=="string"?m.inputValue.slice(0,2e3):"",...c||{}},B={...C,uploadedRefUrl:x(C.uploadedRefUrl)?null:C.uploadedRefUrl,extraRefUrls:C.extraRefUrls.filter(je=>!x(je))},X=[{...C,...d||{}},C,B,{...B,messages:C.messages.slice(-20)}];for(const je of X)try{const ke=Date.now();return sessionStorage.setItem(n,JSON.stringify({...je,ts:ke,savedAt:ke})),!0}catch{}return!1},Oe=!!si(),[Ue,xt]=h.useState(""),[Ne,dt]=h.useState(null),[nt,ua]=h.useState(!1),[Oa,vt]=h.useState(null),[pa,$a]=h.useState(!1),Vt=t&&k&&k.brandLink?String(k.brandLink):"",[Re,Ye]=h.useState(null),[Ma,ma]=h.useState(!1),ja=!!Vt||$.some(n=>n&&n.type==="brand-ref"&&n.guidelines),bt=Xi(Re&&Re.logoUrl)||(Re?Xi(k&&k.logoUrl):"");h.useEffect(()=>{if(bt)return eo(bt,bt),()=>Jf()},[bt]);const Xa=ly(Re&&Re.name,k&&(k.brandName||k.name));h.useEffect(()=>{if(!Xa)return;const n=es(Xa);return()=>{es(n)}},[Xa]);const wt=h.useRef(null);h.useEffect(()=>{if(!Vt){wt.current=null,Ye(null),ma(!1);return}let n=!1;return wt.current=nb(Vt),wt.current.then(c=>{n||(c&&c.success?(Ye(c),ma(!1)):(Ye(null),ma(!0)))}),()=>{n=!0}},[Vt]);const _a=t&&String(k&&k.clientKey||"").startsWith("mfr-")&&k.brandNameLookup===!0?k.clientKey:"";h.useEffect(()=>{if(Re){dt(Re);return}const n=Ue.trim();if(!n){dt(null),vt(null);return}const c=/^https?:\/\//i.test(n)||!/\s/.test(n)&&/\.[a-z]{2,}$/i.test(n.replace(/\/.*$/,""));let d;if(c){if(n.length<4)return;d=`url=${encodeURIComponent(n)}`}else{if(n.length<2||!/[a-z]/i.test(n))return;d=`name=${encodeURIComponent(n)}`}let m=!1;ua(!0),vt(null);const x=setTimeout(async()=>{try{const C=c?null:await io(n,_a);if(m)return;if(C){dt(C);return}const B=await Te(`/api/brand-scrape?${d}`),X=await B.json();if(m)return;if(!B.ok)throw new Error((X==null?void 0:X.error)||`HTTP ${B.status}`);if(!X.success){vt("Couldn't find that brand"),dt(null);return}if(dt(X),X.siteType){const ke={ymca:"YMCA",scouting:"Scouts","martial-arts":"Karate","youth-sports":"Sports","first-responder":"LawEnforcement",military:"Military"}[X.siteType];ke&&We(Ge=>Ge.style===ke?Ge:{...Ge,style:ke})}}catch(C){if(m)return;vt(C.message||"Could not read that site"),dt(null)}finally{m||ua(!1)}},700);return()=>{m=!0,clearTimeout(x)}},[Ue,_a,Re]);const Ta=h.useRef(Ne);h.useEffect(()=>{if(Ta.current===Ne)return;Ta.current=Ne;const n=!!(Ne&&Ne.success);n&&Ne.locked||ee(c=>{let d=-1;for(let B=c.length-1;B>=0;B--)if(c[B]&&c[B].type==="design"){d=B;break}const m=c.findIndex((B,X)=>X>d&&B&&B.type==="brand-ref");if(!n)return m===-1?c:c.filter((B,X)=>X!==m);const x={role:"user",type:"brand-ref",content:Ne.name||Ne.host||"",host:Ne.host||"",logoUrl:Ne.logoUrl||"",colors:Array.isArray(Ne.colors)?Ne.colors.slice(0,5):[],...Ne.source==="guidelines"?{guidelines:!0}:{}};if(m===-1)return[...c,x];const C=c.slice();return C[m]=x,C})},[Ne]);const ga=vy(v.typingExamples,{paused:!!oe||!!Be||!!w||he}),fa=h.useMemo(()=>Zs.map(n=>({...n,label:v.garmentLabels[n.id]||n.label})),[v]),er=h.useMemo(()=>jy.map(n=>n.id==="police-agency"?{...n,ask:v.brandQuestions.policeAgency.ask,options:[{...n.options[0],label:v.brandQuestions.policeAgency.yes,needsText:v.brandQuestions.policeAgency.yesNeedsText},{...n.options[1],label:v.brandQuestions.policeAgency.generic}]}:n),[v]);h.useMemo(()=>{const n=v.shapeQuestion,c=d=>{var m;return((m=n==null?void 0:n.options)==null?void 0:m[d])||d};return{...is,ask:(n==null?void 0:n.ask)||"What shape would you like for your patch?",options:is.options.map(d=>{var m;return{...d,label:c(d.id),...d.needsText?{needsText:((m=n==null?void 0:n.options)==null?void 0:m.otherPlaceholder)||"Type a shape (e.g. hexagon)"}:{}}})}},[v]);const[tr,ur]=h.useState(null),[Nt,Ot]=h.useState(null),[na,it]=h.useState(null),[ya,$t]=h.useState(null),[Kt,Fa]=h.useState(null),[ba,Ia]=h.useState(null),Yt=h.useRef(null),Rt=h.useRef(null),wa=h.useCallback((n,c,d)=>{const m=typeof window<"u"?window.innerWidth:0,x=typeof window<"u"?window.innerHeight:0,C=n&&Number.isFinite(n.clientX)&&n.clientX>0?n.clientX:m/2,B=n&&Number.isFinite(n.clientY)&&n.clientY>0?n.clientY:x/2;let X=c&&c.url?c:null;if(!X){const ke=G.current&&G.current.messages;if(Array.isArray(ke))for(let Ge=ke.length-1;Ge>=0;Ge--){const mt=ke[Ge];
88if(mt&&mt.type==="design"&&mt.url){X=mt;break}}}const je=d&&d.garment&&d.design&&d.fittedUrl?d:null;Ia(null),Fa({x:C,y:B,design:X,tryOn:je}),Rt.current&&clearTimeout(Rt.current),Rt.current=setTimeout(()=>Fa(null),6e3)},[]);h.useEffect(()=>{if(!Kt){Ia(null);return}const n=Yt.current;if(!n||typeof window>"u")return;const c=12,d=n.offsetWidth,m=n.offsetHeight,x=Math.max(c,window.innerWidth-d-c),C=Math.max(c,window.innerHeight-m-c);Ia({left:Math.min(Math.max(c,Kt.x-d/2),x),top:Math.min(Math.max(c,Kt.y-m/2),C)})},[Kt]),h.useEffect(()=>()=>{Rt.current&&clearTimeout(Rt.current)},[]);const[at,Qt]=h.useState(null),[St,Da]=h.useState(null),ar=h.useMemo(()=>St?Wf({typeKey:hr(St.material),backing:St.backing,patchTypes:Gt}):null,[St]),[rr,La]=h.useState([]),le=h.useRef(""),[Ze]=h.useState(()=>{try{const n=typeof window<"u"&&new URLSearchParams(window.location.search).get("fresh")==="1";if(n&&typeof sessionStorage<"u"){Object.keys(sessionStorage).forEach(B=>{B.startsWith("pd_transcript_")&&sessionStorage.removeItem(B)});const C=new URL(window.location.href);C.searchParams.delete("fresh"),window.history.replaceState({},"",C.pathname+(C.search||""))}const c=`pd_transcript_${Ie||"main"}`,d=$.length>0&&($===(re==null?void 0:re.messages)||$===(J==null?void 0:J.messages)),m=!n&&d&&typeof sessionStorage<"u"?sessionStorage.getItem(c):null;if(m)return m;const x=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`t_${Date.now()}_${Math.random().toString(36).slice(2,10)}`;return typeof sessionStorage<"u"&&sessionStorage.setItem(c,x),x}catch{return`t_${Date.now()}_${Math.random().toString(36).slice(2,10)}`}}),[jt,Xe]=h.useState([]),[Et,ia]=h.useState([]),Jt=h.useRef(null),[st,sa]=h.useState(null),[ot,Le]=h.useState(null),Gr=h.useRef($.some(n=>n&&n.type==="design"));h.useRef($.some(n=>n&&n.type==="shape-question"));const[nr,Ar]=h.useState(()=>(t&&(k!=null&&k.railDefaultCollapsed),!0)),Nr=h.useCallback(()=>{Ar(n=>!n)},[]),Zt=h.useRef(null),Mt=h.useRef(0),ir=h.useRef(null),za=h.useRef(null),Ha=()=>{Mt.current+=1;try{ir.current&&ir.current.abort()}catch{}ir.current=null,za.current=null,qe(!1),At(0)},{isLoaded:Rr,isSignedIn:Pt,user:Ft}=xo(),{getToken:_t}=vo(),{openSignIn:pr}=So(),{signIn:mr}=jo(),gr=h.useRef(null),fr=h.useRef(!1),ka=h.useRef(null),yr=async n=>{const c=typeof window<"u"?window.location.pathname+window.location.search:"/ai-tool",d=gr.current||za.current||null;try{Se("pd_aitool_retry_resume",{heavy:{retry:d}})}catch{}try{if(!mr)throw new Error("clerk signIn unavailable");await mr.authenticateWithRedirect({strategy:n,redirectUrl:"/sso-callback",redirectUrlComplete:c})}catch{try{pr({redirectUrl:c})}catch{}}},[br,Er]=h.useState(null),de=h.useMemo(()=>{var n,c;if(Rr)return!Pt||!Ft?null:{id:Ft.id,name:Ft.fullName||Ft.firstName||((n=Ft.primaryEmailAddress)==null?void 0:n.emailAddress)||"User",email:((c=Ft.primaryEmailAddress)==null?void 0:c.emailAddress)||"",provider:"clerk"}},[Rr,Pt,Ft]);h.useEffect(()=>{jl({userId:(de==null?void 0:de.id)||null,orgToken:(j==null?void 0:j.sessionToken)||null,getToken:_t})},[de==null?void 0:de.id,j==null?void 0:j.sessionToken,_t]),h.useEffect(()=>{de&&ee(n=>{const c=n.filter(d=>!(d&&d.type==="rate-limit"&&d.kind==="anon"));return c.length===n.length?n:c})},[de]),h.useEffect(()=>{const n=F.current;if(!n)return;const c=$[$.length-1];requestAnimationFrame(()=>{const d=typeof window<"u"&&window.matchMedia&&window.matchMedia("(max-width: 768px)").matches;if(d&&he){const m=n.querySelector("[data-loading-row]");if(m){m.scrollIntoView({behavior:"smooth",block:"center"});return}}if(c&&c.type==="design"&&c.designId){const m=n.querySelector(`[data-design-id="${c.designId}"]`);if(m){if(d){m.scrollIntoView({behavior:"smooth",block:"start"});return}const x=m.offsetTop-n.offsetTop;n.scrollTo({top:Math.max(0,x-8),behavior:"smooth"});return}}if(d&&n.lastElementChild){n.lastElementChild.scrollIntoView({behavior:"smooth",block:"center"});return}n.scrollTop=n.scrollHeight})},[$,he]),h.useEffect(()=>{if(!Ve&&!at)return;const n=c=>{c.key==="Escape"&&(at?Qt(null):Je(null))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[Ve,at]),h.useEffect(()=>{if(!$.length||k!=null&&k.__preview)return;const n=setTimeout(()=>{const c=$.map(d=>{const m=Date.now();if(d.type==="design"){const x=typeof d.hostedUrl=="string"&&d.hostedUrl?d.hostedUrl:"",C=typeof d.url=="string"&&!d.url.startsWith("data:")?d.url:"",B=x||C||void 0;return{role:"assistant",kind:"design",content:d.prompt||"",imageUrl:B,designId:d.designId||"",ts:m}}if(d.type==="ref-image"){const x=typeof d.hostedUrl=="string"&&d.hostedUrl?d.hostedUrl:"",C=typeof d.content=="string"&&!d.content.startsWith("data:")?d.content:"";return{role:"user",kind:"ref-image",content:"",imageUrl:x||C||void 0,ts:m}}return d.type==="brand-question"?{role:"assistant",kind:"brand-question",content:d.ask||"",ts:m}:d.type==="shape-question"?{role:"assistant",kind:"shape-question",content:d.ask||"",ts:m}:d.type==="error"?{role:"assistant",kind:"error",content:d.friendly||"",ts:m}:{role:d.role||"user",kind:d.type||"text",content:d.content||"",ts:m}});Te("/api/transcript",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({transcriptId:Ze,clientKey:t&&Ie||"main",turns:c,config:H,palette:jt,userEmail:(de==null?void 0:de.email)||"",anonId:Hr()||""}),keepalive:!0}).then(d=>d&&d.ok?d.json():null).then(d=>{d&&d.designNumber&&(le.current=String(d.designNumber))}).catch(()=>{})},2e3);return()=>clearTimeout(n)},[$,H,jt,de==null?void 0:de.email]),h.useEffect(()=>{if(t||!de)return;let n=!1;const c="pd_anon_claimed";try{if(localStorage.getItem(c)==="1")return}catch{}const d=Hr();if(d)return(async()=>{try{const m=await _t().catch(()=>null);if(!m||n)return;const x=await Te("/api/anon-claim",{method:"POST",headers:{"Content-Type":"application/json","X-Clerk-Token":m},body:JSON.stringify({anonId:d})});if(x&&x.ok)try{localStorage.setItem(c,"1")}catch{}}catch{}})(),()=>{n=!0}},[t,de,_t]),h.useEffect(()=>{if(t||!de||!$.length)return;const n=setTimeout(async()=>{try{const c=await _t().catch(()=>null);if(!c)return;const d=qn($);await _o({messages:d,config:H},c)}catch{}},2e3);return()=>clearTimeout(n)},[$,H,de,t]);const Xt=h.useCallback(n=>{n&&We(c=>{var m;const d={...c};for(const[x,C]of Object.entries(n))x==="eventName"?(((m=c.smartFields)==null?void 0:m.eventName)||"")!==C&&(d.smartFields={...c.smartFields||{},eventName:C}):c[x]!==C&&(d[x]=C);return d})},[]),fe=h.useCallback(async(n,c={})=>{var ut,Na;if(!n.trim()&&!Be||he)return;const d=c&&c.shapeOverride?c.shapeOverride:null,m=c.refUrl!==void 0?c.refUrl:Be,x=c.extraUrls!==void 0?c.extraUrls:ve,C=!n.trim()&&m?hy:n,B=!c.forceFresh&&(!!w||!!c.anch
88orImage)&&!m;if(B||(ka.current={text:n,refUrl:m||null,extraUrls:x||[]}),ee(q=>[...q,{role:"user",type:"text",content:B?`Edit: ${C}`:C}]),ne(""),La([]),pt(null),ct([]),qe(!0),A(!1),!t)try{(Na=(ut=rt).promptSubmitted)==null||Na.call(ut,!!m,!!B)}catch{}try{const q=j?null:await Te("/api/rate-limit",{method:"POST",headers:{"Content-Type":"application/json",...await As()},body:JSON.stringify({userId:(de==null?void 0:de.id)||null,anonId:Hr()})}).then(Ce=>Ce.ok?Ce.json():null);if(q&&!q.allowed&&q.reason==="month"){ee(Ce=>[...Ce,{role:"assistant",type:"rate-limit",kind:de||t?"auth":"anon",scope:"month",monthResetLabel:bs(q.monthResetAt,L),contactEmail:q.contactEmail}]),qe(!1);return}if(q&&!q.allowed){gr.current={text:C,refUrl:m||null,extraUrls:x||[],isEdit:B,baseImage:B&&(w||c.anchorImage)||null,autoRetryAttempts:0,editOverride:null},ee(Ce=>[...Ce,{role:"assistant",type:"rate-limit",kind:!de&&!t?"anon":"auth",limit:q.limit,bonus:17,contactEmail:q.contactEmail,resetAt:q.resetAt}]),qe(!1);return}q&&q.allowed&&q.monthWarn&&ee(Ce=>[...Ce,{role:"assistant",type:"rate-limit",kind:"auth",scope:"month",soft:!0,warnPct:Number(q.monthWarn),monthResetLabel:bs(q.monthResetAt,L),contactEmail:q.contactEmail}]),q&&q.allowed&&!de&&!t&&Number(q.used)>=sb&&!fr.current&&(fr.current=!0,ee(Ce=>[...Ce,{role:"assistant",type:"rate-limit",kind:"anon",soft:!0,limit:q.limit,remaining:Number(q.remaining)||0,bonus:17,contactEmail:q.contactEmail,resetAt:q.resetAt}]))}catch{}if(!B&&!m){const q=Ay(C);if(q.style||q.mainFeature||q.width||q.height){const Ce=q.style&&q.style!==H.style;Xt(Ce?{eventName:"",mainFeature:q.mainFeature||"",style:q.style,shape:"",...q.width?{width:q.width}:{},...q.height?{height:q.height}:{}}:q)}}if(!B&&!m&&!st&&!c.forceFresh){const q=er.find(Ce=>Ce.match.test(C));if(q){sa({question:q,pendingPrompt:C}),ee(Ce=>[...Ce,{role:"assistant",type:"brand-question",questionId:q.id,ask:q.ask,options:q.options}]),qe(!1);return}}let X=m;if(m&&!B)try{const q=await Al(m);q.croppedDataUrl&&(X=q.croppedDataUrl),q.applied.shapeDetected&&!H.shape&&We(Ce=>({...Ce,shape:q.shape}))}catch(q){console.warn("[AIToolPageV2] reference prep failed:",q.message)}const je=X?{url:X}:c.forceFresh?null:c.anchorImage||w;z(null);let ke=null;if(B&&je){const q=Vi(C,as);q&&Ki(q)&&(ke=`Re-render the existing patch with these changes: ${q.map(zt=>`${zt.label}: ${zt.value}`).join(", ")}. Keep the entire subject, composition, all elements, text/wordmarks, and color palette EXACTLY identical. Apply ONLY the rendering / material / shape change requested. Do not redraw, recompose, or reinterpret the artwork.`)}let Ge=Re||Ne,mt=(Ue||"").trim(),Ee=null;if(!B&&!mt&&(!Ge||!Ge.success)&&(Ee=ib(C),Ee&&(mt=Ee,(Ue||"").trim()||xt(Ee))),!B&&mt&&(!Ge||!Ge.success)){let q=await ys(mt,_a);q||(q=await ys(mt,_a)),q?(Ge=q,dt(q),vt(null)):Ee&&vt(`Couldn't pull ${Ee} just now â it's in the brand field above; tap Regenerate to apply it.`)}const gt=Ee&&Ge&&Ge.success&&C.replace(Ee,"").replace(/\s{2,}/g," ").trim()||C;await Wa({text:gt,refUrl:m,extraUrls:x,isEdit:B,baseImage:je,editOverride:ke,shapeOverride:d,brandOverride:Ge})},[he,H,w,Be,ve,de,Ue,Ne,_a,Re]),Wa=h.useCallback(async({text:n,refUrl:c,extraUrls:d=[],isEdit:m,baseImage:x,autoRetryAttempts:C=0,editOverride:B=null,shapeOverride:X=null,brandOverride:je=null})=>{var Ce,zt,la,sn,or,lr;const ke=X?{...H,shape:X}:H,Ge=!!(t&&k&&k.brandLink),mt=Ge&&wt.current?await wt.current:null,Ee=(mt&&mt.success?mt:null)||je||Ne,gt=t&&k&&k.brandKit&&!pa&&!Ge?{houseKit:k.brandKit}:{},ut=Ee?{...ke,...gt,brandContext:Ee}:{...ke,...gt},Na=Mt.current,q=()=>Mt.current!==Na;za.current={text:n,refUrl:c||null,extraUrls:d||[],isEdit:m,baseImage:x||null,autoRetryAttempts:C,editOverride:B||null,shapeOverride:X||null,brandOverride:je||null},qe(!0);try{const ie=C+1;let kt=(x==null?void 0:x.url)||null,ea=Array.isArray(d)?d:[];if(!m&&Ee&&(Ee.logoDataUrl||Ee.logoUrl)){const xe=Ee.logoDataUrl||await ab(Ee.logoUrl);xe&&(kt?ea=[xe,...ea].slice(0,2):kt=xe)}const Ra=new AbortController;ir.current=Ra;const cr=m?Dl(x.enhancedPrompt||x.prompt,B||n,ut,(x==null?void 0:x.url)||null,ie,Ra.signal):El(n,ut,kt,ie,ea,Ra.signal),on=new Promise((xe,Wt)=>{setTimeout(()=>{const Me=new Error("Generation watchdog: API never settled within 90s");Me.errorCode="GEN-T01",Me.isClientWatchdog=!0,Wt(Me)},9e4)}),ta=await Promise.race([cr,on]);if(q())return;const Ht=ta.imageUrl,lt=os();if(Gr.current=!0,ee(xe=>[...xe,{role:"assistant",type:"design",designId:lt,transcriptId:Ze,url:Ht,rawUrl:Ht,prompt:n,enhancedPrompt:ta.enhancedPrompt,material:H.material,width:H.width,height:H.height,style:H.style,shape:ut.shape,configSnapshot:{...ut,smartFields:{...ut.smartFields||{}}}}]),z({designId:lt,url:Ht,prompt:n,enhancedPrompt:ta.enhancedPrompt}),(zt=(Ce=rt).patchGenerated)==null||zt.call(Ce),!t)try{(sn=(la=rt).imageGenerated)==null||sn.call(la,ta.model||null,ta.durationMs||null,{designId:lt,style:H.style,material:H.material,size:`${H.width}x${H.height}`,shape:ut.shape})}catch{}try{i==null||i({prompt:n,material:H.material,size:`${H.width}" Ã ${H.height}"`,style:H.style,model:ta.model||null})}catch{}Te("/api/upload-reference-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:Ht})}).then(xe=>xe&&xe.ok?xe.json().catch(()=>({})):null).then(xe=>{!xe||!xe.url||ee(Wt=>Wt.map(Me=>Me.type==="design"&&Me.designId===lt?{...Me,hostedUrl:xe.url}:Me))}).catch(()=>{}),Cl(Ht).then(xe=>{Ir&&Lf(xe||Ht,gs()).then(Me=>{Me&&ee(It=>It.map(Lt=>Lt.type==="design"&&Lt.designId===lt?{...Lt,previewUrl:Me}:Lt))}),xe&&(ee(Me=>Me.map(It=>It.type==="design"&&It.designId===lt?{...It,url:xe}:It)),z(Me=>Me&&(Me.designId===lt||Me.url===Ht)?{...Me,designId:lt,url:xe}:Me))}).catch(()=>{});try{const xe=parseFloat(H.width)||0,Wt=parseFloat(H.height)||0;xe&&Wt&&Math.min(xe,Wt)<=2.5&&Hl(Ht,xe,Wt).then(Me=>{ee(It=>It.map(Lt=>Lt.type==="design"&&Lt.designId===lt?{...Lt,legibility:Me}:Lt))}).catch(()=>{})}catch{}}catch(ie){if(q())return;const kt=(ie==null?void 0:ie.errorCode)||(ie!=null&&ie.isServiceLimited?"GEN-Q01":"GEN-E01");let ea;kt==="GEN-S01"||ie!=null&&ie.isSafetyBlock?ea=(ie==null?void 0:ie.message)||"That prompt was blocked by our safety filter. Try rewording â describe the patch theme, colors, and shapes, without naming real people or sensitive content.":kt==="GEN-B01"||ie!=null&&ie.isBudgetCapped?ea=t?"The designer is at capacity right now. Please try again a little later.":(ie==null?void 0:ie.message)||"Our image service is at capacity right now â but we don't want you to lose this idea. Email your design description to [email protected] and our team will create it for you within a few hours.":kt==="GEN-R01"?ea="That one didn't come through â tweaking the prompt slightly often helps, or just tap Try again.":ea="Our designer is in high demand right now, so this one is taking a little longer than usual. We're automatically trying again â hang tight, or tap Try again in a moment.",console.error("[runGeneration] failed:",kt,ie==null?void 0:ie.message,ie==null?void 0:ie.geminiErrors);try{Te("/api/log-event",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientKey:t&&Ie||"main",eventType:"error",metadata:{errorCode:kt,message:((ie==null?void 0:ie.message)||"").slice(0,300),isEdit:!!m,hasRef:!!c,autoRetryAttempt:C,models:Array.isArray(ie==null?void 0:ie.geminiErrors)&&ie.geminiErrors.length>0?ie.geminiErrors.map(lt=>
88lt==null?void 0:lt.model).filter(Boolean).join(","):Sy[C+1]||"",modelsSource:Array.isArray(ie==null?void 0:ie.geminiErrors)&&ie.geminiErrors.length>0?"server":"client-expected",isServiceLimited:!!(ie!=null&&ie.isServiceLimited)}})}).catch(()=>{})}catch{}if(!t)try{(lr=(or=rt).generationFailed)==null||lr.call(or,kt,!!m,!!c)}catch{}const Ra=[3e3,3e3],cr=Ra.length,ta=new Set(["GEN-E01","GEN-G01","GEN-T01","GEN-U01","GEN-R01","GEN-Q01"]).has(kt)&&C<cr,Ht=Ra[C]||1e4;ee(lt=>[...lt,{role:"assistant",type:"error",errorId:`err_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,friendly:ea,code:kt,retry:{text:n,refUrl:c||null,extraUrls:d||[],isEdit:m,baseImage:x||null,autoRetryAttempts:C+1,editOverride:B||null},autoRetryAt:ta?Date.now()+Ht:null,autoRetryAttempt:ta?C+1:0,autoRetryTotal:ta?cr:0,priorAutoRetries:C,autoRetryMax:cr}]),c&&pt(c),d&&d.length&&ct(d)}finally{q()||(za.current=null,qe(!1),setTimeout(()=>{var ie;return(ie=E.current)==null?void 0:ie.focus({preventScroll:!0})},100))}},[H,t,k,pa]),[ki,Pr]=h.useState(!1),Br=h.useCallback(n=>{if(n!=null&&n.retry){try{if(typeof sessionStorage<"u"){const c=$.filter(d=>d.errorId!==n.errorId);sessionStorage.setItem("pd_aitool_retry_resume",JSON.stringify({retry:n.retry,config:H,uploadedRefUrl:Be,extraRefUrls:ve,editing:ls(w),messages:qn(c).slice(-30),ts:Date.now()}))}}catch(c){console.warn("[handleRetry] persist failed, falling back to in-place retry:",c),ee(d=>d.filter(m=>m.errorId!==n.errorId)),Wa(n.retry);return}Pr(!0),setTimeout(()=>{typeof window<"u"&&window.location.reload()},700)}},[$,H,Be,ve,w,Wa]),Tt=h.useMemo(()=>{for(let n=$.length-1;n>=0;n--){const c=$[n];if(c.type==="error"&&c.autoRetryAt)return c}return null},[$]);h.useEffect(()=>{if(!Tt)return;const n=Tt.autoRetryAt-Date.now(),c=setTimeout(()=>{Br(Tt)},Math.max(0,n));return()=>clearTimeout(c)},[Tt==null?void 0:Tt.errorId,Tt==null?void 0:Tt.autoRetryAt,Br]);const[,Or]=h.useState(0);h.useEffect(()=>{if(!Tt)return;const n=setInterval(()=>Or(c=>c+1),1e3);return()=>clearInterval(n)},[Tt==null?void 0:Tt.errorId]);const xi=h.useCallback(n=>{ee(c=>c.map(d=>d.errorId===n?{...d,autoRetryAt:null}:d))},[]);h.useEffect(()=>{if(!(!$||$.length===0||$.some(c=>c.type==="micro-survey")||$.filter(c=>c.type==="design").length<3)){try{const c=localStorage.getItem("pd_micro_survey_shown");if(c&&Date.now()-parseInt(c,10)<720*60*60*1e3)return}catch{}ee(c=>[...c,{role:"assistant",type:"micro-survey",surveyId:`survey_${Date.now()}_${Math.random().toString(36).slice(2,7)}`}]);try{localStorage.setItem("pd_micro_survey_shown",String(Date.now()))}catch{}}},[$]);const $r=h.useCallback(async(n,c,d,m)=>{if(ee(x=>x.map(C=>C.surveyId===n?{...C,answered:!0,skipped:!!d,answer:c||""}:C)),!(!c||!c.trim()))try{await Te("/api/log-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({vote:"survey",clientKey:typeof window<"u"&&window.__PATCHDESIGN_CLIENT_KEY__||"main",reason:c.trim().slice(0,500),topic:m||""})})}catch(x){console.warn("[micro-survey] log-feedback failed:",x&&x.message)}},[]),Mr=h.useCallback((n,c)=>{var x,C;const d=String(c||"").trim();if(!d)return;ee(B=>B.map(X=>X.surveyId===n?{...X,answered:!0,skipped:!0}:X));let m;if(!w){const B=$.filter(X=>X&&X.type==="design").pop();B&&B.url&&(m={anchorImage:{url:B.url,prompt:B.prompt,enhancedPrompt:B.enhancedPrompt}})}try{(C=(x=rt).ctaClicked)==null||C.call(x,"survey-text-as-edit","ai-tool-v2")}catch{}fe(d,m)},[$,w,fe]),qr=h.useRef(!1),Ua=h.useRef(Wa);h.useEffect(()=>{Ua.current=Wa},[Wa]),h.useEffect(()=>{if(!qr.current&&re!=null&&re.retry){qr.current=!0;try{typeof sessionStorage<"u"&&sessionStorage.removeItem("pd_aitool_retry_resume")}catch{}me||setTimeout(()=>Ua.current(re.retry),50)}},[]);const wr=h.useCallback(n=>{if(!st)return;if(n.needsText){sa(m=>m&&{...m,awaitingText:n});return}const c=st.pendingPrompt,d=n.append?`${c} â ${n.append}`:c;sa(null),ee(m=>[...m,{role:"user",type:"brand-answer",content:n.label}]),n.configPatch&&Xt(n.configPatch),setTimeout(()=>fe(d),0)},[st,Xt,fe]),Rn=h.useCallback(n=>{const c=(n||"").trim();if(!st||!st.awaitingText)return;const d=st.awaitingText,m=st.pendingPrompt,x=c?d.textTemplate?d.textTemplate.replace(/\{text\}/g,c):c:"",C=[];d.append&&C.push(d.append),x&&C.push(x);const B=C.length?`${m} â ${C.join(" â ")}`:m;sa(null),ee(X=>[...X,{role:"user",type:"brand-answer",content:c?`${d.label}: ${c}`:d.label}]),d.configPatch&&Xt(d.configPatch),setTimeout(()=>fe(B),0)},[st,Xt,fe]),En=h.useCallback(n=>{if(!ot)return;if(n.needsText){Le(x=>x&&{...x,awaitingText:n});return}const c=ot.pendingPrompt,d=n.append?`${c} â ${n.append}`:c;Le(null),ee(x=>[...x,{role:"user",type:"shape-answer",content:n.label}
88]),n.configPatch&&Xt(n.configPatch);const m=n.configPatch&&n.configPatch.shape?n.configPatch.shape:null;setTimeout(()=>fe(d,{shapeOverride:m}),0)},[ot,Xt,fe]),kr=h.useCallback(n=>{const c=(n||"").trim();if(!ot||!ot.awaitingText)return;const d=ot.awaitingText,m=ot.pendingPrompt,x=c?d.textTemplate?d.textTemplate.replace(/\{text\}/g,c):c:"",C=x?`${m} â ${x}`:m;Le(null),ee(X=>[...X,{role:"user",type:"shape-answer",content:c?`${d.label}: ${c}`:d.label}]);const B=c?c.toLowerCase().replace(/\s+/g," ").trim():null;B&&Xt({shape:B}),setTimeout(()=>fe(C,{shapeOverride:B}),0)},[ot,Xt,fe]),Ca=()=>{ce.listening&&ce.stop();let n;if(!w&&oe){const c=Vi(oe,as);if(c&&Ki(c)){const d=$.filter(m=>m&&m.type==="design").pop();d&&d.url&&(n={anchorImage:{url:d.url,prompt:d.prompt,enhancedPrompt:d.enhancedPrompt}})}}fe(oe,n)},xr=n=>{var c,d;ne(n);try{(d=(c=rt).ctaClicked)==null||d.call(c,"example-tile","ai-tool-v2")}catch{}try{E.current&&E.current.focus({preventScroll:!0})}catch{}he||(A(!0),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>A(!1),12e3),setTimeout(()=>{var m;try{(m=Y.current)==null||m.scrollIntoView({behavior:"smooth",block:"center"})}catch{}},60))},Pn=n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),Ca()),n.key==="Escape"&&te&&A(!1)},Bn=(n,c)=>{z({designId:n.designId,url:n.url,prompt:n.prompt,enhancedPrompt:n.enhancedPrompt}),La(d=>{const m=d.includes(c)?d.filter(x=>x!==c):[...d,c];return ne(m.join(" and ")),m}),setTimeout(()=>{var d;return(d=E.current)==null?void 0:d.focus({preventScroll:!0})},50)},Vr=h.useCallback((n,c,d)=>{if(n==null||(d==null?"":String(d)).trim()==="")return;const m=Gi(n,String(d).trim(),v,L),x=String(m.value).trim();x&&ne(C=>qi(C,m.label,x))},[v,L]),Fr=n=>{if(!n||!n.type||!n.type.startsWith("image/"))return;if((Be?1:0)+ve.length>=we){_.current&&(_.current.value="");return}const d=!Be;yt(!0);const m=new FileReader;m.onload=async()=>{const x=m.result,C=`ref_${Date.now()}_${Math.random().toString(36).slice(2,7)}`;d?pt(x):ct(B=>B.length>=we-1?B:[...B,x]),ee(B=>[...B,{role:"user",type:"ref-image",content:x,refMessageId:C}]);try{const B=await Te("/api/upload-reference-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:x})});if(B&&B.ok){const X=await B.json().catch(()=>({}));X&&X.url&&ee(je=>je.map(ke=>ke.refMessageId===C?{...ke,hostedUrl:X.url}:ke))}}catch{}yt(!1),_.current&&(_.current.value="")},m.readAsDataURL(n)},Kr=n=>{var c;Fr((c=n.target.files)==null?void 0:c[0])},Dt=Be?[Be,...ve]:[],Ga=n=>{const c=Dt[n];
88n===0?(pt(ve[0]||null),ct(d=>d.slice(1))):ct(d=>d.filter((m,x)=>x!==n-1)),c&&ee(d=>{const m=d.findIndex(x=>x&&x.type==="ref-image"&&x.content===c);return m===-1?d:d.filter((x,C)=>C!==m)})},qa=n=>{var d;const c=(d=n.clipboardData)==null?void 0:d.items;if(!(!c||c.length===0))for(let m=0;m<c.length;m++){const x=c[m];if(x&&x.kind==="file"&&x.type&&x.type.startsWith("image/")){const C=x.getAsFile();if(C){n.preventDefault(),Fr(C);return}}}},Va=async(n,c={})=>{var q,Ce;if(!n)return;const d=H.material||n.material||"Embroidered",m=hr(d),x=Cr(m,k==null?void 0:k.pricingOverrides,k==null?void 0:k.addOnOverrides)||Gt[m]||Gt.embroidered,C=Object.keys(x.table),B=parseFloat(H.width||n.width||3),X=parseFloat(H.height||n.height||B),je=(B+X)/2,ke=ci(C,je),Ge=c.quantity||H.quantity||100,Ee=_r(m,ke,Ge,k==null?void 0:k.pricingOverrides),gt=H.width||n.width||"",ut=H.height||n.height||gt,Na=gt&&ut?`${gt}"Ã${ut}"`:"";qt({imageUrl:n.url,displayImageUrl:Ea(n),description:n.prompt,material:d,size:ke,quantity:Ge,estimate:Ee,width:String(gt||""),height:String(ut||""),dimensions:Na,legibility:n.legibility||null,rawImageUrl:n.rawUrl||null,backing:c.backing||"",comments:c.comments||"",customValues:H.customValues||{}}),ze(!0),(Ce=(q=rt).orderModalOpened)==null||Ce.call(q,"ai-tool-v2"),Ko(n.url,Ai).then(zt=>{Array.isArray(zt)&&Xe(zt.map(la=>la.hex).filter(Boolean))}).catch(()=>{}),Jt.current=Yo(n.url,Ai).then(zt=>{const la=Array.isArray(zt)?zt:[];return ia(la),la}).catch(()=>[])},Yr=h.useRef(!1);h.useEffect(()=>{if(Yr.current||!t||I.get("preview")!=="1"||I.get("quote")!=="1")return;const n=$.find(c=>c&&c.type==="design"&&c.url);n&&(Yr.current=!0,Va(n))},[$,t]);const vr=h.useCallback((n,c,d)=>{try{Te("/api/log-event",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientKey:t&&Ie||"main",eventType:n,metadata:{transcriptId:Ze,designId:c||"",source:d||""}})}).catch(()=>{})}catch{}},[Ze,t,Ie]),xa=async n=>{var c,d;if(!(!n||!n.url)){if(!Pt&&!t){try{const m=typeof n.hostedUrl=="string"&&n.hostedUrl?n.hostedUrl:"",x=m||!String(n.url||"").startsWith("data:")?m||n.url:"";x&&sessionStorage.setItem("pd_aitool_pendingDownload",JSON.stringify({url:x,at:Date.now()}))}catch(m){console.warn("[handleDownload] pending download persist failed:",m)}try{const m=typeof window<"u"?window.location.href:"/ai-tool";pr({afterSignInUrl:m,afterSignUpUrl:m,redirectUrl:m})}catch(m){console.error("[handleDownload] openSignIn failed:",m)}return}if(it("downloading"),!t)try{(d=(c=rt).imageDownloaded)==null||d.call(c,"chat")}catch{}vr("download",n.designId,"chat");try{const x=/^https:\/\//i.test(n.url)?Za(`/api/download-image?url=${encodeURIComponent(n.url)}&filename=patch-design.png${Lr()}`):Ea(n),C=document.createElement("a");C.href=x,C.download="patch-design.png",C.rel="noopener",document.body.appendChild(C),C.click(),document.body.removeChild(C),it("success"),setTimeout(()=>it(null),2500)}catch(m){console.warn("[handleDownload] failed:",m),it("error"),setTimeout(()=>it(null),3500)}}},Qr=async(n,c)=>{var x,C;const{garment:d,design:m}=n||{};if(!d||!m||!c)return xa(m);if(it("downloading"),!t)try{(C=(x=rt).imageDownloaded)==null||C.call(x,"tryon")}catch{}vr("download",m.designId,"tryon");try{const{widthIn:B,heightIn:X}=Sn(n),{leftPct:je,topPct:ke,widthPct:Ge,heightPct:mt}=An(d,B,X,420/380),Ee=1680,gt=Math.round(Ee*380/420),ut=document.createElement("canvas");ut.width=Ee,ut.height=gt;const Na=ut.getContext("2d"),q=Wt=>new Promise((Me,It)=>{const Lt=new Image;Lt.crossOrigin="anonymous",Lt.onload=()=>Me(Lt),Lt.onerror=()=>It(new Error(`Failed to load ${Wt}`)),Lt.src=Wt}),[Ce,zt]=await Promise.all([q(da(d.src)),q(c)]),la=Ce.naturalWidth/Ce.naturalHeight,sn=Ee/gt;let or,lr,ie,kt;la>sn?(or=Ee,lr=Ee/la,ie=0,kt=(gt-lr)/2):(lr=gt,or=gt*la,kt=0,ie=(Ee-or)/2),Na.drawImage(Ce,ie,kt,or,lr);const ea=Ge/100*Ee,Ra=mt/100*gt,cr=je/100*Ee,on=ke/100*gt;Na.drawImage(zt,cr-ea/2,on-Ra/2,ea,Ra);const ta=await new Promise((Wt,Me)=>{try{ut.toBlob(It=>It?Wt(It):Me(new Error("toBlob returned null")),"image/png")}catch(It){Me(It)}}),Ht=URL.createObjectURL(ta),lt=(d.label||"garment").toLowerCase().replace(/[^a-z0-9]+/g,"-"),xe=document.createElement("a");xe.href=Ht,xe.download=`patch-on-${lt}.png`,xe.rel="noopener",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),setTimeout(()=>URL.revokeObjectURL(Ht),2e3),it("success"),setTimeout(()=>it(null),2500)}catch(B){console.warn("[handleTryOnDownload] compose failed, falling back to bare patch:",B),xa(m)}},Dr=async n=>{if(n){if(!de){Er(n);try{sessionStorage.removeItem("pd_aitool_pendingDownload")}catch{}try{Se("pd_aitool_resume",{light:{pendingSaveDesignId:n.designId}})}catch(c){console.warn("[handleSave] sessionStorage persist failed:",c)}try{const c=typeof window<"u"&&window.location.pathname||"/ai-tool";pr({afterSignInUrl:c,afterSignUpUrl:c,redirectUrl:c})}catch(c){console.error("[openSignIn] failed:",c)}return}Ot("saving");try{const c=await _t().catch(C=>(console.error("[getToken] failed:",C),null));if(!c)throw new Error("No auth token (Clerk getToken returned null)");const d=await Li({imageUrl:n.url,prompt:n.prompt,material:n.material||H.material,size:`${n.width||H.width}" Ã ${n.height||H.height}"`,shape:n.shape||H.shape,style:n.style||H.style,userName:de.name||""},c),m=d&&d.id?String(d.id):null,x=d&&d.url?d.url:n.url;m&&ee(C=>C.map(B=>B.designId===n.designId?{...B,savedDesignId:m,savedOwnerId:de.id,url:x}:B)),Ot("saved"),setTimeout(()=>Ot(null),2500)}catch(c){console.error("[save-design] failed:",c),Ot("error"),setTimeout(()=>Ot(null),3500)}}};h.useEffect(()=>{if(Pt&&br&&de){const n=br;Er(null),Dr(n)}},[Pt,br,de]),h.useEffect(()=>{if(!Pt||!de)return;let n;try{n=typeof sessionStorage<"u"?sessionStorage.getItem("pd_aitool_resume"):null}catch{return}if(n)try{const c=JSON.parse(n);if(c!=null&&c.config&&typeof c.config=="object"&&We(d=>
88({...d,...c.config})),c!=null&&c.pendingSaveDesignId&&Array.isArray(c==null?void 0:c.messages)){const d=c.messages.find(m=>m.designId===c.pendingSaveDesignId);d&&setTimeout(()=>Dr(d),0)}}catch(c){console.warn("[resume] sessionStorage parse failed:",c)}finally{try{sessionStorage.removeItem("pd_aitool_resume")}catch{}}},[Pt,de]),h.useEffect(()=>{if(!Pt)return;let n;try{n=typeof sessionStorage<"u"?sessionStorage.getItem("pd_aitool_pendingDownload"):null}catch{return}if(n){try{sessionStorage.removeItem("pd_aitool_pendingDownload")}catch{}try{const{url:c,at:d}=JSON.parse(n);if(!c)return;const m=600*1e3;if(typeof d=="number"&&Date.now()-d>m)return;if(typeof navigator<"u"&&/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent||"")){$t(c);return}const B=/^https:\/\//i.test(c)?Za(`/api/download-image?url=${encodeURIComponent(c)}&filename=patch-design.png${Lr()}`):c,X=document.createElement("a");X.href=B,X.download="patch-design.png",X.rel="noopener",document.body.appendChild(X),X.click(),document.body.removeChild(X)}catch(c){console.warn("[pendingDownload] resume failed:",c)}}},[Pt]),h.useEffect(()=>{const n=()=>{var c;try{if(typeof sessionStorage>"u"||(c=ae.current)!=null&&c.__preview)return;const{messages:d}=G.current;if(!Array.isArray(d)||d.length===0)return;let m;try{const x=sessionStorage.getItem("pd_aitool_resume"),C=x?JSON.parse(x).pendingSaveDesignId:null;C&&(m={pendingSaveDesignId:C})}catch{}Se("pd_aitool_resume",{light:m})}catch{}};return window.addEventListener("pagehide",n),window.addEventListener("beforeunload",n),()=>{window.removeEventListener("pagehide",n),window.removeEventListener("beforeunload",n)}},[]);const Jr=h.useCallback(async n=>{if(t){const c=n.url;return{shareUrl:Vs(a,n)||(/^https:\/\//i.test(String(c||""))?c:""),imageUrl:c}}if(n.savedDesignId&&n.savedOwnerId)return{shareUrl:un({userId:n.savedOwnerId,designId:n.savedDesignId,isSaved:!0}),imageUrl:n.url};if(de)try{const c=await _t().catch(()=>null);if(c){const d=await Li({imageUrl:n.url,prompt:n.prompt,material:n.material||H.material,size:`${n.width||H.width}" Ã ${n.height||H.height}"`,shape:n.shape||H.shape,style:n.style||H.style,userName:de.name||""},c),m=d&&d.id?String(d.id):null,x=d&&d.url?d.url:n.url;if(m)return ee(C=>C.map(B=>B.designId===n.designId?{...B,savedDesignId:m,savedOwnerId:de.id,url:x}:B)),{shareUrl:un({userId:de.id,designId:m,isSaved:!0}),imageUrl:x}}}catch(c){console.warn("[ensureShareablePermalink] auth save failed, trying anonymous:",c&&c.message)}try{const c=await To({imageUrl:n.url,prompt:n.prompt,material:n.material||H.material,size:`${n.width||H.width}" Ã ${n.height||H.height}"`,shape:n.shape||H.shape,style:n.style||H.style});if(c&&c.id&&c.ownerId){const d=c.url||n.url;return ee(m=>m.map(x=>x.designId===n.designId?{...x,savedDesignId:String(c.id),savedOwnerId:c.ownerId,url:d}:x)),{shareUrl:un({userId:c.ownerId,designId:String(c.id),isSaved:!0}),imageUrl:d}}}catch(c){console.warn("[ensureShareablePermalink] anonymous save failed, falling back to /ai-tool:",c&&c.message)}return{shareUrl:un({isSaved:!1}),imageUrl:n.url}},[de,_t,H,t,a]),[On,Zr]=h.useState(!1),Xr=()=>{var n,c;Zr(!0);try{(c=(n=rt).ctaClicked)==null||c.call(n,"design-help-open","ai-tool-v2")}catch{}},en=()=>{const n=$.filter(c=>c&&c.type==="design").pop();return{designImageUrl:n&&(n.hostedUrl||(typeof n.url=="string"&&n.url.startsWith("http")?n.url:""))||"",dis
88playImageUrl:n?Ea(n):"",clientKey:t&&Ie||"",designNumber:le.current||n&&n.designNumber||"",transcriptId:Ze||"",patchType:H.material||"",patchSize:H.width&&H.height?`${H.width}" Ã ${H.height}"`:"",quantity:H.quantity||"",chatTail:$.filter(c=>c&&(c.type==="text"||c.type==="design")).slice(-8).map(c=>({role:c.role==="user"?"user":"assistant",text:String(c.type==="design"?c.prompt||"[design generated]":c.content||"").slice(0,400)})).filter(c=>c.text)}},Ka=()=>{Mt.current+=1,qe(!1),At(0),z(null),La([]);const n=ka.current,c=$.filter(m=>m&&m.type==="design").pop(),d=n&&(String(n.text||"").trim()||n.refUrl)?n:c&&String(c.prompt||"").trim()?{text:c.prompt,refUrl:null,extraUrls:[]}:null;if(d)pt(d.refUrl||null),ct(Array.isArray(d.extraUrls)?d.extraUrls:[]),setTimeout(()=>{fe(d.text||"",{forceFresh:!0,refUrl:d.refUrl||null,extraUrls:Array.isArray(d.extraUrls)?d.extraUrls:[]})},0);else{if(ee([]),pt(null),ct([]),xt(""),ne(""),typeof window<"u")try{window.scrollTo({top:0,behavior:"smooth"})}catch{window.scrollTo(0,0)}try{F.current&&(F.current.scrollTop=0)}catch{}setTimeout(()=>{var m;return(m=E.current)==null?void 0:m.focus({preventScroll:!0})},100)}},Bt=(()=>{for(let n=$.length-1;n>=0;n--)if($[n].type==="design")return $[n].designId;return null})();(()=>{for(let n=$.length-1;n>=0;n--)if($[n].type==="design")return $[n].url;return null})();const Sr=(()=>{if(!w||!Bt)return null;const n=$.find(c=>c&&c.type==="design"&&(w.designId?c.designId===w.designId:w.url&&c.url===w.url));return!n||n.designId===Bt?null:n.designId})(),[Aa,tn]=h.useState(null),oa=Aa||Bt;h.useEffect(()=>{Aa&&Bt&&Aa!==Bt&&($.some(c=>c.type==="design"&&c.designId===Aa)||tn(null))},[$.length]);const an=n=>{var c,d;if(!(!n||!n.designId)){tn(n.designId),n.configSnapshot&&We(m=>({...m,...n.configSnapshot}));try{(d=(c=rt).ctaClicked)==null||d.call(c,"order-older-design","ai-tool-v2")}catch{}}},rn=n=>{var c,d;if(!(!n||!n.url)){z({designId:n.designId,url:n.url,prompt:n.prompt,enhancedPrompt:n.enhancedPrompt});try{(d=(c=rt).ctaClicked)==null||d.call(c,"continue-from-older-design","ai-tool-v2")}catch{}requestAnimationFrame(()=>{requestAnimationFrame(()=>{var x;const m=Y.current;try{m==null||m.scrollIntoView({behavior:"smooth",block:"end"})}catch{}try{(x=E.current)==null||x.focus({preventScroll:!0})}catch{}})})}},f=(n,c="edit-in-chat-pencil")=>{var d,m;n&&n.url&&z({designId:n.designId,url:n.url,prompt:n.prompt,enhancedPrompt:n.enhancedPrompt});try{(m=(d=rt).ctaClicked)==null||m.call(d,c,"ai-tool-v2")}catch{}N(!0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>N(!1),1800),setTimeout(()=>{var C;const x=Y.current;try{x==null||x.scrollIntoView({behavior:"smooth",block:"center"})}catch{}try{(C=E.current)==null||C.focus({preventScroll:!0})}catch{}},60)},O=(n,c)=>{var C,B;if(!n||!c||he)return;ce.listening&&ce.stop();const d=Gi("Type",c,v,L),m=qi(oe,d.label,String(d.value).trim()),x=w?void 0:{anchorImage:{url:n.url,prompt:n.prompt,enhancedPrompt:n.enhancedPrompt}};try{(B=(C=rt).ctaClicked)==null||B.call(C,"type-hint-generate","ai-tool-v2")}catch{}fe(m,x)};(()=>{for(let n=$.length-1;n>=0;n--)if($[n].type==="design")return $[n];return null})(),h.useEffect(()=>{Bt&&Zt.current!==Bt&&(Zt.current=Bt)},[Bt]);const W=$.length===0||$.every(jr),[ue,_e]=h.useState(!1);h.useEffect(()=>{if(t||!W){_e(!1);return}const n=Y.current;if(!n)return;const c=()=>{const m=n.getBoundingClientRect();_e(m.bottom<0)};c();let d=null;return typeof IntersectionObserver<"u"&&(d=new IntersectionObserver(c,{threshold:0}),d.observe(n)),window.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),()=>{d&&d.disconnect(),window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[t,W]);const $e=()=>{var n,c;try{(c=(n=rt).ctaClicked)==null||c.call(n,"composer-recall-bar","ai-tool-v2")}catch{}N(!0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>N(!1),1800),setTimeout(()=>{var m;const d=Y.current;try{d==null||d.scrollIntoView({behavior:"smooth",block:"center"})}catch{}try{(m=E.current)==null||m.focus({preventScroll:!0})}catch{}},60)},Qe=$.filter(n=>n&&n.type==="design").length,ht=W,sr=te&&!he&&(!!oe.trim()||!!Be),vi=e.jsxs("div",{ref:Y,className:`${r.inputWrap} ${M?r.inputWrapPulse:""}`,children:[e.jsx("input",{type:"file",ref:_,accept:"image/*",style:{display:"none"},onChange:Kr}),e.jsxs("div",{className:r.inputRowWrap,children:[e.jsxs("div",{className:r.inputBar,children:[Dt.length>0&&e.jsx("div",{className:r.refStrip,children:Dt.map((n,c)=>e.jsxs("div",{className:r.refThumb,children:[e.jsx("img",{src:n,alt:v.actions.refImageAlt(c+1)}),e.jsx("button",{type:"button",className:r.refThumbRemove,onClick:()=>Ga(c),title:v.actions.removeRefImage,"aria-label":v.actions.removeRefImage,children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,
88children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},c))}),e.jsx("textarea",{ref:E,"data-pd-composer":!0,className:r.chatInput,rows:4,placeholder:w?v.placeholder.editing:Be?v.placeholder.refReady:Re&&Re.name?String(v.placeholder.brand||"Describe a {brand} patchâ¦").replace("{brand}",Re.name):ga||v.placeholder.describe,value:oe,onChange:n=>ne(n.target.value),onKeyDown:Pn,onPaste:qa}),ce.listening&&e.jsxs("div",{className:r.micLive,role:"status",children:[e.jsx("span",{className:r.micLiveDot,"aria-hidden":!0}),e.jsx("span",{className:r.micLiveText,children:ce.interim||v.actions.micListening||"Listening â describe your patchâ¦"})]}),!ce.listening&&(ce.error==="not-allowed"||ce.error==="service-not-allowed")&&e.jsxs("div",{className:r.micError,role:"status",children:[v.actions.micBlocked||"Microphone access is blocked. Open the icon at the left of the address bar, allow the microphone, then try again."," ",e.jsx("a",{className:r.micErrorLink,href:eb(),target:"_blank",rel:"noopener noreferrer",children:v.actions.micBlockedHelp||"How to allow it"})]}),e.jsxs("div",{className:`${r.inputActions}${he?` ${r.inputActionsBusy}`:""}`,children:[e.jsxs("div",{className:r.inputActionsLeft,children:[$.length>0&&e.jsxs("button",{type:"button",className:r.newIconBtn,onClick:Ka,title:v.actions.restart,"aria-label":v.actions.restart,children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("polyline",{points:"1 4 1 10 7 10"}),e.jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),e.jsx("span",{className:r.newIconBtnLabel,children:v.actions.restart})]}),e.jsxs("button",{type:"button",className:`${r.uploadIconBtn} ${Dt.length>0?r.uploadIconBtnReady:""}`,onClick:()=>{var n;return(n=_.current)==null?void 0:n.click()},disabled:ha||Dt.length>=we,title:Dt.length>=we?v.actions.uploadTitleFull||`Maximum ${we} reference images`:Dt.length>0?v.actions.uploadTitleMore||"Add another reference image":v.actions.uploadTitleEmpty,"aria-label":v.actions.uploadAria,children:[ha?e.jsx(Vn,{}):e.jsx(Xy,{}),Dt.length>0&&!ha&&e.jsx("span",{className:r.uploadCountBadge,"aria-hidden":!0,children:Dt.length})]}),ce.supported&&e.jsx("button",{type:"button",className:`${r.uploadIconBtn} ${ce.listening?r.micBtnLive:""}`,onClick:ce.toggle,"aria-pressed":ce.listening,title:ce.listening?v.actions.micStopTitle||"Stop listening":v.actions.micTitle||"Describe your patch out loud","aria-label":ce.listening?v.actions.micStopAria||"Stop voice input":v.actions.micAria||"Start voice input",children:e.jsx(tb,{})}),!t&&!j&&e.jsxs("button",{type:"button",className:r.helpIconBtn,onClick:Xr,title:v.actions.helpTitle||v.actions.help,"aria-label":v.actions.helpTitle||v.actions.help,children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),e.jsx("span",{className:r.helpIconBtnLabel,children:v.actions.help||"Need help?"})]})]}),e.jsxs("button",{className:r.generateBtn,onClick:Ca,disabled:he||!oe.trim()&&!Be,title:v.actions.generateTitle,"aria-label":v.actions.generateAria,children:[e.jsx("span",{className:r.generateBtnLabel,children:he?v.actions.generating:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:r.generateBtnLabelFull,children:v.actions.generate}),e.jsx("span",{className:r.generateBtnLabelShort,children:v.actions.generateShort||v.actions.generate})]})}),e.jsx("span",{className:r.generateBtnArrow,"aria-hidden":"true",children:e.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})})})]}),e.jsx("span",{className:r.srOnly,role:"status","aria-live":"polite",children:sr?v.actions.coachEditThenGenerate||"Edit the text, then press Generate":""}),sr&&e.jsxs("div",{className:r.coachBubble,children:[e.jsxs("span",{className:r.coachBubbleText,"aria-hidden":"true",children:[e.jsx("span",{className:r.coachBubbleTextFull,children:v.actions.coachEditThenGenerate||"Edit the text, then press Generate"}),e.jsx("span",{className:r.coachBubbleTextShort,children:v.actions.coachEditThenGenerateShort||v.actions.coachEditThenGenerate||"Edit the text, then press Go"})]}),e.jsx("button",{type:"button",className:r.coachBubbleClose,onClick:()=>A(!1),"aria-label":v.actions.coachDismiss||"Dismiss",children:e.jsx("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round","aria-hidden":!0,
88children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]})]})]}),e.jsxs("div",{className:r.inputAurora,"aria-hidden":"true",children:[e.jsx("span",{className:`${r.auroraBlob} ${r.auroraBlobA}`}),e.jsx("span",{className:`${r.auroraBlob} ${r.auroraBlobB}`}),e.jsx("span",{className:`${r.auroraBlob} ${r.auroraBlobC}`})]})]})]}),Si=(n,c=!1)=>e.jsx(kb,{sessionId:Ze,sessionClientKey:t&&Ie||"main",ourPromises:Ae,design:n,editingThis:w!=null&&w.designId?w.designId===n.designId:(w==null?void 0:w.url)===n.url,onExitFocus:()=>z(null),busy:tr===n.url,authUser:de,showRail:!0,isLatest:n.designId===Bt,isOrderTarget:n.designId===oa,onChooseForOrder:()=>an(n),onContinueFrom:()=>rn(n),onEditHere:()=>f(n),onRegenerateType:d=>O(n,d),onGuideType:()=>f(n,"type-hint-guide"),config:H,setConfig:We,referenceWebsite:Ue,setReferenceWebsite:xt,brandContext:Ne,brandLoading:nt,brandError:Oa,selectedEdits:rr,railCollapsed:nr,onToggleRail:Nr,parkerSrc:be,embedConfig:t?k:null,embedMode:t,hostPageUrl:a,partnerId:g,featureFlags:b,onZoom:Je,onSaveBlocked:wa,onDownload:()=>xa(n),onSave:()=>Dr(n),onOrder:()=>Va(n),onReviewOrder:d=>Va(n,d),onQuickEdit:d=>Bn(n,d),onRailChange:Vr,onShareResolveUrl:Jr,onLogShare:d=>vr("share",n.designId,d),onTryOn:(d,m,x)=>{const C=fa.find(B=>B.id===d);C&&Qt({garment:C,design:n,widthIn:m,heightIn:x})},onSaveToLibrary:y?()=>y(n):null,onView360:Da,orgContext:j,orgEventName:P,t:v,localizedGarments:fa,compact:c},n.designId),uo=$.some(n=>n&&n.type==="design"),$n=(()=>{let n=-1;for(let c=$.length-1;c>=0;c--)if($[c]&&$[c].type==="design"){n=c;break}for(let c=n-1;c>=0;c--){const d=$[c];if(d&&d.role==="user")return d.type==="ref-image"||d.type==="brand-ref"||typeof d.content!="string"?-1:c}return-1})(),nn=$.filter(n=>n.type==="design"&&n.designId!==oa),Mn=nn.length?nn[nn.length-1].designId:null,po=Mn?$.findIndex(n=>n.type==="design"&&n.designId===Mn):-1,ji={kit:t&&k&&k.brandKit&&!Vt?k.brandKit:null,lockedBrand:Re,brandLinkDead:Ma,tenantName:k&&(k.brandName||k.name)||"",off:pa,setOff:$a,pausedFor:Ne&&Ne.success&&Ne.source==="guidelines"&&Ne.name||""};return e.jsx(Nn.Provider,{value:ji,children:e.jsxs("div",{className:r.page,style:j?{minHeight:0,paddingBottom:16}:void 0,children:[!t&&u,!t&&e.jsxs("div",{className:`${r.hero}${uo?` ${r.heroTucked}`:""}`,children:[e.jsx("h1",{className:r.heroTitle,children:v.hero.title}),e.jsx("p",{className:r.heroSubtitle,children:v.hero.subtitle})]}),ue&&typeof document<"u"&&yn.createPortal(e.jsxs("button",{type:"button",className:r.askBar,onClick:$e,children:[e.jsx("span",{className:r.askBarIcon,"aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),e.jsx("span",{className:r.askBarLabel,children:((_i=v.askBar)==null?void 0:_i.label)||"Describe your patch"}),e.jsx("span",{className:r.askBarArrow,"aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 19V5M6 11l6-6 6 6"})})})]}),document.body),ki&&e.jsx("div",{className:r.retryReloadOverlay,role:"status","aria-live":"polite",children:e.jsxs("div",{className:r.retryReloadCard,children:[e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",className:r.errorAutoRetrySpinner,"aria-hidden":!0,children:[e.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.36L21 8"}),e.jsx("path",{d:"M21 3v5h-5"}),e.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.36L3 16"}),e.jsx("path",{d:"M3 21v-5h5"})]}),e.jsxs("div",{children:[e.jsx("div",{className:r.retryReloadTitle,children:v.reloading.title}),e.jsx("div",{className:r.retryReloadSub,children:v.reloading.sub})]})]})}),e.jsxs("div",{className:`${r.chatShell}${$.length===0||$.every(jr)?" "+r.chatShellEmpty:""}`,children:[Oe&&($.length===0||$.every(jr))&&e.jsx("div",{className:r.startLang,children:e.jsx(Jn,{})}),e.jsxs("div",{className:r.messagesArea,ref:F,children:[$.length===0||$.every(jr)?e.jsxs("div",{className:`${r.emptyStateRow} ${nr?r.emptyStateRowFolded:""} ${nr&&ht?r.emptyStateRowTabAtInput:""}`,children:[e.jsxs("div",{className:r.emptyLeftCol,children:[e.jsxs("div",{className:r.chatEmpty,children:[Re&&e.jsx(sy,{t:v,brand:Re,tenantName:ji.tenantName}),!Re&&De.image&&e.jsx("div",{className:`${r.parkerOrbFrame} ${r.parkerOrbFrameIdle}
88`,"aria-hidden":!0,children:e.jsx("img",{src:De.image,alt:De.alt,className:`${r.parkerOrb} ${t&&(k!=null&&k.logoUrl)||o&&o.logoSrc?r.parkerOrbPartner:""}`})}),!Re&&De.title&&e.jsx("h2",{children:De.title}),!Re&&(!t||!(k!=null&&k.hideGreetingSubtitle))&&e.jsx(e.Fragment,{children:e.jsx("p",{className:r.introLine,children:t&&k&&k.chatSubtitle?k.chatSubtitle:v.greeting.intro})}),$.some(jr)&&e.jsx("div",{className:r.emptyStateRefPreview,children:$.filter(jr).map((n,c)=>n.type==="brand-ref"?e.jsx(ss,{msg:n,t:v},c):e.jsxs("div",{className:r.refImgPreview,children:[e.jsx("span",{className:r.refImgLabel,children:v.greeting.uploadedRef}),e.jsx("img",{src:n.content,alt:v.greeting.refAlt,className:r.chatImgThumb})]},c))})]}),ht&&vi,W&&Re&&e.jsx("div",{className:r.fsPromptChips,children:oy(v,Re.name||"").map(n=>e.jsx("button",{type:"button",className:r.fsPromptChip,disabled:he,onClick:()=>xr(n.prompt),title:n.prompt,children:n.label},n.label))}),W&&!Re&&Fe.length>0&&e.jsx(pb,{prompts:Fe,disabled:he,onPick:n=>fe(n)}),W&&e.jsx(xs,{t:v,pool:tt,showTrust:Ae,pills:ye,hideExamples:ja,onUsePrompt:xr})]}),Ke&&(nr?e.jsxs("button",{type:"button",className:r.railReopen,onClick:Nr,title:v.affordance.showGuidance,"aria-label":v.affordance.showGuidance,children:[e.jsx("span",{className:r.railReopenTri,"aria-hidden":!0,children:e.jsx(bi,{size:12})}),e.jsx("span",{className:r.railReopenLabel,children:v.affordance.designGuidance})]}):e.jsx(ii,{config:H,setConfig:We,onRailChange:Vr,busy:he,onOrder:()=>{},onQuickEdit:()=>{},selectedEdits:rr,onCollapse:Nr,referenceWebsite:Ue,setReferenceWebsite:xt,brandContext:Ne,brandLoading:nt,brandError:Oa,hideQuoteCard:!0,embedConfig:t?k:null,ourPromises:Ae,t:v}))]}):e.jsxs(Ya,{initial:!1,children:[Sr&&e.jsxs(Pe.div,{className:r.designMsg,initial:{opacity:0}
88,animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},children:[e.jsx("img",{src:be,alt:"",className:r.avatar}),e.jsxs("button",{type:"button",className:r.focusHistoryRow,onClick:()=>z(null),children:[e.jsx("span",{className:r.focusHistoryIcon,"aria-hidden":!0,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M4 6h16M4 12h16M4 18h10"})})}),e.jsx("span",{className:r.focusHistoryText,children:((Ti=v.designCard)==null?void 0:Ti.otherHistory)||"Other designs and chat history"}),e.jsx("span",{className:r.focusHistoryHint,children:((Ii=v.designCard)==null?void 0:Ii.otherHistoryHint)||"open to edit other design versions"})]})]},"focus-history"),$.map((n,c)=>Sr&&!(n.type==="design"&&n.designId===Sr)||c<po&&n.type!=="design"&&!(n.type==="micro-survey"&&!n.answered)?null:n.type==="design"?Sr||n.designId===oa?Si(n):n.designId===Mn?e.jsx(bb,{parkerSrc:be,t:v,children:nn.slice().reverse().map(d=>Si(d,!0))},"earlier-designs"):null:n.type==="rail-change"?e.jsx(Pe.div,{className:`${r.messageRow} ${r.messageRowUser}`,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2},children:e.jsxs("div",{className:r.railChangePill,children:[e.jsx(ro,{}),e.jsx("span",{children:n.content})]})},c):n.type==="brand-question"?e.jsxs(Pe.div,{className:r.messageRow,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.25},children:[e.jsx("img",{src:be,alt:"",className:r.avatar}),e.jsxs("div",{className:`${r.messageBubble} ${r.messageAssistant} ${r.brandQuestionCard}`,children:[e.jsx("p",{className:r.brandQuestionAsk,children:n.ask}),(()=>{const d=st&&st.question.id===n.questionId,m=d?st.awaitingText:null;return m?e.jsx(ws,{placeholder:m.needsText,onSubmit:Rn,t:v}):e.jsx("div",{className:r.brandQuestionOptions,children:(n.options||[]).map(x=>e.jsx("button",{type:"button",className:r.brandQuestionBtn,onClick:()=>wr(x),disabled:!d,children:x.label},x.label))})})()]})]},c):n.type==="shape-question"?e.jsxs(Pe.div,{className:r.messageRow,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.25},children:[e.jsx("img",{src:be,alt:"",className:r.avatar}),e.jsxs("div",{className:`${r.messageBubble} ${r.messageAssistant} ${r.brandQuestionCard}`,children:[e.jsx("p",{className:r.brandQuestionAsk,children:n.ask}),(()=>{const d=ot&&ot.question.id===n.questionId,m=d?ot.awaitingText:null;return m?e.jsx(ws,{placeholder:m.needsText,onSubmit:kr,t:v}):e.jsx("div",{className:r.brandQuestionOptions,children:(n.options||[]).map(x=>e.jsx("button",{type:"button",className:r.brandQuestionBtn,onClick:()=>En(x),disabled:!d,children:x.label},x.id||x.label))})})()]})]},c):n.type==="error"?e.jsxs(Pe.div,{className:r.messageRow,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.25},children:[e.jsx("img",{src:be,alt:"",className:r.avatar,style:{alignSelf:"flex-start",marginTop:2}}),e.jsxs("div",{className:`${r.messageBubble} ${r.messageAssistant} ${r.errorCard}`,children:[e.jsx("p",{className:r.errorFriendly,children:n.friendly}),n.autoRetryAt&&n.autoRetryAt>Date.now()&&e.jsxs("p",{className:r.errorAutoRetryNote,role:"status","aria-live":"polite",children:[e.jsx("span",{className:r.errorAutoRetryDot,"aria-hidden":!0}),v.errors.autoRetrying(n.autoRetryAttempt,n.autoRetryTotal)]}),!(n.autoRetryAt&&n.autoRetryAt>Date.now())&&n.priorAutoRetries>0&&e.jsxs("p",{className:r.errorPriorRetriesNote,role:"status",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.36L21 8"}),e.jsx("path",{d:"M21 3v5h-5"}),e.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.36L3 16"}),e.jsx("path",{d:"M3 21v-5h5"})]}),v.errors.priorAuto(n.priorAutoRetries)]}),e.jsxs("div",{className:r.errorActions,children:[n.autoRetryAt&&n.autoRetryAt>Date.now()?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:r.errorRetryBtn,disabled:!0,"aria-live":"polite",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",className:r.errorAutoRetrySpinner,children:[e.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.36L21 8"}),e.jsx("path",{d:"M21 3v5h-5"}),e.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.36L3 16"}),e.jsx("path",{d:"M3 21v-5h5"})]}),e.jsx("span",{children:v.errors.autoRetryIn(Math.max(1,Math.ceil((n.autoRetryAt-Date.now())/1e3)))})]}),e.jsx("button",{type:"button",className:r.errorCancelBtn,onClick:()=>xi(n.errorId),children:v.errors.cancel})]}):e.jsxs("button",{type:"button",className:r.errorRetryBtn,onClick:()=>Br(n),disabled:he,children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.36L21 8"}),e.jsx("path",{d:"M21 3v5h-5"}),e.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.36L3 16"}),e.jsx("path",{d:"M3 21v-5h5"})]}),e.jsx("span",{children:v.errors.tryAgain})]}),n.code&&e.jsxs("span",{className:r.errorCode,children:[v.errors.ref," ",n.code]}),!t&&e.jsx("a",{href:`mailto:[email protected]?subject=${encodeURIComponent(v.errors.reportSubject(n.code))}&body=${encodeURIComponent(v.errors.reportBody(n.code))}`,className:r.errorReportLink,children:v.errors.reportThis})]}),Ae&&!(n.autoRetryAt&&n.autoRetryAt>Date.now())&&n.retry&&e.jsx(Ab,{retry:n.retry,errorCode:n.code,embedMode:t,embedClientKey:Ie,t:v})]})]},c):n.type==="rate-limit"?e.jsxs(Pe.div,{className:r.messageRow,initial:{opacity:0,y:10}
88,animate:{opacity:1,y:0},transition:{duration:.25},children:[e.jsx("img",{src:be,alt:"",className:r.avatar}),e.jsx(ob,{msg:n,t:v,embedMode:t,ourPromises:Ae,onSignInWith:yr,hasDesign:$.some(d=>d.type==="design"),designUrls:$.filter(d=>d.type==="design").map(d=>d.hostedUrl||d.url).filter(d=>typeof d=="string"&&/^https?:\/\//i.test(d)),primaryDataUrl:(()=>{const d=$.filter(x=>x.type==="design"),m=d[d.length-1];return m&&typeof m.url=="string"&&m.url.startsWith("data:image/")?m.url:""})(),transcriptId:(()=>{const d=$.filter(x=>x.type==="design"),m=d[d.length-1];return m&&m.transcriptId||""})(),onGetItMade:()=>{const d=$.filter(x=>x.type==="design"),m=d.find(x=>x.designId===Bt)||d[d.length-1];m&&Va(m)}})]},c):n.type==="brand-answer"||n.type==="shape-answer"?e.jsx(Pe.div,{className:`${r.messageRow} ${r.messageRowUser}`,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2},children:e.jsx("div",{className:`${r.messageBubble} ${r.messageUser}`,children:e.jsx("span",{children:n.content})})},c):n.type==="micro-survey"?e.jsx(Pe.div,{className:`${r.messageRow} ${r.microSurveyRow}`,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.25},children:e.jsx(xb,{msg:n,embedMode:t,onSubmit:(d,m,x)=>$r(n.surveyId,d,m,x),onApplyAsEdit:d=>Mr(n.surveyId,d),t:v})},c):e.jsxs(Pe.div,{className:`${r.messageRow} ${n.role==="user"?r.messageRowUser:""}${c===$n?` ${r.messageRowOneLine}`:""}`,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.25},children:[n.role==="assistant"&&e.jsx("img",{src:be,alt:"",className:r.avatar}),e.jsx("div",{className:`${r.messageBubble} ${n.role==="user"?r.messageUser:r.messageAssistant}${c===$n?` ${r.messageBubbleOneLine}`:""}`,title:c===$n?Qi(n.content,v):void 0,children:n.type==="ref-image"?e.jsxs("div",{className:r.refImgPreview,children:[e.jsx("span",{className:r.refImgLabel,children:v.greeting.uploadedRef}),e.jsx("img",{src:n.content,alt:v.greeting.refAlt,className:r.chatImgThumb})]}):n.type==="brand-ref"?e.jsx(ss,{msg:n,t:v}):e.jsx("span",{children:Qi(n.content,v)})})]},c))]}),he&&e.jsxs(e.Fragment,{children:[e.jsxs(Pe.div,{"data-loading-row":!0,className:r.messageRow,initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:[e.jsxs("span",{className:`${r.avatarFrame} ${r.avatarFrameBusy}`,"aria-hidden":!0,style:{alignSelf:"flex-start",marginTop:2},children:[e.jsx("img",{src:be,alt:"",className:r.avatar}),e.jsx(ks,{})]}),e.jsxs("div",{className:r.loadingStack,children:[e.jsxs("div",{className:r.loadingBubble,children:[e.jsx("span",{className:r.loadingTextRainbow,children:v.loading.designing}),e.jsxs("span",{className:r.loadingPercent,"aria-live":"polite",children:[Ct,"%"]}),e.jsx("button",{type:"button",onClick:Ha,"aria-label":v.loading&&v.loading.stop||"Stop generating",title:v.loading&&v.loading.stop||"Stop",style:{flex:"0 0 auto",display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,marginLeft:2,padding:0,background:"#9ca3af",border:"none",borderRadius:999,color:"#fff",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.18)"},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2"})})})]}),e.jsx("div",{className:r.loadingProgressTrack,role:"progressbar","aria-valuenow":Ct,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:r.loadingProgressFill,style:{width:`${Ct}%`}})}),e.jsx(cb,{locale:L,ourOffer:Ae,iteration:Qe+1,hasPhoto:!!Be||Array.isArray(ve)&&ve.length>0,isLarge:Math.max(parseFloat(H==null?void 0:H.width)||0,parseFloat(H==null?void 0:H.height)||0)>6})]})]}),e.jsxs("div",{className:r.loadingExtras,children:[Ae&&e.jsx(hb,{t:v,couponLabel:Ut.label[L]||Ut.label.en}),!Ae&&ye.length>0&&e.jsx("div",{className:r.loadingBadges,children:ye.map(n=>e.jsxs("span",{className:`${r.loadingBadge}${n.length>24?" "+r.loadingBadgeWide:""}`,children:[co,n]},n))}),de===null&&!t&&!j&&e.jsx(db,{t:v,onSignInWith:yr}),e.jsx("div",{className:$.some(n=>n&&n.type==="design")?r.fsShowcaseRepeat:void 0,children:e.jsx(xs,{t:v,pool:tt,showTrust:Ae,hideExamples:ja,onUsePrompt:xr})})]})]}),ha&&!he&&e.jsxs(Pe.div,{className:r.messageRow,initial:{opacity:0,y:10}
88,animate:{opacity:1,y:0},children:[e.jsxs("span",{className:`${r.avatarFrame} ${r.avatarFrameBusy}`,"aria-hidden":!0,children:[e.jsx("img",{src:be,alt:"",className:r.avatar}),e.jsx(ks,{})]}),e.jsx("div",{className:r.loadingBubble,children:e.jsx("span",{children:v.loading.reading})})]})]}),!ht&&vi]}),e.jsxs("p",{className:r.disclaimer,style:{textAlign:"left"},children:[e.jsx("span",{"aria-hidden":!0,style:{marginRight:6},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,style:{display:"inline-block",verticalAlign:"-1px"},children:e.jsx("path",{d:"M12 2 L13.5 9.5 L21 11 L13.5 12.5 L12 20 L10.5 12.5 L3 11 L10.5 9.5 Z"})})}),Ae?v.disclaimers[0]:v.previewNote,v.disclaimerLink&&!t&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:v.disclaimerLink.href,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:v.disclaimerLink.text})]})]}),!t&&e.jsxs("p",{className:r.disclaimer,style:{textAlign:"left",marginTop:0},children:[e.jsx("span",{"aria-hidden":!0,style:{marginRight:6},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,style:{display:"inline-block",verticalAlign:"-1px"},children:e.jsx("path",{d:"M12 2 L13.5 9.5 L21 11 L13.5 12.5 L12 20 L10.5 12.5 L3 11 L10.5 9.5 Z"})})}),v.disclaimers[1].map((n,c)=>typeof n=="string"?e.jsx("span",{children:n},c):e.jsx("a",{href:`mailto:${n.mail}`,style:{color:"inherit",textDecoration:"underline"},children:n.mail},c))]}),l,!t&&!j&&e.jsx("div",{style:{textAlign:"center",margin:"20px auto 4px",padding:"0 16px"},children:e.jsxs("a",{href:"https://www.trustpilot.com/review/patchdesign.ai",target:"_blank",rel:"noopener noreferrer","aria-label":v.trustpilot.aria,style:{display:"inline-flex",alignItems:"center",gap:10,background:"#ffffff",color:"#191919",padding:"10px 18px",borderRadius:999,fontSize:"0.92rem",fontWeight:600,textDecoration:"none",border:"1px solid rgba(15, 23, 42, 0.12)",boxShadow:"0 2px 8px rgba(15, 23, 42, 0.06)",transition:"transform 150ms ease, box-shadow 150ms ease"},onMouseEnter:n=>{n.currentTarget.style.transform="translateY(-1px)",n.currentTarget.style.boxShadow="0 6px 16px rgba(15, 23, 42, 0.10)"},onMouseLeave:n=>{n.currentTarget.style.transform="",n.currentTarget.style.boxShadow="0 2px 8px rgba(15, 23, 42, 0.06)"},children:[e.jsx("span",{children:v.trustpilot.rate}),e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.jsx("rect",{width:"24",height:"24",rx:"3",fill:"#00b67a"}),e.jsx("path",{d:"M12 5.2l1.97 4.34 4.78.46-3.6 3.18 1.07 4.65L12 15.3l-4.22 2.53 1.07-4.65-3.6-3.18 4.78-.46L12 5.2z",fill:"#fff"})]}),e.jsx("span",{style:{color:"#191919",fontWeight:700},children:"Trustpilot"})]})}),!t&&!j&&e.jsx("div",{style:{padding:"10px 16px 28px"},children:e.jsxs("a",{href:"/design-vs-production",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:14,maxWidth:560,margin:"0 auto",padding:"12px 16px",background:"var(--color-bg-alt, #f6f2ff)",border:"1px solid rgba(124,58,237,0.18)",borderRadius:14,textDecoration:"none",color:"inherit"},children:[e.jsxs("span",{"aria-hidden":!0,style:{position:"relative",flexShrink:0,width:64,height:64,borderRadius:10,overflow:"hidden",background:"linear-gradient(160deg,#fff,#f1ecff)",border:"1px solid rgba(17,24,39,0.08)"},children:[e.jsx("img",{src:da("/patches/showcase/handwriting-eagle.webp"),alt:"",loading:"lazy",decoding:"async",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain"}}),e.jsx("span",{style:{position:"absolute",inset:0,clipPath:"inset(0 0 0 50%)"},children:e.jsx("img",{src:da("/patches/showcase/embroidered.webp"),alt:"",loading:"lazy",decoding:"async",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain"}})}),e.jsx("span",{style:{position:"absolute",top:0,bottom:0,left:"50%",width:1,background:"rgba(255,255,255,0.9)",boxShadow:"0 0 0 1px rgba(17,24,39,0.15)"}})]}),e.jsxs("span",{style:{minWidth:0},children:[e.jsx("span",{style:{display:"block",fontWeight:700,fontSize:"0.92rem",lineHeight:1.3},children:v.seeItMade.title}),e.jsx("span",{style:{display:"block",marginTop:3,fontSize:"0.8rem",lineHeight:1.45,color:"var(--color-text-light)"},children:v.seeItMade.body})]}),e.jsx("span",{"aria-hidden":!0,style:{marginLeft:"auto",color:"var(--color-primary)",flexShrink:0},children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})})]})}),e.jsx(Ya,{children:Ve&&e.jsxs(Pe.div,{className:r.zoomOverlay,initial:{opacity:0}
88,animate:{opacity:1},exit:{opacity:0},onClick:()=>Je(null),children:[e.jsx("button",{type:"button",className:r.zoomCloseBtn,onClick:n=>{n.stopPropagation(),Je(null)},"aria-label":v.zoom.close,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),typeof Ve=="string"?e.jsx(Pe.img,{src:Ve,alt:v.zoom.alt,className:r.zoomImage,initial:{scale:.9},animate:{scale:1},exit:{scale:.9},onClick:n=>n.stopPropagation(),...Pa(wa)}):Ve.type==="tryon"?e.jsx(Lb,{data:Ve,onSaveBlocked:(n,c)=>wa(n,Ve.design,{...Ve,fittedUrl:c}),t:v}):null,e.jsx("div",{className:r.zoomNote,children:v.zoom.threadNote}),e.jsx("div",{className:r.zoomHint,children:v.zoom.hint})]})}),e.jsx(Ya,{children:St&&(()=>{var B,X,je;const n=St,c=hr(n.material),d=ar,m=v.view360||et.en.view360,x=((v.patchTypeOptions||[]).find(ke=>ke.value===n.material)||{}).label||n.material||((B=Gt[c])==null?void 0:B.label)||"",C=m.backs&&m.backs[d.back]||"";return e.jsx(h.Suspense,{fallback:null,children:e.jsx(cy,{src:Ea(n.design),fallbackSrc:((X=n.design)==null?void 0:X.url)||"",spec:d,sizeIn:Math.max(n.widthIn||3,n.heightIn||3),title:m.title,subtitle:[x,C].filter(Boolean).join(" · "),copy:m,onClose:()=>Da(null)},`${((je=n.design)==null?void 0:je.url)||""}|${c}|${d.back}`)})})()}),e.jsx(Ya,{children:at&&(()=>{const{widthIn:n,heightIn:c}=Sn(at),d=Xs(fa,n,c);return e.jsx(Cb,{data:at,garments:d,t:v,onPrev:()=>{const m=d.findIndex(C=>C.id===at.garment.id),x=d[(m-1+d.length)%d.length];Qt({...at,garment:x})},onNext:()=>{const m=d.findIndex(C=>C.id===at.garment.id),x=d[(m+1)%d.length];Qt({...at,garment:x})},onClose:()=>Qt(null),onSaveBlocked:(m,x)=>wa(m,at.design,{...at,fittedUrl:x}),onDownload:m=>Qr(at,m),onZoom:()=>Je({...at,type:"tryon"})})})()}),e.jsx(Vo,{isOpen:Ba,onClose:()=>ze(!1),prefill:Sa,designConfig:H,clientKey:t?Ie:null,partnerName:t&&k&&(k.logoText||k.brandName||k.name)||null,partnerId:g||null,transcriptId:Ze,palette:jt,paletteAccuracy:Et,getPaletteAccuracy:async()=>{const n=Jt.current;if(!n)return Array.isArray(Et)?Et:[];const c=new Promise(m=>setTimeout(()=>m(null),3e4)),d=await Promise.race([n,c]);return d===null?Array.isArray(Et)?Et:[]:Array.isArray(d)?d:[]},embedConfig:t?k:null,orgContext:j,onSubmitForReview:T}),On&&e.jsx(Zl,{onClose:()=>Zr(!1),t:v.help,context:en(),defaultNeed:oe,defaultEmail:(de==null?void 0:de.email)||""}),!t&&!j&&e.jsx(ec,{enabled:!Pt&&$.some(n=>n&&n.type==="design"&&n.url),designs:$.filter(n=>n&&n.type==="design").map(n=>n.hostedUrl||n.url).filter(n=>typeof n=="string"&&/^https?:\/\//i.test(n)),primaryDataUrl:(()=>{const n=$.filter(d=>d&&d.type==="design"),c=n[n.length-1];return c&&typeof c.url=="string"&&c.url.startsWith("data:image/")?c.url:""})(),transcriptId:(()=>{const n=$.filter(d=>d&&d.type==="design"),c=n[n.length-1];return c&&c.transcriptId||""})()}),e.jsxs(Ya,{children:[Nt&&e.jsxs(Pe.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},style:{position:"fixed",top:72,left:16,right:16,margin:"0 auto",maxWidth:"fit-content",background:Nt==="saved"?"#22c55e":Nt==="error"?"#ef4444":"#6366f1",color:"white",padding:"12px 20px",borderRadius:16,fontWeight:600,fontSize:"0.88rem",zIndex:9999,boxShadow:"0 8px 28px rgba(0,0,0,0.3)",lineHeight:1.35,display:"inline-flex",alignItems:"center",gap:8,textAlign:"center"},children:[Nt==="saving"&&e.jsxs(e.Fragment,{children:[e.jsx(Vn,{})," ",v.toast.saving]}),Nt==="saved"&&e.jsxs(e.Fragment,{children:[e.jsx(ds,{})," ",v.toast.saved]}),Nt==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(hs,{})," ",v.toast.saveErr]})]}),na&&e.jsxs(Pe.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},style:{position:"fixed",top:Nt?124:72,left:16,right:16,margin:"0 auto",maxWidth:"fit-content",background:na==="success"?"#22c55e":na==="error"?"#ef4444":"#6366f1",color:"white",padding:"12px 20px",borderRadius:16,fontWeight:600,fontSize:"0.88rem",zIndex:9999,boxShadow:"0 8px 28px rgba(0,0,0,0.3)",lineHeight:1.35,display:"inline-flex",alignItems:"center",gap:8,textAlign:"center"},children:[na==="downloading"&&e.jsxs(e.Fragment,{children:[e.jsx(Vn,{})," ",v.toast.downloading]}),na==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(ds,{})," ",v.toast.downloadOk]}),na==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(hs,{})," ",v.toast.downloadErr]})]},"download-toast"),Kt&&(()=>{const n=Kt.design,c=Kt.tryOn,d=!!(n&&n.url),m=!!(j&&y),x=d?c?v.toast.saveBlockedTryOn??"Download this image":m?P?`Save to ${P}`:"Save to your organization library":!Pt&&!t?v.toast.saveBlockedSignin??"Sign in to download":v.toast.saveBlockedDownload??"Download this design":v.toast.saveBlocked??"Use the Download button to save your design";return e.jsxs(Pe.button,{ref:Yt,type:"button",disabled:!d,onClick:()=>{Rt.current&&clearTimeout(Rt.current),Fa(null),c?Qr(c,c.fittedUrl):m?y(n):xa(n)},initial:{opacity:0,scale:.94}
88,animate:{opacity:1,scale:1},exit:{opacity:0,scale:.94},transition:{duration:.15},style:{position:"fixed",left:ba?ba.left:0,top:ba?ba.top:0,visibility:ba?"visible":"hidden",maxWidth:"min(320px, calc(100vw - 24px))",background:"#4c1d95",color:"white",padding:"11px 17px",borderRadius:14,zIndex:1e4,boxShadow:"0 10px 30px rgba(0,0,0,0.4)",lineHeight:1.35,display:"inline-flex",alignItems:"center",gap:8,textAlign:"left",border:"none",fontFamily:"inherit",fontWeight:600,fontSize:"0.85rem",cursor:d?"pointer":"default",pointerEvents:d?"auto":"none"},children:[e.jsx("span",{style:{flexShrink:0,display:"inline-flex"},children:e.jsx(Oy,{})}),x]},"save-blocked-toast")})(),ya&&e.jsxs(Pe.button,{type:"button",initial:{opacity:0,y:-20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},onClick:()=>{const n=ya;$t(null);try{const d=/^https:\/\//i.test(n)?Za(`/api/download-image?url=${encodeURIComponent(n)}&filename=patch-design.png${Lr()}`):n,m=document.createElement("a");m.href=d,m.download="patch-design.png",m.rel="noopener",document.body.appendChild(m),m.click(),document.body.removeChild(m),it("success"),setTimeout(()=>it(null),2500)}catch(c){console.warn("[pendingDownload] tap failed:",c),it("error"),setTimeout(()=>it(null),3500)}},style:{position:"fixed",top:72,left:12,right:12,marginInline:"auto",width:"fit-content",maxWidth:"calc(100vw - 24px)",background:"#7c3aed",color:"white",padding:"12px 24px",borderRadius:999,fontWeight:600,fontSize:"0.92rem",zIndex:9999,boxShadow:"0 8px 28px rgba(0,0,0,0.3)",textAlign:"left",lineHeight:1.3,display:"inline-flex",alignItems:"center",gap:8,border:"none",cursor:"pointer"},children:[e.jsx(yi,{})," ",v.toast.downloadTap]},"pending-download-tap")]}),!t&&p]})})}function ws({placeholder:t,onSubmit:a,t:s}){s=s||et.en;const[i,o]=h.useState(""),l=h.useRef(null);h.useEffect(()=>{var p;(p=l.current)==null||p.focus()},[]);const u=()=>a(i);return e.jsxs("div",{className:r.brandQuestionInputRow,children:[e.jsx("input",{ref:l,type:"text",className:r.brandQuestionInput,placeholder:t,value:i,onChange:p=>o(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),u())}}),e.jsx("button",{type:"button",className:r.brandQuestionSubmit,onClick:u,"aria-label":s.confirm,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.8",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]})}function ks(){const t=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("path",{d:"M12 0 L14 10 L24 12 L14 14 L12 24 L10 14 L0 12 L10 10 Z"})});return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`${r.sparkle} ${r.sparkle1}`,children:e.jsx(t,{})}),e.jsx("span",{className:`${r.sparkle} ${r.sparkle2}`,children:e.jsx(t,{})}),e.jsx("span",{className:`${r.sparkle} ${r.sparkle3}`,children:e.jsx(t,{})}),e.jsx("span",{className:`${r.sparkle} ${r.sparkle4}`,children:e.jsx(t,{})}),e.jsx("span",{className:`${r.sparkle} ${r.sparkle5}`,children:e.jsx(t,{})})]})}function cb({locale:t,iteration:a,hasPhoto:s,isLarge:i,ourOffer:o=!0}){const l=h.useMemo(()=>Vl({locale:t,iteration:a,ourOffer:o}),[t,a,s,i,o]),[u,p]=h.useState(0);return h.useEffect(()=>{if(p(0),l.length<=1)return;const g=setInterval(()=>p(b=>(b+1)%l.length),4500);return()=>clearInterval(g)},[l]),l.length?e.jsx("span",{className:r.loadingBeat,"aria-hidden":"true",children:e.jsx(Ya,{mode:"wait",children:e.jsx(Pe.span,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.3},style:{display:"inline-block"},children:l[u]},u)})}):null}function db({t,onSignInWith:a}){const s=t&&t.loading||{},i=t&&t.rateLimit||{},o=typeof i.continueWith=="function"?i.continueWith:p=>`Continue with ${p}`,l=s.signInTitle,u=s.signInSub;return e.jsxs("div",{className:r.loadingSignIn,children:[l&&e.jsx("p",{className:r.loadingSignInTitle,children:l}),u&&e.jsx("p",{className:r.loadingSignInSub,children:u}),e.jsxs("div",{className:r.rateLimitProviders,children:[e.jsxs("button",{type:"button",className:r.rateLimitProviderBtn,onClick:()=>a("oauth_google"),"aria-label":o("Google"),title:o("Google"),children:[e.jsx(so,{}),e.jsx("span",{children:"Google"})]}),e.jsxs("button",{type:"button",className:r.rateLimitProviderBtn,onClick:()=>a("oauth_facebook"),"aria-label":o("Facebook"),title:o("Facebook"),children:[e.jsx(oo,{}),e.jsx("span",{children:"Facebook"})]}),e.jsxs("button",{type:"button",className:r.rateLimitProviderBtn,onClick:()=>a("oauth_microsoft"),"aria-label":o("Microsoft"),title:o("Microsoft"),children:[e.jsx(lo,{}),e.jsx("span",{children:"Microsoft"})]})]})]})}function hb({t,couponLabel:a}){const s=t&&t.wait||{}
88,i=(Array.isArray(s.badges)?s.badges:[]).filter(Boolean),[o,l]=h.useState(!1),u=()=>{try{typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(Ut.code),l(!0),setTimeout(()=>l(!1),1800)}catch{}};return i.length,e.jsxs("div",{className:r.loadingBadges,children:[i.map((p,g)=>e.jsxs("span",{className:`${r.loadingBadge}${p.length>24?" "+r.loadingBadgeWide:""}`,children:[Tn[g%Tn.length],p]},g)),e.jsxs("button",{type:"button",className:`${r.loadingBadge} ${r.loadingBadgeCoupon}`,onClick:u,title:s.couponCopy||"Copy","aria-label":`${a||""} - ${s.couponCopy||"Copy"} ${Ut.code}`,children:[e.jsxs("span",{className:r.loadingBadgeCouponTop,children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0},children:[e.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),e.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),a&&e.jsx("span",{children:a})]}),e.jsxs("span",{className:r.loadingBadgeCodeWrap,children:[e.jsx("span",{className:r.loadingBadgeCode,children:o?s.couponCopied||"Copied":Ut.code}),!o&&e.jsx("span",{className:r.loadingBadgeCodeHint,children:s.couponCopyHint||"copy"})]})]})]})}const Tn=[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M5 18H3c-.6 0-1-.4-1-1V7c0-.6.4-1 1-1h10c.6 0 1 .4 1 1v11"}),e.jsx("path",{d:"M14 9h4l4 4v4c0 .6-.4 1-1 1h-2"}),e.jsx("circle",{cx:"7",cy:"18",r:"2"}),e.jsx("path",{d:"M15 18H9"}),e.jsx("circle",{cx:"17",cy:"18",r:"2"})]},"t"),e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6l7-3z"}),e.jsx("path",{d:"M9 12l2 2 4-4"})]},"s"),e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]},"e"),e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("polyline",{points:"12 7 12 12 15 14"})]},"c")],co=e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M8.5 12.5l2.5 2.5 4.5-5"})]});function ub(t,a){if(!t||!a)return mn;const s=String(a.showcaseMode||"").toLowerCase();if(s==="off")return[];if(s==="custom"){const i=(Array.isArray(a.showcaseItems)?a.showcaseItems:[]).filter(o=>o&&typeof o.image=="string"&&o.image&&typeof o.prompt=="string"&&o.prompt);return i.length?i:mn}return mn}function pb({prompts:t,disabled:a,onPick:s}){return e.jsx("div",{className:r.fsPromptChips,children:t.map(i=>e.jsx("button",{type:"button",className:r.fsPromptChip,disabled:a,onClick:()=>s(i),title:i,children:i},i))})}function xs({t,onUsePrompt:a,pool:s=mn,showTrust:i=!0,pills:o=null,hideExamples:l=!1}){const u=t&&t.showcase||{},p=Math.min(5,s.length),[g,b]=h.useState(()=>s.slice(0,p)),[y,T]=h.useState(-1),j=h.useRef(g);j.current=g;const[P,S]=h.useState(-1),R=h.useRef(0),L=s.map(I=>I.image).join("|"),k=h.useRef(L);return h.useEffect(()=>{k.current!==L&&(k.current=L,b(s.slice(0,p)),R.current=0,T(-1),S(-1))},[L]),h.useEffect(()=>{if(typeof window>"u"||s.length<=p)return;const I=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=navigator.connection||navigator.mozConnection||navigator.webkitConnection,F=!!(E&&(E.saveData||/^(slow-)?2g$|^3g$/.test(E.effectiveType||"")));if(I||F)return;let _=null,Y=null,V=null;const M=D=>{const te=new Set(D),A=s.filter(ge=>!te.has(ge.image));if(!A.length){V=null;return}V=A[Math.floor(Math.random()*A.length)];const v=new Image;v.src=da(V.image)};M(j.current.map(D=>D.image));const N=setInterval(()=>
88{const D=j.current,te=new Set(D.map(K=>K.image)),A=s.filter(K=>!te.has(K.image));if(!A.length)return;const v=R.current%D.length;R.current=(R.current+1)%D.length;const ge=V&&!te.has(V.image)?V:A[Math.floor(Math.random()*A.length)];S(v),T(v),_=setTimeout(()=>{const K=D.map((Ie,He)=>He===v?ge:Ie);b(K),T(-1),M(K.map(Ie=>Ie.image))},300),Y=setTimeout(()=>S(-1),750)},4e3);return()=>{clearInterval(N),_&&clearTimeout(_),Y&&clearTimeout(Y)}},[s,p]),s.length?e.jsxs("div",{className:r.fsShowcase,children:[!l&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:r.fsShowcaseLabel,children:u.madeWith||"Made with this tool"}),e.jsx("style",{children:"@keyframes pdFsShine { 0% { transform: translateX(-160%) skewX(-18deg); opacity: 0 } 18% { opacity: 1 } 100% { transform: translateX(260%) skewX(-18deg); opacity: 0 } }"}),e.jsx("div",{className:r.fsShowcaseRow,children:g.map((I,E)=>e.jsxs("button",{type:"button",className:r.fsShowcaseThumb,onClick:()=>a&&a(I.prompt),title:u.useThis||"Use as a starting point","aria-label":(u.useThis||"Use as a starting point")+": "+I.prompt,style:{position:"relative",overflow:"hidden"},children:[e.jsx("img",{src:da(I.image),alt:"",loading:"lazy",decoding:"async",style:{opacity:y===E?0:1,transition:"opacity 0.3s ease"}}),P===E&&e.jsx("span",{"aria-hidden":!0,style:{position:"absolute",top:0,bottom:0,left:0,width:"45%",background:"linear-gradient(105deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%)",animation:"pdFsShine 0.75s ease-out",pointerEvents:"none"}})]},E))})]}),i&&e.jsx("div",{className:r.fsTrustStrip,children:(u.trust||[]).map((I,E)=>e.jsxs("span",{className:r.fsTrustItem,children:[Tn[E%Tn.length],I]},E))}),!i&&o&&o.length>0&&e.jsx("div",{className:r.fsTrustStrip,children:o.map(I=>e.jsxs("span",{className:r.fsTrustItem,children:[co,I]},I))})]}):null}function mb({audit:t,onRegenerate:a,t:s}){if(s=s||et.en,!t||t.hasText===!1||t.status!=="fail"&&t.status!=="caution")return null;const i=t.status==="fail",o=i?"#fef2f2":"#fffbeb",l=i?"#f87171":"#fbbf24",u=i?"#991b1b":"#78350f",p=i?s.legibility.failTitle:s.legibility.cautionTitle;return e.jsx("div",{style:{margin:"8px 0 14px",background:o,border:`1.5px solid ${l}`,borderRadius:10,padding:"12px 14px"},role:"alert",children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:u,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0,marginTop:1},children:[e.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("strong",{style:{fontSize:"0.86rem",color:u,display:"block",marginBottom:4},children:p}),e.jsx("p",{style:{fontSize:"0.8rem",color:u,lineHeight:1.5,margin:"0 0 10px"},children:t.advice||t.rationale}),i&&a&&e.jsxs("button",{type:"button",onClick:a,style:{background:"#7c3aed",color:"#fff",border:"none",borderRadius:8,padding:"8px 12px",fontSize:"0.78rem",fontWeight:700,cursor:"pointer",whiteSpace:"nowrap"},children:[s.legibility.regenerate,e.jsx(Ln,{trailing:!0})]})]})]})})}function gb(t,a,s={}){const i=a||(l=>`$${Number(l||0).toFixed(2)}`),o=Is(t);return o.kind==="per-patch"?`+${i(o.amount)}`:o.kind==="percent"?`+${Math.round(o.amount*100)}%`:o.kind==="setup"?s.backingSetup?s.backingSetup(i(o.amount)):`+${i(o.amount)} setup`:o.kind==="tbd"?s.backingQuote||"Quote":s.included||"included"}function vs({value:t,unit:a,onCommit:s,suggestions:i,ariaLabel:o,listId:l,style:u,className:p}){const[g,b]=h.useState(""),[y,T]=h.useState(!1),j=a==="cm"?Qn(t):Qa(t,{withQuote:!1}),P=()=>{T(!1);const S=String(g).trim();if(S===""||S===String(j).trim())return;let R=null;if(a==="cm"){const L=parseFloat(S.replace(",",".").replace(/cm/ig,"").trim());isFinite(L)&&L>0&&(R=L/2.54)}else{const L=zr(S);L!=null&&L>0&&(R=Math.round(L*16)/16)}R!=null&&R>0&&s(String(Number(R.toFixed(4))))};return e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",inputMode:a==="cm"?"decimal":"text",list:l,value:y?g:j,placeholder:a==="cm"?"cm":"in",onFocus:()=>{b(j),T(!0)},onChange:S=>b(S.target.value),onBlur:P,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),P(),S.target.blur())},"aria-label":o,className:p,style:u}),i&&i.length>0&&e.jsx("datalist",{id:l,children:i.map(S=>e.jsx("option",{value:S},S))})]})}function fb({design:t,config:a,setConfig:s,embedConfig:i,partnerId:o,t:l,authUser:u,onReviewOrder:p,onRailChange:g,onSaveBlocked:b,sessionId:y="",sessionClientKey:T="main",imageSlot:j=null,specFooter:P=null,specHeader:S=null,imageAspect:R=1,designMaterial:L="",onRegenerateType:k,onGuideType:I,optionsOpen:E=!1,ourPromises:
88F=!0,quoteMode:_=!1,onQuote:Y,busy:V=!1,quoteSelRef:M=null,quoteNote:N=null,designOnly:D=!1,onBackingChange:te}){const A=l&&l.rail&&l.rail.instant||{},v=In(),ge=F&&!_,K=_&&!F&&!!(i&&i.hidePricing),Ie=!!(i&&i.hideCurrency),He=!!si(),Ae=f=>!_||!D&&bn(i,f)==="shown",Ke=f=>Cn(i,f),ye=Ae("quantity"),tt=F&&!_?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:"0.72rem",fontWeight:700,color:"#15803d",background:"#e9f9ef",borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap"},children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M12 3l7 3v5c0 4.5-3 7.6-7 9-4-1.4-7-4.5-7-9V6z"}),e.jsx("path",{d:"M9 12l2 2 4-4"})]}),A.priceMatchLabel||"Lowest price guaranteed"]}):null,Fe=oi(),ra=Do(),{currency:be,currencyPicked:U,format:De,formatPlain:ft}=js(),pe=f=>De(f)||`$${Number(f||0).toFixed(2)}`,re=f=>ft(f)||`$${Number(f||0).toFixed(2)}`,me=f=>dy(pe(f)),J=hr(a==null?void 0:a.material),H=Cr(J,i==null?void 0:i.pricingOverrides,i==null?void 0:i.addOnOverrides)||Gt[J]||Gt.embroidered,We=Object.keys(H.table),Z=typeof s=="function",Q=We.map(f=>parseFloat(f)).filter(f=>isFinite(f)).map(f=>Fe==="cm"?Qn(f):Qa(f,{withQuote:!1})),se=(()=>{const f=i==null?void 0:i.enabledPatchTypes,O=!Array.isArray(f)||f.length===0;return[...((l==null?void 0:l.patchTypeOptions)||[]).filter(W=>O||f.includes(ri[W.value])),...Ts()]})(),oe=We.map(f=>parseFloat(f)).filter(f=>isFinite(f)),ne=oe.length?Math.max(...oe):12,ce=oe.length?Math.min(...oe):1,[$,ee]=h.useState(""),he=f=>Fe==="cm"?`${Qn(f)} cm`:Qa(f),qe=H.label||(a==null?void 0:a.material)||"",Ct=f=>{ee("");const O=f.target.value,W=a==null?void 0:a.material;s&&s(ue=>({...ue,material:O}));try{typeof g=="function"&&O!==W&&g("Type",W,O)}catch{}},At=(()=>{let f=null;for(const O of se){const W=O.key||ri[O.value];if(!W||W===J)continue;const ue=Cr(W,i==null?void 0:i.pricingOverrides,i==null?void 0:i.addOnOverrides)||Gt[W],_e=Object.keys(ue&&ue.table||{}).map(Qe=>parseFloat(Qe)).filter(Qe=>isFinite(Qe)),$e=_e.length?Math.max(..._e):0;$e>ne+1e-6&&(!f||$e>f.max)&&(f={label:O.label,max:$e})}return f})(),[Be,pt]=h.useState(!1),we=f=>O=>{if(!s)return;let W=parseFloat(O);if(!isFinite(W)||W<=0)return;W>ne?(W=ne,ee(At&&A.sizeMaxWhy?A.sizeMaxWhy(qe,he(ne),At.label,he(At.max)):(A.sizeMax||(($e,Qe)=>`${$e} patches go up to ${Qe}. We set it to the maximum.`))(qe,he(ne)))):W<ce?(W=ce,ee((A.sizeMin||(($e,Qe)=>`${$e} patches start at ${Qe}. We set it to the minimum.`))(qe,he(ce)))):ee("");const ue=String(Number(W.toFixed(4))),_e=parseFloat(a==null?void 0:a[f]);if(!(isFinite(_e)&&W<=_e+1e-6)){const $e={width:a==null?void 0:a.width,height:a==null?void 0:a.height,[f]:ue},Qe=gi(a==null?void 0:a.placement,$e.width,$e.height);Qe&&!Qe.fits&&pt(!0)}s($e=>({...$e,[f]:ue}))},ve=(f,O)=>{const W=parseFloat(a==null?void 0:a[f]),ue=isFinite(W)&&W>0?W:3,_e=Fe==="cm"?1:.5,Qe=(Fe==="cm"?Math.round(ue*2.54):ue)/_e,ht=O>0?(Math.floor(Qe+1e-6)+1)*_e:(Math.ceil(Qe-1e-6)-1)*_e;if(!(ht>0))return;const sr=Fe==="cm"?ht/2.54:ht;we(f)(String(Number(sr.toFixed(4))))},ct=f=>(parseFloat(a==null?void 0:a[f])||0)>=ne-1e-6,ha=f=>(parseFloat(a==null?void 0:a[f])||0)<=ce+1e-6,yt=((parseFloat(a==null?void 0:a.width)||3)+(parseFloat(a==null?void 0:a.height)||3))/2,Ve=ci(We,yt),Je=H.minQty||1,Ba=[200],ze=[...new Set([...H.quantities||[25,50,100,200,300,500],...Ba])].filter(f=>f>=Je).sort((f,O)=>f-O),Sa=(H.addOns||[]).filter(f=>f.group==="backing"),qt=()=>ze.includes(150)?150:ze.includes(200)?200:ze.includes(100)?100:ze[0],[w,z]=h.useState(()=>{const f=parseInt(a==null?void 0:a.quantity,10);return isFinite(f)&&ze.includes(f)?f:qt()});h.useEffect(()=>{!_||!ye||typeof s!="function"||s(f=>f&&f.quantity===w?f:{...f,quantity:w})},[w,_,ye]);const[G,ae]=h.useState("");h.useEffect(()=>{typeof te=="function"&&te(G)},[G,te]),h.useEffect(()=>()=>{typeof te=="function"&&te("")},[te]);const Se=_?bn(i,"backing"):"shown";h.useEffect(()=>{Se!=="shown"&&ae(Se==="more"&&(a==null?void 0:a.orderBacking)||"")},[Se,a==null?void 0:a.orderBacking]);const[Oe,Ue]=h.useState(""),[xt,Ne]=h.useState(""),dt=()=>({quantity:ye?w:void 0,backing:G,comments:xt});h.useEffect(()=>{if(M)return M.current=_?dt:null,()=>{M.current=null}});const[nt,ua]=h.useState(()=>j?"auto":!1),Oa=h.useRef(null),vt=()=>{const f=Oa.current;return!!f&&typeof window<"u"&&window.getComputedStyle(f).display!=="none"}
88,[pa,$a]=h.useState(""),Vt=f=>(((l==null?void 0:l.patchTypeOptions)||[]).find(O=>O.value===f)||{}).label||fn(f,l),Re=!!L&&!!(a!=null&&a.material)&&a.material!==L&&pa!==a.material;h.useEffect(()=>{E&&ua(!1)},[E]);const[Ye,Ma]=h.useState(!1),[ma,ja]=h.useState(""),[bt,Xa]=h.useState(!1),[wt,_a]=h.useState(!1);h.useEffect(()=>{ze.includes(w)||z(qt())},[J]),h.useEffect(()=>{s&&s(f=>{const O=parseFloat(f==null?void 0:f.width),W=parseFloat(f==null?void 0:f.height),ue=isFinite(O)&&O>ne,_e=isFinite(W)&&W>ne;return!ue&&!_e?f:{...f,...ue?{width:String(ne)}:{},..._e?{height:String(ne)}:{}}})},[J]);const[Ta,ga]=h.useState(!1),fa=h.useMemo(()=>i?{arm:"popup",assigned:!1}:xf(vf,Hr()),[i]),er=fa.arm,{popup:tr,email:ur,tiers:Nt}=Sf(er),[Ot,na]=h.useState(()=>{if(u&&u.email)return u.email;try{const f=(new URLSearchParams(window.location.search).get("email")||"").trim();if(/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(f))return f}catch{}return""}),[it,ya]=h.useState(""),[$t,Kt]=h.useState(null),[Fa,ba]=h.useState(!1);h.useEffect(()=>{if(!$t)return;const f=$t.closest(`.${r.designCard}`)||$t,O=document.querySelector(`.${r.inputWrap}`),W=()=>{const _e=window.innerHeight||0,$e=$t.getBoundingClientRect(),Qe=$e.bottom<0||$e.top>_e;let ht=!1;if(O){const sr=O.getBoundingClientRect();ht=sr.bottom>_e-8&&sr.top<_e}ba(Qe&&!ht)};W();let ue=null;return typeof IntersectionObserver<"u"&&(ue=new IntersectionObserver(W,{threshold:0}),ue.observe($t),f!==$t&&ue.observe(f),O&&ue.observe(O)),window.addEventListener("scroll",W,{passive:!0}),window.addEventListener("resize",W),()=>{ue&&ue.disconnect(),window.removeEventListener("scroll",W),window.removeEventListener("resize",W)}},[$t]);const Ia=h.useRef(""),Yt=h.useRef(!1),Rt=h.useRef(""),wa=h.useRef("");h.useEffect(()=>{if(_)return;const f=typeof(t==null?void 0:t.hostedUrl)=="string"&&/^https?:\/\//i.test(t.hostedUrl)?t.hostedUrl:"";if(f){Rt.current=f;return}const O=typeof(t==null?void 0:t.url)=="string"&&t.url.startsWith("data:")?t.url:"";!O||wa.current===O||(wa.current=O,Te("/api/upload-reference-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:O})}).then(W=>W&&W.ok?W.json().catch(()=>null):null).then(W=>{W&&W.url&&(Rt.current=W.url)}).catch(()=>{}))},[t]),h.useEffect(()=>{_||Te("/api/instant-order?warm=1").catch(()=>{})},[_]);const at=h.useRef(0),Qt=h.useRef({}),St=(f,O=null)=>{const W=(t==null?void 0:t.transcriptId)||y;if(!W)return;const ue=f+":"+(at.current||0);if(Qt.current[ue])return;Qt.current[ue]=!0;const _e=JSON.stringify({transcriptId:W,clientKey:T||"main",stage:f,...O||{}}),$e=Za("/api/order-intent");try{if(f==="dismissed"){const ht=new Blob([_e],{type:"text/plain;charset=UTF-8"});if(typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon($e,ht))return}const Qe=()=>Te($e,{method:"POST",body:_e,keepalive:!0}).then(ht=>ht.json().catch(()=>null)).catch(()=>null);Qe().then(ht=>{ht&&ht.ok&&ht.matched===!1&&setTimeout(()=>{Qe()},3e3)})}catch{}},Da=()=>{at.current+=1,Qt.current={},fr(null),St("opened",{usd:Number(Zt.toFixed(2)),qty:Le?1:w,typeKey:J,size:Ve,...fa.assigned?{arm:er}:{},auth:u?"in":"out"})},ar=()=>{Da(),ga(!0)},rr=()=>{Ye||(Da(),Yt.current=!0,St("checkout"),br(""))},La=(f=!0)=>{if(Yt.current||u||i)return;const O=(Ot||"").trim();if(!/\S+@\S+\.\S+/.test(O)||Ia.current===O)return;Ia.current=O;const W=Rt.current||(typeof(t==null?void 0:t.hostedUrl)=="string"&&/^https?:\/\//i.test(t.hostedUrl)?t.hostedUrl:""),ue=typeof(t==null?void 0:t.url)=="string"&&t.url.startsWith("data:image/")?t.url:"",_e=W?[W]:[];if(f||W||!ue){const $e=JSON.stringify({email:O,designs:_e,transcriptId:(t==null?void 0:t.transcriptId)||"",source:"get-it-made-popup"});try{typeof navigator<"u"&&navigator.sendBeacon?navigator.sendBeacon("/api/ai-tool-capture",new Blob([$e],{type:"application/json"})):Te("/api/ai-tool-capture",{method:"POST",headers:{"Content-Type":"application/json"},body:$e,keepalive:!0}).catch(()=>{})}catch{}}else try{Te("/api/ai-tool-capture",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:O,designs:_e,primaryDataUrl:ue,transcriptId:(t==null?void 0:t.transcriptId)||"",source:"get-it-made-popup"})}).catch(()=>{})}catch{}},le=()=>{Yt.current||St("dismissed"),La(!1),ga(!1)};h.useEffect(()=>{if(!Ta)return;const f=()=>{Yt.current||St("dismissed"),La()};return window.addEventListener("pagehide",f),()=>window.removeEventListener("pagehide",f)},[Ta,Ot,u,i,t]);const Ze=h.useRef(!1);h.useEffect(()=>{if(Ze.current||_)return;let f=!1;
88try{f=new URLSearchParams(window.location.search).get("checkout")==="1"}catch{}if(f){Ze.current=!0;try{const O=new URL(window.location.href);O.searchParams.delete("checkout"),window.history.replaceState({},"",O.pathname+(O.search||""))}catch{}tr&&ar()}},[]);const jt=f=>{if(!f)return!1;const O=(H.addOns||[]).find(W=>W.label===f);return!!(O&&(O.special||Is(O.price).kind==="tbd"))},Xe=jt(G),Et=_r(J,Ve,w,i==null?void 0:i.pricingOverrides),ia=Et?Number(Et.estimatedTotal):0,Jt=qo({addOns:H.addOns||[],selectedLabels:G?[G]:[],baseTotal:ia,quantity:w}),st=ia+(Jt?Number(Jt.total):0),sa=il({typeKey:J,width:a==null?void 0:a.width,height:a==null?void 0:a.height}),ot=_||!sa.ok,Le=!ot&&Oe?sl[Oe]:null,Gr="ship",nr=!ot,Ar=Le?Ri(J,Le.key):0,Nr=Ri(J,Gr),Zt=Le?Ar:st,Mt=Le?Ar:w>0?st/w:0,ir=_r(J,Ve,100,i==null?void 0:i.pricingOverrides),za=ir?Number(ir.pricePerPatch):0,Ha=!Le&&!Xe&&ge&&Zt>0,Rr=Ha?Zt*Ut.percentOff/100:0,Pt=Zt-Rr,Ft=Ha&&w>0?Pt/w:0,_t=Ha&&Ft>0&&Ft<Mt,pr=3,mr=Math.max(0,ze.length-pr),[gr,fr]=h.useState(null),ka=h.useMemo(()=>{const f=O=>Math.min(Math.max(0,O),mr);return gr!=null?f(gr):f(Math.max(0,ze.indexOf(w))-1)},[gr,w,mr,ze.join(",")]),yr=h.useMemo(()=>Nt?ze.slice(ka,ka+pr).map(f=>{const O=_r(J,Ve,f,i==null?void 0:i.pricingOverrides),W=O?Number(O.estimatedTotal):0;return{key:`q${f}`,qty:f,label:String(f),rate:f>0?W/f:0}}):[],[Nt,ka,J,Ve,ze.join(",")]),br=async f=>{var O,W;if(!Ye){ja(""),Ma(!0);try{rt.checkoutStarted(Number(Zt.toFixed(2)),"USD","instant-order",w)}catch{}try{const ue=f||u&&u.email||"";ue&&Wo({email:ue})}catch{}try{const ue=await Te("/api/instant-order",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientKey:(i==null?void 0:i.clientKey)||"",partnerId:o||"",transcriptId:(t==null?void 0:t.transcriptId)||"",material:(a==null?void 0:a.material)||"embroidered",size:Ve,width:a==null?void 0:a.width,height:a==null?void 0:a.height,unit:Fe,displayCurrency:be||"USD",unitPicked:ra,currencyPicked:U,sampleKind:Le?Le.key:"",quantity:Le?1:w,backing:G||(Dt?"No backing":"Sew-on"),comments:xt||"",email:f||u&&u.email||"",designImageUrl:(t==null?void 0:t.hostedUrl)||(t==null?void 0:t.url)||"",designConfig:a||null,affiliateRef:typeof window<"u"&&window.endorsely_referral||"",...Uo()})}),_e=await ue.json().catch(()=>({}));if(ue.ok&&_e.url){try{(W=(O=rt).paymentInfoAdded)==null||W.call(O,Number(Zt.toFixed(2)),"USD","instant-order",w)}catch{}window.location.href=_e.url;return}ja(_e&&(_e.reason||_e.error)||A.error||"Could not start checkout. Please try again.")}catch{ja(A.error||"Could not start checkout. Please try again.")}Yt.current=!1,Ma(!1)}},Er=(f="inline")=>{if(Ye)return;if(_){if(V)return;Y==null||Y(dt());return}const O=Xe?"special-backing":"instant-order";try{rt.addToCart(Number(Zt.toFixed(2)),"USD",f==="inline"?O:`${O}:${f}`,w)}catch{}if(Xe){try{rt.orderModalOpened("get-it-made-special-backing")}catch{}p==null||p({quantity:w,backing:G,comments:xt});return}if(ya(""),!tr){rr();return}ar()},de=()=>{const f=(Ot||"").trim();if(ur&&!/\S+@\S+\.\S+/.test(f)){ya(A.captureInvalid||"Please enter a valid email address.");return}ya(""),Yt.current=!0,St("checkout"),br(f)},Xt=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches,fe=typeof window<"u"&&(window.innerHeight<600||window.innerWidth<360),Wa=f=>i||typeof document>"u"?f:yn.createPortal(f,document.body);if(!Et||!(t!=null&&t.url))return null;const Pr={width:"100%",height:36,padding:"0 10px",border:"1.5px solid #e2e8f0",borderRadius:10,fontWeight:600,fontFamily:"inherit",color:"#0f172a",background:"#fff"},Br=l&&l.rail&&l.rail.quantityUnit||"pcs",Tt=l&&l.rail&&l.rail.quote&&l.rail.quote.perPatchSuffix||"/patch",Or=nr&&(bt||!!Le),$r=ho(471)?3:2,Mr=$r,qr=Or&&!bt?Mr-1:Mr,Ua=Math.max(1,qr),wr=Math.max(0,ze.length-Ua),[Rn,En]=h.useState(()=>Math.max(0,ze.indexOf(100))),kr=Math.max(0,ze.indexOf(w)),Ca=(()=>{let f=Math.min(Math.max(Rn,0),wr);return kr<f&&(f=kr),kr>f+Ua-1&&(f=kr-Ua+1),Math.min(Math.max(f,0),wr)})(),xr=ze.slice(Ca,Ca+Ua),Pn=bt?ze:xr,Bn=Ca>0,Vr=Ca<wr,Fr=f=>{const O=Math.min(wr,Math.max(0,Ca+f));if(O===Ca)return;En(O);const W=ze.slice(O,O+Ua);W.includes(w)||(z(f>0?W[0]:W[W.length-1]),Ue(""))},Kr=Math.max(0,ze.length-xr.length)+(nr&&!Or?1:0),Dt=J==="pvc-2d"||J==="pvc-3d",Ga=[{value:"",short:Dt?A.noBackingShort||"None":A.sewOnShort||"Sew-on",sub:A.included||"included",special:!1},...Sa.map(f=>({value:f.label,short:ll(f.label,v),sub:gb(f.price,re,A),special:jt(f.label)}))],qa=$r,Va=Math.max(0,Ga.length-qa),[Yr,vr]=h.useState(0),xa=Math.min(Math.max(Yr,0),Va),Qr=Ga.slice(xa,xa+qa),Dr=wt?Ga:Qr,Jr=Math.max(0,Ga.length-qa),On=xa>0,Zr=xa<Va,Xr=f=>vr(Math.min(Va,Math.max(0,xa+f)));h.useEffect(()=>{const f=Ga.findIndex(O=>O.value===G);f<0||vr(O=>{const W=Math.max(0,Ga.length-qa),ue=Math.min(Math.max(O,0),W);return f<ue?f:f>ue+qa-1?Math.min(W,f-qa+1):O})},[G]);const en=f=>e.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",style:{verticalAlign:"middle",transform:f?"rotate(180deg)":"none"}
88,"aria-hidden":!0,children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),Ka=(f,O,W,ue)=>e.jsx("button",{type:"button",className:r.ioArrow,onClick:O,disabled:W,"aria-label":ue,children:e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:f<0?"15 18 9 12 15 6":"9 18 15 12 9 6"})})}),Bt=(f,O)=>e.jsxs("span",{className:r.ioSizeStep,"aria-hidden":!1,children:[e.jsx("button",{type:"button",onClick:()=>ve(f,1),"aria-disabled":ct(f),"aria-label":A.stepUp?A.stepUp(O):`Increase ${O}`,children:e.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:"18 15 12 9 6 15"})})}),e.jsx("button",{type:"button",onClick:()=>ve(f,-1),"aria-disabled":ha(f),"aria-label":A.stepDown?A.stepDown(O):`Decrease ${O}`,children:e.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),Sr={background:"rgba(22,163,74,0.12)",color:"#15803d"},Aa={background:"#f1f5f9",color:"#64748b"},tn=(f,O)=>{if(f===100)return e.jsx("span",{className:r.ioTierBadge,style:Aa,children:A.basePrice||"Base price"});const W=za>0&&O<za?Math.round((1-O/za)*100):0;return W>0?e.jsx("span",{className:r.ioTierBadge,style:Sr,children:A.saveBadge?A.saveBadge(W):`Save ${W}%`}):f>100?e.jsx("span",{className:r.ioTierBadge,style:Aa,children:A.basePrice||"Base price"}):e.jsx("span",{className:r.ioTierBadge,style:Aa,children:A.smallBatch||"Small batch"})},oa=!!j,an=e.jsxs("div",{className:r.ioFine,children:[_t&&e.jsx("p",{style:{textAlign:"center",fontSize:"0.76rem",lineHeight:1.25,color:"#6b6080",margin:"6px 2px 0"},children:A.ctaOffer?A.ctaOffer(Ut.code):`15% Off with ${Ut.code} at Checkout, Limited Time.`}),!i&&!_&&(()=>{const f=Ci(J),O=[f.coverage&&(A.incCoverage||"100% embroidery"),f.sample&&(A.incSample||"a real sample"),f.shipping&&(A.incShipping||"free worldwide shipping")].filter(Boolean);return O.length?e.jsx("div",{style:{textAlign:"center",marginTop:1},children:e.jsx("span",{style:{fontSize:"0.76rem",lineHeight:1.25,color:"#64748b",display:"inline-block",maxWidth:340},children:(A.includesPrefix||"Price includes")+" "+O.join(", ")+"."})}):null})(),F&&!_&&e.jsx("div",{style:{textAlign:"center",marginTop:-1.5},children:e.jsxs("a",{href:"/terms#price-match",target:"_blank",rel:"noopener","aria-label":A.priceMatchAria||"Lowest price guaranteed â see how our price-match works",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"0.76rem",fontWeight:600,letterSpacing:"0.2px",color:"#15803d",textDecoration:"none",borderBottom:"1px dotted #86efac",paddingBottom:0,lineHeight:1.25},children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6z"}),e.jsx("path",{d:"M9 12l2 2 4-4"})]}),e.jsx("span",{children:A.priceMatchLabel||"Lowest price guaranteed"})]})})]}),rn=_?N?e.jsx("div",{className:r.ioReassure,children:N}):null:e.jsxs("div",{className:r.ioReassure,style:{fontSize:"0.72rem",color:"#64748b",textAlign:"center",marginTop:7,lineHeight:1.4},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#16a34a",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{verticalAlign:-2,marginRight:3},children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),Le?A.reassureSample||"You approve your patch, including how thread renders fine detail, before it ships.":A.reassure||"Nothing's made until you approve a free proof."]});return e.jsxs("div",{className:r.instantOrderRoot,children:[Fa&&!Ta&&!i&&!_&&typeof document<"u"&&yn.createPortal(e.jsxs("div",{className:r.stickyBuyBar,children:[e.jsxs("div",{className:r.stickyBuyMeta,children:[e.jsxs("span",{className:r.stickyBuyTotal,children:[pe(_t?Ft:Mt),e.jsx("span",{className:r.stickyBuyUnit,children:A.perPatch?` ${A.perPatch}`:" per patch"})]}),e.jsx("span",{className:r.stickyBuySub,children:Le?A.sampleCtaMain||Le.ctaMain:`${w} à ${fn((a==null?void 0:a.material)||"Embroidered",l)}`})]}),e.jsx("button",{type:"button",onClick:()=>Er("sticky"),disabled:Ye,className:r.stickyBuyBtn,children:Ye?A.starting||"Starting checkoutâ¦":Xe?l.rail&&l.rail.quote&&l.rail.quote.send||"Get It Made":A.pay||"Get It Made"})]}),document.body),Ta&&Wa(e.jsx("div",{onClick:le,role:"dialog","aria-modal":"true","aria-label":A.captureTitle||"Almost there",style:{position:"fixed",inset:0,zIndex:1e4,background:"rgba(15,15,25,0.62)",display:"flex",alignItems:"center",justifyContent:"center",padding:fe?8:16,overflowY:"auto"},children:e.jsxs("div",{onClick:f=>f.stopPropagation(),style:{background:"#fff",color:"#1e1b2e",borderRadius:16,padding:fe?12:16,width:"100%",maxWidth:400,maxHeight:fe?"calc(100dvh - 16px)":"calc(100dvh - 32px)",overflowY:"auto",boxShadow:"0 24px 70px -12px rgba(0,0,0,0.5)",textAlign:"left"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:fe?8:10},children:[e.jsx("h3",{style:{margin:0,fontSize:fe?"1rem":"1.12rem",fontWeight:800,color:"#1e1b2e"},children:A.captureTitle||"Almost there"}),e.jsx("button",{type:"button",onClick:le,"aria-label":A.captureClose||"Close",style:{flexShrink:0,width:30,height:30,display:"flex",alignItems:"center",justifyContent:"center",padding:0,border:"none",borderRadius:"50%",background:"#f4f1fa",color:"#6b6080",cursor:"pointer"},children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round","aria-hidden":"true",children:e.jsx("path",{d:"M6 6l12 12M18 6L6 18"})})})]}),e.jsx("div",{role:"group","aria-label":A.captureRecap||"Your order",style:{marginBottom:fe?8:10},children:e.jsxs("div",{style:{display:"flex",gap:11,alignItems:"center"},children:[(t==null?void 0:t.url)&&e.jsx("img",{src:Ea(t),alt:"",...Pa(f=>b==null?void 0:b(f,t)),style:{flexShrink:0,width:56,height:56,borderRadius:8,objectFit:"cover",border:"1px solid #e0d9ef",background:"#fff"}}),e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{fontSize:"0.88rem",fontWeight:700,color:"#1e1b2e"},children:[Le?A.sampleCtaMain||Le.ctaMain:`${w} à ${fn((a==null?void 0:a.material)||"Embroidered",l)}`," · ",(()=>{const f=parseFloat(a==null?void 0:a.width),O=parseFloat(a==null?void 0:a.height);return isFinite(f)&&f>0&&isFinite(O)&&O>0?`${he(f)} à ${he(O)}`:String(Ve)})()]}),e.jsxs("div",{style:{fontSize:"0.8rem",color:"#6b6080",marginTop:2},children:[A.backing||"Backing",": ",G||(Dt?A.noBacking||"No backing":A.sewOn||"Sew-on (included)")]}),e.jsxs("div",{style:{fontSize:"1.02rem",fontWeight:800,color:"#7c3aed",marginTop:1},children:[!Ha&&e.jsxs(e.Fragment,{children:[pe(Zt),!Le&&e.jsx("br",{})]}),!Le&&e.jsxs("span",{style:{display:"block",fontSize:"0.89rem",fontWeight:700,color:"#7c3aed",marginTop:1},children:[_t&&e.jsxs(e.Fragment,{children:[e.jsx("s",{style:{fontWeight:600,color:"#a99fc7"},children:pe(Mt)})," "]}),pe(_t?Ft:Mt)," ",A.perPatch||"per patch"]})]})]})]})}),Nt&&yr.length>1&&e.jsx("div",{role:"group","aria-label":A.quantity||"Quantity",style:{marginBottom:fe?8:10},children:e.jsxs("div",{style:{display:"flex",alignItems:"stretch",gap:6},children:[Ka(-1,()=>fr(ka-1),ka<=0,A.ladderPrev||"Smaller runs"),e.jsx("div",{style:{flex:1,minWidth:0,display:"grid",gridTemplateColumns:`repeat(${yr.length}, 1fr)`,gap:5},children:yr.map(f=>{const O=!Le&&w===f.qty;return e.jsxs("button",{type:"button","aria-pressed":O,onClick:()=>{Ue(""),z(f.qty)}
88,style:{font:"inherit",cursor:"pointer",textAlign:"center",padding:fe?"4px 2px 4px":"6px 2px 5px",background:O?"#f6f1fe":"#fff",color:"#1e1b2e",lineHeight:1.25,border:`1.5px solid ${O?"#7c3aed":"#e6e0f5"}`,borderRadius:9},children:[e.jsx("span",{style:{display:"block",fontSize:"0.82rem",fontWeight:800},children:f.label}),e.jsx("span",{style:{display:"block",fontSize:"0.64rem",marginTop:1,color:O?"#7c3aed":"#6b6080"},children:pe(f.rate)})]},f.key)})}),Ka(1,()=>fr(ka+1),ka>=mr,A.ladderNext||"Larger runs")]})}),Ha&&e.jsxs("div",{style:{background:"#f5f3fb",border:"1px solid #ece8f7",borderRadius:10,padding:fe?"7px 10px":"9px 12px",marginBottom:fe?8:10},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12,fontSize:"0.78rem",color:"#6b6080",padding:fe?"1px 0":"2px 0"},children:[e.jsx("span",{children:A.ladderQty?A.ladderQty(w,pe(Mt)):`${w} patches at ${pe(Mt)}`}),e.jsx("span",{style:{fontWeight:600,whiteSpace:"nowrap"},children:pe(Zt)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12,fontSize:"0.78rem",color:"#15803d",padding:fe?"1px 0":"2px 0"},children:[e.jsx("span",{children:A.ladderCoupon?A.ladderCoupon(Ut.code):`${Ut.code}, first order`}),e.jsxs("span",{style:{fontWeight:600,whiteSpace:"nowrap"},children:["â",pe(Rr)]})]}),Ci(J).shipping&&e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12,fontSize:"0.78rem",color:"#6b6080",padding:fe?"1px 0":"2px 0"},children:[e.jsx("span",{children:A.ladderShipping||"Shipping"}),e.jsx("span",{style:{fontWeight:700,whiteSpace:"nowrap",color:"#15803d"},children:A.ladderFree||"Free"})]}),e.jsx("hr",{style:{border:"none",borderTop:"1px solid #ddd6ef",margin:fe?"4px 0 3px":"6px 0 5px"}}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12,fontSize:"0.95rem",fontWeight:800,color:"#1e1b2e"},children:[e.jsx("span",{children:A.ladderPay||"You pay"}),e.jsx("span",{style:{color:"#7c3aed",fontSize:"1.12rem",whiteSpace:"nowrap"},children:pe(Pt)})]}),tt&&e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:fe?5:7},children:tt})]}),!Ha&&tt&&e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginBottom:14},children:tt}),A.importNote&&e.jsx("p",{style:{fontSize:"0.68rem",lineHeight:1.5,color:"#6b6080",background:"#f7f5fb",border:"1px solid #e6e1f0",borderRadius:8,padding:fe?"6px 8px":"8px 10px",margin:fe?"0 0 8px":"0 0 12px"},children:A.importNote}),e.jsxs("form",{onSubmit:f=>{f.preventDefault(),de()},style:{margin:0},children:[ur&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:600,color:"#4b4360",marginBottom:fe?4:5,lineHeight:1.3},children:A.captureEmailShort||A.captureEmailLabel||"Email"}),e.jsx("input",{type:"email",name:"email",inputMode:"email",autoComplete:"email",autoFocus:!Xt,value:Ot,onChange:f=>{na(f.target.value),it&&ya("")},placeholder:A.captureEmailPlaceholder||"[email protected]",style:{width:"100%",boxSizing:"border-box",padding:fe?"8px 12px":"10px 12px",fontSize:16,border:`1.5px solid ${it?"#dc2626":"#d9d2ea"}`,borderRadius:10,color:"#1e1b2e",background:"#fff",outline:"none"}}),it&&e.jsx("p",{style:{margin:"6px 0 0",fontSize:"0.76rem",color:"#dc2626"},children:it})]}),e.jsxs("button",{type:"submit",disabled:Ye,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",marginTop:fe?8:10,padding:fe?"11px":"12px",fontSize:"0.95rem",fontWeight:800,color:"#fff",background:Ye?"#a78bfa":"#7c3aed",border:"none",borderRadius:12,cursor:Ye?"default":"pointer"},children:[Ye?e.jsx("span",{className:r.captureSpinner,"aria-hidden":"true"}):e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,marginRight:8},children:[e.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2"}),e.jsx("path",{d:"M8 11V7a4 4 0 0 1 8 0v4"})]}),Ye?A.starting||"Starting checkoutâ¦":A.captureContinue||"Continue to secure checkout"]}),ma&&e.jsx("p",{style:{margin:"8px 0 0",fontSize:"0.78rem",color:"#dc2626",textAlign:"center"},children:ma})]})]})})),e.jsxs("div",{className:`${r.ioColumn}${E?` ${r.ioColumnOptionsOpen}`:""}`,children:[e.jsxs("div",{className:r.ioBuy,children:[oa?e.jsxs("div",{className:r.ioImageFill,style:{"--pd-ar":R},children:[j,oa&&(He||!Xe&&!K&&!Ie)&&e.jsx("div",{className:r.ioRailCurrency,children:e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:6,whiteSpace:"nowrap"},children:[He&&e.jsx(Jn,{}),!Xe&&!K&&!Ie&&e.jsx(Ni,{})]})})]}
88):j,e.jsxs("div",{className:r.ioCtaGroup,children:[!oa&&(He||!Xe&&!K&&!Ie)&&e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",alignItems:"center",gap:6,marginBottom:7},children:[He&&e.jsx(Jn,{}),!Xe&&!K&&!Ie&&e.jsx(Ni,{})]}),e.jsxs("button",{ref:Kt,type:"button",onClick:()=>Er("inline"),disabled:Ye||_&&V,style:{width:"100%",border:"none",borderRadius:10,cursor:Ye?"default":"pointer",background:"linear-gradient(135deg, var(--color-primary, #7c3aed) 0%, var(--color-accent, #4f46e5) 100%)",boxShadow:"0 8px 18px -10px rgb(var(--brand-primary-rgb, 124 58 237) / 0.55)",opacity:Ye?.7:1,color:"#fff",padding:"11px 14px",display:"flex",alignItems:"center",gap:9,font:"inherit",textAlign:"left"},children:[e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 9px"},children:[e.jsx("span",{style:{fontWeight:800,textTransform:"uppercase",whiteSpace:"nowrap",fontSize:"clamp(0.59rem, 2.48vw, 0.83rem)",letterSpacing:"0.4px"},children:Xe||_?l.rail&&l.rail.quote&&l.rail.quote.send||"Get It Made":A.pay||"Get It Made"}),!Xe&&!K&&(Ye?e.jsx("span",{style:{fontWeight:700,fontSize:"clamp(0.59rem, 2.38vw, 0.79rem)"},children:A.starting||"Starting checkoutâ¦"}):Le?e.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:7,minWidth:0},children:[e.jsx("span",{style:{fontWeight:800,fontSize:"clamp(0.71rem, 2.97vw, 0.99rem)"},children:me(Ar)}),e.jsx("span",{style:{fontSize:"clamp(0.51rem, 1.98vw, 0.66rem)",fontWeight:600,opacity:.9,whiteSpace:"nowrap"},children:A.sampleCtaMain||Le.ctaMain})]}):e.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:7,minWidth:0},children:[_t&&e.jsx("s",{style:{fontWeight:400,fontSize:"clamp(0.71rem, 2.97vw, 0.99rem)"},children:pe(Mt)}),e.jsx("span",{style:{fontWeight:800,fontSize:"clamp(0.71rem, 2.97vw, 0.99rem)"},children:pe(_t?Ft:Mt)}),e.jsx("span",{style:{fontSize:"clamp(0.51rem, 1.98vw, 0.66rem)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.3px",opacity:.9,whiteSpace:"nowrap"},children:A.perPatch||"per patch"})]}))]}),e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0},children:[e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),e.jsx("polyline",{points:"12 5 19 12 12 19"})]})]})]}),!oa&&an]}),!D&&e.jsxs("div",{className:r.ioSpec,children:[S,e.jsx("div",{className:r.ioRule}),e.jsxs("div",{className:r.ioOptions,children:[Z&&Ae("type")&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`${r.ioOptLabel} ${r.ioOptLabelMid}`,style:Ke("type"),children:l.rail&&l.rail.labels&&l.rail.labels.type||"Type"}),e.jsxs("div",{className:r.typeSelectWrap,style:Ke("type"),children:[e.jsx("select",{value:(a==null?void 0:a.material)||"",onChange:Ct,"aria-label":l.rail&&l.rail.labels&&l.rail.labels.type||"Type",style:{...Pr,fontSize:"0.8rem",minWidth:0,width:"100%"},children:se.map(f=>e.jsx("option",{value:f.value,children:f.label},f.value))}),Re&&e.jsxs("div",{className:r.typeHint,role:"status",children:[e.jsx("span",{className:r.typeHintIcon,children:e.jsx(zo,{})}),e.jsxs("div",{className:r.typeHintBody,children:[e.jsx("p",{className:r.typeHintText,children:(A.typeHintNote||((f,O)=>`Your preview is still ${f}. Add any guidance in the chat, or tap Generate to see it as ${O}.`))(Vt(L),Vt(a.material))}),e.jsxs("div",{className:r.typeHintActions,children:[e.jsxs("button",{type:"button",className:r.typeHintGenerate,onClick:()=>{$a(a.material),k==null||k(a.material)},children:[e.jsx(Ho,{}),(A.typeHintGenerate||(f=>`Generate as ${f}`))(Vt(a.material))]}),e.jsx("button",{type:"button",className:r.typeHintGuide,onClick:()=>{$a(a.material),I==null||I()},children:A.typeHintGuide||"Add guidance first"})]})]}),e.jsx("button",{type:"button",className:r.typeHintClose,onClick:()=>$a(a.material),"aria-label":A.typeHintClose||"Close",children:e.jsx(Ur,{})})]})]})]}),Z&&Ae("size")&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`${r.ioOptLabel} ${r.ioOptLabelMid} ${r.ioOptLabelLine}`,style:Ke("size"),children:(l.rail&&l.rail.labels&&l.rail.labels.size||"Size").split("â")[0].trim()}),e.jsxs("div",{className:r.ioOptCtrlLine,style:{...Ke("size"),position:"relative",display:"flex",alignItems:"center",gap:5,minWidth:0,alignSelf:"center"},children:[e.jsxs("span",{className:r.ioSizeWrap,children:[e.jsx(vs,{value:a==null?void 0:a.width,unit:Fe,onCommit:we("width"),suggestions:Q,listId:"io-size-w",ariaLabel:l.rail&&l.rail.labels&&l.rail.labels.widthAria||"Width",className:r.ioSizeField,style:{...Pr,padding:"0 17px 0 var(--io-size-pad-l, 17px)",width:"100%",minWidth:0,fontSize:"0.8rem",textAlign:"center"}}),Bt("width",l.rail&&l.rail.labels&&l.rail.labels.widthAria||"Width")]}),e.jsx("span",{style:{color:"#94a3b8",flexShrink:0},children:"Ã"}),e.jsxs("span",{className:r.ioSizeWrap,children:[e.jsx(vs,{value:a==null?void 0:a.height,unit:Fe,onCommit:we("height"),suggestions:Q,listId:"io-size-h",ariaLabel:l.rail&&l.rail.labels&&l.rail.labels.heightAria||"Height",className:r.ioSizeField,style:{...Pr,padding:"0 17px 0 var(--io-size-pad-l, 17px)",width:"100%",minWidth:0,fontSize:"0.8rem",textAlign:"center"}}),Bt("height",l.rail&&l.rail.labels&&l.rail.labels.heightAria||"Height")]}),e.jsx(Cs,{}),Be&&e.jsx(jb,{config:a,unit:Fe,t:l,onClose:()=>pt(!1)})]}),$&&e.jsxs("div",{role:"status",className:r.ioSizeNotice,style:{...Ke("size"),display:"flex",alignItems:"flex-start",ga
88p:5,marginTop:-5,fontSize:"0.7rem",lineHeight:1.4,color:"#b45309"},children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0,marginTop:1},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),e.jsx("span",{children:$})]})]}),ye&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`${r.ioOptLabel} ${r.ioOptLabelLine}`,style:Ke("quantity"),children:[e.jsx("span",{children:A.volume||"Quantity"}),Kr>0&&e.jsxs("button",{type:"button",className:`${r.ioMore} ${r.ioMoreStack}`,onClick:()=>Xa(f=>!f),"aria-expanded":bt,children:[bt?A.showFewer||"Show fewer":`+${Kr} ${A.more||"more"}`," ",en(bt)]})]}),e.jsxs("div",{className:r.ioOptCtrlLine,style:{...Ke("quantity"),minWidth:0},children:[e.jsxs("div",{className:r.ioOptRow,children:[!bt&&Ka(-1,()=>Fr(-1),!Bn,A.prevOptions||"Show earlier options"),e.jsxs("div",{className:`${r.ioTierGrid}${!bt&&Mr===2?` ${r.ioTierGridTwo}`:""}`,children:[Or&&e.jsxs("button",{type:"button",onClick:()=>Ue(Gr),"aria-pressed":!!Le,className:`${r.ioTier} ${Le?r.ioTierSel:""}`,children:[e.jsx("span",{style:{display:"block",fontSize:"0.8rem",fontWeight:700,color:"#0f172a"},children:A.sampleTier||"1 Sample"}),e.jsx("span",{className:r.ioTierSub,children:me(Nr)}),e.jsx("span",{className:r.ioTierBadge,style:Aa,children:A.sampleTierBadge||"Ships to you"})]}),Pn.map(f=>{const O=_r(J,Ve,f,i==null?void 0:i.pricingOverrides),W=O?Number(O.pricePerPatch):0;return e.jsxs("button",{type:"button",onClick:()=>{z(f),Ue("")},"aria-pressed":f===w,className:`${r.ioTier} ${f===w&&!Le?r.ioTierSel:""}`,style:Le?{opacity:.45}:void 0,children:[e.jsxs("span",{style:{display:"block",fontSize:"0.8rem",fontWeight:700,color:"#0f172a"},children:[f," ",Br]}),!K&&e.jsxs("span",{className:r.ioTierSub,children:[pe(W),e.jsx("wbr",{}),Tt]}),!K&&tn(f,W)]},f)})]}),!bt&&Ka(1,()=>Fr(1),!Vr,A.nextOptions||"Show later options")]}),Le&&e.jsx("p",{className:r.sampleNote,style:{margin:"8px 2px 0",color:ts},children:A.sampleDisclaimerShipped||ol}),ot&&Oe&&e.jsx("p",{className:r.sampleNote,style:{margin:"8px 2px 0",color:ts},children:sa.reason})]})]}),Ae("backing")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`${r.ioOptLabel} ${r.ioOptLabelLine}`,style:Ke("backing"),children:[e.jsx("span",{children:A.backing||"Backing"}),Jr>0&&e.jsxs("button",{type:"button",className:`${r.ioMore} ${r.ioMoreStack}`,onClick:()=>_a(f=>!f),"aria-expanded":wt,children:[wt?A.showFewer||"Show fewer":`+${Jr} ${A.more||"more"}`," ",en(wt)]})]}),e.jsxs("div",{className:r.ioOptCtrlLine,style:{...Ke("backing"),minWidth:0},children:[e.jsxs("div",{className:r.ioOptRow,children:[!wt&&Ka(-1,()=>Xr(-1),!On,A.prevOptions||"Show earlier options"),e.jsx("div",{className:`${r.ioPillGrid}${!wt&&$r===2?` ${r.ioPillGridTwo}`:""}`,children:Dr.map(f=>{const O=wt&&/button\s*loop/i.test(f.value||"");return e.jsxs("button",{type:"button",onClick:()=>ae(f.value),"aria-pressed":f.value===G,className:`${r.ioPill} ${f.value===G?r.ioPillSel:""} ${O?r.ioPillTall:""}`,children:[e.jsx("span",{style:{display:"block",fontSize:"0.74rem",fontWeight:600},children:f.short}),!K&&e.jsx("span",{style:{display:"block",fontSize:"0.66rem",color:"#64748b"},children:f.sub})]},f.value||"sew-on")})}),!wt&&Ka(1,()=>Xr(1),!Zr,A.nextOptions||"Show later options")]}),Xe&&!_&&e.jsx("div",{style:{marginTop:10,fontSize:"0.74rem",color:"#92400e",lineHeight:1.45,background:"#fef3c7",border:"1px solid #fcd34d",borderRadius:10,padding:"8px 12px"},children:A.specialOrderNote||"Special order â our team will send a custom quote before charging."})]})]})]}),e.jsx("div",{className:r.ioRule}),!(i!=null&&i.hideRailComments)&&e.jsxs("div",{style:{marginTop:12},className:nt==="auto"?r.ioCommentsFit:void 0,children:[e.jsxs("button",{type:"button",onClick:()=>ua(f=>f==="auto"?!vt():!f),"aria-expanded":nt!==!1,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"9px 12px",borderRadius:10,cursor:"pointer",border:"1px solid #e2e8f0",background:"#f8fafc",color:"#475569",fontFamily:"inherit",fontSize:"0.72rem",fontWeight:700},children:[e.jsx("span",{children:A.commentsLabel||"Comments / Special Requests"}),e.jsx("svg",{className:r.ioCommentsChevron,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{transform:nt?"rotate(180deg)":"none",transition:"transform 120ms"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),nt&&e.jsx("textarea",{ref:Oa,value:xt,onChange:f=>Ne(f.target.value),rows:3,placeholder:A.commentsPlaceholder||"Any special requirements, rush order needs, specific colors, delivery deadline, or questions for our teamâ¦",className:r.ioCommentsBox,style:{width:"100%",marginTop:8,padding:"10px 12px",borderRadius:10,boxSizing:"border-box",border:"1.5px solid #e2e8f0",fontFamily:"inherit",color:"#0f172a",background:"#fff",resize:"vertical",lineHeight:1.5}})]}),!oa&&rn,ma&&e.jsx("div",{style:{fontSize:"0.78rem",color:"#b91c1c",textAlign:"center",marginTop:8},children:ma}),P,oa&&rn]}),oa&&an]})]})}function yb({design:t,onShareResolveUrl:a,t:s,embedMode:i=!1,hostPageUrl:o=""}){const l=s&&s.emailDesign||et.en.emailDesign,[u,p]=h.useState(!1),[g,b]=h.useState(""),[y,T]=h.useState(!1),[j,P]=h.useState(!1),[S,R]=h.useState(""),L=(()=>{const F=t&&t.hostedUrl;if(typeof F=="string"&&/^https:\/\//i.test(F))return F;const _=t&&t.url;return typeof _=="string"&&/^https:\/\//i.test(_)?_:""})(),k=typeof window<"u"&&window.location&&window.location.origin||"https://patchdesign.ai",I=F=>{if(i)return Vs(o,L?{...t,url:L}:t,{edit:F})||L;if(!L)return`${k}/ai-tool`;const _=new URLSearchParams({design:L});return F&&_.set("edit","1"),t.width&&_.set("w",String(t.width)),t.height&&_.set("h",String(t.height)),t.material&&_.set("m",String(t.material)),t.style&&_.set("st",String(t.style)),t.shape&&_.set("sh",String(t.shape)),t.prompt&&_.set("p",String(t.prompt).slice(0,500)),`${k}/ai-tool?${_.toString()}`},E=async F=>{if(F.preventDefault(),!y){R(""),T(!0);try{let _=null;if(typeof a=="function")try{_=await a(t)}catch{_=null}const Y=_&&/^https:\/\//i.test(String(_.imageUrl||""))?_.imageUrl:L,V=_&&/^https:\/\//i.test(String(_.shareUrl||""))&&!/\/ai-tool$/.test(_.shareUrl)?_.shareUrl:"",M=await Te("/api/send-email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"email-design",data:{email:g.trim(),imageUrl:Y,prompt:t&&(t.prompt||t.text||""),patchType:t&&t.material||"",patchSize:t&&t.width&&t.height?`${t.width}" x ${t.height}"`:"",editUrl:I(!0),orderUrl:I(!1),shareUrl:V||I(!0),pageUrl:I(!0),clientKey:ni}})}),N=await M.json().catch(()=>({}));if(!M.ok)throw new Error(N.error||"send-email failed");P(!0)}catch(_){console.warn("[email-design] failed:",_&&_.message),R(l.failed)}finally{T(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:r.imageActionBtn,onClick:()=>{p(!0),P(!1),R("")},title:l.buttonTitle,"aria-label":l.buttonAria,children:e.jsx(Ey,{})}),u&&e.jsx("div",{role:"dialog","aria-label":l.dialogAria,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:80,display:"flex",alignItems:"center",justifyContent:"center",padding:16},onClick:()=>!y&&p(!1),children:e.jsxs("form",{onClick:F=>F.stopPropagation(),onSubmit:E,style:{background:"#fff",borderRadius:12,padding:20,width:"min(420px, 100%)",boxShadow:"0 12px 40px rgba(0,0,0,0.2)"},children:[e.jsx("h3",{style:{margin:"0 0 8px",fontSize:"1.15rem"},children:l.heading}),e.jsx("p",{style:{margin:"0 0 12px",color:"#4b5563",fontSize:"0.9rem"},children:l.body}),!L&&!j?e.jsx("p",{style:{margin:"0 0 10px",color:"#92400e",background:"#fffbeb",border:"1px solid #fde68a",borderRadius:8,padding:"8px 10px",fontSize:"0.83rem"},children:l.notReady}):null,j?e.jsx("p",{style:{color:"#059669",fontWeight:700},children:l.sent}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"email",required:!0,value:g,onChange:F=>b(F.target.value),placeholder:l.placeholder,style:{width:"100%",padding:"10px 12px",borderRadius:8,border:"1px solid #d1d5db",marginBottom:10}}),S?e.jsx("p",{style:{color:"#b91c1c",fontSize:"0.85rem"},children:S}):null,e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",onClick:()=>p(!1),disabled:y,children:l.cancel}),e.jsx("button",{type:"submit",disabled:y||!L,style:{background:y||!L?"#c4b5fd":"#7c3aed",color:"#fff",border:0,borderRadius:8,padding:"8px 14px",fontWeight:700},children:y?l.sending:l.send})]})]}),j?e.jsx("button",{type:"button",onClick:()=>p(!1),style:{marginTop:8},children:l.close}):null]})})]})}function bb({parkerSrc:t,t:a,children:s}){const i=h.useRef(null),[o,l]=h.useState({left:!1,right:!1}),u=h.Children.count(s),p=h.useCallback(()=>{const y=i.current;if(!y)return;const T=y.scrollWidth-y.clientWidth;l({left:y.scrollLeft>4,right:y.scrollLeft<T-4})},[]);h.useEffect(()=>{p();const y=i.current;if(!y||typeof ResizeObserver>"u")return;const T=new ResizeObserver(p);return T.observe(y),()=>T.disconnect()},[p,u]);const g=y=>{const T=i.current;T&&T.scrollBy({left:y*Math.max(T.clientWidth*.85,200),behavior:"smooth"})},b=a.designCard&&a.designCard.earlierDesigns||"Earlier designs";return e.jsxs(Pe.div,{className:`${r.messageRow} ${r.designRow}`,initial:{opacity:0,y:12}
88,animate:{opacity:1,y:0},transition:{duration:.3},children:[e.jsx("img",{src:t,alt:"",className:`${r.avatar} ${r.designRowAvatar}`}),e.jsxs("div",{className:r.designCard,children:[e.jsx("p",{className:r.prevStripLead,children:b}),e.jsxs("div",{className:r.prevStripWrap,children:[o.left&&e.jsx("button",{type:"button",className:`${r.prevArrow} ${r.prevArrowLeft}`,onClick:()=>g(-1),"aria-label":a.designCard&&a.designCard.earlierPrev||"Show earlier designs",children:e.jsx(bi,{size:18})}),e.jsx("div",{className:r.prevStrip,ref:i,onScroll:p,"aria-label":b,children:s}),o.right&&e.jsx("button",{type:"button",className:`${r.prevArrow} ${r.prevArrowRight}`,onClick:()=>g(1),"aria-label":a.designCard&&a.designCard.earlierNext||"Show more designs",children:e.jsx(no,{size:18})})]})]})]})}function wb({lang:t="en-US",onFinalText:a}={}){const[s,i]=h.useState(!1),[o,l]=h.useState(""),[u,p]=h.useState(""),g=h.useRef(null),b=h.useRef(a);b.current=a;const y=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition),T=h.useCallback(()=>{const S=g.current;if(S)try{S.stop()}catch{}},[]),j=h.useCallback(()=>{if(!y||g.current)return;const S=window.SpeechRecognition||window.webkitSpeechRecognition;let R;try{R=new S}catch{p("unavailable");return}R.lang=t,R.continuous=!0,R.interimResults=!0,R.onresult=L=>{let k="",I="";for(let E=L.resultIndex;E<L.results.length;E++){const F=L.results[E];F.isFinal?I+=F[0].transcript:k+=F[0].transcript}l(k),I.trim()&&b.current&&b.current(I)},R.onerror=L=>{const k=L&&L.error||"unknown";k!=="no-speech"&&k!=="aborted"&&p(k)},R.onend=()=>{g.current=null,i(!1),l("")},g.current=R,p("");try{R.start(),i(!0)}catch{g.current=null,p("unavailable")}},[y,t]),P=h.useCallback(()=>{s?T():j()},[s,j,T]);return h.useEffect(()=>()=>{try{g.current&&g.current.abort()}catch{}},[]),{supported:y,listening:s,interim:o,error:u,start:j,stop:T,toggle:P,clearError:()=>p("")}}function ho(t){const a=`(min-width: ${t}px)`,[s,i]=h.useState(()=>typeof window<"u"&&window.matchMedia?window.matchMedia(a).matches:!1);return h.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(a),l=u=>i(u.matches);return i(o.matches),o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[a]),s}function kb({sessionId:t="",sessionClientKey:a="main",design:s,editingThis:i,busy:o,authUser:l,showRail:u,isLatest:p=!1,onExitFocus:g,isOrderTarget:b=!1,onChooseForOrder:y,onContinueFrom:T,onEditHere:j,compact:P=!1,config:S,setConfig:R,referenceWebsite:L,setReferenceWebsite:k,brandContext:I,brandLoading:E,brandError:F,selectedEdits:_,railCollapsed:Y,onToggleRail:V,parkerSrc:M,onZoom:N,onDownload:D,onSave:te,onOrder:A,onReviewOrder:v,onQuickEdit:ge,onRailChange:K,onTryOn:Ie,onSaveBlocked:He,onShareResolveUrl:Ae,onLogShare:Ke,embedConfig:ye,embedMode:tt=!1,hostPageUrl:Fe="",partnerId:ra=null,featureFlags:be={},t:U,localizedGarments:De,onSaveToLibrary:ft,orgContext:pe=null,orgEventName:re="",ourPromises:me=!0,onRegenerateType:J,onGuideType:H,onView360:We}){var Kt,Fa,ba,Ia,Yt,Rt,wa,at,Qt,St,Da,ar,rr,La;U=U||et.en,De=De||Zs;const Z=p||b,Q=Z?S:s.configSnapshot||S,se=Z?R:(()=>{}),oe=ho(1024),ne=typeof window<"u"&&window.matchMedia?window.matchMedia("(max-width: 720px)").matches:!1,[ce,$]=h.useState(!1),ee=Y||!p&&ne||!oe&&!ce,he=u&&!P,qe=h.useRef(null),Ct=h.useRef(!1),At=h.useCallback(()=>{if(Ct.current=ee&&ne,!oe&&!ce){$(!0),Y&&(V==null||V());return}V==null||V()},[ee,ne,oe,ce,Y,V]);h.useEffect(()=>{if(Ct.current&&!(ee||!qe.current)){Ct.current=!1;try{qe.current.scrollIntoView({behavior:"instant",block:"start"})}catch{try{qe.current.scrollIntoView(!0)}catch{}}}},[ee]);const Be=parseFloat(s.width)||3,pt=parseFloat(s.height)||3,we=parseFloat(Q==null?void 0:Q.width)||Be,ve=parseFloat(Q==null?void 0:Q.height)||pt,[ct,ha]=h.useState(""),yt=We?()=>{var le;return We({design:s,material:(Q==null?void 0:Q.material)||s.material||((le=s.configSnapshot)==null?void 0:le.material)||"",backing:ct,widthIn:we,heightIn:ve})}:null,Ve=Xs(De,we,ve),Je=b&&!(ye!=null&&ye.hideTryOn)&&(!pe||pe.showTryOn!==!1),[Ba,ze]=h.useState(!1),Sa=!!(ye!=null&&ye.tryOnAlways),qt=Sa||Ba,w=`tryon-panel-${s.designId||s.id||"card"}`,z=!l&&!tt,G=!pe&&(!ye||ye.plan==="partner"),ae=!b&&G&&!!y,Se=!p&&!!T,Oe=!G&&!pe,Ue=b&&(G||Oe),xt=h.useRef(null),Ne=()=>{const le=Oe&&xt.current;le?(v||A)(le()):A()},dt=Oe&&!!(ye&&ye.hideSidebar),nt=u&&Ue&&!dt,ua=nt?Dn.filter(le=>
88!(Oe&&bn(ye,le)==="more")):[],Oa=nt?Object.fromEntries(Dn.map(le=>[le,ua.includes(le)])):null,vt=oe&&nt,pa=h.useRef(null),[$a,Vt]=h.useState(null),Re=!!be.aspectFrame&&p,Ye=we,Ma=ve;h.useEffect(()=>{if(!Re){Vt(null);return}const le=()=>{const jt=pa.current;if(!jt)return;const Xe=jt.getBoundingClientRect();if(Xe.width<=0||Xe.height<=0)return;const Et=.88,ia=Xe.width*Et,Jt=Xe.height*Et,st=Ye/Ma;let sa,ot;ia/Jt>st?(ot=Jt,sa=Jt*st):(sa=ia,ot=ia/st),Vt({width:Math.round(sa),height:Math.round(ot)})};le();let Ze=null;return typeof ResizeObserver<"u"&&pa.current&&(Ze=new ResizeObserver(le),Ze.observe(pa.current)),typeof window<"u"&&window.addEventListener("resize",le),()=>{Ze&&Ze.disconnect(),typeof window<"u"&&window.removeEventListener("resize",le)}},[Re,Ye,Ma]);const ma=.15,ja=Be/pt||1,bt=we/ve||1,Xa=Math.abs(bt-ja)/ja,wt=we!==Be||ve!==pt,_a=!!be.rerenderSuggestion&&p&&wt&&Xa>=ma&&!s.rerenderDismissed,Ta=()=>{const le=`Size: ${we}Ã${ve}`;ge(le)},ga=(le,Ze,jt,Xe="")=>pe?e.jsxs("span",{className:r.railRow,"data-rail-row":!0,children:[le,e.jsxs("span",{className:`${r.railLabel}${jt?` ${r.railLabelHasShort}`:""}${Xe?` ${Xe}`:""}`,onClick:Et=>{var Jt;const ia=(Jt=Et.currentTarget.closest("[data-rail-row]"))==null?void 0:Jt.querySelector("button");ia&&ia.click()},"aria-hidden":!0,children:[e.jsx("span",{className:r.railLabelFull,children:Ze}),jt?e.jsx("span",{className:r.railLabelShort,children:jt}):null]})]},Ze):le,fa=!!(pe&&re),er=ft?ga(e.jsx("button",{type:"button",className:r.imageActionBtn,onClick:ft,title:fa?`Save this design to â${re}â and your organization's library. Nothing is sent for review yet.`:"Save this design to your organization's library. Nothing is sent for review yet.","aria-label":fa?`Save to the event ${re}`:"Save to the organization library",disabled:o,children:e.jsx(By,{})}),fa?"Save to event":"Save to library"):null,tr=e.jsxs("div",{ref:pa,className:`${r.designImageBox}${pe?` ${r.designImageBoxLabeled}`:""}`,style:{aspectRatio:`${Be} / ${pt}`},onClick:()=>N(Ea(s)),role:"button","aria-label":U.designCard.zoomAria,children:[e.jsx("img",{src:Ea(s),alt:U.designCard.imageAlt,...Pa(le=>He==null?void 0:He(le,s)),onError:le=>{le.currentTarget.dataset.wmFellBack!=="1"&&(le.currentTarget.dataset.wmFellBack="1",le.currentTarget.src=s.url)}}),yt&&!P&&e.jsxs("button",{type:"button",className:r.view360Btn,onClick:le=>{le.stopPropagation(),yt()},title:((Kt=U.view360)==null?void 0:Kt.buttonTitle)||"See it in 360","aria-label":((Fa=U.view360)==null?void 0:Fa.buttonAria)||"See this patch in 360 degrees",children:[e.jsx($o,{}),e.jsx("span",{children:((ba=U.view360)==null?void 0:ba.button)||"360°"})]}),Re&&$a&&e.jsx("div",{className:r.aspectFrame,style:$a,"aria-hidden":!0,children:e.jsxs("span",{className:r.aspectFrameLabel,children:[Ye,'" à ',Ma,'"']})}),o&&e.jsxs("div",{className:r.imageBadge,children:[e.jsx("span",{className:r.imageBadgeSpinner})," ",U.designCard.refining]}),e.jsxs("div",{className:`${r.imageActions}${pe?` ${r.imageActionsLabeled}`:""}`,onClick:le=>le.stopPropagation(),children:[pe&&er,ga(e.jsx("button",{type:"button",className:r.imageActionBtn,onClick:()=>N(Ea(s)),title:U.designCard.zoomTitle,"aria-label":U.designCard.zoomTitle,children:e.jsx(ao,{})}),"Zoom in","Zoom"),!pe&&e.jsx("button",{type:"button",className:r.imageActionBtn,onClick:D,title:z?U.designCard.downloadTitleAnon:U.designCard.downloadTitle,"aria-label":z?U.designCard.downloadAriaAnon:U.designCard.downloadAria,children:e.jsx(yi,{})}),!pe&&e.jsx(yb,{design:s,onShareResolveUrl:Ae,t:U,embedMode:tt,hostPageUrl:Fe}),!ye&&!pe&&e.jsx("button",{type:"button",className:r.imageActionBtn,onClick:te,title:l?U.designCard.saveTitleAuthed:U.designCard.saveTitleAnon,"aria-label":U.designCard.saveAria,disabled:o,children:e.jsx(Py,{})}),!pe&&er,ga(e.jsx(Zy,{design:s,onShareResolveUrl:Ae,onLogShare:Ke,t:U,embedMode:tt}),"Share a link","Share"),j&&ga(e.jsx("button",{type:"button",className:`${r.imageActionBtn} ${r.imageActionBtnEdit}`,onClick:j,title:((Ia=U.designCard)==null?void 0:Ia.editHere)||"Make changes â chat below","aria-label":((Yt=U.designCard)==null?void 0:Yt.editHereAria)||"Make changes to this design in the chat below",children:e.jsx(ro,{})}),"Change it in chat","Edit"),he&&ee&&!nt&&!dt&&ga(e.jsxs("button",{type:"button",className:`${r.railReopen} ${r.railReopenInCol}`,onClick:At,title:U.designCard.showSettings,"aria-label":U.designCard.showSettings,children:[e.jsx("span",{className:r.railReopenGear,"aria-hidden":!0,
88children:e.jsx(cs,{})}),e.jsx("span",{className:r.railReopenTri,"aria-hidden":!0,children:e.jsx(bi,{size:12})}),e.jsx("span",{className:r.railReopenLabel,children:U.affordance.designGuidance})]}),U.affordance.designGuidance,"",r.railLabelGearOnly)]})]}),ur=e.jsx(ii,{rootRef:qe,ourPromises:me,config:Q,setConfig:se,onRailChange:p?K:()=>{},busy:o,onOrder:A,onQuickEdit:ge,selectedEdits:_,onCollapse:V,hideQuoteCard:p&&G||b&&Oe,specInBlock:Oa,placement:"more",...p?{referenceWebsite:L,setReferenceWebsite:k,brandContext:I,brandLoading:E,brandError:F}:{},embedConfig:ye,t:U,showRerenderChip:_a,rerenderChipDesignW:Be,rerenderChipDesignH:pt,rerenderChipLiveW:we,rerenderChipLiveH:ve,onRerenderAtNewSize:Ta}),Nt=u&&!dt&&al(ye,!me,{brand:p,blockKeys:ua})?e.jsx("div",{className:r.shownFieldsBlock,children:e.jsx(ii,{placement:"shown",ourPromises:me,config:Q,setConfig:se,onRailChange:p?K:()=>{},busy:o,onOrder:A,onQuickEdit:ge,selectedEdits:_,hideQuoteCard:p&&G||b&&Oe,specInBlock:Oa,...p?{referenceWebsite:L,setReferenceWebsite:k,brandContext:I,brandLoading:E,brandError:F}:{},embedConfig:ye,t:U})}):null,Ot=Je?e.jsxs("div",{className:r.tryOnDisclosure,children:[!Sa&&e.jsxs("button",{type:"button",className:r.tryOnToggle,onClick:()=>ze(le=>!le),"aria-expanded":qt,"aria-controls":w,children:[e.jsx("svg",{className:r.tryOnToggleIcon,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23Z"})}),e.jsx("span",{children:qt?U.designCard.tryOnToggleHide:U.designCard.tryOnToggle}),e.jsx("svg",{className:`${r.tryOnChevron} ${qt?r.tryOnChevronOpen:""}`,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),qt&&e.jsxs("div",{id:w,className:r.tryOnPanel,children:[e.jsx("div",{className:`${r.tryOnRow}${Ve.length===4?` ${r.tryOnRowFour}`:""}`,"aria-label":U.designCard.tryOnAria,children:Ve.map(le=>e.jsx(Ib,{garment:le,patchUrl:Ea(s),patchWidthIn:we,patchHeightIn:ve,onOpen:()=>Ie(le.id,we,ve),onSaveBlocked:He?(Ze,jt)=>He(Ze,s,{garment:le,design:s,widthIn:we,heightIn:ve,fittedUrl:jt}):void 0,t:U},le.id))}),e.jsx("p",{className:r.tryOnDisclaimer,children:U.designCard.tryOnDisclaimer})]})]}):null,na=Ls(ye,!me,{brand:p&&typeof k=="function",blockKeys:ua,foldOrderKeys:nt?Dn.filter(le=>!ua.includes(le)&&bn(ye,le)==="more"):[]}),it=u&&na?e.jsxs("div",{className:r.moreOptionsBlock,children:[e.jsxs("button",{type:"button",className:`${r.moreOptionsBar} ${ee?"":r.moreOptionsBarOpen}`,onClick:At,"aria-expanded":!ee,children:[e.jsx("span",{className:r.moreOptionsGear,"aria-hidden":!0,children:e.jsx(cs,{})}),e.jsx("span",{className:r.moreOptionsLabel,children:U.designCard&&U.designCard.moreOptions||"More options"}),e.jsx("svg",{className:`${r.moreOptionsChevron} ${ee?"":r.moreOptionsChevronOpen}`,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!ee&&e.jsx("div",{className:r.moreOptionsPanel,children:ur})]}):null,ya=e.jsxs("p",{className:r.designCardLead,children:[e.jsx("img",{src:M,alt:"",className:r.designLeadAvatar}),e.jsxs("span",{className:r.designCardLeadFull,children:[(dt||!na)&&!nt&&U.designCard.leadPreNoOptions||U.designCard.leadPre,e.jsxs("span",{style:{whiteSpace:"nowrap"},children:[e.jsx("button",{type:"button",className:r.inlineQuoteLink,onClick:Ne,children:U.designCard.leadSend}),U.designCard.leadPost]})]}),e.jsxs("span",{className:r.designCardLeadShort,children:[U.designCard.leadShort||"Here's your patch:"," ",e.jsx("button",{type:"button",className:r.inlineQuoteLink,onClick:Ne,children:me?U.designCard.leadShortLink||"Get a human review":U.designCard.leadSend})]})]}),$t=e.jsxs("p",{className:r.designThreadNote,children:[e.jsx("span",{className:r.designThreadNoteFull,children:U.zoom.threadNote}),e.jsx("span",{className:r.designThreadNoteShort,children:U.zoom.threadNoteShort||U.zoom.threadNote})]});return e.jsxs(Pe.div,{className:P?r.prevItem:`${r.messageRow} ${r.designRow}`,"data-design-id":s.designId,initial:{opacity:0,y:12}
88,animate:{opacity:1,y:0},transition:{duration:.3},children:[!P&&e.jsx("img",{src:M,alt:"",className:`${r.avatar} ${r.designRowAvatar}`}),e.jsxs("div",{className:P?r.prevItemInner:r.designCard,children:[!P&&!vt&&ya,!P&&e.jsx(mb,{audit:s.legibility,onRegenerate:()=>ge("Regenerate this design with the text MUCH larger and bolder. Reduce the number of words if needed â readability matters more than completeness."),t:U}),e.jsxs("div",{className:he?ee||vt||dt?r.designContentRowCollapsed:r.designContentRow:"",children:[e.jsxs("div",{className:`${r.designImageColumn}${vt?` ${r.designSplit}`:""}${pe?` ${r.designImageColumnLabeled}`:""}`,children:[!vt&&tr,Ue&&e.jsx(fb,{design:s,config:Q,setConfig:se,embedConfig:ye,partnerId:ra,t:U,authUser:l,ourPromises:me,onReviewOrder:v,onRailChange:p?K:void 0,onSaveBlocked:He,sessionId:t,sessionClientKey:a,optionsOpen:nt&&!ee,imageSlot:vt?tr:null,specFooter:nt?e.jsxs(e.Fragment,{children:[Nt,it,Ot]}):null,specHeader:vt?ya:null,imageAspect:Be/pt||1,designMaterial:s.material||((Rt=s.configSnapshot)==null?void 0:Rt.material)||"",onBackingChange:ha,onRegenerateType:p?J:void 0,onGuideType:H,quoteMode:Oe,onQuote:Oe?v||A:void 0,quoteSelRef:xt,busy:o,quoteNote:Oe&&!P?$t:null,designOnly:dt}),!P&&!Ue&&$t,(ae||Se)&&e.jsxs("div",{className:r.orderThisRow,children:[ae&&e.jsxs("button",{type:"button",className:r.orderThisBtn,onClick:y,disabled:o,children:[e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"9",cy:"21",r:"1"}),e.jsx("circle",{cx:"20",cy:"21",r:"1"}),e.jsx("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]}),P?e.jsx("span",{children:((wa=U.designCard)==null?void 0:wa.orderVerb)||"Order"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:r.orderThisFull,children:((at=U.designCard)==null?void 0:at.orderThis)||"Order this one"}),e.jsx("span",{className:r.orderThisShort,children:((Qt=U.designCard)==null?void 0:Qt.orderThisShort)||"Order"})]})]}),Se&&(i?e.jsx(e.Fragment,{children:e.jsxs("span",{className:r.continueThisActive,children:[e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),((St=U.designCard)==null?void 0:St.continuingThis)||"Editing this one"]})}):e.jsxs("button",{type:"button",className:r.continueThisBtn,onClick:T,disabled:o,children:[e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),P?e.jsx("span",{children:((Da=U.designCard)==null?void 0:Da.editVerb)||"Edit"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:r.orderThisFull,children:((ar=U.designCard)==null?void 0:ar.continueThis)||"Continue from this one"}),e.jsx("span",{className:r.orderThisShort,children:((rr=U.designCard)==null?void 0:rr.continueThisShort)||"Edit"})]})]}))]}),!P&&i&&Se&&g&&e.jsx("p",{className:r.exitFocusLine,children:e.jsx("button",{type:"button",className:r.exitFocusLink,onClick:g,children:((La=U.designCard)==null?void 0:La.showAllDesigns)||"Show all designs and history"})}),!nt&&Nt,!nt&&Ot]}),he&&!ee&&!nt&&!dt&&ur]}),!he&&!P&&e.jsxs("div",{className:r.designCardCaption,children:[U.designCard.generatedWith," ",e.jsx("strong",{children:s.material||"Embroidered"})," ·"," ",e.jsxs("strong",{children:[s.width||"3.5",'" à ',s.height||"3.5",'"']}),s.style?e.jsxs(e.Fragment,{children:[" · ",e.jsx("strong",{children:s.style})]}):null]})]})]})}function xb({msg:t,onSubmit:a,onApplyAsEdit:s,t:i,embedMode:o=!1}){const l=o?i.survey.labelNeutral:i.survey.label;i=i||et.en;const u=i.survey&&i.survey.topics||et.en.survey.topics,[p,g]=h.useState(null),[b,y]=h.useState(""),[T,j]=h.useState(""),P=!!t.answered,S=I=>{if(I.id==="other"){g("other");return}const E=et.en.survey.topics.find(F=>F.id===I.id);a((E||I).label,!1,I.id)},R=()=>{const I=b.trim();
88if(I){if(s&&ky(I)){j(I);return}a(b,!1,"other"),y("")}},L=()=>{a("",!0)},k=()=>{const I=T;j(""),y(""),a(I,!1,"other")};return P?t.skipped?null:e.jsx("div",{className:`${r.microSurveyPanel} ${r.microSurveyDone}`,children:i.survey.done}):T?e.jsxs("div",{className:`${r.microSurveyPanel} ${r.microSurveyCard}`,children:[e.jsx("p",{className:r.microSurveyAsk,children:i.survey.editAsk}),e.jsxs("p",{className:r.microSurveyEcho,children:["â",T,"â"]}),e.jsxs("div",{className:r.microSurveyActions,children:[e.jsx("button",{type:"button",className:r.microSurveySkipBtn,onClick:k,children:i.survey.editKeep}),e.jsx("button",{type:"button",className:r.microSurveySendBtn,onClick:()=>{const I=T;j(""),y(""),s(I)},children:i.survey.editApply})]})]}):p==="other"?e.jsxs("div",{className:`${r.microSurveyPanel} ${r.microSurveyCard}`,children:[e.jsx("p",{className:r.microSurveyLabel,children:l}),e.jsx("p",{className:r.microSurveyAsk,children:i.survey.otherAsk||i.survey.ask}),e.jsx("textarea",{className:r.microSurveyInput,value:b,onChange:I=>y(I.target.value.slice(0,500)),placeholder:i.survey.placeholder,rows:2,maxLength:500,autoFocus:!0}),e.jsx("p",{className:r.microSurveyNote,children:i.survey.note}),e.jsxs("div",{className:r.microSurveyActions,children:[e.jsx("button",{type:"button",className:r.microSurveySkipBtn,onClick:()=>{y(""),g(null)},children:i.survey.back||i.survey.skip}),e.jsx("button",{type:"button",className:r.microSurveySendBtn,onClick:R,disabled:!b.trim(),children:i.survey.send})]})]}):e.jsxs("div",{className:`${r.microSurveyPanel} ${r.microSurveyCard}`,children:[e.jsx("p",{className:r.microSurveyLabel,children:l}),e.jsx("p",{className:r.microSurveyAsk,children:i.survey.ask}),e.jsx("div",{className:r.microSurveyChips,role:"group","aria-label":i.survey.ask,children:u.map(I=>e.jsx("button",{type:"button",className:r.microSurveyChip,onClick:()=>S(I),children:I.label},I.id))}),e.jsx("div",{className:r.microSurveyActions,children:e.jsx("button",{type:"button",className:r.microSurveySkipBtn,onClick:L,children:i.survey.skip})})]})}const vb={hat:Po,"shirt-front":Eo,polo:Ro,jacket:No,"small-bag":Ao,"large-bag":Co,"shirt-back":Lo};function Sb({config:t,unit:a,t:s,style:i,className:o}){const l=gi(t&&t.placement,t&&t.width,t&&t.height);if(!l||l.fits)return null;const u=s&&s.rail||et.en.rail,p=Wr(parseFloat(t.width),parseFloat(t.height),a),g=Wr(l.maxW,l.maxH,a),b=u.placementOptions&&u.placementOptions[t.placement]||t.placement;return e.jsxs("div",{role:"status","data-placement-warning":!0,className:o,style:{display:"flex",alignItems:"flex-start",gap:6,marginTop:6,padding:"7px 9px",background:"#fffbeb",border:"1px solid #fbbf24",borderRadius:8,fontSize:"0.72rem",lineHeight:1.45,color:"#78350f",...i},children:[e.jsx(Ss,{style:{flexShrink:0,marginTop:2,color:"#b45309"}}),e.jsx("span",{children:u.placementWarning(p,g,b)})]})}function jb({config:t,unit:a,t:s,onClose:i}){const o=gi(t&&t.placement,t&&t.width,t&&t.height);if(!o||o.fits)return null;const l=s&&s.rail||et.en.rail,u=Wr(parseFloat(t.width),parseFloat(t.height),a),p=Wr(o.maxW,o.maxH,a),g=l.placementOptions&&l.placementOptions[t.placement]||t.placement;return e.jsxs("div",{className:r.typeHint,role:"alertdialog","aria-live":"polite","data-placement-popover":!0,children:[e.jsx("span",{className:r.typeHintIcon,children:e.jsx(Ss,{})}),e.jsxs("div",{className:r.typeHintBody,children:[e.jsx("p",{className:r.typeHintText,children:l.placementWarning(u,p,g)}),e.jsx("div",{className:r.typeHintActions,children:e.jsx("button",{type:"button",className:r.typeHintGenerate,onClick:i,children:l.placementGotIt||"Got it"})})]}),e.jsx("button",{type:"button",className:r.typeHintClose,onClick:i,"aria-label":l.placementClose||"Close",children:e.jsx(Ur,{})})]})}function ii({rootRef:t=null,config:a,setConfig:s,onRailChange:i,busy:o,onOrder:l,onQuickEdit:u,selectedEdits:p,onCollapse:g,hideQuoteCard:b,embedConfig:y,ourPromises:T=!0,referenceWebsite:j,setReferenceWebsite:P,brandContext:S,brandLoading:R,brandError:L,specInBlock:k=null,placement:I="all",showRerenderChip:E=!1,rerenderChipDesignW:F=null,rerenderChipDesignH:_=null,rerenderChipLiveW:Y=null,rerenderChipLiveH:V=null,onRerenderAtNewSize:M=null,t:N}){var Sa,qt;N=N||et.en;const D=w=>{const z=rl(y,w);return z!=="hidden"&&(I==="all"||z===I)},te=w=>Cn(y,w),A=D("brand"),v=h.useContext(Nn),ge=!!(v&&(v.lockedBrand||v.brandLinkDead)),K=D("style"),Ie=D("detail"),He=D("event"),Ae=D("feature"),Ke=w=>!!(k&&k[w]),ye=w=>!!(k&&!k[w]),tt=D("type")&&!Ke("type"),Fe=D("size")&&!Ke("size"),ra=D("shape"),be=D("placement"),U=D("quantity"),De=I!=="shown",ft=tl(y,!T).filter(w=>I==="all"||(w.shown?"shown":"more")===I),pe=(w,z)=>s(G=>({...G,customValues:{...G.customValues||{},[w]:z}})),re=(w,z,G)=>i==null?void 0:i(w,z,G),me=(w,z)=>G=>{const ae=G.target.value;s(Se=>(Se[w]!==ae&&re(z,Se[w],ae),{...Se,[w]:ae}))},J=(w,z,G)=>{s(ae=>{if(ae[w]===G)return ae;re(z,`${Qa(parseFloat(ae[w]))}`,`${Qa(parseFloat(G))}`);const Se={...ae,[w]:G},Oe=Gn(ae.shape);if(Oe==="round"||Oe==="rectangle"){const Ue=rs(Oe,Se.width,Se.height,ae.shape);Ue&&Ue!==ae.shape&&(re("Shape",ae.shape,Ue),Se.shape=Ue)}return Se})},H=w=>
88{s(z=>{const G=rs(w,z.width,z.height,z.shape);return!G||G===z.shape?z:(re("Shape",z.shape||"-",G),{...z,shape:G})})},We=w=>{const z=w||"",G=z.trim()?z:hn;s(ae=>G===ae.shape?ae:(G!==hn&&re("Shape",ae.shape||"-",G.trim()),{...ae,shape:G}))},Z=w=>{s(z=>(z.granularity!==w&&re("Detail",z.granularity,w),{...z,granularity:w}))},[Q,se]=h.useState(((Sa=a.smartFields)==null?void 0:Sa.eventName)||""),[oe,ne]=h.useState(a.mainFeature||"");h.useEffect(()=>{var w;se(((w=a.smartFields)==null?void 0:w.eventName)||"")},[(qt=a.smartFields)==null?void 0:qt.eventName]),h.useEffect(()=>{ne(a.mainFeature||"")},[a.mainFeature]);const ce=()=>{const w=Q.trim();s(z=>{var ae;const G=((ae=z.smartFields)==null?void 0:ae.eventName)||"";return G===w?z:(re("Event / Team",G,w),{...z,smartFields:{...z.smartFields,eventName:w}})})},$=()=>{const w=oe.trim();s(z=>(z.mainFeature||"")===w?z:(re("Main Feature",z.mainFeature||"",w),{...z,mainFeature:w}))},ee=w=>z=>{z.key==="Enter"&&(z.preventDefault(),w(),z.target.blur())},he=oi(),qe=w=>he==="cm"?Fo(parseFloat(w)):`${w}"`,Ct=w=>{const z=String(parseFloat(w));return z==="NaN"||yt.includes(z)?yt:[...yt,z].sort((G,ae)=>parseFloat(G)-parseFloat(ae))},At=hr(a.material),Be=Cr(At,y==null?void 0:y.pricingOverrides,y==null?void 0:y.addOnOverrides)||Gt[At]||Gt.embroidered,we=Object.keys(Be.table).map(w=>String(parseFloat(w)));we.join(",");const ve=we.length?parseFloat(we[0]):0,ct=we.length?parseFloat(we[we.length-1]):12,ha=h.useMemo(()=>{const w=Math.ceil(ve*Fn-1e-6),z=Math.floor(ct*Fn+1e-6),G=[];for(let ae=w;ae<=z;ae+=1)G.push(String(Number((ae/Fn).toFixed(4))));return G},[ve,ct]),yt=he==="cm"?ha:we,Ve=yt.join(","),[Je,Ba]=h.useState(()=>!we.includes(String(parseFloat(a.width)))||!we.includes(String(parseFloat(a.height))));h.useEffect(()=>{if(yt.length===0)return;const w=Se=>{const Oe=parseFloat(Se)||3;return yt.reduce((Ue,xt)=>Math.abs(parseFloat(xt)-Oe)<=Math.abs(parseFloat(Ue)-Oe)?xt:Ue,yt[Math.floor(yt.length/2)])},z=Se=>{const Oe=parseFloat(Se);return isFinite(Oe)?Oe>ct?String(ct):Oe<ve?String(ve):Se:String(ve)},G=Je?z(a.width):w(a.width),ae=Je?z(a.height):w(a.height);(G!==a.width||ae!==a.height)&&s(Se=>({...Se,width:G,height:ae}))},[Ve]);const ze=g?"button":"div";return e.jsxs("div",{className:r.designRail,ref:t,"aria-label":N.rail.aria,children:[I!=="shown"&&e.jsxs(ze,{className:`${r.designRailHeader}${g?" "+r.designRailHeaderToggle:""}`,...g?{type:"button",onClick:g,title:N.rail.hideTitle,"aria-label":N.rail.hideAria}:{},children:[e.jsxs("span",{className:r.designRailTitle,children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{verticalAlign:"-2px",marginRight:4},children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),N.rail.title]}),g&&e.jsx("span",{"aria-hidden":!0,className:r.designRailHeaderChevron,children:e.jsx(no,{size:13})})]}),typeof P=="function"&&A&&e.jsx(Vy,{t:N,style:te("brand")}),typeof P=="function"&&ge&&e.jsx(Ky,{t:N,style:te("brand")}),typeof P=="function"&&A&&!ge&&e.jsxs("label",{className:r.designRailItem,"data-rail-field":"brand",style:te("brand"),children:[e.jsx("span",{className:r.designRailLabel,children:N.rail.labels.brandRef}),e.jsx("div",{className:r.designRailInputWrap,children:e.jsx("input",{className:r.designRailInput,type:"text",inputMode:"text",name:"pd-brand-ref",autoComplete:"off",value:j||"",onChange:w=>P(w.target.value),placeholder:"e.g. www.nike.com",style:S&&S.success?{outline:"1px solid rgba(16,185,129,0.6)"}:L?{outline:"1px solid #ef4444"}:void 0})}),S&&S.success&&e.jsxs("div",{style:{marginTop:6,padding:"6px 8px",borderRadius:6,background:"rgba(16,185,129,0.10)",border:"1px solid rgba(16,185,129,0.4)",color:"inherit"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[S.logoUrl&&e.jsx("img",{src:S.logoUrl,alt:"",width:22,height:22,onError:w=>{w.currentTarget.style.display="none"},style:{borderRadius:4,background:"#fff",objectFit:"contain",padding:2,flexShrink:0,border:"1px solid rgba(0,0,0,0.12)"}}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:"0.72rem",fontWeight:600,color:"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.name||S.host}),S.source==="guidelines"&&e.jsx("div",{style:{fontSize:"0.66rem",opacity:.75,whiteSpace:"nowrap"},children:N.greeting.brandGuidelines||"Brand guidelines applied"}),(S.colors||[]).length>0&&e.jsx("div",{style:{display:"flex",gap:3,marginTop:3},children:(S.colors||[]).slice(0,5).map(w=>e.jsx("span",{title:w,style:{width:12,height:12,borderRadius:3,background:w,border:"1px solid rgba(0,0,0,0.2)"}},w))})]}),e.jsx("button",{type:"button",onClick:()=>{P("")},title:"Clear","aria-label":"Clear referenced brand or website",style:{background:"none",border:"none",color:"inherit",opacity:.6,cursor:"pointer",padding:2,lineHeight:0,flexShrink:0,display:"inline-flex"},children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[e.jsx("line",{x1:"5",y1:"5",x2:"19",y2:"19"}),e.jsx("line",{x1:"19",y1:"5",x2:"5",y2:"19"})]})})]}),S.logoUrl&&e.jsx("div",{style:{marginTop:6,paddingTop:6,borderTop:"1px solid rgba(128,128,128,0.28)",fontSize:"0.6rem",lineHeight:1.4,color:"inherit",opacity:.7},children:"Brand colors and logo are pulled for design reference only. Use only brands you own or are authorized to represent â you are responsible for ensuring you have the rights to any third-party marks used in your patch."})]}),R&&e.jsx("span",{style:{display:"block",marginTop:4,fontSize:"0.65rem",opacity:.6},children:"reading brandâ¦"}),L&&!R&&e.jsx("span",{style:{display:"block",marginTop:4,fontSize:"0.65rem",color:"#ef4444"},children:"Couldn't read that brand â patch will still generate normally."}),!S&&!L&&!R&&e.jsx("span",{style:{display:"block",marginTop:4,fontSize:"0.65rem",opacity:.55},children:N.rail.labels.brandRefHint})]}),K&&e.jsxs("label",{className:r.designRailItem,"data-rail-field":"style",style:te("style"),children:[e.jsx("span",{className:r.designRailLabel,children:N.rail.labels.style}),e.jsx(ns,{value:a.style,options:N.visibleStyles,onChange:w=>{w!==a.style&&(re("Style",a.style,w),s(z=>({...z,style:w,eventName:"",mainFeature:"",shape:""})))}})]}),Ie&&e.jsxs("div",{className:r.designRailItem,"data-rail-field":"detail",style:te("detail"),children:[e.jsx("span",{className:r.designRailLabel,children:N.rail.labels.detail}),e.jsx("div",{className:r.designRailSegmented,children:["Less","Normal","More"].map((w,z)=>e.jsx("button",{type:"button",onClick:()=>Z(w),className:`${r.designRailSegBtn} ${a.granularity===w?r.designRailSegBtnActive:""}`,"aria-pressed":a.granularity===w,children:N.rail.detailOptions[z]},w))})]}),He&&e.jsxs("label",{className:r.designRailItem,"data-rail-field":"event",style:te("event"),children:[e.jsx("span",{className:r.designRailLabel,children:N.rail.labels.event}),e.jsxs("div",{className:r.designRailInputWrap,children:[e.jsx("input",{className:r.designRailInput,type:"text",name:"pd-event-team",autoComplete:"off",placeholder:N.rail.labels.eventPlaceholder,value:Q,onChange:w=>
88se(w.target.value),onBlur:ce,onKeyDown:ee(ce)}),e.jsx("button",{type:"button",className:r.designRailInputSend,onClick:ce,title:N.rail.labels.applyTitle,"aria-label":N.rail.labels.applyEventAria,disabled:!Q.trim(),children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]})]}),Ae&&e.jsxs("label",{className:r.designRailItem,"data-rail-field":"feature",style:te("feature"),children:[e.jsx("span",{className:r.designRailLabel,children:N.rail.labels.mainFeature}),e.jsxs("div",{className:r.designRailInputWrap,children:[e.jsx("input",{className:r.designRailInput,type:"text",name:"pd-main-feature",autoComplete:"off",placeholder:N.rail.labels.mainFeaturePlaceholder,value:oe,onChange:w=>ne(w.target.value),onBlur:$,onKeyDown:ee($)}),e.jsx("button",{type:"button",className:r.designRailInputSend,onClick:$,title:N.rail.labels.applyTitle,"aria-label":N.rail.labels.applyFeatureAria,disabled:!oe.trim(),children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]})]}),tt&&(()=>{const w=y==null?void 0:y.enabledPatchTypes,G=[...!Array.isArray(w)||w.length===0?N.patchTypeOptions:N.patchTypeOptions.filter(ae=>w.includes(ri[ae.value])),...Ts()];return G.length===0?null:e.jsxs("label",{className:r.designRailItem,style:te("type"),children:[e.jsx("span",{className:r.designRailLabel,children:N.rail.labels.type}),e.jsx("select",{className:r.designRailSelect,value:a.material,onChange:me("material","Type"),children:G.map(ae=>e.jsx("option",{value:ae.value,children:ae.label},ae.value))})]})})(),Fe&&e.jsxs("div",{className:r.designRailItem,style:te("size"),children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[e.jsx("span",{className:r.designRailLabel,children:N.rail.labels.size}),e.jsx(Cs,{variant:"inherit"})]}),Je&&he!=="cm"?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{children:[e.jsx("span",{className:r.designRailLabel,style:{display:"block",marginBottom:4},children:N.rail.labels.width}),e.jsx(Di,{compact:!0,value:a.width,onChange:w=>J("width","Width",w),maxInches:ct,minInches:ve,ariaLabel:N.rail.labels.widthAria})]}),e.jsxs("div",{children:[e.jsx("span",{className:r.designRailLabel,style:{display:"block",marginBottom:4},children:N.rail.labels.height}),e.jsx(Di,{compact:!0,value:a.height,onChange:w=>J("height","Height",w),maxInches:ct,minInches:ve,ariaLabel:N.rail.labels.heightAria})]})]}):e.jsxs("div",{className:r.designRailSizeRow,style:{alignItems:"center"},children:[e.jsx("select",{className:r.designRailSelect,value:String(parseFloat(a.width)),onChange:w=>J("width","Width",w.target.value),"aria-label":N.rail.labels.widthAria,children:Ct(a.width).map(w=>e.jsx("option",{value:w,children:qe(w)},w))}),e.jsx("span",{className:r.designRailSizeX,children:"Ã"}),e.jsx("select",{className:r.designRailSelect,value:String(parseFloat(a.height)),onChange:w=>J("height","Height",w.target.value),"aria-label":N.rail.labels.heightAria,children:Ct(a.height).map(w=>e.jsx("option",{value:w,children:qe(w)},w))})]}),Je&&he!=="cm"&&e.jsx("p",{style:{margin:"6px 0 0",fontSize:"0.74rem",color:"#64748b",lineHeight:1.45},children:e.jsx("strong",{style:{color:"#0f172a",fontWeight:700},children:`${Qa(parseFloat(a.width))} Ã ${Qa(parseFloat(a.height))}`})}),he!=="cm"&&e.jsx("div",{style:{marginTop:2},children:e.jsx("button",{type:"button",onClick:()=>{if(Je){Ba(!1);const w=z=>{const G=parseFloat(z)||3;return we.reduce((ae,Se)=>Math.abs(parseFloat(Se)-G)<=Math.abs(parseFloat(ae)-G)?Se:ae,we[Math.floor(we.length/2)])};J("width","Width",w(a.width)),J("height","Height",w(a.height))}else Ba(!0)},"aria-pressed":Je,title:Je?N.rail.customSize.activeTitle:N.rail.customSize.switchTitle,style:{padding:"3px 11px",borderRadius:999,border:Je?"1px solid rgb(var(--brand-primary-rgb, 124 58 237) / 0.55)":"1px solid rgba(148,163,184,0.45)",background:Je?"rgb(var(--brand-primary-rgb, 124 58 237) / 0.14)":"transparent",color:Je?"var(--color-primary, #7c3aed)":"#64748b",fontSize:"0.7rem",fontWeight:700,cursor:"pointer",letterSpacing:"0.02em",whiteSpace:"nowrap"},children:Je?e.jsxs(e.Fragment,{children:[e.jsx(Io,{leading:!0}),N.rail.customSize.active]}):N.rail.customSize.switch})}),E&&M&&e.jsxs("div",{className:r.rerenderChipRail,role:"status",children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0},children:[e.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.36L21 8"}),e.jsx("path",{d:"M21 3v5h-5"}),e.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.36L3 16"}),e.jsx("path",{d:"M3 21v-5h5"})]}),e.jsxs("div",{className:r.rerenderChipRailBody,children:[e.jsxs("p",{className:r.rerenderChipRailText,children:[N.rail.rerender.bodyPrefix,F,'" Ã ',_,'"',N.rail.rerender.bodyMid,Y,'" Ã ',V,'"',N.rail.rerender.bodySuffix]}),e.jsxs("button",{type:"button",className:r.rerenderChipRailBtn,onClick:M,disabled:o,children:[N.rail.rerender.button,e.jsx(Ln,{trailing:!0})]})]})]}),(()=>{const w=parseFloat(a.width)||0,z=parseFloat(a.height)||0,G=Math.min(w,z);
88if(!w||!z||G>2.5)return null;const ae=Math.max(.6,w-.3),Se=Math.max(4,Math.floor(ae/.15));return e.jsx("div",{style:{marginTop:8,background:"#fffbeb",border:"1px solid #fbbf24",borderRadius:8,padding:"8px 10px",fontSize:"0.75rem",color:"#78350f",lineHeight:1.45},role:"note",children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:6},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"#b45309",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{flexShrink:0,marginTop:2},children:[e.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),e.jsxs("span",{children:[N.rail.smallPatchWarning.prefix,e.jsx("strong",{children:N.rail.smallPatchWarning.strong(Se)}),N.rail.smallPatchWarning.suffix]})]})})})()]}),ra&&e.jsxs("div",{className:`${r.designRailItem} ${r.designRailItemShape}`,"data-rail-field":"shape",style:te("shape"),children:[e.jsxs("span",{className:r.designRailLabel,children:[N.rail.labels.shape,a.shape&&e.jsx("span",{className:r.designRailShapeChip,children:ai(a.shape,N)})]}),e.jsx("div",{className:r.designRailSegmented,children:(()=>{const w=Gn(a.shape);return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>H("round"),className:`${r.designRailSegBtn} ${w==="round"?r.designRailSegBtnActive:""}`,"aria-pressed":w==="round",title:N.rail.shape.roundTitle,children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{verticalAlign:"middle",marginRight:4},children:e.jsx("circle",{cx:"12",cy:"12",r:"9"})}),N.rail.shape.round]}),e.jsxs("button",{type:"button",onClick:()=>H("rectangle"),className:`${r.designRailSegBtn} ${w==="rectangle"?r.designRailSegBtnActive:""}`,"aria-pressed":w==="rectangle",title:N.rail.shape.rectangleTitle,children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{verticalAlign:"middle",marginRight:4},children:e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"})}),N.rail.shape.rectangle]}),e.jsxs("button",{type:"button",onClick:()=>H("other"),className:`${r.designRailSegBtn} ${w==="other"?r.designRailSegBtnActive:""}`,"aria-pressed":w==="other",title:N.rail.shape.otherTitle,children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{verticalAlign:"middle",marginRight:4},children:e.jsx("polygon",{points:"12 2 14.9 8.6 22 9.3 16.5 14.1 18.2 21 12 17.3 5.8 21 7.5 14.1 2 9.3 9.1 8.6 12 2"})}),N.rail.shape.other]})]})})()}),Gn(a.shape)==="other"&&(()=>{const w=gy.has(a.shape),z=w?a.shape:"custom";return e.jsxs("div",{className:r.designRailShapeOtherWrap,children:[e.jsxs("select",{className:r.designRailSelect,value:z,onChange:G=>{const ae=G.target.value;if(ae==="custom"){if(!w&&a.shape)return;We(hn)}else We(ae)},"aria-label":N.rail.shape.otherPresetAria,children:[to.map(G=>e.jsx("option",{value:G,children:ai(G,N)},G)),e.jsx("option",{value:"custom",children:N.rail.shape.customOption})]}),!w&&e.jsx("input",{className:r.designRailInput,type:"text",placeholder:N.rail.shape.customPlaceholder,value:a.shape===hn?"":a.shape||"",onChange:G=>We(G.target.value),"aria-label":N.rail.shape.customAria})]})})()]}),be&&e.jsxs("label",{className:r.designRailItem,"data-rail-field":"placement",style:te("placement"),children:[e.jsx("span",{className:r.designRailLabel,children:N.rail.labels.placement}),e.jsx(ns,{value:a.placement||"",onChange:w=>s(z=>({...z,placement:w})),iconFor:w=>{const z=vb[w]||Bo;return e.jsx(z,{size:15})},ariaLabel:N.rail.labels.placement,options:[{key:"",label:N.rail.placementOptions.none},...qs.map(w=>{const z=w.maxIn||va[w.garment];return{key:w.id,label:N.rail.placementOptions[w.id],hint:N.rail.placementFitHint(Wr(z.w,z.h,he))}})]}),e.jsx(Sb,{config:a,unit:he,t:N})]}),ft.map(w=>e.jsxs("label",{className:r.designRailItem,"data-rail-field":"custom-"+w.id,style:{order:50},children:[e.jsxs("span",{className:r.designRailLabel,children:[w.label,w.required?" *":""]}),e.jsx("div",{className:r.designRailInputWrap,children:e.jsx("input",{className:r.designRailInput,type:"text",autoComplete:"off",maxLength:500,placeholder:w.placeholder||"",value:a.customValues&&a.customValues[w.id]||"",onChange:z=>pe(w.id,z.target.value),"aria-label":w.label})})]}
88,w.id)),ye("backing")&&e.jsx(_b,{config:a,setConfig:s,embedConfig:y,t:N}),e.jsx(Tb,{config:a,setConfig:s,onRailChange:i,busy:o,onOrder:l,embedConfig:y,ourPromises:T,t:N,showQuantity:U&&!Ke("quantity")&&(!b||ye("quantity")),showQuote:!b&&De}),!1]})}function _b({config:t,setConfig:a,embedConfig:s,t:i}){const o=i&&i.rail&&i.rail.instant||{},l=hr(t.material),p=((Cr(l,s==null?void 0:s.pricingOverrides,s==null?void 0:s.addOnOverrides)||Gt[l]||Gt.embroidered).addOns||[]).filter(y=>y.group==="backing"),g=l==="pvc-2d"||l==="pvc-3d",b=o.backing||"Backing";return e.jsxs("label",{className:r.designRailItem,"data-rail-field":"backing",style:Cn(s,"backing"),children:[e.jsx("span",{className:r.designRailLabel,children:b}),e.jsxs("select",{className:r.designRailSelect,value:t.orderBacking||"","aria-label":b,onChange:y=>{const T=y.target.value;a(j=>({...j,orderBacking:T}))},children:[e.jsx("option",{value:"",children:g?o.noBackingShort||"None":o.sewOnShort||"Sew-on"}),p.map(y=>e.jsx("option",{value:y.label,children:y.label},y.label))]})]})}function Tb({config:t,setConfig:a,onRailChange:s,busy:i,onOrder:o,embedConfig:l,ourPromises:u=!0,showQuantity:p=!0,showQuote:g=!0,t:b}){b=b||et.en;const y=!u&&!!(l&&l.hidePricing),{format:T}=js(),j=_=>T(_)||`$${Number(_||0).toFixed(2)}`,P=_=>{const Y=parseInt(_.target.value,10)||100;a(V=>(V.quantity!==Y&&(s==null||s("Quantity",`${V.quantity}`,`${Y}`)),{...V,quantity:Y}))},S=((parseFloat(t.width)||3)+(parseFloat(t.height)||3))/2,R=hr(t.material),L=Cr(R,l==null?void 0:l.pricingOverrides,l==null?void 0:l.addOnOverrides)||Gt[R]||Gt.embroidered,k=Object.keys(L.table),I=ci(k,S),E=t.quantity||100,F=_r(R,I,E,l==null?void 0:l.pricingOverrides);return e.jsxs(e.Fragment,{children:[p&&e.jsxs("label",{className:r.designRailItem,style:Cn(l,"quantity"),children:[e.jsx("span",{className:r.designRailLabel,children:b.rail.labels.quantity}),e.jsx("select",{className:r.designRailSelect,value:t.quantity||100,onChange:P,children:fy.map(_=>e.jsxs("option",{value:_,children:[_," ",b.rail.quantityUnit]},_))})]}),g&&e.jsxs("div",{className:r.designRailQuoteCard,style:{order:100},children:[F&&!y&&e.jsxs("div",{className:r.designRailPrice,children:[e.jsxs("span",{className:r.designRailPriceAmount,children:[j(F.pricePerPatch),e.jsx("span",{className:r.designRailPriceUnit,children:b.rail.quote.perPatchSuffix})]}),e.jsxs("span",{className:r.designRailPriceSub,children:[E," ",b.rail.quantityUnit," · ",t.material," · ",I," · ",e.jsxs("strong",{children:[j(F.estimatedTotal)," ",b.rail.quote.totalLabel]})]})]}),e.jsx("button",{type:"button",className:r.railCta,onClick:o,disabled:i,children:i?b.rail.quote.preparing:e.jsxs(e.Fragment,{children:[b.rail.quote.send," ",e.jsx("span",{children:e.jsx(Ln,{})})]})}),u&&e.jsx("div",{style:{textAlign:"center",marginTop:8},children:e.jsxs("a",{href:"/terms#price-match",target:"_blank",rel:"noopener","aria-label":b.rail&&b.rail.instant&&b.rail.instant.priceMatchAria||"Lowest price guaranteed â see how our price-match works",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"0.68rem",fontWeight:600,letterSpacing:"0.3px",color:"#15803d",textDecoration:"none",borderBottom:"1px dotted #86efac",paddingBottom:0,lineHeight:1.25},children:[e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M9 12l2 2 4-4"}),e.jsx("path",{d:"M21 12c0 4.97-4.03 9-9 9s-9-4.03-9-9 4.03-9 9-9 9 4.03 9 9z"})]}),e.jsx("span",{children:b.rail&&b.rail.instant&&b.rail.instant.priceMatchLabel||"Lowest price guaranteed"})]})})]})]})}function wi(t){const[a,s]=h.useState(t);return h.useEffect(()=>{if(s(t),!t)return;let i=!1,o=null;const l=new Image;return l.crossOrigin="anonymous",l.onload=()=>{if(!i)try{const u=l.naturalWidth,p=l.naturalHeight;if(!u||!p)return;const g=240,b=Math.min(g/u,g/p,1),y=Math.max(1,Math.round(u*b)),T=Math.max(1,Math.round(p*b)),j=document.createElement("canvas");j.width=y,j.height=T;const P=j.getContext("2d",{willReadFrequently:!0});P.drawImage(l,0,0,y,T);const S=P.getImageData(0,0,y,T).data,R=[[0,0],[y-1,0],[0,T-1],[y-1,T-1],[Math.floor(y/2),
880],[Math.floor(y/2),T-1],[0,Math.floor(T/2)],[y-1,Math.floor(T/2)]];let L=0,k=0,I=0,E=0;for(const[be,U]of R){const De=(U*y+be)*4;L+=S[De],k+=S[De+1],I+=S[De+2],E+=S[De+3]}L/=R.length,k/=R.length,I/=R.length,E/=R.length;const F=E<32,_=32,Y=3600;let V=y,M=-1,N=T,D=-1;for(let be=0;be<T;be++)for(let U=0;U<y;U++){const De=(be*y+U)*4,ft=S[De+3];let pe;if(F)pe=ft>_;else{const re=S[De]-L,me=S[De+1]-k,J=S[De+2]-I;pe=re*re+me*me+J*J>Y}pe&&(U<V&&(V=U),U>M&&(M=U),be<N&&(N=be),be>D&&(D=be))}if(M<0)return;const te=V/y,A=N/T,v=(M-V+1)/y,ge=(D-N+1)/T;if(v<.25||ge<.25||v>.92&&ge>.92)return;const K=.015,Ie=K,He=K,Ae=Math.max(0,te-Ie)*u,Ke=Math.max(0,A-He)*p,ye=Math.min(1,v+2*Ie)*u,tt=Math.min(1,ge+2*He)*p,Fe=document.createElement("canvas");Fe.width=Math.round(ye),Fe.height=Math.round(tt),Fe.getContext("2d").drawImage(l,-Ae,-Ke),Fe.toBlob(be=>{i||!be||(o=URL.createObjectURL(be),s(o))},"image/png")}catch(u){typeof console<"u"&&console.warn("[useTrimmedPatch]",u&&u.message)}},l.onerror=()=>{},l.src=t,()=>{i=!0,o&&URL.revokeObjectURL(o)}},[t]),a}function Ib({garment:t,patchUrl:a,patchWidthIn:s,patchHeightIn:i,onOpen:o,onSaveBlocked:l,t:u}){u=u||et.en;const p=wi(a),g=P=>{l&&l(P,p)},{leftPct:b,topPct:y,widthPct:T,heightPct:j}=An(t,s,i,420/240);return e.jsxs("button",{type:"button",className:r.tryOnThumb,onClick:o,"aria-label":u.tryOn.tryAria(t.label),title:u.tryOn.seeAria(t.label),children:[e.jsxs("div",{className:r.tryOnThumbInner,children:[e.jsx("img",{src:da(t.src),alt:"",className:r.tryOnThumbGarment,...Pa(g)}),e.jsx("img",{src:p,alt:"",className:r.tryOnThumbPatch,...Pa(g),style:{width:`${T}%`,height:`${j}%`,left:`${b}%`,top:`${y}%`}})]}),e.jsx("span",{className:r.tryOnThumbLabel,children:t.label})]})}function Lb({data:t,onSaveBlocked:a,t:s}){const i=s&&s.tryOn&&s.tryOn.patchOnGarmentAlt||et.en.tryOn.patchOnGarmentAlt,{garment:o,design:l}=t,u=wi(l.url),p=S=>{a&&a(S,u)},{widthIn:g,heightIn:b}=Sn(t),{leftPct:y,topPct:T,widthPct:j,heightPct:P}=An(o,g,b,420/380);return e.jsx(Pe.div,{className:r.zoomTryOnStage,initial:{scale:.92},animate:{scale:1},exit:{scale:.92},onClick:S=>S.stopPropagation(),children:e.jsxs("div",{className:r.zoomTryOnCanvas,children:[e.jsx("img",{src:da(o.src),alt:"",className:r.zoomTryOnGarment,...Pa(p)}),e.jsx("img",{src:u,alt:i,className:r.zoomTryOnPatch,...Pa(p),style:{width:`${j}%`,height:`${P}%`,left:`${y}%`,top:`${T}%`}})]})})}function Cb({data:t,onClose:a,onDownload:s,onZoom:i,onPrev:o,onNext:l,onSaveBlocked:u,garments:p,t:g}){g=g||et.en;const{garment:b,design:y}=t,T=wi(y.url),j=E=>{u&&u(E,T)};h.useEffect(()=>{if(!o&&!l)return;const E=F=>{F.key==="ArrowLeft"&&o?o():F.key==="ArrowRight"&&l&&l()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[o,l]);const{widthIn:P,heightIn:S}=Sn(t),{leftPct:R,topPct:L,widthPct:k,heightPct:I}=An(b,P,S,420/380);return e.jsx(Pe.div,{className:r.tryOnModalOverlay,initial:{opacity:0}
88,animate:{opacity:1},exit:{opacity:0},onClick:a,children:e.jsxs(Pe.div,{className:r.tryOnModalCard,initial:{scale:.92,y:18},animate:{scale:1,y:0},exit:{scale:.92,y:18},transition:{duration:.2},onClick:E=>E.stopPropagation(),children:[e.jsxs("div",{className:r.tryOnModalHeader,children:[e.jsx("span",{children:g.tryOn.header(b.label)}),e.jsx("button",{type:"button",className:r.tryOnModalClose,onClick:a,"aria-label":g.tryOn.close,children:e.jsx(Ur,{})})]}),e.jsxs("div",{className:r.tryOnModalStage,children:[o&&e.jsx("button",{type:"button",className:`${r.tryOnNavBtn} ${r.tryOnNavBtnLeft}`,onClick:E=>{E.stopPropagation(),o()},"aria-label":g.tryOn.prevAria,title:g.tryOn.prev,children:e.jsx("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}),l&&e.jsx("button",{type:"button",className:`${r.tryOnNavBtn} ${r.tryOnNavBtnRight}`,onClick:E=>{E.stopPropagation(),l()},"aria-label":g.tryOn.nextAria,title:g.tryOn.next,children:e.jsx("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})}),e.jsxs("div",{className:r.tryOnModalCanvas,children:[e.jsx("img",{src:da(b.src),alt:"",className:r.tryOnModalGarment,...Pa(j)}),e.jsx("img",{src:T,alt:g.tryOn.patchOnGarmentAlt,className:r.tryOnModalPatch,...Pa(j),style:{width:`${k}%`,height:`${I}%`,left:`${R}%`,top:`${L}%`}})]}),e.jsxs("div",{className:r.tryOnModalActions,children:[e.jsx("button",{type:"button",className:r.imageActionBtn,onClick:i,title:g.tryOn.zoomTitle,"aria-label":g.designCard.zoomTitle,children:e.jsx(ao,{})}),e.jsx("button",{type:"button",className:r.imageActionBtn,onClick:()=>s&&s(T),title:g.designCard.downloadTitle,"aria-label":g.designCard.downloadAria,children:e.jsx(yi,{})})]})]})]})})}function Ab({retry:t,errorCode:a,embedMode:s,embedClientKey:i,t:o}){o=o||et.en;const[l,u]=h.useState(""),[p,g]=h.useState("idle"),[b,y]=h.useState(""),T=h.useCallback(async j=>{j&&j.preventDefault&&j.preventDefault();const P=l.trim().toLowerCase();if(!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(P)){g("error"),y(o.failedGenLead.errInvalid);return}g("submitting"),y("");try{const S=await Te("/api/save-failed-generation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:P,prompt:(t==null?void 0:t.text)||"",errorCode:a||"",clientKey:s&&i||"main",refImagePresent:!!(t!=null&&t.refUrl)})});if(!S.ok)throw new Error(`HTTP ${S.status}`);g("done")}catch{g("error"),y(s?o.failedGenLead.errSaveNeutral:o.failedGenLead.errSave)}},[l,t,a,s,i]);return p==="done"?e.jsx("p",{style:{marginTop:10,fontSize:"0.88rem",color:"#15803d",lineHeight:1.45},children:o.failedGenLead.doneText}):e.jsxs("form",{onSubmit:T,style:{marginTop:12,display:"flex",flexDirection:"column",gap:6},children:[e.jsx("label",{style:{fontSize:"0.85rem",color:"#475569",lineHeight:1.4},children:o.failedGenLead.label}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("input",{type:"email",value:l,onChange:j=>u(j.target.value),placeholder:o.failedGenLead.placeholder,required:!0,disabled:p==="submitting",style:{flex:"1 1 200px",minWidth:0,padding:"8px 10px",borderRadius:8,border:"1px solid #e5e7eb",fontSize:"0.9rem"}}),e.jsx("button",{type:"submit",disabled:p==="submitting",style:{padding:"8px 14px",borderRadius:8,border:"none",background:"#7c3aed",color:"#fff",fontSize:"0.9rem",fontWeight:600,cursor:p==="submitting"?"wait":"pointer"},children:p==="submitting"?o.failedGenLead.submitting:o.failedGenLead.submit})]}),p==="error"&&b&&e.jsx("span",{style:{fontSize:"0.82rem",color:"#b91c1c"},children:b})]})}const Yb=Object.freeze(Object.defineProperty({__proto__:null,default:lb},Symbol.toStringTag,{value:"Module"}));export{lb as A,Kb as T,Mi as a,Yb as b,qb as h,Gb as p,aa as s,Vb as t};
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.