PageSourceSearch

https://app.parler.com/assets/CreateLoungeModal-dqEEpsFP.js

js parler.com collected 2026-09-24 08:27:08 UTC 12,042 bytes, 1 lines download raw bytes

1import{ab as Ne,gs as Ce,j as e,a3 as we,c2 as Ie,gt as Se,gu as Re,gv as Le,gw as Ae}from"./vendor-data-eBPZki-Z.js";import{r as s,f as Ue}from"./vendor-react-BgtJhS2O.js";import{m as ce,Z as te,X as Pe,af as ae,aD as se,t as $,am as Ee,an as ze,ao as Oe,ap as Te,aq as $e,ey as Fe,ez as Me,dw as re,b9 as _e,aA as Ge,b8 as Qe,bz as le}from"./index-DTQGL8n8.js";import{dO as De}from"./vendor-zod-Bei2Z9MS.js";import{u as ne}from"./useImageCropTarget-D4vTG1Mx.js";import{L,a as Ve,i as Be}from"./LoungePrivacyRadios-DMwsS6RQ.js";import{u as qe}from"./usePremiumGateAccess-_F9WRRYB.js";import{t as He,M as Xe,a as Ke}from"./loungeSlug-ziCyOWDO.js";function We({value:r,onChange:i}){const[d,p]=s.useState(""),u=Ne(d,300),o=Ce(u),f=new Set(r.map(a=>a.id)),y=(o.data??[]).filter(a=>!f.has(a.id)),C=u.trim().replace(/^@/,"").length>=2,k=a=>{r.some(n=>n.id===a.id)||(i([...r,a]),p(""))},j=a=>i(r.filter(n=>n.id!==a));return e.jsxs("div",{children:[e.jsxs("label",{className:"relative block",children:[e.jsx("span",{className:"sr-only",children:"Invite people by username"}),e.jsx("input",{type:"search",value:d,onChange:a=>p(a.target.value),placeholder:"Invite by username...",className:"w-full h-9 px-3 text-sm rounded-lg bg-bg-elevated dark:bg-bg-elevated-dark text-text dark:text-text-dark placeholder:text-text-secondary dark:placeholder:text-text-secondary-dark focus:outline-none focus:ring-2 focus:ring-brand"})]}),C&&e.jsx("div",{className:"mt-1 rounded-lg border border-border-light/60 dark:border-border-dark/60 overflow-hidden",children:o.isLoading?e.jsx("div",{className:"py-3 flex justify-center",children:e.jsx(ce,{size:"sm",label:"Searching users"})}):y.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-secondary dark:text-text-secondary-dark",children:"No users found."}):e.jsx("ul",{children:y.map(a=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>k({id:a.id,username:a.username,displayName:a.displayName,avatarUrl:a.avatarUrl}),className:"w-full text-left flex items-center gap-3 px-3 py-2 hover:bg-bg-elevated dark:hover:bg-bg-elevated-dark transition-colors",children:[a.avatarUrl&&e.jsx("img",{src:a.avatarUrl,alt:"",className:"w-8 h-8 rounded-full object-cover flex-shrink-0"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx(te,{className:"block text-sm font-medium text-text dark:text-text-dark",children:a.displayName}),e.jsxs(te,{as:"span",className:"block text-xs text-text-secondary dark:text-text-secondary-dark",children:["@",a.username]})]})]})},a.id))})}),r.length>0&&e.jsx("ul",{className:"mt-2 flex flex-wrap gap-2",children:r.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5 pl-3 pr-1.5 py-1 rounded-full bg-bg-elevated dark:bg-bg-elevated-dark",children:[e.jsxs("span",{className:"text-xs text-text dark:text-text-dark",children:["@",a.username]}),e.jsx("button",{type:"button",onClick:()=>j(a.id),className:"p-0.5 text-text-secondary dark:text-text-secondary-dark hover:text-text dark:hover:text-text-dark","aria-label":`Remove @${a.username}`,children:e.jsx(Pe,{width:12,height:12})})]},a.id))})]})}async function oe(r,i,d){if(r.length===0)return;const u=(await Promise.allSettled(r.map(o=>Promise.resolve().then(()=>i(o))))).filter(o=>o.status==="rejected").length;u>0&&d(u,r.length)}function ie(r,i){return De[r]?.label??i?.find(d=>d.slug===r)?.name??r}function lt({open:r,onOpenChange:i}){const d=Ue(),p=we("hidden_lounges"),u=qe("lounge_private_hidden"),o=Ie({enabled:r}),f=Se(),y=Re(),C=Le(),k=ae(),j=ae(),a=ne(),n=ne(),F=a.onPick,M=n.onPick,_=se(a.file),G=se(n.file),Q=s.useRef(null),D=s.useRef(null),V=s.useRef(1),[v,B]=s.useState(""),[w,q]=s.useState(""),[A,H]=s.useState("public"),de=t=>{if(t!==A){if(Be(t)&&!u.allowed){u.requestPaywall();return}H(t)}},[I,X]=s.useState(""),[U,K]=s.useState(""),[P,S]=s.useState([]),[E,W]=s.useState([]),[R,Z]=s.useState(""),[ue,J]=s.useState(!1),c=He(v);s.useEffect(()=>{const t=setTimeout(()=>Z(c),500);return()=>clearTimeout(t)},[c]),s.useEffect(()=>{r&&(B(""),q(""),H("public"),X(""),K(""),S([]),W([]),Z(""),V.current=1,a.reset(),n.reset())},[r]);const h=Ae(R),z=c.length>=3&&(R!==c||h.isFetching),Y=c.length>=3&&R===c&&!!h.data&&!h.data.available,ee=c.length>=3&&R===c&&!h.isFetching&&(!h.data||h.data.available),xe=s.useMemo(()=>{const t=U.trim().toLowerCase(),l=o.data??[];return t?l.filter(b=>ie(b.slug,l).toLowerCase().includes(t)):l},[U,o.data]),O=p?A:"public",me=k.isUploading||j.isUploading,g=ue||f.isPending||me,T=v.trim().length>0&&w.trim().length>0&&ee&&!Y&&!g,be=s.useCallback(()=>{const t=V.current++;S(l=>[...l,{key:t,title:""}])},[]),pe=s.useCallback((t,l)=>{S(b=>b.map(x=>x.key===t?{...x,title:l}:x))},[]),he=s.useCallback(t=>
1{S(l=>l.filter(b=>b.key!==t))},[]),ge=s.useCallback(async()=>{if(!(!T||g)){J(!0);try{const[t,l]=await Promise.all([a.file?k.upload(a.file):Promise.resolve(void 0),n.file?j.upload(n.file):Promise.resolve(void 0)]),x=(await f.mutateAsync({name:c,displayName:v.trim(),description:w.trim(),visibility:O,...I?{category:I}:{},...t?{iconUrl:t}:{},...l?{bannerUrl:l}:{}}))?.data?.ulid;if(x){const je=P.map(m=>m.title.trim()).filter(Boolean);await oe(je,m=>y.mutateAsync({spaceId:x,input:{title:m,description:""}}),(m,N)=>$.error(`${m} of ${N} rule${N===1?"":"s"} couldn't be saved. Add them from Edit.`)),await oe(E,m=>C.mutateAsync({spaceId:x,username:m.username}),(m,N)=>{const ve=O==="public"?"":" Invite them from the lounge's Members page.";$.error(`${m} of ${N} invite${N===1?"":"s"} couldn't be sent.${ve}`)})}i(!1),x&&d(`/lounges/${x}`)}catch(t){$.error(t instanceof Error?t.message:"Failed to create lounge")}finally{J(!1)}}},[n.file,j,T,I,y,f,w,O,a.file,k,C,E,g,v,d,i,P,c]),fe=s.useCallback(t=>{g||i(t)},[g,i]),ye=s.useCallback(t=>{M(t.target.files?.[0]??null),t.target.value=""},[M]),ke=s.useCallback(t=>{F(t.target.files?.[0]??null),t.target.value=""},[F]);return e.jsx(Ee,{open:r,onOpenChange:fe,children:e.jsxs(ze,{children:[e.jsx(Oe,{className:"fixed inset-0 z-50 bg-scrim data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0"}),e.jsxs(Te,{className:"fixed left-1/2 top-1/2 z-50 flex max-h-[92vh] w-[calc(100vw-24px)] max-w-md -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-border-light bg-bg font-inter text-text shadow-xl dark:border-border-dark dark:bg-bg-dark dark:text-text-dark","aria-describedby":void 0,children:[e.jsx($e,{className:"sr-only",children:"Create Lounge"}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-6 pt-4 sm:px-5",children:[e.jsxs("div",{className:"relative mb-14",children:[e.jsxs("button",{type:"button",onClick:()=>D.current?.click(),className:"relative flex h-40 w-full items-center justify-center overflow-hidden rounded-xl bg-surface text-text-secondary dark:bg-surface-dark dark:text-text-secondary-dark",children:[G&&e.jsx("img",{src:G,alt:"",className:"h-full w-full object-cover"}),e.jsxs("span",{className:"absolute right-3 top-3 flex items-center gap-1.5 rounded-md bg-black/55 px-2.5 py-1.5 text-xs font-semibold text-white",children:[e.jsx(Fe,{size:16})," Cover photo"]})]}),e.jsx("input",{ref:D,type:"file",accept:"image/jpeg,image/png,image/webp",className:"sr-only","aria-label":"Choose cover photo",onChange:ye}),e.jsx("button",{type:"button",onClick:()=>Q.current?.click(),className:"absolute -bottom-9 left-3 flex h-[76px] w-[76px] items-center justify-center overflow-hidden rounded-xl border-4 border-bg bg-brand text-white shadow-sm dark:border-bg-dark","aria-label":"Choose lounge icon",children:_?e.jsx("img",{src:_,alt:"",className:"h-full w-full object-cover"}):e.jsx(Me,{size:31})}),e.jsx("input",{ref:Q,type:"file",accept:"image/jpeg,image/png,image/webp",className:"sr-only",onChange:ke})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-2 block text-xs font-semibold",children:"Name"}),e.jsx("input",{value:v,onChange:t=>B(t.target.value),maxLength:Xe,placeholder:"Enter lounge name",className:L}),z&&e.jsx("span",{className:"mt-1.5 block text-xs text-text-secondary dark:text-text-secondary-dark",children:"Checking…"}),!z&&Y&&e.jsx("span",{className:"mt-1.5 block text-xs text-error",children:"Name already taken"}),!z&&ee&&e.jsxs("span",{className:"mt-1.5 flex items-center gap-1 text-xs text-success",children:[e.jsx(re,{size:15})," Available"]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-2 block text-xs font-semibold",children:"About"}),e.jsx("textarea",{value:w,onChange:t=>q(t.target.value),maxLength:Ke,rows:10,placeholder:"What is this lounge about?",className:`${L} min-h-56 resize-y leading-5`})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-xs font-semibold",children:"Rules & Guidelines"}),e.jsxs("div",{className:"space-y-2",children:[P.map(t=>{const l=t.title.trim().length>0;return e.jsxs("div",{className:"flex items-center gap-2",children:[l?e.jsx(re,{className:"flex-none text-brand",size:19}):e.jsx("span",{className:"h-[19px] w-[19px] flex-none rounded-full border border-border-light dark:border-border-dark"}),e.jsx("input",{value:t.title,onChange:b=>pe(t.key,b.target.value),placeholder:"Rule Title",maxLength:100,className:`${L} min-w-0 flex-1 py-2.5`}),e.jsx("button",{type:"button",onClick:()=>he(t.key),"aria-label":"Remove rule",className:"flex h-8 w-8 flex-none items-center justify-center text-text-dim hover:text-error",children:e.jsx(_e,{size:20})})]},t.key)}),e.jsxs("button",{type:"button",onClick:be,className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-border-light py-3 text-sm font-semibold hover:border-brand dark:border-border-dark",children:[e.jsx(Ge,{size:17})," Add Rule"]})]})]}),p&&e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-xs font-semibold",children:"Privacy"}),e.jsx(Ve,{value:A,onSelect:de,showPremiumCallout:!u.allowed})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-xs font-semibold",children:"Categories"}),e.jsxs("label",{className:"relative block",children:[e.jsx(Qe,{size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-text-dim"}),e.jsx("input",{value:U,onChange:t=>K(t.target.value),placeholder:"Search","aria-label":"Search categories",className:`${L} py-2.5 pl-9`})]}),o.isLoading?e.jsx("div",{className:"py-4",children:e.jsx(ce,{size:"sm",label:"Loading c
1ategories"})}):o.isError?e.jsxs("div",{className:"py-4 text-center",children:[e.jsx("p",{className:"text-xs text-text-secondary dark:text-text-secondary-dark",children:"Couldn't load categories."}),e.jsx("button",{type:"button",onClick:()=>o.refetch(),className:"mt-2 text-xs font-semibold text-brand",children:"Retry"})]}):e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",role:"radiogroup","aria-label":"Category",children:xe.map(t=>{const l=I===t.slug;return e.jsx("button",{type:"button",role:"radio","aria-checked":l,onClick:()=>X(t.slug),className:`rounded-full border px-3.5 py-1.5 text-xs transition-colors ${l?"border-brand bg-brand text-white":"border-border-light text-text-secondary hover:border-brand/60 dark:border-border-dark dark:text-text-secondary-dark"}`,children:ie(t.slug,o.data)},t.slug)})})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-xs font-semibold",children:"Invites"}),e.jsx(We,{value:E,onChange:W})]})]})]}),e.jsx("div",{className:"flex-none border-t border-border-light bg-bg p-3 dark:border-border-dark dark:bg-bg-dark",children:e.jsx("button",{type:"button",onClick:()=>void ge(),disabled:!T,className:"h-12 w-full rounded-xl bg-label-primary text-sm font-semibold text-white disabled:opacity-40",children:g?"Creating…":"Create Lounge"})}),e.jsx(le,{open:a.isOpen,onOpenChange:a.setOpen,onCancel:a.cancel,file:a.dialogFile,aspect:1,lockAspect:!0,title:"Crop icon",onApply:a.onApply}),e.jsx(le,{open:n.isOpen,onOpenChange:n.setOpen,onCancel:n.cancel,file:n.dialogFile,aspect:3,lockAspect:!0,title:"Crop banner",onApply:n.onApply})]})]})})}export{lt as default,ie as resolveCategoryLabel};

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.