PageSourceSearch

https://bluerevolution-cc.manus.space/assets/Globe3D-BOKP6bZZ.js

js bluerevolution-cc.manus.space collected 2026-10-03 05:02:21 UTC 11,852 bytes, 16 lines download raw bytes

1import{j as o}from"./editor-BhGk7_S1.js";import{b as a}from"./leaflet-DcfcX7a_.js";import{m as U}from"./mapbox-gl-DEKaLS0d.js";import{u as B,t as V}from"./index-BjIHAQhU.js";import{t as X}from"./countryTranslations--xXtAg9U.js";import{C as q}from"./check-DFqoFjW9.js";import{C as Y}from"./copy-XdjMT1NJ.js";import"./mapbox-BPFQ-Sfv.js";import"./trpc-DqtxhgQo.js";U.accessToken="pk.eyJ1IjoianBnb3V4IiwiYSI6ImNtaXFsZXoydTAwNDQzZnF0aGk1eWV3YXcifQ.MH45ZTKcC_vcmr_0rK2DKg";function ae({countries:D,contactLeadsByCountry:g,selectedStatuses:S,autoPlayAfterAnimation:M=!1}){console.log("🌐 Globe3D render",{countriesCount:D.length,contactLeadsKeys:Object.keys(g).length,selectedStatuses:S});const{t:r,language:T}=B(),_=a.useRef(null),e=a.useRef(null),[w,K]=a.useState(!1),[Z,O]=a.useState(!1),[s,y]=a.useState(null),[R,H]=a.useState({x:0,y:0}),[v,z]=a.useState(!1),f=a.useRef(null),N=a.useRef(null),[W,A]=a.useState(!1),k=a.useRef(!1);return a.useEffect(()=>{const t=()=>{O(window.innerWidth<768)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]),a.useEffect(()=>{if(!_.current||e.current)return;const t=window.innerWidth<768?.7:1.1;return e.current=new U.Map({container:_.current,style:"mapbox://styles/mapbox/dark-v11",projection:{name:"globe"},zoom:t,center:[10,20],pitch:0,pitchWithRotate:!1,dragRotate:!0,touchPitch:!1,antialias:window.innerWidth>=768,maxTileCacheSize:window.innerWidth<768?50:150}),e.current.on("load",()=>{e.current&&e.current.setPaintProperty("water","fill-color","#000000")}),e.current.on("style.load",()=>{e.current&&(e.current.setFog({color:"rgb(0, 119, 255)","high-color":"rgb(0, 47, 167)","horizon-blend":.02,"space-color":"rgb(10, 14, 39)","star-intensity":.6}),e.current.once("idle",()=>{K(!0)}))}),e.current.on("rotate",()=>{k.current||y(null)}),e.current.on("zoom",()=>{k.current||y(null)}),()=>{e.current&&(e.current.remove(),e.current=null)}},[]),a.useEffect(()=>{if(!e.current||!v){f.current!==null&&(cancelAnimationFrame(f.current),f.current=null);return}let t=!1;const u=.1,b=()=>{if(!e.current||!v||t)return;const h=e.current.getCenter();h.lng-=u,h.lng<-180&&(h.lng+=360),e.current.easeTo({center:h,duration:0,easing:$=>$}),f.current=requestAnimationFrame(b)},m=()=>{t=!0},i=()=>{t=!1,v&&(f.current=requestAnimationFrame(b))},n=()=>{t=!0},c=()=>{t=!1,v&&(f.current=requestAnimationFrame(b))};return e.current.on("mousedown",m),e.current.on("mouseup",i),e.current.on("touchstart",n),e.current.on("touchend",c),f.current=requestAnimationFrame(b),()=>{f.current!==null&&(cancelAnimationFrame(f.current),f.current=null),e.current&&(e.current.off("mousedown",m),e.current.off("mouseup",i),e.current.off("touchstart",n),e.current.off("touchend",c))}},[v]),a.useEffect(()=>{if(M&&w){const t=setTimeout(()=>{z(!0)},3e3);return()=>clearTimeout(t)}},[M,w]),a.useEffect(()=>{if(console.log("🔄 Globe3D useEffect triggered",{mapLoaded:w,countriesCount:D.length,contactLeadsCount:Object.keys(g).length,contactLeadsKeys:Object.keys(g),selectedStatuses:S}),!e.current||!w){console.log("⏸️  Globe3D useEffect skipped",{mapExists:!!e.current,mapLoaded:w});return}const t=[],u=new Set,b=Object.keys(g);console.log("🔑 First 10 contactLeadsByCountry keys:",b.slice(0,10));const m="#2563EB",i="#3B82F6",n="#60A5FA",c="#93C5FD",h="#002FA7";D.forEach(l=>{if(l.participating===1)u.has(l.iso2)||(t.push(l.iso2.toUpperCase(),h),u.add(l.iso2),console.log(`🎨 Coloring ${l.name} (${l.iso2}): ${h} (Participating)`));else{const d=g&&g[l.id];if(d&&d.length>0&&!u.has(l.iso2)){let p=c;const F=d.some(x=>x.status==="sure"),C=d.some(x=>x.status==="very_probable"),I=d.some(x=>x.status==="probable");F?p=m:C?p=i:I&&(p=n),t.push(l.iso2.toUpperCase(),p),u.add(l.iso2),console.log(`🎨 Coloring ${l.name} (${l.iso2}): ${p} (Potential)`)}}}),console.log("🎨 Color pairs count:",t.length/2),console.log("🔍 First 10 country names:",t.slice(0,20));const $=t.length>0?["match",["get","iso_3166_1"],...t,"#1a1a1a"]:["match",["get","iso_3166_1"],"XX","#1a1a1a","#1a1a1a"];return(()=>{if(e.current){e.current.getLayer("country-fills-custom")&&e.current.removeLayer("country-fills-custom"),e.current.getSource("country-boundaries-custom")&&e.current.removeSource("country-boundaries-custom");try{e.current.addSource("country-boundaries-custom",{type:"vector",url:"mapbox://mapbox.country-boundaries-v1"});const l=e.current.getStyle().layers;let P;for(const d of l)if(d.type==="symbol"){P=d.id;break}
1e.current.addLayer({id:"country-fills-custom",type:"fill",source:"country-boundaries-custom","source-layer":"country_boundaries",paint:{"fill-color":$,"fill-opacity":.85}},P),console.log("✅ Added custom country fills layer with",t.length/2,"countries"),e.current.on("mouseenter","country-fills-custom",()=>{e.current&&(e.current.getCanvas().style.cursor="pointer",console.log("👆 Mouse entered country layer"))}),e.current.on("mouseleave","country-fills-custom",()=>{e.current&&(e.current.getCanvas().style.cursor="",console.log("👆 Mouse left country layer"))}),e.current.once("idle",()=>{if(!e.current)return;console.log("🎯 Map is idle, attaching event listeners"),N.current&&e.current&&e.current.off("click","country-fills-custom",N.current);const d=p=>{if(!e.current||!p.features||p.features.length===0)return;const F=p.features[0];console.log("🖱️ Click detected on country layer",{feature:F.properties});const C=[F];if(C&&C.length>0){const x=C[0].properties?.iso_3166_1;if(console.log("🗺️ Clicked country ISO-2:",x),x){const j=D.find(G=>G.iso2.toUpperCase()===x.toUpperCase());if(console.log("🔍 Found country:",j?.name),j){const G=g[j.id]||[];console.log("📋 Contact leads for",j.name,":",G.length);let L;j.participating===1?L="participating":G.length>0?L="potential":L="notyet",y({country:X(j.name,T),status:L,leads:G.map(E=>({city:E.city,content:E.content,userFirstName:E.userFirstName,userLastName:E.userLastName,leadStatus:E.status}))}),H({x:p.point.x,y:p.point.y}),console.log("✅ Tooltip set")}else y(null)}else y(null)}else y(null)};N.current=d,e.current.on("click","country-fills-custom",d),e.current.on("mouseleave","country-fills-custom",()=>{y(null)})})}catch(l){console.error("❌ Error adding custom layer:",l)}}})(),()=>{N.current&&e.current&&(e.current.off("click",N.current),N.current=null)}},[D,g,S,w,T]),o.jsxs("div",{"data-loc":"client/src/components/Globe3D.tsx:439",className:"relative w-full h-[350px] md:h-[450px] rounded-lg overflow-hidden",children:[o.jsx("style",{"data-loc":"client/src/components/Globe3D.tsx:440",children:`
2        .mapboxgl-ctrl-attrib {
3          background-color: rgba(0, 0, 0, 0.8) !important;
4        }
5        .mapboxgl-ctrl-attrib a,
6        .mapboxgl-ctrl-attrib button {
7          color: #9ca3af !important;
8        }
9      `}),o.jsx("div",{"data-loc":"client/src/components/Globe3D.tsx:449",ref:_,className:"w-full h-full"}),o.jsx("button",{"data-loc":"client/src/components/Globe3D.tsx:452",onClick:()=>z(!v),className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 z-10 w-10 h-10 md:w-12 md:h-12 rounded-full bg-gradient-to-br from-blue-500 to-blue-700 hover:from-blue-600 hover:to-blue-800 text-white shadow-lg hover:shadow-xl transition-all duration-300 flex items-center justify-center group",title:v?r("home.pauseRotation")||"Pause rotation":r("home.playRotation")||"Play rotation",children:v?o.jsx("svg",{"data-loc":"client/src/components/Globe3D.tsx:458",xmlns:"http://www.w3.org/2000/svg",className:"w-5 h-5 md:w-6 md:h-6",viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{"data-loc":"client/src/components/Globe3D.tsx:459",d:"M6 4h4v16H6V4zm8 0h4v16h-4V4z"})}):o.jsx("svg",{"data-loc":"client/src/components/Globe3D.tsx:462",xmlns:"http://www.w3.org/2000/svg",className:"w-5 h-5 md:w-6 md:h-6",viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{"data-loc":"client/src/components/Globe3D.tsx:463",d:"M8 5v14l11-7z",transform:"translate(1, 0)"})})}),s&&o.jsxs("div",{"data-loc":"client/src/components/Globe3D.tsx:469",className:"absolute z-50 bg-card text-card-foreground rounded-md shadow-xl border border-border pointer-events-auto max-w-xs",style:{left:`${R.x+10}px`,top:`${R.y+10}px`,maxHeight:"min(400px, calc(100vh - 100px))",display:"flex",flexDirection:"column"},onMouseEnter:()=>{k.current=!0},onMouseLeave:()=>{k.current=!1,y(null)},children:[o.jsxs("div",{"data-loc":"client/src/components/Globe3D.tsx:489",className:"flex items-start justify-between gap-2 px-4 pt-3 pb-2 border-b border-border flex-shrink-0",children:[o.jsx("div",{"data-loc":"client/src/components/Globe3D.tsx:490",className:"font-bold text-lg",children:s.country}),o.jsx("button",{"data-loc":"client/src/components/Globe3D.tsx:491",onClick:()=>{const t=s.status==="participating"?r("home.participating"):s.status==="potential"?r("home.potential"):r("home.notYetParticipating");let u=`${s.country}
10${t}`;if(s.leads&&s.leads.length>0){u+=`
11
12${r("tooltip.contactLeads")}: ${s.leads.length}
13`;const b=["sure","very_probable","probable","uncertain"],m={sure:r("home.sure"),very_probable:r("home.veryProbable"),probable:r("home.probable"),uncertain:r("home.uncertain")};b.forEach(i=>
13{const n=s.leads.filter(c=>c.leadStatus===i);n.length>0&&(u+=`
14${m[i]} (${n.length}):
15`,n.forEach(c=>{const h=c.userFirstName||c.userLastName?` - ${c.userFirstName} ${c.userLastName}`:"";u+=`• ${c.city}${h}
16`}))})}navigator.clipboard.writeText(u),A(!0),V.success(r("tooltip.copied")||"Copié !"),setTimeout(()=>A(!1),2e3)},className:"flex-shrink-0 p-1.5 hover:bg-primary/10 rounded transition-colors",title:r("tooltip.copy")||"Copier",children:W?o.jsx(q,{"data-loc":"client/src/components/Globe3D.tsx:537",className:"w-4 h-4 text-[oklch(0.50_0.15_259)]"}):o.jsx(Y,{"data-loc":"client/src/components/Globe3D.tsx:539",className:"w-4 h-4 text-muted-foreground hover:text-primary"})})]}),o.jsxs("div",{"data-loc":"client/src/components/Globe3D.tsx:545",className:"overflow-y-auto px-4 py-3",style:{maxHeight:"calc(400px - 60px)"},children:[o.jsx("div",{"data-loc":"client/src/components/Globe3D.tsx:546",className:"text-sm font-semibold mb-2",style:{color:s.status==="participating"?"#002FA7":s.status==="potential"?"#5BA4E5":"#6b7280"},children:s.status==="participating"?r("home.participating"):s.status==="potential"?r("home.potential"):r("home.notYetParticipating")}),s.leads&&s.leads.length>0&&o.jsxs("div",{"data-loc":"client/src/components/Globe3D.tsx:556",className:"text-sm font-semibold mb-2 text-blue-400",children:[r("tooltip.contactLeads"),": ",s.leads.length]}),s.leads&&s.leads.length>0&&(()=>{const t=["sure","very_probable","probable","uncertain"],u={sure:r("home.sure"),very_probable:r("home.veryProbable"),probable:r("home.probable"),uncertain:r("home.uncertain")},b=t.reduce((m,i)=>{const n=s.leads.filter(c=>c.leadStatus===i);return n.length>0&&(m[i]=n),m},{});return o.jsx("div",{"data-loc":"client/src/components/Globe3D.tsx:579",className:"mt-2 pt-2 border-t border-border",children:o.jsx("div",{"data-loc":"client/src/components/Globe3D.tsx:580",className:"space-y-3",children:t.map(m=>{const i=b[m];return i?o.jsxs("div",{"data-loc":"client/src/components/Globe3D.tsx:586",children:[o.jsxs("div",{"data-loc":"client/src/components/Globe3D.tsx:587",className:"text-xs font-semibold text-blue-400 mb-1.5",children:[u[m]," (",i.length,")"]}),o.jsx("div",{"data-loc":"client/src/components/Globe3D.tsx:590",className:"space-y-1",children:i.map((n,c)=>o.jsxs("div",{"data-loc":"client/src/components/Globe3D.tsx:592",className:"text-xs pl-2",children:[o.jsx("span",{"data-loc":"client/src/components/Globe3D.tsx:593",className:"text-gray-400",children:n.city}),(n.userFirstName||n.userLastName)&&o.jsxs("span",{"data-loc":"client/src/components/Globe3D.tsx:595",className:"text-white",children:[" - ",n.userFirstName," ",n.userLastName]})]},c))})]},m):null})})})})()]})]})]})}export{ae 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.