PageSourceSearch

https://cosmicchoices.xyz/assets/Ama-B3H1voeH.js

js cosmicchoices.xyz collected 2026-10-05 01:33:12 UTC 5,874 bytes, 1 lines download raw bytes

1import{r as l,k as h,m,d as f,f as y,C as p,n as g}from"./index-DiEydHLj.js";import{C}from"./Camera-CNP5GVcB.js";import{S as _}from"./Scene-B4SNVToz.js";import r from"./characters-B902kvS8.js";import{P as q}from"./Prop-ciauDdv4.js";import{I as u}from"./Interval-C-_cxb_p.js";import"./View-BNK5Vt5p.js";class I{constructor(e){this.currentIndex=-2,this.manifestUrl="",this.queueCollection=e}getManifestUrl(){return this.manifestUrl}getCurrentIndex(){return this.currentIndex}setCollection(e){this.queueCollection=e}setLatest(){const e=this.queueCollection.getCurrentIndexByTime(),t=this.queueCollection.getActiveModel();t&&(this.currentIndex=e,this.manifestUrl=t.manifestUrl)}setById(e){const t=this.queueCollection.getIndexById(e),s=this.queueCollection.models[t];s&&(this.currentIndex=t,this.manifestUrl=s.manifestUrl)}setByIndex(e){const t=this.queueCollection.models[e];if(t){if(t.isStale||t.isDead)return this.setNext();this.currentIndex=e,this.manifestUrl=t.manifestUrl}}setNext(){if(this.currentIndex>=this.queueCollection.models.length-1){console.warn(`No more items in queue, play some other thing like "What, that's all you got?"`);return}this.currentIndex=Math.min(this.currentIndex+1,this.queueCollection.models.length-1),this.setByIndex(this.currentIndex)}hasMore(){return this.currentIndex<this.queueCollection.models.length-1}getCurrentModel(){return this.currentIndex===-2||!this.queueCollection.models[this.currentIndex]?null:this.queueCollection.models[this.currentIndex]}isCurrentValid(){const e=this.getCurrentModel();return e?!e.isStale&&!e.isDead:!1}}var D=Object.defineProperty,x=Object.getOwnPropertyDescriptor,o=(n,e,t,s)=>{for(var a=s>1?void 0:s?x(e,t):e,d=n.length-1,c;d>=0;d--)(c=n[d])&&(a=(s?c(e,t,a):c(a))||a);return s&&a&&D(e,t,a),a};let i=class extends _{constructor(){super(...arguments),this.currentDialogue="",this.firstFetch=!0,this.isPlaying=!1,this.hasPlayed={typing:!1},this.idleDuration=1e3*15,this.idleWaitDuration=1e3*5,this.lastPlayedAt=Date.now(),this.pollingDuration=1e3*5,this.queueManifest=new I,this.submissions=0}async setup(){this.queueManifest.setCollection(this.queueCollection),this.$route.params.id?this.queueManifest.setById(this.$route.params.id):(await this.playIntro(),this.queueManifest.setLatest()),C.enterAma()}attachEvents(){this.queueCollection.on("complete",this.Handle_OnFetchComplete),u.add(this.Handle_OnPolling,this.pollingDuration,"fetchQueue"),u.add(this.Handle_OnIdle,this.idleDuration,"idleQueue")}detachEvents(){this.queueCollection.off("complete",this.Handle_OnFetchComplete),u.remove("fetchQueue"),u.remove("idleQueue")}async playIdle(){return this.currentDialogue=l(r.sandy.ama.idle),new Promise(n=>this.$once("dynamic:end",n))}async playIntro(){return this.currentDialogue=l(r.sandy.ama.intro_with_questions),new Promise(n=>this.$once("dynamic:end",n))}async playSubmitted(){return this.currentDialogue=l(r.sandy.ama.submitted),new Promise(n=>this.$once("dynamic:end",n))}async playSubmittedAgain(){return this.currentDialogue=l(r.sandy.ama.submitted_again),new Promise(n=>this.$once("dynamic:end",n))}async playTyping(){return this.currentDialogue=l(r.sandy.ama.typing),new Promise(n=>this.$once("dynamic:end",n))}async Handle_OnChangeText(){this.hasPlayed.typing||(this.hasPlayed.typing=!0,this.playTyping())}async Handle_OnDialogueEnded(){this.$store.dispatch("changeAnimation",h.IDLE),this.lastPlayedAt=Date.now(),this.isPlaying=!1,this.queueManifest.setNext()}async Handle_OnDialogueStarted(){this.$store.dispatch("changeAnimation",h.TALKING),this.currentDialogue="",this.isPlaying=!0}async Handle_OnDynamicDialogueEnded(){this.$emit("dynamic:end")}async Handle_OnFetchComplete(){if(!this.queueCollection.models[0]){console.warn(`No items left in queue, play some other thing like "What, that's all you got?"`);return}if(this.isPlaying){console.warn("Already playing, wait for the next one.");return}this.queueManifest.setLatest(),this.firstFetch=!1}async Handle_OnIdle(){if(this.isPlaying){console.warn("Already playing, wait for the next one.");return}if(Date.now()-this.lastPlayedAt<this.idleWaitDuration){console.warn("Not enough time has passed since last played, skipping idle.");return}this.playIdle()}async Handle_OnPolling(){this.queueCollection.setQueryParam("cb",Date.now()),this.queueCollection.fetch()}async Handle_OnSelectItem(n){const e=this.queueCollection.models[n];if(!e){console.warn("No model found for index",n);return}this.$router.push({name:"PageAskMeAnything",params:{id:e.id}}),this.queueManifest.setByIndex(n)}
1async Handle_OnSubmitForm(){this.submissions===0?this.playSubmitted():this.playSubmittedAgain(),this.submissions++}};o([q()],i.prototype,"queueCollection",2);o([m],i.prototype,"setup",1);o([m],i.prototype,"attachEvents",1);o([f],i.prototype,"detachEvents",1);o([y],i.prototype,"Handle_OnIdle",1);o([y],i.prototype,"Handle_OnPolling",1);i=o([p],i);var w=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("section",{staticClass:"scene-ama"},[t("ViewContainer",[e.isPlaying?e._e():t("ViewUiDynamicDialogue",{attrs:{input:e.currentDialogue},on:{"play:end":e.Handle_OnDynamicDialogueEnded}}),e.queueManifest.manifestUrl?t("ViewUiSpokenDialogue",{key:e.queueManifest.manifestUrl,attrs:{manifestUrl:e.queueManifest.manifestUrl},on:{"play:end":e.Handle_OnDialogueEnded,"play:start":e.Handle_OnDialogueStarted}}):e._e()],1),t("ViewContainer",{staticClass:"action-container"},[t("ViewButtonSound")],1),t("ViewContainer",{staticClass:"community-container"},[t("header",[t("h3",[e._v("Ask me Anything")])]),t("ViewAmaList",{attrs:{currentIndex:e.queueManifest.currentIndex,queueCollection:e.queueCollection},on:{select:e.Handle_OnSelectItem}}),t("ViewAmaForm",{attrs:{queueCollection:e.queueCollection},on:{change:e.Handle_OnChangeText,submit:e.Handle_OnSubmitForm}})],1)],1)},P=[],M=g(i,w,P,!1,null,null,null,null);const $=M.exports;export{$ 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.