1import{d as T,P as B,a as N,r as u,M as S,N as V,ad as $,g as l,h as o,m as y,l as e,D as w,E as g,y as x,k as A,F as M,I as k,aN as U,V as O,z as P,o as a,v as z}from"./DLseKeBg.js";const F={key:0,class:"alert alert-warning"},R={key:1,class:"flex w-full flex-col gap-5"},I={class:"card w-full overflow-hidden bg-base-100 shadow-xl"},L={class:"card-body gap-4 bg-secondary/25"},W={class:"flex flex-col gap-2"},j={key:0,class:"card w-full overflow-hidden bg-base-100 shadow-xl"},K={class:"card-body gap-4"},Y={class:"flex flex-col gap-2"},q={class:"form-control w-full"},G={class:"form-control w-full"},H={class:"card-actions justify-end"},J={key:2,class:"alert alert-info"},Q={method:"dialog",class:"modal-box"},X={class:"modal-action"},Z=["disabled"],ss=["disabled"],es="cytoid",ns=T({__name:"sudo",setup(ts){const C=B(),{user:_,ready:h,isModerator:m,isAdmin:E}=N(),c=u(null),r=u(""),d=u(""),b=u(!1);S(()=>{V(async()=>{try{if(await $(h).toBeTruthy({timeout:1e3,throwOnTimeout:!0}),!m)throw new Error("Permission denied")}catch(n){console.error(n),C.push({name:"studio"})}})});async function D(){try{await k("/session/sudo",{method:"POST"}),U({path:"/studio/sudo",persistState:!1})}catch(n){O(n)}}async function i(n){await k(n?"/workers/".concat(n):"/workers",{method:"POST",body:{command:r.value,argument:d.value}}),P("Command sent")}return(n,s)=>{var f;const p=z;return a(),l(M,null,[((f=o(_))==null?void 0:f.uid)===es?(a(),l("div",F,[y(p,{name:"ph:hash-bold",size:"24"}),s[8]||(s[8]=e("span",null,"You're the superuser now!",-1))])):o(m)?(a(),l("div",R,[e("div",I,[e("div",L,[e("div",W,[s[9]||(s[9]=e("h2",{class:"card-subtitle"}," Superuser ",-1)),s[10]||(s[10]=e("p",null," Do you want to be a superuser? ",-1)),e("button",{class:"btn btn-secondary",onClick:s[0]||(s[0]=t=>{var v;return(v=o(c))==null?void 0:v.showModal()})}," Be a superuser ")])])]),o(E)?(a(),l("div",j,[e("div",K,[e("div",Y,[s[13]||(s[13]=e("h2",{class:"card-subtitle"}," Worker Command ",-1)),e("div",q,[s[11]||(s[11]=e("label",{class:"label"},[e("span",{class:"label-text"},"Command")],-1)),w(e("input",{"onUpdate:modelValue":s[1]||(s[1]=t=>x(r)?r.value=t:null),type:"text",class:"input input-bordered w-full"},null,512),[[g,o(r)]])]),e("div",G,[s[12]||(s[12]=e("label",{class:"label"},[e("span",{class:"label-text"},"Argument")],-1)),w(e("input",{"onUpdate:modelValue":s[2]||(s[2]=t=>x(d)?d.value=t:null),type:"text",class:"input input-bordered w-full"},null,512),[[g,o(d)]])])]),e("div",H,[e("button",{class:"btn btn-neutral",onClick:s[3]||(s[3]=t=>i("level"))}," Emit Level "),e("button",{class:"btn btn-neutral",onClick:s[4]||(s[4]=t=>i("user"))}," Emit User "),e("button",{class:"btn btn-neutral",onClick:s[5]||(s[5]=t=>i("record"))}," Emit Record "),e("button",{class:"btn btn-primary",onClick:s[6]||(s[6]=t=>i())}," Emit ")])])])):A("",!0)])):(a(),l("div",J,[y(p,{name:"mdi:loading",size:"24",class:"animate-spin"}),s[14]||(s[14]=e("span",null,"Loading...",-1))])),e("dialog",{ref_key:"superuserDialog",ref:c,class:"modal"},[e("form",Q,[s[15]||(s[15]=e("h3",{class:"text-lg font-bold"}," Be a superuser ",-1)),s[16]||(s[16]=e("p",{class:"py-4"}," Do you want to be a superuser? ",-1)),e("div",X,[e("button",{disabled:o(b),class:"btn btn-neutral",value:"cancel",formmethod:"dialog"}," Cancel ",8,Z),e("button",{disabled:o(b),class:"btn btn-secondary",value:"default",onClick:s[7]||(s[7]=t=>{t.preventDefault(),D()})}," OK ",8,ss)])])],512)],64)}}});export{ns as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.