1import{d as ie,b as n,r as re,w as q,L as oe,a as g,u as C,aS as ne,ag as de,ah as ue,K as ce,f as d,i as s,h as H,j as c,n as f,D as fe,z as me,_ as v,Q as B,g as y,l as p,m as _,t as u,F as P,N as z,k as pe,s as ve,v as r,x as $,$ as xe,e as he}from"./index.16ba4ea0.js";import"./vendor-highcharts.9b480a8e.js";import"https://cdn.jsdelivr.net/npm/[email protected]/dist/buttplug-wasm.mjs";const ge={class:"flex flex-col gap-y-3"},_e={class:"flex justify-center items-center"},we={key:0,class:"text-white font-medium text-xl"},be={key:1,class:"text-white font-medium text-xl"},ye={class:"flex flex-col items-center gap-y-4"},ke={class:"p-2 text-sm text-center"},Re={class:"flex flex-col gap-y-6"},Le={class:"flex flex-col md:flex-row"},Ee={class:"md:w-3/4 grid grid-cols-1 gap-2"},Te={class:"flex flex-wrap items-center gap-2"},Se={class:"flex flex-wrap items-center gap-2"},Ve={ref:"el",class:"flex items-center"},Fe={class:"w-64 p-3 h-full"},Ce={class:"h-auto overflow-y-auto"},Pe={class:"text-zinc-300 mt-3 text-sm"},ze=["href"],Oe={key:0,class:"text-xs text-zinc-400"},Ue={key:0,class:"mt-1"},Ae={key:0,class:"flex justify-end text-white italic opacity-50"},Me={class:"list-disc"},Be={class:"flex justify-end text-white italic opacity-50"},$e={key:0,class:"bg-zinc-800 border border-1 border-zinc-700 rounded-md p-2 text-sm mb-4"},Ne={key:1,class:"flex flex-col gap-y-6"},We={class:"flex flex-col md:flex-row md:items-center"},De={class:"md:w-3/4"},je={class:"text-white"},Ie={class:"flex flex-col md:flex-row md:items-center"},qe={class:"md:w-3/4 flex flex-wrap gap-2"},He={key:0,class:"text-zinc-400 text-sm"},Qe={class:"flex flex-col md:flex-row md:items-center"},Ye={class:"md:w-3/4 flex flex-wrap gap-2"},Ge={key:0,class:"text-zinc-400 text-sm"},Je={class:"flex gap-3 md:w-3/4 md:self-end"},Ke={class:"p-3 bg-zinc-800 border border-zinc-700 rounded-md shadow-xl max-w-xs"},Xe={class:"text-xs text-zinc-300 list-disc list-inside space-y-1"},lt=ie({__name:"CreateUserFunscript",emits:["submit-funscript"],setup(Ze,{emit:Q}){const Y=Q,N=ve(),w=n(!1),O=n(!0),U=n(!0),G=n(!0),k=n(0),R=n(!1),L=n(!1),A=n(),E=n(!1),T=n(""),x=n([]),S=n(!1),W=n(),e=re({loading:!1,performers:[],tags:[],providers:[],projections:["MONO_FLAT","MONO_360","STEREO_FLAT_LR","STEREO_FLAT_LR_SQUARE","STEREO_FLAT_TB","STEREO_FLAT_TB_SQUARE","STEREO_180_LR","STEREO_180_LR_SPHERICAL","STEREO_180_TB","STEREO_180_TB_SPHERICAL","STEREO_360_LR","STEREO_360_TB","STEREO_FISHEYE_200_LR"],fields:{name:"",description:"",stream_url:"",downloadable:!0,performers:[],tags:[],orientation:0,vr:!1,projection:"MONO_FLAT",thumbnail:"",duration:0}}),o=n(null),D=n(0);n([]);const h=n(0),M=n(0),j=async()=>{const l=await g.funscripts.getQueueCount();D.value=l.funscripts_in_queue},V=async()=>{const l=await g.funscripts.getFunscriptCountLast24Hours();h.value=l.remaining,M.value=l.limit},J=async()=>{try{e.fields.stream_url="";const l=await navigator.clipboard.readText();l&&(e.fields.stream_url=l)}catch(l){console.error("Failed to read clipboard:",l)}},K=l=>{navigator.clipboard.writeText(l)};q(()=>e.error,l=>{l&&(R.value=!0,setTimeout(()=>{R.value=!1,e.error=void 0},5e3))}),oe(async()=>{let l=await g.providers.getProviders();const t=["pornhub.com","xvideos.com"],i=b=>b.replace(/^www\./i,"");l=l.map(i).filter(b=>t.includes(b)).sort((b,ae)=>b.localeCompare(ae)),e.providers=l;let a=C().isPremium,m=C().fapAPI_license_key;U.value=!!a,G.value=!!m,await j(),await V()}),ne(async(l,t,i)=>{await j(),await V(),i()});const X=()=>e.fields.stream_url===""?(x.value=["Video URL is required"],!1):h.value<=0?(x.value=["Daily limit reached"],!1):e.fields.name===""?(x.value=["Video title is required"],!1):e.fields.duration<=0?(x.value=["Video duration is required (Fetch Metadata first)"],!1):(x.value=[],!0);
1q([o,e.fields],()=>{O.value=!X()},{deep:!0,immediate:!0});const Z=l=>{const t=l.toLowerCase().replace(/^www\./,"");return t==="porngub.com"||t==="pornhub.org"||t==="pornhub.com"||t.endsWith(".pornhub.com")||t.endsWith(".pornhub.org")?"pornhub.com":t==="xvides.com"||t==="xvideos.org"||t==="xvideos.com"||t.endsWith(".xvideos.com")||t.endsWith(".xvideos.org")?"www.xvideos.com":t==="xnxx.org"||t==="xnxx.com"||t.endsWith(".xnxx.com")||t.endsWith(".xnxx.org")?"www.xnxx.com":t==="xhamster.org"||t==="xhamster.com"||t.endsWith(".xhamster.com")||t.endsWith(".xhamster.org")?"xhamster.com":t},F=l=>{if(!l)return"";const t=l.trim();try{const i=new URL(t),a=Z(i.hostname);return i.hostname=a,i.toString()}catch{return t}},ee=async()=>{let l=F(e.fields.stream_url);const t=I(l);if(console.log("Validating URL:",t),!t){e.error="URL does not contain any valid provider from the supported list.";return}T.value="Please wait \u2014 we're fetching metadata.";try{E.value=!0,e.error=void 0,o.value=null,e.fields.stream_url=F(e.fields.stream_url);const i=await g.videos.getMetadataPh(e.fields.stream_url);console.log("GetMeta:",i),o.value={title:i.title,description:i.description||i.title,tags:(i.tags||[]).filter(a=>a!=="Suggest"),performers:(i.pornstars||[]).filter(a=>{var m;return!((m=a.name)!=null&&m.toLowerCase().includes("suggest"))}),duration:i.duration||0},e.fields.name=o.value.title,e.fields.description=o.value.description,e.fields.tags=o.value.tags,e.fields.performers=o.value.performers,e.fields.duration=o.value.duration,e.fields.thumbnail=i.thumbnail,e.fields.downloadable=!0,e.fields.orientation=0,e.fields.vr=!1,e.fields.projection="MONO_FLAT"}catch(i){console.log(i),e.error=i||"Oops, that failed! Please try again in 5 seconds."}finally{T.value="",E.value=!1}},te=()=>{e.fields.name="",e.fields.description="",e.fields.stream_url="",e.fields.downloadable=!0,e.fields.performers=[],e.fields.tags=[],e.fields.orientation=0,e.fields.vr=!1,e.fields.projection="MONO_FLAT",o.value=null},se=async()=>{if(h.value>0&&!!I(F(e.fields.stream_url)))try{e.loading=!0,e.error=void 0,e.fields.stream_url=F(e.fields.stream_url);let l=e.fields.stream_url;l.startsWith("https://")&&!l.startsWith("https://www.")&&!l.includes("xhamster")&&(l="https://www."+l.slice(8)),e.fields.stream_url=l,o.value&&(e.fields.name=o.value.title,e.fields.description=o.value.description,e.fields.tags=o.value.tags,e.fields.performers=o.value.performers||[],e.fields.duration=o.value.duration||0),e.fields&&(e.fields.tags.includes("AI")||e.fields.tags.push("AI"),e.fields.tags.includes("Faptap AI")||e.fields.tags.push("Faptap AI")),await g.funscripts.createFunscriptVideo(e.fields),te(),await V(),N.push("/funscripts")}catch(l){e.error=l}finally{e.loading=!1}},le=async()=>{if(!!e.fields.id){e.loading=!0;try{await g.funscripts.deleteFunscript(e.fields.id),N.push("/funscripts"),Y("submit-funscript",e.fields),await V()}catch(l){e.error=l}finally{e.loading=!1}}},I=l=>{if(!l)return!1;const t=l.trim();return["xnxx.com","xhamster.com","pornhub.com","xvideos.com"].some(a=>t.includes(a))};return de(()=>{w.value=!1}),ue(()=>{w.value=!1}),ce(()=>{he({meta:[{name:"description",content:"Easily create funscripts from any video URL on FapTap AI (Beta). Just paste a Pornhub or YouTube video link."}],link:[{rel:"canonical",href:"https://faptap.net/funscripts/create"}]})}),(l,t)=>{var i;return r(),d("div",ge,[s("div",_e,[H(C)().isProduction?(r(),d("h1",we,"Create Funscript from Video URL ")):(r(),d("h1",be,"Create Funscript from YouTube video"))]),s("form",{onSubmit:pe(se,["prevent"]),class:"flex flex-col gap-y-3 mt-4 mx-4 sm:mx-8"},[c(fe,{modelValue:R.value,"onUpdate:modelValue":t[1]||(t[1]=a=>R.value=a),title:"Error"},{default:f(()=>[s("div",ye,[s("div",ke,u(e.error),1),c(v,{theme:"blue",class:"flex items-center gap-x-2",onClick:t[0]||(t[0]=a=>K(String(e.error)))},{default:f(()=>[c($,{name:"content_copy",class:"h-4 w-4"}),t[12]||(t[12]=s("span",null,"Copy Error",-1))]),_:1})])]),_:1},8,["modelValue"]),s("div",Re,[s("div",Le,[t[15]||(t[15]=s("div",{class:"md:w-1/4"},[s("label",{class:"hidden md:block text-white font-medium text-right pr-4 pt-2"}," Video URL")],-1)),s("div",Ee,[s("div",Te,[c(me,{class:"flex-1 min-w-[150px]",required:"",modelValue:e.fields.stream_url,"onUpdate:modelValue":t[2]||(t[2]=a=>e.fields.stream_url=a),placeholder:"Stream URL"},null,8,["modelValue"]),s("div",Se,[c(v,{ref_key:"pasteBtnRef",ref:A,onClick:J,onMouseenter:t[3]||(t[3]=a=>L.value=!0),onMouseleave:t[4]||(t[4]=a=>L.value=!1),type:"button",theme:"blue",class:""},{default:f(()=>
1[c($,{name:"content_paste",class:"h-4 w-4"})]),_:1},512),c(B,{modelValue:L.value,"onUpdate:modelValue":t[5]||(t[5]=a=>L.value=a),target:((i=A.value)==null?void 0:i.$el)||A.value,offset:"8",placement:"top"},{default:f(()=>[...t[13]||(t[13]=[s("div",{class:"px-2 py-1 text-xs bg-zinc-800 text-white rounded border border-zinc-700 shadow-xl whitespace-nowrap"}," Paste your copied link ",-1)])]),_:1},8,["modelValue","target"]),e.fields.stream_url!==""?(r(),y(v,{key:0,onClick:ee,type:"button",theme:"blue",class:"",disabled:e.loading,loading:E.value},{default:f(()=>[_(u(E.value?"Fetching...":"Fetch Metadata"),1)]),_:1},8,["disabled","loading"])):p("",!0),s("div",Ve,[c(v,{onClick:t[6]||(t[6]=a=>w.value=!0),type:"button",theme:"transparent",class:""},{default:f(()=>[c($,{name:"help-outline",class:"h-6 w-6 text-zinc-400"})]),_:1})],512),c(B,{modelValue:w.value,"onUpdate:modelValue":t[7]||(t[7]=a=>w.value=a),target:l.$refs.el,offset:"8"},{default:f(()=>[s("div",Fe,[t[14]||(t[14]=s("p",{class:"text-white font-medium"},"Supported sites",-1)),s("div",Ce,[s("ul",Pe,[(r(!0),d(P,null,z(e.providers,a=>(r(),d("li",null,[s("a",{href:`https://${a}`,target:"_blank",class:"hover:text-white"},"https://"+u(a),9,ze)]))),256))])])])]),_:1},8,["modelValue","target"])])]),e.fields.stream_url?p("",!0):(r(),d("p",Oe," Videos over 30 minutes will be rejected "))])]),s("div",{class:"flex justify-end text-white italic opacity-50",onClick:t[8]||(t[8]=()=>{k.value++,k.value>5&&(k.value=0)})},[_(" Remaining funscripts today: "+u(h.value)+" \xA0 ",1),U.value&&h.value===0?(r(),d("small",Ue,"[Max Limit ("+u(M.value)+") Reached for today]",1)):p("",!0)]),k.value==5?(r(),d("small",Ae,[s("ul",Me,[s("li",null,"User Type: "+u(U.value?"Premium":"Regular"),1),s("li",null,"Remaining: "+u(h.value),1),s("li",null,"Your Video Limit: "+u(M.value),1)])])):p("",!0),s("div",Be,[_(" Current funscripts in queue: "+u(D.value)+" ",1),t[16]||(t[16]=s("br",null,null,-1))])]),T.value?(r(),d("div",$e,u(T.value),1)):p("",!0),o.value?(r(),d("div",Ne,[s("div",We,[t[17]||(t[17]=s("div",{class:"md:w-1/4"},[s("label",{class:"hidden md:block text-white font-medium text-right pr-4"},"Title")],-1)),s("div",De,[s("p",je,u(o.value.title),1)])]),s("div",Ie,[t[18]||(t[18]=s("div",{class:"md:w-1/4"},[s("label",{class:"hidden md:block text-white font-medium text-right pr-4"},"Tags")],-1)),s("div",qe,[o.value.tags.length===0?(r(),d("div",He," No tags found. ")):(r(!0),d(P,{key:1},z(o.value.tags,(a,m)=>(r(),d("div",{key:m,class:"bg-zinc-700 rounded text-sm px-2.5 py-0.5 flex items-center gap-x-1 grow-0 shrink-0"},[s("span",null,u(a),1)]))),128))])]),s("div",Qe,[t[19]||(t[19]=s("div",{class:"md:w-1/4"},[s("label",{class:"hidden md:block text-white font-medium text-right pr-4"},"Performers")],-1)),s("div",Ye,[o.value.performers.length===0?(r(),d("div",Ge," No performers found. ")):(r(!0),d(P,{key:1},z(o.value.performers,(a,m)=>(r(),d("div",{key:m,class:"bg-zinc-700 rounded text-sm px-2.5 py-0.5 flex items-center gap-x-1 grow-0 shrink-0"},[s("span",null,u(a.name),1),a.avatar_url?(r(),y(xe,{key:0,src:a.avatar_url,alt:a.name,class:"h-20 w-20 rounded-full border-2 border-zinc-700 overflow-hidden","aspect-ratio":"1/1"},null,8,["src","alt"])):p("",!0)]))),128))])])])):p("",!0),s("div",Je,[e.fields.id?(r(),y(v,{key:0,loading:e.loading,theme:"red",onClick:le,class:"shrink-0"},{default:f(()=>[...t[20]||(t[20]=[_("Delete",-1)])]),_:1},8,["loading"])):p("",!0),s("div",{ref_key:"submitBtnWrapper",ref:W,class:"flex-1 flex",onMouseenter:t[9]||(t[9]=a=>S.value=O.value),onMouseleave:t[10]||(t[10]=a=>S.value=!1)},[H(C)().isProduction?(r(),y(v,{key:0,disabled:O.value,loading:e.loading,theme:"blue",class:"flex-1"},{default:f(()=>[_(u(e.fields.id?"Edit":"Create"),1)]),_:1},8,["disabled","loading"])):(r(),y(v,{key:1,loading:e.loading,theme:"blue",class:"flex-1"},{default:f(()=>[_(u(e.fields.id?"Edit":"Create"),1)]),_:1},8,["loading"]))],544),c(B,{modelValue:S.value,"onUpdate:modelValue":t[11]||(t[11]=a=>S.value=a),target:W.value,placement:"top",offset:10},{default:f(()=>[s("div",Ke,[t[21]||(t[21]=s("p",{class:"text-white font-medium mb-2 text-sm"},"Cannot create funscript:",-1)),s("ul",Xe,[(r(!0),d(P,null,z(x.value,a=>(r(),d("li",{key:a},u(a),1))),128))])])]),_:1},8,["modelValue","target"])])],32)])}}});
1export{lt 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.