drawing-prompt/assets/index-Bpryj5yb.js
Joshua Seigler d5b65a8faf Updates
2025-04-25 14:33:25 -04:00

1 line
18 KiB
JavaScript

(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const re=!1,ie=(e,t)=>e===t,P={equals:ie};let Y=ee;const y=1,N=2,z={owned:null,cleanups:null,context:null,owner:null};var p=null;let W=null,se=null,d=null,h=null,m=null,M=0;function oe(e,t){const n=d,r=p,i=e.length===0,s=t===void 0?r:t,a=i?z:{owned:null,cleanups:null,context:s?s.context:null,owner:s},o=i?e:()=>e(()=>k(()=>_(a)));p=a,d=null;try{return C(o,!0)}finally{d=n,p=r}}function q(e,t){t=t?Object.assign({},P,t):P;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=i=>(typeof i=="function"&&(i=i(n.value)),Z(n,i));return[J.bind(n),r]}function A(e,t,n){const r=I(e,t,!1,y);x(r)}function ae(e,t,n){Y=fe;const r=I(e,t,!1,y);r.user=!0,m?m.push(r):x(r)}function U(e,t,n){n=n?Object.assign({},P,n):P;const r=I(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,x(r),J.bind(r)}function k(e){if(d===null)return e();const t=d;d=null;try{return e()}finally{d=t}}function le(e){ae(()=>k(e))}function J(){if(this.sources&&this.state)if(this.state===y)x(this);else{const e=h;h=null,C(()=>O(this),!1),h=e}if(d){const e=this.observers?this.observers.length:0;d.sources?(d.sources.push(this),d.sourceSlots.push(e)):(d.sources=[this],d.sourceSlots=[e]),this.observers?(this.observers.push(d),this.observerSlots.push(d.sources.length-1)):(this.observers=[d],this.observerSlots=[d.sources.length-1])}return this.value}function Z(e,t,n){let r=e.value;return(!e.comparator||!e.comparator(r,t))&&(e.value=t,e.observers&&e.observers.length&&C(()=>{for(let i=0;i<e.observers.length;i+=1){const s=e.observers[i],a=W&&W.running;a&&W.disposed.has(s),(a?!s.tState:!s.state)&&(s.pure?h.push(s):m.push(s),s.observers&&te(s)),a||(s.state=y)}if(h.length>1e6)throw h=[],new Error},!1)),t}function x(e){if(!e.fn)return;_(e);const t=M;ce(e,e.value,t)}function ce(e,t,n){let r;const i=p,s=d;d=p=e;try{r=e.fn(t)}catch(a){return e.pure&&(e.state=y,e.owned&&e.owned.forEach(_),e.owned=null),e.updatedAt=n+1,ne(a)}finally{d=s,p=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Z(e,r):e.value=r,e.updatedAt=n)}function I(e,t,n,r=y,i){const s={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:p,context:p?p.context:null,pure:n};return p===null||p!==z&&(p.owned?p.owned.push(s):p.owned=[s]),s}function j(e){if(e.state===0)return;if(e.state===N)return O(e);if(e.suspense&&k(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<M);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===y)x(e);else if(e.state===N){const r=h;h=null,C(()=>O(e,t[0]),!1),h=r}}function C(e,t){if(h)return e();let n=!1;t||(h=[]),m?n=!0:m=[],M++;try{const r=e();return ue(n),r}catch(r){n||(m=null),h=null,ne(r)}}function ue(e){if(h&&(ee(h),h=null),e)return;const t=m;m=null,t.length&&C(()=>Y(t),!1)}function ee(e){for(let t=0;t<e.length;t++)j(e[t])}function fe(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:j(r)}for(t=0;t<n;t++)j(e[t])}function O(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const r=e.sources[n];if(r.sources){const i=r.state;i===y?r!==t&&(!r.updatedAt||r.updatedAt<M)&&j(r):i===N&&O(r,t)}}}function te(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=N,n.pure?h.push(n):m.push(n),n.observers&&te(n))}}function _(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),r=e.sourceSlots.pop(),i=n.observers;if(i&&i.length){const s=i.pop(),a=n.observerSlots.pop();r<i.length&&(s.sourceSlots[a]=r,i[r]=s,n.observerSlots[r]=a)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)_(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)_(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function de(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function ne(e,t=p){throw de(e)}function V(e,t){return k(()=>e(t||{}))}const he=e=>`Stale read from <${e}>.`;function ge(e){const t=e.keyed,n=U(()=>e.when,void 0,void 0),r=t?n:U(n,void 0,{equals:(i,s)=>!i==!s});return U(()=>{const i=r();if(i){const s=e.children;return typeof s=="function"&&s.length>0?k(()=>s(t?i:()=>{if(!k(r))throw he("Show");return n()})):s}return e.fallback},void 0,void 0)}function pe(e,t,n){let r=n.length,i=t.length,s=r,a=0,o=0,c=t[i-1].nextSibling,u=null;for(;a<i||o<s;){if(t[a]===n[o]){a++,o++;continue}for(;t[i-1]===n[s-1];)i--,s--;if(i===a){const f=s<r?o?n[o-1].nextSibling:n[s-o]:c;for(;o<s;)e.insertBefore(n[o++],f)}else if(s===o)for(;a<i;)(!u||!u.has(t[a]))&&t[a].remove(),a++;else if(t[a]===n[s-1]&&n[o]===t[i-1]){const f=t[--i].nextSibling;e.insertBefore(n[o++],t[a++].nextSibling),e.insertBefore(n[--s],f),t[i]=n[s]}else{if(!u){u=new Map;let l=o;for(;l<s;)u.set(n[l],l++)}const f=u.get(t[a]);if(f!=null)if(o<f&&f<s){let l=a,g=1,w;for(;++l<i&&l<s&&!((w=u.get(t[l]))==null||w!==f+g);)g++;if(g>f-o){const b=t[a];for(;o<f;)e.insertBefore(n[o++],b)}else e.replaceChild(n[o++],t[a++])}else a++;else t[a++].remove()}}}const G="_$DX_DELEGATE";function me(e,t,n,r={}){let i;return oe(s=>{i=s,t===document?e():R(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=""}}function $(e,t,n,r){let i;const s=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},a=()=>(i||(i=s())).cloneNode(!0);return a.cloneNode=a,a}function ye(e,t=window.document){const n=t[G]||(t[G]=new Set);for(let r=0,i=e.length;r<i;r++){const s=e[r];n.has(s)||(n.add(s),t.addEventListener(s,be))}}function S(e,t){t==null?e.removeAttribute("class"):e.className=t}function we(e,t,n,r){if(Array.isArray(n)){const i=n[0];e.addEventListener(t,n[0]=s=>i.call(e,n[1],s))}else e.addEventListener(t,n,typeof n!="function"&&n)}function R(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return B(e,t,r,n);A(i=>B(e,t(),i,n),r)}function be(e){let t=e.target;const n=`$$${e.type}`,r=e.target,i=e.currentTarget,s=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),a=()=>{const c=t[n];if(c&&!t.disabled){const u=t[`${n}Data`];if(u!==void 0?c.call(t,u,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&s(t.host),!0},o=()=>{for(;a()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),e.composedPath){const c=e.composedPath();s(c[0]);for(let u=0;u<c.length-2&&(t=c[u],!!a());u++){if(t._$host){t=t._$host,o();break}if(t.parentNode===i)break}}else o();s(r)}function B(e,t,n,r,i){for(;typeof n=="function";)n=n();if(t===n)return n;const s=typeof t,a=r!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,s==="string"||s==="number"){if(s==="number"&&(t=t.toString(),t===n))return n;if(a){let o=n[0];o&&o.nodeType===3?o.data!==t&&(o.data=t):o=document.createTextNode(t),n=v(e,n,r,o)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||s==="boolean")n=v(e,n,r);else{if(s==="function")return A(()=>{let o=t();for(;typeof o=="function";)o=o();n=B(e,o,n,r)}),()=>n;if(Array.isArray(t)){const o=[],c=n&&Array.isArray(n);if(D(o,t,n,i))return A(()=>n=B(e,o,n,r,!0)),()=>n;if(o.length===0){if(n=v(e,n,r),a)return n}else c?n.length===0?H(e,o,r):pe(e,n,o):(n&&v(e),H(e,o));n=o}else if(t.nodeType){if(Array.isArray(n)){if(a)return n=v(e,n,r,t);v(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function D(e,t,n,r){let i=!1;for(let s=0,a=t.length;s<a;s++){let o=t[s],c=n&&n[e.length],u;if(!(o==null||o===!0||o===!1))if((u=typeof o)=="object"&&o.nodeType)e.push(o);else if(Array.isArray(o))i=D(e,o,c)||i;else if(u==="function")if(r){for(;typeof o=="function";)o=o();i=D(e,Array.isArray(o)?o:[o],Array.isArray(c)?c:[c])||i}else e.push(o),i=!0;else{const f=String(o);c&&c.nodeType===3&&c.data===f?e.push(c):e.push(document.createTextNode(f))}}return i}function H(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function v(e,t,n,r){if(n===void 0)return e.textContent="";const i=r||document.createTextNode("");if(t.length){let s=!1;for(let a=t.length-1;a>=0;a--){const o=t[a];if(i!==o){const c=o.parentNode===e;!s&&!a?c?e.replaceChild(i,o):e.insertBefore(i,n):c&&o.remove()}else s=!0}}else e.insertBefore(i,n);return[i]}const ve=["agreeable","aloof","ambitious","angry","animated","antagonistic","anxious","apprehensive","awestruck","belligerent","calm","carefree","caring","cheerful","combative","dark","defensive","dejected","eager","energetic","erratic","excited","fearful","festive","friendly","fun","gloomy","glum","grateful","gregarious","heartbroken","hopeful","hostile","idyllic","impatient","indignant","invigorated","lighthearted","lively","lonely","loving","melancholy","mischievous","miserable","mournful","mysterious","nervous","nostalgic","ominous","optimistic","outgoing","overwhelmed","passionate","peaceful","perky","pessimistic","playful","realistic","reflective","resentful","restless","romantic","sad","sentimental","serious","shy","silly","solemn","strange","tender","tense","thankful","transcendent","unaffected","uneasy","unfriendly","unstable","unsteady","vivacious","wretched"],ke=["plush","robot","vampire","zombie","wooden","virtual","military","aquatic","ancient","future","superpowered"],Se=["albatross","alligator","antelope","arctic fox","armadillo","baboon","badger","bat","beagle","brown bear","black bear","polar bear","beaver","bison","blue whale","boar","brill","buffalo","bull","camel","capybara","carp","cat","chameleon","cheetah","chihuahua","chimpanzee","chinchilla","cobra","cow","crab","crocodile","crow","deer","dodo","dog","dolphin","donkey","duck","eagle","eel","elephant","elk","emu","fish","flamingo","fox","frog","frog","giant","giraffe","goat","goose","gorilla","haddock","hammerhead","hamster","hare","hawk","hedgehog","hen","hermit","herring","hippopotamus","horse","ibex","iguana","jackal","jaguar","jellyfish","kangaroo","koala","lemur","leopard","lion","lizard","llama","lynx","mammoth","meerkat","mole","monkey","mouse","mule","newt","orangutan","ostrich","otter","owl","panda","panther","peacock","pigeon","pike","porcupine","possum","pufferfish","rabbit","racoon","rat","rhinoceros","salamander","salmon","sardine","shark","sheep","sloth","snake","squirrel","swan","tiger","toad","tortoise","tuna","turtle","vulture","whale","wolf","wombat","zebra"],Ee=["accountant","actor","actuary","administrator","advertising manager","aerospace engineer","agent","agricultural engineer","air traffic controller","anthropologist","archeologist","architect","art director","astronomer","athlete","auditor","baker","banking analyst","barista","bartender","bioinformatics scientist","biologist","biomedical engineer","blacksmiths","board member","broker","business analyst","buyer","naval captain","carpenter","cashier","chef","chemical engineer","chemist","chief executive","childcare worker","choreographer","civil engineer","cleaner","clergy","compliance manager","computer scientist","concierge","conservation worker","construction manager","construction worker","consultant","cook","copywriter","cosmetologist","courier","craftsperson","curator","customer experience designer","customer service representative","data analyst","data architect","data scientist","database administrator","dental assistant","dentist","development manager","director","ecommerce seller","economist","electrical engineer","electrician","emergency medical technician","energy engineer","engineer","entrepreneur","environmental engineer","environmental scientist","epidemiologist","equipment operator","event planner","executive management","farmer","fashion designer","financial analyst","financial controller","financial manager","firefighter","fishery worker","fitness trainer","flight attendant","floral designer","forestry worker","funeral attendant","game designer","gardener","general manager","geographer","government worker","hair stylist","health educator","homemaker","hotel manager","human resources","import/export specialist","industrial designer","information designer","information scientist","information technology manager","installation & maintenance worker","interpreter","journalist","laboratory technician","laborer","landscape architect","landscaping","lawyer","legal secretary","librarian","lifeguard","logistics engineer","management consultant","manicurist","manufacturing engineer","manufacturing worker","marketing analyst","marketing manager","mathematician","mechanical engineer","medical administrator","medical assistant","medical technician","medical technologist","mental health counselor","midwife","miner","monk","musician","nanny","network administrator","nun","nurse","occupational health & safety specialist","occupational therapist","office clerk","operations analyst","operations manager","optometrist","performance artist","personal care aid","pharmacist","photographer","physician","physicist","pilot","plumber","police officer","politician","producer","product designer","production manager","professor","program manager","project manager","promotion manager","property manager","public relations","purchasing manager","quality assurance manager","quality control analyst","railroad engineer","reporter","researcher","restaurant manager","rigger","robotics engineer","sales engineer","sales manager","salesperson","scientist","service attendant","service manager","shop salesperson","small business owner","social worker","sociologist","software architect","software developer","solar energy technician","space scientist","statistician","steel worker","stonemason","supervisor","surgeon","surveyor","system administrator","systems analyst","tailor","teacher","technical support representative","technical writer","technician","technology architect","testing engineer","tour guide","translator","transportation engineer","truck driver","tutor","urban designer","veterinarian","visual designer","waiter","web developer","wind energy engineer","writer","zoologist"],T={adjective:ve,mod:ke,animal:Se,jobs:Ee},Ae="modulepreload",_e=function(e){return"/"+e},K={},xe=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",reason:l}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),c=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=a(n.map(u=>{if(u=_e(u),u in K)return;K[u]=!0;const f=u.endsWith(".css"),l=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${l}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":Ae,f||(g.as="script"),g.crossOrigin="",g.href=u,c&&g.setAttribute("nonce",c),document.head.appendChild(g),f)return new Promise((w,b)=>{g.addEventListener("load",w),g.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return t().catch(s)})};function Ce(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:s,onRegisterError:a}=e;let o,c;const u=async(l=!0)=>{await c};async function f(){if("serviceWorker"in navigator){if(o=await xe(async()=>{const{Workbox:l}=await import("./workbox-window.prod.es5-B9K5rw8f.js");return{Workbox:l}},[]).then(({Workbox:l})=>new l("/drawing-prompt/sw.js",{scope:"/drawing-prompt/",type:"classic"})).catch(l=>{a==null||a(l)}),!o)return;o.addEventListener("activated",l=>{(l.isUpdate||l.isExternal)&&window.location.reload()}),o.addEventListener("installed",l=>{l.isUpdate||r==null||r()}),o.register({immediate:t}).then(l=>{s?s("/drawing-prompt/sw.js",l):i==null||i(l)}).catch(l=>{a==null||a(l)})}}return c=f(),u}function $e(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:s,onRegisterError:a}=e,[o,c]=q(!1),[u,f]=q(!1),l=Ce({immediate:t,onOfflineReady(){f(!0),r==null||r()},onNeedRefresh(){c(!0),n==null||n()},onRegistered:i,onRegisteredSW:s,onRegisterError:a});return{needRefresh:[o,c],offlineReady:[u,f],updateServiceWorker:l}}const Te="_Container_klvpw_1",Le="_Toast_klvpw_7",Pe="_Message_klvpw_20",Ne="_ToastButton_klvpw_23",E={Container:Te,Toast:Le,Message:Pe,ToastButton:Ne};var je=$("<div><div><span id=toast-message>New content available, click on reload button to update.</span></div><div><button>Reload</button><button>Close"),Oe=$("<div role=alert aria-labelledby=toast-message>");const Re=()=>{const{needRefresh:[t,n],updateServiceWorker:r}=$e({onRegisteredSW(s,a){var o;((o=a==null?void 0:a.active)==null?void 0:o.state)==="activated"?Q(36e5,s,a):a!=null&&a.installing&&a.installing.addEventListener("statechange",c=>{c.target.state==="activated"&&Q(36e5,s,a)})}});function i(){n(!1)}return(()=>{var s=Oe();return R(s,V(ge,{get when(){return t()},get children(){var a=je(),o=a.firstChild,c=o.nextSibling,u=c.firstChild,f=u.nextSibling;return u.$$click=()=>r(),f.$$click=()=>i(),A(l=>{var g=E.Toast,w=E.Message,b=E.ToastButton,F=E.ToastButton;return g!==l.e&&S(a,l.e=g),w!==l.t&&S(o,l.t=w),b!==l.a&&S(u,l.a=b),F!==l.o&&S(f,l.o=F),l},{e:void 0,t:void 0,a:void 0,o:void 0}),a}})),A(()=>S(s,E.Container)),s})()};function Q(e,t,n){setInterval(async()=>{if("onLine"in navigator&&!navigator.onLine)return;const r=await fetch(t,{cache:"no-store",headers:{cache:"no-store","cache-control":"no-cache"}});(r==null?void 0:r.status)===200&&await n.update()},e)}ye(["click"]);var Be=$("<div>You should draw "),Me=$("<div class=prompt>"),We=$("<button id=regenerate>↻");const L=e=>e[Math.floor(e.length*Math.random())],X=()=>{let e="";do e+=L(T.adjective)+" ";while(Math.random()>.8);for(Math.random()>.5&&(e+=L(T.mod)+" ");Math.random()>.75;)e+=L(T.animal)+"/";return e=e.slice(0,-1),e+=" "+L(T.jobs),e};function Ue(){const[e,t]=q("");return le(()=>{t(X())}),[(()=>{var n=Be();return n.firstChild,R(n,()=>["a","e","i","o","u"].includes(e().charAt(0))?"an":"a",null),n})(),(()=>{var n=Me();return R(n,e),n})(),(()=>{var n=We();return we(n,"click",()=>{t(X())}),n})(),V(Re,{})]}const qe=document.getElementById("root");me(()=>V(Ue,{}),qe);