1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[75],{3454:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(7663)},8835:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/QuestionsRadio",function(){return n(5870)}])},1097:function(e,t,n){"use strict";n.r(t);var r=n(5893),i=n(7294),o=n(6485),s=n(8583);t.default=()=>{let{inProgress:e,setRevealImage:t,buttonDisabled:n,setButtonDisabled:a,setHideReset:u,showConfetti:l,setShowConfetti:c}=(0,i.useContext)(o.zX);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),a(!0),u(!1),c(!0);let n=new FormData(e.target).get("finalOptions");"Number 1"===n?t([!0,!1,!1]):"Number 2"===n?t([!1,!0,!1]):t([!1,!1,!0])},className:e?"hidden":"mb-4",children:[(0,r.jsxs)("p",{className:"mb-2",children:["Will you pick ",(0,r.jsx)("span",{className:"text-pink-600 font-bold",children:"Number 1"}),", ",(0,r.jsx)("span",{className:"text-pink-600 font-bold",children:"Number 2"}),", or ",(0,r.jsx)("span",{className:"text-pink-600 font-bold",children:"Number 3"}),"? The choice is yours!"]}),["Number 1","Number 2","Number 3"].map((e,t)=>(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("input",{type:"radio",id:e,name:"finalOptions",value:e,disabled:n}),(0,r.jsx)("label",{htmlFor:e,children:e})]},t)),(0,r.jsx)("button",{type:"submit",className:n?"rounded bg-pink-800 text-white p-2":"rounded bg-pink-600 text-white p-2 hover:bg-pink-800",disabled:n,children:"Submit"})]}),l&&(0,r.jsx)(s.Z,{})]})}},5870:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return l}});var r=n(5893),i=n(7294),o=n(3454);let s=async(e,t,n,r,i,s,a,u,l,c,d,p)=>{let h=o.env.OPENAI_API_KEY;try{let o=[];t.forEach(e=>{let t={title:e.title,attribution:e.attribution};o.push(t)});let m=await fetch("/api/generateAnswers",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(h)},body:JSON.stringify({prompt:e,artworks:o})}),f=await m.json(),b=t.map((e,t)=>{let n=f[t];return{...e,answer:n}});if(n(b),i>1?s(i-1):1===i&&s("Final"),console.log(f),r(!1),0===a||1===a||2===a){let e=l.filter(function(e){return e!==l[a]});e=[...e.slice(0,a),d[0],...e.slice(a)];let t=d.filter(function(e){return e!==d[0]});p(t),c(e)}u(void 0)}catch(e){console.error("Error:",e)}};var a=n(1097),u=n(6485),l=()=>{let{artworks:e,setArtworks:t,inProgress:n,setInProgress:o,remainingQuestions:l,setRemainingQuestions:c,setReset:d,selectedOption:p,setSelectedOption:h,questions:m,setQuestions:f,backupQuestions:b,setBackupQuestions:x}=(0,i.useContext)(u.zX),v=(0,i.useRef)(),g=(0,i.useRef)(),N=e=>{h(e),k(!1)},[y,j]=(0,i.useState)(""),[w,k]=(0,i.useState)(!1),T=e=>{j(e.target.value),k(e.target.checked),v.current.focus(),h(m.length+1)};return(0,r.jsxs)("div",{children:[("Final"!==l||"Final"===l&&n)&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"mb-2",children:[(0,r.jsx)("span",{className:"text-pink-600 text-xl font-bold",children:1!==l?"".concat(l," "):"Final "}),1!==l?"Questions Remaining":"Question"]}),(0,r.jsxs)("form",{onSubmit:n=>{n.preventDefault(),o(!0),d(!1),s(new FormData(n.target).get("radioOptions"),e,t,o,l,c,p,h,m,f,b,x),j("")},className:"mb-4",children:[m.map((e,t)=>(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("input",{type:"radio",id:"question-".concat(t),name:"radioOptions",value:e,className:"mr-2",required:!0,disabled:n,checked:t===p,onChange:()=>N(t)}),(0,r.jsx)("label",{htmlFor:"question-".concat(t),children:e})]},t)),(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("input",{ref:g,type:"radio",id:"customQuestion",name:"radioOptions",value:y,onChange:T,className:"mr-2",required:!0,disabled:n}),(0,r.jsx)("label",{htmlFor:"customQuestion",children:"Other:"}),(0,r.jsx)("input",{ref:v,type:"text",id:"customQuestionInput",value:y,onChange:T,className:"ml-2 p-0.5 w-60",required:w,placeholder:"e.g. Do you like pi\xf1a coladas?",disabled:n,onFocus:()=>{g.current.checked=!0}})]}),(0,r.jsx)("button",{type:"submit",className:n?"rounded bg-pink-800 text-white p-2":"rounded bg-pink-600 text-white p-2 hover:bg-pink-800",disabled:n,children:n?"Holding on for Love...":"Ask Question"})]})]}
1),(0,r.jsx)("p",{className:n?"mb-4 text-pink-600 font-bold":"hidden",children:"Please give the artworks some time to think of their replies... it may take a while."}),"Final"===l&&!n&&(0,r.jsx)(a.default,{})]})}},7663:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function o(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u=[],l=!1,c=-1;function d(){l&&r&&(l=!1,r.length?u=r.concat(u):c=-1,u.length&&p())}function p(){if(!l){var e=a(d);l=!0;for(var t=u.length;t;){for(r=u,u=[];++c<t;)r&&r[c].run();c=-1,t=u.length}r=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];
1u.push(new h(e,t)),1!==u.length||l||a(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw Error("process.chdir is not supported")},i.umask=function(){return 0}}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var o=n[e]={exports:{}},s=!0;try{t[e](o,o.exports,r),s=!1}finally{s&&delete n[e]}return o.exports}r.ab="//";var i=r(229);e.exports=i}()}},function(e){e.O(0,[583,888,774,179],function(){return e(e.s=8835)}),_N_E=e.O()}]);
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.