PageSourceSearch

https://dtweeklypresents.base44.app/assets/Ballot-Z604kONv.js

js dtweeklypresents.base44.app collected 2026-10-03 03:13:12 UTC 11,772 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B_oCfkOd.js","assets/index-DXt5Jah9.css"])))=>i.map(i=>d[i]);
2var G=a=>{throw TypeError(a)};var E=(a,t,s)=>t.has(a)||G("Cannot "+s);var l=(a,t,s)=>(E(a,t,"read from private field"),s?s.call(a):t.get(a)),y=(a,t,s)=>t.has(a)?G("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,s),N=(a,t,s,r)=>(E(a,t,"write to private field"),r?r.call(a,s):t.set(a,s),s),_=(a,t,s)=>(E(a,t,"access private method"),s);import{S as U,s as F,n as M,o as Y,p as L,a as z,r as b,q as Q,t as W,j as e,m as V,C as K,v as H,w as $,g as J,x as S,f as q,B as j,l as A,y as I,z as X,I as Z,F as ee,T as te,_ as se,d as ae,e as C}from"./index-B_oCfkOd.js";import{L as O}from"./lock-DnHnmFrZ.js";import{V as re}from"./vote-BWKsqDqX.js";import{S as P}from"./Snowfall-B-pO6T-o.js";var f,w,m,g,v,k,B,R,ie=(R=class extends U{constructor(t,s){super();y(this,v);y(this,f);y(this,w);y(this,m);y(this,g);N(this,f,t),this.setOptions(s),this.bindMethods(),_(this,v,k).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const s=this.options;this.options=l(this,f).defaultMutationOptions(t),F(this.options,s)||l(this,f).getMutationCache().notify({type:"observerOptionsUpdated",mutation:l(this,m),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&M(s.mutationKey)!==M(this.options.mutationKey)?this.reset():((r=l(this,m))==null?void 0:r.state.status)==="pending"&&l(this,m).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=l(this,m))==null||t.removeObserver(this)}onMutationUpdate(t){_(this,v,k).call(this),_(this,v,B).call(this,t)}getCurrentResult(){return l(this,w)}reset(){var t;(t=l(this,m))==null||t.removeObserver(this),N(this,m,void 0),_(this,v,k).call(this),_(this,v,B).call(this)}mutate(t,s){var r;return N(this,g,s),(r=l(this,m))==null||r.removeObserver(this),N(this,m,l(this,f).getMutationCache().build(l(this,f),this.options)),l(this,m).addObserver(this),l(this,m).execute(t)}},f=new WeakMap,w=new WeakMap,m=new WeakMap,g=new WeakMap,v=new WeakSet,k=function(){var s;const t=((s=l(this,m))==null?void 0:s.state)??Y();N(this,w,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},B=function(t){L.batch(()=>{var s,r,n,u,h,i,d,o;if(l(this,g)&&this.hasListeners()){const c=l(this,w).variables,x=l(this,w).context,p={client:l(this,f),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((r=(s=l(this,g)).onSuccess)==null||r.call(s,t.data,c,x,p),(u=(n=l(this,g)).onSettled)==null||u.call(n,t.data,null,c,x,p)):(t==null?void 0:t.type)==="error"&&((i=(h=l(this,g)).onError)==null||i.call(h,t.error,c,x,p),(o=(d=l(this,g)).onSettled)==null||o.call(d,void 0,t.error,c,x,p))}this.listeners.forEach(c=>{c(l(this,w))})})},R);function le(a,t){const s=z(),[r]=b.useState(()=>new ie(s,a));b.useEffect(()=>{r.setOptions(a)},[r,a]);const n=b.useSyncExternalStore(b.useCallback(h=>r.subscribe(L.batchCalls(h)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),u=b.useCallback((h,i)=>{r.mutate(h,i).catch(Q)},[r]);if(n.error&&W(r.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:u,mutateAsync:n.mutate}}const oe={greatest_marketplace:"Greatest Marketplace",greatest_apartments:"Greatest Apartments",greatest_outdoors:"Greatest Outdoors",greatest_photo_art:"Greatest Photo Opp",greatest_gifts:"Greatest Gifts",greatest_snow:"Greatest Snow",greatest_ornaments:"Greatest Ornaments",greatest_star:"Greatest Star",greatest_window_display:"Greatest Window Display",greatest_lights:"Greatest Lights",mrs_cluster_favorite:"Mrs Cluster Favorite",jacked_up:"Jacked Up 😬"};function T({category:a,entries:t,votedTreeId:s,onVote:r,hasBallot:n,isAuthenticated:u}){const h=b.useRef(null),i=t.filter(o=>{var c;return((c=o.categories)==null?void 0:c.includes(a))||o.category===a}),d=()=>{h.current&&h.current.scrollBy({left:200,behavior:"smooth"})};return i.length===0?null:e.jsx(V.div,{initial:{opacity:0,y:20}
2,animate:{opacity:1,y:0},className:"mb-6",children:e.jsxs(K,{className:"border-0 shadow-lg bg-white/95 backdrop-blur-sm overflow-hidden",children:[e.jsx(H,{className:"bg-gradient-to-r from-amber-500/70 to-red-950/80 backdrop-blur-sm text-white py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx($,{className:"text-lg font-bold",children:oe[a]||a}),s&&e.jsxs(J,{className:"bg-white/20 text-white border-0",children:[e.jsx(S,{className:"w-3 h-3 mr-1"}),"Voted"]})]})}),e.jsx(q,{className:"p-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{ref:h,className:"flex gap-3 overflow-x-auto pb-2",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:i.map(o=>{const c=s===o.id;return e.jsxs(V.div,{whileHover:{scale:1.02},className:`relative rounded-xl overflow-hidden border-2 transition-all flex-shrink-0 w-40 ${c?"border-emerald-500 ring-2 ring-emerald-500/50":"border-transparent hover:border-gray-200"}`,children:[e.jsxs("div",{className:"aspect-square relative",children:[e.jsx("img",{src:o.photo_url,alt:o.owner_name,className:"w-full h-full object-cover",onError:x=>{x.target.src="https://images.unsplash.com/photo-1543589077-47d81606c1bf?w=400"}}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-transparent to-transparent"}),c&&e.jsx("div",{className:"absolute top-2 right-2 bg-emerald-500 text-white p-1.5 rounded-full",children:e.jsx(S,{className:"w-4 h-4"})}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-2",children:[e.jsx("p",{className:"text-white font-semibold text-sm truncate",children:o.owner_name}),e.jsx("p",{className:"text-white/70 text-xs truncate",children:o.address}),e.jsxs("p",{className:"text-emerald-300 text-xs mt-1",children:[o.votes||0," votes"]})]})]}),e.jsx("div",{className:"p-2 bg-gray-50",children:u?n?c?e.jsxs(j,{size:"sm",className:"w-full text-xs bg-emerald-500 hover:bg-emerald-600",disabled:!0,children:[e.jsx(S,{className:"w-3 h-3 mr-1"}),"Your Vote"]}):e.jsxs(j,{size:"sm",onClick:()=>r(o),className:"w-full text-xs bg-gradient-to-r from-red-500 to-rose-600 hover:from-red-600 hover:to-rose-700",children:[e.jsx(re,{className:"w-3 h-3 mr-1"}),"Vote"]}):e.jsx(A,{to:I("PurchaseBallot"),className:"w-full",children:e.jsxs(j,{size:"sm",variant:"outline",className:"w-full text-xs",children:[e.jsx(O,{className:"w-3 h-3 mr-1"}),"Get ballot"]})}):e.jsxs(j,{size:"sm",variant:"outline",className:"w-full text-xs",disabled:!0,children:[e.jsx(O,{className:"w-3 h-3 mr-1"}),"Sign in"]})})]},o.id)})}),i.length>2&&e.jsx(j,{onClick:d,size:"icon",className:"absolute right-0 top-1/2 -translate-y-1/2 bg-black/50 hover:bg-black/70 text-white rounded-full shadow-lg z-10",children:e.jsx(X,{className:"w-5 h-5"})})]})})]})})}function ne({onVerified:a}){const[t,s]=b.useState(""),[r,n]=b.useState(""),[u,h]=b.useState(!1),i=async()=>{if(!t||!t.includes("@")){n("Please enter a valid email address");return}h(!0),n("");try{const{base44:d}=await se(async()=>{const{base44:x}=await import("./index-B_oCfkOd.js").then(p=>p.aG);return{base44:x}},__vite__mapDeps([0,1])),c=(await d.entities.BallotPurchase.list()).filter(x=>{var p;return((p=x.email)==null?void 0:p.toLowerCase().trim())===t.toLowerCase().trim()});c&&c.length>0?a(c[0]):n("No ballot found for this email. Please purchase a ballot first.")}catch{n("Error verifying ballot. Please try again.")}finally{h(!1)}};return e.jsx(V.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"max-w-md mx-auto",children:e.jsx(K,{className:"border-0 shadow-xl bg-white/95 backdrop-blur-sm",children:e.jsxs(q,{className:"p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-amber-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(O,{className:"w-8 h-8 text-amber-600"})}),e.jsx("h2",{className:"text-2xl font-bold text-gray-800 mb-2",children:"Verify Your Ballot"}),e.jsx("p",{className:"text-gray-500 mb-6",children:"Enter the email address used to purchase your ballot"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email Address"}),e.jsx(Z,{type:"email",placeholder:"[email protected]",value:t,onChange:d=>{s(d.target.value),n("")},onKeyDown:d=>d.key==="Enter"&&i(),className:"w-full"})]}),r&&e.jsx("p",{className:"text-sm text-red-500 text-left",children:r}),e.jsxs(j,{onClick:i,disabled:u,className:"w-full bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white border-0 shadow-lg py-6",children:[u?"Verifying...":"
2Verify Ballot",e.jsx(ee,{className:"w-4 h-4 ml-2"})]})]}),e.jsxs("div",{className:"mt-6 pt-6 border-t",children:[e.jsx("p",{className:"text-sm text-gray-500 mb-3",children:"Don't have a ballot yet?"}),e.jsx(A,{to:I("PurchaseBallot"),children:e.jsxs(j,{variant:"outline",className:"gap-2",children:[e.jsx(te,{className:"w-4 h-4"}),"Get Your Ballot - $4.99"]})})]})]})})})}function xe(){const[a,t]=b.useState(null),s=["greatest_marketplace","greatest_apartments","greatest_outdoors","greatest_photo_art","greatest_gifts","greatest_snow","greatest_ornaments","greatest_star","greatest_window_display","greatest_lights","mrs_cluster_favorite","jacked_up"],r=z(),n=(a==null?void 0:a.voted_categories)||{},{data:u=[]}=ae({queryKey:["treeEntries"],queryFn:async()=>(await C.entities.TreeEntry.list()).sort((d,o)=>(d.owner_name||"").localeCompare(o.owner_name||""))}),h=le({mutationFn:async i=>{var x;const d=((x=i.categories)==null?void 0:x[0])||i.category,o=n[d];if(o===i.id)return;if(o){const p=u.find(D=>D.id===o);p&&await C.entities.TreeEntry.update(o,{votes:Math.max(0,(p.votes||1)-1)})}await C.entities.TreeEntry.update(i.id,{votes:(i.votes||0)+1});const c={...n,[d]:i.id};await C.entities.BallotPurchase.update(a.id,{voted_categories:c}),t({...a,voted_categories:c})},onSuccess:()=>{r.invalidateQueries({queryKey:["treeEntries"]})}});return a?e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-900 via-emerald-950 to-slate-900 relative",children:[e.jsx(P,{}),e.jsx("div",{className:"relative z-10 pt-16 pb-6 px-4",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx("div",{className:"flex items-center justify-between flex-wrap gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-white",children:"Official Great Tree Voting Ballot"}),e.jsx("p",{className:"text-gray-300",children:'Scroll through each category and tap "Vote" on your favorite tree. You can vote once per category.'})]})}),e.jsx("div",{className:"mt-6 bg-white/10 backdrop-blur-sm rounded-xl p-4 border border-white/20",children:e.jsx("p",{className:"text-amber-300 text-sm font-medium",children:'The top 5 trees with the most votes automatically advance to "Greatest Tree"! Winner announced December 25th!'})})]})}),e.jsx("div",{className:"relative z-10 max-w-6xl mx-auto px-4 pb-16",children:s.map(i=>e.jsx(T,{category:i,entries:u,votedTreeId:n[i],onVote:d=>h.mutate(d),hasBallot:!0,isAuthenticated:!0},i))})]}):e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-900 via-emerald-950 to-slate-900 relative overflow-hidden",children:[e.jsx(P,{}),e.jsx("div",{className:"absolute inset-0 opacity-20 pointer-events-none overflow-y-auto pt-20 px-4",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:s.slice(0,4).map(i=>e.jsx(T,{category:i,entries:u,votedTreeId:null,onVote:()=>{},hasBallot:!1,isAuthenticated:!1},i))})}),e.jsx("div",{className:"relative z-10 min-h-screen flex items-center justify-center p-4",children:e.jsx(ne,{onVerified:t})})]})}export{xe as default};

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.