1 line
No EOL
16 KiB
JavaScript
1 line
No EOL
16 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[893],{2269:(e,t,s)=>{"use strict";var r=s(9509);s(8375);var i=s(2115),n=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(i),o=void 0!==r&&r.env&&!0,a=function(e){return"[object String]"===Object.prototype.toString.call(e)},d=function(){function e(e){var t=void 0===e?{}:e,s=t.name,r=void 0===s?"stylesheet":s,i=t.optimizeForSpeed,n=void 0===i?o:i;c(a(r),"`name` must be a string"),this._name=r,this._deletedRulePlaceholder="#"+r+"-deleted-rule____{}",c("boolean"==typeof n,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=n,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var d="undefined"!=typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=d?d.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){c("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),c(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(c(!this._injected,"sheet already injected"),this._injected=!0,"undefined"!=typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(o||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(c(a(e),"`insertRule` accepts only strings"),"undefined"==typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return o||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var r=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,r))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"undefined"==typeof window){var s="undefined"!=typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(r){o||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var r=this._tags[e];c(r,"old rule at index `"+e+"` not found"),r.textContent=t}return e},s.deleteRule=function(e){if("undefined"==typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];c(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"undefined"!=typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"undefined"==typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&c(a(t),"makeStyleTag accepts only strings as second parameter");var r=document.createElement("style");this._nonce&&r.setAttribute("nonce",this._nonce),r.type="text/css",r.setAttribute("data-"+e,""),t&&r.appendChild(document.createTextNode(t));var i=document.head||document.getElementsByTagName("head")[0];return s?i.insertBefore(r,s):i.appendChild(r),r},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function c(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var l=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var s=String(t),r=e+s;return u[r]||(u[r]="jsx-"+l(e+"-"+s)),u[r]}function m(e,t){"undefined"==typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var f=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,r=void 0===s?null:s,i=t.optimizeForSpeed,n=void 0!==i&&i;this._sheet=r||new d({name:"styled-jsx",optimizeForSpeed:n}),this._sheet.inject(),r&&"boolean"==typeof n&&(this._sheet.setOptimizeForSpeed(n),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"undefined"==typeof window||this._fromServer||(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),r=s.styleId,i=s.rules;if(r in this._instancesCounts){this._instancesCounts[r]+=1;return}var n=i.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[r]=n,this._instancesCounts[r]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var r=this._fromServer&&this._fromServer[s];r?(r.parentNode.removeChild(r),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],r=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,r=e.id;if(s){var i=h(r,s);return{styleId:i,rules:Array.isArray(t)?t.map(function(e){return m(i,e)}):[m(i,t)]}}return{styleId:h(r),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=i.createContext(null);p.displayName="StyleSheetContext";var x=n.default.useInsertionEffect||n.default.useLayoutEffect,b="undefined"!=typeof window?new f:void 0;function g(e){var t=b||i.useContext(p);return t&&("undefined"==typeof window?t.add(e):x(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}g.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},t.style=g},8332:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>u});var r=s(5155),i=s(9137),n=s.n(i),o=s(2115),a=s(5695),d=s(6874),c=s.n(d),l=s(6766);function u(){let e=(0,a.useSearchParams)().get("query")||"",[t,s]=(0,o.useState)(e),[i,d]=(0,o.useState)(e),[u,h]=(0,o.useState)([]),[m,f]=(0,o.useState)(!0),[p]=(0,o.useState)(["assets","documents","fixtures","projects","templates","test files","tools"]);(0,o.useEffect)(()=>{let e=setTimeout(()=>d(t),300);return()=>clearTimeout(e)},[t]),(0,o.useEffect)(()=>{let e=new URL("".concat("https://forms.lasereverything.net","/items/projects"));e.searchParams.set("fields","submission_id,title,uploader,category,tags,p_image.filename_disk,p_image.title"),e.searchParams.set("limit","-1"),fetch(e.toString(),{cache:"no-store"}).then(e=>e.json()).then(e=>{h(e.data||[]),f(!1)}).catch(()=>f(!1))},[]);let x=e=>null==e?void 0:e.toLowerCase().replace(/[_\s]/g,""),b=(0,o.useMemo)(()=>{let e=x(i);return u.filter(t=>{var s,r,i;return[null!=(s=t.title)?s:"",null!=(r=t.uploader)?r:"",null!=(i=t.category)?i:"",Array.isArray(t.tags)?t.tags.join(" "):""].filter(Boolean).some(t=>x(t).includes(e))})},[u,i]),g=(0,o.useMemo)(()=>{let e={};return u.forEach(t=>{Array.isArray(t.tags)&&t.tags.forEach(t=>{e[t]=(e[t]||0)+1})}),e},[u]),j=Object.entries(g).sort((e,t)=>(Number(t[1])||0)-(Number(e[1])||0)).slice(0,10).map(e=>{let[t]=e;return t}),y=[...u].sort((e,t)=>t.submission_id-e.submission_id).slice(0,10).flatMap(e=>e.tags||[]).filter((e,t,s)=>s.indexOf(e)===t).slice(0,10),_=new Set(u.map(e=>e.uploader).filter(Boolean)).size,v=Object.keys(g).length;return(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12 p-6 max-w-7xl mx-auto",children:[(0,r.jsx)(n(),{id:"55279b04e627cd12",children:"mark{background:#ffde59;color:#242424;padding:0 2px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(500px,1fr));gap:1rem}.project-card{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;background-color:#242424;color:var(--card-foreground);border:1px solid var(--border);-webkit-border-radius:.5rem;-moz-border-radius:.5rem;border-radius:.5rem;overflow:hidden;height:150px}.project-image{width:150px;height:150px;-o-object-fit:cover;object-fit:cover}.project-content{padding:.75rem;-webkit-box-flex:1;-webkit-flex:1;-moz-box-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-webkit-justify-content:space-between;-moz-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.project-tags{overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap}.project-tags span,.flex.flex-wrap span{display:inline-block;margin-right:.25rem;margin-bottom:.25rem;padding:.25rem .5rem;background-color:var(--muted);color:var(--foreground);-webkit-border-radius:.25rem;-moz-border-radius:.25rem;border-radius:.25rem;font-size:.7rem;cursor:pointer;-webkit-transition:background-color.2s ease;-moz-transition:background-color.2s ease;-o-transition:background-color.2s ease;transition:background-color.2s ease}.project-tags span:hover,.flex.flex-wrap span:hover{background-color:#ffde59;color:#000}"}),(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12 grid md:grid-cols-2 xl:grid-cols-3 gap-4 mb-6",children:[(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12 card bg-card text-card-foreground p-4",children:[(0,r.jsx)("h1",{className:"jsx-55279b04e627cd12 text-xl font-bold mb-2",children:"Community Projects"}),(0,r.jsx)("input",{type:"search",value:t,onChange:e=>s(e.target.value),placeholder:"Search projects...",className:"jsx-55279b04e627cd12 w-full dark:bg-background border border-border rounded-md p-2"}),(0,r.jsx)(c(),{href:"/",className:"inline-block mt-4 px-4 py-2 bg-accent text-background rounded-md text-sm",children:"← Back to Main Menu"})]}),(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12 card bg-card text-card-foreground p-4",children:[(0,r.jsx)("h2",{className:"jsx-55279b04e627cd12 text-md font-semibold mb-2",children:"Popular Tags"}),j.length>0?(0,r.jsx)("div",{className:"jsx-55279b04e627cd12 flex flex-wrap",children:j.map((e,t)=>(0,r.jsx)("span",{onClick:()=>s(e),title:e,className:"jsx-55279b04e627cd12",children:e},t))}):(0,r.jsx)("p",{className:"jsx-55279b04e627cd12 text-sm text-muted-foreground",children:"No tags yet."})]}),(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12 card bg-card text-card-foreground p-4",children:[(0,r.jsx)("h2",{className:"jsx-55279b04e627cd12 text-md font-semibold mb-2",children:"Recent Tags"}),y.length>0?(0,r.jsx)("div",{className:"jsx-55279b04e627cd12 flex flex-wrap",children:y.map((e,t)=>(0,r.jsx)("span",{onClick:()=>s(e),title:e,className:"jsx-55279b04e627cd12",children:e},t))}):(0,r.jsx)("p",{className:"jsx-55279b04e627cd12 text-sm text-muted-foreground",children:"No recent tags."})]}),(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12 card bg-card text-card-foreground p-4",children:[(0,r.jsx)("h2",{className:"jsx-55279b04e627cd12 text-md font-semibold mb-2",children:"Project Stats"}),(0,r.jsxs)("p",{className:"jsx-55279b04e627cd12 text-sm text-muted-foreground",children:["Total Projects: ",u.length]}),(0,r.jsxs)("p",{className:"jsx-55279b04e627cd12 text-sm text-muted-foreground",children:["Unique Uploaders: ",_]}),(0,r.jsxs)("p",{className:"jsx-55279b04e627cd12 text-sm text-muted-foreground",children:["Total Tags: ",v]})]}),(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12 card bg-card text-card-foreground p-4",children:[(0,r.jsx)("h2",{className:"jsx-55279b04e627cd12 text-md font-semibold mb-2",children:"Browse by Category"}),(0,r.jsx)("div",{className:"jsx-55279b04e627cd12 flex flex-wrap",children:p.map((e,t)=>(0,r.jsx)("span",{onClick:()=>s(e),className:"jsx-55279b04e627cd12",children:"test_files"===e?"test files":e},t))})]}),(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12 card bg-card text-card-foreground p-4 flex flex-col justify-between",children:[(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12",children:[(0,r.jsx)("h2",{className:"jsx-55279b04e627cd12 text-md font-semibold mb-2",children:"Submit a Project"}),(0,r.jsx)("p",{className:"jsx-55279b04e627cd12 text-sm text-muted-foreground mb-2",children:"Have a cool design, tool, or jig to share? Submit it to the community database."})]}),(0,r.jsx)("button",{disabled:!0,className:"jsx-55279b04e627cd12 bg-muted text-foreground text-sm px-4 py-2 rounded opacity-50 cursor-not-allowed",children:"Coming Soon"})]})]}),(0,r.jsx)("hr",{className:"jsx-55279b04e627cd12 my-8 border-border"}),m?(0,r.jsx)("p",{className:"jsx-55279b04e627cd12 text-muted",children:"Loading projects..."}):0===b.length?(0,r.jsx)("p",{className:"jsx-55279b04e627cd12 text-muted",children:"No projects found."}):(0,r.jsx)("div",{className:"jsx-55279b04e627cd12 card-grid",children:b.map(e=>{var t,i;return(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12 project-card",children:[(0,r.jsx)(l.default,{src:"https://forms.lasereverything.net/assets/".concat(null==(t=e.p_image)?void 0:t.filename_disk),alt:(null==(i=e.p_image)?void 0:i.title)||"Project image",width:150,height:150,className:"project-image"}),(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12 project-content",children:[(0,r.jsxs)("div",{className:"jsx-55279b04e627cd12",children:[(0,r.jsx)(c(),{href:"/projects/".concat(e.submission_id),className:"text-base font-semibold text-accent underline",children:e.title||"Untitled"}),(0,r.jsxs)("p",{className:"jsx-55279b04e627cd12 text-xs text-muted-foreground",children:["Uploaded by: ",e.uploader||"—"]}),(0,r.jsxs)("p",{className:"jsx-55279b04e627cd12 text-xs text-muted-foreground",children:["Category: ",e.category||"—"]})]}),(0,r.jsx)("div",{className:"jsx-55279b04e627cd12 project-tags",children:Array.isArray(e.tags)&&e.tags.length>0?e.tags.map((e,t)=>(0,r.jsx)("span",{onClick:()=>s(e),title:e,className:"jsx-55279b04e627cd12",children:e},t)):""})]})]},e.submission_id)})})]})}},8375:()=>{},9137:(e,t,s)=>{"use strict";e.exports=s(2269).style},9144:(e,t,s)=>{Promise.resolve().then(s.bind(s,8332))}},e=>{var t=t=>e(e.s=t);e.O(0,[6874,4212,8441,1684,7358],()=>t(9144)),_N_E=e.O()}]); |