"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8261],{547:(e,n,t)=>{t.d(n,{x:()=>c});var i=t(37876),r=t(14232),l=t(89572),a=t(58772),o=t(93026),s=t(93801);let c=e=>{let{children:n,css:t}=e,o=(0,r.useRef)(null),[c,h]=(0,r.useState)(0),[g,p]=(0,r.useState)(0);(0,s.w)({target:o,onResize:()=>{if(!o.current)return;let e=o.current.scrollWidth-o.current.offsetWidth;if(e<=0){h(0),p(0),x("Pending");return}h(e),p(e),x("Animating")}});let[f,x]=(0,r.useState)("Pending"),_=(0,r.useMemo)(()=>{if("Pending"===f)return"none";if("Animating"===f)return"both";if("Paused"===f)if(0===g)return"right";else return"left";return"both"},[f,g]);return(0,i.jsxs)(d,{css:t,children:[(0,i.jsx)(l.a,{ref:o,css:{display:"flex"},style:{transform:"translateX(-".concat(g,"px)"),transition:"transform ".concat(33*c,"ms linear")},onTransitionEnd:async()=>{x("Paused"),await (0,a.u)(2e3),x("Animating"),p(e=>0===e?c:0)},children:n}),"Pending"!==f&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(u,{style:{opacity:+("both"===_||"left"===_)}}),(0,i.jsx)(m,{style:{opacity:+("both"===_||"right"===_)}})]})]})},d=(0,o.pH)("div",{position:"relative",whiteSpace:"nowrap",width:"100%",overflow:"hidden"}),u=(0,o.pH)("div",{position:"absolute",top:0,left:0,width:"$2",height:"100%",background:"linear-gradient(to right, $background 0%, transparent 100%)",pointerEvents:"none",transition:"opacity 200ms ease-out"}),m=(0,o.pH)("div",{position:"absolute",top:0,right:0,width:"$2",height:"100%",background:"linear-gradient(to left, $background 0%, transparent 100%)",pointerEvents:"none",transition:"opacity 200ms ease-out"})},1623:(e,n,t)=>{t.d(n,{HX:()=>c,PE:()=>u,_Z:()=>d});var i=t(21071);let r=async e=>{let n=await fetch(e);if(!n.ok)throw Error("Failed to fetch ".concat(e,": ").concat(n.statusText));return new Uint8Array(await n.arrayBuffer())},l=async e=>{let n=await fetch(e);if(!n.ok)throw Error("Failed to fetch ".concat(e,": ").concat(n.statusText));return await n.blob()},a=e=>'\n\n\n\n URL\n '.concat(e,"\n\n"),o=async e=>{switch(e.typename){case"Attachment":case"Image":return await r(e.url);case"Embed":case"Link":return new TextEncoder().encode(a(e.url));case"Text":return new TextEncoder().encode(e.content)}},s=()=>new TextEncoder().encode("Failed to fetch"),c=async e=>{switch(e.typename){case"Attachment":case"Image":return await l(e.url);case"Embed":case"Link":return new Blob([a(e.url)],{type:"application/octet-stream"});case"Text":return new Blob([e.content],{type:"text/plain"})}},d=async(e,n)=>{let{onProgress:t,onZip:r}=n;if(0===e.length)throw Error("No inputs provided");return new Promise(async(n,l)=>{let a=0,c=Object.assign({},...await Promise.all(e.map(async n=>{try{let i=await o(n);return t(++a/e.length*100),{[n.filename]:i}}catch(e){return{["".concat(n.filename,"_error.txt")]:s()}}})));r(),(0,i.yU)(c,{level:6},(e,t)=>{e?l(e):n(new Blob([t],{type:"application/zip"}))})})},u=async(e,n)=>{let t=URL.createObjectURL(n),i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}},1640:(e,n,t)=>{t.d(n,{JJ:()=>x,SZ:()=>_,j7:()=>f});var i=t(28888),r=t(37876),l=t(89572),a=t(93578),o=t(5336),s=t(14232),c=t(86355),d=t(93026),u=t(29332),m=t(84147),h=t(6547),g=t(64206);function p(){let e=(0,i._)(["\n fragment BlockTextFragment on Text {\n id\n content(format: HTML)\n can {\n manage\n }\n sub_type {\n __typename\n ... on HexColor {\n value\n }\n }\n }\n"]);return p=function(){return e},e}let f=e=>{let{text:n}=e,{setNavigationState:t}=(0,u.lA)(),i=(0,s.useMemo)(()=>{var e;return(null==(e=n.sub_type)?void 0:e.__typename)==="HexColor"?(0,r.jsx)(l.a,{css:{width:"100%",minHeight:"100%",borderRadius:"$1",p:"$2","@bp1":{p:"$1"}},style:{backgroundColor:n.sub_type.value},children:(0,r.jsx)(g.C,{size:"sm",css:{p:"$1 $2",display:"inline-block"},children:n.sub_type.value})}):(0,r.jsx)(_,{size:"md",dangerouslySetInnerHTML:{__html:n.content}})},[n]);return(0,r.jsx)(l.a,{css:{display:"flex",minHeight:"100%",p:"$4","@bp1":{p:"$2"}},children:n.can.manage?(0,r.jsx)(m.D,{css:{width:"100%"},onClick:()=>{t({mode:"Edit",intent:"content"})},children:(0,r.jsx)(l.a,{onClick:h.D,css:{width:"100%",height:"100%"},children:i})}):i})};(0,c.J1)(p());let x="88ch",_=(0,d.pH)(o.E,{p:"$5",width:x,maxWidth:"100%",mx:"auto",minHeight:"100%",color:"$gray6",border:"1px solid $gray2",overflowX:"auto","-webkit-overflow-scrolling":"touch","@bp1":{p:"$2"},...a.gO})},2751:(e,n,t)=>{t.d(n,{s:()=>u});var i=t(37876),r=t(89572),l=t(76841),a=t(5336),o=t(547),s=t(77680),c=t(27079),d=t(94026);let u=e=>{let{url:n,additionalOptions:t}=e,{copy:u}=(0,c.i)();return(0,i.jsxs)(r.a,{css:{display:"flex",flexShrink:0,py:"$1",px:"$2",border:"1px solid $gray2",borderRadius:"$1",alignItems:"center",gap:"$2",color:"$gray5","&:hover":{textDecoration:"underline"}},children:[(0,i.jsx)(d.tz,{trigger:(0,i.jsx)(l.$,{size:"icon",children:(0,i.jsx)(s.fCU,{})}),items:[{id:"open-in-new-tab",type:"link",icon:(0,i.jsx)(s.Ngv,{}),label:"Open in new tab",href:n,target:"_blank",rel:"noopener noreferrer"},{id:"copy-url",type:"button",icon:(0,i.jsx)(s.DDb,{}),label:"Copy URL",onClick:()=>{n&&u(n)}},...t||[]]}),(0,i.jsxs)(r.a,{as:"a",href:n,target:"_blank",rel:"noopener noreferrer",css:{display:"flex",flex:1,gap:"$2",justifyContent:"space-between",textDecoration:"none",color:"currentColor",fontWeight:"bold",minWidth:0},children:[(0,i.jsx)(o.x,{children:(0,i.jsx)(a.E,{size:"xs",children:n})}),(0,i.jsx)(s.Ngv,{})]})]})}},6547:(e,n,t)=>{t.d(n,{D:()=>i});let i=e=>{e.target instanceof HTMLElement&&e.target.closest("a")&&e.stopPropagation()}},9021:(e,n,t)=>{t.d(n,{S:()=>c,v:()=>d});var i=t(28888),r=t(37876),l=t(41058),a=t(39220),o=t(86355);function s(){let e=(0,i._)(['\n fragment BlockMetadataDefinitionListFragment on Konnectable {\n __typename\n ... on Model {\n id\n created_at(relative: true)\n created_at_timestamp: created_at(format: "%b %e, %Y, %l:%M %p %Z")\n updated_at(relative: true)\n updated_at_timestamp: updated_at(format: "%b %e, %Y, %l:%M %p %Z")\n }\n ... on ConnectableInterface {\n user {\n id\n name\n href\n }\n source {\n title\n url\n }\n }\n ... on PendingBlock {\n remote_source_url\n }\n ... on Image {\n original_dimensions {\n width\n height\n }\n }\n ... on Attachment {\n file_url\n file_size\n file_extension\n file_content_type\n }\n }\n']);return s=function(){return e},e}let c=e=>{let{block:n}=e;return(0,r.jsx)(l.u,{definitions:[{term:"Added",description:(0,r.jsx)(a.m_,{label:n.created_at_timestamp,children:(0,r.jsx)("div",{children:n.created_at})})},...n.created_at!==n.updated_at?[{term:"Modified",description:(0,r.jsx)(a.m_,{label:n.updated_at_timestamp,children:(0,r.jsx)("div",{children:n.updated_at})})}]:[],...n.user?[{term:"By",description:n.user.name,href:n.user.href}]:[],..."PendingBlock"===n.__typename&&n.remote_source_url?[{term:"Source",description:n.remote_source_url,href:n.remote_source_url}]:[],...n.source&&n.source.url&&n.source.title?[{term:"Source",description:n.source.title,href:n.source.url}]:[],..."Image"===n.__typename&&n.original_dimensions&&n.original_dimensions.width&&n.original_dimensions.height?[{term:"Dimensions",description:"".concat(n.original_dimensions.width," \xd7 ").concat(n.original_dimensions.height)}]:[],..."Attachment"===n.__typename&&n.file_size&&n.file_content_type&&n.file_url&&n.file_extension?[{term:"Content Type",description:n.file_content_type},{term:"File Size",description:n.file_size},{term:"Download",description:"Download .".concat(n.file_extension),href:n.file_url}]:[]]})},d=()=>(0,r.jsx)(l.f,{length:4});(0,o.J1)(s())},24973:(e,n,t)=>{t.d(n,{LG:()=>G,IG:()=>Z,eQ:()=>Q});var i=t(28888),r=t(37876),l=t(86355),a=t(14905),o=t(89572),s=t(87479),c=t(64445),d=t(14232);function u(){let e=(0,i._)(["\n fragment BlockResizedImageFragment on ResizedImage {\n id\n alt_text\n original_url\n blurhash\n block_resized_image: resized(width: 1200, height: 1200, quality: 75) {\n id\n width\n height\n src_1x\n src_2x\n }\n }\n"]);return u=function(){return e},e}let m=e=>{let{resizedImage:n}=e,[t,i]=(0,d.useState)("Idle"),l=()=>{i("Drag")};if(!n.block_resized_image||!n.original_url)return null;let a="Drag"===t?[n.original_url]:[n.block_resized_image.src_1x,n.block_resized_image.src_2x];return n.block_resized_image.width&&n.block_resized_image.height?(0,r.jsx)(o.a,{onMouseDown:l,css:{display:"block",p:"$2",width:"100%",height:"100%","@bp1":{p:0}},children:(0,r.jsx)(c.h,{aspectWidth:n.block_resized_image.width,aspectHeight:n.block_resized_image.height,maxWidth:n.block_resized_image.width,maxHeight:n.block_resized_image.height,css:{bg:"$gray2"},children:(0,r.jsx)(s.H,{indicator:!0,blurhash:n.blurhash,srcs:a,width:"100%",height:"100%",alt:n.alt_text||""},n.block_resized_image.id)})}):(0,r.jsx)(o.a,{onMouseDown:l,css:{display:"block",p:"$2",width:"100%",height:"100%","@bp1":{p:0}},children:(0,r.jsx)(s.H,{indicator:!0,srcs:a,width:"100%",height:"100%",alt:"",css:{objectFit:"scale-down"}},n.block_resized_image.id)})};function h(){let e=(0,i._)(["\n fragment BlockImageFragment on Image {\n id\n resized_image {\n ...BlockResizedImageFragment\n original_url\n id\n }\n }\n"]);return h=function(){return e},e}(0,l.J1)(u());let g=e=>{let{image:n}=e;return n.resized_image?(0,r.jsx)(o.a,{as:"a",href:n.resized_image.original_url,target:"_blank",children:(0,r.jsx)(m,{resizedImage:n.resized_image})}):null};(0,l.J1)(h());var p=t(29332),f=t(41534),x=t(10731),_=t(93578),b=t(87303),j=t(5336),k=t(52001),y=t(60513);function w(){let e=(0,i._)(["\n fragment BlockReaderFragment on Link {\n __typename\n id\n canonical_link {\n id\n title\n provider_name\n provider_url\n content\n state\n }\n }\n\n query BlockReaderQuery($id: ID!) {\n link: blokk(id: $id) {\n ...BlockReaderFragment\n }\n }\n"]);return w=function(){return e},e}function v(){let e=(0,i._)(["\n mutation BlockReaderRegenerateCanonicalLinkMutation($id: ID!) {\n regenerate_canonical_link(input: { block_id: $id }) {\n blokk {\n ...BlockReaderFragment\n }\n }\n }\n"]);return v=function(){return e},e}let $=e=>{let{id:n}=e,[{data:t,fetching:i,error:l}]=(0,a.AQ4)({variables:{id:n.toString()},requestPolicy:"network-only"}),{sendToast:o,sendGenericError:s}=(0,k.Yf)(),[c,d]=(0,a.lQb)(),u=async()=>{try{await d({id:n.toString()}),o({title:"Extracting text",description:"We're extracting the text from this link. It should be ready in a few seconds."})}catch(e){s(e)}};if(l)throw l;if(i||!(null==t?void 0:t.link))return(0,r.jsx)(B,{});if("Link"!==t.link.__typename)return null;let{link:m,link:{canonical_link:h}}=t;if(!h)return(0,r.jsx)(M,{id:m.id});let g=C.parse(h.state);switch(g){case"pending":return(0,r.jsx)(M,{id:m.id});case"remote_processing":return(0,r.jsx)(F,{id:m.id});case"failed":return(0,r.jsx)(x.P,{variant:"alert",actions:[{label:"Extract content from link",onClick:u}],children:"It looks like the last time we tried extracting content the process failed. Do you want to try extracting the content again?"});case"available":return(0,r.jsx)(b.B,{gap:"$4",css:{"@bp1":{gap:"$2",border:"1px solid $gray2",p:"$2"}},children:h.content?(0,r.jsx)(j.E,{size:"lg",css:{maxWidth:"80ch",mx:"auto",fontFamily:"$serif"},children:(0,r.jsxs)(b.B,{gap:"$4",css:{mx:"auto"},children:[(0,r.jsxs)(b.B,{gap:"$1",children:[h.title&&(0,r.jsx)(j.E,{size:"xl",css:{fontFamily:"$serif"},children:h.title}),h.provider_name&&h.provider_url&&(0,r.jsx)(j.E,{as:"a",size:"xs",css:{color:"$slate"},href:h.provider_url,target:"_blank",rel:"noopener noreferrer",children:h.provider_name})]}),(0,r.jsx)(j.E,{as:_.g3,size:"lg",css:{fontFamily:"$serif"},dangerouslySetInnerHTML:{__html:h.content}})]})}):(0,r.jsx)(x.P,{variant:"alert",children:"We were unable to extract content."})});default:return(0,r.jsx)(r.Fragment,{children:g})}};(0,l.J1)(w());let C=y.z.enum(["remote_processing","available","failed","pending"]),B=e=>{let{children:n}=e;return(0,r.jsx)(x.P,{variant:"loading",children:null!=n?n:"Loading"})},M=e=>{let{id:n}=e,[t,i]=(0,d.useState)("Idle"),l=(0,d.useRef)(!1),[o,s]=(0,a.lQb)();(0,d.useEffect)(()=>{l.current||(s({id:n.toString()}),i("Pending"),l.current=!0)},[n,s]);let[{fetching:c},u]=(0,a.AQ4)({variables:{id:n.toString()},requestPolicy:"network-only",pause:!0});return(0,f.n)({fetching:c,refetch:u,pause:"Idle"===t}),(0,r.jsx)(B,{children:"Extracting text"})};(0,l.J1)(v());let F=e=>{let{id:n}=e,[{fetching:t},i]=(0,a.AQ4)({variables:{id:n.toString()},requestPolicy:"network-only",pause:!0});return(0,f.n)({fetching:t,refetch:i}),(0,r.jsx)(B,{children:"Extracting text"})};var E=t(62610),z=t(1261),I=t(77680),S=t(29979),D=t(2751);function L(){let e=(0,i._)(["\n fragment BlockLinkFragment on Link {\n id\n source_url\n resized_image {\n ...BlockResizedImageFragment\n id\n }\n }\n"]);return L=function(){return e},e}let P=e=>{let{link:n}=e,{mode:t}=(0,p.lA)(),[i,l]=(0,d.useState)("Default"),a=()=>{l(e=>"Default"===e?"Iframe":"Default")};return(0,S.vC)("i",a),(0,r.jsxs)(o.a,{css:{display:"flex",flex:1,width:"100%",height:"100%",flexDirection:"column",p:"$2","@bp1":{p:"$1"}},children:[n.source_url&&(0,r.jsx)(D.s,{url:n.source_url,additionalOptions:[{id:"iframe",type:"button",icon:(0,r.jsx)(I.H0W,{}),label:"Iframe"===i?"Close IFrame":"Load in IFrame",onClick:a,badge:{label:"I",variant:"keyboard"}}]}),"Default"===i?(0,r.jsx)(r.Fragment,{children:"Reader"===t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z.h,{y:["$1","$5"]}),(0,r.jsx)(E.j,{children:(0,r.jsx)($,{id:n.id})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z.h,{y:"$2"}),n.resized_image&&(0,r.jsx)(o.a,{...n.source_url?{as:"a",href:n.source_url,target:"_blank",rel:"noopener noreferrer"}:{},css:{width:"100%",height:"100%"},children:(0,r.jsx)(m,{resizedImage:n.resized_image})})]})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z.h,{y:"$2"}),n.source_url&&(0,r.jsx)(o.a,{as:"iframe",src:n.source_url,css:{width:"100%",height:"100%"}})]})]})};(0,l.J1)(L());var T=t(1640);function R(){let e=(0,i._)(["\n fragment BlockEmbedFragment on Embed {\n id\n embed_html\n embed_width\n embed_height\n }\n"]);return R=function(){return e},e}let H=e=>{let{embed:n}=e;return n.embed_html&&n.embed_width&&n.embed_height?(0,r.jsx)(o.a,{css:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center",p:"$4","@bp1":{p:"$2"}},children:(0,r.jsx)(c.h,{aspectWidth:n.embed_width,aspectHeight:n.embed_height,maxWidth:4e3,maxHeight:4e3,children:(0,r.jsx)(o.a,{dangerouslySetInnerHTML:{__html:n.embed_html},css:{width:"100%",height:"100%",iframe:{width:"100%",height:"100%"}}})})}):null};function A(){let e=(0,i._)(["\n fragment BlockAttachmentFragment on Attachment {\n id\n title\n file_url\n file_size\n file_extension\n file_content_type\n }\n"]);return A=function(){return e},e}(0,l.J1)(R());let J=e=>{let{attachment:n}=e;if(!n.file_url)return null;switch(n.file_content_type){case"application/pdf":return(0,r.jsx)(o.a,{css:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center",flexDirection:"column",p:"$5","@bp1":{p:0}},children:(0,r.jsx)("iframe",{src:n.file_url,width:"100%",height:"100%",allowFullScreen:!0})});case"audio/mpeg":return(0,r.jsx)(o.a,{css:{height:"100%",width:"100%",p:"$5",bg:"$gray1",display:"flex",flexDirection:"column",gap:"$2"},children:(0,r.jsx)(o.a,{as:"audio",controls:!0,src:n.file_url,css:{width:"100%",m:"auto"}})});case"video/mp4":case"video/quicktime":return(0,r.jsx)(o.a,{css:{height:"100%",width:"100%",p:"$5",bg:"$gray1",display:"flex",flexDirection:"column",gap:"$2"},children:(0,r.jsx)(o.a,{as:"video",controls:!0,src:n.file_url,css:{m:"auto",width:"100%",height:"auto",maxHeight:"100%"}})});default:return(0,r.jsx)(o.a,{css:{width:"100%",height:"100%",bg:"$gray1",p:"$5"},children:(0,r.jsxs)(x.P,{actions:[{label:"Download",href:n.file_url,target:"_blank"}],children:["Unable to preview ",n.title]})})}};(0,l.J1)(A());var O=t(78085),U=t(13107);function W(){let e=(0,i._)(['\n fragment BlockPendingBlockFragment on PendingBlock {\n id\n created_at(relative: true)\n iso_created_at: created_at(format: "%Y-%m-%dT%H:%M:%S.%LZ")\n remote_source_url\n }\n']);return W=function(){return e},e}let q=e=>{let{pending:n}=e,[{fetching:t},i]=(0,a.noG)({variables:{id:n.id.toString()},pause:!0}),{isStale:l}=(0,O.g)({fetching:t,isoTimestamp:n.iso_created_at,refetch:i});return(0,r.jsx)(o.a,{css:{width:"100%",height:"100%",bg:"$gray1",p:"$4","@bp1":{p:"$2"}},children:l?(0,r.jsxs)(b.B,{gap:"$2",children:[n.remote_source_url&&(0,r.jsx)(x.P,{children:(0,r.jsx)("a",{href:n.remote_source_url,target:"_blank",rel:"noopener noreferrer",children:n.remote_source_url})}),(0,r.jsx)(x.P,{variant:"alert",children:(0,r.jsxs)(b.B,{gap:"$2",direction:"horizontal",children:["Created ",n.created_at,". Failed to process."]})})]}):(0,r.jsxs)(x.P,{variant:"loading",children:["Processing"," ",(0,U.xv)(n.remote_source_url,{length:25,from:"center"})]})})};(0,l.J1)(W());var N=t(57175);function K(){let e=(0,i._)(["\n fragment BlockRepresentationFragment on Konnectable {\n ...BlockPendingBlockFragment\n ...BlockImageFragment\n ...BlockLinkFragment\n ...BlockTextFragment\n ...BlockEmbedFragment\n ...BlockAttachmentFragment\n __typename\n ... on Model {\n id\n }\n }\n"]);return K=function(){return e},e}function Y(){let e=(0,i._)(["\n query BlockRepresentationQuery($id: ID!) {\n block: blokk(id: $id) {\n ...BlockRepresentationFragment\n ... on Model {\n id\n }\n }\n }\n"]);return Y=function(){return e},e}let G=e=>{let{block:n}=e;switch(n.__typename){case"PendingBlock":return(0,r.jsx)(q,{pending:n});case"Text":return(0,r.jsx)(T.j7,{text:n});case"Link":return(0,r.jsx)(P,{link:n});case"Image":return(0,r.jsx)(g,{image:n});case"Embed":return(0,r.jsx)(H,{embed:n});case"Attachment":return(0,r.jsx)(J,{attachment:n});default:return null}},Q=()=>(0,r.jsx)(N.Z,{css:{width:"100%",height:"100%",color:"$gray2"}});(0,l.J1)(K());let Z=e=>{let{id:n}=e,[{data:t,error:i,fetching:l}]=(0,a.KWF)({variables:{id:n.toString()}});if(i)throw i;let o=null==t?void 0:t.block;return l||!o?(0,r.jsx)(Q,{}):(0,r.jsx)(G,{block:o})};(0,l.J1)(Y())},29332:(e,n,t)=>{t.d(n,{eB:()=>eO,VL:()=>eQ,Ne:()=>eW,Ru:()=>eU,lA:()=>eZ});var i=t(28888),r=t(37876),l=t(14905),a=t(14232),o=t(86355),s=t(1261),c=t(10120),d=t(5336),u=t(87303);let m=(e,n)=>e?e.reduce((e,t)=>((e[t[n]]=e[t[n]]||[]).push(t),e),{}):{},h=(e,n)=>(0,a.useMemo)(()=>Object.entries(m(e,n)),[e,n]);var g=t(84147),p=t(54761),f=t(89099),x=t(89572),_=t(77152),b=t(48230),j=t.n(b),k=t(10731),y=t(38652);function w(){let e=(0,i._)(["\n query BlockMetadataUrlConnectionsQuery($id: ID!) {\n block: blokk(id: $id) {\n ...BlockMetadataUrlConnectionsFragment\n ... on Model {\n id\n }\n }\n }\n\n fragment BlockMetadataUrlConnectionsFragment on Block {\n channels_with_same_source(per: 5) {\n ...ChannelCompactFragment\n id\n }\n }\n"]);return w=function(){return e},e}let v=e=>{let{block:n}=e;return 0===n.channels_with_same_source.length?null:(0,r.jsxs)(u.B,{gap:"$1",children:[(0,r.jsx)(d.E,{size:"xs",css:{color:"$link"},children:"Blocks with this URL also appear in"}),(0,r.jsx)(u.B,{gap:"$2",children:n.channels_with_same_source.map(e=>(0,r.jsx)(c.H,{channel:e,hoverCard:"left"},e.id))})]})};(0,o.J1)(w());let $=e=>{let{id:n}=e,{ref:t,isIntersecting:i}=(0,y.B)({rootMargin:"100px",freezeOnceVisible:!0}),[{data:a,error:o}]=(0,l.Sfn)({variables:{id:n.toString()},pause:!i});return o?(console.error(o),null):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.a,{ref:t,css:{position:"absolute",bottom:0,left:0}}),i&&(a&&a.block&&"channels_with_same_source"in a.block?(0,r.jsx)(v,{block:a.block}):null)]})};function C(){let e=(0,i._)(['\n fragment BlockMetadataConnectionsFragment on Konnectable {\n ... on Model {\n id\n }\n ... on ConnectableInterface {\n href\n my_connections: connections(filter: OWN) {\n id\n created_at(format: "%B %Y")\n channel {\n ...ChannelCompactFragment\n id\n slug\n }\n }\n public_connections: connections(\n page: 1\n per: 20\n direction: DESC\n filter: EXCLUDE_OWN\n ) {\n id\n created_at(format: "%B %Y")\n channel {\n ...ChannelCompactFragment\n id\n slug\n }\n }\n }\n }\n']);return C=function(){return e},e}function B(){let e=(0,i._)(["\n query BlockMetadataConnectionsQuery($id: ID!) {\n block: blokk(id: $id) {\n ...BlockMetadataConnectionsFragment\n ... on Model {\n id\n }\n }\n }\n"]);return B=function(){return e},e}let M=e=>{var n,t;let{block:i}=e,{pathname:l,query:{channelId:a}}=(0,f.useRouter)(),o=h(i.my_connections,"created_at"),s=h(i.public_connections,"created_at");return(null==(n=i.my_connections)?void 0:n.length)===0&&(null==(t=i.public_connections)?void 0:t.length)===0?(0,r.jsx)(k.P,{children:"Nothing yet."}):(0,r.jsx)(u.B,{gap:"$6",children:[["Your connections",o],["All connections",s]].map(e=>{let[n,t]=e;return 0===t.length?null:(0,r.jsx)(u.B,{gap:"$6",children:t.map((e,t)=>{let[o,s]=e;return(0,r.jsxs)(u.B,{gap:"$1",children:[(0,r.jsxs)(x.a,{css:{display:"flex",justifyContent:"space-between"},children:[0===t?(0,r.jsx)(d.E,{as:j(),href:"".concat(i.href,"/connections"),size:"xs",css:{color:"$link"},children:n}):(0,r.jsx)("div",{}),(0,r.jsx)(d.E,{size:"xs",css:{color:"$gray5"},children:o})]}),(0,r.jsx)(u.B,{gap:"$2",children:s.map(e=>{let{channel:n}=e;return"/[profileId]/[channelId]"===l&&n.id.toString()===(null==a?void 0:a.toString())?(0,r.jsx)(p.eB.bm,{asChild:!0,children:(0,r.jsx)(g.D,{children:(0,r.jsx)(c.H,{channel:n,inert:!0},n.id)})},n.id):(0,r.jsx)(c.H,{channel:n,hoverCard:"left"},n.id)})})]},o)})},n)})})},F=()=>(0,r.jsxs)(u.B,{gap:"$1",children:[(0,r.jsxs)(x.a,{css:{display:"flex",justifyContent:"space-between"},children:[(0,r.jsx)(d.E,{size:"xs",css:{color:"$link"},children:"All connections"}),(0,r.jsx)(_.r,{size:"xs",children:"January 2000"})]}),(0,r.jsx)(u.B,{gap:"$2",children:Array.from({length:3}).map((e,n)=>(0,r.jsx)(c.K,{length:[10,13,7,20][n%4]},n))})]});(0,o.J1)(C());let E=e=>{let{id:n}=e,[{data:t,fetching:i,error:a}]=(0,l.hzB)({variables:{id:n.toString()}});return a?(console.error(a),null):!i&&t&&t.block&&t.block.my_connections?(0,r.jsxs)(u.B,{gap:"$6",css:{position:"relative"},children:[(0,r.jsx)(M,{block:t.block}),(0,r.jsx)($,{id:t.block.id})]}):(0,r.jsx)(F,{})};(0,o.J1)(B());var z=t(18570),I=t(76841),S=t(93578),D=t(947),L=t(11891),P=t(18847);let T=t.n(P)()(()=>Promise.all([t.e(5352),t.e(6361),t.e(3742),t.e(1462)]).then(t.bind(t,1462)).then(e=>e.Editor),{loadableGenerated:{webpack:()=>[1462]},ssr:!1,loading:()=>(0,r.jsx)(L.ue,{css:{height:"$11"}})}),R=e=>(0,r.jsx)(S.g3,{css:{bg:"$gray1",borderRadius:"$1",minHeight:"$11",".tiptap":{...D.MI,...d.X.md,p:"$2",minHeight:"$11","p.is-editor-empty:first-child::before":{color:"$slate",content:"attr(data-placeholder)",float:"left",height:0,pointerEvents:"none"},"&:hover, &:focus":{"p.is-editor-empty:first-child::before":{color:"$gray6"}},"blockquote, pre, code, hr":{mixBlendMode:"$colors$blend"},"pre code":{mixBlendMode:"normal"}}},children:(0,r.jsx)(T,{...e})});var H=t(52001);let A=e=>{let n=(0,a.useRef)(null);return(0,a.useLayoutEffect)(()=>{n.current=e}),(0,a.useCallback)(()=>{var e;return null==(e=n.current)?void 0:e.call(n)},[])};function J(){let e=(0,i._)(["\n mutation BlockMetadataCommentsNewMutation(\n $input: CreateCommentMutationInput!\n ) {\n create_comment(input: $input) {\n comment {\n id\n commentable {\n ...BlockMetadataCommentsFragment\n ... on Model {\n id\n }\n ... on Block {\n counts {\n comments\n }\n }\n }\n }\n }\n }\n"]);return J=function(){return e},e}let O=e=>{let{id:n}=e,{sendGenericError:t}=(0,H.Yf)(),[i,o]=(0,l.dvb)(),[s,c]=(0,a.useState)(""),[d,m]=(0,a.useState)("Idle"),h=""===s.trim(),g=A(async()=>{var e;if(h||"Submitting"===d||!(null==(e=p.current)?void 0:e.editor))return;let{editor:i}=p.current;m("Submitting");try{let e=await o({input:{block_id:n.toString(),body:s}});if(e.error)throw e.error;i.commands.clearContent(!0)}catch(e){t(e)}m("Idle")}),p=(0,a.useRef)(null);return(0,r.jsxs)(u.B,{gap:"$2",children:[(0,r.jsx)(R,{editorRef:p,placeholder:"Add new comment",onChange:e=>{c(e)},onSubmit:g}),(0,r.jsx)(I.$,{disabled:h||"Submitting"===d,onClick:g,css:{alignSelf:"flex-end"},children:{Idle:"Add comment",Submitting:"Adding…"}[d]})]})};(0,o.J1)(J());var U=t(39706),W=t(5301),q=t(94026),N=t(39220),K=t(77680);function Y(){let e=(0,i._)(['\n fragment BlockMetadataCommentFragment on Comment {\n id\n created_at(relative: true)\n created_at_timestamp: created_at(format: "%b %e, %Y, %l:%M %p %Z")\n body(format: HTML)\n user {\n id\n name\n href\n }\n can {\n destroy\n }\n }\n\n mutation BlockMetadataCommentDeleteMutation($id: ID!) {\n delete_comment(input: { id: $id }) {\n commentable {\n ...BlockMetadataCommentsFragment\n ... on Model {\n id\n }\n ... on Block {\n counts {\n comments\n }\n }\n }\n }\n }\n']);return Y=function(){return e},e}let G=e=>{let{comment:n}=e,[t,i]=(0,a.useState)("Idle"),{sendToast:o,sendGenericError:s}=(0,H.Yf)(),[c,m]=(0,l.nP7)(),h=async()=>{i("Deleting");try{let e=await m({id:n.id.toString()});if(e.error)throw e.error;o({title:"Comment deleted"})}catch(e){s(e)}i("Idle")};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(u.B,{gap:"$1",children:[n.user&&(0,r.jsxs)(x.a,{css:{position:"relative",display:"flex",justifyContent:"space-between"},children:[(0,r.jsxs)(u.B,{direction:"horizontal",gap:"$1",css:{pr:"$5"},children:[(0,r.jsx)(d.E,{as:j(),href:n.user.href,size:"xs",css:{flexShrink:0,color:"$link",fontWeight:"bold"},children:n.user.name}),(0,r.jsx)(N.m_,{label:n.created_at_timestamp,children:(0,r.jsx)(d.E,{size:"xs",ellipsis:!0,css:{color:"$slate"},children:n.created_at})})]}),n.can.destroy&&(0,r.jsx)(q.tz,{trigger:(0,r.jsx)(I.$,{size:"icon",css:{position:"absolute",top:0,right:0},children:(0,r.jsx)(K.Oer,{"aria-label":"More Actions"})}),items:[{id:"delete",type:"button",label:"Delete",onClick:()=>{i("Confirm")}}]})]}),(0,r.jsx)(d.E,{size:"sm",css:{color:"$link"},hyphenate:!0,children:(0,r.jsx)(S.g3,{dangerouslySetInnerHTML:{__html:n.body}})})]}),(0,r.jsx)(W.T,{open:"Idle"!==t,onCancel:()=>{i("Idle")},onConfirm:h,action:"Deleting"===t?(0,r.jsx)(I.$,{disabled:!0,children:"Deleting..."}):(0,r.jsx)(I.$,{children:"Confirm"})})]})};(0,o.J1)(Y());let Q=e=>{let{i:n}=e;return(0,r.jsxs)(u.B,{gap:"$1",children:[(0,r.jsxs)(u.B,{direction:"horizontal",gap:"$2",children:[(0,r.jsx)(_.r,{size:"xs",css:{color:"$foreground"},children:["Pierre Marteau","Peter Hammer","Jacques le Sincere"][n%3]}),(0,r.jsx)(_.r,{size:"xs",css:{color:"$gray8"},children:"0 days ago"})]}),(0,r.jsx)(_.r,{size:"sm",children:"Lorem ipsum dolor sit amet consectetur adipisicing elit."})]})};function Z(){let e=(0,i._)(["\n fragment BlockMetadataCommentsFragment on Block {\n ... on Model {\n id\n }\n can {\n comment\n }\n comments(direction: ASC) {\n ...BlockMetadataCommentFragment\n id\n }\n }\n"]);return Z=function(){return e},e}function X(){let e=(0,i._)(["\n query BlockMetadataCommentsQuery($id: ID!) {\n block: blokk(id: $id) {\n __typename\n ...BlockMetadataCommentsFragment\n ... on Model {\n id\n }\n }\n }\n"]);return X=function(){return e},e}let V=e=>{let{block:n}=e;return 0!==n.comments.length||n.can.comment?(0,r.jsxs)(u.B,{gap:"$4",children:[n.comments.map(e=>(0,r.jsx)(G,{comment:e},e.id)),n.can.comment&&(0,r.jsxs)(u.B,{gap:"$2",children:[n.comments.length>0&&(0,r.jsx)(U.w,{}),(0,r.jsx)(O,{id:n.id})]})]}):(0,r.jsx)(k.P,{children:"Nothing yet."})};(0,o.J1)(Z());let ee=()=>(0,r.jsx)(u.B,{gap:"$5",children:[,,,].fill(null).map((e,n)=>(0,r.jsx)(Q,{i:n},n))}),en=e=>{let{id:n}=e,[{data:t,fetching:i,error:a}]=(0,l.o_6)({variables:{id:n}});return a?(console.error(a),null):!i&&t&&t.block?"Channel"===t.block.__typename?null:(0,r.jsx)(V,{block:t.block}):(0,r.jsx)(ee,{})};(0,o.J1)(X());var et=t(13521),ei=t(15333),er=t(10963),el=t(64281),ea=t(78085),eo=t(65074),es=t(1623);function ec(){let e=(0,i._)(["\n fragment UseDownloadFragment on Konnectable {\n ... on Model {\n id\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 original_content: 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"]);return ec=function(){return e},e}let ed=e=>{let{block:n}=e,{isLoggedIn:t}=(0,eo.Jd)(),{sendToast:i,sendGenericError:r,updateToast:l,retractToast:a}=(0,H.Yf)();return{handleDownload:async()=>{if(t&&n)try{let e=i({title:"Preparing download"}),t=(()=>{switch(n.__typename){case"Attachment":if(!n.file_url)return null;return{typename:"Attachment",url:n.file_url,filename:"".concat(n.file_name,".").concat(n.file_extension)};case"Image":if(!n.image_url)return null;return{typename:"Image",url:n.image_url,filename:"".concat(n.file_name,".").concat(n.file_extension)};case"Text":return{typename:"Text",content:n.original_content,filename:"".concat(n.file_name,".txt")};case"Link":if(!n.source_url)return null;return{typename:"Link",url:n.source_url,filename:"".concat(n.file_name,".webloc")};case"Embed":if(!n.source_url)return null;return{typename:"Embed",url:n.source_url,filename:"".concat(n.file_name,".webloc")};default:return null}})();if(!t)return;let r=await (0,es.HX)(t);(0,es.PE)(t.filename,r),l({...e,title:"Downloading..."}),a(e.id,1e3)}catch(e){r(e)}}}};(0,o.J1)(ec());var eu=t(10394),em=t(74349);function eh(){let e=(0,i._)(['\n fragment BlockMetadataContextMenuFragment on Konnectable {\n ...UseDownloadFragment\n __typename\n ... on Model {\n id\n iso_updated_at: updated_at(format: "%Y-%m-%dT%H:%M:%S.%LZ")\n }\n ... on Block {\n block_state\n can {\n manage\n mute\n potentially_edit_thumbnail\n edit_thumbnail\n flag\n find_original_url\n }\n }\n ... on ConnectableInterface {\n is_muted\n source {\n url\n }\n }\n ... on Image {\n find_original_url\n }\n ... on Link {\n image_url\n }\n ... on Attachment {\n image_url\n }\n ... on Embed {\n image_url\n }\n }\n\n query BlockMetadataContextMenuQuery($id: ID!) {\n block: blokk(id: $id) {\n ...BlockMetadataContextMenuFragment\n }\n }\n\n mutation BlockMetadataContextMenuMuteMutation($id: ID!) {\n mute(input: { id: $id, type: BLOCK }) {\n mmutable {\n ...BlockMetadataContextMenuFragment\n }\n }\n }\n\n mutation BlockMetadataContextMenuUnmuteMutation($id: ID!) {\n unmute(input: { id: $id, type: BLOCK }) {\n mmutable {\n ...BlockMetadataContextMenuFragment\n }\n }\n }\n\n mutation BlockMetadataContextMenuChangeCoverMutation(\n $input: UpdateBlockThumbnailMutationInput!\n ) {\n update_block_thumbnail(input: $input) {\n block: blokk {\n ...BlockMetadataContextMenuFragment\n }\n }\n }\n']);return eh=function(){return e},e}function eg(){let e=(0,i._)(["\n query BlockMetadataContextMenuChangeCoverImageProcessingQuery($id: ID!) {\n block: blokk(id: $id) {\n ...BlockMetadataContextMenuFragment\n ...BlockRepresentationFragment\n ...GridCellBlockFragment\n ... on Model {\n id\n }\n }\n }\n"]);return eg=function(){return e},e}let ep=e=>{var n,t,i,o,s,c,d;let{id:u}=e,{isLoggedIn:m}=(0,eo.Jd)(),{setNavigationState:h}=eZ(),g=(0,em.s)(),[p,f]=(0,a.useState)(!1),[x,_]=(0,a.useState)("Idle"),[{data:b}]=(0,l.sj6)({variables:{id:u.toString()},pause:!p}),j=null==b?void 0:b.block,{sendToast:k,updateToast:y,sendGenericError:w}=(0,H.Yf)(),{handleDownload:v}=ed({block:j}),$=(0,l.ell)()[1],C=(0,l.xuj)()[1],B=(0,l.sxE)()[1],M=async()=>{let e=k({title:"Muting"});try{let n=await $({id:u.toString()});if(n.error)throw n.error;y({...e,title:"Muted"})}catch(e){w(e)}},F=async()=>{let e=k({title:"Unmuting"});try{let n=await C({id:u.toString()});if(n.error)throw n.error;y({...e,title:"Unmuted"})}catch(e){w(e)}},{triggerUpload:E}=(0,er.Su)(),z=async()=>{if(j&&"image_url"in j){if(!j.can.edit_thumbnail)return void g.open({type:"PremiumGate"});E({multiple:!1,accept:"image/*",maxFileSizeMb:eu.J.image,onBatch:e=>{k({title:"Uploading...",content:(0,r.jsx)(er.Hs,{id:e.id})})},onSuccess:async e=>{let{location:n}=e;try{let e=await B({input:{id:u.toString(),image_url:n}});if(e.error)throw e.error;k({title:"Uploaded. Processing..."})}catch(e){w(e)}}})}};if((null==j?void 0:j.__typename)==="Channel")return null;let S=!(null==j||null==(n=j.can)?void 0:n.manage)&&!(null==j||null==(t=j.can)?void 0:t.potentially_edit_thumbnail)&&!(null==j||null==(i=j.source)?void 0:i.url)&&!(null==j||null==(o=j.can)?void 0:o.mute)&&!(null==j||null==(s=j.can)?void 0:s.flag)&&!(null==j||null==(c=j.can)?void 0:c.find_original_url)&&!m;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(q.tz,{onOpenChange:e=>{e&&f(!0)},trigger:(0,r.jsxs)(I.$,{size:"sm",disabled:!!(j&&S),children:["Actions ",(0,r.jsx)(K.bDP,{})]}),items:[...j?[...j.can.manage?[{id:"edit",type:"button",icon:(0,r.jsx)(K.WhT,{}),label:"Edit",onClick:()=>{h({mode:"Edit",intent:"content"})},badge:{label:"E",variant:"keyboard"}}]:[],...j.can.potentially_edit_thumbnail?[{id:"change-cover",type:"button",icon:(0,r.jsx)(K.JMY,{}),label:"Change cover image",onClick:z,disabled:"UPDATE_PROCESSING"===j.block_state}]:[],...(null==(d=j.source)?void 0:d.url)?[{id:"view-source",type:"link",icon:(0,r.jsx)(K.loI,{}),label:"View source",href:j.source.url,target:"_blank",rel:"noopener noreferrer",variant:"secondary"}]:[],...j.can.mute?[{id:j.is_muted?"unmute":"mute",type:"button",icon:j.is_muted?(0,r.jsx)(K.JT8,{}):(0,r.jsx)(K.Kr0,{}),label:j.is_muted?"Unmute":"Mute",onClick:j.is_muted?F:M,variant:"secondary"}]:[],...j.can.flag?[{id:"flag",type:"button",icon:(0,r.jsx)(K.W1d,{}),label:"Flag as inappropriate",onClick:()=>{_("Flag")},variant:"secondary"}]:[],..."Image"===j.__typename&&j.can.find_original_url?[{id:"find-original",type:"link",icon:(0,r.jsx)(K.$p$,{}),label:"Find original",href:j.find_original_url,target:"_blank",rel:"noopener noreferrer",variant:"secondary"}]:[],...m?[{id:"download",type:"button",icon:(0,r.jsx)(K.s3U,{}),label:"Download",onClick:v,variant:"secondary",badge:{label:"D",variant:"keyboard"}}]:[]]:[{id:"loading",type:"button",label:"Loading",disabled:!0,onClick:()=>{}}]]}),j&&"Flag"===x&&(0,r.jsx)(el._,{id:j.id,onClose:()=>{_("Idle")},type:"Block"}),j&&"UPDATE_PROCESSING"===j.block_state&&(0,r.jsx)(ef,{block:j})]})};(0,o.J1)(eh());let ef=e=>{let{block:n}=e,[{fetching:t},i]=(0,l.ZA0)({variables:{id:n.id.toString()},pause:!0});return(0,ea.g)({fetching:t,isoTimestamp:n.iso_updated_at,refetch:i}),null};(0,o.J1)(eg());var ex=t(9021),e_=t(93026),eb=t(29979),ej=t(6547);function ek(){let e=(0,i._)(["\n fragment BlockMetadataEditableFieldsFragment on Konnectable {\n ... on Model {\n id\n }\n ... on Block {\n can {\n manage\n }\n }\n ... on ConnectableInterface {\n title\n description(format: HTML)\n }\n }\n"]);return ek=function(){return e},e}let ey=e=>{let{block:n}=e,{setNavigationState:t}=eZ(),i="can"in n&&n.can.manage,l=n.title?n.title.trim():null,a=n.description?n.description.trim():null;(0,eb.vC)("e",()=>{i&&t({mode:"Edit"})});let o=()=>{t({mode:"Edit",intent:"title"})},s=()=>{t({mode:"Edit",intent:"description"})};return(0,r.jsxs)(u.B,{gap:"$1",children:[l?(0,r.jsx)(d.E,{size:"lg",hyphenate:!0,...i?{as:ew,onClick:o,empty:!1}:{as:"h1",css:{color:"$link"}},children:l}):(0,r.jsx)(d.E,{size:"lg",...i?{as:ew,onClick:o,empty:!0}:{css:{color:"$gray3"}},children:"No title"}),a?(0,r.jsx)(x.a,{...i?{as:ew,onClick:s,empty:!1}:{css:{color:"$link"}},children:(0,r.jsx)(d.E,{as:S.g3,onClick:ej.D,size:"sm",hyphenate:!0,dangerouslySetInnerHTML:{__html:a}})}):(0,r.jsx)(d.E,{size:"sm",...i?{as:ew,onClick:s,empty:!0}:{css:{color:"$gray3"}},children:"No description"})]})},ew=(0,e_.pH)(g.D,{fontFamily:"$sans","&:hover":{bg:"$blue1",color:"$link"},variants:{empty:{true:{color:"$gray3"},false:{color:"$link"}}}});function ev(){let e=(0,i._)(["\n fragment BlockMetadataFragment on Konnectable {\n ...UseDownloadFragment\n ...BlockMetadataEditableFieldsFragment\n ...BlockMetadataDefinitionListFragment\n __typename\n ... on Model {\n id\n }\n ... on Block {\n counts {\n channels\n comments\n }\n }\n }\n"]);return ev=function(){return e},e}(0,o.J1)(ek());let e$=e=>{let{block:n,children:t}=e,{mode:i,setNavigationState:l}=eZ(),{handleDownload:a}=ed({block:n});return((0,eb.vC)("d",a),"Channel"===n.__typename)?null:(0,r.jsxs)(r.Fragment,{children:[t,(0,r.jsx)(ey,{block:n}),(0,r.jsx)(s.h,{y:"$3"}),(0,r.jsxs)(u.B,{gap:"$3",children:[(0,r.jsx)(ex.S,{block:n}),(0,r.jsxs)(x.a,{css:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"$1",px:"$3",py:"$2",border:"1px solid",borderColor:"$gray2",borderRadius:"$1","@bp2":{alignItems:"flex-start",flexDirection:"column"}},children:[(0,r.jsxs)(u.B,{gap:"$1",direction:"horizontal",children:[(0,r.jsx)(et.P,{id:n.id,type:"Block",children:(0,r.jsxs)(I.$,{size:"sm",css:{gap:"$1"},children:["Connect ",(0,r.jsx)(K.flY,{})]})}),(0,r.jsx)(ep,{id:n.id})]}),"Link"===n.__typename&&(0,r.jsx)(ei.lM,{items:[{children:"Preview",active:"Show"===i,onClick:()=>{l({mode:"Show"})}},{children:"Reader",active:"Reader"===i,onClick:()=>{l({mode:"Reader"})}}]})]}),(0,r.jsxs)(z.pK,{defaultValue:"connections",children:[(0,r.jsxs)(z.j7,{children:[(0,r.jsxs)(z.Xi,{value:"connections",children:["Connections"," ",n.counts.channels>0&&(0,r.jsxs)(r.Fragment,{children:["(",n.counts.channels,")"]})]}),(0,r.jsxs)(z.Xi,{value:"comments",children:["Comments"," ",n.counts.comments>0&&(0,r.jsxs)(r.Fragment,{children:["(",n.counts.comments,")"]})]})]}),(0,r.jsxs)(z.av,{value:"connections",children:[(0,r.jsx)(s.h,{y:"$6"}),(0,r.jsx)(E,{id:n.id})]}),(0,r.jsxs)(z.av,{value:"comments",children:[(0,r.jsx)(s.h,{y:"$6"}),(0,r.jsx)(en,{id:n.id.toString()})]})]})]})]})},eC=e=>{let{children:n}=e;return(0,r.jsxs)(r.Fragment,{children:[n,(0,r.jsx)(_.r,{size:"lg",children:"Example Block Title"}),(0,r.jsx)(s.h,{y:"$1"}),(0,r.jsx)(_.r,{size:"sm",children:"No description"}),(0,r.jsx)(s.h,{y:"$3"}),(0,r.jsx)(ex.v,{})]})};(0,o.J1)(ev());var eB=t(24973),eM=t(14451),eF=t(1640),eE=t(93126),ez=t(68944),eI=t(70842),eS=t(22365),eD=t(13810),eL=t(74716),eP=t(88992),eT=t(60513);function eR(){let e=(0,i._)(["\n fragment BlockEditFragment on Konnectable {\n ...BlockRepresentationFragment\n ...GridCellTextFragment\n __typename\n ... on Model {\n id\n }\n ... on ConnectableInterface {\n title\n editableDescription: description(format: MARKDOWN)\n }\n ... on Text {\n editableContent: content(format: MARKDOWN)\n }\n ... on Image {\n alt_text\n }\n }\n\n mutation BlockEditMutation($input: UpdateBlockMutationInput!) {\n update_block(input: $input) {\n blokk {\n ...BlockFragment\n ...BlockEditFragment\n ... on Model {\n id\n }\n }\n }\n }\n"]);return eR=function(){return e},e}let eH=eT.z.object({title:eT.z.string().optional().or(eT.z.null()),description:eT.z.string().optional().or(eT.z.null()),content:eT.z.string().optional().or(eT.z.null()),alt_text:eT.z.string().optional().or(eT.z.null())}),eA=e=>{let{block:n,css:t}=e,{setNavigationState:i,intent:o}=eZ(),[s,c]=(0,a.useState)("Idle"),{register:m,formState:h,...g}=(0,eP.mN)({resolver:(0,eD.u)(eH),defaultValues:{title:n.title,description:n.editableDescription,..."Text"===n.__typename?{content:n.editableContent}:{},..."Image"===n.__typename?{alt_text:n.alt_text}:{}}});(0,a.useEffect)(()=>(window.onbeforeunload=()=>{if(h.isDirty)return""},()=>{window.onbeforeunload=null}),[h.isDirty]);let{sendToast:p,sendGenericError:f}=(0,H.Yf)(),[_,b]=(0,l.ACg)(),j=async e=>{c("Saving");try{let t=await b({input:{id:n.id.toString(),...e}});if(t.error)throw t.error;p({title:"Block updated"}),i({mode:"Show"})}catch(e){f(e)}c("Idle")},k=e=>{Object.entries(e).forEach(e=>{let[n,t]=e;t&&p({title:n.charAt(0).toUpperCase()+n.slice(1),description:t.message})})};return(0,eb.vC)("meta+s",e=>{e.preventDefault(),g.handleSubmit(j,k)()},{enableOnFormTags:!0},[g.handleSubmit,j,k]),(0,r.jsx)(x.a,{as:"form",onSubmit:g.handleSubmit(j,k),css:(0,eL.h)({width:"100%",height:"calc(100% - ".concat(ez.MJ,"px)")},t),children:(0,r.jsxs)(eM.g,{css:{height:"100%"},children:[(0,r.jsxs)(r.Fragment,{children:["Text"===n.__typename&&(0,r.jsx)(x.a,{css:{height:"100%",p:"$4"},children:(0,r.jsxs)(d.E,{size:"md",css:{position:"relative",height:"100%",width:eF.JJ,maxWidth:"100%",mx:"auto"},children:[(0,r.jsx)(L.TM,{...m("content"),autoFocus:"content"===o,placeholder:"Content",css:{width:"100%",minHeight:"100%"},required:!0}),(0,r.jsx)(eE.i,{side:"top",children:(0,r.jsx)(eI.E,{variant:"keyboard",css:{position:"absolute",bottom:"$3",right:"$3"},children:"Formatting"})})]})}),"Text"!==n.__typename&&(0,r.jsx)(eB.LG,{block:n})]}),(0,r.jsxs)(u.B,{gap:"$4",children:[(0,r.jsxs)(u.B,{gap:"$2",children:[(0,r.jsx)(eS.J,{htmlFor:"BlockEdit--title",children:"Title"}),(0,r.jsx)(D.pd,{id:"BlockEdit--title",...m("title"),autoFocus:"title"===o,placeholder:"Type block title"})]}),"Image"===n.__typename&&(0,r.jsxs)(u.B,{gap:"$2",children:[(0,r.jsx)(eS.J,{htmlFor:"BlockEdit--alt_text",children:"Alt text"}),(0,r.jsx)(D.pd,{id:"BlockEdit--alt_text",...m("alt_text"),placeholder:"Type block alt text"})]}),(0,r.jsxs)(u.B,{gap:"$2",children:[(0,r.jsx)(eS.J,{htmlFor:"BlockEdit--description",children:"Description"}),(0,r.jsx)(L.TM,{id:"BlockEdit--description",...m("description"),autoFocus:"description"===o,placeholder:"Type block description",rows:5,css:{resize:"vertical"}})]}),(0,r.jsxs)(u.B,{gap:"$2",direction:"horizontal",css:{justifyContent:"flex-end"},children:[(0,r.jsx)(I.$,{type:"button",onClick:()=>{i({mode:"Show"})},children:"Cancel"}),(0,r.jsx)(I.$,{type:"submit",children:{Idle:"Save",Saving:"Saving…"}[s]})]})]})]})})};function eJ(){let e=(0,i._)(["\n fragment BlockFragment on Konnectable {\n ...BlockEditFragment\n ...BlockRepresentationFragment\n ...BlockMetadataFragment\n ... on Model {\n id\n }\n }\n\n query BlockQuery($id: ID!) {\n block: blokk(id: $id) {\n ...BlockFragment\n ... on Model {\n id\n }\n }\n }\n"]);return eJ=function(){return e},e}(0,o.J1)(eR());let eO=e=>{let{block:n,css:t,children:i}=e,{mode:l}=eZ();return"Edit"===l?(0,r.jsx)(eA,{block:n,css:t}):(0,r.jsxs)(eM.g,{css:t,children:[(0,r.jsx)(eB.LG,{block:n}),(0,r.jsx)(e$,{block:n,children:i})]})},eU=e=>{let{css:n,children:t}=e;return(0,r.jsxs)(eM.g,{css:n,children:[(0,r.jsx)(eB.eQ,{}),(0,r.jsx)(eC,{children:t})]})},eW=e=>{let{id:n,css:t,children:i}=e,[{data:a,error:o,fetching:s}]=(0,l.noG)({variables:{id:n.toString()}});if(o)throw o;return!s&&a&&a.block?(0,r.jsx)(eO,{block:a.block,css:t,children:i}):(0,r.jsx)(eU,{css:t,children:i})};(0,o.J1)(eJ());let eq=eT.z.union([eT.z.literal("Show"),eT.z.literal("Edit"),eT.z.literal("Reader")]),eN=eT.z.union([eT.z.literal("title"),eT.z.literal("description"),eT.z.literal("content")]),eK="Show",eY="content",eG=(0,a.createContext)({mode:eK,intent:eY,setNavigationState:()=>{}}),eQ=e=>{let{children:n}=e,t=(0,f.useRouter)(),i=t.query.mode||eK,l=t.query.intent||eY,o=(0,a.useMemo)(()=>{try{return eq.parse(i)}catch(e){return eK}},[i]),s=(0,a.useMemo)(()=>{try{return eN.parse(l)}catch(e){return eY}},[l]);return(0,r.jsx)(eG.Provider,{value:{mode:o,intent:s,setNavigationState:e=>{let{mode:n,intent:i}=e;t.replace({query:{...t.query,...n?{mode:n}:{},...i?{intent:i}:{}}})}},children:n})},eZ=()=>(0,a.useContext)(eG)},41437:(e,n,t)=>{t.d(n,{E:()=>i});let i=t(14232).useLayoutEffect},62610:(e,n,t)=>{t.d(n,{j:()=>u});var i=t(37876),r=t(65074),l=t(10731),a=t(48230),o=t.n(a),s=t(33572),c=t(14905);let d=()=>(0,i.jsxs)(l.P,{Icon:m,variant:"brandLight",children:["This feature requires ",(0,i.jsx)(o(),{href:"/about#pricing",children:"Premium"})," to access."]}),u=e=>{let{children:n}=e,{isPremium:t}=(0,r.Jd)();return t?(0,i.jsx)(i.Fragment,{children:n}):(0,i.jsx)(d,{})},m=()=>(0,i.jsx)(s.V,{badge:c.lqH.Premium})},64281:(e,n,t)=>{t.d(n,{_:()=>f});var i=t(28888),r=t(37876),l=t(10625),a=t(89572),o=t(76841),s=t(54761),c=t(87303),d=t(5336),u=t(52001),m=t(14905),h=t(14232),g=t(86355);function p(){let e=(0,i._)(["\n fragment FlagContentDialogFragment on Channel {\n id\n is_nsfw\n }\n\n query FlagContentDialogQuery($id: ID!) {\n channel(id: $id) {\n ...FlagContentDialogFragment\n }\n }\n\n mutation FlagContentDialogMutation($input: FlagContentMutationInput!) {\n flag_content(input: $input) {\n status\n }\n }\n"]);return p=function(){return e},e}let f=e=>{let{id:n,onClose:t,type:i}=e,[{data:g,fetching:p,error:f}]=(0,m.PlR)({variables:{id:n.toString()},pause:"Channel"!==i}),x=null==g?void 0:g.channel,{open:_,onOpenChange:b}=(0,l.u)({defaultOpen:!0}),{sendToast:j,sendGenericError:k}=(0,u.Yf)(),[y,w]=(0,h.useState)("Idle"),[v,$]=(0,m.wBi)(),C=e=>async()=>{w("Flagging");try{let r=await $({input:{category:e,id:n.toString(),type:m.HCV[i]}});if(r.error)throw r.error;j({title:"Content flagged",description:"We will review this content as soon as possible, and get back to you if we have any questions."}),t()}catch(e){k(e)}w("Idle")};if(f)throw f;return(0,r.jsx)(s.Dz,{open:_,onOpenChange:e=>{b(e),e||t()},children:(0,r.jsx)(s.lG,{title:"Flag inappropriate",isCloseable:!0,css:{width:375},children:(0,r.jsxs)(c.B,{gap:"$4",children:[(0,r.jsxs)(d.E,{size:"xs",css:{color:"$slate"},children:["Be mindful when reporting content. Feel free to read our"," ",(0,r.jsx)(a.a,{as:"a",href:"/community-guidelines",target:"_blank",css:{fontWeight:"bold"},children:"Community Guidelines"})," ","and"," ",(0,r.jsx)(a.a,{as:"a",href:"/terms",target:"_blank",css:{fontWeight:"bold"},children:"Terms"})," ","to know what is allowed."]}),(0,r.jsx)(c.B,{gap:"$2",direction:"horizontal",children:p||"Channel"===i&&!x?(0,r.jsx)(o.k,{css:{width:"100%"}}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.$,{css:{flex:1},onClick:C(m.Eew.Spam),disabled:"Flagging"===y,children:"Spam"}),("Channel"===i&&x&&!x.is_nsfw||"Block"===i)&&(0,r.jsx)(o.$,{css:{flex:1},onClick:C(m.Eew.Nsfw),disabled:"Flagging"===y,children:"NSFW"}),(0,r.jsx)(o.$,{css:{flex:1},onClick:C(m.Eew.Offensive),disabled:"Flagging"===y,children:"Offensive"})]})}),(0,r.jsx)(d.E,{size:"xs",css:{color:"$slate"},children:"We will review this content as soon as possible, and get back to you if we have any questions."}),(0,r.jsx)(s.Es,{children:(0,r.jsx)(o.$,{onClick:t,children:"Cancel"})})]})})})};(0,g.J1)(p())},64445:(e,n,t)=>{t.d(n,{h:()=>g});var i=t(37876),r=t(64686),l=t(14232);let a=e=>{let{onMutate:n,options:t={attributes:!0,characterData:!0,childList:!0,subtree:!0},target:i}=e;(0,l.useEffect)(()=>{if("undefined"==typeof MutationObserver)return;let e=i&&"current"in i?i.current:i;if(!e)return;let r=new MutationObserver(n);return r.observe(e,t),()=>{r.disconnect()}},[n,t,i])};var o=t(41437),s=t(93801);let c={top:0,left:0,width:0,height:0},d=function(){let{trackMutation:e=!1,targetRef:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,l.useRef)(null),[i,r]=(0,l.useState)(c),d=(0,l.useCallback)(()=>{let e=(null==n?void 0:n.current)||t.current;e&&r({top:e.offsetTop,left:e.offsetLeft,width:e.offsetWidth,height:e.offsetHeight})},[n]);return a({target:t,onMutate:n=>{e&&n.forEach(e=>{"attributes"===e.type&&d()})}}),(0,s.w)({target:t,onResize:d}),(0,o.E)(()=>{let e=function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(null==n?void 0:n.current)||t.current?d():i<30?requestAnimationFrame(()=>e(i+1)):console.warn("useGeometry: Element not found after maximum retries. Ensure the ref is properly attached to a DOM element.")};e()},[d,n]),{ref:t,...i}},u=e=>{let{aspectWidth:n,aspectHeight:t,maxWidth:i,maxHeight:a}=e,{ref:o,width:s,height:c}=d(),[{scaledWidth:u,scaledHeight:m},h]=(0,l.useState)({scaledWidth:0,scaledHeight:0});return(0,l.useEffect)(()=>{if(!o.current)return;let e=(0,r.scale)({width:n,height:t,maxWidth:Math.min(s,i||1/0),maxHeight:Math.min(c,a||1/0)});h({scaledWidth:e.width,scaledHeight:e.height})},[t,n,c,a,i,o,s]),{ref:o,scaledWidth:u,scaledHeight:m}};var m=t(89572),h=t(74716);let g=e=>{let{aspectWidth:n,aspectHeight:t,maxWidth:r,maxHeight:l,children:a,css:o}=e,{ref:s,scaledWidth:c,scaledHeight:d}=u({aspectWidth:n,aspectHeight:t,maxWidth:r,maxHeight:l});return(0,i.jsx)(m.a,{ref:s,css:{width:"100%",height:"100%",display:"flex"},children:(0,i.jsx)(m.a,{css:(0,h.h)({width:c,height:d,m:"auto"},o),children:a})})}},93126:(e,n,t)=>{t.d(n,{i:()=>a});var i=t(37876),r=t(41058),l=t(8302);let a=e=>{let{children:n,side:t="bottom"}=e;return(0,i.jsxs)(l.z8,{children:[(0,i.jsx)(l.d0,{asChild:!0,children:n}),(0,i.jsx)(l.HP,{children:(0,i.jsx)(l.Et,{sideOffset:5,side:t,children:(0,i.jsx)(r.u,{definitions:[{term:"Italic",description:"*italic* or _italic_"},{term:"Bold",description:"**bold** or __bold__"},{term:"Combined",description:"**bold and _italic_**"},{term:"Horizontal rule",description:"---"},{term:"Strikethrough",description:"~~strike this~~"},{term:"Highlighted",description:"==highlighted=="},{term:"Ordered list",description:"1. List item"},{term:"Unordered list",description:"- List item"},{term:"Links",description:"[link text](link URL)"},{term:"Inline code",description:"`code`"},{term:"Multiline code",description:"```multiline code```"},{term:"Blockquote",description:"> I'm a quote"},{term:"Headers",description:"# h1\n## h2\n### h3\n#### h4\n##### h5\n###### h6"}]})})})]})}},93801:(e,n,t)=>{let i;t.d(n,{w:()=>o});var r=t(41437),l=t(14232);let a=e=>{let n=(0,l.useRef)(e);return(0,l.useEffect)(()=>{n.current=e}),n},o=e=>{let{target:n,onResize:t}=e,i=c(),l=a(t);(0,r.E)(()=>{if(!i)return;let e=!1,t=n&&"current"in n?n.current:n;if(!t)return;let r=(n,t)=>{e||l.current(n,t)};return i.subscribe(t,r),()=>{e=!0,i.unsubscribe(t,r)}},[n,i,l])},s=()=>{if("undefined"==typeof ResizeObserver)return null;let e=!1,n=[],t=new Map,i=new ResizeObserver((i,r)=>{n=n.concat(i),e||window.requestAnimationFrame(()=>{let i=new Set;for(let e=0;et(n[e],r))}n=[],e=!1}),e=!0});return{observer:i,subscribe(e,n){var r;i.observe(e);let l=null!=(r=t.get(e))?r:[];l.push(n),t.set(e,l)},unsubscribe(e,n){var r;let l=null!=(r=t.get(e))?r:[];if(1===l.length){i.unobserve(e),t.delete(e);return}let a=l.indexOf(n);-1!==a&&l.splice(a,1),t.set(e,l)}}},c=()=>i||(i=s())}}]);