"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7253],{12023:(e,n,t)=>{t.d(n,{b:()=>l});var r=t(21071),a=t(82909).hp;let l=e=>{let n=a.from(e,"base64"),t=(0,r.Wt)(new Uint8Array(n));return JSON.parse(new TextDecoder().decode(t))}},15882:(e,n,t)=>{t.d(n,{T:()=>a});var r=t(89099);let a=()=>{let e=(0,r.useRouter)(),{pathname:n,query:{profileId:t,channelId:a,blockId:l,blockChannelId:i,blockProfileId:s},isReady:o}=e;return{isReady:o,isShared:"/share/[token]"===n,blockId:l?"".concat(l):null,channelId:"".concat(i||a||"—"),profileId:"".concat(s||t||"—"),router:e}}},26650:(e,n,t)=>{t.d(n,{Sc:()=>o,XZ:()=>c});var r=t(37876),a=t(93026),l=t(84147),i=t(22365),s=t(77680);let o=e=>{let{checked:n,children:t,disabled:a,onCheckedChange:i}=e;return(0,r.jsx)(l.D,{disabled:a,role:"checkbox","aria-checked":n,onClick:()=>{null==i||i(!n)},children:(0,r.jsxs)(d,{checked:n,children:[(0,r.jsx)(c,{disabled:a,checked:!!n,children:n&&(0,r.jsx)(s.Srz,{})}),t]})})},c=(0,a.pH)("div",{all:"unset",groundColor:"$background",width:12,height:12,borderRadius:"$1",display:"flex",alignItems:"center",justifyContent:"center",color:"$slate",border:"1px solid $slate","&:focus":{borderColor:"$focus"},"&:disabled":{color:"$gray4",borderColor:"$gray4"},variants:{checked:{true:{color:"$link",borderColor:"$link"}},disabled:{true:{color:"$gray4",borderColor:"$gray4"}}}}),d=(0,a.pH)(i.J,{display:"flex",alignItems:"center",fontWeight:"bold",gap:"$2",userSelect:"none",color:"$slate",cursor:"pointer","&:hover, &:focus":{color:"$foreground"},"&:focus":{outline:0,"> div":{borderColor:"$focus"}},"&:disabled > div":{color:"$gray4",borderColor:"$gray4"},variants:{disabled:{true:{color:"$gray4"}},checked:{true:{color:"$link"}}}})},58780:(e,n,t)=>{t.d(n,{h:()=>f});var r=t(37876),a=t(16607),l=t(50168),i=t(29334),s=t(14232);let o=e=>{let{onFiles:n,onText:t}=e;(0,s.useEffect)(()=>{let e=e=>{if(!e.clipboardData)return;let{clipboardData:r}=e;if((r.types.includes("text/plain")||r.types.includes("text/html"))&&t)return void t(r.getData("text/plain"));if(!n)return;let{clipboardData:{items:a}}=e;if(!a)return;let l=(0,i.o)(Array.from(a).filter(e=>{let{kind:n}=e;return"file"===n}).map(e=>e.getAsFile()));0!==l.length&&n(l)};return window.addEventListener("paste",e),()=>{window.removeEventListener("paste",e)}},[n,t])};var c=t(10394),d=t(52447),h=t(89572),u=t(87303),p=t(5336),m=t(52001),x=t(10963),g=t(37101);let f=()=>{let[e,n]=(0,s.useState)("Idle"),{createBlock:t}=(0,a.p)(),{addCell:i}=(0,l.E1)(),{sendToast:f,updateToast:j,retractToast:b,sendGenericError:C}=(0,m.Yf)(),{addFiles:y}=(0,x.Su)(),_=()=>{n("Idle")},v=(0,s.useCallback)(async e=>{let a=null;n("Idle");try{let n=y(e,{onSuccess:async e=>{let{location:n}=e;if(!a)return void console.error("Unable to notify for batch upload");try{let e=await t({value:n});i({type:"Block",id:e})}catch(n){console.error(n);let e=(0,d.PE)(n);j({...a,variant:"error",title:e,content:null})}}});if(!n)return;let l=n.uploads.length;a=f({title:"Adding ".concat(l," file").concat(1===l?"":"s"),content:(0,r.jsx)(x.Hs,{id:n.id}),duration:1/0}),await n.promise}catch(e){C(e)}finally{if(!a)return void console.error("Unable to notify for batch upload");b(a.id,1e3)}},[i,y,t,b,C,f,j]),{getRootProps:$,getInputProps:w}=(0,g.VB)({onDropAccepted:v,onDropRejected:_,onDragLeave:_,preventDropOnDocument:!1,noClick:!0,noKeyboard:!0});return((0,s.useEffect)(()=>{let e=e=>{var t;(null==(t=e.dataTransfer)?void 0:t.types.includes("Files"))&&n("Active")};return window.addEventListener("dragenter",e),()=>{window.removeEventListener("dragenter",e)}}),o({onFiles:v}),"Idle"===e)?null:(0,r.jsxs)(h.a,{...$(),css:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:c.o.DIALOG,bg:"$backgroundLight",backdropFilter:"$blurs$1",display:"flex",alignItems:"center",justifyContent:"center",p:"$2"},children:[(0,r.jsx)("input",{...w()}),(0,r.jsxs)(u.B,{gap:"$1",css:{textAlign:"center"},children:[(0,r.jsx)(p.E,{size:"xl",children:"Drop files to add"}),(0,r.jsxs)(p.E,{size:"xs",children:["Max file for images is ",x.t8," MB, and for all other files ",x.Y4," MB."]})]})]})}},76694:(e,n,t)=>{t.d(n,{N:()=>r});let r=(0,t(93026).pH)("div",{variants:{visibility:{PUBLIC:{},PRIVATE:{},CLOSED:{}},level:{primary:{},secondary:{},tertiary:{}}},compoundVariants:[{visibility:"PUBLIC",level:"primary",css:{color:"$channelPublic3"}},{visibility:"PUBLIC",level:"secondary",css:{color:"$channelPublic2"}},{visibility:"PUBLIC",level:"tertiary",css:{color:"$channelPublic1"}},{visibility:"PRIVATE",level:"primary",css:{color:"$channelPrivate3"}},{visibility:"PRIVATE",level:"secondary",css:{color:"$channelPrivate2"}},{visibility:"PRIVATE",level:"tertiary",css:{color:"$channelPrivate1"}},{visibility:"CLOSED",level:"primary",css:{color:"$channelClosed3"}},{visibility:"CLOSED",level:"secondary",css:{color:"$channelClosed2"}},{visibility:"CLOSED",level:"tertiary",css:{color:"$channelClosed1"}}]})},78787:(e,n,t)=>{t.d(n,{E:()=>k});var r=t(28888),a=t(37876),l=t(14905),i=t(89099),s=t(14232),o=t(86355),c=t(50168),d=t(34426),h=t(16607),u=t(12023),p=t(15882),m=t(58780),x=t(31896),g=t(89572),f=t(76841),j=t(87303),b=t(5336),C=t(48230),y=t.n(C);let _=()=>(0,a.jsx)(g.a,{css:{px:"$10",py:"$10",bg:"$gray1",color:"$slate",textAlign:"center","@bp1":{py:"$6",px:"$4"}},children:(0,a.jsxs)(j.B,{gap:"$2",children:[(0,a.jsxs)(b.E,{size:"xl",css:{color:"$slate",textWrap:"balance"},children:["You’ve reached your block limit.",(0,a.jsx)("br",{}),"Upgrade to a Premium to get unlimited blocks, pinning, reader mode, table view and more."]}),(0,a.jsx)(f.$,{as:y(),href:"/billing",size:"sm",css:{mixBlendMode:"$colors$blend",alignSelf:"center"},children:"Upgrade to Premium"})]})});var v=t(1746),$=t(30090);function w(){let e=(0,r._)(["\n fragment ChannelGridChannelFragment on Channel {\n id\n href\n compressed_skeleton\n can {\n add_to\n potentially_add_to\n }\n }\n\n query ChannelGridQuery($id: ID!) {\n channel(id: $id) {\n ...ChannelGridChannelFragment\n ...ChannelOperationsChannelFragment\n id\n }\n }\n"]);return w=function(){return e},e}let k=e=>{let{id:n}=e,{blockId:t,isReady:r}=(0,p.T)(),o=(0,i.useRouter)(),{breakpoint:g}=(0,$.dv)(),[{data:f,fetching:b,error:C}]=(0,l.XND)({variables:{id:n.toString()},pause:!r,requestPolicy:"cache-and-network"}),y=(0,s.useMemo)(()=>f&&f.channel?(0,u.b)(f.channel.compressed_skeleton):[],[f]),w=(0,s.useMemo)(()=>y.filter(e=>e.pinned),[y]);if(C)throw C;let k=null==f?void 0:f.channel;if(b||!k)return(0,a.jsx)(d.C,{});let I=[...k.can.add_to&&"1"!==g?[c.zd]:[],...y];return(0,a.jsx)(h.T,{channel:k,children:(0,a.jsx)(v.Q,{pinned:w,children:(0,a.jsxs)(c.kv,{cells:I,children:[(0,a.jsx)(m.h,{}),(0,a.jsxs)(j.B,{gap:"$4",children:[!k.can.add_to&&k.can.potentially_add_to&&(0,a.jsx)(_,{}),(0,a.jsx)(c.xA,{})]}),(0,a.jsx)(x.k,{id:t,onOpenChange:e=>{!e&&f&&f.channel&&o.back()}})]},k.id)})})};(0,o.J1)(w())},80397:(e,n,t)=>{t.d(n,{F_:()=>W,jW:()=>V});var r=t(28888),a=t(37876),l=t(5336),i=t(14232),s=t(89572),o=t(86355),c=t(14905),d=t(48230),h=t.n(d),u=t(77152),p=t(87303),m=t(41058),x=t(71431),g=t(39220),f=t(76841),j=t(45990),b=t(57880),C=t(93578),y=t(38942),_=t(15333),v=t(13521),$=t(10625),w=t(54761),k=t(84147),I=t(53630),E=t(22365),D=t(9922),S=t(52001),z=t(92797),M=t(65074),F=t(89099);function A(){let e=(0,r._)(["\n fragment ChannelCollaboratorsDialogFragment on Channel {\n id\n counts {\n collaborators\n }\n members {\n ...CollaboratorsSelectResultFragment\n ... on Model {\n id\n }\n }\n }\n\n query ChannelCollaboratorsDialogQuery($id: ID!) {\n channel(id: $id) {\n ...ChannelCollaboratorsDialogFragment\n id\n }\n }\n\n mutation ChannelCollaboratorsDialogAddMutation(\n $input: AddChannelMembersMutationInput!\n ) {\n add_channel_members(input: $input) {\n channel {\n ...ChannelCollaboratorsDialogFragment\n ...ChannelTransferChannelFragment\n id\n }\n }\n }\n\n mutation ChannelCollaboratorsDialogRemoveMutation(\n $input: RemoveChannelMembersMutationInput!\n ) {\n remove_channel_members(input: $input) {\n channel {\n ...ChannelCollaboratorsDialogFragment\n id\n }\n }\n }\n\n mutation ChannelCollaboratorsDialogInviteMutation(\n $input: InviteCollaboratorMutationInput!\n ) {\n invite_collaborator(input: $input) {\n channel {\n ...ChannelCollaboratorsDialogFragment\n id\n }\n }\n }\n"]);return A=function(){return e},e}let B=e=>{var n,t;let{id:r,length:o}=e,{sendGenericError:d,sendToast:h,updateToast:u}=(0,S.Yf)(),[{data:m,fetching:x}]=(0,c.OcB)({variables:{id:r.toString()},pause:0===o}),g=(0,c.SAT)()[1],f=(0,c.zsy)()[1],j=(0,c.s0j)()[1],b=async e=>{if("Email"===e.__typename){try{let n=h({title:"Inviting ".concat(e.email)}),t=await j({input:{channel_id:r.toString(),email:e.email}});if(t.error)throw t.error;u({...n,title:"Successfully invited ".concat(e.email)})}catch(e){d(e)}return}try{let n=h({title:"Adding ".concat(e.name)}),t=await g({input:{id:r.toString(),members:[{id:e.id.toString(),type:c.mc9[e.__typename]}]}});if(t.error)throw t.error;u({...n,title:"Successfully added ".concat(e.name)})}catch(e){d(e)}},{userId:C}=(0,M.Jd)(),y=(0,F.useRouter)(),_=async e=>{await f({input:{id:r.toString(),members:[{id:e.id.toString(),type:c.mc9[e.__typename]}]}}),e.id===C&&y.push("/")},v=null!=(t=null==m||null==(n=m.channel)?void 0:n.members)?t:[],[$,A]=(0,i.useState)("Idle");return(0,a.jsxs)(s.a,{css:{display:"flex",flexDirection:"column",width:"100%",justifyContent:"space-between"},children:[(0,a.jsx)(w.HM,{}),(0,a.jsxs)(p.B,{gap:"$6",children:[(0,a.jsx)(w.L3,{children:"Manage collaborators"}),(0,a.jsxs)(p.B,{gap:"$1",children:[(0,a.jsx)(E.J,{children:"Invite"}),(0,a.jsx)(D.o,{onSelect:b,inviteEmails:!0})]}),(0,a.jsxs)(p.B,{gap:"$2",children:[(0,a.jsx)(E.J,{children:"Collaborators"}),0===v.length&&(0,a.jsxs)(l.E,{size:"xs",css:{color:"$slate"},children:["No collaborators. Working with people on multiple channels? Try"," ",(0,a.jsx)(k.D,{onClick:()=>{A("NewGroup")},css:{fontWeight:"bold"},children:"Groups."})]}),x?(0,a.jsx)(a.Fragment,{children:Array.from({length:3}).map((e,n)=>(0,a.jsx)(I.Y,{},n))}):(0,a.jsx)(a.Fragment,{children:v.map(e=>(0,a.jsx)(I.r,{result:e,onRemove:_},e.id))})]})]}),"NewGroup"===$&&(0,a.jsx)(z._,{onClose:()=>{A("Idle")},onSuccess:e=>{b(e),A("Idle")}})]})},P=e=>{let{id:n,children:t,length:r}=e,{open:l,onOpenChange:i}=(0,$.u)();return(0,a.jsxs)(w.Dz,{open:l,onOpenChange:i,children:[(0,a.jsx)(w.lG,{css:{display:"flex",width:375,height:600},children:(0,a.jsx)(B,{id:n,length:r})}),(0,a.jsx)(w.zM,{asChild:!0,children:t})]})};(0,o.J1)(A());var T=t(15882),L=t(77680),R=t(60513),O=t(29507),G=t(97423),U=t(30090);function J(){let e=(0,r._)(['\n fragment ChannelMetadataFragment on Channel {\n ...ChannelShareChannelFragment\n id\n owner {\n __typename\n ... on Model {\n id\n }\n }\n user {\n id\n name\n href\n }\n created_at(relative: true)\n created_at_timestamp: created_at(format: "%b %e, %Y, %l:%M %p %Z")\n added_to_at(relative: true)\n added_to_at_timestamp: added_to_at(format: "%b %e, %Y, %l:%M %p %Z")\n description(format: HTML)\n href\n counts {\n followers\n contents\n collaborators\n }\n can {\n manage_collaborators\n }\n members {\n __typename\n ... on User {\n ...AvatarUserFragment\n id\n name\n href\n }\n ... on Group {\n ...AvatarGroupFragment\n id\n name\n href\n }\n }\n connected_to_channels(page: 1, per: 25) {\n id\n title\n href\n }\n }\n\n query ChannelMetadataQuery($id: ID!) {\n channel(id: $id) {\n ...ChannelMetadataFragment\n }\n }\n']);return J=function(){return e},e}let q=R.z.enum(["collaborators","connections","followers","table"]),V=e=>""===e||void 0===e||q.safeParse(e).success,W=e=>{let{id:n}=e,{query:t}=(0,F.useRouter)(),r=(0,O.r)(t.tab),{preferences:o,updatePreferences:d}=(0,G.gc)(),{breakpoint:u}=(0,U.dv)(),{isReady:j,isShared:$}=(0,T.T)(),[{data:w,fetching:k,error:I}]=(0,c.QuP)({variables:{id:n.toString()},pause:!j});if(I)return console.error(I),null;if(k||!(null==w?void 0:w.channel))return(0,a.jsx)(N,{});let E=w.channel,D=E.members,S=E.connected_to_channels;return(0,a.jsxs)(b.OS,{children:[(0,a.jsxs)(b.Eu,{css:{a:{fontWeight:"bold"}},children:[(0,a.jsx)(b.rv,{children:"Info"}),(0,a.jsxs)(p.B,{gap:"$2",children:[E.description?(0,a.jsx)(l.E,{as:C.g3,size:"xs",dangerouslySetInnerHTML:{__html:E.description}}):(0,a.jsx)(l.E,{size:"xs",css:{color:"$gray5"},children:"—"}),(0,a.jsx)(m.u,{definitions:[..."Group"===E.owner.__typename&&E.user?[{term:"Started by",description:E.user.name,href:E.user.href}]:[],{term:"Started",description:(0,a.jsx)(g.m_,{label:E.created_at_timestamp,children:(0,a.jsx)("div",{children:E.created_at})})},...E.added_to_at&&E.added_to_at!==E.created_at?[{term:"Modified",description:(0,a.jsx)(g.m_,{label:E.added_to_at_timestamp,children:(0,a.jsx)("div",{children:E.added_to_at})})}]:[],{term:"Length",description:E.counts.contents},...E.counts.followers>0?[{term:"Followers",description:E.counts.followers,href:"".concat(E.href,"/followers")}]:[]]})]})]}),(D.length>0||E.can.manage_collaborators)&&(0,a.jsxs)(b.Eu,{children:[(0,a.jsx)(b.rv,{children:"Collaborators"}),(0,a.jsx)(p.B,{gap:"$1",children:(D.length>0||E.can.manage_collaborators)&&(0,a.jsxs)(p.B,{gap:"$2",direction:"vertical",children:[D.length>0&&(0,a.jsx)(p.B,{gap:"$1",direction:"horizontal",css:{flexWrap:"wrap"},children:D.map(e=>e.href?(0,a.jsx)(i.Fragment,{children:(0,a.jsx)(g.m_,{label:e.name,side:"bottom",children:(0,a.jsx)(s.a,{as:h(),href:e.href,children:(0,a.jsx)(x.e,{size:"xs",entity:e,variant:"Group"===e.__typename?"square":"round"})})})},e.id):null)}),E.can.manage_collaborators&&(0,a.jsx)(s.a,{children:(0,a.jsx)(P,{id:E.id,length:D.length,children:(0,a.jsx)(f.$,{size:"sm",children:0===D.length?"Add collaborator":"Manage collaborators"})})})]})})]}),!$&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(b.Eu,{css:{a:{fontWeight:"bold"}},children:[(0,a.jsx)(b.rv,{children:"This channel appears in"}),(0,a.jsxs)(p.B,{gap:"$2",children:[S.length>0&&(0,a.jsx)(l.E,{size:"xs",css:{color:"$gray5"},children:S.map((e,n)=>e.href?(0,a.jsxs)(i.Fragment,{children:[(0,a.jsx)(y.E,{id:e.id,children:(0,a.jsx)(h(),{href:e.href,children:e.title})}),n===S.length-1?null:(0,a.jsx)(a.Fragment,{children:", "})]},e.id):null)}),(0,a.jsxs)(p.B,{gap:"$1",direction:"horizontal",children:[S.length>=25&&(0,a.jsx)(f.$,{as:h(),href:"".concat(E.href,"/connections"),size:"sm",children:"View all"}),(0,a.jsx)(v.P,{id:E.id,type:"Channel",children:(0,a.jsxs)(f.$,{size:"sm",children:["Connect ",(0,a.jsx)(L.flY,{})]})})]})]})]}),(0,a.jsxs)(b.Eu,{children:[(0,a.jsx)(b.rv,{children:"View"}),(0,a.jsxs)(p.B,{gap:"$6",css:{flexDirection:"row"},children:[(0,a.jsx)(_.lM,{items:[{children:"Grid",href:E.href},{children:"Table",href:"".concat(E.href,"/table")}]}),"1"===u&&""===r&&(0,a.jsx)(_.lM,{items:[{children:"1-column",active:"default"===o.gridLayout,onClick:()=>{d({gridLayout:"default"})}},{children:"2-column",active:"2-up"===o.gridLayout,onClick:()=>{d({gridLayout:"2-up"})}}]})]})]})]})]})},N=()=>(0,a.jsxs)(b.BF,{children:[(0,a.jsxs)(b.Eu,{children:[(0,a.jsx)(b.rv,{children:"Info"}),(0,a.jsxs)(p.B,{gap:"$1",children:[(0,a.jsx)(u.r,{size:"xs",children:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet."}),(0,a.jsx)(u.r,{size:"xs",children:"Started 1 year ago"})]})]}),(0,a.jsxs)(b.Eu,{children:[(0,a.jsx)(b.rv,{children:"Collaborators"}),(0,a.jsxs)(p.B,{gap:"$1",direction:"horizontal",css:{flexWrap:"wrap"},children:[(0,a.jsx)(j.LI,{size:"xs"}),(0,a.jsx)(j.LI,{size:"xs"}),(0,a.jsx)(j.LI,{size:"xs"})]})]}),(0,a.jsxs)(b.Eu,{children:[(0,a.jsx)(b.rv,{children:"This channel appears in"}),(0,a.jsx)(u.r,{size:"xs",children:"Example Channel, Example Channel, Example Channel, Example Channel, Example Channel, Example Channel, Example Channel, Example Channel, Example Channel, Example Channel, Example Channel, Example Channel"})]})]});(0,o.J1)(J())},80904:(e,n,t)=>{t.d(n,{YX:()=>d,q4:()=>p});var r=t(28888),a=t(37876),l=t(4439),i=t(59782),s=t(86355);function o(){let e=(0,r._)(["\n fragment MetaTagsChannelFragment on Channel {\n id\n metaDescription: description(format: PLAIN)\n href\n image_url(size: ORIGINAL)\n is_indexable\n title\n }\n"]);return o=function(){return e},e}function c(){let e=(0,r._)(["\n query MetaTagsChannelQuery($id: ID!) {\n channel(id: $id) {\n ...MetaTagsChannelFragment\n id\n visibility_name\n }\n }\n ","\n"]);return c=function(){return e},e}let d=e=>{let{channel:n}=e;return(0,a.jsx)(l.p,{description:n.metaDescription,imageUrl:(0,l.R)(n.image_url),isIndexable:n.is_indexable,title:"".concat(n.title," | Are.na"),canonical:n.href,children:(0,a.jsx)("link",{rel:"alternate",type:"application/rss+xml",title:"".concat(n.title," | Are.na"),href:"".concat("https://www.are.na").concat(n.href,"/feed/rss")})})},h=(0,s.J1)(o()),u=(0,s.J1)(c(),h),p=async e=>{let{client:n,id:t}=e,{data:r,error:a}=await n.query(u,{id:t.toString()}).toPromise();if(a)throw a;let l=null==r?void 0:r.channel;if(!l)throw new i.m_;return{metaTags:l}}},97775:(e,n,t)=>{t.d(n,{G:()=>eE});var r=t(37876),a=t(28888),l=t(89572),i=t(14905),s=t(48230),o=t.n(s),c=t(14232),d=t(86355),h=t(53493),u=t(28815),p=t(15882),m=t(76841),x=t(52001),g=t(30833),f=t(64281),j=t(27079),b=t(10625),C=t(54761),y=t(947),_=t(77152),v=t(87303);function $(){let e=(0,a._)(["\n fragment ChannelShareChannelFragment on Channel {\n id\n share_id\n visibility_name\n href\n }\n\n mutation ChannelShareMutation($input: ShareChannelMutationInput!) {\n share_channel(input: $input) {\n channel {\n ...ChannelShareChannelFragment\n }\n }\n }\n"]);return $=function(){return e},e}function w(){let e=(0,a._)(["\n query ChannelShareDialogQuery($id: ID!) {\n channel(id: $id) {\n ...ChannelShareChannelFragment\n id\n }\n }\n"]);return w=function(){return e},e}let k="".concat("https://www.are.na"),I=e=>{let{channel:n,onDisable:t}=e,[a,l]=(0,i.n3i)(),{sendToast:s,sendGenericError:o}=(0,x.Yf)(),[d,h]=(0,c.useState)("Idle"),u=async()=>{h("Disabling");try{let e=await l({input:{id:n.id.toString(),enable:!1}});if(e.error)throw e.error;s({title:"Share link disabled"}),t()}catch(e){o(e)}h("Idle")},{copy:p}=(0,j.i)(),g=(0,c.useRef)(!1);(0,c.useEffect)(()=>{n.share_id||"PRIVATE"!==n.visibility_name||g.current||(g.current=!0,(async()=>{h("Generating");try{var e,t;let r=await l({input:{id:n.id.toString(),enable:!0}});if(r.error)throw r.error;let a=null==(t=r.data)||null==(e=t.share_channel)?void 0:e.channel.share_id;if(!a)throw Error("Unable to share channel. Try again.");s({title:"Channel shared",actions:[{label:"Visit",href:"".concat(k,"/share/").concat(a)}]})}catch(e){o(e)}h("Idle")})())},[n.id,n.share_id,n.visibility_name,l,o,s]);let f=(0,c.useMemo)(()=>"PRIVATE"!==n.visibility_name?"".concat(k).concat(n.href):n.share_id?"".concat(k,"/share/").concat(n.share_id):null,[n.href,n.share_id,n.visibility_name]);return f?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.pd,{variant:"title",readOnly:!0,value:f}),(0,r.jsx)(C.Es,{children:(0,r.jsxs)(v.B,{direction:"horizontal",gap:"$1",css:{alignItems:"center"},children:[(0,r.jsx)(m.$,{size:"sm",as:"a",href:f,target:"_blank",children:"View"}),(0,r.jsx)(m.$,{size:"sm",onClick:()=>{p(f)},children:"Copy link"}),"PRIVATE"===n.visibility_name&&n.share_id&&(0,r.jsx)(m.$,{size:"sm",onClick:u,disabled:"Disabling"===d,children:"Disabling"===d?"Disabling...":"Disable link"})]})})]}):(0,r.jsx)(E,{})},E=()=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_.E,{children:(0,r.jsx)(y.pd,{variant:"title",css:{opacity:0}})}),(0,r.jsx)(C.Es,{children:(0,r.jsxs)(v.B,{direction:"horizontal",gap:"$1",css:{alignItems:"center"},children:[(0,r.jsx)(m.k,{size:"sm",children:"Disable link"}),(0,r.jsx)(m.k,{size:"sm",children:"View page"}),(0,r.jsx)(m.k,{size:"sm",children:"Copy"})]})})]});(0,d.J1)($());let D=e=>{let{id:n,onClose:t}=e,{open:a,onOpenChange:l}=(0,b.u)({defaultOpen:!0,onClose:t}),[{data:s,fetching:o,error:c}]=(0,i.iDO)({variables:{id:n.toString()}});if(c)throw c;let d=null==s?void 0:s.channel;return(0,r.jsx)(C.Dz,{open:a,onOpenChange:l,children:(0,r.jsx)(C.lG,{title:"Share channel",isCloseable:!0,css:{width:375},children:(0,r.jsx)(v.B,{gap:"$6",children:o||!d?(0,r.jsx)(E,{}):(0,r.jsx)(I,{channel:d,onDisable:t})})})})};(0,d.J1)(w());var S=t(60513),z=t(88992),M=t(26650),F=t(13810);let A=S.z.object({toc:S.z.boolean().optional(),author:S.z.boolean().optional(),source:S.z.boolean().optional(),description:S.z.boolean().optional(),reverse:S.z.boolean().optional()}),B=A.parse({toc:!0,author:!0,source:!0,description:!0,reverse:!0}),P=e=>{let{onClose:n,slug:t}=e,{open:a,onOpenChange:l}=(0,b.u)({defaultOpen:!0,onClose:n}),{setValue:i,getValues:s,watch:o}=(0,z.mN)({defaultValues:B,resolver:(0,F.u)(A)});return(0,r.jsx)(C.Dz,{open:a,onOpenChange:l,children:(0,r.jsx)(C.lG,{title:"Make book using print.are.na",isCloseable:!0,css:{width:375},children:(0,r.jsxs)(v.B,{gap:"$6",children:[(0,r.jsxs)(v.B,{gap:"$1",children:[(0,r.jsx)(M.Sc,{checked:o("toc"),onCheckedChange:e=>{i("toc",e)},children:"Table of Contents"}),(0,r.jsx)(M.Sc,{checked:o("author"),onCheckedChange:e=>{i("author",e)},children:"Display block author"}),(0,r.jsx)(M.Sc,{checked:o("source"),onCheckedChange:e=>{i("source",e)},children:"Display block source"}),(0,r.jsx)(M.Sc,{checked:o("description"),onCheckedChange:e=>{i("description",e)},children:"Display block description"}),(0,r.jsx)(M.Sc,{checked:o("reverse"),onCheckedChange:e=>{i("reverse",e)},children:"Default order (newest blocks first)"})]}),(0,r.jsx)(C.Es,{children:(0,r.jsx)(m.$,{onClick:()=>{let{toc:e,author:n,source:r,description:a,reverse:l}=s();window.open("https://print.are.na/book/".concat(t,"?toc=").concat(e,"&author=").concat(n,"&source=").concat(r,"&description=").concat(a,"&reverse=").concat(l))},children:"Make book"})})]})})})};var T=t(52447),L=t(29334),R=t(1623),O=t(88663),G=t(5336),U=t(50014),J=t(6416),q=t(77680),V=t(72696);let W=e=>{try{if(e.includes('"')||e.includes(",")||e.includes("\n"))return'"'.concat(e.replace(/"/g,'""'),'"');return e}catch(e){return console.error(e),"ERROR"}},N=e=>{let{header:n,rows:t}=e;return[n.map(e=>{let[,n]=e;return W(n)}).join(","),...t.map(e=>Array.from(n,n=>{var t,r;let[a]=n;return W(null!=(r=null==(t=e[a])?void 0:t.toString())?r:"")}).join(","))].join("\n")};function Y(){let e=(0,a._)(["\n query ChannelExporterRangePageQuery($id: ID!, $page: Int!, $per: Int!) {\n channel(id: $id) {\n id\n connectables: blokks(page: $page, per: $per) {\n ... on Model {\n id\n created_at\n updated_at\n }\n ... on Channel {\n slug\n href\n }\n ... on ConnectableInterface {\n title\n description(format: MARKDOWN)\n source {\n url\n }\n }\n ... on Attachment {\n file_name\n file_extension\n file_url\n }\n ... on Image {\n file_extension\n file_name\n image_url(size: ORIGINAL)\n }\n ... on Text {\n content(format: MARKDOWN)\n file_name\n }\n ... on Link {\n file_name\n source_url\n }\n ... on Embed {\n file_name\n source_url\n }\n }\n }\n }\n"]);return Y=function(){return e},e}function H(){let e=(0,a._)(["\n fragment ChannelExporterRangeChannelFragment on Channel {\n id\n slug\n counts {\n contents\n }\n }\n"]);return H=function(){return e},e}let Q=e=>{let{actions:n,channel:t,endIndex:a,onDone:l,onStart:i,part:s,per:o,startIndex:d}=e,h=(0,c.useRef)(new AbortController),u=(0,c.useRef)(!1),{sendGenericError:p}=(0,x.Yf)(),[g,f]=(0,c.useState)("Idle"),[j,b]=(0,c.useState)(0),[C,y]=(0,c.useState)(0),_=(0,J.tH)(),$=Math.min(t.counts.contents,a),w=0===d&&$===t.counts.contents?"".concat(t.slug):"".concat(t.slug,"_part-").concat(s),k=Math.min(o,100),I=Math.ceil(d/k),E=Math.ceil($/k)-I,D=(0,c.useCallback)(async()=>{try{i(),f("Api");let e=Array.from({length:E},(e,n)=>I+n+1),n=0,r=async e=>{let r=await _.query(Z,{id:t.id.toString(),page:e,per:k},{requestPolicy:"network-only"}).toPromise();return b(++n/E*100),r},a=await (0,U.Ay)(e,r,{concurrency:4,signal:h.current.signal});if(u.current)return;let s=(0,L.o)(a.flatMap(e=>{var n,t;return null==e||null==(t=e.data)||null==(n=t.channel)?void 0:n.connectables})),o=(0,L.o)(s.map((e,n)=>{if(u.current)return;let t=d+n+1;switch(e.__typename){case"Attachment":if(!e.file_url)return null;return{filename:"".concat(t,"_").concat(e.file_name,".").concat(e.file_extension),typename:e.__typename,url:e.file_url};case"Image":if(!e.image_url)return null;return{filename:"".concat(t,"_").concat(e.file_name,".").concat(e.file_extension),typename:e.__typename,url:e.image_url};case"Text":return{content:e.content,filename:"".concat(t,"_").concat(e.file_name,".txt"),typename:e.__typename};case"Embed":case"Link":if(!e.source_url)return null;return{filename:"".concat(t,"_").concat(e.file_name,".webloc"),typename:e.__typename,url:e.source_url};case"Channel":return{filename:"".concat(t,"_").concat(e.slug,".webloc"),typename:"Link",url:"".concat("https://www.are.na").concat(e.href)};case"PendingBlock":return null}}));if(f("File"),u.current)return;let c={filename:"".concat(w,".csv"),content:N({header:[["id","ID"],["filename","Filename"],["title","Title"],["description","Description"],["createdAt","Created At"],["updatedAt","Updated At"],["source","Source"]],rows:o.map((e,n)=>{var t;let{filename:r}=e,a=s[n];return{id:a.id,filename:r,title:a.title,description:a.description,createdAt:a.created_at,updatedAt:a.updated_at,source:null==(t=a.source)?void 0:t.url}})}),typename:"Text"},p=await (0,R._Z)([c,...o],{onProgress:y,onZip:()=>{f("Zip")}});if(u.current)return;(0,R.PE)("".concat(w,".zip"),p),f("Done"),l()}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;p(e),f("Idle")}},[t.id,_,w,l,i,k,p,d,I,E]);(0,c.useImperativeHandle)(n,()=>({abort:()=>{u.current=!0,h.current.abort()},start:D}),[D]);let S=(0,c.useMemo)(()=>{switch(g){case"Idle":return 0;case"Api":return j;case"File":return C;case"Zip":case"Done":return 100}},[j,C,g]),z=(0,c.useMemo)(()=>{switch(g){case"Idle":return"Initializing";case"Api":return"Downloading";case"File":return"Exporting";case"Zip":return"Zipping";case"Done":return"Complete"}},[g]);return"Idle"===g?(0,r.jsxs)(v.B,{gap:"$1",children:[(0,r.jsxs)(v.B,{gap:"$1",direction:"horizontal",css:{alignItems:"center"},children:[(0,r.jsx)(m.$,{size:"icon",onClick:D,children:(0,r.jsx)(q.udU,{})}),(0,r.jsx)(O.z,{progress:S,css:{width:"100%"}})]}),(0,r.jsxs)(G.E,{size:"xs",children:[w,".zip"]})]}):(0,r.jsxs)(v.B,{gap:"$1",children:[(0,r.jsxs)(v.B,{gap:"$1",direction:"horizontal",css:{alignItems:"center"},children:[(0,r.jsx)(m.$,{size:"icon",disabled:!0,children:"Done"===g?(0,r.jsx)(q.Srz,{}):(0,r.jsx)(V.y,{size:15})}),(0,r.jsx)(O.z,{progress:S,css:{width:"100%"}},g)]}),(0,r.jsxs)(G.E,{size:"xs",children:[z,(0,r.jsx)(r.Fragment,{children:"Api"===g||"File"===g?" (".concat(S.toFixed(0),"%)"):null})]})]})},Z=(0,d.J1)(Y());(0,d.J1)(H());var K=t(29017),X=t(63073),ee=t(10731),en=t(2450),et=t(22365),er=t(63853);function ea(){let e=(0,a._)(["\n fragment ChannelExporterChannelFragment on Channel {\n id\n slug\n counts {\n contents\n }\n }\n"]);return ea=function(){return e},e}function el(){let e=(0,a._)(["\n query ChannelExporterDialogQuery($id: ID!) {\n channel(id: $id) {\n ...ChannelExporterChannelFragment\n id\n }\n }\n"]);return el=function(){return e},e}let ei=e=>{let{channel:n,onDone:t,actions:a}=e,[l,i]=(0,c.useState)("Idle"),[s,o]=(0,c.useState)(0),[d,h]=(0,c.useState)(1e3),[u]=(0,er.d7)(Math.max(1,d||1),500),p=Math.ceil(n.counts.contents/u),x=(0,c.useMemo)(()=>Array.from({length:p},(e,n)=>({key:n+1,part:n+1,startIndex:n*u,endIndex:(n+1)*u,actions:(0,c.createRef)()})),[u,p]);(0,c.useEffect)(()=>{s===p&&t()},[s,t,p]),(0,c.useImperativeHandle)(a,()=>({abort:()=>{x.forEach(e=>{var n;null==(n=e.actions.current)||n.abort()})}}),[x]);let[g,f]=(0,c.useState)(!0);return(0,r.jsxs)(v.B,{gap:"$6",children:[(0,r.jsxs)(ee.P,{children:["This will download"," ",(0,X.B)(n.counts.contents,{verbose:!0})," block",1===n.counts.contents?"":"s"," and compress"," ",1===n.counts.contents?"it":"them"," into"," ",1===p?"a single":p," .zip file",1===p?"":"s","."]}),(0,r.jsx)(en.E,{label:"Advanced options",children:(0,r.jsxs)(v.B,{gap:"$2",children:[(0,r.jsxs)(et.J,{children:["Blocks per file",(0,r.jsx)(y.pd,{type:"number",value:d,onChange:e=>{h(parseInt(e.target.value,10))}})]}),x.length>1&&(0,r.jsx)(M.Sc,{checked:g,onCheckedChange:f,children:"Auto-play downloads"})]})}),(0,r.jsx)(v.B,{gap:"$4",children:x.map(e=>(0,r.jsx)(Q,{channel:n,actions:e.actions,startIndex:e.startIndex,endIndex:e.endIndex,part:e.part,per:u,onDone:()=>{o(e=>e+1);let n=x.find(n=>n.part===e.part+1);if(g&&n){var t;null==(t=n.actions.current)||t.start()}},onStart:()=>{i("Downloading")}},e.key))},u),(0,r.jsxs)(v.B,{gap:"$2",direction:"horizontal",css:{justifyContent:"flex-end"},children:[(0,r.jsx)(m.$,{onClick:t,children:"Cancel"}),(0,r.jsx)(m.$,{disabled:"Idle"!==l,onClick:()=>{var e;i("Downloading"),null==(e=x[0].actions.current)||e.start(),(0,K.sx)("download channel")},children:"Download"})]})]})},es=()=>(0,r.jsxs)(v.B,{gap:"$6",children:[(0,r.jsx)(_.E,{children:(0,r.jsx)(ee.P,{variant:"alert",css:{opacity:0},children:"This will download 1,000 blocks and compress them into a single ZIP file."})}),(0,r.jsx)(m.$,{disabled:!0,css:{alignSelf:"flex-end"},children:"Download"})]});(0,d.J1)(ea());let eo=e=>{let{id:n,onClose:t}=e,{open:a,onOpenChange:l}=(0,b.u)({defaultOpen:!0,onClose:t}),[{data:s,fetching:o,error:d}]=(0,i.oGB)({variables:{id:n.toString()},requestPolicy:"network-only"});if(d)throw d;let h=null==s?void 0:s.channel,u=(0,c.useRef)(null);return(0,r.jsx)(C.Dz,{open:a,onOpenChange:e=>{var n;l(e),e||null==(n=u.current)||n.abort()},children:(0,r.jsx)(C.lG,{title:"Download channel",isCloseable:!0,css:{width:375},children:(0,r.jsx)(v.B,{gap:"$6",children:o||!h?(0,r.jsx)(es,{}):(0,r.jsx)(ei,{actions:u,channel:h,onDone:t})})})})};(0,d.J1)(el());var ec=t(74349),ed=t(94026);function eh(){let e=(0,a._)(["\n fragment ChannelContextMenuChannelFragment on Channel {\n id\n href\n slug\n is_muted\n share_id\n visibility_name\n can {\n mute\n update\n export\n share\n present\n print\n }\n }\n\n query ChannelContextMenuQuery($id: ID!) {\n channel(id: $id) {\n ...ChannelContextMenuChannelFragment\n id\n }\n }\n\n mutation ChannelContextMenuMuteMutation($id: ID!) {\n mute_channel(input: { id: $id }) {\n channel {\n ...ChannelContextMenuChannelFragment\n id\n }\n }\n }\n\n mutation ChannelContextMenuUnmuteMutation($id: ID!) {\n unmute_channel(input: { id: $id }) {\n channel {\n ...ChannelContextMenuChannelFragment\n id\n }\n }\n }\n"]);return eh=function(){return e},e}let eu=()=>{let e=(0,ec.s)(),{sendToast:n,updateToast:t}=(0,x.Yf)(),{channelId:a}=(0,p.T)(),[l,s]=(0,c.useState)("Idle"),[o,d]=(0,c.useState)(!1),[{data:h}]=(0,i.Zlf)({variables:{id:a},pause:!o}),u=(0,i.vi3)()[1],m=(0,i.sF)()[1],j=async()=>{let e=n({title:"Muting"});try{let n=await u({id:a});if(n.error)throw n.error;t({...e,title:"Muted"})}catch(r){console.error(r);let n=(0,T.PE)(r);t({...e,variant:"error",title:n})}},b=async()=>{let e=n({title:"Unmuting"});try{let n=await m({id:a});if(n.error)throw n.error;t({...e,title:"Unmuted"})}catch(r){console.error(r);let n=r instanceof Error?r.message:"Unknown error.";t({...e,title:"Something went wrong",description:n})}},C=()=>{s("Idle")},y=null==h?void 0:h.channel;return y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ed.tz,{onOpenChange:d,trigger:"more",items:[...y.can.update?[{id:"edit",type:"button",icon:(0,r.jsx)(q.WhT,{}),label:"Edit",onClick:()=>s("Edit"),badge:{label:"⌘ + E",variant:"keyboard"}}]:[],...y.can.mute?[{id:y.is_muted?"unmute":"mute",type:"button",icon:y.is_muted?(0,r.jsx)(q.JT8,{}):(0,r.jsx)(q.Kr0,{}),label:y.is_muted?"Unmute":"Mute",onClick:y.is_muted?b:j}]:[],{id:"flag",type:"button",icon:(0,r.jsx)(q.W1d,{}),label:"Flag as inappropriate",onClick:()=>s("Flag")},...y.can.present?[{id:"present",variant:"secondary",type:"link",icon:(0,r.jsx)(q.udU,{}),label:"Present",href:"/".concat(y.href,"/slides"),badge:{label:"Beta",variant:"brand"}}]:[{id:"present",type:"button",icon:(0,r.jsx)(q.udU,{}),label:"Present",onClick:()=>e.open({type:"PremiumGate"}),badge:{label:"Beta",variant:"brand"},variant:"secondary"}],...y.can.export?[{id:"export",type:"button",icon:(0,r.jsx)(q.s3U,{}),label:"Download",onClick:()=>s("Export"),variant:"secondary"}]:[],...y.can.print?[{id:"print",type:"button",icon:(0,r.jsx)(q.pTT,{}),label:"Make book / PDF",onClick:()=>s("Print"),variant:"secondary"}]:[],...y.can.share?[{id:"share",type:"button",icon:(0,r.jsx)(q.qfV,{}),label:y.share_id||"PRIVATE"!==y.visibility_name?"Share link":"Generate share link",onClick:()=>s("Share"),variant:"secondary"}]:[]]}),"Edit"===l&&(0,r.jsx)(g._,{id:y.id,onClose:C}),"Flag"===l&&(0,r.jsx)(f._,{id:y.id,onClose:C,type:"Channel"}),"Share"===l&&(0,r.jsx)(D,{id:y.id,onClose:C}),"Export"===l&&(0,r.jsx)(eo,{id:y.id,onClose:C}),"Print"===l&&(0,r.jsx)(P,{slug:y.slug,onClose:C})]}):(0,r.jsx)(ed.tz,{items:[{id:"loading",type:"button",label:"Loading",disabled:!0,onClick:()=>{}}],onOpenChange:d,trigger:"more"})};(0,d.J1)(eh());var ep=t(39734),em=t(13521),ex=t(70842),eg=t(39220),ef=t(29979),ej=t(76694),eb=t(54904),eC=t(1061),ey=t(80904),e_=t(94663);function ev(){let e=(0,a._)(["\n fragment ChannelHeaderFragment on Channel {\n ...MetaTagsChannelFragment\n id\n slug\n title\n visibility_name\n href\n is_nsfw\n owner {\n __typename\n ... on User {\n id\n slug\n name\n href\n }\n ... on Group {\n id\n slug\n name\n href\n }\n }\n counts {\n collaborators\n }\n can {\n follow\n update\n }\n }\n\n query ChannelHeaderQuery($id: ID!) {\n channel(id: $id) {\n ...ChannelHeaderFragment\n }\n }\n"]);return ev=function(){return e},e}let e$=e=>{let{children:n,id:t}=e,{profileId:a,isReady:s,isShared:d}=(0,p.T)(),{handleFollow:x,label:f}=(0,ep.f)({id:t,type:"Channel"}),[{data:j,fetching:b,error:C}]=(0,i.On4)({variables:{id:t.toString()},pause:!s}),[y,_]=(0,c.useState)("Idle");(0,ef.vC)("meta+e",()=>{var e;(null==j||null==(e=j.channel)?void 0:e.can.update)&&_("Edit")});let $=(0,e_.hW)(),w=()=>{I&&($.setTerm("channel:".concat(I.slug," ")),$.focus())};(0,ef.vC)("f",e=>{e.preventDefault(),w()});let{history:k}=(0,eC.W)();if(C)throw C;let I=null==j?void 0:j.channel,E=b||!I;return(0,r.jsxs)(r.Fragment,{children:[k.length>1&&I&&(0,r.jsx)(ey.YX,{channel:I}),(0,r.jsxs)(u.Y,{children:[(0,r.jsxs)(h.Qp,{children:[(0,r.jsx)(r.Fragment,{children:E?a:(0,r.jsx)(eb.s,{slug:I.owner.slug,type:I.owner.__typename,children:(0,r.jsxs)(o(),{href:I.owner.href,children:[I.owner.name,I.counts.collaborators>0&&" (+".concat(I.counts.collaborators,")")]})})}),(0,r.jsx)(r.Fragment,{children:E?(0,r.jsx)(l.a,{css:{color:"$gray6"},children:t}):(0,r.jsxs)(l.a,{as:o(),href:I.href,css:{display:"flex",alignItems:"center",gap:"$2"},children:[(0,r.jsx)(ej.N,{visibility:I.visibility_name,level:"primary",children:I.title}),I.is_nsfw&&(0,r.jsx)(ex.E,{variant:"alert",children:"NSFW"})]})}),n]}),!d&&(0,r.jsxs)(v.B,{gap:"$1",direction:"horizontal",children:[(0,r.jsx)(eg.m_,{label:"Search this channel (f)",children:(0,r.jsx)(m.$,{"aria-label":"Search this channel",size:"icon",onClick:w,children:(0,r.jsx)(q.$p$,{})})}),I&&(0,r.jsxs)(r.Fragment,{children:[I.can.follow&&(0,r.jsx)(m.$,{disabled:b,size:"sm",onClick:x,children:f}),(0,r.jsx)(em.P,{id:I.id,type:"Channel",children:(0,r.jsxs)(m.$,{size:"sm",css:{gap:"$1"},children:["Connect ",(0,r.jsx)(q.flY,{})]})})]}),(0,r.jsx)(eu,{})]})]}),I&&"Edit"===y&&(0,r.jsx)(g._,{id:I.id,onClose:()=>_("Idle")})]})};(0,d.J1)(ev());var ew=t(80397),ek=t(88024),eI=t(1261);let eE=e=>{let{children:n,id:t,name:a}=e;return(0,r.jsxs)(ek.Y,{children:[(0,r.jsx)(e$,{id:t,children:a}),(0,r.jsx)(eI.h,{y:["$4","$7"]}),(0,r.jsx)(ew.F_,{id:t}),(0,r.jsx)(eI.h,{y:["$6","$8"]}),n]})}}}]);