A modification for grok.com
ของเมื่อวันที่
// ==UserScript==
// @name Void
// @namespace https://github.com/imjustprism/Void
// @version 0.2.2
// @description A modification for grok.com
// @author Prism & Void Contributors
// @environment Production
// @match *://grok.com/*
// @run-at document-start
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_listValues
// @license GPL-3.0-or-later
// ==/UserScript==
(()=>{var Ws=Object.defineProperty;var Xo=(e,t)=>{for(var o in t)Ws(e,o,{get:t[o],enumerable:!0,configurable:!0,set:(n)=>t[o]=()=>n})};var Mr={};Xo(Mr,{waitFor:()=>Ce,syncLazyModules:()=>Nt,subscribe:()=>gt,stopPlugin:()=>No,startPlugin:()=>Te,sleep:()=>Ui,showToast:()=>Uo,showNotice:()=>Oo,search:()=>ia,sanitizeFilename:()=>Do,requireModule:()=>ln,removeChatBarButton:()=>ko,registerStyle:()=>P,registerPlugin:()=>Bo,proxyLazy:()=>Se,plugins:()=>v,patches:()=>U,patchStats:()=>xe,patchResults:()=>no,patchReport:()=>Or,openModal:()=>tr,onlyOnce:()=>Hi,onceReady:()=>oo,migrateSettingsToPlugin:()=>os,migratePluginSettings:()=>es,migratePluginSetting:()=>ts,mergeDefaults:()=>He,matchesPattern:()=>wt,matchesAllPatterns:()=>De,mapMangledModuleLazy:()=>na,mapMangledModule:()=>Zr,mapMangledCssClasses:()=>Yr,makeLazy:()=>Mt,isTruthy:()=>_i,isPluginEnabled:()=>N,isObject:()=>ft,isNonNullish:()=>zi,isBlacklisted:()=>oe,initSettings:()=>Fo,init:()=>Tr,importModule:()=>sa,getTurbopackHelpers:()=>et,getRuntimeModuleCache:()=>Fr,getRuntimeFactoryRegistry:()=>Ve,getModuleCache:()=>H,formatDuration:()=>zt,formatCountdown:()=>Po,findStoreLazy:()=>Qs,findStore:()=>Xr,findModuleId:()=>Kr,findModuleFactory:()=>sn,findLazy:()=>rn,findExportedComponentLazy:()=>Ot,findExportedComponent:()=>L,findCssClassesLazy:()=>ea,findCssClasses:()=>qr,findComponentByCodeLazy:()=>Js,findComponentByCode:()=>jr,findByPropsLazy:()=>d,findByProps:()=>lo,findByCodeLazy:()=>Zs,findByCode:()=>Wr,findBulk:()=>oa,findAll:()=>Ks,find:()=>tt,filters:()=>W,fetchExternal:()=>ge,extractAndLoadChunksLazy:()=>ra,extractAndLoadChunks:()=>Qr,errorMessage:()=>To,enableStyle:()=>Ae,downloadFile:()=>Mo,dispatch:()=>vo,disableStyle:()=>ie,definePluginSettings:()=>te,definePlugin:()=>h,debounce:()=>Ln,copyToClipboard:()=>Co,confirm:()=>Vs,common:()=>Cr,closeNotice:()=>An,closeModal:()=>or,closeAllModals:()=>Bs,classes:()=>Z,classNameFactory:()=>I,clamp:()=>Wi,addPatch:()=>On,addChatBarButton:()=>Io,ToastType:()=>zo,StartAt:()=>nt,SettingsStore:()=>q,Settings:()=>b,PlainSettings:()=>Ut,OptionType:()=>se,NoticeType:()=>Vo,Logger:()=>M,DefaultChunkLoadRegex:()=>an,ChunkPathRegex:()=>Jr});var cn={};Xo(cn,{WorkspaceStore:()=>mi,WorkspaceConnectorsStore:()=>Ti,WorkspaceCollectionsStore:()=>Pi,UpsellStore:()=>ci,TourGuideStore:()=>pi,TextToSpeechStore:()=>xi,TasksStore:()=>bi,TabsManagerStore:()=>ri,SubscriptionsStore:()=>po,SourcesSelectorStore:()=>di,ShareStore:()=>ui,SettingsStore:()=>ei,SettingsDialogStore:()=>ti,SessionStore:()=>co,RoutingStore:()=>ni,ResponseStore:()=>ot,ReportStore:()=>Si,PersonalityStore:()=>hi,NotificationsStore:()=>ii,ModesStore:()=>ai,ModelsStore:()=>uo,MentionMenuStore:()=>gi,MediaStore:()=>si,FileStore:()=>oi,FeatureStore:()=>j,DevModelsStore:()=>fi,ConversationStore:()=>At,CommandMenuStore:()=>li,ChatPageStore:()=>re,AssetStore:()=>yi,ArtifactStore:()=>Ci});var Dr=["arguments","caller","prototype"],Ze=Symbol.for("void.lazy.get"),qo=Symbol.for("void.lazy.cached"),Jt={};for(let e of["apply","construct","defineProperty","deleteProperty","getPrototypeOf","has","isExtensible","preventExtensions","set","setPrototypeOf"])Jt[e]=(t,...o)=>Reflect[e](t[Ze]?.()??t,...o);Jt.ownKeys=(e)=>{let t=e[Ze]?.()??e,o=Reflect.ownKeys(t);for(let n of Dr)if(!o.includes(n))o.push(n);return o};Jt.getOwnPropertyDescriptor=(e,t)=>{if(typeof t==="string"&&Dr.includes(t))return Reflect.getOwnPropertyDescriptor(e,t);let o=e[Ze]?.()??e,n=Reflect.getOwnPropertyDescriptor(o,t);if(n)Object.defineProperty(e,t,n);return n};function Mt(e){let t,o=!1;return()=>{if(!o){if(t=e(),t!=null)o=!0}return t}}function Se(e){let t=Mt(e),o=Object.assign(()=>{},{[qo]:void 0,[Ze](){let n=t();return o[qo]=n,n}});return new Proxy(o,{...Jt,get(n,i,s){if(i===qo||i===Ze)return Reflect.get(n,i,s);let a=n[Ze]();if(a==null)return;if(typeof a==="object"||typeof a==="function")return Reflect.get(a,i,s);throw Error("proxyLazy: factory returned a primitive value")}})}var Yo=null;function vr(e){Yo=e}function C(e,t){let o=null,n=(i)=>{if(o??=t(),!o||!Yo)return null;return Yo(o,i)};return Object.defineProperty(n,"name",{value:e}),new Proxy(n,{get(i,s){if(s==="$$voidGetWrapped")return()=>o??t();if(s==="displayName"){if(o??=t(),o)return o[s]}return Reflect.get(i,s)}})}var js=typeof window<"u",Dt={reset:"\x1B[0m",bold:"\x1B[1m",green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",magenta:"\x1B[35m",gray:"\x1B[90m"};class M{name;color;constructor(e,t="white"){this.name=e;this.color=t}_log(e,t){if(js){console[e](`%c Void %c %c ${this.name} `,"background: white; color: black; font-weight: bold; border-radius: 5px;","",`background: ${this.color}; color: black; font-weight: bold; border-radius: 5px;`,...t);return}let n={error:Dt.red,warn:Dt.yellow}[e]??Dt.green,i=`${Dt.bold}${n}[${this.name}]${Dt.reset}`;console[e](i,...t)}log(...e){this._log("log",e)}info(...e){this._log("info",e)}error(...e){this._log("error",e)}warn(...e){this._log("warn",e)}debug(...e){this._log("debug",e)}}function vt(e,t){let o=e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/\b\w/g,(n)=>n.toUpperCase());if(!t)return o;return Object.entries(t).reduce((n,[i,s])=>n.replace(new RegExp(`\\b${i}\\b`,"g"),s),o)}function Lr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Lt(e,t,o){return`${e} ${e===1?t:o??t+"s"}`}function wt(e,t){if(typeof t==="string")return e.includes(t);return t.lastIndex=0,t.test(e)}function De(e,t){return t.every((o)=>wt(e,o))}var It=Symbol("Void.originalFactory"),kt=Symbol("Void.patched"),Qt=Symbol("Void.patchedBy"),Et=Symbol("Void.patchedCode");var be=new M("TurbopackPatcher","#e78284"),eo=typeof unsafeWindow<"u"?unsafeWindow:window,Zo=2147483646,Xs=Symbol.for("motionComponentSymbol"),qs=0,wr=(e,t,o)=>{let n=`__void_eval_${qs++}`,i=document.createElement("script"),s=`window["${n}"]=(${e});`;if(t)s=`${t}
${s}`;if(o)s+=`
${o}`;i.textContent=s,(document.head??document.documentElement).appendChild(i),i.remove();let a=eo[n];if(delete eo[n],!a)throw Error("Factory compilation failed (CSP?)");return a},to=new Set,U=[],Be=new Map,Je=new Map,Qe=null,G=null,V=null,Ft=null,on,oo=new Promise((e)=>on=e);var no=[],xe={applied:0,noEffect:0,errors:0,patchedModules:new Set};function H(){return Be}function Fr(){return G}var Ir=0;function Nt(){if(!G)return;let e=0;for(let t in G)e++;if(e===Ir)return;for(let t in G){let o=G[t];if(o?.exports==null)continue;let n=Number(t);if(!Be.has(n))ro(o.exports,n)}Ir=e}function Ve(){return V}function et(){return Ft}function Nr(e,t){Je.set(e,t)}function Br(e){Je.delete(e)}var Jo=new Set;function Bt(e){return Jo.add(e),()=>Jo.delete(e)}var Qo=new WeakSet;function en(e){if(e==null)return!0;let t=typeof e;if(t!=="object"&&t!=="function")return!0;if(e===window||e===document||e===document.documentElement)return!0;try{if(e[Symbol.toStringTag]==="DOMTokenList")return!0;if(e[Xs])return!0}catch{return!0}return e instanceof HTMLElement||e instanceof ArrayBuffer||e instanceof MessagePort||e instanceof Map||e instanceof Set||ArrayBuffer.isView(e)||typeof WebSocket<"u"&&e instanceof WebSocket}function Vr(){let e=console.warn;console.warn=(...t)=>{if(t.some((o)=>typeof o==="string"&&(o.includes("has been renamed to")||o.includes("silence this warning"))))return;if(t.length===1&&t[0]==="")return;e.apply(console,t)};try{for(let[,t]of Be){if(en(t)){if(t!=null&&(typeof t==="object"||typeof t==="function"))Qo.add(t);continue}if(typeof t!=="object")continue;for(let o in t)try{let n=t[o];if(en(n)&&n!=null&&(typeof n==="object"||typeof n==="function"))Qo.add(n)}catch{}}}finally{console.warn=e}}function oe(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(Qo.has(e))return!0;return en(e)}function ro(e,t){if(e==null)return;if(Be.get(t)===e)return;if(Be.set(t,e),Je.size)for(let[o,n]of[...Je])try{if(!Je.has(o))continue;if(o(e))Je.delete(o),n(e,t)}catch(i){be.error("WaitFor listener error:",i)}for(let o of[...Jo])try{o()}catch{}}function Ys(e,t){if(!U.length)return t;let o=String(t),n=o,i=t,s=new Set;for(let a=0;a<U.length;a++){let l=U[a];if(l.predicate&&!l.predicate())continue;if(!(Array.isArray(l.find)?De(o,l.find):wt(o,l.find)))continue;let u=Array.isArray(l.replacement)?l.replacement:[l.replacement],f=n,w=i,g=!0,S=0,A={plugin:l.plugin,find:String(l.find),moduleId:e,replacements:[]};for(let B of u){if(B.predicate&&!B.predicate())continue;let $=n,z=i;try{let{match:R}=B,y=performance.now(),k=n.replace(R,B.replace),ce=performance.now()-y;if(k===n){if(xe.noEffect++,A.replacements.push({match:String(R),status:"noEffect"}),!l.noWarn&&!B.noWarn)be.error(`Patch by ${l.plugin} had no effect: ${String(R)}`);if(l.group){g=!1;break}continue}n=k,i=wr(n),i[It]=t,i[kt]=!0,i[Et]=n,s.add(l.plugin),xe.applied++,S++,xe.patchedModules.add(e),A.replacements.push({match:String(R),status:"applied"})}catch(R){if(xe.errors++,A.replacements.push({match:String(B.match),status:"error"}),be.error(`Error in patch by ${l.plugin} on module ${e}:`,R),n=$,i=z,l.group){n=f,i=w,s.delete(l.plugin);break}}}if(no.push(A),l.group&&!g){if(xe.applied-=S,n=f,i=w,s.delete(l.plugin),!l.noWarn)be.warn(`Group patch by ${l.plugin} failed, reverting`);continue}if(!l.all)U.splice(a--,1)}if(s.size){let a=[...s].join(", ");i=wr(n,`// Turbopack Module ${e} - Patched by ${a}`,`//# sourceURL=file:///TurbopackModule${e}`),i[It]=t,i[kt]=!0,i[Et]=n,i[Qt]=[...s]}return i}function tn(e,t){let o=Ys(e,t),n=o[It]??t,i=function(s,a,l){if(!Ft)Ft=s;if(!G&&s.c){G=s.c,$r(G);for(let c of to)try{c()}catch{}to.clear()}if(!V&&s.M)V=s.M;try{o.call(this,s,a,l)}catch(c){if(o===t)throw c;be.error(`Patched module ${a?.id??e} errored, using original:`,c);try{n.call(this,s,a,l)}catch(u){throw be.error(`Original module ${a?.id??e} also errored:`,u),u}}try{let c=a?.id??e;if(a?.exports!=null)ro(a.exports,c)}catch{}};if(i.toString=()=>String(t),i[It]=n,o[kt])i[kt]=!0,i[Qt]=o[Qt],i[Et]=o[Et];return i}function Ko(...e){let t=e[0];if(!Array.isArray(t))return Qe(...e);let o=null,n=new Map;for(let i=1;i<t.length;i++){if(typeof t[i]!=="function")continue;let s=t[i-1];if(typeof s!=="number")continue;if(!o)o=[...t];let a=t[i],l=n.get(a);if(l)o[i]=l;else{let c=tn(s,a);n.set(a,c),o[i]=c}}return Qe.call(null,o??t)}function Or(){return{stats:{...xe,patchedModules:[...xe.patchedModules]},results:no,orphaned:U.filter((e)=>!e.all).map((e)=>({plugin:e.plugin,find:String(e.find)}))}}function Ar(){let e=U.filter((t)=>!t.all);if(e.length)be.warn(`${e.length} patch(es) found no module:`,e.map((t)=>`${t.plugin}: ${String(t.find)}`))}function $r(e){let t=0;for(let o in e){let n=e[o];if(n?.exports==null)continue;let i=Number(o);if(Be.get(i)!==n.exports)ro(n.exports,i),t++}}function io(){if(!G)return;let e=0;for(let t in G){let o=G[t];if(o?.exports==null)continue;let n=Number(t);if(Be.get(n)!==o.exports)ro(o.exports,n),e++}if(e>0)be.info(`Rescan found ${e} new/updated modules`)}function kr(){let e=Map.prototype.set,t=null;Map.prototype.set=function(o,n){if(!t&&typeof o==="number"&&typeof n==="function")t=this;return e.call(this,o,n)};try{Qe(["void-factory-probe",Zo,()=>{}])}finally{Map.prototype.set=e}return t?.delete(Zo),t}function Er(e){let t=Zo-1;e.set(t,(o)=>{if(!Ft)Ft=o;if(!G&&o.c){G=o.c,$r(G);for(let n of to)try{n()}catch{}to.clear()}if(!V&&o.M)V=o.M}),Qe(["void-cache-probe",{otherChunks:[],runtimeModuleIds:[t]}]),Promise.resolve().then(()=>e.delete(t))}function Rr(){let e=eo.TURBOPACK;if(e&&!Array.isArray(e)&&typeof e.push==="function"){if(Qe=e.push.bind(e),e.push=(...n)=>Ko(...n),V=kr(),V)for(let[n,i]of V)V.set(n,tn(n,i));if(!G&&V)Er(V);return}let t=[];if(Array.isArray(e))t.push(...e);let o=e??[];if(Object.defineProperty(eo,"TURBOPACK",{configurable:!0,get(){return o},set(n){if(n&&!Array.isArray(n)&&typeof n.push==="function"){let i=n;Qe=i.push.bind(i),i.push=(...s)=>Ko(...s),o=i;for(let s of t)try{Ko(s)}catch(a){be.error("Failed to process queued chunk:",a)}if(t.length=0,V=kr(),V)for(let[s,a]of V)V.set(s,tn(s,a));if(!G&&V)Er(V)}else o=n}}),Array.isArray(o)){let n=o.push.bind(o);o.push=(...i)=>{return t.push(...i),n(...i)}}}var ne=new M("TurbopackFinder","#a6d189"),nn=!1;function Vt(e){if(nn)return e();nn=!0;let t=console.warn;console.warn=(...o)=>{if(o.some((n)=>typeof n==="string"&&(n.includes("has been renamed to")||n.includes("silence this warning"))))return;if(o.length===1&&o[0]==="")return;t.apply(console,o)};try{return e()}finally{console.warn=t,nn=!1}}var Gr=new WeakMap;function ao(e){let t=Gr.get(e);if(t===void 0)t=String(e),Gr.set(e,t);return t}function Hr(e){if(e.startsWith("use"))return e;return e.endsWith("Store")?`use${e}`:`use${e}Store`}var W={byProps:(...e)=>{return e.length===1?(t)=>t[e[0]]!=null:(t)=>e.every((o)=>t[o]!=null)},byCode:(...e)=>{return(t)=>{if(typeof t!=="function")return!1;return De(ao(t),e)}},byDisplayName:(e)=>{return(t)=>t?.displayName===e||t?.render?.displayName===e},byStoreName:(e)=>{let t=Hr(e);return(o)=>{if(typeof o!=="object"||o===null)return!1;let n=o[t];return typeof n==="function"&&typeof n.getState==="function"}},componentByCode:(...e)=>{let t=W.byCode(...e);return(o)=>{if(t(o))return!0;if(!o?.$$typeof)return!1;if(o.type)return t(o.type);if(o.render)return t(o.render);return!1}},byClassName:(...e)=>{return(t)=>{if(typeof t!=="object"||t===null)return!1;return e.every((o)=>typeof t[o]==="string")}}};function Oe(e,t=!1,o=!1){return Vt(()=>{let n=_r(e,t,o);if(!t&&n)return n;if(t&&n.length)return n;let i=H().size;if(Nt(),H().size===i)return n;return _r(e,t,o)})}function _r(e,t,o){let n=[],i=t?new Set:null,s=H();for(let[,a]of s){if(a==null||oe(a))continue;try{if(e(a)){if(!t)return a;if(!i.has(a))i.add(a),n.push(a);continue}}catch{}if(!o&&typeof a==="object")for(let l in a)try{let c=a[l];if(c==null||oe(c))continue;if(e(c)){if(!t)return c;if(!i.has(c))i.add(c),n.push(c)}}catch{}}return t?n:null}function tt(e){return Oe(e)}function Ks(e){return Oe(e,!0)}function rn(e){let t=Oe(e);if(t)return t;return Se(()=>Oe(e))}function lo(...e){return tt(W.byProps(...e))}function d(...e){return Se(()=>lo(...e))}function Wr(...e){return tt(W.byCode(...e))}function Zs(...e){return Se(()=>Wr(...e))}function jr(...e){return tt(W.componentByCode(...e))}function Js(...e){return C("findComponentByCode",()=>jr(...e))}function L(...e){return Vt(()=>{let t=zr(e);if(t)return t;let o=H().size;if(Nt(),H().size===o)return null;return zr(e)})}function zr(e){let t=H();for(let[,o]of t){if(o==null||typeof o!=="object"||oe(o))continue;for(let n of e)try{let i=o[n];if(i==null||oe(i))continue;if(typeof i==="function"||i?.$$typeof)return i}catch{}}return null}function Ot(...e){return C(e[0],()=>L(...e))}function Xr(e){let t=Hr(e),o=tt(W.byStoreName(e));return o?.[t]??o}function Qs(e){return Se(()=>Xr(e))}function qr(...e){let t=Oe(W.byClassName(...e),!1,!0);if(!t)return{};return Yr(t,e)}function ea(...e){return Se(()=>qr(...e))}function ta(e){return new RegExp(`(?:\\b|_)${Lr(e)}(?:\\b|_)`)}function Yr(e,t){let o={};for(let n of t){let i=ta(n),s=!1;for(let a in e)if(typeof e[a]==="string"&&i.test(e[a])){o[n]=e[a],s=!0;break}if(!s)ne.warn(`mapMangledCssClasses: class "${n}" not found in module`)}return o}function oa(...e){let{length:t}=e;if(t<2)return ne.warn("findBulk called with fewer than 2 filters, use find instead."),t===1?[tt(e[0])]:[];return Vt(()=>{let o=[...e],n=Array(t).fill(null),i=0,s=H();e:for(let[,a]of s){if(a==null||oe(a))continue;for(let l=0;l<t;l++){let c=o[l];if(!c)continue;try{if(c(a)){if(n[l]=a,o[l]=void 0,++i===t)break e}}catch{}}if(typeof a==="object")for(let l in a)try{let c=a[l];if(c==null||oe(c))continue;for(let u=0;u<t;u++){let f=o[u];if(!f)continue;if(f(c)){if(n[u]=c,o[u]=void 0,++i===t)break e;break}}}catch{}}if(i!==t)ne.warn(`findBulk: got ${t} filters but only found ${i} modules.`);return n})}function sn(...e){let t=Ve();if(!t)return null;for(let[o,n]of t)if(De(ao(n),e))return[o,n];return null}function Kr(...e){return sn(...e)?.[0]??null}function Zr(e,t){let o={},n=Kr(...e);if(n==null)return o;let i=ln(n);if(i==null)return o;return Vt(()=>{let s=Object.entries(t),a=0;e:for(let l in i)try{let c=i[l];for(let u=0;u<s.length;u++){let[f,w]=s[u];if(f in o)continue;if(w(c)){if(o[f]=c,++a===s.length)break e;break}}}catch{}return o})}function na(e,t){return Se(()=>Zr(e,t))}var so="[A-Za-z_$][\\w$]*",an=new RegExp(`Promise\\.all\\(\\[([^\\]]+)\\]\\.map\\(${so}=>${so}\\.l\\(${so}\\)\\)\\)\\.then\\(\\(\\)=>${so}\\((\\d+)\\)\\)`),Jr=/"(static\/chunks\/[^"]+)"/g;async function Qr(e,t=an){let o=sn(...e);if(!o)return ne.warn("extractAndLoadChunks: no module factory found for:",e),!1;let n=ao(o[1]).match(t);if(!n)return ne.warn("extractAndLoadChunks: no chunk loading pattern found in factory for:",e),!1;let[,i,s]=n;if(s==null)return ne.warn("extractAndLoadChunks: matcher did not capture entry point ID for:",e),!1;let a=et();if(!a)return ne.warn("extractAndLoadChunks: Turbopack helpers not available."),!1;if(i){let c=Array.from(i.matchAll(Jr),(u)=>u[1]);if(c.length)try{await Promise.all(c.map((u)=>a.l(u)))}catch(u){return ne.warn("extractAndLoadChunks: chunk loading failed:",u),!1}}let l=Number(s);try{ln(l)}catch(c){return ne.warn("extractAndLoadChunks: entry point module failed:",c),!1}return!0}function ra(e,t=an){return Mt(()=>Qr(e,t))}function ia(...e){let t={},o=Ve();if(!o)return t;for(let[n,i]of o)if(De(ao(i),e))t[n]=i;return t}function ln(e){let t=H();if(t.has(e))return t.get(e);let o=et();if(!o)return null;try{return o.i(e)}catch{return null}}function sa(e){let t=et();if(!t)return Promise.reject(Error("Turbopack helpers not available"));return t.A(e)}function Ur(e,t){return Vt(()=>{if(oe(e))return null;try{if(t(e))return e;if(typeof e==="object"&&e!==null)for(let o in e)try{let n=e[o];if(n!=null&&!oe(n)&&t(n))return n}catch{}}catch{}return null})}function Ce(e,t,o=0){let n=Oe(e);if(n)return t(n,-1),()=>{};let i=(u)=>Ur(u,e)!=null,s=(u,f)=>{try{let w=Ur(u,e);if(w)t(w,f)}catch(w){ne.error("waitFor callback error:",w)}},a=null;Nr(i,(u,f)=>{if(a)clearTimeout(a);s(u,f)});let c=()=>{if(a)clearTimeout(a);Br(i)};if(o>0)a=setTimeout(()=>{if(a=null,H().size>0&&!Oe(e))ne.warn(`waitFor timed out after ${o}ms:`,e),c()},o);return c}var co=d("useSession","SessionStoreProvider"),ei=d("useSettingsStore","TOOL_NAMES"),ti=d("useSettingsDialogStore"),j=d("useFeatureStore"),oi=d("useFileStore"),At=d("useConversationStore","createOptimisticConversation"),ot=d("useResponseStore","createOptimisticResponse"),ni=d("useRoutingStore","formatUrl"),uo=d("useModelsStore"),re=d("useChatPageStore","getLatestThreadMessageId"),ri=d("useTabsManagerStore"),po=d("useSubscriptionsStore"),ii=d("useNotificationsStore","useNotificationsStoreInit"),si=d("useMediaStore","useImagineModeStore"),ai=d("useModesStore"),li=d("useCommandMenuStore","createSelection"),ci=d("useUpsellStore","useShouldShowUpgradeButton"),ui=d("useShareStore"),di=d("useSourcesSelectorStore"),pi=d("useTourGuideStore","useTourGuideTooltip"),fi=d("useDevModelsStore","DRAFT_MODEL_ID"),mi=d("useWorkspaceStore","useWorkspacesList"),gi=d("useMentionMenuStore"),yi=d("useAssetStore"),hi=d("usePersonalityStore","DEFAULT_CUSTOM_PERSONALITY"),Si=d("useReportStore"),xi=d("useTextToSpeechStore"),bi=d("useTasksStore"),Ci=d("useArtifactStore","useArtifactEdits"),Pi=d("useWorkspaceCollectionsStore","useWorkspaceActiveCollectionIds"),Ti=d("useWorkspaceConnectorsStore","useWorkspaceActiveConnectorIds");var aa=new M("Styles","#a6d189"),Di=new Map,fo=new Map,$t=null,mo=[];function un(){if($t)return $t;if(!document.head)return null;return $t=document.createElement("void-styles"),document.head.appendChild($t),$t}function Mi(){let e=un();if(!e)return;for(let[t,o]of mo)dn(e,t,o);mo=[]}function dn(e,t,o){let n=fo.get(t);if(n){if(n.textContent!==o)n.textContent=o;return}let i=document.createElement("style");i.dataset.void=t,i.textContent=o,e.appendChild(i),fo.set(t,i)}function P(e,t){Di.set(e,t);let o=un();if(o)dn(o,e,t);else if(mo.push([e,t]),mo.length===1)if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",Mi,{once:!0});else Mi()}function Ae(e){let t=fo.get(e);if(t){if(t.disabled)return t.disabled=!1,!0;return!1}let o=Di.get(e);if(!o)return aa.warn(`Style "${e}" not registered.`),!1;let n=un();if(!n)return!1;return dn(n,e,o),!0}function ie(e){let t=fo.get(e);if(!t)return!1;return t.disabled=!0,!0}var I=(e="")=>(...t)=>{let o=new Set;for(let n of t)if(typeof n==="string")o.add(n);else if(Array.isArray(n))n.forEach((i)=>o.add(i));else if(n&&typeof n==="object")Object.entries(n).forEach(([i,s])=>s&&o.add(i));return Array.from(o,(n)=>e+n).join(" ")};function Z(...e){return e.filter(Boolean).join(" ")}function pn(e){let t=typeof e==="string",o=t?e:e.source;if(o=o.replaceAll(/#{i18n::([^}]+)}/g,(i,s)=>t?`"${s}"`:`"${s.replaceAll(".","\\.")}"`),!t)o=o.replaceAll(/(\\*)\\i/g,(i,s)=>s.length%2===0?`${s}(?:[A-Za-z_$][\\w$]*)`:i.slice(1)),o=o.replaceAll(/\\e\{(\w+)\}/g,(i,s)=>`["']${s}["'],\\(\\)=>(?:[A-Za-z_$][\\w$]*)`);if(o===(t?e:e.source))return e;if(t)return o;let n=new RegExp(o,e.flags);return n.toString=e.toString.bind(e),n}function la(e,t){if(typeof e!=="function")return e.replaceAll("$self",t);return(o,...n)=>e(o,...n).replaceAll("$self",t)}function vi(e,t){e.match=pn(e.match),e.replace=la(e.replace,t)}function Li(e){if(Array.isArray(e.find))e.find=e.find.map((t)=>pn(t));else e.find=pn(e.find)}function h(e){return e}var nt;((n)=>{n.Init="Init";n.DOMContentLoaded="DOMContentLoaded";n.TurbopackReady="TurbopackReady"})(nt||={});var se;((c)=>{c[c.STRING=0]="STRING";c[c.NUMBER=1]="NUMBER";c[c.BIGINT=2]="BIGINT";c[c.BOOLEAN=3]="BOOLEAN";c[c.SELECT=4]="SELECT";c[c.SLIDER=5]="SLIDER";c[c.COMPONENT=6]="COMPONENT";c[c.CUSTOM=7]="CUSTOM"})(se||={});var r,x,O,fn,Y,ue,Rt,X,ae,Gt;Ce(W.byProps("useReducedMotion"),(e)=>{({useReducedMotion:Gt}=e)});Ce(W.byProps("useState","createElement"),(e)=>{let t=e;r=t,{useState:x,useEffect:O,useLayoutEffect:fn,useMemo:Y,useRef:ue,useReducer:Rt,useCallback:X,createElement:ae}=t,vr(t.createElement)});var rt=Symbol.for("react.fragment"),wi=d("createPortal","flushSync");var Ii=null;Ce(W.byProps("Button","ButtonWithTooltipOptimized"),(e)=>{Ii=e});var ki=(e)=>C(e,()=>Ii?.[e]??L(e)),E=ki("Button"),$e=ki("ButtonWithTooltip"),go=C("Card",()=>L("Card")),Ei=null;Ce(W.byProps("Dialog","DialogContent","DialogHeader"),(e)=>{Ei=e});var Re=(e)=>C(e,()=>Ei?.[e]??L(e)),ve=Re("Dialog"),Le=Re("DialogContent"),we=Re("DialogHeader"),Ie=Re("DialogTitle"),it=Re("DialogDescription"),st=Re("DialogFooter"),yo=Re("DialogClose"),at=C("DropdownMenuItem",()=>L("DropdownMenuItem")),Q=C("Input",()=>L("Input")),ho=C("MotionDiv",()=>lo("motion")?.motion?.div),de=C("Select",()=>L("Select")),pe=C("SelectTrigger",()=>L("SelectTrigger")),fe=C("SelectContent",()=>L("SelectContent")),F=C("SelectItem",()=>L("SelectItem")),me=C("SelectValue",()=>L("SelectValue")),ke=C("Separator",()=>L("Separator")),So=C("Slider",()=>L("Slider")),lt=C("SettingsRow",()=>L("SettingsRow")),ct=C("SettingsTitle",()=>L("SettingsTitle")),ut=C("SettingsDescription",()=>L("SettingsDescription")),K=C("Switch",()=>L("Switch")),Ge=C("Tooltip",()=>L("Tooltip")),_e=C("TooltipTrigger",()=>L("TooltipTrigger")),ze=C("TooltipContent",()=>L("TooltipContent")),{toast:Fi}=d("toast","Toaster"),mn=d("Sidebar","SidebarContent","SidebarProvider"),gn=C("AnimatePresence",()=>L("AnimatePresence"));var yn=d("chatApi","modelsApi"),hn=d("Toaster","toast"),Ue=d("cn","middleTruncate"),Sn=d("reasoningModeToRequestKind","reasoningModeToDeepsearchPreset"),ca=d("create","useStore"),ua=d("useTranslation"),da=d("useRouter","usePathname");var pa="inline-flex items-center rounded-full border border-input-border px-2 py-0.5 text-[10px] font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",fa={default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"bg-popover border-border-l1 text-fg-secondary-foreground hover:bg-popover/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-secondary"};function xn({variant:e="secondary",className:t,children:o,...n}){return r.createElement("div",{className:Ue.cn(pa,fa[e],t),...n},o)}var ma="w-full max-w-md p-6 rounded-2xl border border-border-l1 flex flex-col gap-6";function _t({open:e,onOpenChange:t,title:o,description:n,confirmText:i="Confirm",cancelText:s="Cancel",danger:a,onConfirm:l}){return r.createElement(ve,{open:e,onOpenChange:t},r.createElement(Le,{className:ma},r.createElement(we,null,r.createElement(Ie,null,o),r.createElement(it,null,n)),r.createElement(st,null,r.createElement(E,{variant:"secondary",size:"md",onClick:()=>t(!1)},s),r.createElement(E,{variant:a?"danger":"primary",size:"md",onClick:()=>{t(!1),l()}},i))))}var xo=null;function ga(){if(xo)return xo;return xo=class extends r.Component{constructor(t){super(t);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){if(this.state.hasError)return this.props.fallback??null;return this.props.children??null}},xo}function ya(e){let t=ga();return r.createElement(t,{...e})}var _=ya;Object.defineProperty(_,"wrap",{value(e,t=null){let o=(n)=>r.createElement(_,{fallback:t},r.createElement(e,{...n}));return Object.defineProperty(o,"name",{value:`ErrorBoundary(${e.displayName??e.name??"Unknown"})`}),o},configurable:!0});P("ErrorCard",`.void-error-card-root {
padding: 1rem;
border-radius: var(--radius);
background: hsl(var(--red-800) / 60%);
border: 1px solid hsl(var(--red-700));
color: hsl(var(--fg-danger));
}
.void-error-card-header {
font-weight: 600;
margin-bottom: 0.5rem;
}
.void-error-card-root code {
display: block;
margin-top: 0.5rem;
padding: 0.5rem;
border-radius: calc(var(--radius) / 2);
background: hsl(var(--black) / 20%);
font-size: 0.85em;
white-space: pre-wrap;
overflow-wrap: break-word;
}
`);var Mc=I("void-error-card-");function p({flexDirection:e,gap:t="1em",justifyContent:o,alignItems:n,flexWrap:i,children:s,style:a,ref:l,...c}){return r.createElement("div",{ref:l,style:{display:"flex",flexDirection:e,gap:t,justifyContent:o,alignItems:n,flexWrap:i,...a},...c},s)}function dt({columns:e,rows:t,gap:o="0.75rem",justifyItems:n,alignItems:i,children:s,style:a,...l}){return r.createElement("div",{style:{display:"grid",gridTemplateColumns:e,gridTemplateRows:t,gap:o,justifyItems:n,alignItems:i,...a},...l},s)}var ee=(e,...t)=>r.createElement("svg",{width:e.size??"1em",height:e.size??"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:e.className},t),bn=(e={})=>ee(e,r.createElement("path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"}),r.createElement("path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"})),Ni=(e={})=>ee(e,r.createElement("rect",{x:"3",y:"8",width:"13",height:"13",rx:"4",stroke:"currentColor"}),r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13 2.00004L12.8842 2.00002C12.0666 1.99982 11.5094 1.99968 11.0246 2.09611C9.92585 2.31466 8.95982 2.88816 8.25008 3.69274C7.90896 4.07944 7.62676 4.51983 7.41722 5.00004H9.76392C10.189 4.52493 10.7628 4.18736 11.4147 4.05768C11.6802 4.00488 12.0228 4.00004 13 4.00004H14.6C15.7366 4.00004 16.5289 4.00081 17.1458 4.05121C17.7509 4.10066 18.0986 4.19283 18.362 4.32702C18.9265 4.61464 19.3854 5.07358 19.673 5.63807C19.8072 5.90142 19.8994 6.24911 19.9488 6.85428C19.9992 7.47112 20 8.26343 20 9.40004V11C20 11.9773 19.9952 12.3199 19.9424 12.5853C19.8127 13.2373 19.4748 13.8114 19 14.2361V16.5829C20.4795 15.9374 21.5804 14.602 21.9039 12.9755C22.0004 12.4907 22.0002 11.9334 22 11.1158L22 11V9.40004V9.35725C22 8.27346 22 7.3993 21.9422 6.69141C21.8826 5.96256 21.7568 5.32238 21.455 4.73008C20.9757 3.78927 20.2108 3.02437 19.27 2.545C18.6777 2.24322 18.0375 2.1174 17.3086 2.05785C16.6007 2.00002 15.7266 2.00003 14.6428 2.00004L14.6 2.00004H13Z",fill:"currentColor"})),Cn=(e={})=>ee(e,r.createElement("path",{d:"M10.88 21.94 15.46 14"}),r.createElement("path",{d:"M21.17 8H12"}),r.createElement("path",{d:"M3.95 6.06 8.54 14"}),r.createElement("circle",{cx:"12",cy:"12",r:"10"}),r.createElement("circle",{cx:"12",cy:"12",r:"4"})),Pn=(e={})=>ee(e,r.createElement("circle",{cx:"12",cy:"12",r:"10"}),r.createElement("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),r.createElement("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})),Tn=(e={})=>ee(e,r.createElement("path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"}),r.createElement("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),r.createElement("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),r.createElement("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),r.createElement("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"})),bo=(e={})=>ee(e,r.createElement("path",{d:"m12 14 4-4"}),r.createElement("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}));var Bi=(e={})=>ee(e,r.createElement("path",{d:"M10 11v6"}),r.createElement("path",{d:"M14 11v6"}),r.createElement("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),r.createElement("path",{d:"M3 6h18"}),r.createElement("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})),Mn=(e={})=>ee(e,r.createElement("path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3"}),r.createElement("path",{d:"m16 2 6 6"}),r.createElement("path",{d:"M12 16H4"})),Vi=(e={})=>ee(e,r.createElement("path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44"}),r.createElement("path",{d:"m13.56 11.747 4.332-.924"}),r.createElement("path",{d:"m16 21-3.105-6.21"}),r.createElement("path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z"}),r.createElement("path",{d:"m6.158 8.633 1.114 4.456"}),r.createElement("path",{d:"m8 21 3.105-6.21"}),r.createElement("circle",{cx:"12",cy:"13",r:"2"})),Dn=(e={})=>ee(e,r.createElement("path",{d:"m19 5 3-3"}),r.createElement("path",{d:"m2 22 3-3"}),r.createElement("path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z"}),r.createElement("path",{d:"M7.5 13.5 10 11"}),r.createElement("path",{d:"M10.5 16.5 13 14"}),r.createElement("path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z"})),Oi=(e={})=>r.createElement("svg",{width:e.size??"1em",height:e.size??"1em",viewBox:"0 0 15 15",fill:"none",className:e.className},r.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})),Ai=(e={})=>ee(e,r.createElement("circle",{cx:"12",cy:"12",r:"1"}),r.createElement("circle",{cx:"12",cy:"5",r:"1"}),r.createElement("circle",{cx:"12",cy:"19",r:"1"})),$i=(e={})=>r.createElement("svg",{width:e.size??"1em",height:e.size??"1em",viewBox:"0 0 24 24",fill:"currentColor",className:e.className},r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3C9.86974 3 8.36758 3.44687 7.30331 4.30861C6.24544 5.16518 5.77303 6.31294 5.44931 7.34656C5.34315 7.68552 5.24989 8.01119 5.16061 8.32293C4.67184 10.0297 4.3026 11.3191 2.59045 12.0877L2 12.3528V13C2 13.5638 2.1227 14.0439 2.36548 14.4568C2.59992 14.8555 2.9079 15.1234 3.14945 15.3133C3.24924 15.3917 3.33688 15.4587 3.41432 15.5178L3.41445 15.5179C3.75134 15.7753 3.89523 15.8852 4.00625 16.153C4.02083 16.1882 4.05258 16.3202 4.01681 16.6105C3.98277 16.8867 3.89932 17.2176 3.78078 17.5898C3.67031 17.9367 3.54072 18.2855 3.41195 18.6321L3.38617 18.7015C3.25634 19.0512 3.11722 19.4276 3.03341 19.7437L2.70025 21H7.87689L12 22.0308L16.1231 21H21.3378L20.9591 19.7169C20.8577 19.3732 20.7296 19.016 20.6096 18.6814L20.6 18.6547C20.4736 18.302 20.3539 17.9667 20.2541 17.6336C20.0498 16.9516 19.971 16.4061 20.0567 15.9647C20.0994 15.7444 20.1593 15.7043 20.6831 15.3528L20.697 15.3435C20.9367 15.1826 21.2889 14.9346 21.5621 14.5365C21.8517 14.1145 22 13.6069 22 13V12.3528L21.4095 12.0877C19.6974 11.3191 19.3282 10.0297 18.8394 8.32294L18.8392 8.32236C18.75 8.01083 18.6568 7.68526 18.5507 7.34656C18.227 6.31294 17.7546 5.16518 16.6967 4.30861C15.6324 3.44687 14.1303 3 12 3ZM11 10.625C11 11.7986 10.3284 12.75 9.5 12.75C8.67157 12.75 8 11.7986 8 10.625C8 9.4514 8.67157 8.5 9.5 8.5C10.3284 8.5 11 9.4514 11 10.625ZM14.5 12.75C15.3284 12.75 16 11.7986 16 10.625C16 9.4514 15.3284 8.5 14.5 8.5C13.6716 8.5 13 9.4514 13 10.625C13 11.7986 13.6716 12.75 14.5 12.75Z"})),Ri=(e={})=>ee(e,r.createElement("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),r.createElement("path",{d:"M12 9v4"}),r.createElement("path",{d:"M12 17h.01"}));var ha={primary:"",secondary:"text-secondary",muted:"text-muted-foreground"};function Ee({color:e="secondary",className:t,children:o,...n}){return r.createElement("p",{className:Ue.cn("text-xs text-pretty",ha[e],t),...n},o)}var Sa={xs:"text-xs",sm:"text-sm",base:"text-base",lg:"text-lg",xl:"text-xl","2xl":"text-2xl"},xa={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},ba={primary:"",secondary:"text-secondary",muted:"text-muted-foreground"};function m({size:e="sm",weight:t="normal",color:o="primary",as:n="div",className:i,...s}){return ae(n,{className:Ue.cn(Sa[e],xa[t],ba[o],i),...s})}var Ca={width:"auto",opacity:1},Gi={width:0,opacity:0},Pa={duration:0.2,ease:"easeOut"},Ta="h-10 relative rounded-full ring-1 ring-inset transition-colors duration-150 ease-out text-fg-primary ring-border-l1 hover:bg-surface-l3";function pt({icon:e,children:t,tooltip:o,onClick:n,className:i,iconOnly:s,"aria-label":a}){let l=typeof o==="string"?o:a,c=Gt(),u=ue(!1),f=!s&&!!t;return O(()=>{if(f)u.current=!0},[f]),r.createElement($e,{variant:"none",size:"none",className:Z("group flex flex-col justify-center rounded-full","focus:outline-none focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"),tooltipContent:o,tooltipProps:{delayDuration:600},tooltipContentProps:{side:"top"},onClick:n,"aria-label":l},r.createElement("div",{className:Z(Ta,"flex items-center justify-center",f?"px-2.5 gap-1.5 text-xs font-medium tabular-nums":"aspect-square gap-0.5",i)},e,s!=null?r.createElement(gn,null,f&&r.createElement(ho,{initial:c||!u.current?!1:Gi,animate:Ca,exit:Gi,transition:c?{duration:0}:Pa,className:"flex items-center overflow-hidden whitespace-nowrap"},t)):t))}function _i(e){return Boolean(e)}function zi(e){return e!=null}function ft(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function He(e,t){for(let o in t){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let n=e[o];if(ft(n))He(n,t[o]);else if(n===void 0)e[o]=t[o]}return e}function Ui(e){return new Promise((t)=>setTimeout(t,e))}async function Co(e){try{await navigator.clipboard.writeText(e)}catch{if(typeof GM_setClipboard==="function")GM_setClipboard(e)}}function Hi(e){let t,o=!1;return(...n)=>{if(o)return t;return o=!0,t=e(...n),t}}function Ln(e,t){let o,n=(...i)=>{clearTimeout(o),o=setTimeout(()=>e(...i),t)};return n.cancel=()=>clearTimeout(o),n}function ge(e){if(typeof GM_xmlhttpRequest>"u")return fetch(e);return new Promise((t,o)=>{GM_xmlhttpRequest({method:"GET",url:e,responseType:"blob",onload(n){let i=n.response;t(new Response(i,{status:n.status,statusText:n.statusText}))},ontimeout(){o(Error("fetch timeout"))},onerror(){o(Error("fetch error"))},onabort(){o(Error("fetch aborted"))}})})}function mt(){let e=new Set,t=0;return{notify(){t++;for(let o of e)o()},subscribe(o){return e.add(o),()=>{e.delete(o)}},getSnapshot(){return t}}}var vn=(e)=>String(e).padStart(2,"0");function Po(e){let t=Math.floor(e/3600),o=Math.floor(e%3600/60),n=e%60;return t>0?`${t}:${vn(o)}:${vn(n)}`:`${o}:${vn(n)}`}function zt(e){let t=Math.floor(e/3600),o=Math.floor(e%3600/60);if(t>0&&o>0)return`${t}h ${o}m`;return t>0?`${t}h`:`${o}m`}function Wi(e,t,o){return Math.min(Math.max(e,t),o)}function To(e){return e instanceof Error?e.message:String(e)}function Mo(e,t,o="application/octet-stream"){let n=new Blob([t],{type:o}),i=URL.createObjectURL(n),s=document.createElement("a");s.href=i,s.download=e,s.click(),URL.revokeObjectURL(i)}function Do(e,t="file"){return e.replace(/[^a-zA-Z0-9 ]/g,"").trim().replace(/\s+/g,"-")||t}var wn=new Map;function gt(e,t){let o=wn.get(e);if(!o)o=new Set,wn.set(e,o);return o.add(t),()=>{o.delete(t)}}function vo(e,t){let o=wn.get(e);if(!o?.size)return;for(let n of[...o])n(t)}function yt(e){return typeof e==="function"?e():e}function ht(e){r.useSyncExternalStore(e.subscribe,e.getSnapshot)}function We(){return Rt((e)=>e+1,0)[1]}function In(e,t){O(()=>gt(e,t),[e,t])}function je(e,t,o){return Y(()=>{let n=t.toLowerCase().trim();if(!n)return e;return e.filter((i)=>o(i).toLowerCase().includes(n))},[e,t,o])}function Lo(e){let[t,o]=x(e),n=ue(e);if(n.current!==e)n.current=e,o(e);return O(()=>{if(t==null||t<=0)return;let i=setInterval(()=>o((s)=>s!=null&&s>1?s-1:null),1000);return()=>clearInterval(i)},[t!=null&&t>0]),t}var wo=new Map,kn=mt();function Io(e,t){wo.set(e,t),kn.notify()}function ko(e){wo.delete(e),kn.notify()}function Ma(e,t){if(e.render){let o=e.render;return r.createElement(o,{iconOnly:t})}return r.createElement(pt,{icon:yt(e.icon),tooltip:yt(e.tooltip),onClick:e.onClick,iconOnly:t})}function ji({iconOnly:e}){if(ht(kn),!wo.size)return null;let t=[...wo.entries()].sort(([,o],[,n])=>(o.order??0)-(n.order??0));return r.createElement(r.Fragment,null,t.map(([o,n])=>r.createElement(_,{key:o},Ma(n,e))))}var En=new Map,Fn=mt();function Xi(e){let t=En.get(e);if(!t)t=new Map,En.set(e,t);return t}function qi(e,t,o){Xi(e).set(t,o),Fn.notify()}function Yi(e,t){Xi(e).delete(t),Fn.notify()}function Da(e,t){if(e.render){let o=e.render;return r.createElement(o,{...t})}return r.createElement(at,{onSelect:()=>e.onSelect?.(t)},yt(e.icon),yt(e.label))}function Ki({location:e,...t}){ht(Fn);let o=En.get(e);if(!o?.size)return null;let n=[...o.entries()].sort(([,i],[,s])=>(i.order??0)-(s.order??0));return r.createElement(r.Fragment,null,n.map(([i,s])=>r.createElement(_,{key:i,fallback:null},Da(s,t))))}var va=null;function Zi(){return va??=new Promise((e,t)=>{let o=indexedDB.open("Void",1);o.onupgradeneeded=()=>{if(!o.result.objectStoreNames.contains("kv"))o.result.createObjectStore("kv")},o.onsuccess=()=>e(o.result),o.onerror=()=>t(o.error)})}async function Ji(e){let t=await Zi();return new Promise((o,n)=>{let s=t.transaction("kv","readonly").objectStore("kv").get(e);s.onsuccess=()=>o(s.result),s.onerror=()=>n(s.error)})}async function Eo(e,t){let o=await Zi();return new Promise((n,i)=>{let a=o.transaction("kv","readwrite").objectStore("kv").put(t,e);a.onsuccess=()=>n(),a.onerror=()=>i(a.error)})}var La=new M("SettingsStore");function Qi(e,t){let o=e.get(t);if(!o)o=new Set,e.set(t,o);return o}class Nn{globalListeners=new Set;pathListeners=new Map;prefixListeners=new Map;defaultGetters=new Map;saveTimer=null;constructor(e){this.plain=e,this.store=this.makeProxy(e)}setDefaultGetter(e,t){this.defaultGetters.set(e,t)}makeProxy(e,t=""){return new Proxy(e,{get:(o,n)=>{let i=o[n];if(i===void 0&&n!=="__proto__"){let s=t?`${t}.${n}`:n;for(let[a,l]of this.defaultGetters)if(s.startsWith(a)){let c=s.slice(a.length+1);if(c&&!c.includes(".")){let u=l(c);if(u!==void 0)o[n]=u,i=u}break}}if(ft(i))return this.makeProxy(i,t?`${t}.${n}`:n);return i},set:(o,n,i)=>{if(o[n]===i)return!0;o[n]=i;let s=t?`${t}.${n}`:n;return this.notifyListeners(s),!0},deleteProperty:(o,n)=>{if(!(n in o))return!0;delete o[n];let i=t?`${t}.${n}`:n;return this.notifyListeners(i),!0}})}notifyListeners(e){for(let o of this.globalListeners)o(e);let t=this.pathListeners.get(e);if(t)for(let o of t)o(e);for(let[o,n]of this.prefixListeners)if(e.startsWith(o))for(let i of n)i(e);this.scheduleSave()}scheduleSave(){if(this.saveTimer)return;this.saveTimer=setTimeout(()=>{this.saveTimer=null,this.save()},100)}save(){try{let e=JSON.stringify(this.plain);if(typeof GM_setValue==="function")GM_setValue("VoidSettings",e);else Eo("VoidSettings",e).catch(()=>{})}catch(e){La.error("Failed to save settings:",e)}}markAsChanged(){this.notifyListeners("")}addGlobalChangeListener(e){this.globalListeners.add(e)}removeGlobalChangeListener(e){this.globalListeners.delete(e)}addChangeListener(e,t){Qi(this.pathListeners,e).add(t)}removeChangeListener(e,t){this.pathListeners.get(e)?.delete(t)}addPrefixChangeListener(e,t){Qi(this.prefixListeners,e).add(t)}removePrefixChangeListener(e,t){this.prefixListeners.get(e)?.delete(t)}}var Pe=new M("Settings"),Bn={plugins:{},notifications:{timeout:5000,position:"bottom-right"}},Xe={};He(Xe,Bn);var q=new Nn(Xe),Ut=Xe,b=q.store;async function Fo(){if(typeof GM_getValue==="function"){try{let t=GM_getValue("VoidSettings",null);if(t)Object.assign(Xe,JSON.parse(t))}catch(t){Pe.error("Failed to load settings:",t)}He(Xe,Bn);return}let e=null;try{e=await Ji("VoidSettings")}catch(t){Pe.warn("Failed to read IndexedDB:",t)}if(!e){if(e=wa(),e)Eo("VoidSettings",e).catch((t)=>Pe.debug("Failed to persist settings to IndexedDB:",t))}if(e)try{Object.assign(Xe,JSON.parse(e))}catch(t){Pe.error("Failed to parse settings:",t)}He(Xe,Bn)}function wa(){try{let e=localStorage.getItem("VoidSettings");if(e)return localStorage.removeItem("VoidSettings"),Pe.info("Migrated settings from localStorage to IndexedDB"),e}catch(e){Pe.warn("Failed to read localStorage:",e)}return null}function es(e,...t){let{plugins:o}=q.plain;if(e in o)return;for(let n of t)if(n in o){Pe.info(`Migrating settings from old name ${n} to ${e}`),o[e]=o[n],delete o[n],q.markAsChanged();break}}function ts(e,t,o){let n=q.plain.plugins[e];if(!n||!(o in n)||t in n)return;Pe.info(`Migrating setting ${o} -> ${t} in ${e}`),n[t]=n[o],delete n[o],q.markAsChanged()}function os(e,t,...o){let n=q.plain.plugins[t];if(!n)return;let i=q.plain.plugins[e]??={enabled:!1},s=!1;for(let a of o)if(a in n&&!(a in i))i[a]=n[a],delete n[a],s=!0;if(s)Pe.info(`Migrated settings [${o.join(", ")}] from ${t} to ${e}`),q.markAsChanged()}function Ia(e){if("default"in e)return e.default;if(e.type===4)return e.options.find((t)=>t.default)?.value;return}function te(e,t){let o="",n={get store(){if(!o)throw Error("Cannot access settings before plugin is initialized");return b.plugins[o]},get plain(){if(!o)throw Error("Cannot access settings before plugin is initialized");return Ut.plugins[o]},def:e,checks:t??{},get pluginName(){return o},set pluginName(i){if(o=i,!i)return;if(!Ut.plugins[i])Ut.plugins[i]={enabled:!1};q.setDefaultGetter(`plugins.${i}`,(s)=>{let a=e[s];return a?Ia(a):void 0})},use(i){let s=We();return O(()=>{let a=`plugins.${o}`;if(i?.length){let l=i.map((u)=>`${a}.${String(u)}`),c=(u)=>{if(l.some((f)=>u.startsWith(f)))s()};return q.addPrefixChangeListener(a,c),()=>q.removePrefixChangeListener(a,c)}return q.addPrefixChangeListener(a,s),()=>q.removePrefixChangeListener(a,s)},[]),n.store},withPrivateSettings(){return this}};return n}var ye=new M("PluginManager","#b4befe"),v={},Vn=new Map,ns=!1,ka=cn;function N(e){let t=v[e];if(!t)return!1;if(t.required)return!0;if(t.isDependency)return!0;return b.plugins[e]?.enabled??t.enabledByDefault??!1}function On(e,t){let o=e;if(o.plugin=t,o.predicate&&!o.predicate())return;if(Li(o),!Array.isArray(o.replacement))o.replacement=[o.replacement];let n=`Void.plugins[${JSON.stringify(t)}]`;for(let i of o.replacement)vi(i,n);o.replacement=o.replacement.filter(({predicate:i})=>!i||i()),U.push(o)}function rs(e,t=new Set){if(!e.dependencies)return!0;for(let o of e.dependencies){let n=v[o];if(!n)return ye.warn(`Missing dependency ${o} for ${e.name}`),!1;if(n.started)continue;if(t.has(o))return ye.error(`Circular dependency detected: ${e.name} -> ${o}`),!1;if(n.isDependency=!0,b.plugins[o]={...b.plugins[o],enabled:!0},t.add(o),!rs(n,t))return!1;if(!Te(n))return!1}return!0}function Ea(e){let t=ka[e];if(!t)return null;let o=`use${e}`,n=t[o];if(n&&typeof n.subscribe==="function")return n;for(let i in t){let s=t[i];if(s&&typeof s.subscribe==="function")return s}return null}function Te(e,t=!1){if(e.started)return!0;try{if(!rs(e))return ye.error(`Failed to start dependencies for ${e.name}`),!1;if(e.managedStyle)Ae(e.managedStyle);if(!e.hidden&&!t)ye.info(`Starting plugin ${e.name}`);if(e.start?.(),e.chatBarButton)Io(e.name,e.chatBarButton);if(e.contextMenuItems)for(let[n,i]of Object.entries(e.contextMenuItems))qi(n,e.name,i);let o=[];if(e.events)for(let[n,i]of Object.entries(e.events))o.push(gt(n,i));if(e.storeSubscriptions?.length)for(let n of e.storeSubscriptions)o.push(n.store.subscribe(n.callback,n.selector));if(e.zustand)for(let[n,i]of Object.entries(e.zustand)){let s=Ea(n);if(!s){ye.warn(`Store "${n}" not found for plugin ${e.name}`);continue}let a=(c,u)=>{try{i.handler(c,u)}catch(f){ye.error(`Zustand handler error in ${e.name} for ${n}:`,f)}},l=i.selector?s.subscribe(i.selector,a):s.subscribe(a);o.push(l)}if(e.eventListeners)for(let n of e.eventListeners){let i=n.target==="window"?window:document;i.addEventListener(n.event,n.handler,n.options),o.push(()=>i.removeEventListener(n.event,n.handler,n.options))}if(o.length)Vn.set(e.name,o);return e.started=!0,!0}catch(o){return ye.error(`Failed to start plugin ${e.name}:`,o),!1}}function No(e){if(!e.started)return!0;try{let t=Vn.get(e.name);if(t){for(let o of t)o();Vn.delete(e.name)}if(ko(e.name),e.contextMenuItems)for(let o of Object.keys(e.contextMenuItems))Yi(o,e.name);if(e.managedStyle)ie(e.managedStyle);if(e.cleanupSelectors)for(let o of e.cleanupSelectors)document.querySelectorAll(o).forEach((n)=>n.remove());return e.stop?.(),e.started=!1,!0}catch(t){return ye.error(`Failed to stop plugin ${e.name}:`,t),!1}}function Ht(e){for(let t in v){let o=v[t];if(!N(t))continue;if((o.startAt??"Init")!==e)continue;Te(o)}}function Bo(e){if(v[e.name])return;if(v[e.name]=e,e.started=!1,e.settings)e.settings.pluginName=e.name}function is(){if(ns)return;ns=!0;let e=new Set;for(let n in v){if(!N(n))continue;let i=v[n];if(i.dependencies?.forEach((s)=>{let a=v[s];if(!a){ye.warn(`Plugin ${n} has unresolved dependency ${s}`);return}b.plugins[s]={...b.plugins[s],enabled:!0},a.isDependency=!0}),i.chatBarButton)e.add("ChatBarButtonAPI");if(i.contextMenuItems)e.add("ContextMenuAPI")}for(let n of e){let i=v[n];if(!i)continue;b.plugins[n]={...b.plugins[n],enabled:!0},i.isDependency=!0}for(let n in v){if(!N(n))continue;let i=v[n];for(let s of Object.keys(i)){if(s==="start"||s==="stop")continue;let a=i[s];if(typeof a==="function"&&!a.$$voidBound){let l=a.bind(i);l.$$voidBound=!0,i[s]=l}}if(i.patches)for(let s of i.patches)On(s,n)}let t=Object.values(v).filter((n)=>!n.hidden),o=t.filter((n)=>N(n.name)).length;ye.info(`${o}/${t.length} plugins enabled, ${U.length} patches`)}var as=new M("Notices"),Vo;((n)=>{n.INFO="log";n.WARNING="warn";n.ERROR="error"})(Vo||={});var St=null,qe=null;function ss(e){try{localStorage.removeItem(`banner-${e}`)}catch(t){as.debug("Failed to clear banner dismissal:",t)}}function Oo(e){let t=`void-notice-${Date.now()}`;if(qe)clearTimeout(qe),qe=null;if(St)ss(St);ss(t);let{config:o}=j.useFeatureStore.getState();if(j.useFeatureStore.setState({config:{...o,banner:{type:e.type??"log",message:e.message,sentAt:t}}}),St=t,e.timeout)qe=setTimeout(An,e.timeout);return t}function An(){if(!St)return;if(qe)clearTimeout(qe),qe=null;try{localStorage.setItem(`banner-${St}`,"true")}catch(t){as.debug("Failed to persist banner dismissal:",t)}let{config:e}=j.useFeatureStore.getState();j.useFeatureStore.setState({config:{...e,banner:{}}}),St=null}var $n=new M("UpdateChecker","#85c1dc");function Fa(e,t){let o=e.split(".").map(Number),n=t.split(".").map(Number);for(let i=0;i<Math.max(o.length,n.length);i++){let s=o[i]??0,a=n[i]??0;if(s>a)return!0;if(s<a)return!1}return!1}async function ls(){try{let e=await ge("https://raw.githubusercontent.com/imjustprism/Void/main/package.json");if(!e.ok)return;let{version:t}=await e.json();if(!t||!Fa(t,"0.2.2")){$n.info("Up to date (0.2.2)");return}$n.info(`Update available: ${"0.2.2"} → ${t}`),Oo({message:"Void is outdated, please update to the latest version to avoid potential bugs.",type:"warn"})}catch(e){$n.warn("Failed to check for updates",e)}}P("settings",`.void-settings-version,
.void-settings-version * {
user-select: text;
font-size: 0.625rem !important;
line-height: 1rem !important;
}
.void-settings-version-link {
text-decoration: none;
color: inherit;
}
.void-settings-version-link:hover {
text-decoration: underline;
}
`);var cs=new M("Themes","#c6a0f6");function us(){return b.plugins.Settings??{}}function Fe(e){let t=0;for(let o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return`void-theme-${(t>>>0).toString(36)}`}function Na(e){let t={name:"",author:"",description:""},o=e.match(/\/\*\*[\s\S]*?\*\//);if(!o)return t;let n=o[0].match(/@name\s+(.+)/),i=o[0].match(/@author\s+(.+)/),s=o[0].match(/@description\s+(.+)/);if(n)t.name=n[1].trim();if(i)t.author=i[1].trim();if(s)t.description=s[1].trim();return t}function le(){let e=us();return Array.isArray(e.themes)?e.themes:[]}function Ao(){return us().themesEnabled!==!1}function $o(e){let t=b.plugins.Settings;b.plugins.Settings={...t,themes:e}}function ds(e){let t=b.plugins.Settings;b.plugins.Settings={...t,themesEnabled:e};for(let o of le())if(o.enabled)if(e)Ae(Fe(o.url));else ie(Fe(o.url))}function Ba(e){try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")throw 0}catch{throw Error("Enter a valid URL.")}if(!/\.css$/i.test(e))throw Error("URL must point to a .css file.")}async function ps(e){Ba(e);let t=le();if(t.some((a)=>a.url===e))throw Error("This theme is already added.");let o=await ge(e);if(!o.ok)throw Error(`Failed to fetch theme (${o.status}).`);let n=await o.text();if(!n.trim())throw Error("Theme file is empty.");let i=Na(n),s={url:e,name:i.name||Va(e),author:i.author,description:i.description,enabled:!1};return P(Fe(e),n),ie(Fe(e)),$o([...t,s]),cs.info(`Added theme "${s.name}" from ${e}`),s}function fs(e){ie(Fe(e)),$o(le().filter((t)=>t.url!==e))}async function ms(e){if($o(le().map((i)=>i.url===e?{...i,enabled:!0}:i)),!Ao())return;let t=Fe(e);if(Ae(t))return;let o=await ge(e);if(!o.ok)return;let n=await o.text();P(t,n)}function gs(e){$o(le().map((t)=>t.url===e?{...t,enabled:!1}:t)),ie(Fe(e))}async function ys(){if(!Ao())return;let e=le().filter((o)=>o.enabled),t=await Promise.allSettled(e.map(async(o)=>{let n=await ge(o.url);if(!n.ok)throw Error(`HTTP ${n.status}`);let i=await n.text();P(Fe(o.url),i)}));for(let o=0;o<t.length;o++)if(t[o].status==="rejected")cs.warn(`Failed to load theme "${e[o].name}":`,t[o].reason)}function Va(e){return(e.split("/").pop()??e).replace(/\.css$/i,"").replace(/[-_]/g," ")}P("CustomCSSTab",`.void-css-block {
display: flex;
flex-direction: column;
min-height: 400px;
margin: 0 0.75rem;
border: 1px solid var(--border-l1);
border-radius: 0.75rem;
overflow: hidden;
}
.void-css-header {
display: flex;
align-items: center;
height: 2.5rem;
padding: 0 1rem;
background: hsl(var(--surface-base));
border-radius: 0.75rem 0.75rem 0 0;
}
.void-css-header span {
font-family: var(--font-ibm-plex-mono), monospace;
font-size: 0.75rem;
color: hsl(var(--fg-secondary));
user-select: none;
}
.void-css-editor {
flex: 1;
background: hsl(var(--surface-inset));
border-radius: 0 0 0.75rem 0.75rem;
}
.void-css-editor .monaco-editor,
.void-css-editor .monaco-editor .overflow-guard {
border-radius: 0 0 0.75rem 0.75rem;
}
.void-css-editor .monaco-editor .focused .selected-text,
.void-css-editor .monaco-editor.focused {
outline: none !important;
border: none !important;
}
.void-css-editor .monaco-editor,
.void-css-editor .monaco-editor .inputarea {
outline: none !important;
box-shadow: none !important;
}
.void-css-editor .monaco-editor .cursors-layer > .cursor {
visibility: hidden !important;
}
.void-css-editor .monaco-editor.focused .cursors-layer > .cursor {
visibility: inherit !important;
}
.void-css-editor .monaco-editor .current-line-margin-both {
border: none !important;
}
`);var Rn=I("void-css-"),hs="void-custom-css",Gn=d("initMonaco"),Oa=rn((e)=>e.darkTheme?.base==="vs-dark");function Ro(){return b.plugins.Settings??{}}function _n(e){P(hs,e)}function Aa(){ie(hs)}function $a(e){let t=b.plugins.Settings;if(b.plugins.Settings={...t,customCSSEnabled:e},e){let o=typeof Ro().customCSS==="string"?Ro().customCSS:"";if(o)_n(o)}else Aa()}function Wt(){let e=Ro(),t=e.customCSS;if(typeof t==="string"&&t&&e.customCSSEnabled!==!1)return _n(t),t;return typeof t==="string"?t:""}function Ra(e){let t=b.plugins.Settings,o=t?.customCSSEnabled!==!1;if(b.plugins.Settings={...t,customCSS:e},o)_n(e)}function zn(){let e=ue(null),t=ue(null),[o,n]=x(()=>Ro().customCSSEnabled!==!1),i=(s)=>{n(s),$a(s)};return O(()=>{if(!e.current)return;let s=!1,a=null;return(async()=>{if(!Gn.monacoInstance)await Gn.initMonaco();if(s)return;let l=Gn.monacoInstance;l.editor.defineTheme("grok-dark",Oa.darkTheme),a=l.editor.create(e.current,{value:Wt(),language:"css",theme:"grok-dark",minimap:{enabled:!1},scrollbar:{vertical:"hidden",horizontal:"hidden"},overviewRulerLanes:0,hideCursorInOverviewRuler:!0,overviewRulerBorder:!1,folding:!1,glyphMargin:!1,fontSize:13,lineNumbers:"off",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:4,wordWrap:"on",padding:{top:8},renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,lineDecorationsWidth:0,readOnly:!o}),t.current=a,a.onDidChangeModelContent(()=>Ra(a.getValue()))})(),()=>{s=!0,a?.dispose(),t.current=null}},[]),O(()=>{t.current?.updateOptions({readOnly:!o})},[o]),r.createElement(p,{flexDirection:"column",gap:"1rem"},r.createElement(p,{alignItems:"center",justifyContent:"space-between",style:{padding:"0 0.75rem"}},r.createElement(p,{flexDirection:"column",gap:"0"},r.createElement(m,{size:"sm",weight:"medium"},"Quick CSS"),r.createElement(m,{size:"xs",color:"secondary"},"Custom CSS applied live as you type.")),r.createElement(K,{checked:o,onCheckedChange:i})),r.createElement("div",{className:Rn("block")},r.createElement("div",{className:Rn("header")},r.createElement(m,{as:"span"},"CSS")),r.createElement("div",{ref:e,className:Rn("editor")})))}P("PluginsTab",`.void-plugins-reload-banner {
padding: 0.625rem 0.75rem;
border-radius: var(--radius);
background: hsl(var(--yellow-800) / 60%);
border: 1px solid hsl(var(--yellow-700));
color: hsl(var(--fg-warning));
}
`);P("PluginCard",`.void-plugin-card-root {
padding: 0;
display: flex;
flex-direction: column;
border-radius: 0.375rem;
border: 1px solid var(--border-l1);
background: var(--card);
min-height: 120px;
}
.void-plugin-card-body {
padding: 0.625rem 0.75rem;
flex: 1;
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.void-plugin-card-name {
font-size: 0.875rem;
font-weight: 400;
display: flex;
align-items: center;
gap: 0.375rem;
min-width: 0;
}
.void-plugin-card-required-icon,
.void-plugin-card-badge {
display: inline-flex;
align-items: center;
justify-content: center;
color: hsl(var(--fg-tertiary));
flex-shrink: 0;
line-height: 0;
}
.void-plugin-card-desc {
font-size: 0.75rem;
color: hsl(var(--fg-secondary));
line-height: 1.5;
margin-top: 0.5rem;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.void-plugin-card-controls {
flex-shrink: 0;
}
.void-plugin-card-separator {
height: 1px;
background: var(--border-l1);
}
.void-plugin-card-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.375rem 0.75rem;
gap: 0.75rem;
}
.void-plugin-card-authors {
font-size: 0.7rem;
color: hsl(var(--fg-tertiary));
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.void-plugin-card-required {
opacity: 0.4;
}
.void-plugin-card-crashed {
opacity: 0.5;
border-color: hsl(var(--red-700));
}
.void-plugin-card-crashed-icon {
display: inline-flex;
align-items: center;
justify-content: center;
color: hsl(var(--fg-danger));
flex-shrink: 0;
line-height: 0;
}
.void-plugin-card-crashed-icon svg {
width: 1em;
height: 1em;
}
`);var Ga=[{key:"dev",icon:$i,tooltip:"Dev Only"},{key:"chrome",icon:Cn,tooltip:"Chromium Only"},{key:"preview",icon:Vi,tooltip:"Preview plugin, may be removed once Grok ships this."}];function Ss({plugin:e,className:t}){return Ga.map((o)=>e[o.key]?r.createElement(Ge,{key:o.key},r.createElement(_e,{asChild:!0},r.createElement("span",{className:t},r.createElement(o.icon,null))),r.createElement(ze,null,o.tooltip)):null)}function xs(e){if("default"in e)return e.default;if("options"in e&&e.type===4)return e.options.find((t)=>t.default)?.value}function Un([,e]){return e.type!==7&&!(("hidden"in e)&&e.hidden)}function bs(e){return!!e.settings?.def&&Object.entries(e.settings.def).some(Un)}var J=I("void-plugin-card-");function Go({name:e,onSettings:t,onReload:o}){let n=v[e],i=We(),s=N(e),a=s&&!n.started&&!n.required,l=!!n.patches?.length,c=()=>{if(b.plugins[e]={...b.plugins[e],enabled:!s},!s)Te(n,!0);else No(n);if(i(),vo("pluginToggle"),l)o(e)};return r.createElement("div",{className:Z(J("root"),n.required&&J("required"),a&&J("crashed"))},r.createElement("div",{className:J("body")},r.createElement(p,{alignItems:"center",justifyContent:"space-between",gap:"0.5rem"},r.createElement(m,{as:"span",className:J("name")},e,a&&r.createElement(Ge,null,r.createElement(_e,{asChild:!0},r.createElement(m,{as:"span",className:J("crashed-icon")},r.createElement(Ri,null))),r.createElement(ze,null,"This plugin failed to start")),n.required&&r.createElement(Ge,null,r.createElement(_e,{asChild:!0},r.createElement(m,{as:"span",className:J("required-icon")},r.createElement(Pn,null))),r.createElement(ze,null,"This plugin is required for Void to work")),r.createElement(Ss,{plugin:n,className:J("badge")})),r.createElement(p,{alignItems:"center",gap:"0.375rem",className:J("controls")},bs(n)&&r.createElement(E,{variant:"tertiary",size:"xs",shape:"square",onClick:()=>t(e)},r.createElement(Ai,{size:16})),r.createElement(K,{checked:s,disabled:n.required,onCheckedChange:c}))),n.description&&r.createElement("div",{className:J("desc")},n.description)),r.createElement("div",{className:J("separator")}),r.createElement("div",{className:J("footer")},r.createElement("div",{className:J("authors")},n.authors?.length?n.authors.join(", "):" ")))}P("PluginDialog",`.void-plugin-dialog-content {
width: 600px;
min-height: 420px;
padding: 1.5rem;
border-radius: 1rem;
border: 1px solid var(--border-l1);
background: var(--background);
display: flex;
flex-direction: column;
gap: 1rem;
}
/* SettingsRow has px-3 built in, strip it so fields align with the title */
.void-plugin-dialog-content .px-3 {
padding-left: 0;
padding-right: 0;
}
.void-plugin-dialog-close {
position: absolute;
right: 1rem;
top: 1rem;
z-index: 10;
}
.void-plugin-dialog-header {
text-align: left;
}
`);function xt(e,t,o){let[n,i]=x((b.plugins[e]??{})[t]??xs(o)),s=X((a)=>{i(a),b.plugins[e]={...b.plugins[e],[t]:a},o.onChange?.(a)},[t,e,o]);return[n,s]}function jt({id:e,setting:t}){return r.createElement(p,{flexDirection:"column",gap:"0"},r.createElement(ct,null,vt(e)),"description"in t&&t.description&&r.createElement(ut,null,t.description))}function _a({id:e,setting:t,pluginName:o}){let[n,i]=xt(o,e,t);return r.createElement(lt,{action:r.createElement(K,{checked:!!n,onCheckedChange:i})},r.createElement(jt,{id:e,setting:t}))}function za({id:e,setting:t,pluginName:o}){let[n,i]=xt(o,e,t);if(!("options"in t))return null;return r.createElement(p,{flexDirection:"column",gap:"0.5rem"},r.createElement(jt,{id:e,setting:t}),r.createElement(de,{value:String(n??""),onValueChange:i},r.createElement(pe,null,r.createElement(me,null)),r.createElement(fe,null,t.options.map((s)=>r.createElement(F,{key:String(s.value),value:String(s.value)},s.label)))))}function Ua({id:e,setting:t,pluginName:o}){let[n,i]=xt(o,e,t);if(!("min"in t))return null;let{min:s,max:a}=t;return r.createElement(p,{flexDirection:"column",gap:"0.5rem"},r.createElement(jt,{id:e,setting:t}),r.createElement(p,{gap:"8px",className:"items-center"},r.createElement(So,{value:[n??s],min:s,max:a,step:1,onValueChange:([l])=>i(l),className:"w-32"}),r.createElement(m,{size:"sm",color:"secondary",className:"tabular-nums w-6 text-right"},n)))}function Ha({setting:e,pluginName:t}){let[,o]=xt(t,"component",e);if(!("component"in e))return null;let n=e.component;return r.createElement(n,{setValue:o,option:e})}function Cs({id:e,setting:t,pluginName:o}){let[n,i]=xt(o,e,t);return r.createElement(p,{flexDirection:"column",gap:"0.5rem"},r.createElement(jt,{id:e,setting:t}),r.createElement(Q,{type:"number",value:n??"",onChange:(s)=>{let a=Number(s.target.value);if(!isNaN(a))i(a)},className:"w-24"}))}function Wa({id:e,setting:t,pluginName:o}){let[n,i]=xt(o,e,t);return r.createElement(p,{flexDirection:"column",gap:"0.5rem"},r.createElement(jt,{id:e,setting:t}),r.createElement(Q,{type:"text",value:n??"",onChange:(s)=>i(s.target.value),placeholder:"placeholder"in t?t.placeholder:void 0,className:"w-full"}))}var ja={3:_a,4:za,5:Ua,6:Ha,1:Cs,2:Cs,0:Wa,7:null};function Hn({id:e,setting:t,pluginName:o}){let n=ja[t.type];if(!n)return null;return r.createElement(n,{id:e,setting:t,pluginName:o})}var Wn=I("void-plugin-dialog-");function jn({plugin:e,open:t,onClose:o}){let n=Object.entries(e.settings?.def??{}).filter(Un);return r.createElement(ve,{open:t,onOpenChange:(i)=>{if(!i)o()}},r.createElement(Le,{className:Wn("content"),"aria-describedby":void 0},r.createElement(yo,{asChild:!0},r.createElement(E,{variant:"tertiary",size:"sm",shape:"square",className:Wn("close")},r.createElement(Oi,null))),r.createElement(we,{className:Wn("header")},r.createElement(Ie,null,e.name),e.description&&r.createElement(m,{size:"xs",color:"secondary"},e.description)),r.createElement(ke,null),e.authors?.length&&r.createElement(p,{flexDirection:"column",gap:"0.25rem"},r.createElement(m,{size:"sm",weight:"medium"},"Authors"),r.createElement(m,{size:"xs",color:"secondary"},e.authors.join(", "))),r.createElement(p,{flexDirection:"column",gap:"0.25rem"},r.createElement(m,{size:"sm",weight:"medium"},"Settings"),n.length?r.createElement(p,{flexDirection:"column",gap:"0.75rem",className:"mt-2"},n.map(([i,s])=>r.createElement(Hn,{key:i,id:i,setting:s,pluginName:e.name}))):r.createElement(m,{size:"xs",color:"secondary"},"No configurable settings."))))}var Xa=I("void-plugins-"),bt=null,_o=new Set,Xn=!1,Ps=(e)=>`${e} ${v[e].description??""}`;function qn(){let[e,t]=x(""),[o,n]=x("all"),[i,s]=x(null),[a,l]=x(!1),{userPlugins:c,requiredPlugins:u}=Y(()=>{let y=[],k=[];for(let ce of Object.keys(v).sort((D,Tt)=>D.localeCompare(Tt))){if(v[ce].hidden)continue;if(v[ce].required)k.push(ce);else y.push(ce)}return{userPlugins:y,requiredPlugins:k}},[]);O(()=>{if(bt)return;bt=new Map;for(let y of c)bt.set(y,N(y));for(let y of u)bt.set(y,N(y))},[c,u]);let f=Y(()=>{if(o==="all")return c;let y=o==="enabled";return c.filter((k)=>N(k)===y)},[o,c]),w=Y(()=>{if(o==="all")return u;let y=o==="enabled";return u.filter((k)=>N(k)===y)},[o,u]),g=je(f,e,Ps),S=je(w,e,Ps),A=i?v[i]:null,B=g.length||S.length,$=_o.size>0,z=X((y)=>{if(!bt)return;if(N(y)===bt.get(y))_o.delete(y);else _o.add(y);if(_o.size){if(!Xn)l(!0)}else l(!1),Xn=!1},[]),R=X(()=>{Xn=!0,l(!1)},[]);return r.createElement(p,{flexDirection:"column",gap:"1.5rem"},r.createElement(p,{flexDirection:"column",gap:"0",style:{padding:"0 0.75rem"}},r.createElement(m,{size:"sm",weight:"medium"},"Plugins"),r.createElement(m,{size:"xs",color:"secondary"},"Pick which plugins to use. Some need a page reload to kick in.")),$&&!a&&r.createElement(p,{alignItems:"center",className:Z(Xa("reload-banner"),"mx-3")},r.createElement(m,{size:"xs",className:"text-inherit flex-1"},"Reload the page to apply plugin changes."),r.createElement(E,{variant:"secondary",size:"sm",onClick:()=>location.reload()},"Reload")),r.createElement(p,{alignItems:"center",gap:"0.75rem",style:{padding:"0 0.75rem"}},r.createElement(Q,{type:"text",placeholder:`Search ${f.length+w.length} plugins...`,value:e,onChange:(y)=>t(y.target.value),className:"flex-1 min-w-0"}),r.createElement(de,{value:o,onValueChange:(y)=>n(y)},r.createElement(pe,{className:"w-28"},r.createElement(me,null)),r.createElement(fe,null,r.createElement(F,{value:"all"},"All"),r.createElement(F,{value:"enabled"},"Enabled"),r.createElement(F,{value:"disabled"},"Disabled")))),g.length>0&&r.createElement(dt,{columns:"repeat(2, 1fr)",style:{padding:"0 0.75rem"}},g.map((y)=>r.createElement(Go,{key:y,name:y,onSettings:s,onReload:z}))),S.length>0&&r.createElement(r.Fragment,null,r.createElement(ke,{className:"mx-3 w-auto"}),r.createElement(dt,{columns:"repeat(2, 1fr)",style:{padding:"0 0.75rem"}},S.map((y)=>r.createElement(Go,{key:y,name:y,onSettings:s,onReload:z})))),!B&&r.createElement(Ee,{color:"secondary",className:"text-center py-8"},e?"No plugins match your search.":"No plugins available."),A&&r.createElement(jn,{plugin:A,open:!0,onClose:()=>s(null)}),r.createElement(_t,{open:a,onOpenChange:(y)=>{if(!y)R()},title:"Reload required",description:"This plugin patches Grok's code, so you need to reload the page.",confirmText:"Reload",cancelText:"Later",onConfirm:()=>location.reload()}))}P("ThemesTab",`.void-themes-add-error {
font-size: 0.75rem;
color: hsl(var(--fg-danger));
}
`);P("ThemeCard",`.void-theme-card-root {
padding: 0;
display: flex;
flex-direction: column;
border-radius: 0.375rem;
border: 1px solid var(--border-l1);
background: var(--card);
}
.void-theme-card-body {
padding: 0.625rem 0.75rem;
flex: 1;
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.void-theme-card-name {
font-size: 0.875rem;
font-weight: 400;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.void-theme-card-controls {
flex-shrink: 0;
}
.void-theme-card-desc {
font-size: 0.75rem;
color: hsl(var(--fg-secondary));
line-height: 1.5;
margin-top: 0.25rem;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.void-theme-card-separator {
height: 1px;
background: var(--border-l1);
}
.void-theme-card-footer {
display: flex;
align-items: center;
padding: 0.375rem 0.75rem;
}
.void-theme-card-author {
font-size: 0.7rem;
color: hsl(var(--fg-tertiary));
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
`);var Ne=I("void-theme-card-");function Yn({theme:e,globalEnabled:t,onRemove:o,onToggle:n}){let i=()=>{if(e.enabled)gs(e.url);else ms(e.url);n()};return r.createElement("div",{className:Ne("root")},r.createElement("div",{className:Ne("body")},r.createElement(p,{alignItems:"center",justifyContent:"space-between",gap:"0.5rem"},r.createElement(m,{as:"span",className:Ne("name")},e.name??e.url),r.createElement(p,{alignItems:"center",gap:"0.375rem",className:Ne("controls")},r.createElement($e,{variant:"tertiary",size:"xs",shape:"square",tooltipContent:"Copy URL",onClick:()=>Co(e.url)},r.createElement(Ni,{size:16})),r.createElement($e,{variant:"tertiary",size:"xs",shape:"square",tooltipContent:"Remove",onClick:()=>o(e.url)},r.createElement(Bi,{size:16})),r.createElement(K,{checked:e.enabled,disabled:!t,onCheckedChange:i}))),e.description&&r.createElement("div",{className:Ne("desc")},e.description)),r.createElement("div",{className:Ne("separator")}),r.createElement("div",{className:Ne("footer")},r.createElement("div",{className:Ne("author")},e.author??" ")))}var qa=I("void-themes-"),Ya=(e)=>`${e.name} ${e.description} ${e.author}`;function Kn(){let[e,t]=x(""),[o,n]=x("all"),[i,s]=x(""),[a,l]=x(""),[c,u]=x(!1),[f,w]=x(Ao),[g,S]=x(le),A=Y(()=>{if(o==="all")return g;let D=o==="enabled";return g.filter((Tt)=>Tt.enabled===D)},[g,o]),B=je(A,e,Ya),$=(D)=>{w(D),ds(D)},z=async()=>{let D=i.trim();if(!D)return;l(""),u(!0);try{await ps(D),s(""),S(le())}catch(Tt){l(To(Tt))}finally{u(!1)}},[R,y]=x(null),k=R?g.find((D)=>D.url===R):null,ce=()=>{if(!R)return;fs(R),y(null),S(le())};return r.createElement(p,{flexDirection:"column",gap:"2rem"},r.createElement(p,{alignItems:"center",justifyContent:"space-between",style:{padding:"0 0.75rem"}},r.createElement(p,{flexDirection:"column",gap:"0"},r.createElement(m,{size:"sm",weight:"medium"},"Themes"),r.createElement(m,{size:"xs",color:"secondary"},"Custom CSS themes for Grok. Paste a URL to a .css file to add one.")),r.createElement(K,{checked:f,onCheckedChange:$})),r.createElement(p,{flexDirection:"column",gap:"0.5rem",style:{padding:"0 0.75rem"}},r.createElement(p,{alignItems:"center",gap:"0.5rem"},r.createElement(Q,{type:"text",placeholder:"https://raw.githubusercontent.com/...",value:i,onChange:(D)=>{s(D.target.value),l("")},onKeyDown:(D)=>{if(D.key==="Enter")z()},className:"flex-1 min-w-0"}),r.createElement(E,{variant:"primary",size:"sm",className:"h-9",onClick:z,disabled:c||!i.trim()},c?"Importing...":"Import")),a&&r.createElement(m,{size:"xs",className:qa("add-error")},a)),g.length>0&&r.createElement(p,{flexDirection:"column",gap:"0.375rem",style:{padding:"0 0.75rem"}},r.createElement(p,{flexDirection:"column",gap:"0"},r.createElement(m,{size:"sm",weight:"medium"},"Installed Themes"),r.createElement(m,{size:"xs",color:"secondary"},"Re-fetched every page load. Use the switch above to disable all themes at once.")),r.createElement(m,{size:"xs",color:"secondary"},`${Lt(g.length,"theme")} installed · ${g.filter((D)=>D.enabled).length} enabled`)),g.length>0&&r.createElement(p,{alignItems:"center",gap:"0.75rem",style:{padding:"0 0.75rem"}},r.createElement(Q,{type:"text",placeholder:`Search ${g.length} themes...`,value:e,onChange:(D)=>t(D.target.value),className:"flex-1 min-w-0"}),r.createElement(de,{value:o,onValueChange:(D)=>n(D)},r.createElement(pe,{className:"w-28"},r.createElement(me,null)),r.createElement(fe,null,r.createElement(F,{value:"all"},"All"),r.createElement(F,{value:"enabled"},"Enabled"),r.createElement(F,{value:"disabled"},"Disabled")))),B.length>0&&r.createElement(dt,{columns:"repeat(2, 1fr)",style:{padding:"0 0.75rem"}},B.map((D)=>r.createElement(Yn,{key:D.url,theme:D,globalEnabled:f,onRemove:y,onToggle:()=>S(le())}))),g.length>0&&!B.length&&r.createElement(Ee,{color:"secondary",className:"text-center py-8"},"No themes match your search."),!g.length&&r.createElement(Ee,{color:"secondary",className:"text-center py-8"},"No themes added yet. Paste a URL above to add one."),r.createElement(_t,{open:R!=null,onOpenChange:(D)=>{if(!D)y(null)},title:"Remove theme",description:`Are you sure you want to remove "${k?.name??"this theme"}"?`,confirmText:"Remove",cancelText:"Cancel",danger:!0,onConfirm:ce}))}var Ts=_.wrap(zn),Ms=_.wrap(qn),Ds=_.wrap(Kn);P("experiments",`.void-experiments-section {
padding: 0 0.75rem;
}
.void-experiments-modified {
margin-left: 6px;
color: hsl(var(--fg-warning));
}
.void-experiments-new-chip {
margin-left: 6px;
vertical-align: middle;
}
.void-experiments-warning {
margin: 0 0.75rem;
padding: 0.625rem 0.75rem;
border-radius: var(--radius);
background: hsl(var(--yellow-800) / 60%);
border-color: hsl(var(--yellow-700));
color: hsl(var(--fg-warning));
}
.void-experiments-warning-text {
color: inherit;
line-height: 1.5;
}
.void-experiments-clear-btn {
flex-shrink: 0;
border-color: hsl(var(--yellow-700));
color: hsl(var(--fg-warning));
}
.void-experiments-empty {
text-align: center;
padding: 2rem;
}
`);var zo;((a)=>{a[a.MESSAGE=0]="MESSAGE";a[a.SUCCESS=1]="SUCCESS";a[a.ERROR=2]="ERROR";a[a.INFO=3]="INFO";a[a.WARNING=4]="WARNING";a[a.LOADING=5]="LOADING"})(zo||={});var Ka=["message","success","error","info","warning","loading"];function Uo(e,t=0,o){let n=Ka[t];hn.toast[n](e,o)}var T=Object.freeze({Prism:"Prism",adryd:"adryd"});var Me=I("void-experiments-"),Za=86400000,Xt=te({notifyNewFlags:{type:3,description:"Show a notification when new experiment flags are added.",default:!0}}).withPrivateSettings();function ws(e){return Object.keys(e).filter((t)=>typeof e[t]==="boolean")}function vs(e){let t=ws(e);if(!t.length)return;let o=Xt.plain.knownFlags,n=o==null,i=o??{},s=Date.now(),a=n;if(!n){let u=Object.values(i);if(u.length>1&&u.every((f)=>f===u[0]&&f!==0)){for(let f of Object.keys(i))i[f]=0;a=!0}}let l=[];for(let u of t)if(!(u in i)){if(i[u]=n?0:s,!n)l.push(u);a=!0}let c=new Set(t);for(let u of Object.keys(i))if(!c.has(u))delete i[u],a=!0;if(a)Xt.store.knownFlags={...i};if(l.length&&Xt.store.notifyNewFlags)Uo(`${Lt(l.length,"new experiment flag")} added`,3)}function Ls(e){let t=Xt.plain.knownFlags?.[e];if(t==null)return!1;return Date.now()-t<Za}var Ja={Mcp:"MCP",Ui:"UI",Api:"API",Url:"URL",Gcal:"GCal",Mie:"MIE",Xlsx:"XLSX",Nux:"NUX",Xai:"xAI",Grok:"Grok",Id:"ID"},Is=(e)=>vt(e,Ja);function Qa({flagKey:e,isNew:t}){let o=j.useFeatureStore((l)=>l.config[e]),n=j.useFeatureStore((l)=>l.overrides[e]),i=n!==void 0,s=i?!!n:!!o,a=X((l)=>{let{setOverride:c,clearOverride:u,config:f}=j.useFeatureStore.getState();if(l===!!f[e])u(e);else c(e,l)},[e]);return r.createElement(lt,{action:r.createElement(K,{checked:s,onCheckedChange:a})},r.createElement(ct,null,Is(e),t&&r.createElement(xn,{className:Me("new-chip")},"NEW"),i&&r.createElement(m,{size:"xs",as:"span",className:Me("modified")},"(modified)")),r.createElement(ut,null,e))}function el(){let[e,t]=x(""),[o,n]=x("all"),i=j.useFeatureStore((g)=>g.config),s=j.useFeatureStore((g)=>g.overrides),a=Y(()=>ws(i).sort(),[i]),l=X((g)=>`${g} ${Is(g)}`,[]),c=X((g)=>{if(o==="all")return!0;let S=s[g],A=S!==void 0?!!S:!!i[g];if(o==="enabled")return A;if(o==="disabled")return!A;if(o==="new")return Ls(g);if(o==="modified")return S!==void 0},[o,i,s]),u=Y(()=>a.filter(c),[a,c]),f=je(u,e,l),w=Object.keys(s).length;return r.createElement(p,{flexDirection:"column",gap:"1rem",className:Me("root")},r.createElement(p,{flexDirection:"column",gap:"0",className:Me("section")},r.createElement(m,{size:"sm",weight:"medium"},"Experiments"),r.createElement(m,{size:"xs",color:"secondary"},"Toggle unreleased Grok features. These are experimental and may break things.")),r.createElement(go,{variant:"ghost",className:Me("warning")},r.createElement(p,{alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},r.createElement(m,{size:"xs",className:Me("warning-text")},"Only enable flags you understand. Changing the wrong setting can break Grok or cause unexpected behavior."),w>0&&r.createElement(E,{variant:"secondary",size:"sm",className:Me("clear-btn"),onClick:()=>j.useFeatureStore.getState().clearAllOverrides()},"Clear ",Lt(w,"override")))),r.createElement(p,{alignItems:"center",gap:"0.5rem",className:Me("section")},r.createElement(Q,{placeholder:`Search ${u.length} flags...`,value:e,onChange:(g)=>t(g.target.value),className:"flex-1"}),r.createElement(de,{value:o,onValueChange:(g)=>n(g)},r.createElement(pe,{className:"w-28"},r.createElement(me,null)),r.createElement(fe,null,r.createElement(F,{value:"all"},"All"),r.createElement(F,{value:"enabled"},"Enabled"),r.createElement(F,{value:"disabled"},"Disabled"),r.createElement(F,{value:"new"},"New"),r.createElement(F,{value:"modified"},"Modified")))),f.map((g)=>r.createElement(_,{key:g,fallback:null},r.createElement(Qa,{flagKey:g,isNew:Ls(g)}))),!f.length&&r.createElement(Ee,{color:"muted",className:Me("empty")},e?`No flags matching "${e}"`:`No ${o} flags`))}var ks=_.wrap(el),Zn=h({name:"Experiments",description:"Unlock and toggle unreleased Grok features.",authors:[T.Prism],settings:Xt,startAt:"TurbopackReady",start(){let e=j.useFeatureStore.getState();if(e.status==="ready")vs(e.config)},zustand:{FeatureStore:{selector:(e)=>e.status==="ready"?e.config:null,handler(e){if(e)vs(e)}}},patches:[{find:'ENABLE_SCREEN_SHARING:"enable_screen_sharing"',all:!0,replacement:{match:/\i&&(void 0!==\i\[\i\])/,replace:"$1"}},{find:"Feature flag overrides active",replacement:{match:/\i\.toast\.warning\(\i\("Feature flag overrides active","Feature flag overrides active"\)\)/,replace:"void 0"}}]});var Fs=I("void-settings-"),Jn=te({hideUserId:{type:3,description:"Hide your user ID from the account settings page.",default:!0},fixDialogFlash:{type:3,description:"Fix the white border flash when clicking inside dialogs.",default:!0}}),tl=[{id:"void_plugins_tab",name:"Plugins",icon:Dn,component:Ms},{id:"void_themes_tab",name:"Themes",icon:Tn,component:Ds},{id:"void_css_tab",name:"Quick CSS",icon:bn,component:Ts},{id:"void_experiments_tab",name:"Experiments",icon:Mn,component:ks,plugin:"Experiments"}];function Ns(){return tl.filter((e)=>!e.plugin||N(e.plugin))}function Qn(){return r.createElement(m,{as:"span",color:"secondary"},"•")}function Es({href:e,children:t}){return r.createElement("a",{href:e,target:"_blank",rel:"noreferrer",className:Z(Fs("version-link"),"pointer-events-auto")},r.createElement(m,{as:"span",color:"secondary"},t))}function ol(){return r.createElement(p,{flexDirection:"column",gap:"0",className:Z(Fs("version"),"absolute bottom-0 left-0 right-0 p-3 opacity-30 text-secondary pointer-events-none")},r.createElement(p,{alignItems:"center",gap:"0.25rem"},r.createElement(Es,{href:"https://github.com/imjustprism/Void"},"Void"),r.createElement(Qn,null),r.createElement(m,{as:"span",color:"secondary"},"v0.2.2"),r.createElement(Qn,null),r.createElement(Es,{href:"https://github.com/imjustprism/Void/commit/6791a31"},"(6791a31)")),r.createElement(p,{alignItems:"center",gap:"0.25rem"},r.createElement(m,{as:"span",color:"secondary"},"Production"),r.createElement(Qn,null),r.createElement(m,{as:"span",color:"secondary"},"Userscript")))}function nl({jsx:e,TabButton:t}){let o=We();return In("pluginToggle",o),r.createElement(rt,null,Ns().map((n)=>e(t,{key:n.id,icon:n.icon,text:n.name,tab:n.id})))}function rl({jsx:e,activeTab:t,Wrapper:o}){let n=We();In("pluginToggle",n);let i=Ns().find((s)=>s.id===t);if(!i)return null;return e(o,{key:i.id,children:e(i.component,{})})}var er=h({name:"Settings",description:"Adds Void settings UI.",authors:["Prism"],required:!0,settings:Jn,_hideUserId(){return Jn.store.hideUserId},_fixDialogFlash(){return Jn.store.fixDialogFlash},renderTabs(e,t){return[r.createElement(nl,{key:"void-tabs",jsx:e,TabButton:t}),r.createElement(ol,{key:"void-version"})]},renderPanels(e,t,o){return[r.createElement(rl,{key:"void-panels",jsx:e,activeTab:t,Wrapper:o})]},start(){if(P("void-global","[data-sonner-toast] [data-title]{font-weight:400}"),document.head)Wt();else document.addEventListener("DOMContentLoaded",Wt,{once:!0});ys()},patches:[{find:'DialogOverlay",()=>',all:!0,replacement:{match:/dark:border-border-l1 duration-200/,replace:'dark:border-border-l1 "+($self._fixDialogFlash()?"outline-none ":"")+"duration-200'}},{find:"pressed_cmd_settings",replacement:[{match:/(\i\.jsx)\)\((\i),\{icon:\i\.DatabaseIcon,.{0,80}tab:"data"\}\)/,replace:"$&,...$self.renderTabs($1,$2)"},{match:/"data"===(\i)&&\i\.user&&\(0,(\i\.jsx)\)\((\i),\{children:/,replace:"...$self.renderPanels($2,$1,$3),$&"},{match:/\i\.user&&\(0,\i\.jsx\)\("div",.{0,120}:\i\.userId\}\)/,replace:"!$self._hideUserId()&&$&"}]}]});var il=0,Ye=[],qt=mt();function tr(e,t){let o=t?.modalKey??`void-modal-${il++}`;return Ye.push({key:o,render:e}),qt.notify(),o}function or(e){let t=Ye.findIndex((o)=>o.key===e);if(t!==-1)Ye.splice(t,1),qt.notify()}function Bs(){Ye.length=0,qt.notify()}function Vs(e){return new Promise((t)=>{let o=tr(({onClose:i})=>{let s=(a)=>{t(a),i()};return r.createElement(we,null,r.createElement(Ie,null,e.title),r.createElement(it,null,e.body),r.createElement(st,null,r.createElement(E,{variant:"secondary",size:"md",onClick:()=>s(!1)},e.cancelText??"Cancel"),r.createElement(E,{variant:e.danger?"danger":"primary",size:"md",onClick:()=>s(!0)},e.confirmText??"Confirm")))}),n=qt.subscribe(()=>{if(!Ye.some((i)=>i.key===o))n(),t(!1)})})}function sl({entry:e}){let t=X(()=>or(e.key),[e.key]);return r.createElement(ve,{open:!0,onOpenChange:(o)=>{if(!o)t()}},r.createElement(Le,{"aria-describedby":void 0},e.render({onClose:t})))}function Os(){if(ht(qt),!Ye.length)return null;return r.createElement(r.Fragment,null,Ye.map((e)=>r.createElement(sl,{key:e.key,entry:e})))}var nr=h({name:"ChatBarButtonAPI",description:"Adds buttons to the chat input bar.",authors:["Prism"],required:!0,hidden:!0,renderButtons(e){return ae(rt,null,ae(ji,{iconOnly:e}),ae(Os,null))},patches:[{find:"ImagineSelector,{iconOnlyTrigger",all:!0,replacement:[{match:/ModelModeSelect,\{iconOnlyTrigger:(\i)\}\)\}\),/,replace:"$&$self.renderButtons($1),"},{match:/paddingInlineEnd:\i\?void 0:(\i)\?/,replace:"paddingInlineEnd:$1?"}]}]});var rr=h({name:"ContextMenuAPI",description:"Adds items to context menus.",authors:["Prism"],required:!0,hidden:!0,renderItems(e,t){return ae(Ki,{location:e,...t})},patches:[{find:"handleIsolateClick,children:[i&&",all:!0,group:!0,replacement:[{match:/onSaveEdit:(\i)\}\)/,replace:"onSaveEdit:$1,id:arguments[0].id})"},{match:/onEditClick:(\i)\}\)/,replace:"onEditClick:$1,...arguments[0]})"},{match:/"Delete","Delete"\)\]\}\)/,replace:'$&,$self.renderItems("conversation",{conversationId:arguments[0].id})'}]},{find:'"CopyButton",()=>',all:!0,replacement:{match:/slice\(0,5\)\}\}\)\}\)\]\}\)/,replace:'$&,$self.renderItems("message",{response:arguments[0].response})'}},{find:'"AvatarDropdownMenu",()=>',all:!0,replacement:{match:/"Sign Out"\)\]\}\)/,replace:'$&,$self.renderItems("user")'}}]});var As=new M("AutoContinue","#a6e3a1"),Ct=te({delay:{type:5,description:"Delay in seconds before automatically retrying.",min:1,max:15,default:3},maxRetries:{type:5,description:"Maximum number of automatic retries per response.",min:1,max:10,default:3}}),Ke=null,Yt=0,$s=0,ir=new Set;function Rs(e){if(Ke)clearTimeout(Ke);if(Date.now()-$s>30000)Yt=0;if(Yt>=Ct.store.maxRetries){As.info(`Reached max retries (${Ct.store.maxRetries})`);return}As.info(`Auto-retrying in ${Ct.store.delay}s (attempt ${Yt+1}/${Ct.store.maxRetries})`),Ke=setTimeout(()=>{Yt++,$s=Date.now(),Ke=null,e()},Ct.store.delay*1000)}var sr=h({name:"AutoContinue",description:"Automatically retries when Grok fails to respond.",authors:[T.Prism],settings:Ct,stop(){if(Ke)clearTimeout(Ke),Ke=null;Yt=0,ir.clear()},_autoRetry(e){return Rs(e),e},_handleNoResponse(){let e=re.useChatPageStore.getState().conversationId;if(!e)return;let{byId:t,byConversationId:o}=ot.useResponseStore.getState(),n=o[e];if(!n?.length)return;let i=t[n[n.length-1]];if(!i||i.sender==="human"||i.message||i.partial)return;if(ir.has(i.responseId))return;Rs(()=>{ir.add(i.responseId),re.useChatPageStore.getState().sendResponse({message:"",parentResponseId:i.parentResponseId,conversationId:e,enableRetries:!0})})},patches:[{find:'"StreamingResponse",()=>',replacement:{match:/onRetry:(\i),conversationId/,replace:"onRetry:$self._autoRetry($1),conversationId"}},{find:'"ChatInteraction",()=>',replacement:{match:/(?<=unable to reply\.description.{0,60})onRetry:(\i),conversationId/,replace:"onRetry:$self._autoRetry($1),conversationId"}},{find:'"ResponseContent",()=>',all:!0,replacement:{match:/(\i)\("response\.no-response","No response\."\)/,replace:'($self._handleNoResponse(),$1("response.no-response","No response."))'}}]});var Ho=h({name:"BackgroundThinking",description:"Lets Grok think in the background while you are away.",authors:[T.Prism],patches:[{find:'"bgThinkingDefaultOptinSet"',replacement:{match:/\.success\?(\i)\.data:null/,replace:".success?$1.data:{enabled:!0,maxConcurrentRequests:3}"}}]});var al={SUBSCRIPTION_TIER_INVALID:"Free",SUBSCRIPTION_TIER_X_BASIC:"Basic",SUBSCRIPTION_TIER_X_PREMIUM:"Premium",SUBSCRIPTION_TIER_X_PREMIUM_PLUS:"Premium+",SUBSCRIPTION_TIER_GROK_PRO:"SuperGrok",SUBSCRIPTION_TIER_SUPER_GROK_PRO:"SuperGrok Pro"},ll={"0":"Free","1":"X Premium","2":"X Premium+"};function cl(e,t){if(e)return al[e]??e;return ll[t??"0"]??"Free"}function ul(){let{open:e}=mn.useSidebar(),{user:t}=co.useSession(),o=po.useSubscriptionsStore((n)=>n.bestSubscription);if(!e||!t)return null;return r.createElement(p,{flexDirection:"column",justifyContent:"center",gap:"0",className:"min-w-0 overflow-hidden"},r.createElement(m,{as:"span",size:"sm",weight:"medium",className:"truncate"},t.givenName||t.email?.split("@")[0]||"User"),r.createElement(m,{as:"span",size:"xs",color:"secondary",className:"truncate"},cl(o,t.sessionTierId)))}var ar=h({name:"BetterSidebar",description:"Shows your name and plan in the sidebar footer.",authors:[T.Prism],renderUserInfo:_.wrap(ul),patches:[{find:"AvatarDropdownMenu,{}),",replacement:{match:/AvatarDropdownMenu,\{\}\)/,replace:"$&,$self.renderUserInfo()"}}]});var lr=h({name:"Cleaner",description:"Hides upgrade nags and upsell banners.",authors:[T.Prism],patches:[{find:'"user-dropdown.upgrade","Upgrade plan"',all:!0,replacement:{match:/\i(?:\|\|\i)+(?=\?null:.{0,160}"user-dropdown\.upgrade")/,replace:"true"}},{find:'"UpsellCard",()=>',all:!0,replacement:{match:/"UpsellCard",\(\)=>\i/,replace:'"UpsellCard",()=>()=>null'}},{find:'"UpsellSuperGrokSmall",()=>',all:!0,replacement:{match:/"UpsellSuperGrokSmall",\(\)=>\i/,replace:'"UpsellSuperGrokSmall",()=>()=>null'}},{find:"group/model-mode-select-upsell",replacement:{match:/(?<=useCheckSubscriptionOffer\)\(\);).{0,30}return null;/,replace:"return null;"}}]});var cr=h({name:"ConsoleJanitor",description:"Silences noisy warnings and info logs in the browser console.",authors:[T.Prism],patches:[{find:"x.ai/careers",replacement:{match:/console\.info\("[^"]{0,2000}"\)/,replace:"void 0"}},{find:"DialogDescriptionWarning",all:!0,replacement:{match:/console\.warn\(\i\)/,replace:"void 0"}}]});var dl=Ot("DownloadIcon");function pl(e){return{id:e.responseId,sender:e.sender,message:e.message,query:e.query,createTime:e.createTime,model:e.requestMetadata?.model??e.model,...e.thinkingTrace&&{thinkingTrace:e.thinkingTrace},...e.webSearchResults?.length&&{webSearchResults:e.webSearchResults},...e.generatedImageUrls?.length&&{generatedImageUrls:e.generatedImageUrls},...e.fileAttachments?.length&&{fileAttachments:e.fileAttachments},...e.steps?.length&&{steps:e.steps}}}async function fl(e){let t=await ot.useResponseStore.getState().loadInitialResponses(e,!0);if(!t?.length)return;let n=At.useConversationStore.getState().byId[e]?.title??"Untitled Chat";Mo(`${Do(n,"chat")}.json`,JSON.stringify({conversationId:e,title:n,exportedAt:new Date().toISOString(),messages:t.map(pl)},null,2),"application/json")}function ml({conversationId:e}){return r.createElement(at,{onSelect:()=>fl(e)},r.createElement(dl,{size:16,className:"me-2"}),"Export")}var ur=h({name:"ExportChat",description:"Export conversations as JSON from the right-click menu.",authors:[T.Prism],contextMenuItems:{conversation:{label:"Export",render:ml}}});var Kt=h({name:"FixChrome",description:"Fixes Chromium-specific performance issues like backdrop blur lag.",authors:[T.Prism],required:!0,patches:[{find:"bg-overlay backdrop-blur-[2px]",all:!0,replacement:{match:/backdrop-blur-\[2px\] /,replace:" "}}]});function gl(e){let o=e.target.closest("[id^='response-']");if(!o)return;o.querySelector("[aria-label='Edit']")?.click()}var dr=h({name:"MessageClickActions",description:"Double-click your own messages to edit them.",authors:[T.Prism],eventListeners:[{event:"dblclick",handler:gl}]});var Gs=te({playOnHover:{type:3,description:"Play video thumbnails when hovered.",default:!0}}),pr=new WeakMap;function yl(e){pr.set(e,e.play().catch(()=>{}))}function hl(e){let t=pr.get(e);if(pr.delete(e),t)t.then(()=>{e.pause(),e.currentTime=0});else e.pause(),e.currentTime=0}var Sl=(e)=>{let t=e.currentTarget.querySelector("video");if(t)yl(t)},xl=(e)=>{let t=e.currentTarget.querySelector("video");if(t)hl(t)},fr=h({name:"NoAutoplay",description:"Stops video thumbnails from autoplaying on the Imagine page.",authors:[T.Prism],settings:Gs,_hoverProps(){if(!Gs.store.playOnHover)return{};return{onMouseEnter:Sl,onMouseLeave:xl}},patches:[{find:"group/media-post-masonry-card",group:!0,replacement:[{match:/muted:!0,autoPlay:!0/,replace:"muted:!0,autoPlay:!1"},{match:/onMouseOver:\i\?\(\)=>\i\(!0\):void 0,onMouseLeave:\i\?\(\)=>\i\(!1\):void 0/,replace:"$&,...$self._hoverProps()"}]}]});var mr=h({name:"NoTelemetry",description:"Disables all tracking, telemetry, and event logging.",authors:[T.Prism],required:!0,patches:[{find:"ingest.us.sentry.io",replacement:{match:/dsn:"https:\/\/.{0,80}\.ingest\.us\.sentry\.io\/.{0,30}"/,replace:'dsn:""'}},{find:'"after-init"),(0,',replacement:{match:/function \i\(\)\{if\(Object\.prototype\.hasOwnProperty[\s\S]{0,450}setHasMixpanelInitialized\)\(!0\)\}\}\)\}/,replace:"function p(){}"}},{find:"sendBatchLogEvent",all:!0,replacement:[{match:/"sendBatchLogEvent",\i=>\{\i\(this\.address\+.{0,40},\i\)\}/,replace:'"sendBatchLogEvent",()=>{}'},{match:/"sendBatchLogExperimentExposure",\i=>\{\i\(this\.address\+.{0,50},\i\)\}/,replace:'"sendBatchLogExperimentExposure",()=>{}'},{match:/"\/api\/log_metric",\i\)/,replace:'"/api/log_metric",[])'}]},{find:"feature-store-set-override",all:!0,replacement:[{match:/\(0,\i\.\i\)\("feature-store-set-override".{0,65}\)/,replace:"void 0"},{match:/\(0,\i\.\i\)\("feature-store-clear-override".{0,45}\)/,replace:"void 0"},{match:/\(0,\i\.\i\)\("feature-store-clear-all-overrides".{0,40}\)/,replace:"void 0"}]}]});var bl="https://raw.githubusercontent.com/adryd325/oneko.js/c4ee66353b11a44e4a5b7e914a81f8d33111555e/oneko.js",Cl="https://raw.githubusercontent.com/adryd325/oneko.js/14bab15a755d0e35cd4ae19c931d96d306f99f42/oneko.gif",gr=!1,yr=h({name:"Oneko",description:"Cat follows your mouse cursor.",authors:[T.adryd],cleanupSelectors:["#oneko"],start(){gr=!1,ge(bl).then((e)=>e.text()).then((e)=>e.replace("./oneko.gif",Cl).replace("(isReducedMotion)","(false)")).then((e)=>{if(gr)return;let t=new Blob([e],{type:"text/javascript"}),o=document.createElement("script");o.src=URL.createObjectURL(t),document.head.appendChild(o),o.addEventListener("load",()=>{o.remove(),URL.revokeObjectURL(o.src)})})},stop(){gr=!0}});var Pl=new M("RateLimitDisplay","#ef9f76"),_s=te({showMaxCount:{type:3,description:"Show the maximum count alongside remaining.",default:!0}}),zs=Ot("ClockIcon"),he={remaining:-1,total:-1,windowSeconds:0,waitSeconds:null};function hr(e){return e!=null&&e>0?Math.ceil(e):null}function Wo(e,t,o){return{remaining:e.remainingQueries,total:Math.floor(t/e.cost),windowSeconds:o,waitSeconds:hr(e.waitTimeSeconds)}}function Zt(e,t){let o=e.windowSizeSeconds,n=e.totalTokens??0;if(n>0){if(t==="fast"&&e.lowEffortRateLimits)return Wo(e.lowEffortRateLimits,n,o);if(t==="expert"&&e.highEffortRateLimits)return Wo(e.highEffortRateLimits,n,o);if(e.highEffortRateLimits)return Wo(e.highEffortRateLimits,n,o);if(e.lowEffortRateLimits)return Wo(e.lowEffortRateLimits,n,o);return{remaining:e.remainingTokens??0,total:n,windowSeconds:o,waitSeconds:hr(e.waitTimeSeconds)}}if(e.totalQueries>0)return{remaining:e.remainingQueries,total:e.totalQueries,windowSeconds:o,waitSeconds:hr(e.waitTimeSeconds)};return{...he,windowSeconds:o}}function jo(e,t){return yn.rateLimitsApi.rateLimitsGetRateLimits({body:{modelName:e,requestKind:t}})}function Pt(e,t){if(e.waitSeconds!=null&&e.waitSeconds>0)return Po(e.waitSeconds);if(e.total<0)return"...";if(e.total===0)return"∞";return t||!_s.store.showMaxCount?String(e.remaining):`${e.remaining}/${e.total}`}function Tl({usage:e,iconOnly:t}){let o=Lo(e.waitSeconds),n=o!=null&&o>0,i=n?{...e,waitSeconds:o}:e,s=e.windowSeconds>0?`Resets every ${zt(e.windowSeconds)}`:"",a=t?[Pt(i),s].filter(Boolean).join(" · "):s||void 0;return r.createElement(pt,{icon:n?r.createElement(zs,{size:18}):r.createElement(bo,{size:18}),tooltip:a,className:n?"text-fg-danger":void 0,iconOnly:t},Pt(i))}function Ml({fast:e,expert:t,iconOnly:o}){let n=Lo(e.waitSeconds),i=Lo(t.waitSeconds),s=n!=null&&n>0,a=i!=null&&i>0,l=s||a,c=s?{...e,waitSeconds:n}:e,u=a?{...t,waitSeconds:i}:t,f=e.windowSeconds??t.windowSeconds,w=f>0?` · resets every ${zt(f)}`:"";return r.createElement(pt,{icon:l?r.createElement(zs,{size:18}):r.createElement(bo,{size:18}),tooltip:`Fast ${Pt(c)} · Expert ${Pt(u)}${w}`,className:l?"text-fg-danger":void 0,iconOnly:o},Pt(c,!0),r.createElement(ke,{orientation:"vertical",className:"mx-1 h-3 w-0.5"}),Pt(u,!0))}function Dl({iconOnly:e}){let t=re.useChatPageStore((S)=>S.modelMode),o=re.useChatPageStore((S)=>S.reasoningMode),n=re.useChatPageStore((S)=>S.conversationId),i=re.useChatPageStore((S)=>S.lastMessageId),s=re.useChatPageStore((S)=>!!S.streamedMessageId),a=uo.useModelsStore((S)=>S.modelByMode),[l,c]=x(he),[u,f]=x(he),[w,g]=x(he);if(O(()=>{if(t==="auto"&&s)return;let S=Sn.reasoningModeToRequestKind?.(o)??"DEFAULT",A=($)=>Pl.error("Failed to fetch rate limits",$),B=!1;if(t==="auto"){let $=a?.fast?.modelId,z=a?.expert?.modelId;if(!$&&!z)return;let R=$===z,y=$??z;if(R&&y)jo(y,S).then((k)=>{if(B)return;c(Zt(k,"fast")),f(Zt(k,"expert")),g(he)}).catch(A);else Promise.all([$?jo($,S):null,z?jo(z,S):null]).then(([k,ce])=>{if(B)return;c(k?Zt(k,"fast"):he),f(ce?Zt(ce,"expert"):he),g(he)}).catch(A)}else{let $=a?.[t]?.modelId;if(!$)return;jo($,S).then((z)=>{if(B)return;c(he),f(he),g(Zt(z,t))}).catch(A)}return()=>{B=!0}},[t,o,n,i,s,a]),t==="auto")return r.createElement(Ml,{fast:l,expert:u,iconOnly:e});return r.createElement(Tl,{usage:w,iconOnly:e})}var Sr=h({name:"RateLimitDisplay",description:"Shows rate limit usage next to the chat input.",authors:[T.Prism],settings:_s,chatBarButton:{render:Dl}});var xr=h({name:"Starry",description:"Enables Grok's native starry idle background with shooting stars.",authors:[T.Prism],patches:[{find:"inactivityDelay:1e4,fadeInDuration:1e4",replacement:[{match:/\i\.SHOW_STARRY_IDLE&&!\i&&\i&&"main"===\i\.page&&/,replace:"true&&"},{match:/inactivityDelay:1e4,fadeInDuration:1e4/,replace:"inactivityDelay:0,fadeInDuration:0"}]}]});Ho.preview=!0;Kt.chrome=!0;Kt.hidden=!window.chrome;var br={[er.name]:er,[nr.name]:nr,[rr.name]:rr,[sr.name]:sr,[Ho.name]:Ho,[ar.name]:ar,[lr.name]:lr,[cr.name]:cr,[Zn.name]:Zn,[ur.name]:ur,[Kt.name]:Kt,[dr.name]:dr,[fr.name]:fr,[mr.name]:mr,[yr.name]:yr,[Sr.name]:Sr,[xr.name]:xr};var Cr={};Xo(Cr,{zustandCreate:()=>ca,useState:()=>x,useRef:()=>ue,useReducer:()=>Rt,useReducedMotion:()=>Gt,useMemo:()=>Y,useLayoutEffect:()=>fn,useEffect:()=>O,useCallback:()=>X,toast:()=>Fi,onceReady:()=>oo,i18n:()=>ua,createElement:()=>ae,WorkspaceStore:()=>mi,WorkspaceConnectorsStore:()=>Ti,WorkspaceCollectionsStore:()=>Pi,UpsellStore:()=>ci,TourGuideStore:()=>pi,TooltipTrigger:()=>_e,TooltipContent:()=>ze,Tooltip:()=>Ge,Toaster:()=>hn,TextToSpeechStore:()=>xi,TasksStore:()=>bi,TabsManagerStore:()=>ri,Switch:()=>K,SubscriptionsStore:()=>po,SourcesSelectorStore:()=>di,Slider:()=>So,SidebarComponents:()=>mn,ShareStore:()=>ui,SettingsTitle:()=>ct,SettingsStore:()=>ei,SettingsRow:()=>lt,SettingsDialogStore:()=>ti,SettingsDescription:()=>ut,SessionStore:()=>co,Separator:()=>ke,SelectValue:()=>me,SelectTrigger:()=>pe,SelectItem:()=>F,SelectContent:()=>fe,Select:()=>de,RoutingStore:()=>ni,ResponseStore:()=>ot,ReportStore:()=>Si,ReasoningModeUtils:()=>Sn,ReactDOM:()=>wi,React:()=>r,PersonalityStore:()=>hi,NotificationsStore:()=>ii,NextRouter:()=>da,MotionDiv:()=>ho,ModesStore:()=>ai,ModelsStore:()=>uo,MentionMenuStore:()=>gi,MediaStore:()=>si,LazyComponent:()=>C,Input:()=>Q,Fragment:()=>rt,FileStore:()=>oi,FeatureStore:()=>j,DropdownMenuItem:()=>at,DialogTitle:()=>Ie,DialogHeader:()=>we,DialogFooter:()=>st,DialogDescription:()=>it,DialogContent:()=>Le,DialogClose:()=>yo,Dialog:()=>ve,DevModelsStore:()=>fi,ConversationStore:()=>At,CommandMenuStore:()=>li,ClassNames:()=>Ue,ChatPageStore:()=>re,Card:()=>go,ButtonWithTooltip:()=>$e,Button:()=>E,AssetStore:()=>yi,ArtifactStore:()=>Ci,ApiClients:()=>yn,AnimatePresence:()=>gn});var Pr=new M("TurbopackPatcher","#e78284"),Us=500,vl=0.4,Ll=15000,wl=15000,Il=5000;function kl(){if(!U.some((n)=>!n.all))return;let t=Bt(()=>{if(!U.some((n)=>!n.all))t(),clearTimeout(o)}),o=setTimeout(()=>{t(),Ar()},Il)}function El(){let e=()=>Object.values(v).filter((s)=>!s.started&&N(s.name)&&(s.startAt??"Init")==="TurbopackReady");if(!e().length)return;let t=null,n=Bt(()=>{if(t)clearTimeout(t);t=setTimeout(()=>{t=null,io();for(let s of e())Te(s,!0);if(!e().length)n(),clearTimeout(i),Pr.info("All previously failed plugins started after late module load")},200)}),i=setTimeout(()=>{if(n(),t)clearTimeout(t);io();let s=e();for(let l of s)Te(l,!0);let a=e();if(a.length)Pr.warn(`${a.length} plugin(s) still failed after retry window: ${a.map((l)=>l.name).join(", ")}`)},wl)}function Fl(){let e=Ve();if(!e)return!1;return H().size/e.size>=vl}function Nl(){let e=null,t=null,o=null,n=null,i=!1,s=()=>{if(i)return;if(i=!0,e)clearTimeout(e);if(t)clearTimeout(t);if(o)o();if(n)n();io(),Vr(),on(),Ht("TurbopackReady"),Pr.info(`${H().size} modules loaded, ready`),El(),kl(),ls()},a=()=>{if(i)return;if(e)clearTimeout(e);if(Fl()){s();return}e=setTimeout(a,Us)};n=Ce(W.byProps("useRoutingStore","formatUrl"),()=>{n=null,a()}),o=Bt(()=>{if(!i&&!n&&e)clearTimeout(e),e=setTimeout(a,Us)}),t=setTimeout(s,Ll)}function Tr(){Rr();for(let e in br)Bo(br[e]);if(is(),Ht("Init"),document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>Ht("DOMContentLoaded"),{once:!0});else Ht("DOMContentLoaded");Nl()}var Hs=typeof unsafeWindow<"u"?unsafeWindow:window;if(!Hs.Void)Object.defineProperty(Hs,"Void",{value:Mr,writable:!1,configurable:!0}),Fo().then(()=>Tr());})();