PageSourceSearch

https://fossilsketch.org/_next/static/chunks/1294-aac9e6078b15bfb4.js

js fossilsketch.org collected 2026-10-09 00:42:12 UTC 19,172 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1294],{1191:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2784),i=n(2589);function a(e){var t=e.activityKey,n=e.classroomId,a=(0,r.useRef)(Date.now()),s=(0,r.useRef)(!0),o=(0,r.useRef)(0),c=(0,r.useRef)(0),l=(0,r.useRef)(0),u=(0,r.useRef)(null),d=i.S.useMutation(["user.logActivityTime"]).mutate;return(0,r.useEffect)((function(){if(Number.isFinite(n)&&!(n<=0)&&t){a.current=Date.now(),s.current=!0,o.current=0,c.current=0,l.current=0;var e=function(){var e=function(){var e=Date.now(),t=s.current?e-a.current:0;return Math.floor((o.current+t)/1e3)}()-c.current-l.current;e<=0||(l.current+=e,d({classroomId:n,activityKey:t,seconds:e},{onSuccess:function(){c.current+=e,l.current=Math.max(0,l.current-e)},onError:function(t){console.error("Failed to log activity time",t),l.current=Math.max(0,l.current-e)}}))},r=function(){var t=Date.now();"hidden"===document.visibilityState?(s.current&&(o.current+=t-a.current,s.current=!1),e()):s.current||(a.current=t,s.current=!0)},i=function(){var e=Date.now();s.current&&(o.current+=e-a.current,s.current=!1);var r=Math.floor(o.current/1e3)-c.current-l.current;r>0&&function(e){if(!e||e<=0)return!1;var r=new Blob([JSON.stringify({0:{classroomId:n,activityKey:t,seconds:Math.round(e)}})],{type:"application/json"});try{var i;return Boolean(null===(i=navigator.sendBeacon)||void 0===i?void 0:i.call(navigator,"/api/trpc/user.logActivityTime?batch=1",r))}catch(a){return console.error("Beacon failed",a),!1}}(r)&&(c.current+=r)};return document.addEventListener("visibilitychange",r),window.addEventListener("pagehide",i),u.current=window.setInterval(e,5e3),function(){document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",i),u.current&&clearInterval(u.current),s.current&&(o.current+=Date.now()-a.current,s.current=!1);var e=Math.floor(o.current/1e3)-c.current-l.current;e>0&&d({classroomId:n,activityKey:t,seconds:e})}}}),[t,n]),null}},7444:function(e,t,n){"use strict";var r=n(2322),i=(n(2784),n(9094)),a=n(6577),s=n.n(a);t.Z=function(e){var t=e.width,n=void 0===t?400:t,a=e.height,o=void 0===a?140:a,c=e.link,l=void 0===c?"/":c;return(0,r.jsx)(i.M,{children:(0,r.jsx)("a",{href:l,children:(0,r.jsx)(s(),{src:"/logos/logo.png",alt:"FossilSketch logo",width:n,height:o})})})}},2672:function(e,t,n){"use strict";var r=n(2322),i=n(2784),a=n(9097),s=n.n(a),o=n(5632),c=n(7082),l=n(2037),u=n.n(l),d=n(7841),f=n(8090),h=n(5117),p=n(9834),m=n(7973),v=n(2589),_=n(9454),g=n(8268),y=n(1191),x=n(5237),b=n.n(x)()((function(){return Promise.all([n.e(4546),n.e(7430),n.e(8364),n.e(2489)]).then(n.bind(n,2489))}),{loadableGenerated:{webpack:function(){return[2489]}},ssr:!1});t.Z=function(e){var t=e.link,n=e.button_title,a=e.stars,l=e.title,x=e.fossilIds,w=e.bgImage,k=e.fossilType,j=e.fossilImagePath,N=e.id,C=function(e){return(0,_.Kk)(e,(t=k)&&"ostracoda"===t.toLowerCase()?"ostracoda":"foraminifera");var t},S=function(){O(!F)},E=function(){var e={};return e.pathname=t.split("?",2)[0],void 0!=t.split("?",2)[1]&&(e.query={view:t.split("?",2)[1]}),e},I=function(){t.includes("identify_fossil")&&0!==x.length&&(!function(){if(t.includes("identify_fossil")&&0!==x.length){var e=Math.floor(Math.random()*x.length);D.setCurrentFossil(x[e])}}(),T.push(E()))},Z=function(e){return"model"===e?(0,r.jsxs)("div",{className:u().module_icon_container,children:[(0,r.jsx)(d.z,{className:u().background,style:{backgroundImage:V,backgroundSize:"contain"},onClick:function(){return K(!0)}}),(0,r.jsx)(d.z,{size:"lg",radius:"xl",className:u().name,onClick:function(){return K(!0)},children:n})]}):(0,r.jsxs)("div",{className:u().module_icon_container,children:[(0,r.jsx)(d.z,{className:u().background,style:{backgroundImage:V,backgroundSize:t.includes("identify_fossil")?"contain":"cover"},onClick:function(){return t.includes("identify_fossil")?I():void 0}}),(0,r.jsx)(d.z,{size:"lg",radius:"xl",className:u().name,onClick:function(){return t.includes("identify_fossil")?I():void 0},children:n})]})},T=(0,o.useRouter)(),P=(0,i.useRef)(null),L=(0,i.useRef)(null),M=(0,i.useRef)(0),R=(0,i.useRef)(null),D=(0,i.useContext)(m.Z),z=(0,i.useState)(!1),F=z[0],O=z[1],W=(0,i.useState)(""),A=(W[0],W[1],(0,i.use
1State)(!1)),B=A[0],K=A[1],J=(0,i.useState)(""),V=J[0],H=J[1],U=v.S.useMutation(["classroom.getFossil"],{onSuccess:function(e){var t;if(null===e||void 0===e||null===(t=e.fossilData)||void 0===t?void 0:t.imagePath){var n=C(e.fossilData.imagePath);n&&H('url("'.concat(n,'")'))}}}),X=U.mutate,q=v.S.useMutation(["user.saveVideoView"]).mutate,G=function(e){try{var t,n=new URL(e),r=n.searchParams.get("v");return r||(null!==(t=n.pathname.split("/").filter(Boolean).pop())&&void 0!==t?t:"").split("?")[0]}catch(a){var i;return(null!==(i=e.split("/").pop())&&void 0!==i?i:"").split("?")[0]}},Y=function(){R.current&&(clearInterval(R.current),R.current=null)};return(0,i.useEffect)((function(){H(function(){if(w&&(w.startsWith("http://")||w.startsWith("https://")||w.startsWith("/")))return'url("'.concat(w,'")');var e=t.includes("sketchfab")||/\.(glb|gltf)$/i.test(t)||t.includes("/3D_models/");if(!t.includes("identify_fossil")&&!e)return'url("/video_thumbnails/'+w+'")';if("?"!==n){if(j&&x.length>0){var r=C(j);if(r)return'url("'.concat(r,'")')}x.length>0&&X({fossilId:x[0],fossilType:k})}return'url("/icons/questionmark.jpg")'}())}),[n,j]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.u,{opened:B,onClose:function(){return K(!1)},centered:!0,overlayOpacity:.4,size:"70vw",withCloseButton:!0,styles:{modal:{background:"#1a1a1a"},body:{padding:0,minHeight:"60vh"}},style:{textAlign:"center"},children:B&&(0,r.jsx)(b,{src:(0,_.JF)(t,n)||"",alt:n})}),(0,r.jsxs)("div",{className:u().container,children:[(0,r.jsxs)("div",{className:u().module_icon_container,children:[!t.includes("youtube")&&(0,r.jsxs)("div",{className:u().module_icon_container,children:[!t.includes("identify_fossil")&&(0,r.jsx)(h.x,{className:u().title,children:l}),t.includes("sketchfab")||t.endsWith(".glb")||t.endsWith(".gltf")||t.includes("/3D_models/")||t.includes("/api/uploads/3D_models/")?(0,r.jsx)("a",{children:Z("model")}):t.includes("https")?(0,r.jsx)(s(),{href:E(),children:(0,r.jsx)("a",{target:"_blank",children:Z("fossil")})}):t.includes("identify_fossil")?Z("fossil"):(0,r.jsx)(s(),{href:E(),children:Z("fossil")})]}),(null===t||void 0===t?void 0:t.includes("youtube"))&&(0,r.jsxs)("div",{className:u().module_icon_container,children:[(0,r.jsx)(h.x,{className:u().title,children:l}),(0,r.jsx)(d.z,{className:u().background,style:{backgroundImage:V},onClick:S}),(0,r.jsx)(d.z,{size:"lg",radius:"xl",className:u().name,onClick:S,children:n})]}),-1!==a&&(0,r.jsx)("div",{style:{backgroundImage:'url("/icons/star'+a+'.svg")'},className:u().star_rating})]}),(null===t||void 0===t?void 0:t.includes("youtube"))&&(0,r.jsx)("div",{className:F?u().video_overlay_active:u().video_overlay,onClick:S,children:(0,r.jsxs)("div",{className:u().video_container,children:[(0,r.jsx)(p.A,{onClick:function(){P.current&&P.current.internalPlayer.pauseVideo(),O(!1)},variant:"transparent",component:"a",size:"xl",className:u().close_button,children:(0,r.jsx)(c.Z,{width:64,height:64})}),F&&D.currentClass&&(0,r.jsx)(y.Z,{activityKey:function(){var e=(l||"").toLowerCase();return e.includes("microfossils")?"microfossils_video":e.includes("ostracod")?"ostracod_video":e.includes("foraminifera")?"foraminifera_video":e.includes("morphotype")?"morphotype_video":"video"}(),classroomId:parseInt(D.currentClass)}),(0,r.jsx)(g.Z,{ref:P,videoId:G(t),opts:{playerVars:{autoplay:0,rel:0,controls:0,disablekb:1,fs:0,modestbranding:1,iv_load_policy:3,playsinline:1}},onReady:function(e){L.current=e.target;try{e.target.setPlaybackRate(1)}catch(t){}e.target.pauseVideo()},onStateChange:function(e){var t=e.data;L.current||(L.current=e.target),1===t?(Y(),R.current=window.setInterval((function(){try{var e=L.current.getCurrentTime();if("number"===typeof e){if(e>M.current+1)return void L.current.seekTo(M.current,!0);e>M.current&&(M.current=e)}}catch(t){}}),500)):Y()},onPlaybackRateChange:function(e){if(1!==e.data&&L.current)try{L.current.setPlaybackRate(1)}catch(t){}},onEnd:function(e){e.target.seekTo(0),e.target.pauseVideo(),0===D.role&&q({classroomId:parseInt(D.currentClass),moduleId:N,videoId:G(t)})}})]})})]})]})}},2468:function(e,t,n){"use strict";var r=n(930),i=n(2322),a=n(2784),s=n(2589),o=n(2927),c=n.n(o),l=n(5117),u=n(8855),d=n(7973);t.Z=function(e){var t=e.classHandler,n=e.joinClassHandler,o=(0,a.useContext)(d.Z),f=(0,a.useState)([]),h=f[0],p=f[1];return s.S.useQuery(["classroom.getClasses"],{onSuccess:function(e){p(e.map((function(e){return{value:e.id,label:e.name}}))),!o.currentClass&&e.length>0&&(o.setCurrentClass(e[0].id),t(e[0].id))}}),(0,a.useEffect)((function(){0==o.role&&h.length>0&&!h.some((function(e){return"-1"===e.value}))&&p((function(e){return(0,r.Z)(e).concat([{value:"-1",label:"+ Join New Class"}])}))}),[h]),(0,i.jsx)("div",{children:h.length>0&&(0,i.jsxs)("div",{className:c().select_class_container,children:[(0,i.jsx)(l.x,{className:c().select_class_text,children:"SELECTED CLASS:"}),(0,i.jsx)(u.Ph,{placeholder:"Select Class",value:o.currentClass,onChange:function(e){"-1"==e?n():(o.setCurrentClass(e),t(e))},data:h,radius:"xl",size:"md",classNames:{input:c().select_input,dropdown:c().select_dropdown,item:c().select_item}})]})})}},1783:function(e,t,n){"use strict";var r=n(2322),i=n(2784),a=n(7001),s=n(4736),o=n(7973),c=n(7648),l=n(5092),u=n(3341),d=n(8454),f=n(2183),h=n(5166),p=n(8890),m=n(7444),v=n(4621),_=n.n(v),g=n(9097),y=n.n(g),x=n(5632),b=[{path:"/home",text:"Home",icon:c.Z,visibleTo:[0,1,2]},{path:"/database",text:"Database",icon:l.Z,visibleTo:[0,1,2]},{path:"/progress",text:"Progress",icon:u.Z,visibleTo:[0]}
1],w=[{path:"/instructor/student_stats",text:"Student Statistics",icon:d.Z,visibleTo:[1,2]},{path:"/instructor/game_builder",text:"Game Builder",icon:f.Z,visibleTo:[2]},{path:"/instructor/new_fossil",text:"New Microfossil",icon:d.Z,visibleTo:[1,2]},{path:"/instructor/new_class",text:"New Class",icon:d.Z,visibleTo:[1,2]},{path:"/instructor/game_builder?tab=matching",text:"Matching Games",icon:d.Z,visibleTo:[2]},{path:"/instructor/add_instructor",text:"Add Instructor",icon:d.Z,visibleTo:[2]},{path:"/instructor/select_content",text:"Select Content",icon:d.Z,visibleTo:[1,2]}];t.Z=function(e){var t=e.handleLogout,n=(0,x.useRouter)(),c=(0,i.useContext)(o.Z),l=c.role,u=c.currentClass,d=c.setRole,f=(0,i.useState)(null!==l&&void 0!==l?l:-1),v=f[0],g=f[1];(0,i.useEffect)((function(){var e=localStorage.getItem("role");if(null!==e){var t=parseInt(e,10);if(!Number.isNaN(t))return g(t),void d(t)}void 0!==l&&null!==l&&l>=0&&g(l)}),[l,d]);var k=(0,i.useState)(!1),j=k[0],N=k[1],C=function(e){var t=e.split("?")[0];return n.pathname===t?"".concat(_().link_icon," ").concat(_().active):_().link_icon},S=function(e){var t=e.split("?")[0];return n.pathname===t?"".concat(_().link," ").concat(_().active):_().link};return(0,r.jsxs)("div",{children:[(0,r.jsxs)(a.d,{opened:j,onClose:function(){return N(!1)},size:"md",padding:"xl",overlayOpacity:.3,classNames:{drawer:_().drawer},children:[(0,r.jsx)("div",{className:_().logo,children:(0,r.jsx)(m.Z,{width:270,height:100,link:"/home"})}),b.map((function(e){return e.visibleTo.includes(v)&&(0,r.jsxs)("div",{className:_().link_container,children:[(0,r.jsx)(e.icon,{className:C(e.path)}),(0,r.jsx)(y(),{href:e.path,children:(0,r.jsx)("a",{className:S(e.path),children:e.text})})]},e.path)})),v>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:_().link_container,children:[(0,r.jsx)(h.Z,{className:_().link_icon}),(0,r.jsx)("div",{className:_().link,style:{cursor:"default"},children:"Manage"})]}),(0,r.jsx)("div",{className:_().instructor_container,children:w.filter((function(e){return"/instru
1ctor/add_instructor"!==e.path||"47"!==u&&"48"!==u})).map((function(e){return e.visibleTo.includes(v)&&(0,r.jsxs)("div",{className:"".concat(_().link_container," ").concat(_().manage_link),children:[(0,r.jsx)(e.icon,{className:C(e.path)}),(0,r.jsx)(y(),{href:e.path,children:(0,r.jsx)("a",{className:S(e.path),children:e.text})})]},e.path)}))})]}),(0,r.jsxs)("div",{className:_().link_container,children:[(0,r.jsx)(p.Z,{className:_().link_icon}),(0,r.jsx)("a",{className:_().link,onClick:function(){return t()},children:"Logout"})]})]}),(0,r.jsx)(s.k,{onClick:function(){return N(!0)},children:(0,r.jsx)("div",{className:_().toggle_menu})})]})}},9454:function(e,t,n){"use strict";n.d(t,{DE:function(){return _},Ix:function(){return c},JF:function(){return h},Kk:function(){return g},NO:function(){return d},a9:function(){return v},ao:function(){return p},h0:function(){return s},yk:function(){return y}});var r=n(8788),i=n(2838),a=n(2970);function s(e,t,n){return o.apply(this,arguments)}function o(){return(o=(0,r.Z)((function(e,t,n){return(0,a.__generator)(this,(function(r){return(0,i.Z)(e,File)?[2,new Promise((function(r,i){var a=new FormData;a.append("image",e),a.append("fossilType",t);var s=new XMLHttpRequest;s.upload.addEventListener("progress",(function(e){if(e.lengthComputable){var t=Math.round(e.loaded/e.total*100);n({percentage:t,status:"uploading"})}})),s.addEventListener("load",(function(){if(s.status>=200&&s.status<300)try{var e=JSON.parse(s.responseText);e.imagePath?(n({percentage:100,status:"success"}),r(e.imagePath)):(n({percentage:100,status:"error",error:"No image path in response"}),i(new Error("No image path in response")))}catch(t){n({percentage:100,status:"error",error:"Failed to parse response"}),i(new Error("Failed to parse response"))}else n({percentage:100,status:"error",error:"Upload failed: ".concat(s.status)}),i(new Error("Upload failed with status ".concat(s.status)))})),s.addEventListener("error",(function(){n({percentage:0,status:"error",error:"Network error"}),i(new Error("Network error"))})),s.open("POST","/api/uploadImage"),s.send(a)}))]:[2]}))}))).apply(this,arguments)}function c(e,t){return l.apply(this,arguments)}function l(){return(l=(0,r.Z)((function(e,t){var n,r,s,o;return(0,a.__generator)(this,(function(a){switch(a.label){case 0:return(0,i.Z)(e,File)?((n=new FormData).append("image",e),n.append("fossilType",t),s={},[4,fetch("/api/uploadImage",(s.method="POST",s.body=n,s))]):[2];case 1:return[4,(r=a.sent()).json().catch((function(){return{}}))];case 2:if(o=a.sent(),!r.ok)throw new Error("string"===typeof o.error?o.error:"Upload failed (".concat(r.status,")"));if(o.imagePath)return[2,o.imagePath];throw new Error("Server did not return an image path")}}))}))).apply(this,arguments)}function u(){var e=window.location,t=e.hostname,n=e.protocol;return"localhost"===t||"127.0.0.1"===t?"".concat(n,"//").concat(t,":8000/api/uploadImage"):"/api/uploadImage"}function d(e,t){return f.apply(this,arguments)}function f(){return(f=(0,r.Z)((function(e,t){return(0,a.__generator)(this,(function(n){if(!(0,i.Z)(e,File))throw new Error("Invalid file");return[2,new Promise((function(n,r){var i=new FormData;i.append("image",e),i.append("fossilType","3D_models");var a=new XMLHttpRequest;a.withCredentials=!0,a.upload.addEventListener("progress",(function(e){if(e.lengthComputable){var n=Math.min(99,Math.round(e.loaded/e.total*100));null===t||void 0===t||t({percentage:n,status:"uploading"})}})),a.addEventListener("load",(function(){var e={};try{e=JSON.parse(a.responseText||"{}")}catch(s){}if(a.status>=200&&a.status<300&&e.imagePath)return null===t||void 0===t||t({percentage:100,status:"success"}),void n(e.imagePath);var i="string"===typeof e.error?e.error:"Upload failed (".concat(a.status||"network",")");null===t||void 0===t||t({percentage:0,status:"error",error:i}),r(new Error(i))})),a.addEventListener("error",(function(){null===t||void 0===t||t({percentage:0,status:"error",error:"Network error"}),r(new Error("Network error during model upload"))})),a.addEventListener("timeout",(function(){r(new Error("Upload timed out"))})),a.open("POST",u()),a.timeout=6e5,null===t||void 0===t||t({percentage:0,status:"uploading"}),a.send(i)}))]}))}))).apply(this,arguments)}function h(e,t){if(!(null===e||void 0===e?void 0:e.trim()))return null;
1var n=e.trim(),r=n.startsWith("{")||/sketchfab\.com/i.test(n);if(!r&&/\.(glb|gltf)$/i.test(n))return/^https?:\/\//i.test(n)||n.startsWith("/")?n:v(n.startsWith("/")?n.slice(1):n);if(null===t||void 0===t?void 0:t.trim()){var i=t.toLowerCase().replace(/^fossil\s+/,"").trim(),a="trifarina"===i?"trifarina_angulosa":i.replace(/ /g,"_");return"https://storage.googleapis.com/fossilsketch/3D_models/".concat(a,".glb")}return null}function p(e,t){return m.apply(this,arguments)}function m(){return(m=(0,r.Z)((function(e,t){var n;return(0,a.__generator)(this,(function(r){switch(r.label){case 0:return""===e?[3,2]:(n={},[4,fetch("/api/deleteImage",(n.method="POST",n.headers={"Content-Type":"application/json"},n.body=JSON.stringify({fileName:e,fossilType:t.toLowerCase()}),n)).then((function(e){return e.json()}))]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))).apply(this,arguments)}function v(e){if(e.startsWith("http"))return e;return"https://storage.googleapis.com/".concat("fossilsketch","/").concat(e.startsWith("/")?e.substring(1):e)}function _(e){var t=e.toLowerCase();return"foraminifera"===t||"forams"===t||"morphotype"===t||"morphotypes"===t?"foraminifera":"ostracoda"===t?"ostracoda":t}function g(e,t){if(!(null===e||void 0===e?void 0:e.trim()))return null;var n=e.trim();if(/^https?:\/\//i.test(n))return n;if(n.startsWith("/api/uploads/"))return n;var r=_(t),i=n.replaceAll(" ","");return i.includes("/")||(i="".concat(r,"/").concat(i)),"localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname?"/api/uploads/".concat(i):v(i)}function y(e){return x.apply(this,arguments)}function x(){return(x=(0,r.Z)((function(e){var t,n;return(0,a.__generator)(this,(function(r){switch(r.label){case 0:return""===e?[3,2]:(n={},[4,fetch("/api/fetchImageNames",(n.method="POST",n.headers={"Content-Type":"application/json"},n.body=JSON.stringify({folderName:e}),n)).then((function(e){return e.json()}))]);case 1:return(t=r.sent()).imagePaths?[2,t.imagePaths]:[2,[]];case 2:return[2]}}
1))}))).apply(this,arguments)}},2037:function(e){e.exports={container:"module_icon_container__w4Ywq",module_icon_container:"module_icon_module_icon_container__efvbr",background:"module_icon_background__H5lGP",name:"module_icon_name__Mm8PX",title:"module_icon_title__Gd0hS",star_rating:"module_icon_star_rating__W6a0I",video_overlay:"module_icon_video_overlay__rWEVn",video_overlay_active:"module_icon_video_overlay_active___nqsE",video_container:"module_icon_video_container__BsMS2",close_button:"module_icon_close_button__PyWxj"}},2927:function(e){e.exports={select_class_container:"select_classroom_select_class_container__X3OUR",select_class_text:"select_classroom_select_class_text__AyYWR"}},4621:function(e){e.exports={drawer:"sidebar_drawer__KpNLV",logo:"sidebar_logo__3EwEr",link_container:"sidebar_link_container__pZwwX",link_icon:"sidebar_link_icon___D4fO",active:"sidebar_active__zubOB",link:"sidebar_link__gXfrl",instructor_container:"sidebar_instructor_container__K4glu",manage_link:"sidebar_manage_link__MXySh",toggle_menu:"sidebar_toggle_menu__dg0Az"}}}]);

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.