1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="40e68ffd-3208-69b8-b3c6-2ade311a9e76")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42450,e=>{"use strict";e.s(["reconcileTagSlugsAfterDelete",0,function(e){let{selectedSlugs:u,deletedSlug:t,deletedSlugExistsElsewhere:a}=e;return!u.includes(t)||a?u:u.filter(e=>e!==t)},"reconcileTagSlugsAfterRename",0,function(e){let{selectedSlugs:u,oldSlug:t,newSlug:a,oldSlugExistsElsewhere:l}=e;return u.includes(t)&&t!==a?l?u.includes(a)?u:[...u,a]:Array.from(new Set(u.map(e=>e===t?a:e))):u}])},269239,e=>{"use strict";var u=e.i(996038);let t=["1","2","3","4","5","6","7","8","9","10"];e.s(["getTagsFromEditor",0,function(e){var u,t,a,l;if(!e||e.isDestroyed)return[];let r=null!=(u=null==(l=e.view.state.doc.content.content[0])||null==(a=l.content)||null==(t=a.content)?void 0:t.filter(e=>"tag"===e.type.name).map(e=>e.attrs))?u:[];return 0===r.length?[]:r},"mergeTagSelectionIntoSlugs",0,function(e){let{currentSlugs:u,resolvedSlugs:t,selection:a}=e,l=new Set(t),r=new Set(a.map(e=>e.slug)),s=(null!=u?u:[]).filter(e=>!l.has(e)||r.has(e)),n=new Set(s);return[...s,...a.map(e=>e.slug).filter(e=>!n.has(e))]},"randomTagColor",0,()=>t[Math.floor(Math.random()*t.length)],"slugifyTag",0,function(e){return(0,u.default)(e,{lower:!0,strict:!0})},"tagColors",0,t,"tagCssColor",0,(e,u)=>"hsl(var(--tag-".concat(e,"Hsl) / ").concat(null!=u?u:.25,")")])},450569,e=>{"use strict";var u=e.i(878420),t=e.i(64386),a=e.i(394487),l=e.i(278689),r=e.i(831136),s=e.i(663973),n=e.i(976859),i=e.i(76795),o=e.i(42450),c=e.i(60035),d=e.i(135644),F=e.i(575216),g=e.i(269239),f=e.i(345988),p=e.i(416340),m=e.i(387911),y=e.i(577735),h=e.i(673073);let C=e=>{let{isLoggedIn:a}=(0,n.useLoggedIn)({requireAccount:!0}),{data:l}=(0,r.useQuery)((0,t._)((0,u._)({},h.queries.tags.all(null!=e?e:0)),{refetchOnWindowFocus:!0,staleTime:1e4,enabled:a&&null!=e}));return(0,p.useMemo)(()=>A(l),[l])},x=e=>{var u;let t=new Map;for(let u of e)for(let e of null!=u?u:[])t.has(e.slug)||t.set(e.slug,e);return null!=(u=A([...t.values()]))?u:[]},A=e=>Array.isArray(e)?e.slice().sort((e,u)=>v(e.name).localeCompare(v(u.name),void 0,{sensitivity:"base"})):void 0,v=e=>e.replace(RegExp("<a?:.+?:\\d{18}>|[\\u00A9\\u00AE\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9-\\u21AA\\u231A-\\u231B\\u2328\\u23CF\\u23E9-\\u23F3\\u23F8-\\u23FA\\u24C2\\u25AA-\\u25AB\\u25B6\\u25C0\\u25FB-\\u25FE\\u2600-\\u2604\\u260E\\u2611\\u2614-\\u2615\\u2618\\u261D\\u2620\\u2622-\\u2623\\u2626\\u262A\\u262E-\\u262F\\u2638-\\u263A\\u2640\\u2642\\u2648-\\u2653\\u265F-\\u2660\\u2663\\u2665-\\u2666\\u2668\\u267B\\u267E-\\u267F\\u2692-\\u2697\\u2699\\u269B-\\u269C\\u26A0-\\u26A1\\u26A7\\u26AA-\\u26AB\\u26B0-\\u26B1\\u26BD-\\u26BE\\u26C4-\\u26C5\\u26C8\\u26CE-\\u26CF\\u26D1\\u26D3-\\u26D4\\u26E9-\\u26EA\\u26F0-\\u26F5\\u26F7-\\u26FA\\u26FD\\u2702\\u2705\\u2708-\\u270D\\u270F\\u2712\\u2714\\u2716\\u271D\\u2721\\u2728\\u2733-\\u2734\\u2744\\u2747\\u274C\\u274E\\u2753-\\u2755\\u2757\\u2763-\\u2764\\u2795-\\u2797\\u27A1\\u27B0\\u27BF\\u2934-\\u2935\\u2B05-\\u2B07\\u2B1B-\\u2B1C\\u2B50\\u2B55\\u3030\\u303D\\u3297\\u3299\\u{1F004}\\u{1F02C}-\\u{1F02F}\\u{1F094}-\\u{1F09F}\\u{1F0AF}-\\u{1F0B0}\\u{1F0C0}\\u{1F0CF}-\\u{1F0D0}\\u{1F0F6}-\\u{1F0FF}\\u{1F170}-\\u{1F171}\\u{1F17E}-\\u{1F17F}\\u{1F18E}\\u{1F191}-\\u{1F19A}\\u{1F1AE}-\\u{1F1E5}\\u{1F201}-\\u{1F20F}\\u{1F21A}\\u{1F22F}\\u{1F232}-\\u{1F23A}\\u{1F23C}-\\u{1F23F}\\u{1F249}-\\u{1F25F}\\u{1F266}-\\u{1F321}\\u{1F324}-\\u{1F393}\\u{1F396}-\\u{1F397}\\u{1F399}-\\u{1F39B}\\u{1F39E}-\\u{1F3F0}\\u{1F3F3}-\\u{1F3F5}\\u{1F3F7}-\\u{1F3FA}\\u{1F400}-\\u{1F4FD}\\u{1F4FF}-\\u{1F53D}\\u{1F549}-\\u{1F54E}\\u{1F550}-\\u{1F567}\\u{1F56F}-\\u{1F570}\\u{1F573}-\\u{1F57A}\\u{1F587}\\u{1F58A}-\\u{1F58D}\\u{1F590}\\u{1F595}-\\u{1F596}\\u{1F5A4}-\\u{1F5A5}\\u{1F5A8}\\u{1F5B1}-\\u{1F5B2}\\u{1F5BC}\\u{1F5C2}-\\u{1F5C4}\\u{1F5D1}-\\u{1F5D3}\\u{1F5DC}-\\u{1F5DE}\\u{1F5E1}\\u{1F5E3}\\u{1F5E8}\\u{1F5EF}\\u{1F5F3}\\u{1F5FA}-\\u{1F64F}\\u{1F680}-\\u{1F6C5}\\u{1F6CB}-\\u{1F6D2}\\u{1F6D5}-\\u{1F6E5}\\u{1F6E9}\\u{1F6EB}-\\u{1F6F0}\\u{1F6F3}-\\u{1F6FF}\\u{1F7DA}-\\u{1F7FF}\\u{1F80C}-\\u{1F80F}\\u{1F848}-\\u{1F84F}\\u{1F85A}-\\u{1F85F}\\u{1F888}-\\u{1F88F}\\u{1F8AE}-\\u{1F8AF}\\u{1F8BC}-\\u{1F8BF}\\u{1F8C2}-\\u{1F8CF}\\u{1F8D9}-\\u{1F8FF}\\u{1F90C}-\\u{1F93A}\\u{1F93C}-\\u{1F945}\\u{1F947}-\\u{1F9FF}\\u{1FA58}-\\u{1FA5F}\\u{1FA6E}-\\u{1FAFF}\\u{1FC00}-\\u{1FFFD}]","gu"),""),w=(e,u)=>{let t=C(u);return(0,p.useMemo)(()=>(null!=e?e:[]).map(e=>null==t?void 0:t.find(u=>u.slug===e)).filter(e=>!!e),[t,e])};async function S(e){let{queryClient:a,accountIds:l,excludedAccountId:r,slug:s}=e;return(await Promise.all(l.filter(e=>e!==r).map(async e=>{try{return await a.ensureQueryData((0,t._)((0,u._)({},h.queries.tags.all(e)),{staleTime:1e4}))}catch(e){return null}}))).some(e=>!Array.isArray(e)||e.some(e=>e.slug===s))}e.s(["mergeTagsBySlug",0,x,"useAccountTags",0,C,"useAddStarterTags",0,()=>{let e=(0,s.useQueryClient)();return(0,a.useMutation)({mutationFn:async e=>{let{mode:t="append",targetAccountId:a}=e,l=await m.default.post("/accounts/".concat(a,"/starter-tags/"),{replace_existing:"replace"===t});return(0,u._)({mode:t,targetAccountId:a},l.data)},onSuccess:u=>{e.setQueryData(h.queries.tags.all(u.targetAccountId).queryKey,u.tags),e.
2invalidateQueries({queryKey:h.queries.tags.importSources._def})}})},"useCopyTagsFromAccount",0,()=>{let e=(0,s.useQueryClient)();return(0,a.useMutation)({mutationFn:async e=>{let{mode:t="append",sourceAccountId:a,targetAccountId:l}=e,r=await m.default.post("/accounts/".concat(l,"/copy-tags/"),{replace_existing:"replace"===t,source_account_id:a});return(0,u._)({mode:t,sourceAccountId:a,targetAccountId:l},r.data)},onSuccess:u=>{e.setQueryData(h.queries.tags.all(u.targetAccountId).queryKey,u.tags),e.invalidateQueries({queryKey:h.queries.tags.importSources._def})}})},"useCreateTag",0,()=>{let e=(0,s.useQueryClient)();return(0,a.useMutation)({mutationFn:async u=>{let{tag:t,accountId:a}=u;return await e.cancelQueries({queryKey:h.queries.tags.all(a).queryKey}),(await m.default.post("/tags/",{name:t.name,color:t.color},(0,m.withAccount)(a))).data},onSuccess:(u,t)=>{let{accountId:a}=t;e.setQueryData(h.queries.tags.all(a).queryKey,e=>[...null!=e?e:[],u])},onError:e=>{(0,y.notifApiError)(e,{fallbackMessage:"Can't create tag"})}})},"useDeleteTag",0,()=>{let e=(0,n.useAppSelectedAccountId)(),u=(0,n.useAccounts)().map(e=>e.id),t=(0,s.useQueryClient)(),[,l,r]=(0,i.useWorkspaceTags)(),{onTagDeleted:c}=(0,f.useDraftCacheMutations)();return(0,a.useMutation)({mutationFn:async e=>{let{slug:u,accountId:a}=e;return await t.cancelQueries({queryKey:h.queries.tags.all(a).queryKey}),(await m.default.delete("/tags/"+u+"/",(0,m.withAccount)(a))).data},onMutate:async e=>{let{slug:u,accountId:a}=e,l=t.getQueryData(h.queries.tags.all(a).queryKey);return t.setQueryData(h.queries.tags.all(a).queryKey,e=>null==e?void 0:e.filter(e=>e.slug!==u)),{previousTags:l}},onError:(e,u,a)=>{let{accountId:l}=u;(0,y.notifApiError)(e),(null==a?void 0:a.previousTags)&&t.setQueryData(h.queries.tags.all(l).queryKey,a.previousTags)},onSuccess:async(a,s)=>{let{slug:n,accountId:i}=s;if(c({account:i,slug:n}),r||i===e){let e=!!r&&await S({queryClient:t,accountIds:u,excludedAccountId:i,slug:n});l(u=>(0,o.reconcileTagSlugsAfterDelete)({selectedSlugs:u,deletedSlug:n,deletedSlugExistsElsewhere:e}))}}})},"useSelectedThreadTags",0,()=>{let e=(0,c.useMaybeEditingDraftMetadata)();return w(null==e?void 0:e.tags,null==e?void 0:e.account)},"useSidebarTags",0,()=>{let e=(0,n.useAppSelectedAccountId)(),[u]=(0,i.useWorkspaceTags)();return w(u,e)},"useSyncTag",0,()=>{let e=(0,n.useAppSelectedAccountId)(),u=(0,n.useAccounts)().map(e=>e.id),t=(0,s.useQueryClient)(),l=(0,d.useUpdateDraftById)(),{onTagRenamed:r}=(0,f.useDraftCacheMutations)(),[,c,p]=(0,i.useWorkspaceTags)();return(0,a.useMutation)({mutationFn:async e=>{await t.cancelQueries({queryKey:h.queries.tags.all(e.accountId).queryKey});let u={};return void 0!==e.newName&&(u.name=e.newName),void 0!==e.newColor&&(u.color=e.newColor),(await m.default.patch("/tags/"+e.slug+"/",u,(0,m.withAccount)(e.accountId))).data},retry:1,onMutate:async e=>{let{slug:u,newName:a,newColor:r,accountId:s}=e,n=t.getQueryData(h.queries.tags.all(s).queryKey),i=(0,g.slugifyTag)(null!=a?a:u);t.setQueryData(h.queries.tags.all(s).queryKey,e=>null==e?void 0:e.map(e=>e.slug===u?{slug:i,name:null!=a?a:e.name,color:null!=r?r:e.color}:e));let o=[];for(let e of F.useDraftStore.getState().drafts.values()){var c,d;if(e&&e.account===s&&(null!=(c=e.tags)?c:[]).includes(u)){let t=null!=(d=e.tags)?d:[];o.push({id:e.id,previousTags:t}),l(e.id,{tags:t.map(e=>e===u?i:e)})}}return{affectedDrafts:o,previousAccountTags:n,newSlug:i,previousSlug:u}},onError:(e,u,a)=>{var r,s;(0,y.notifApiError)(e);let n=t.getQueryData(h.queries.tags.all(u.accountId).queryKey),{affectedDrafts:i,previousSlug:o,previousAccountTags:c,newSlug:d}=null!=a?a:{},F=null==c||null==(r=c.find(e=>e.slug===u.slug))?void 0:r.color,g=null==c||null==(s=c.find(e=>e.slug===u.slug))?void 0:s.name;for(let{id:e,previousTags:a}of((u.newColor&&F||u.newName&&g)&&t.setQueryData(h.queries.tags.all(u.accountId).queryKey,null==n?void 0:n.map(e=>e.slug===d?{slug:o||e.slug,color:u.newColor&&F?F:e.color,name:u.newName&&g?g:e.name}:e)),null!=i?i:[]))l(e,{tags:a})},onSuccess:async(a,l)=>{if(a&&(t.setQueryData(h.queries.tags.all(l.accountId).queryKey,e=>null==e?void 0:e.map(e=>e.slug===l.slug?a:e)),r({account:l.accountId,oldSlug:l.slug,newSlug:a.slug}),l.slug!==a.slug)&&(p||l.accountId===e)){let e=!!p&&await S({queryClient:t,accountIds:u,excludedAccountId:l.accountId,slug:l.slug});c(u=>(0,o.reconcileTagSlugsAfterRename)({selectedSlugs:u,oldSlug:l.slug,newSlug:a.slug,oldSlugExistsElsewhere:e}))}}})},"useTagImportSources",0,(e,a)=>{var l;let{isLoggedIn:s}=(0,n.useLoggedIn)({requireAccount:!0});return(0,r.useQuery)((0,t._)((0,u._)({},h.queries.tags.importSources(null!=e?e:0)),{staleTime:1e4,enabled:s&&!!e&&(null==(l=null==a?void 0:a.enabled)||l)}))},"useTagsForAccounts",0,e=>{let{isLoggedIn:a}=(0,n.useLoggedIn)({requireAccount:!0}),r=(0,l.useQueries)({queries:e.map(e=>(0,t._)((0,u._)({},h.queries.tags.all(e)),{refetchOnWindowFocus:!0,staleTime:1e4,enabled:a}))}),s=e.join(",")+"|"+r.map(e=>e.dataUpdatedAt).join(",");return{tags:(0,p.useMemo)(()=>x(r.map(e=>e.data)),[s]),isLoading:r.some(e=>e.isLoading)}},"useTagsFromSlugs",0,w])},307173,e=>{"use strict";var u=e.i(221628),t=e.i(830469),a=e.i(741781),l=e.i(384345),r=e.i(604643),s=e.i(674829),n=e.i(976859),i=e.i(450569),o=e.i(170490),c=e.i(52722);let d=(0,e.i(843842).default)("replace",[["path",{d:"M14 4a1 1 0 0 1 1-1",key:"dhj8ez"}],["path",{d:"M15 10a1 1 0 0 1-1-1",key:"1mnyi5"}],["path",{d:"M21 4a1 1 0 0 0-1-1",key:"sfs9ap"}],["path",{d:"M21 9a1 1 0 0 1-1 1",key:"mp6qeo"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a2 2 0 0 1 2-2h2",key:"15xut4"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}]]);var F=e.i(416340),g=e.i(221006),f=e.i(271144),p=e.i(265013),m=e.i(588354);let y=(e,u)=>{if(0===e.length)return!0;let t=new Set(u.map(e=>h(e.slug))),a=new Set(u.map(e=>h(e.name)));return e.every(e=>t.has(h(e.slug))||a.has(h(e.name)))},h=e=>e.trim().toLowerCase(),C=e=>{var l;let{sources:r,selectedSource:s,onSelectSource:i,disabled:o}=e,c=(0,n.useAccountsGroupedByTeam)({uniqueTeamName:!0}),d=(0,F.useMemo)(()=>x({accountGroups:c,onSelectSource:i,selectedSource:s,sources:r}),[c,i,s,r]);return(0,u.jsx)(a.default,{items:d,contentWidth:"trigger-width",contentMinWidth:"260px",align:"start",disabled:o,children:(0,u.jsx)(t.Button,{type:"button",variant:"white",size:"medium",icon:(0,u.jsx)(g.ChevronDown,{}),iconSide:"right",disabled:o,className:"w-full min-w-[220px] flex-1 justify-between",children:null!=(l=null==s?void 0:s.name)?l:"Choose tags"})})},x=e=>{let{accountGroups:u,onSelectSource:t,selectedSource:a,sources:l}=e,r=l.find(e=>"starter_pack"===e.source_type),s=l.filter(e=>"social_set"===e.source_type),n=new Map(s.map(e=>[e.id,e])),i=new Set,o=[];for(let e of(r&&(o.push(A({onSelectSource:t,selectedSource:a,source:r})),s.length>0&&o.push({divider:!0,key:"starter-pack-divider"})),u)){let u=e.accounts.flatMap(e=>{let u=n.get(e.id);return u?[u]:[]});if(0!==u.length)for(let l of("team"===e.type&&o.push({header:"".concat(e.label,":"),key:"team-".concat(e.key)}),u))o.push(A({onSelectSource:t,selectedSource:a,source:l})),i.add(l.id)}for(let e of s)i.has(e.id)||o.push(A({onSelectSource:t,selectedSource:a,source:e}));return o},A=e=>{var u;let{onSelectSource:t,selectedSource:a,source:l}=e,r="starter_pack"===l.source_type;return{key:l.id,label:l.name,description:v(l.tags),icon:r?p.Tag:void 0,iconSize:16,iconClassName:"mx-[3px]",image:r?void 0:null!=(u=l.profile_image_url)?u:void 0,imageSize:22,isSelected:l.id===(null==a?void 0:a.id),onSelect:()=>t(l)}},v=e=>{let u=e.map(e=>
2e.name).filter(Boolean),t=u.slice(0,4),a=u.length-t.length;return 0===t.length?"No tags":a>0?"".concat(t.join(", ")," +").concat(a," more"):t.join(", ")};e.s(["TagImportControls",0,e=>{var a;let{currentTags:n,targetAccountId:g}=e,{data:p,isError:h,isLoading:x,isRefetching:A,refetch:v}=(0,i.useTagImportSources)(g),[w,S]=(0,F.useState)(null),D=(0,i.useAddStarterTags)(),j=(0,i.useCopyTagsFromAccount)(),{chooseMode:k,modal:E}=(()=>{let[e,a]=(0,F.useState)(!1),l=(0,F.useRef)(()=>{}),{mount:s,show:n}=(0,o.default)(e),i=(0,F.useCallback)(()=>new Promise(e=>{l.current=e,a(!0)}),[]),g=e=>{l.current(e),a(!1)};return{chooseMode:i,modal:s?(0,u.jsx)(r.Modal,{title:"Import tags",description:"Do you want to add these tags to the current list, or replace the current tags first?",open:n,onOpenChange:e=>{e||g(null)},className:"p-4 w-[430px]",bottomSheet:"mobile",closeOnClickOutside:!1,children:(0,u.jsxs)(r.ModalButtonsFooter,{className:"sm:flex-wrap",children:[(0,u.jsx)(t.Button,{variant:"white",onClick:()=>g(null),children:"Cancel"}),(0,u.jsx)(t.Button,{variant:"destructiveSecondary",icon:(0,u.jsx)(d,{}),onClick:()=>g("replace"),children:"Replace"}),(0,u.jsx)(t.Button,{variant:"primary",icon:(0,u.jsx)(c.Plus,{}),onClick:()=>g("append"),children:"Add tags"})]})}):null}})(),B=(0,F.useMemo)(()=>{let e,u;return e=null!=p?p:[],u=n,e.filter(e=>"starter_pack"!==e.source_type||!y(e.tags,u))},[n,p]),T=null!=(a=B.find(e=>e.id===w))?a:B[0],b=n.length>0,I=D.isPending||j.isPending,q=(0,F.useCallback)(e=>{S(e.id)},[]);if(x)return null;if(h)return(0,u.jsxs)(r.ModalFooter,{children:[(0,u.jsx)(s.P3,{className:"mb-2 text-typ-c2 font-medium",children:"Import tags"}),(0,u.jsxs)(l.HStack,{className:"w-full gap-2 justify-start flex-wrap",children:[(0,u.jsx)(s.P3,{className:"text-typ-c3",children:"Couldn't load tag sources."}),(0,u.jsx)(t.Button,{variant:"white",size:"small",loading:A,onClick:()=>void v(),children:"Retry"})]})]});let N=async()=>{if(!T)return;let e=b?await k():"append";if(!e)return;let u="starter_pack"===T.source_type,t=u?D.mutateAsync({mode:e,targetAccountId:g}):j.mutateAsync({mode:e,sourceAccountId:T.id,targetAccountId:g});m.default.promise(t,{loading:"replace"===e?"Replacing tags...":"Importing ".concat(u?"starter tags":"tags","..."),success:e=>"replace"===e.mode?"Tags replaced":e.created_count>0?"Imported ".concat(e.created_count," tags"):"No new tags to import",error:"Failed to import tags"})};return T?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(r.ModalFooter,{children:[(0,u.jsx)(s.P3,{className:"mb-2 text-typ-c2 font-medium",children:"Import tags"}),(0,u.jsxs)(l.HStack,{className:"w-full gap-2 justify-start flex-wrap",children:[(0,u.jsx)(C,{sources:B,selectedSource:T,onSelectSource:q,disabled:I}),(0,u.jsx)(t.Button,{variant:"primary",size:"medium",icon:(0,u.jsx)(f.Copy,{}),loading:I,disabled:I||!T,onClick:N,children:"Import tags"})]})]}),E]}):null}],307173)},566881,e=>{"use strict";var u=e.i(878420),t=e.i(64386),a=e.i(886513),l=e.i(221628),r=e.i(269239),s=e.i(371123),n=e.i(416340),i=e.i(251839);let o="relative max-w-full z-0 inline-flex flex-nowrap items-center gap-1 font-mono tracking-tight text-[hsl(0,0%,7%)] dark:text-[hsl(0,0%,76%)] px-[9px] py-[2px] rounded-full min-w-0";function c(e){let u=e.replace(/[\u200D\u200B\u00A0\u200E\u200F]/g,"").trim();return(32===u.codePointAt(0)||65039===u.codePointAt(0))&&(u=u.slice(1)),u}e.s(["TAG_CLASSNAME",0,o,"default",0,function(e){let{tag:d,children:F,className:g,style:f,interactive:p}=e,m=(0,a._)(e,["tag","children","className","style","interactive"]),y=(0,n.useRef)(null),[h]=(0,s.default)(y),C=(null!=p?p:!!m.onClick)&&h,x=function(e){let u,t=RegExp("<a?:.+?:\\d{18}>|[\\u00A9\\u00AE\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9-\\u21AA\\u231A-\\u231B\\u2328\\u23CF\\u23E9-\\u23F3\\u23F8-\\u23FA\\u24C2\\u25AA-\\u25AB\\u25B6\\u25C0\\u25FB-\\u25FE\\u2600-\\u2604\\u260E\\u2611\\u2614-\\u2615\\u2618\\u261D\\u2620\\u2622-\\u2623\\u2626\\u262A\\u262E-\\u262F\\u2638-\\u263A\\u2640\\u2642\\u2648-\\u2653\\u265F-\\u2660\\u2663\\u2665-\\u2666\\u2668\\u267B\\u267E-\\u267F\\u2692-\\u2697\\u2699\\u269B-\\u269C\\u26A0-\\u26A1\\u26A7\\u26AA-\\u26AB\\u26B0-\\u26B1\\u26BD-\\u26BE\\u26C4-\\u26C5\\u26C8\\u26CE-\\u26CF\\u26D1\\u26D3-\\u26D4\\u26E9-\\u26EA\\u26F0-\\u26F5\\u26F7-\\u26FA\\u26FD\\u2702\\u2705\\u2708-\\u270D\\u270F\\u2712\\u2714\\u2716\\u271D\\u2721\\u2728\\u2733-\\u2734\\u2744\\u2747\\u274C\\u274E\\u2753-\\u2755\\u2757\\u2763-\\u2764\\u2795-\\u2797\\u27A1\\u27B0\\u27BF\\u2934-\\u2935\\u2B05-\\u2B07\\u2B1B-\\u2B1C\\u2B50\\u2B55\\u3030\\u303D\\u3297\\u3299\\u{1F004}\\u{1F02C}-\\u{1F02F}\\u{1F094}-\\u{1F09F}\\u{1F0AF}-\\u{1F0B0}\\u{1F0C0}\\u{1F0CF}-\\u{1F0D0}\\u{1F0F6}-\\u{1F0FF}\\u{1F170}-\\u{1F171}\\u{1F17E}-\\u{1F17F}\\u{1F18E}\\u{1F191}-\\u{1F19A}\\u{1F1AE}-\\u{1F1E5}\\u{1F201}-\\u{1F20F}\\u{1F21A}\\u{1F22F}\\u{1F232}-\\u{1F23A}\\u{1F23C}-\\u{1F23F}\\u{1F249}-\\u{1F25F}\\u{1F266}-\\u{1F321}\\u{1F324}-\\u{1F393}\\u{1F396}-\\u{1F397}\\u{1F399}-\\u{1F39B}
2\\u{1F39E}-\\u{1F3F0}\\u{1F3F3}-\\u{1F3F5}\\u{1F3F7}-\\u{1F3FA}\\u{1F400}-\\u{1F4FD}\\u{1F4FF}-\\u{1F53D}\\u{1F549}-\\u{1F54E}\\u{1F550}-\\u{1F567}\\u{1F56F}-\\u{1F570}\\u{1F573}-\\u{1F57A}\\u{1F587}\\u{1F58A}-\\u{1F58D}\\u{1F590}\\u{1F595}-\\u{1F596}\\u{1F5A4}-\\u{1F5A5}\\u{1F5A8}\\u{1F5B1}-\\u{1F5B2}\\u{1F5BC}\\u{1F5C2}-\\u{1F5C4}\\u{1F5D1}-\\u{1F5D3}\\u{1F5DC}-\\u{1F5DE}\\u{1F5E1}\\u{1F5E3}\\u{1F5E8}\\u{1F5EF}\\u{1F5F3}\\u{1F5FA}-\\u{1F64F}\\u{1F680}-\\u{1F6C5}\\u{1F6CB}-\\u{1F6D2}\\u{1F6D5}-\\u{1F6E5}\\u{1F6E9}\\u{1F6EB}-\\u{1F6F0}\\u{1F6F3}-\\u{1F6FF}\\u{1F7DA}-\\u{1F7FF}\\u{1F80C}-\\u{1F80F}\\u{1F848}-\\u{1F84F}\\u{1F85A}-\\u{1F85F}\\u{1F888}-\\u{1F88F}\\u{1F8AE}-\\u{1F8AF}\\u{1F8BC}-\\u{1F8BF}\\u{1F8C2}-\\u{1F8CF}\\u{1F8D9}-\\u{1F8FF}\\u{1F90C}-\\u{1F93A}\\u{1F93C}-\\u{1F945}\\u{1F947}-\\u{1F9FF}\\u{1FA58}-\\u{1FA5F}\\u{1FA6E}-\\u{1FAFF}\\u{1FC00}-\\u{1FFFD}]","gu"),a=[],l=0;for(;null!==(u=t.exec(e));)u.index>l&&a.push({type:"text",value:c(e.slice(l,u.index))}),a.push({type:"emoji",value:u[0]}),l=t.lastIndex;return l<e.length&&a.push({type:"text",value:c(e.slice(l))}),a}(d.name);return(0,l.jsxs)("span",(0,t._)((0,u._)({ref:y,"data-type":"tag",className:(0,i.default)(o,g),style:(0,u._)({fontSize:13},f)},m),{children:[(0,l.jsx)("span",{style:{backgroundColor:(0,r.tagCssColor)(d.color,C?.4:.25)},className:"absolute inset-0 pointer-events-none rounded-full z-[-1]","aria-hidden":"true"}),(0,l.jsx)("div",{className:"flex items-center gap-[0.5em] flex-nowrap min-w-0 select-none",children:x.map((e,u)=>"emoji"===e.type?(0,l.jsx)("span",{className:"inline-block scale-110",children:e.value},u):(0,l.jsx)("span",{className:"mix-blend-color-burn dark:mix-blend-color-dodge truncate",children:e.value},u))}),F]}))}])},781638,841995,460094,e=>{"use strict";var u=e.i(221628),t=e.i(830469),a=e.i(384345),l=e.i(604643),r=e.i(674829),s=e.i(976859),n=e.i(574638),i=e.i(293857),o=e.i(559964),c=e.i(514540),d=e.i(136328),F=e.i(76795),g=e.i(307173),f=e.i(450569),p=e.i(269239),m=e.i(844880),y=e.i(128434),h=e.i(617865),C=e.i(170490),x=e.i(368186),A=e.i(52722),v=e.i(281160),w=e.i(675996),S=e.i(416340),D=e.i(216957),j=e.i(251839),k=e.i(920554),E=e.i(566881),B=e.i(293586),T=e.i(588354),b=e.i(878420),I=e.i(64386),q=e.i(886513),N=e.i(252428),M=e.i(971739),_=e.i(334858);function Q(e){let{selectedColor:t,onSelectColor:l,variant:r="inline",className:s}=e;return"dropdown"===r?(0,u.jsx)(K,{selectedColor:t,onSelectColor:l,className:s}):(0,u.jsx)(a.HStack,{className:(0,j.default)("flex-wrap gap-2",s),children:p.tagColors.map(e=>(0,u.jsx)(i.default,{onClick:()=>l(e),onKeyDown:u=>{("Enter"===u.key||" "===u.key)&&l(e)},children:(0,u.jsx)(z,{color:e,selected:t===e})},e))})}function K(e){let{selectedColor:t,onSelectColor:a,onClose:l,className:r}=e,s=(0,S.useRef)(null);return(0,M.default)(s,()=>{l&&l()}),(0,u.jsx)("div",{ref:s,className:(0,j.default)("p-2 flex gap-2 flex-wrap",(0,N.dropDownContentClassName)({variant:"dark"}),r),children:p.tagColors.map(e=>(0,u.jsx)(z,{color:e,selected:t===e,onClick:()=>a(e)},e))})}function z(e){let{color:t,selected:a,className:l}=e,r=(0,q._)(e,["color","selected","className"]);return(0,u.jsx)("div",(0,I._)((0,b._)({className:(0,j.default)("size-5 rounded-full cursor-pointer flex items-center justify-center",l),style:{background:(0,p.tagCssColor)(t,1),border:"1.5px solid ".concat((0,p.tagCssColor)(t,.9))}},r),{children:(0,u.jsx)(_.Check,{color:"white",strokeWidth:3.5,size:12,className:(0,j.default)("transition-all duration-150",a?"opacity-100 scale-100":"opacity-50 scale-0")})}))}let P=e=>{let{shown:s,accountId:n,onClose:i}=e,o=(0,f.useCreateTag)(),c=(0,D.useModalStore)(e=>e.clearEditTagModalSlug),[d,F]=(0,S.useState)(!1),[g,m]=(0,S.useState)(""),[y,h]=(0,S.useState)(()=>(0,p.randomTagColor)()),C=(0,S.useRef)(null);(0,B.default)(C,{delay:250});let x=async()=>{let e=g.trim();if(!e)return void T.default.error("Please enter a tag name");F(!0);let u=(0,p.slugifyTag)(e);try{await o.mutateAsync({tag:{name:e,color:y,slug:u},accountId:n}),i(),c(),(0,T.default)('"'.concat(e,'" tag created'),{duration:4e3})}catch(e){}finally{F(!1)}};return(0,u.jsxs)(l.Modal,{title:"Create New Tag",open:s,onOpenChange:i,className:"w-[350px]",trapFocus:!0,children:[(0,u.jsx)(k.InputWithLabel,{label:"Tag Name",ref:C,value:g,onChange:e=>m(e.target.value),onKeyDown:e=>{"Enter"===e.key&&x()},placeholder:"Enter tag name",maxLength:50,className:"-mt-1"}),(0,u.jsxs)(a.VStack,{className:"gap-2",children:[(0,u.jsx)(r.P3,{children:"Tag Color"}),(0,u.jsx)(Q,{className:"w-full justify-between",selectedColor:y,onSelectColor:h})]}),(0,u.jsxs)(a.VStack,{className:"gap-2 items-start",children:[(0,u.jsx)(r.P3,{children:"Preview"}),(0,u.jsx)(E.default,{className:(0,j.default)("transition duration-200",!g&&"opacity-50"),tag:{name:g||"Preview",color:y,slug:(0,p.slugifyTag)(g)}})]}),(0,u.jsxs)(a.HStack,{className:"justify-end gap-2 mt-3",children:[(0,u.jsx)(t.Button,{variant:"white",onClick:i,children:"Cancel"}),(0,u.jsx)(t.Button,{variant:"primary",icon:(0,u.jsx)(A.Plus,{size:14}),onClick:x,loading:d,disabled:!g.trim(),children:"Create Tag"})]})]})},O=e=>{let{shown:i,accountId:o,onClose:F}=e,[p,h]=(0,S.useState)(o);null!=o&&p!==o&&h(o),(0,y.default)(null!=p,"EditTagModal opened without an account");let x=(0,s.useAccounts)().find(e=>e.id===p),v=(0,f.useAccountTags)(p),{hasTouch:w}=(0,m.useBrowserInfo)(),{modal:D,showModal:j}=(e=>
2{let[t,a]=(0,S.useState)(!1),{mount:l,show:r}=(0,C.default)(t);return{modal:l?(0,u.jsx)(P,{shown:r,accountId:e,onClose:()=>a(!1)}):null,showModal:()=>a(!0)}})(p);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(l.Modal,{open:i,onOpenChange:F,className:"w-[500px]",trapFocus:!1,closeOnEscapeKeyDown:()=>!V(),children:[(0,u.jsxs)(l.ModalHeader,{withBackground:!0,children:[(0,u.jsx)(l.ModalTitle,{children:"Manage Tags"}),(0,u.jsx)(a.VStack,{children:x&&(0,u.jsxs)(r.P2,{children:["You're editing tags for ",(0,u.jsx)(c.default,{size:"sm",account:x,className:"align-middle"}),". Each social set has its own set of tags."," ",(0,u.jsx)(n.default,{href:d.default.support.metadata,children:"Learn more."})]})})]}),(0,u.jsx)(a.HStack,{className:"mb-1 mx-auto gap-2 justify-center flex-wrap",children:(0,u.jsx)(t.Button,{variant:"white",size:"small",icon:(0,u.jsx)(A.Plus,{size:14}),onClick:j,children:"Create New Tag"})}),(null==v?void 0:v.length)===0?(0,u.jsx)(a.VStack,{className:"gap-2 my-5 min-w-0 max-w-full items-center",children:(0,u.jsx)(r.P3,{className:"text-center text-typ-c3",children:"Use tags to categorize and filter your drafts."})}):(0,u.jsxs)(a.VStack,{className:"gap-2 min-w-0 max-w-full",children:[(0,u.jsxs)(r.P3,{className:"text-center pb-1",children:[w?"Tap":"Click"," on a tag name or color to edit it."]}),null==v?void 0:v.map(e=>(0,u.jsx)(R,{tag:e,accountId:p},e.slug))]}),x&&v&&(0,u.jsx)(g.TagImportControls,{targetAccountId:x.id,currentTags:v})]}),D]})},L=e=>document.querySelector('[data-tag-row-id="'.concat(e,'"]')),R=e=>{let{tag:t,accountId:l}=e,[r,n]=(0,S.useState)(!1),[c,d]=(0,S.useState)(!1),g=(0,S.useRef)(null),m=(0,h.default)(),[y,C]=(0,F.useWorkspaceTags)(),A=l===(0,s.useAppSelectedAccountId)(),{tagSlug:k}=(0,D.useModalStore)(e=>e.editTagModal),E=(0,D.useModalStore)(e=>e.clearEditTagModalSlug),B=(0,f.useSyncTag)(),T=(0,f.useDeleteTag)(),b=(0,S.useRef)(!1);(0,S.useEffect)(()=>{if(k===t.slug&&!b.current){var e;b.current=!0,n(!0),null==(e=L(t.slug))||e.scrollIntoView({behavior:"smooth",block:"center"})}},[k,t]),(0,S.useEffect)(()=>{d(!1)},[t]),(0,S.useEffect)(()=>{r&&g.current&&(g.current.focus(),t.slug.startsWith("new-tag")&&g.current.select(),k===t.slug&&g.current&&E())},[r,k,t.slug,E]);let I=()=>{var e;let u=null==(e=g.current)?void 0:e.value.trim();u&&u!==t.name?(B.mutate({newName:u,slug:t.slug,accountId:l}),n(!1),setTimeout(()=>{var e;null==(e=L((0,p.slugifyTag)(u)))||e.scrollIntoView({behavior:"smooth",block:"center"})},200)):n(!1)},q=async()=>{await m({title:"Delete tag",body:"Are you sure you want to delete this tag?",ctaLabel:"Delete",ctaIcon:v.Trash,ctaVariant:"destructive",cancelLabel:"Cancel"})&&T.mutate({slug:t.slug,accountId:l})};return(0,u.jsxs)(a.HStack,{className:(0,j.default)("group relative min-w-0 max-w-full rounded-full px-2.5 py-1.5 gap-2.5",r?"bg-typ-100 dark:bg-typ-600! dark:hover:bg-typ-550!":"hover:bg-typ-50 dark:hover:bg-typ-650!"),noWrap:!0,style:{"--tag-color":(0,p.tagCssColor)(t.color,1)},"data-tag-row-id":t.slug,children:[(0,u.jsx)("div",{className:(0,j.default)("absolute inset-0 rounded-full bg-(--tag-color) transition-all duration-100",r?"opacity-20 group-hover:opacity-25":"opacity-10 group-hover:opacity-20 dark:group-hover:opacity-15")}),(0,u.jsx)(i.default,{className:"relative z-1 rounded-full after:border after:border-(--tag-color) after:transition-all after:duration-100 after:absolute after:inset-0 after:rounded-full after:opacity-0 group-hover:after:opacity-40 hover:after:opacity-80",onClick:()=>{d(!c)},children:(0,u.jsx)("div",{className:"size-3 rounded-full cursor-pointer flex-shrink-0 flex items-center justify-center",style:{background:(0,p.tagCssColor)(t.color,1)}})}),r?(0,u.jsx)("input",{ref:g,className:"text-xs text-typ-c2 min-w-0 flex-1 appearance-none outline-none z-1",defaultValue:t.name||"",onBlur:I,onKeyDown:e=>{"Escape"===e.key?n(!1):"Enter"===e.key&&I()}}):(0,u.jsx)("span",{className:"text-xs text-typ-c2 min-w-0 flex-1 cursor-pointer truncate z-1",onClick:()=>{n(!0)},children:t.name||(0,u.jsx)("span",{className:"opacity-50 italic",children:"Untitled"})}),(0,u.jsxs)(a.HStack,{className:"justify-end no-touch:opacity-0 group-hover:opacity-100 focus:opacity-100 z-1",children:[A&&(0,u.jsx)(o.default,{size:16,icon:(0,u.jsx)(x.Eye,{}),variant:"regular",onClick:()=>{(null==y?void 0:y.includes(t.slug))?C(y.filter(e=>e!==t.slug)):C([t.slug])},tooltip:{title:"Filter drafts by tag"},className:"dark:text-typ-c2",hitInsetClassName:"max-desktop:hidden dark:has-hover:hover:bg-white/10"}),(0,u.jsx)(o.default,{size:16,icon:(0,u.jsx)(w.X,{}),variant:"regular",onClick:q,tooltip:{title:"Delete tag"},className:"dark:text-typ-c2",hitInsetClassName:"dark:has-hover:hover:bg-white/10"})]}),c&&(0,u.jsx)("div",{className:"absolute top-10 left-1 z-10",children:(0,u.jsx)(K,{selectedColor:t.color,onSelectColor:e=>{B.mutate({newColor:e,slug:t.slug,accountId:l}),d(!1)},onClose:()=>d(!1)})})]})},V=()=>{let e=document.activeElement;return e&&"INPUT"===e.tagName};e.s(["default",0,function(){let e=(0,D.useModalStore)(e=>e.editTagModal),t=(0,D.useModalStore)(e=>e.hideEditTagModal),{mount:a,show:l}=(0,C.default)(e.shown);return a?(0,u.jsx)(O,{shown:l,accountId:e.accountId,onClose:()=>{t()}}):null},"useEditTag",0,()=>{let e=(0,D.useModalStore)(e=>e.showEditTagModal);return(u,t)=>{e(u,t)}}],781638);var W=e.i(394487),H=e.i(663973),U=e.i(622618),G=e.i(345988),X=e.i(417524),Y=e.i(575216),J=e.i(105585),Z=e.i(759383),$=e.i(13561),ee=e.i(673073);function eu(){let e=(0,H.useQueryClient)(),u=(0,$.useFeatureEnabled)($.featureFlagKeys.useNewApi);return t=>{let a=Y.useDraftStore.getState().getDraft(t);if(a)return a;
2if(u){let u=e.getQueryData((0,J.retrieveDraftQueryKey)({path:{draft_id:t}}));return u?(0,Z.apiDraftToLegacyDraft)(u):void 0}return e.getQueryData(ee.queries.drafts.get(t).queryKey)}}e.s(["useReadCachedDraft",0,eu],841995),e.i(968344);var et=e.i(683500),ea=e.i(221582),el=e.i(577735);let er={selectNextThread:!0,notifyErrors:!0,deleteOnTwitter:!1,deleteOnLinkedinV2:!1,deleteOnMastodon:!1,deleteOnThreads:!1,deleteOnBluesky:!1,deleteOnSubstack:!1};e.s(["default",0,function(){let e=(0,H.useQueryClient)(),u=(0,U.useInvalidateSidebarDrafts)(),{invalidateAllDraftLists:t}=(0,G.useDraftCacheMutations)(),a=function(){let e=(0,H.useQueryClient)(),u=(0,s.useAppSelectedAccountId)(),{onDraftDeleted:t}=(0,G.useDraftCacheMutations)();return(0,S.useCallback)(a=>{let l=Y.useDraftStore.getState().selectedDraftId,r=l===a,s=null;if(r&&u){var n;s=null!=(n=(0,X.findAdjacentDraftIdInSidebarCache)({queryClient:e,accountId:u,draftId:a,direction:"down"}))?n:(0,X.findAdjacentDraftIdInSidebarCache)({queryClient:e,accountId:u,draftId:a,direction:"up"})}t(a),e.setQueriesData({queryKey:["drafts","search"],exact:!1},e=>e&&Array.isArray(e)?e.filter(e=>e.id!==a):e),r&&(Y.useDraftStore.getState().setSelectedDraftId(s),Y.useDraftStore.getState().removeDraft(l))},[e,u,t])}(),l=(0,Y.useSetAppSelectedDraftId)(),r=eu();return(0,W.useMutation)({onMutate:async e=>{var u;let t=r(e.draftId);return{wasScheduled:null!=(u=e.wasScheduled)?u:(null==t?void 0:t.status)===ea.DraftStatus.Scheduled,accountId:null==t?void 0:t.account}},mutationFn:async u=>{let t=u.draftId,l=(0,b._)({},er,u.options);await Promise.all([e.cancelQueries({queryKey:ee.queries.drafts.list._def}),e.cancelQueries({queryKey:ee.queries.drafts.window._def})]),a(t),await (0,et.deleteDraft)({path:{draft_id:t},query:{"delete-on-twitter":l.deleteOnTwitter,"delete-on-linkedin_v2":l.deleteOnLinkedinV2,"delete-on-mastodon":l.deleteOnMastodon,"delete-on-bluesky":l.deleteOnBluesky,"delete-on-threads":l.deleteOnThreads,"delete-on-substack":l.deleteOnSubstack},throwOnError:!0})},onSuccess:(t,a,l)=>{let r=(0,b._)({},er,a.options);u("currently-selected-filter").then(()=>{var e;null==r||null==(e=r.onDeleted)||e.call(r)}),e.invalidateQueries({queryKey:ee.queries.scheduling.nextFreeSlot._def}),(null==l?void 0:l.wasScheduled)&&(e.invalidateQueries({queryKey:ee.queries.accounts.publishingQuota._def}),e.invalidateQueries({queryKey:null!=l.accountId?ee.queries.drafts.scheduledCount(l.accountId).queryKey:ee.queries.drafts.scheduledCount._def}))},onError:(a,r)=>{let s=(0,b._)({},er,r.options);t(),e.invalidateQueries({queryKey:ee.queries.drafts.search._def}),(null==s?void 0:s.notifyErrors)&&((0,el.notifApiError)(a,{id:"delete-thread"}),u("currently-selected-filter").then(()=>{l(r.draftId)}))}})}],460094)}]); 3 4//# debugId=40e68ffd-3208-69b8-b3c6-2ade311a9e76 5//# sourceMappingURL=09fktex1fo06v.js.map
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.