1import"../chunks/DsnmJJEf.js";import{i as J}from"../chunks/BBXrdGVi.js";import{p as Y,i as re,e as M,b,a as Q,f as C,am as A,an as P,s as E,g as t,k as V,q as H,ao as ee,h as u,m as I,au as de,l as B,d as fe,o as pe,ag as we,ad as ze,n as ae,t as ne,u as me,j as Le}from"../chunks/77vpnFW2.js";import{i as O}from"../chunks/DljiYl60.js";import{s as Oe}from"../chunks/LpsjaltD.js";import{a as q,s as Z}from"../chunks/Bjiw63jq.js";import{g as Ne}from"../chunks/VtDss9li.js";import{p as xe}from"../chunks/BLe3eFw0.js";import{c as U,W as te,b as ve,e as Se,u as Ee,f as Ue,t as j,a as x}from"../chunks/DS8dJ9ix.js";import{s as Be}from"../chunks/DEY4o60C.js";import{F as Fe}from"../chunks/B9b6FxlF.js";import{e as Ge,s as Me,c as he}from"../chunks/C6Od3s4X.js";import{b as ke}from"../chunks/W9saryPS.js";import{p as qe}from"../chunks/Cs13naKd.js";import{c as X}from"../chunks/BNE4N6ps.js";import{L as De,B as ge}from"../chunks/A_fNoe3s.js";import{l as We}from"../chunks/OFdmrB41.js";const ye=!0,je=!0,Ke=!1,Dt=Object.freeze(Object.defineProperty({__proto__:null,prerender:Ke,ssr:je},Symbol.toStringTag,{value:"Module"})),Ve={home:{path:"/",protected:!1},login:{path:"/login",protected:!1},signup:{path:"/signup",protected:!1},privacy:{path:"/privacy",protected:!1},terms:{path:"/terms",protected:!1},refund:{path:"/refund",protected:!1},pricing:{path:"/pricing",protected:!1},legal:{path:"/legal",protected:!1},dmca:{path:"/dmca",protected:!1},aup:{path:"/aup",protected:!1},contact:{path:"/contact",protected:!1},authorize:{path:"/auth/authorize",protected:!1},generation:{path:"/generation/:id",protected:!0},history:{path:"/history",protected:!0},historyDetail:{path:"/history/:id",protected:!0},settings:{path:"/settings",protected:!0},billing:{path:"/billing",protected:!0},subscribe:{path:"/subscribe",protected:!0},billingActivity:{path:"/billing/activity",protected:!0},ownerDashboard:{path:"/owner/dashboard",protected:!0},dashboard:{path:"/dashboard",protected:!0},hub:{path:"/hub",protected:!0},component:{path:"/hub/c/:id",protected:!0},componentEdit:{path:"/hub/c/:id/edit",protected:!0},inbox:{path:"/inbox",protected:!0},adminStats:{path:"/admin/stats",protected:!0},adminUsd100k:{path:"/admin/usd100k",protected:!0},generate:{path:"/generate",protected:!0},generateSession:{path:"/generate/session",protected:!0},generateProjects:{path:"/generate/projects",protected:!0},feed:{path:"/feed",protected:!1},rudiments:{path:"/rudiments",protected:!1},rudiment:{path:"/rudiments/:slug",protected:!1},rudimentNs:{path:"/rudiments/:owner/:slug",protected:!1},myhub:{path:"/myhub",protected:!0},productEditor:{path:"/rudiments/manage/:id",protected:!0}},He=Object.values(Ve).filter(e=>e.protected).map(e=>e.path.replace(/\/:[^/]+/g,"")),Je=/^\/hub\/(?:file|ver|repo|product)_[^/]+\/?$/;function Ye(e){return Je.test(e)?!1:He.some(a=>e===a||e.startsWith(a+"/"))}const Pe="promptContinuationsV1",Qe="promptContinuationForegroundV1";function Ie(e,a){try{return e?JSON.parse(e):a}catch{return a}}function Ae(){return typeof localStorage>"u"?{}:Ie(localStorage.getItem(Pe),{})||{}}function Ze(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(Pe,JSON.stringify(e||{}))}catch{}}function Xe(e){return e&&Ae()[e]||null}function et(e){if(!e)return;const a=Ae();a[e]&&(delete a[e],Ze(a))}function be(e){const a=Xe(e);return a&&et(e),a}function tt(e=2e3){if(typeof localStorage>"u")return!1;const r=Ie(localStorage.getItem(Qe),null)?.ts;return!r||!Number.isFinite(r)?!1:Date.now()-r<=e}const W=()=>{},rt=()=>{};let _e=!1;function at(){try{const e=localStorage.getItem("user");return e?JSON.parse(e):null}catch{return null}}function nt(){if(_e)return;_e=!0;const e=()=>tt(360*60*1e3);U.on(te.PROMPT_READY,async a=>{try{if(e())return;const r=a?.clientTempId,i=(a?.prompt||"").trim();if(!r||!i)return;const _=`${i} ${Fe}`.replace(/\s+/g," ").trim(),f=be(r);if(!f)return;W(r,{status:"pending",input:{...f.basePayload||{},prompt:_}});const o=at();if(!o?.userId||!o?.accessKey){W(r,{status:"failed",error:"Not authenticated"});return}const l={...f.basePayload||{},prompt:_},s=await ve.createAIGeneration(o.userId,o.accessKey,f.modelPath,l);s?.code===200&&s?.data?.id?rt(r):W(r,{status:"failed",error:s?.message||"Failed to create generation"})}catch(r){try{const i=a?.clientTempId;i&&W(i,{status:"failed",error:r?.message||"Failed to create generation"})}catch{}}}),U.on(te.PROMPT_FAILED,a=>{try{if(e())return;const r=a?.clientTempId;if(!r)return;be(r),W(r,{status:"failed",error:a?.error||"Prompt generation failed"})}catch{}})}const Re=new Set(["completed","success"]),st=["/generate","/history","/generation/"],ot=2500,it=45e3;let $e=!1,le=[],ce=[],ue=null,G=null,se=!1;
1function lt(){if(typeof window>"u")return!1;const e=window.location.pathname;return st.some(a=>e===a||e.startsWith(a))}function oe(e,a){return`${e} ${e===1?"generation":"generations"} ${a}`}function ct(){ue=null;const e=Date.now(),a=G&&e-G.at<it,r=le.length+(a?G.ready:0),i=ce.length+(a?G.failed:0);if(le=[],ce=[],!r&&!i)return;a&&j.dismiss(G.id);const _=r&&i?`${oe(r,"ready")}, ${i} failed`:r?oe(r,"ready"):oe(i,"failed");G={id:j.push(_,{variant:r?"success":"error",duration:9e3,action:{label:"VIEW",href:"/generate"}}),at:e,ready:r,failed:i}}function K(e,a){const r=String(e||"").trim();r&&Se().includes(r)&&(Ee(r),!lt()&&((a==="failed"?ce:le).push(r),ue||(ue=setTimeout(ct,ot))))}async function ie(){if(se)return;const e=Se();if(!e.length)return;const a=Ue();if(!a)return;let r=null;try{r=JSON.parse(localStorage.getItem("user")||"{}")?.accessKey||null}catch{r=null}if(r){se=!0;try{const i=await ve.getAIGenerationBatch(a,r,e),_=i?.code===200&&Array.isArray(i.data)?i.data:[],f=new Set;for(const l of _)f.add(String(l?.id)),Re.has(l?.status)?K(l.id,"ready"):l?.status==="failed"&&K(l.id,"failed");const o=e.filter(l=>!f.has(l));o.length&&Ee(o)}catch{}finally{se=!1}}}function ut(){$e||typeof window>"u"||($e=!0,U.on(te.GENERATION_COMPLETE,e=>K(e?.id,"ready")),U.on(te.GENERATION_UPDATE,e=>{e?.id&&(Re.has(e.status)?K(e.id,"ready"):e.status==="failed"&&K(e.id,"failed"))}),U.on("connected",()=>ie()),document.addEventListener("visibilitychange",()=>{document.hidden||ie()}),ie())}var dt=C('<a class="toast-action svelte-zemmny"> </a>'),ft=C('<div><span class="toast-msg svelte-zemmny"> </span> <!> <button class="toast-close svelte-zemmny" type="button" aria-label="Dismiss">Ã</button></div>'),pt=C('<div class="toast-stack svelte-zemmny" role="region" aria-live="polite" aria-label="Notifications"></div>');function vt(e,a){Y(a,!1);const r=()=>q(j,"$toasts",i),[i,_]=Z();J();var f=re(),o=M(f);{var l=s=>{var v=pt();Ge(v,5,r,h=>h.id,(h,p)=>{var g=ft(),y=A(g),$=A(y,!0);P(y);var k=E(y,2);{var w=c=>{var d=dt(),R=A(d,!0);P(d),V(()=>{he(d,"href",t(p).action.href),H(R,t(p).action.label||"OPEN")}),ee("click",d,()=>j.dismiss(t(p).id)),b(c,d)};O(k,c=>{t(p).action?.href&&c(w)})}var z=E(k,2);P(g),V(()=>{Me(g,1,`toast toast-${t(p).variant??""}`,"svelte-zemmny"),he(g,"role",t(p).variant==="error"?"alert":"status"),H($,t(p).message)}),ee("click",z,()=>j.dismiss(t(p).id)),b(h,g)}),P(v),b(s,v)};O(o,s=>{r().length>0&&s(l)})}b(e,f),Q(),_()}var mt=C('<button type="button" class="svelte-1wnyitt">Retry</button>'),ht=C('<div class="conn svelte-1wnyitt" role="status"><span class="dot svelte-1wnyitt" aria-hidden="true"></span> <span class="svelte-1wnyitt"> </span> <!></div>');function gt(e,a){Y(a,!1);const r=()=>q(x,"$authStore",i),[i,_]=Z(),f=I(),o=I(),l=8e3;let s=I(!1),v=I(!1),h=null;function p(c,d){if(clearTimeout(h),!c||d){u(s,!1),u(v,!1);return}h=setTimeout(()=>u(s,!0),l)}const g=U.on("reconnect_failed",()=>{u(v,!0),u(s,!0)}),y=U.on("reconnecting",()=>{u(v,!1)});function $(){u(v,!1),U.retryNow()}de(()=>{clearTimeout(h),g&&g(),y&&y()}),B(()=>r(),()=>{u(f,r().user)}),B(()=>r(),()=>{u(o,r().wsConnected)}),B(()=>(t(f),t(o)),()=>{p(t(f),t(o))}),fe(),J();var k=re(),w=M(k);{var z=c=>{var d=ht(),R=E(A(d),2),S=A(R,!0);P(R);var F=E(R,2);{var L=D=>{var n=mt();ee("click",n,$),b(D,n)};O(F,D=>{t(v)&&D(L)})}P(d),V(()=>H(S,t(v)?"Live updates are offline":"Reconnectingâ¦")),b(c,d)};O(w,c=>{t(s)&&c(z)})}b(e,k),Q(),_()}var yt=C('<div class="cb ds-skin svelte-1xqvkrg" data-surface="dark" role="region" aria-label="Cookie preferences"><p class="cb-t svelte-1xqvkrg">Analytics cookies help us improve TWOZERO. Essential cookies are always on. <span class="cb-l svelte-1xqvkrg"><!></span></p> <div class="cb-act svelte-1xqvkrg"><!> <!></div></div>');function bt(e,a){Y(a,!1);const r=()=>q(X,"$consentStore",i),[i,_]=Z(),f=I();let o=I(null),l=I(null);function s(){if(typeof document>"u")return;if(!t(o)){document.documentElement.style.removeProperty("--tz-cookie-h");return}const y=t(o).getBoundingClientRect(),$=Math.max(0,Math.round(window.innerHeight-y.top));document.documentElement.style.setProperty("--tz-cookie-h",`${$}px`)}pe(()=>(X.init(),typeof ResizeObserver<"u"&&u(l,new ResizeObserver(s)),window.addEventListener("resize",s),(
1)=>{window.removeEventListener("resize",s),t(l)&&t(l).disconnect(),typeof document<"u"&&document.documentElement.style.removeProperty("--tz-cookie-h")}));let v=qe(a,"deferred",8,!1);B(()=>(r(),we(v())),()=>{u(f,r().initialized&&r().needsChoice&&!v())}),B(()=>(t(f),t(l),t(o)),()=>{typeof document<"u"&&(t(f)?ze().then(()=>{t(l)&&t(o)&&t(l).observe(t(o)),s()}):(t(l)&&t(l).disconnect(),document.documentElement.style.removeProperty("--tz-cookie-h")))}),fe(),J();var h=re(),p=M(h);{var g=y=>{var $=yt(),k=A($),w=E(A(k)),z=A(w);De(z,{href:"/cookies",tone:"quiet",children:(S,F)=>{ae();var L=ne("Cookie policy");b(S,L)},$$slots:{default:!0}}),P(w),P(k);var c=E(k,2),d=A(c);ge(d,{variant:"raised",size:"block",full:!0,$$events:{click(...S){X.reject?.apply(this,S)}},children:(S,F)=>{ae();var L=ne("Reject");b(S,L)},$$slots:{default:!0}});var R=E(d,2);ge(R,{variant:"primary",size:"block",full:!0,$$events:{click(...S){X.accept?.apply(this,S)}},children:(S,F)=>{ae();var L=ne("Accept");b(S,L)},$$slots:{default:!0}}),P(c),P($),ke($,S=>u(o,S),()=>t(o)),b(y,$)};O(p,y=>{t(f)&&y(g)})}b(e,h),Q(),_()}var _t=C('<p class="legal-error svelte-1l6oftt" role="alert"> </p>'),$t=C('<div class="legal-banner svelte-1l6oftt" role="region" aria-label="Legal update"><div class="legal-mark svelte-1l6oftt" aria-hidden="true"></div> <div class="legal-text svelte-1l6oftt"><p class="svelte-1l6oftt"><span class="legal-label svelte-1l6oftt">Updated</span> <a href="/terms" class="svelte-1l6oftt">terms</a> <span class="legal-sep svelte-1l6oftt">/</span> <a href="/privacy" class="svelte-1l6oftt">privacy</a> <span class="legal-sep svelte-1l6oftt">·</span> Continued use means agreement.</p> <!></div> <button type="button" class="legal-btn svelte-1l6oftt"> </button></div>');function wt(e,a){Y(a,!1);const r=()=>q(x,"$authStore",i),[i,_]=Z(),f=We.legalVersion;let o=I(!1),l=I(null),s=I(null),v=null;function h(){if(!t(s))return;const c=Math.ceil(t(s).getBoundingClientRect().height);document.documentElement.style.setProperty("--legal-banner-h",`${c}px`)}pe(()=>{h(),typeof ResizeObserver<"u"?(v=new ResizeObserver(h),v.observe(t(s))):window.addEventListener("resize",h)}),de(()=>{typeof window>"u"||(v&&v.disconnect(),window.removeEventListener("resize",h),document.documentElement.style.removeProperty("--legal-banner-h"))});async function p(){u(o,!0),u(l,null);try{const c=r().user,d=await ve.acceptLegal(c.userId,c.accessKey,{version:f,tos:!0,privacy:!0});d&&d.ok?x.updateUser({legalAcceptedVersion:d.legalAcceptedVersion,legalAcceptedAt:d.legalAcceptedAt||null,requiresLegalAccept:!1}):u(l,"Could not save. Try again.")}catch(c){u(l,c&&c.message||"Network error. Try again.")}finally{u(o,!1)}}J();var g=$t(),y=E(A(g),2),$=E(A(y),2);{var k=c=>{var d=_t(),R=A(d,!0);P(d),V(()=>H(R,t(l))),b(c,d)};O($,c=>{t(l)&&c(k)})}P(y);var w=E(y,2),z=A(w,!0);P(w),P(g),ke(g,c=>u(s,c),()=>t(s)),V(()=>{w.disabled=t(o),H(z,t(o)?"Savingâ¦":"I agree")}),ee("click",w,p),b(e,g),Q(),_()}var St=C('<div class="app-loading svelte-12qhfyh"><div class="app-loading-spinner svelte-12qhfyh"></div></div>'),Et=C("<!> <!> <!>",1),kt=C('<a class="tz-skip-link" href="#main">Skip to content</a> <!> <!> <!>',1);function Wt(e,a){Y(a,!1);const r=()=>q(xe,"$page",_),i=()=>q(x,"$authStore",_),[_,f]=Z(),o=I(),l=["/terms","/privacy","/cookies","/legal","/dmca","/aup","/refund"];let s=null,v=null,h=I(!1),p=I(!1),g=I(!1),y=null;function $(n){return t(g)&&y===n||(u(p,!1),u(g,!0),y=n,Ne(n,{replaceState:!0}).catch(()=>{}).finally(()=>{if(y===n&&(u(g,!1),y=null),!t(h))return;const m=w();u(p,!m)})),!0}function k(){if(typeof document>"u")return;const n=document.getElementById("initial-loader");n&&n.parentNode&&n.parentNode.removeChild(n)}pe(()=>{x.init(),nt(),ut();const n=()=>{s&&clearInterval(s),x.refreshBalance(),s=setInterval(()=>{x.refreshBalance()},3e4)};i().user&&n(),v=x.subscribe(m=>{if(!t(h)&&m.initialized){u(h,!0);const T=w(m);u(p,!T),t(p)&&k()}if(m.user&&!s){n();try{const T=sessionStorage.getItem("redirectAfterLogin");if(T){sessionStorage.removeItem("redirectAfterLogin");const N=Be(T);N&&$(N)}}catch{}}else!m.user&&s&&(clearInterval(s),s=null)})}),de(()=>{v&&v(),s&&clearInterval(s)});function w(n=null){const m=r().url.pathname,T=n?.user??i().user;if(m.startsWith("/adminkus"))return window.location.href=m,!0;
1if(Ye(m)&&!T){const N=m+(r().url.search||"");try{sessionStorage.setItem("redirectAfterLogin",N)}catch{}return $(`/login?next=${encodeURIComponent(N)}`)}return!1}B(()=>r(),()=>{u(o,l.some(n=>{const m=r().url.pathname;return m===n||m.startsWith(n+"/")}))}),B(()=>(t(h),t(g),t(p)),()=>{if(t(h)&&typeof window<"u"&&!t(g)){const n=w();u(p,!n),t(p)&&k()}}),fe(),J();var z=kt(),c=E(M(z),2);{var d=n=>{wt(n,{})};O(c,n=>{we(ye),t(o),i(),me(()=>ye&&!t(o)&&i().user&&i().user.requiresLegalAccept)&&n(d)})}var R=E(c,2);{var S=n=>{var m=re(),T=M(m);Oe(T,a,"default",{},null),b(n,m)},F=n=>{var m=St();b(n,m)};O(R,n=>{t(p)?n(S,1):n(F,!1)})}var L=E(R,2);{var D=n=>{var m=Et(),T=M(m);vt(T,{});var N=E(T,2);gt(N,{});var Te=E(N,2);{let Ce=Le(()=>(t(o),i(),me(()=>!t(o)&&!!i().user?.requiresLegalAccept)));bt(Te,{get deferred(){return t(Ce)}})}b(n,m)};O(L,n=>{n(D)})}b(e,z),Q(),f()}export{Wt as component,Dt as universal};
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.