PageSourceSearch

https://myregimen.ai/_next/static/chunks/4670.019787cfd40a1895.js

js myregimen.ai collected 2026-10-05 13:48:26 UTC 89,065 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4670],{68087:function(e,t,l){var s=l(57437),a=l(34703),n=l(8502);l(2265),t.Z=function(e){let t=e.compact?"w-full h-[180px] min-h-[180px]":"w-full min-h-[235px] h-[235px] md:h-[420px]";return e.sourceData.metadata.documentType==a.n_.PODCAST&&e.sourceData.metadata.documentUrl&&(0,n.Qu)(e.sourceData.metadata.documentUrl)&&(0,s.jsx)("div",{className:"flex justify-center items-center w-full ".concat(e.compact?"min-h-[180px]":"min-h-[235px] md:min-h-[420px]"),children:(0,s.jsx)("iframe",{src:"".concat(e.sourceData.metadata.documentUrl,"&t=").concat(e.sourceData.metadata.startTime||0),style:{borderRadius:"12px"},className:e.disabled?"".concat(t," select-none"):t,allow:"autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture",loading:"lazy",...e.disabled&&{tabIndex:-1}})})}},41570:function(e,t,l){var s=l(57437),a=l(8502);l(2265),t.Z=function(e){let t=e.compact?"w-full h-[180px] min-h-[180px]":"w-full min-h-[235px] h-[235px] md:h-[420px]",l=e.sourceData.metadata.documentUrl,n=(0,a.zU)(l),i=(0,a.MU)(l),r=Math.max(0,Math.floor(e.sourceData.metadata.startTime||0));if(!n||!i)return null;let o="".concat(i,"?t=").concat(r);return(0,s.jsx)("div",{className:"flex justify-center items-center w-full ".concat(e.compact?"min-h-[180px]":"min-h-[235px] md:min-h-[420px]"),children:(0,s.jsx)("iframe",{src:o,className:e.disabled?"".concat(t," select-none"):t,title:"Loom video player",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",...e.disabled&&{tabIndex:-1},allowFullScreen:!0},r)})}},59560:function(e,t,l){var s=l(57437),a=l(34703),n=l(8502);l(2265),t.Z=function(e){let t=e.compact?"w-full h-[180px] min-h-[180px]":"w-full min-h-[235px] h-[235px] md:h-[420px]",l=(0,n.H0)(e.sourceData.metadata.documentUrl);return(e.sourceData.metadata.documentType==a.n_.PODCAST||(0,n.nh)(e.sourceData.metadata.documentUrl))&&e.sourceData.metadata.documentUrl&&(0,n.nh)(e.sourceData.metadata.documentUrl)&&l&&(0,s.jsx)("div",{className:"flex justify-center items-center w-full ".concat(e.compact?"min-h-[180px]":"min-h-[235px] md:min-h-[420px]"),children:(0,s.jsx)("iframe",{src:"".concat(l,"?t=").concat(e.sourceData.metadata.startTime||0),style:{borderRadius:"12px"},className:e.disabled?"".concat(t," select-none"):t,allow:"autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture",loading:"lazy",...e.disabled&&{tabIndex:-1}})})}},42495:function(e,t,l){var s=l(57437),a=l(34703),n=l(8502);l(2265),t.Z=function(e){let t=e.compact?"w-full h-[180px] min-h-[180px]":"w-full min-h-[235px] h-[235px] md:h-[420px]",l=(0,n.MS)(e.sourceData.metadata.documentUrl);return(e.sourceData.metadata.documentType==a.n_.VIDEO||(0,n.SH)(e.sourceData.metadata.documentUrl))&&e.sourceData.metadata.documentUrl&&(0,n.SH)(e.sourceData.metadata.documentUrl)&&l&&(0,s.jsx)("div",{className:"flex justify-center items-center w-full ".concat(e.compact?"min-h-[180px]":"min-h-[235px] md:min-h-[420px]"),children:(0,s.jsx)("iframe",{src:"".concat(l,"#t=").concat(e.sourceData.metadata.startTime||0,"s"),className:e.disabled?"".concat(t," select-none"):t,allow:"accelerometer; fullscreen; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",title:"Vimeo video player",referrerPolicy:"strict-origin-when-cross-origin",...e.disabled&&{tabIndex:-1}},e.sourceData.metadata.startTime||0)})}},84814:function(e,t,l){var s=l(57437),a=l(34703),n=l(8502);l(2265);var i=l(5222);t.Z=function(e){let t=e.compact?"w-full h-[180px] min-h-[180px]":"w-full min-h-[235px] h-[235px] md:h-[420px]",l=(0,n.eu)(e.sourceData.metadata.documentUrl);return(e.sourceData.metadata.documentType==a.n_.VIDEO||(0,n._T)(e.sourceData.metadata.documentUrl))&&e.sourceData.metadata.documentUrl&&(0,n._T)(e.sourceData.metadata.documentUrl)&&l&&(0,s.jsxs)(s.Fragment,{children:[!!e.sourceData.metadata.startTime&&!!e.sourceData.metadata.endTime&&(0,s.jsxs)("div",{className:"text-xs mb-1",children:[(0,s.jsx)("span",{children:(0,i.Iy)(e.sourceData.metadata.endTime-e.sourceData.metadata.startTime,!0)}),(0,s.jsx)("span",{children:"\xa0("}),(0,s.jsx)("span",{children:(0,i.Iy)(e.sourceData.metadata.startTime,!1)}),(0,s.jsx)("span",{children:"\xa0-\xa0"}),(0,s.jsx)("span",{children:(0,i.Iy)(e.sourceData.metadata.endTime,!1)}),(0,s.jsx)("span",{children:")"})]}),(0,s.jsx)("div",{className:"flex justify-center items-center w-full ".concat(e.compact?"min-h-[180px]":"min-h-[235px] md:min-
1h-[420px]"),children:(0,s.jsx)("iframe",{src:"".concat(l,"?start=").concat(e.sourceData.metadata.startTime||0,"&end=").concat(e.sourceData.metadata.endTime||0),className:e.disabled?"".concat(t," select-none"):t,title:"YouTube video player",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",...e.disabled&&{tabIndex:-1},allowFullScreen:!0})})]})}},64670:function(e,t,l){l.r(t),l.d(t,{default:function(){return tl}});var s=l(57437),a=l(26068),n=l(56806),i=l(42840),r=l(68087),o=l(41570),d=l(59560),c=l(42495),u=l(84814),m=l(86572),x=l(89557),h=l(51747),p=l(63554),f=l(75947),g=l(22515),b=l(14936),v=l(76720),y=l(93844),j=l(87226),w=l(64205),k=l(5222),N=l(99605),C=l(8502),S=l(95535),P=l(83571);let T=["documentUrl","url","video_url","videoUrl","sourceUrl"];function Z(e){var t,l,s;let a=null!==(s=null===(t=e.input)||void 0===t?void 0:t.documentId)&&void 0!==s?s:null===(l=e.input)||void 0===l?void 0:l.document_id;return null==a||""===a?void 0:String(a)}function D(e){var t,l,s;let a=null!==(s=null===(t=e.output)||void 0===t?void 0:t.documentId)&&void 0!==s?s:null===(l=e.output)||void 0===l?void 0:l.document_id;return null==a||""===a?void 0:String(a)}function I(e){for(let l of T){var t;let s=null===(t=e.input)||void 0===t?void 0:t[l];if("string"==typeof s&&s.trim())return s}}function E(e){var t;return null!==(t=(0,C.B7)(I(e)))&&void 0!==t?t:void 0}function _(e){var t;let l=null===(t=e.input)||void 0===t?void 0:t.documentType;return"string"==typeof l?l:void 0}function A(e){let t=new Set,l=new Set;return e.forEach(e=>{let s=Z(e),a=D(e),n=E(e);s&&t.add(s),a&&t.add(a),n&&l.add(n)}),{ids:t,urlKeys:l}}function M(e,t){let l=Z(e);if(l&&l===t.id)return!0;let s=D(e);if(s&&s===t.id)return!0;let a=(0,C.B7)(t.documentUrl),n=E(e);return!!a&&!!n&&a===n}function L(e,t,l){var s,a;let n=null!==(s=t.find(t=>M(t,e)))&&void 0!==s?s:null;if(n)return{processingJob:n,failedJob:null,matchedJob:n,isProcessing:!0,isFailed:!1};let i=null!==(a=l.find(t=>M(t,e)))&&void 0!==a?a:null;return{processingJob:null,failedJob:i,matchedJob:i,isProcessing:!1,isFailed:!!i,failedErrorMessage:null==i?void 0:i.errorMessage}}var O=l(11159),F=l(93819),z=l(34703),U=l(81013),R=l(13234),W=l(87075),B=l(11743),G=l(74119),V=l(85157),H=l(97121),K=l(34628),Y=l(40099),J=l(71583),q=l(33145),X=l(99376),Q=l(74589),$=l(663),ee=l(61963),et=l(19391),el=l(76776),es=l(73977),ea=l(12455),en=l(36261),ei=l(18223),er=l(95280),eo=l(31835),ed=l(9969),ec=l(51722),eu=l(793),em=l(27350),ex=l(22347),eh=l(79318),ep=l(82995),ef=l(68045),eg=l(66838),eb=l(16116),ev=l(16875),ey=l(49715),ej=l(66825),ew=l(95386),ek=l(1589),eN=l(73697),eC=l(88654),eS=l(93702),eP=l(2265),eT=l(54887),eZ=l(7715),eD=l(73985),eI=l(9391),eE=l(67615),e_=l(8319),eA=l(78602),eM=l(99636),eL=l(64110),eO=l(29588),eF=l(58841),ez=l(4721);let eU="linkedin_post_settings",eR=[{value:"insight",label:"\uD83D\uDCA1 Insight"},{value:"story",label:"\uD83D\uDCD6 Story"},{value:"how-to",label:"\uD83C\uDFAF How-To"},{value:"question",label:"❓ Thought-Provoking Question"},{value:"listicle",label:"\uD83D\uDCDD Listicle"},{value:"behind-the-scenes",label:"\uD83C\uDFAC Behind-The-Scenes"},{value:"personal-experience",label:"\uD83C\uDF1F Personal Experience"},{value:"framework",label:"\uD83D\uDD27 Framework"}],eW=[{value:"claude-3-7-sonnet-20250219",label:"Claude 3.7 Sonnet (Recommended)"},{value:"claude-sonnet-4-5-20250929",label:"Claude 4.5 Sonnet"},{value:"claude-haiku-4-5-20251001",label:"Claude 4.5 Haiku"},{value:"claude-sonnet-4-20250514",label:"Claude 4 Sonnet"},{value:"gpt-5",label:"GPT-5"},{value:"gpt-5-mini",label:"GPT-5 Mini"},{value:"gpt-4o",label:"GPT-4o"},{value:"gpt-4o-mini",label:"GPT-4o Mini"},{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro"},{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash"},{value:"gemini-3.1-flash-lite-preview",label:"Gemini 3.1 Flash Lite Preview"},{value:"gemini-3-pro-preview",label:"Gemini 3 Pro Preview"},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash Preview"}],eB=[{value:"short",label:"Short (80-150 words)"},{value:"medium",label:"Medium (150-300 words)"},{value:"long",label:"Long (300-500 words)"}],eG=["Reading your content...","Creating your unique tone of voice...","Finding unique post ideas...","Creating a post...","Finalizing..."];function eV(e){let{document:t,leader:l,isOpen:a,onClose:n}=e,i=(0,B.E)(),r=(0,Y._)(),{logger:o}=(0,K.w)(),d=(0,X.useRouter)(),c=(0,X.useSearchParams)(),[u,m]=(0,eP.useState)(!1),[x,h]=(0,eP.useState)(""),[p,f]=(0,eP.useState)(!1),[g,b]=(0,eP.useState)("insight"),[v,y]=(0,eP.useState)("claude-3-7-sonnet-20250219"),[j,k]=(0,eP.useState)(!1),[N,C]=(0,eP.useState)("medium"),[S,P]=(0,eP.useState)(""),[T,Z]=(0,eP.useState)(0),[D,I]=(0,eP.useState)(!1);(0,eP.useEffect)(()=>{try{let e=localStorage.getItem(eU);if(e){let t=JSON.parse(e);b(t.postStyle||"insight"),y(t.selectedModel||"claude-3-7-sonnet-20250219"),k(t.includeEmojis||!1),C(t.contentLength||"medium")}}catch(e){(0,w.H)(o,"Failed to load LinkedIn post settings from localStorage",e)}I(!0)},[]),(0,eP.useEffect)(()=>
1{if(a&&D){let e=c.get("style"),t=c.get("model"),l=c.get("emojis"),s=c.get("length");e&&eR.some(t=>t.value===e)&&b(e),t&&eW.some(e=>e.value===t)&&y(t),null!==l&&k("true"===l),s&&eB.some(e=>e.value===s)&&C(s)}},[a,D,c]),(0,eP.useEffect)(()=>{if(a&&t&&D){let e=new URLSearchParams(window.location.search);e.has("view")||e.set("view","content"),e.set("linkedin","true"),e.set("doc",t.id),e.set("style",g),e.set("model",v),e.set("emojis",j.toString()),e.set("length",N),d.replace("".concat(window.location.pathname,"?").concat(e.toString()),{scroll:!1})}},[a,t,g,v,j,N,D]),(0,eP.useEffect)(()=>{a&&t&&D&&!u&&!p&&"true"===c.get("autoGenerate")&&_()},[a,t,D,c]),(0,eP.useEffect)(()=>{if(u){Z(0),P(eG[0]);let e=setInterval(()=>{Z(t=>{let l=t+1;return l>=eG.length?(clearInterval(e),t):(P(eG[l]),l)})},2e3);return()=>clearInterval(e)}},[u]);let E=()=>{try{localStorage.setItem(eU,JSON.stringify({postStyle:g,selectedModel:v,includeEmojis:j,contentLength:N}))}catch(e){(0,w.H)(o,"Failed to save LinkedIn post settings to localStorage",e)}},_=async()=>{if(t)try{m(!0),f(!1);let e=await (0,ez.XV)(i,{document_id:t.id,leader_id:l.id,leader_alias:l.feWebAlias,post_style:g,model:v,include_emojis:j,content_length:N});h(e.post),f(!0),E()}catch(e){(0,w.H)(o,"Failed to generate LinkedIn post",e),null==r||r({severity:"error",message:"Failed to generate LinkedIn post. Please try again."})}finally{m(!1)}},A=async e=>{if(null==e||e.preventDefault(),t)try{m(!0),f(!1),h("");let e=await (0,ez.XV)(i,{document_id:t.id,leader_id:l.id,leader_alias:l.feWebAlias,post_style:g,model:v,regeneration_seed:"regen_".concat(Date.now(),"_").concat(Math.random().toString(36).substring(2,9)),include_emojis:j,content_length:N});h(e.post),f(!0),E()}catch(e){console.error("Regeneration failed:",e),(0,w.H)(o,"Failed to regenerate LinkedIn post",e),null==r||r({severity:"error",message:"Failed to regenerate LinkedIn post. Please try again."})}finally{m(!1)}},M=async()=>{try{await navigator.clipboard.writeText(x),null==r||r({severity:"success",message:"Post copied to clipboard!"})}catch(e){(0,w.H)(o,"Failed to copy to clipboard",e),null==r||r({severity:"error",message:"Failed to copy to clipboard. Please try again."})}},L=()=>{h(""),f(!1),m(!1);let e=new URLSearchParams(window.location.search);e.delete("linkedin"),e.delete("doc"),e.delete("style"),e.delete("model"),e.delete("emojis"),e.delete("length"),e.delete("autoGenerate");let t=e.toString()?"".concat(window.location.pathname,"?").concat(e.toString()):window.location.pathname;d.replace(t,{scroll:!1}),n()};return(0,s.jsxs)(ey.Z,{open:a,onClose:L,maxWidth:"md",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",maxHeight:"85vh"}},children:[(0,s.jsxs)(eD.Z,{sx:{m:0,p:2,display:"flex",alignItems:"center"},children:[(0,s.jsx)(eA.Z,{sx:{mr:1,color:"#0077B5"}}),(0,s.jsx)("span",{className:"flex-1 font-semibold",children:"Generate LinkedIn Post"}),(0,s.jsx)(en.Z,{"aria-label":"close",onClick:L,sx:{color:e=>e.palette.grey[500]},children:(0,s.jsx)($.Z,{})})]}),(0,s.jsx)(ej.Z,{dividers:!0,children:p?(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"bg-gray-50 rounded-lg p-4 border border-gray-200",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-full bg-gray-300 overflow-hidden",children:l.feAvatar&&(0,s.jsx)("img",{src:l.feAvatar,alt:l.feFullName||l.name,className:"w-full h-full object-cover"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-semibold text-sm",children:l.feFullName||l.name}),(0,s.jsx)("p",{className:"text-xs text-gray-500",children:"Just now"})]})]}),(0,s.jsx)(ea.Z,{title:"Copy to clipboard",children:(0,s.jsx)(en.Z,{onClick:M,size:"small",sx:{color:e=>e.palette.grey[500],"&:hover":{color:e=>e.palette.grey[700]}},children:(0,s.jsx)(eF.Z,{fontSize:"small"})})})]}),(0,s.jsx)("div",{className:"whitespace-pre-wrap text-gray-800 leading-relaxed",children:x})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3 justify-end pt-2",children:[(0,s.jsxs)("button",{onClick:A,disabled:u,className:"flex items-center gap-2 rounded-full px-6 py-2.5 text-black bg-white border border-gray-300 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:[(0,s.jsx)(eM.Z,{className:"w-5 h-5"}),"Regenerate"]}),(0,s.jsxs)("button",{onClick:()=>{let e=encodeURIComponent(x);window.open("https://www.linkedin.com/feed/?shareActive&mini=true&text=".concat(e),"_blank","noopener,noreferrer")},disabled:u,className:"flex items-center gap-2 rounded-full px-6 py-2.5 text-white bg-[#0077B5] hover:bg-[#006097] disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:[(0,s.jsx)(eL.Z,{className:"w-5 h-5"}),"Share"]})]})]}):(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"bg-blue-50 rounded-lg p-4 border border-blue-200",children:[(0,s.jsxs)("p",{className:"text-sm text-blue-800 mb-3",children:[(0,s.jsx)("strong",{children:"Document:"})," ",null==t?void 0:t.name]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)(ex.Z,{fullWidth:!0,size:"small",children:[(0,s.jsx)(eI.Z,{id:"post-style-label",children:"Post Style"}),(0,s.jsx)(eh.Z,{labelId:"post-style-label",value:g,label:"Post Style",onChange:e=>b(e.target.value),disabled:u,children:eR.map(e=>(0,s.jsx)(er.Z,{value:e.value,children:e.label},e.value))})]}),(0,s.jsxs)(ex.Z,{fullWidth:!0,size:"small",children:[(0,s.jsx)(eI.Z,{id:"model-label",children:"AI Model"}),(0,s.jsx)(eh.Z,{labelId:"model-label",value:v,label:"AI Model",onChange:e=>y(e.target.value),disabled:u,children:eW.map(e=>(0,s.jsx)(er.Z,{value:e.value,children:e.label},e.value))})]}),(0,s.jsxs)(ex.Z,{fullWidth:!0,size:"small",children:[(0,s.jsx)(eI.Z,{id:"content-length-label",children:"Content Length"}),(0,s.jsx)(eh.Z,{labelId:"content-length-label",value:N,label:"Content Length",onChange:e=>C(e.target.value),disabled:u,children:eB.map(e=>(0,s.jsx)(er.Z,{value:e.value,children:e.label},e.value))})]}),(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)(eE.Z,{control:(0,s.jsx)(eu.Z,{checked:j,onChange:e=>k(e.target.checked),disabled:u,color:"primary"}),label:"Include emojis"})})]})]}),u?(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[(0,s.jsx)(e_.Z,{size:48}),(0,s.jsx)("div",{className:"text-center",children:(0,s.jsx)("p",{className:"text-lg font-medium text-gray-700 animate-pulse",children:S})})]}):(0,s.jsx)("div",{className:"flex justify-center pt-4",children:(0,s.jsxs)("button",{onClick:_,className:"flex items-center gap-2 rounded-full px-8 py-3 text-white bg-[#0077B5] hover:bg-[#006097] transition-all shadow-lg hover:shadow-xl transform hover:scale-105",children:[(0,s.jsx)(eO.Z,{className:"w-5 h-5"}),"Generate Post"]})})]})})]})}var eH=l(19396),eK=l(18944),eY=l(40048),eJ=l(91406),eq=l(10560),eX=l(60366),eQ=l(2880);let e$="Please enable all-access subscription in the Subscriptions tab to make content premium";function e0(e){return(0,C._T)(e)||(0,C.SH)(e)||(0,C.zU)(e)}let e1="flex h-10 shrink-0 items-center justify-center rounded-full border border-black/20 px-2.5 sm:px-3 transition-all disabled:opacity-50 text-sm",e2="rounded-[24px] border-2 border-neutral-200 bg-white text-neutral-800 shadow-xl",e5={popper:{sx:{zIndex:10050}}},e4=(0,eP.memo)(function(e){let{selectedCount:t,isProcessing:l,hasFinalized:a,hasErrors:n,accessMode:i,onSetAccessFree:r,onSetAccessPaid:o,onAddTags:d,onCreatePlaybook:c,showCreatePlaybook:u,onDelete:m,onRetryFailed:x}=e,[h,p]=(0,eP.useState)(null);return(0,y.t)(),(0,s.jsxs)("div",{className:"fixed left-1/2 z-[10000] inline-flex w-fit min-w-max max-w-[min(100vw-2rem,420px)] -translate-x-1/2 flex-col items-center gap-2 px-3.5 py-3 font-sans ".concat(e2),style:{bottom:"max(1.5rem, env(safe-area-inset-bottom, 1.5rem))"},role:"group","aria-label":"Selection actions",children:[(0,s.jsxs)("span",{className:"text-base font-medium leading-snug whitespace-nowrap [text-wrap:pretty]",children:[t," selected"]}),l?(0,s.jsxs)("div",{className:"flex w-full items-center justify-center gap-2.5 py-0.5",children:[(0,s.jsx)("span",{className:"inline-block h-5 w-5 flex-shrink-0 rounded-full border-2 border-neutral-600 border-t-transparent animate-spin"}),(0,s.jsx)("span",{className:"text-base font-medium leading-snug",children:"Processing…"})]}):(0,s.jsxs)("div",{className:"flex flex-nowrap items-center justify-center gap-2",children:[n&&(0,s.jsx)(ea.Z,{title:"Retry all failed",placement:"top",slotProps:e5,children:(0,s.jsxs)("button",{onClick:x,className:"".concat(e1," bg-white text-black"),children:[(0,s.jsx)(el.Z,{sx:{fontSize:16,marginRight:.5}}),"Retry"]})}),u&&c&&(0,s.jsxs)("button",{type:"button",onClick:c,className:"".concat(e1," bg-white text-black border-black/30"),children:[(0,s.jsx)(ee.Z,{sx:{fontSize:16,marginRight:.5}}),"Make Playbook"]}),a&&(0,s.jsx)("button",{type:"button",onClick:d,className:"".concat(e1," bg-white text-black border-black/30"),children:"Add Tags"}),(0,s.jsx)(ea.Z,{title:"Delete",placement:"top",slotProps:e5,children:(0,s.jsx)("button",{onClick:m,className:"flex h-9 w-9 sm:h-10 sm:w-10 shrink-0 items-center justify-center rounded-full border border-warning-color text-warning-color hover:bg-warning-color/10 transition-all disabled:opacity-50",children:(0,s.jsx)($.Z,{className:"h-5 w-5"})})}),a&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ea.Z,{title:"Free or paid access",placement:"top",slotProps:e5,children:(0,s.jsx)(en.Z,{type:"button",onClick:e=>p(e.currentTarget),className:"h-10 w-10 shrink-0 rounded-full border border-neutral-300 text-neutral-700 hover:bg-neutral-200/80","aria-label":"Access: free or paid","aria-haspopup":"menu","aria-expanded":!!h,children:(0,s.jsx)(et.Z,{sx:{fontSize:22}})})}),(0,s.jsxs)(ei.Z,{anchorEl:h,open:!!h,onClose:()=>p(null),anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"},sx:{zIndex:10050},slotProps:{root:{sx:{zIndex:10050}},paper:{sx:{mt:-.5,zIndex:10050}}},MenuListProps:{sx:{py:0}},children:[(0,s.jsxs)(er.Z,{onClick:()=>{r(),p(null)},selected:"free"===i,sx:{gap:1},children:[(0,s.jsx)(eY.Z,{sx:{fontSize:20}}),"Free"]}),(0,s.jsxs)(er.Z,{onClick:()=>{o(),p(null)},selected:"paid"===i,sx:{gap:1},children:[(0,s.jsx)(eK.Z,{sx:{fontSize:20}}),"Paid"]})]})]})]})]})}),e3=(0,eP.memo)(function(){return(0,y.t)(),(0,s.jsxs)("div",{className:"fixed left-1/2 z-[10000] flex w-full max-w-md min-w-[min(100vw-2rem,320px)] -translate-x-1/2 items-center gap-3 rounded-[24px] px-3.5 py-3 font-sans ".concat(e2),style:{bottom:"max(1.5rem, env(safe-area-inset-bottom, 1.5rem))"},children:[(0,s.jsx)("span",{className:"inline-block h-6 w-6 flex-shrink-0 rounded-full border-2 border-neutral-600 border-t-transparent animate-spin"}),(0,s.jsx)("p",{className:"min-w-0 grow text-base font-medium leading-snug [text-wrap:pretty]",children:"Processing your content."})]})});function e8(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function e6(e){return e.trim().replace(/\s+/g," ")}let e7="__manage_tags__";function e9(e,t){let l=new Map;
1return e.forEach(e=>l.set(e.id,e)),t.forEach(e=>l.set(e.id,e)),Array.from(l.values()).sort((e,t)=>e.label.localeCompare(t.label))}function te(e){let{tags:t,limit:l=3,onOpenDocument:a}=e;if(!(null==t?void 0:t.length))return null;let n=t.slice(0,l),i=t.length-n.length,r=a?"button":"span";return(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1 pt-1",children:[n.map(e=>(0,s.jsx)(r,{type:a?"button":void 0,onClick:a,className:"inline-flex max-w-[140px] items-center truncate rounded-full border border-[#f4ead5] bg-[#fffdf6] px-2 py-0.5 text-[11px] font-medium hover:border-[#ecdcbf]",title:e.label,children:e.label},e.id)),i>0&&(0,s.jsxs)(r,{type:a?"button":void 0,onClick:a,className:"inline-flex rounded-full border border-[#f4ead5] bg-[#fffef9] px-2 py-0.5 text-[11px] font-medium hover:border-[#ecdcbf]",children:["+",i," more"]})]})}function tt(e){let{initialTags:t,savedTags:l,disabled:a,helperText:n,onChange:i}=e,[r,o]=(0,eP.useState)(t.map(e=>e.label)),[d,c]=(0,eP.useState)(""),[u,m]=(0,eP.useState)(!1),[x,h]=(0,eP.useState)(),p=t.map(e=>"".concat(e.id,":").concat(e.label)).join("|");(0,eP.useEffect)(()=>{o(t.map(e=>e.label))},[p]);let f=(0,eP.useMemo)(()=>{let e=new Map,t=new Set(r.map(e8)),s=e8(d);return l.forEach(l=>{let a=e8(l.label);a&&!t.has(a)&&(!s||a.includes(s))&&e.set(a,l.label)}),Array.from(e.values()).sort((e,t)=>e.localeCompare(t)).slice(0,8)},[l,r,d]),g=e=>{let t=new Map;return e.forEach(e=>{let l=e6(e),s=e8(l);s&&t.set(s,l)}),Array.from(t.values())},b=async e=>{o(e),m(!0);try{await i(e)||o(r)}finally{m(!1)}},v=async e=>{let t=e6(e);if(h(void 0),!t)return;if(t.length>40){h("Tags can be up to ".concat(40," characters."));return}let l=e8(t);if(r.some(e=>e8(e)===l)){c("");return}let s=g([...r,t]);c(""),await b(s)},y=async e=>{let t=e8(e);await b(r.filter(e=>e8(e)!==t))};return(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,s.jsx)(eo.Z,{value:d,disabled:a||u,onChange:e=>{h(void 0),c(e.target.value.slice(0,40))},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),v(d))},placeholder:"Add one tag",size:"small",helperText:x||n||"".concat(40," character max"),inputProps:{maxLength:40},sx:{flex:1,"& .MuiOutlinedInput-root":{borderRadius:"12px",backgroundColor:"white"}}}),(0,s.jsx)("button",{type:"button",className:"h-10 rounded-full border border-black/40 bg-black px-4 text-sm font-medium text-white transition-all hover:scale-[103%] disabled:cursor-not-allowed disabled:opacity-50",disabled:a||u||!e6(d),onClick:()=>v(d),children:u?"Adding...":"Add"})]}),f.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:f.map(e=>(0,s.jsx)("button",{type:"button",disabled:a||u,className:"rounded-full border border-border bg-white px-2.5 py-1 text-xs font-medium text-muted-foreground hover:border-black/40 disabled:opacity-50",onClick:()=>v(e),children:e},e))}),(0,s.jsx)("div",{className:"flex min-h-8 flex-wrap gap-1.5",children:r.length>0?r.map(e=>(0,s.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1 rounded-full border border-[#f4ead5] bg-[#fffdf6] px-2.5 py-1 text-xs font-medium",children:[(0,s.jsx)("span",{className:"truncate",children:e}),(0,s.jsx)("button",{type:"button",className:"text-muted-foreground hover:text-black disabled:opacity-50",disabled:a||u,onClick:()=>y(e),"aria-label":"Remove ".concat(e),children:"\xd7"})]},e)):(0,s.jsx)("span",{className:"text-sm text-text-color-2",children:"No tags yet"})})]})}function tl(e){let{leader:t,assistant:l,onAssistantUpdated:v,leaderSubscription:y,isLeaderSubscriptionLoading:T,onCreateDocument:D,hideRecordingSessionBooking:$=!1,hideUploadingNotification:et=!1,hideLibraryWhenEmpty:el=!1,onboardingCopy:ei=!1,onDocumentDeleted:ek,onCreatePlaybookFromDocuments:eN}=e,{leaderDocumentMap:eS,resetLeaderDocumentMap:eD,removeDocumentFromLeaderMap:eI,setLeaderDocumentsForSlug:eE}=(0,V.f)(),e_=(0,Y._)(),eA=(0,B.E)(),{logger:eM}=(0,K.w)(),{featureFlags:eL}=(0,G.s)(),{authStatus:eO,setShowSpinner:eF,showSpinner:ez,userData:eU}=(0,H.Z)(),eR=(0,X.useRouter)(),eW=(0,X.useSearchParams)(),eB=(0,ed.Z)("(min-width:768px)",{noSsr:!0}),[eG,eK]=(0,eP.useState)([]),[eY,e1]=(0,eP.useState)(0),[e2,e5]=(0,eP.useState)(""),te=(0,eP.useDeferredValue)(e2),[tl,ti]=(0,eP.useState)(!1),[tr,to]=(0,eP.useState)("all"),[td,tc]=(0,eP.useState)("all"),[tu,tm]=(0,eP.useState)(),[tx,th]=(0,eP.useState)(),tp=(0,eP.useRef)({}),[tf,tg]=(0,eP.useState)(!1),[tb,tv]=(0,eP.useState)(!1),[ty,tj]=(0,eP.useState)(!0),[tw,tk]=(0,eP.useState)(!1),[tN,tC]=(0,eP.useState)(!1),[tS,tP]=(0,eP.useState)(),[tT,tZ]=(0,eP.useState)("link"),[tD,tI]=(0,eP.useState)(!1),[tE,t_]=(0,eP.useState)(),[tA,tM]=(0,eP.useState)(),[tL,tO]=(0,eP.useState)(),[tF,tz]=(0,eP.useState)(!1),[tU,tR]=(0,eP.useState)(null),[tW,tB]=(0,eP.useState)(null),[tG,tV]=(0,eP.useState)(!1),[tH,tK]=(0,eP.useState)(new Set),[tY,tJ]=(0,eP.useState)([]),[tq,tX]=(0,eP.useState)(!1),[tQ,t$]=(0,eP.useState)([]),[t0,t1]=(0,eP.useState)(!1),[t2,t5]=(0,eP.useState)({}),[t4,t3]=(0,eP.useState)({});(0,eP.useEffect)(()=>{tp.current=null!=tx?tx:{}},[tx]);let t8=(0,eP.useCallback)(e=>{var t;if(!(null===(t=e.documentUrl)||void 0===t?void 0:t.trim())){null==e_||e_({severity:"warning",message:"This content can’t be used yet — wait until processing finishes and a link is available."});return}if(!e0(e.documentUrl)){null==e_||e_({severity:"warning",message:"Playbooks can only be created from YouTube, Vimeo, or Loom links."});return}eN&&!1!==eN([e])&&tK(new Set)},[eN,e_]),[t6,t7]=(0,eP.useState)("created"),[t9,le]=(0,eP.useState)("desc"),[lt,ll]=(0,eP.useState)(null),[ls,la]=(0,eP.useState)(null),[ln,li]=(0,eP.useState)(!1),[lr,lo]=(0,eP.useState)(!1),ld=(0,eP.useRef)([]),{backgroundTaskList:lc,localProcessingTasks:lu,recentlyCanceledDocumentIds:lm,recentlyCanceledDocumentUrlKeys:lx,getOptimisticJobIdsAndUrls:lh,fetchBackgroun
1dTaskList:lp,registerCanceledJob:lf,createBackgroundTask:lg}=(0,J.m)(),[lb,lv]=(0,eP.useState)([]),ly=(0,eP.useMemo)(()=>(lc||[]).filter(e=>e.status===b.By.FAILED&&(0,S.p)(e,null==tu?void 0:tu.id)),[lc,null==tu?void 0:tu.id]),lj=(0,eP.useCallback)(e=>L(e,lb,ly),[lb,ly]),lw=(0,eP.useMemo)(()=>(null!=lb?lb:[]).map(e=>{var t;if(eG.some(t=>M(e,t)))return null;let l=I(e),s=(0,j.gA)(e)||"Processing...";return{id:"_processing_".concat(e.id),name:s,documentUrl:l,documentType:_(e)||z.n_.PROMOTIONAL_LINK,createdAt:e.createdAt||new Date().toISOString(),isVisible:!0,isProcessing:!0,isAutomation:!1,assistantId:null!==(t=null==tu?void 0:tu.id)&&void 0!==t?t:""}}).filter(e=>null!==e),[eG,lb,null==tu?void 0:tu.id]),lk=(0,eP.useMemo)(()=>{let e=new Set(lw.map(e=>e.id.replace(/^_processing_/,""))),t=A(null!=lb?lb:[]);return(null!=ly?ly:[]).filter(l=>{if(e.has(l.id))return!1;let s=Z(l);if(s&&t.ids.has(s))return!1;let a=E(l);return!(a&&t.urlKeys.has(a))}).map(e=>{var t;if(eG.some(t=>M(e,t)))return null;let l=I(e),s=(0,j.gA)(e)||"Content";return{id:"_failed_".concat(e.id),name:s,documentUrl:l,documentType:_(e)||z.n_.PROMOTIONAL_LINK,createdAt:e.createdAt||new Date().toISOString(),isVisible:!0,isProcessing:!1,isFailed:!0,failedErrorMessage:(0,P.Ae)(e.errorMessage,(0,P.NN)(e)),isAutomation:!1,assistantId:null!==(t=null==tu?void 0:tu.id)&&void 0!==t?t:""}}).filter(e=>null!==e)},[eG,ly,lw,lb,null==tu?void 0:tu.id]),lN=(0,eP.useMemo)(()=>[...lw,...lk,...eG],[lw,lk,eG]),lC=(0,eP.useMemo)(()=>{let e={all:eG.length,videos:0,podcasts:0,documents:0,websites:0,linkedInPosts:0,links:0};return eG.forEach(t=>{switch(t.documentType){case z.n_.VIDEO:e.videos+=1;break;case z.n_.PODCAST:e.podcasts+=1;break;case z.n_.BOOK:case z.n_.TEXT:case z.n_.TEMPLATE:e.documents+=1;break;case z.n_.WEBSITE:e.websites+=1;break;case z.n_.LINKEDIN_POST:e.linkedInPosts+=1;break;case z.n_.PROMOTIONAL_LINK:e.links+=1}}),e},[eG]),lS=(0,eP.useMemo)(()=>{let e=new Map;return eG.forEach(t=>{var l;
1(null!==(l=t.tags)&&void 0!==l?l:[]).forEach(t=>{var l;e.set(t.id,(null!==(l=e.get(t.id))&&void 0!==l?l:0)+1)})}),e},[eG]),lP=(0,eP.useMemo)(()=>{let e=new Map;return tY.forEach(t=>e.set(t.id,t)),eG.forEach(t=>{var l;(null!==(l=t.tags)&&void 0!==l?l:[]).forEach(t=>{e.has(t.id)||e.set(t.id,t)})}),Array.from(e.values()).sort((e,t)=>e.label.localeCompare(t.label))},[eG,tY]),lT=(0,eP.useCallback)(e=>{switch(e){case"documents":return"Documents (".concat(lC.documents,")");case z.n_.WEBSITE:return"Websites (".concat(lC.websites,")");case z.n_.VIDEO:return"Videos (".concat(lC.videos,")");case z.n_.PODCAST:return"Podcasts (".concat(lC.podcasts,")");case z.n_.LINKEDIN_POST:return"LinkedIn Posts (".concat(lC.linkedInPosts,")");case z.n_.PROMOTIONAL_LINK:return"Links (".concat(lC.links,")");default:return"Type"}},[lC]),lZ=(0,eP.useCallback)(e=>{var t;return"all"===e?"Tags":(null===(t=lP.find(t=>t.id===e))||void 0===t?void 0:t.label)||"Tags"},[lP]),lD=(0,eP.useCallback)(e=>{if(e===e7){t1(!0);return}tc(e)},[]),lI=(0,eP.useMemo)(()=>{let e=lN;if("all"!==tr&&(e="documents"===tr?e.filter(e=>e.documentType===z.n_.BOOK||e.documentType===z.n_.TEXT||e.documentType===z.n_.TEMPLATE):e.filter(e=>e.documentType===tr)),"all"!==td&&(e=e.filter(e=>{var t;return(null!==(t=e.tags)&&void 0!==t?t:[]).some(e=>e.id===td)})),te){let t=te.toLowerCase();e=e.filter(e=>{var l,s,a,n,i,r;return(null===(s=e.fileName)||void 0===s?void 0:null===(l=s.toLowerCase())||void 0===l?void 0:l.includes(t))||(null===(n=e.name)||void 0===n?void 0:null===(a=n.toLowerCase())||void 0===a?void 0:a.includes(t))||(null===(r=e.description)||void 0===r?void 0:null===(i=r.toLowerCase())||void 0===i?void 0:i.includes(t))})}return e},[lN,te,td,tr]),lE=lI.length>0&&lI.every(e=>tH.has(e.id)),l_=tf&&0===lN.length,lA=eY||eG.length,lM=!!e2||"all"!==tr||"all"!==td,lL=tH.size>0&&tH.size<lI.length,lO=(0,eP.useCallback)(()=>{let e=lI.filter(e=>tH.has(e.id)).filter(e=>{var t;return!e.isProcessing&&!e.isFailed&&(null===(t=e.documentUrl)||void 0===t?void 0:t.trim())});if(!e.length){null==e_||e_({severity:"warning",message:"None of the selected items are ready yet — wait until processing finishes and a link is available."});return}let t=e.filter(e=>e0(e.documentUrl));if(!t.length){null==e_||e_({severity:"warning",message:"Playbooks can only be created from YouTube, Vimeo, or Loom links in your knowledge library."});return}t.length<e.length&&(null==e_||e_({severity:"info",message:"Using ".concat(t.length," supported video item(s). Other selected content types can’t be used for playbooks.")})),eN&&!1!==eN(t)&&tK(new Set)},[lI,tH,eN,e_]),lF=(0,eP.useMemo)(()=>{let e=[...lI],t="asc"===t9?1:-1;return e.sort((e,l)=>{if("created"===t6){let t=e.isFailed?0:e.isProcessing?1:2,s=l.isFailed?0:l.isProcessing?1:2;if(t!==s)return t-s}let s=0;switch(t6){case"premium":var a,n;s=((null==tx?void 0:null===(a=tx[e.id])||void 0===a?void 0:a.enabled)?1:0)-((null==tx?void 0:null===(n=tx[l.id])||void 0===n?void 0:n.enabled)?1:0);break;case"type":s=((0,z.eA)(e.documentType)||"").localeCompare((0,z.eA)(l.documentType)||"");break;case"title":s=(e.name||"").localeCompare(l.name||"");break;default:s=(e.createdAt||"").localeCompare(l.createdAt||"")}return s*t}),e},[lI,t6,t9,tx]),lz=e=>{t6===e?le(e=>"desc"===e?"asc":"desc"):(t7(e),le("created"===e?"desc":"asc"))},[lU,lR]=(0,eP.useState)(!1),[lW,lB]=(0,eP.useState)(),lG=(e,t)=>{let l=[...e],s=new Set(e.map(e=>e.id));return t.forEach(e=>{s.has(e.id)||(s.add(e.id),l.push(e))}),l},lV=eG.filter(e=>{var t;return e.documentType===z.n_.VIDEO&&(null===(t=e.documentUrl)||void 0===t?void 0:t.includes("youtube.com"))}).map(e=>{var t,l;return null===(l=e.documentUrl)||void 0===l?void 0:null===(t=l.split("/").pop())||void 0===t?void 0:t.split("?")[0]}).filter(Boolean);(0,eP.useEffect)(()=>{lv((lc||[]).filter(e=>(e.status===b.By.PENDING||e.status===b.By.RUNNING)&&!e.errorMessage&&(0,S.p)(e,null==tu?void 0:tu.id)))},[lc,null==tu?void 0:tu.id]),(0,eP.useEffect)(()=>{void 0!==l&&tm(l)},[l]),(0,eP.useEffect)(()=>{if(!(null==tu?void 0:tu.id)||eO!==F.t.AUTHENTICATED){tJ([]);return}(0,p.JG)(eA,tu.id).then(e=>tJ(e)).catch(e=>{(0,w.H)(eM,"on fetchDocumentTags",e)})},[null==tu?void 0:tu.id,eA,eO,eM]),(0,eP.useEffect)(()=>{"all"===td||lP.some(e=>e.id===td)||tc("all")},[lP,td]),(0,eP.useEffect)(()=>{t0&&t5(Object.fromEntries(lP.map(e=>[e.id,e.label])))},[lP,t0]),(0,eP.useEffect)(()=>{eG.length<=7&&e2&&e5("")},[eG.length,e2]);let lH=async()=>
1{if(!tu){tg(!1),lR(!1),lB(void 0),e1(0);return}tg(!0);try{var e;let l;try{l=await lp({force:!0})}catch(e){(0,w.H)(eM,"fetchBackgroundTaskList in fetchDocuments",e)}let s=await (0,p.LN)(eA,eM,"on fetchDocuments",tu.id,50,void 0),a=s.documents;tJ(e=>e9(e,a.flatMap(e=>{var t;return null!==(t=e.tags)&&void 0!==t?t:[]})));let n=a.map(e=>({...e,isVisible:!0}));ld.current=n;let i=sd(n,l);eK(i),e1(s.totalCount),lB(null===(e=a[a.length-1])||void 0===e?void 0:e.id),lR(s.hasMore),(null==t?void 0:t.feWebAlias)&&eE(t.feWebAlias,n)}catch(e){(0,w.H)(eM,"on fetchDocuments",e),null==e_||e_({severity:"error",message:"We couldn't load your knowledge library. Refresh the page or try again in a moment."})}finally{tg(!1)}},lK=async()=>{if(tu&&lW&&lU&&!tb){tv(!0);try{var e;let l=await (0,p.LN)(eA,eM,"on fetchMoreDocuments",tu.id,50,lW),s=l.documents;tJ(e=>e9(e,s.flatMap(e=>{var t;return null!==(t=e.tags)&&void 0!==t?t:[]})));let a=s.map(e=>({...e,isVisible:!0})),n=lG(ld.current,a);ld.current=n;let i=sd(n);eK(i),e1(l.totalCount),lB(null===(e=s[s.length-1])||void 0===e?void 0:e.id),lR(l.hasMore),(null==t?void 0:t.feWebAlias)&&eE(t.feWebAlias,n)}catch(e){(0,w.H)(eM,"on fetchMoreDocuments",e),null==e_||e_({severity:"error",message:"We couldn't load more knowledge library items. Try again in a moment."})}finally{tv(!1)}}},lY=(0,eP.useCallback)(async e=>{if(0===e.length){tj(!1);return}try{var t;let l=e.filter(e=>!tp.current[e.id]);if(0===l.length)return;tj(!0);let s=(null!==(t=await (0,f.lI)(eA,eM,l.map(e=>({paywallSubjectId:e.id,paywallSubjectType:W.tc.DOCUMENT}))))&&void 0!==t?t:[]).reduce((e,t)=>(e[t.subjectId]=t,e),{});th(e=>({...null!=e?e:{},...s}))}catch(e){(0,w.H)(eM,"on fetchDocumentPaywalls",e)}finally{tj(!1)}},[eA,eM]),lJ=e=>{var t,l;if(e.id.startsWith("_processing_")){let l=e.id.replace(/^_processing_/,""),s=null!==(t=(lc||[]).find(e=>e.id===l))&&void 0!==t?t:null;return s&&(0,S.p)(s,null==tu?void 0:tu.id)?s:null}if(e.id.startsWith("_failed_")){let t=e.id.replace(/^_failed_/,""),s=null!==(l=(lc||[]).find(e=>e.id===t))&&void 0!==l?l:null;return s&&(0,S.p)(s,null==tu?void 0:tu.id)?s:null}return lj(e).matchedJob},lq=async e=>{let t=lJ(e);return t?(await (0,b.CC)(eA,eM,t.id),lf(t),await lp({force:!0}),!0):(null==e_||e_({severity:"error",message:"We couldn't cancel processing for this item. Refresh the page and try again."}),!1)},lX=async e=>{let t=lJ(e);if(!t||t.status!==b.By.FAILED)return null==e_||e_({severity:"error",message:"We couldn't find this item to retry. Refresh the page and try again."}),!1;try{return await lg({kind:b.wE.AUTOMATION,input:{...t.input},status:b.By.PENDING,retryCount:0}),await (0,b.CC)(eA,eM,t.id),lf(t),await lp({force:!0}),!0}catch(e){return(0,w.H)(eM,"on retry failed job",e),null==e_||e_({severity:"error",message:(0,P.wG)(e,"We couldn't retry this item. Try again in a moment.")}),!1}},lQ=async()=>{let e=lI.filter(e=>tH.has(e.id)&&e.isFailed);if(0!==e.length){lo(!0);try{let t=0;for(let l of e)await lX(l)&&(t+=1,tK(e=>{let t=new Set(e);return t.delete(l.id),t}));t>0&&(null==e_||e_({severity:"success",message:"Retrying ".concat(t," item(s)")}))}catch(e){null==e_||e_({severity:"error",message:"Some items couldn't be retried. Try each one again, or refresh the page."})}finally{lo(!1)}}},l$=async()=>{if(0!==tH.size){tz(!1),eF(!0),lo(!0);try{let e=lI.filter(e=>tH.has(e.id)),t=e.filter(e=>e.isProcessing||e.isFailed),l=e.filter(e=>!e.isProcessing&&!e.isFailed),s=0;s=(await Promise.all(t.map(async e=>({doc:e,ok:await lq(e)})))).filter(e=>e.ok).length;let a=0;await Promise.all(l.map(async e=>{await (0,p.iH)(eA,e.id),sl(e.id),a+=1})),tK(t=>{let l=new Set(t);return e.forEach(e=>l.delete(e.id)),l});let n=[];s>0&&n.push("".concat(s," removed from queue")),a>0&&n.push("".concat(a," deleted")),null==e_||e_({severity:"success",message:n.join(". ")||"Done"})}catch(e){null==e_||e_({severity:"error",message:"We couldn't remove or delete every selected item. Try again, or delete one at a time."}),(0,w.H)(eM,"on handleDeleteSelected",e)}finally{eF(!1),lo(!1)}}},l0=async e=>{if(e){tR(null),eF(!0);try{e.isProcessing||e.isFailed?await lq(e)&&(tK(t=>{let l=new Set(t);return l.delete(e.id),l}),null==e_||e_({severity:"success",message:e.isFailed?"Removed":"Removed from queue"})):(await (0,p.iH)(eA,e.id),sl(e.id),tK(t=>{let l=new Set(t);return l.delete(e.id),l}),null==e_||e_({severity:"success",message:"Document deleted"}))}catch(t){null==e_||e_({severity:"error",message:e.isProcessing||e.isFailed?"We couldn't cancel processing for this item. Refresh the page and try again.":(0,P.wG)(t,"We couldn't delete this item. Try again, or refresh the page.")}),(0,w.H)(eM,"on handleDeleteDocument",t)}finally{eF(!1)}}},l1=async e=>{if(0!==tH.size){eF(!0),lo(!0);try{if(e){if(!t.id){null==e_||e_({severity:"warning",message:e$});return}let e=await (0,g.yg)(eA,{leaderId:t.id});if(!(null==e?void 0:e.isActive)){null==e_||e_({severity:"warning",message:e$});return}}let l=lI.filter(e=>tH.has(e.id)&&!e.isProcessing&&!e.isFailed);if(0===l.length){null==e_||e_({severity:"info",message:"No finalized documents to update"});return}await Promise.all(l.map(t=>(0,f.Bd)(eA,t.id,W.tc.DOCUMENT.valueOf(),e))),th(t=>{let s={...null!=t?t:{}};return l.forEach(t=>{var l,a,n;s[t.id]={...null!==(n=s[t.id])&&void 0!==n?n:{id:null!==(a=null===(l=s[t.id])||void 0===l?void 0:l.id)&&void 0!==a?a:t.id,subjectId:t.id,subjectType:W.tc.DOCUMENT},enabled:e}}),s}),tK(e=>{let t=new Set(e);
1return l.forEach(e=>t.delete(e.id)),t}),null==e_||e_({severity:"success",message:"".concat(e?"Paid enabled for selected":"Paid removed from selected")})}catch(e){null==e_||e_({severity:"error",message:(0,P.wG)(e,"We couldn't update paid settings for the selection. Try again.")}),(0,w.H)(eM,"on handleEnableSelectedPaywalls",e)}finally{eF(!1),lo(!1)}}},l2=async(e,t)=>{eF(!0);try{await (0,f.Bd)(eA,e,W.tc.DOCUMENT.valueOf(),t),th(l=>{var s;return{...null!=l?l:{},[e]:{...null!==(s=null==l?void 0:l[e])&&void 0!==s?s:{id:e,subjectId:e,subjectType:W.tc.DOCUMENT},enabled:t}}}),null==e_||e_({severity:"success",message:t?"Paid enabled":"Paid removed"})}catch(e){null==e_||e_({severity:"error",message:(0,P.wG)(e,"We couldn't update paid settings. Try again.")}),(0,w.H)(eM,"on handleUpdatePaywallForDocument",e)}finally{eF(!1)}},l5=(0,eP.useCallback)(e=>{let t=new Map;tY.forEach(e=>{let l=e8(e.label);l&&t.set(l,e)});let l=[],s=[];return e.forEach(e=>{let a=e6(e).slice(0,40),n=e8(a);if(!n)return;let i=t.get(n);i?l.push(i.id):s.push(a)}),{tagIds:l,newTagLabels:s}},[tY]),l4=(0,eP.useCallback)(e=>{let l=new Map(e.map(e=>[e.id,e])),s=e=>{let t=l.get(e.id);return t?{...e,...t,isVisible:e.isVisible}:e};eK(e=>e.map(s)),ld.current=ld.current.map(s),tM(e=>e?s(e):e);let a=e.flatMap(e=>{var t;return null!==(t=e.tags)&&void 0!==t?t:[]});a.length>0&&tJ(e=>e9(e,a)),(null==t?void 0:t.feWebAlias)&&eE(t.feWebAlias,ld.current)},[null==t?void 0:t.feWebAlias,eE]),l3=(0,eP.useCallback)(e=>{tJ(t=>e9(t.filter(t=>t.id!==e.id),[e]));let l=t=>{var l;return{...t,tags:(null!==(l=t.tags)&&void 0!==l?l:[]).map(t=>t.id===e.id?{...t,label:e.label}:t)}};eK(e=>e.map(l)),ld.current=ld.current.map(l),tM(e=>e?l(e):e),(null==t?void 0:t.feWebAlias)&&eE(t.feWebAlias,ld.current)},[null==t?void 0:t.feWebAlias,eE]),l8=(0,eP.useCallback)(e=>{tJ(t=>t.filter(t=>t.id!==e));let l=t=>{var l;return{...t,tags:(null!==(l=t.tags)&&void 0!==l?l:[]).filter(t=>t.id!==e)}};eK(e=>e.map(l)),ld.current=ld.current.map(l),tM(e=>e?l(e):e),td===e&&tc("all"),(null==t?void 0:t.feWebAlias)&&eE(t.feWebAlias,ld.current)},[null==t?void 0:t.feWebAlias,td,eE]),l6=async e=>{var t;if(!(null==tu?void 0:tu.id))return;let l=e6(null!==(t=t2[e])&&void 0!==t?t:"").slice(0,40);if(!l){null==e_||e_({severity:"info",message:"Tag name can't be empty"});return}t3(t=>({...t,[e]:!0}));try{let t=await (0,p.Xc)(eA,{tagId:e,assistantId:tu.id,label:l});l3(t),t5(l=>({...l,[e]:t.label})),null==e_||e_({severity:"success",message:"Tag updated"})}catch(e){null==e_||e_({severity:"error",message:(0,P.wG)(e,"We couldn't update that tag. Try again.")}),(0,w.H)(eM,"on handleUpdateSavedTag",e)}finally{t3(t=>({...t,[e]:!1}))}},l7=async e=>{if(null==tu?void 0:tu.id){t3(t=>({...t,[e]:!0}));try{await (0,p.lE)(eA,tu.id,e),l8(e),t5(t=>{let l={...t};return delete l[e],l}),null==e_||e_({severity:"success",message:"Tag deleted"})}catch(e){null==e_||e_({severity:"error",message:(0,P.wG)(e,"We couldn't delete that tag. Try again.")}),(0,w.H)(eM,"on handleDeleteSavedTag",e)}finally{t3(t=>({...t,[e]:!1}))}}},l9=async e=>{if(!tA)return!1;eF(!0);try{let t=l5(e),l=await (0,p.Jr)(eA,{documentId:tA.id,tagIds:t.tagIds,newTagLabels:t.newTagLabels});return l4([l]),null==e_||e_({severity:"success",message:"Tags updated"}),!0}catch(e){return null==e_||e_({severity:"error",message:(0,P.wG)(e,"We couldn't update tags. Try again.")}),(0,w.H)(eM,"on handleSaveCurrentDocumentTags",e),!1}finally{eF(!1)}},se=async e=>{let t=lI.filter(e=>tH.has(e.id)&&!e.isProcessing&&!e.isFailed);if(0===t.length){null==e_||e_({severity:"info",message:"No finalized documents to tag"});return}let l=l5(e);if(0===l.tagIds.length&&0===l.newTagLabels.length){null==e_||e_({severity:"info",message:"Choose or create at least one tag"});return}eF(!0),lo(!0);try{let e=await (0,p.YF)(eA,{documentIds:t.map(e=>e.id),tagIds:l.tagIds,newTagLabels:l.newTagLabels});l4(e),tK(new Set),tX(!1),t$([]),null==e_||e_({severity:"success",message:"Tags added to selected documents"})}catch(e){null==e_||e_({severity:"error",message:(0,P.wG)(e,"We couldn't add tags to the selection. Try again.")}),(0,w.H)(eM,"on handleBulkAddTags",e)}finally{eF(!1),lo(!1)}},st=async e=>{try{eF(!0),await (0,p.iH)(eA,e),sl(e),null==e_||e_({severity:"success",message:"Document deleted successfully"})}catch(e){null==e_||e_({severity:"error",message:(0,P.wG)(e,"We couldn't delete this item. Try again, or refresh the page.")})}finally{eF(!1),tO(void 0),tM(void 0)}},sl=e=>{e1(e=>{let t=Math.max(e-1,0);return null==ek||ek(t),t}),eK(t=>t.filter(t=>t.id!==e)),ld.current=ld.current.filter(t=>t.id!==e),(null==t?void 0:t.feWebAlias)&&eI(t.feWebAlias,e),th(t=>{if(!t)return t;let l={...t};return delete l[e],l})},ss=(e,t)=>{if(T){null==e_||e_({severity:"info",message:"Please wait while we check your subscription status..."});return}if(!$&&!(null==eU?void 0:eU.admin)&&(0,eX.Z1)(y)){tI(!0);return}ll(t.currentTarget),tZ(e),tP(U.D.CREATE)},sa=e=>{if(e.isProcessing||e.isFailed){null==e_||e_({severity:"info",message:"Wait until this item has finished processing, or fix or remove failed items, before creating a LinkedIn post."});return}tB(e),tV(!0);let t=new URLSearchParams(window.location.search);t.has("view")||t.set("view","content"),t.set("linkedin","true"),t.set("doc",e.id),eR.replace("".concat(window.location.pathname,"?").concat(t.toString()),{scroll:!1})},sn=e=>{if(e.documentType===z.n_.BOOK)return O.Uk.get(z.jG.BOOK);if(e.documentType===z.n_.TEXT)return O.Uk.get(z.jG.TEXT);if(e.documentType===z.n_.WEBSITE)return O.Uk.get(z.jG.WEBSITE);if(e.documentType===z.n_.TEMPLATE)return O.Uk.get(z.jG.TEMPLATE);if(e.documentType===z.n_.LINKEDIN_POST)return{label:"LinkedIn Post",image:"/images/social/linkedin.svg"};if(e.documentType===z.n_.PROMOTIONAL_LINK)return O.Uk.get(z.jG.PROMOTIONAL_LINK);if(!e.documentUrl)return;let t=(0,C.gQ)(e.documentUrl);return t?O.Uk.get(t):O.Uk.get(z.jG.PROMOTIONAL_LINK)};(0,eP.useEffect)(()=>{lY(eG)},[eG,lY]),(0,eP.useEffect)(()=>{eF(tf||tw||ty)},[tf,tw,ty]);let si=(0,eP.useMemo)(()=>A((lc||[]).filter(e=>(e.status===b.By.PENDING||e.status===b.By.RUNNING)&&(0,S.p)(e,null==tu?void 0:tu.id))),[lc,null==tu?void 0:tu.id]),sr=(0,eP.useMemo)(()=>A((lc||[]).filter(e=>(e.status===b.By.COMPLETED||e.status===b.By.FAILED)&&(0,S.p)(e,null==tu?void 0:tu.id))),[lc,null==tu?void 0:tu.id]),so=(0,eP.useMemo)(()=>A((lc||[]).filter(e=>(0,S.p)(e,null==tu?void 0:tu.id))),[lc,null==tu?void 0:tu.id]),sd=(0,eP.useCallback)((e,t)=>{let l=(void 0!==t?t:null!=lc?lc:[]).filter(e=>(0,S.p)(e,null==tu?void 0:tu.id)),s=l.filter(e=>e.status===b.By.PENDING||e.status===b.By.RUNNING),a=l.filter(e=>e.status===b.By.COMPLETED||e.status===b.By.FAILED),n=void 0!==t,i=n?l.filter(e=>e.status===b.By.FAILED):ly,r=n?A(s):si,o=n?A(a):sr,d=n?A(l):so,c=n?s:null!=lb?lb:[],u=e=>lu.some(t=>t.documentType===e),m=e=>c.some(t=>{var l;return(null===(l=t.input)||void 0===l?void 0:l.documentType)===e})||lu.some(t=>t.documentType===e),x=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6e4,l=e.createdAt?new Date(e.createdAt).getTime():0;return Date.now()-l<t},h=e=>{let t=(0,C.B7)(e.documentUrl);
1return!!(d.ids.has(e.id)||t&&d.urlKeys.has(t))&&!(o.ids.has(e.id)||t&&o.urlKeys.has(t))},p=lh(),f=new Set([...r.ids,...p.ids]),g=new Set([...r.urlKeys,...p.urlKeys]),v=e=>{var t;if(e.processing||[z.n_.VIDEO,z.n_.PODCAST].includes(e.documentType)&&!(null===(t=e.documentUrl)||void 0===t?void 0:t.trim())&&x(e,12e4)||f.has(e.id))return!0;let l=(0,C.B7)(e.documentUrl);return!!(l&&g.has(l)||h(e))};return e.filter(e=>{if(!(null==e?void 0:e.id)||lm.has(e.id))return!1;let t=(0,C.B7)(e.documentUrl);return!(t&&lx.has(t)||u(e.documentType)&&x(e)||m(e.documentType)&&[z.n_.VIDEO,z.n_.PODCAST].includes(e.documentType)&&!e.documentUrl&&x(e,12e4))}).map(e=>{let t=n?L(e,s,i):lj(e);return{...e,isProcessing:t.isProcessing||v(e),isFailed:t.isFailed,failedErrorMessage:t.failedJob?(0,P.Ae)(t.failedJob.errorMessage,(0,P.NN)(t.failedJob)):t.failedErrorMessage,isVisible:!0}})},[null==tu?void 0:tu.id,lc,so,sr,si,ly,lh,lu,lb,lm,lx,lj]),sc=(0,eP.useCallback)(()=>{var e;let l=(null===(e=eS.get(t.feWebAlias))||void 0===e?void 0:e.map(e=>({...e,isVisible:!0})))||[];ld.current=l,eK(sd(l)),e1(l.length)},[sd,t.feWebAlias,eS]);(0,eP.useEffect)(()=>{null!=tu&&tu.id||sc()},[eS,null==tu?void 0:tu.id]),(0,eP.useEffect)(()=>{(null==tu?void 0:tu.id)&&lH()},[null==tu?void 0:tu.id]);let su=(0,eP.useRef)([]);(0,eP.useEffect)(()=>{let e=(lc||[]).filter(e=>{if(!(0,S.p)(e,null==tu?void 0:tu.id))return!1;let t=su.current.find(t=>t.id===e.id),l=e.status===b.By.COMPLETED||e.status===b.By.FAILED,s=t&&t.status!==b.By.COMPLETED&&t.status!==b.By.FAILED;return l&&t&&s}),t=e.filter(e=>e.status===b.By.FAILED);if(t.length>0){var l;let e=t[0];(0,w.H)(eM,"knowledge library job failed",null!==(l=e.errorMessage)&&void 0!==l?l:"job failed",{jobId:e.id,error_code:(0,P.NN)(e)});let s=(0,P.Ae)(e.errorMessage,(0,P.NN)(e));null==e_||e_({severity:"error",message:s})}su.current=[...lc||[]],e.length>0&&(null==tu?void 0:tu.id)&&lH()},[lc,null==tu?void 0:tu.id,e_]),(0,eP.useEffect)(()=>{let e=ld.current;(null==e?void 0:e.length)&&(null==tu?void 0:tu.id)&&eK(sd(e))},[si,sr,so,lu,lb,lm,lx,null==tu?void 0:tu.id,sd]);let sm=(0,eP.useCallback)((e,t)=>{tK(l=>{let s=new Set(l);return t?s.add(e):s.delete(e),s})},[]),sx=(0,eP.useCallback)(e=>{tM(e)},[]),sh=(0,eP.useCallback)(e=>{tR(e)},[]);return(0,eP.useEffect)(()=>{"all"!==tr&&0===("documents"===tr?lN.filter(e=>[z.n_.BOOK,z.n_.TEXT,z.n_.TEMPLATE].includes(e.documentType)).length:lN.filter(e=>e.documentType===tr).length)&&to("all")},[tr,lN]),(0,eP.useEffect)(()=>{let e=eW.get("linkedin"),t=eW.get("doc");if("true"===e&&t&&eG.length>0){let e=eG.find(e=>e.id===t);!e||tW||tG?e||null!==tW||tG||(null==e_||e_({severity:"warning",message:"Document not found. Please check the link and try again."}),tV(!0)):(e.isProcessing||e.isFailed?null==e_||e_({severity:"info",message:"Wait until this item has finished processing, or fix or remove failed items, before creating a LinkedIn post."}):tB(e),tV(!0))}else"true"!==e&&tV(!1)},[eW,eG]),(0,s.jsxs)("div",{className:"relative flex flex-col w-full min-w-0 max-w-full gap-5 py-9 overflow-x-hidden ".concat(tH.size>0?"pb-28":""),children:[(0,s.jsxs)("div",{className:"rounded-[28px] border border-border bg-background p-4 shadow-sm sm:p-5",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:gap-8 lg:items-stretch ".concat($?"":"lg:grid-cols-2"),children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-col justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-lg font-semibold text-foreground sm:text-xl",children:"Add what you have"}),(0,s.jsx)("p",{className:"max-w-prose text-sm leading-6 text-muted-foreground",children:"Calls, documents, frameworks, videos. Every piece adds to your system's knowledge."})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[[["channel","YouTube Channel","primary",(0,s.jsx)("img",{src:"/images/assets/icons/logo-youtube.svg",alt:"YouTube",width:18,height:18},"yt")],["document","Documents","secondary",(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)("img",{src:"/images/assets/icons/pdf.svg",alt:"PDF",width:18,height:18,className:"object-contain"})},"doc-icons")],["linkedin","LinkedIn posts","secondary",(0,s.jsx)("img",{src:"/images/social/linkedin.svg",alt:"LinkedIn",width:18,height:18,className:"object-contain"},"li")],["link","Video/Audio link","secondary",(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,s.jsx)("img",{src:"/images/assets/icons/logo-youtube.svg",alt:"",width:14,height:14,className:"object-contain"}),(0,s.jsx)("img",{src:"/images/assets/icons/logo-spotify.svg",alt:"",width:14,height:14,className:"object-contain"}),(0,s.jsx)("img",{src:"/images/assets/icons/logo-vimeo.svg",alt:"",width:14,height:14,className:"object-contain"}),(0,s.jsx)("img",{src:"/images/assets/icons/logo-loom.svg",alt:"",width:14,height:14,className:"object-contain"})]},"link-icons")],["website","Websites","secondary",(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(q.default,{src:"/images/assets/icons/substack.svg",alt:"Substack",width:18,height:18,className:"object-contain"}),(0,s.jsx)(eJ.Z,{sx:{fontSize:18,color:"inherit"}})]},"website-icons")]].map(e=>{let[t,l,a,n]=e;return(0,s.jsxs)("button",{onClick:e=>ss(t,e),className:"flex-none rounded-xl min-h-[40px] px-4 py-2.5 font-medium text-sm flex items-center gap-2 transition-all duration-150 ".concat("primary"===a?"text-primary-foreground bg-primary border border-primary hover:opacity-90":"text-muted-foreground bg-background border border-border hover:bg-accent/40 hover:text-foreground"),children:[n,l]},t)}),(0,s.jsx)("div",{className:"w-full pt-1 text-xs text-muted-foreground",children:"Best results come from concrete examples of how you think, explain, and decide."})]})]}),!$&&(0,s.jsxs)("div",{className:"flex w-full min-w-0 self-stretch flex-col justify-between gap-4 border-t border-border pt-3 lg:border-l lg:border-t-0 lg:pl-8 lg:pt-0",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-lg font-semibold text-foreground sm:text-xl",children:"Record something new"}),(0,s.jsx)("p",{className:"mt-1 max-w-prose text-sm leading-6 text-muted-foreground",children:"Book a session to capture new thoughts, podcast style, with a live interview."})]}),(0,s.jsxs)("button",{type:"button",onClick:e=>{if(T){null==e_||e_({severity:"info",message:"Please wait while we check your subscription status..."});return}if(!(null==eU?void 0:eU.admin)&&(0,eX.Z1)(y)){tI(!0);return}la(e.currentTarget)}
1,className:"flex min-h-[40px] flex-none items-center gap-2 self-start rounded-xl border border-border bg-background px-4 py-2.5 text-sm font-medium text-muted-foreground transition-all duration-150 hover:bg-accent/40 hover:text-foreground",children:[(0,s.jsx)(eH.Z,{sx:{fontSize:18,color:"inherit"}}),"Recording session"]})]})]}),(0,s.jsx)(ec.ZP,{open:!!ls,anchorEl:ls,onClose:()=>la(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{mt:.5,maxWidth:"min(420px, calc(100vw - 24px))",overflow:"visible",boxShadow:"0 8px 24px rgba(0,0,0,0.12)",borderRadius:"24px",border:"1px solid hsl(var(--border))",backgroundColor:"hsl(var(--background))"}}},children:(0,s.jsxs)("div",{className:"relative w-fit max-w-full rounded-[24px] border border-border bg-background px-3 pb-3 pt-5 shadow-sm sm:px-4 sm:pb-4 sm:pt-6",children:[(0,s.jsx)("span",{className:"absolute -top-2 left-3 rounded-md border border-border bg-background px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Recommended"}),(0,s.jsx)("p",{className:"text-sm leading-6 text-muted-foreground max-w-[45ch] mb-4",children:"Recording sessions create the richest AI training material. Gaps in your thinking get filled. Record a session and your AI gets sharper immediately."}),(0,s.jsxs)("a",{href:eq.yN,target:"_blank",rel:"noopener noreferrer",onClick:()=>la(null),className:"inline-flex flex-none rounded-xl min-h-[40px] px-4 py-2.5 font-medium text-sm items-center gap-2 transition-all duration-150 text-primary-foreground bg-primary border border-primary hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",children:[(0,s.jsx)(ee.Z,{sx:{fontSize:18}}),"Book a session"]})]})}),el&&!l_&&0===lN.length&&(0,s.jsxs)("div",{className:"flex flex-col items-center py-12",children:[(0,s.jsx)("svg",{className:"w-12 h-12 text-gray-300 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),(0,s.jsx)("p",{className:"text-sm text-text-color-2 text-center",children:"Nothing here yet. Add your first piece."}),(0,s.jsx)("p",{className:"text-sm text-text-color-2 text-center mt-2",children:"Your system can't think until you give it something to think from."})]})]}),(!el||lN.length>0||l_)&&(0,s.jsxs)("div",{className:"rounded-[28px] border border-border bg-background p-4 shadow-sm sm:p-5 mt-2",children:[(0,s.jsx)("div",{className:"text-lg sm:text-xl font-semibold text-foreground mb-1",children:ei?"What your system knows so far":"Your System's Knowledge Base"}),lA>0&&!et&&(0,s.jsxs)("p",{className:"text-sm leading-6 text-muted-foreground mb-3",children:["Your system draws from"," ",(0,s.jsx)("span",{className:"font-semibold text-foreground",children:lA})," ","source",1!==lA?"s":"",". Add more to sharpen interactive chat or generate scoring playbooks from one or more items."]}),l_?(0,s.jsx)("div",{className:"flex items-center justify-center py-10","aria-live":"polite",children:(0,s.jsx)("span",{className:"inline-block h-6 w-6 shrink-0 rounded-full border-2 border-black/25 border-t-neutral-800 animate-spin","aria-label":"Loading knowledge library"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex md:hidden flex-col gap-2 mb-3 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 w-full",children:[(0,s.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer shrink-0",children:[(0,s.jsx)(eu.Z,{checked:lE,indeterminate:lL,onChange:e=>{e.target.checked?tK(new Set(lI.map(e=>e.id))):tK(new Set)},sx:{padding:0}}),(0,s.jsx)("span",{className:"text-xs text-text-color-2 whitespace-nowrap",children:lI.length>0&&lI.every(e=>tH.has(e.id))?"Select None":"Select All"})]}),eG.length>7&&(0,s.jsxs)("div",{className:"flex-1 min-w-0 flex items-center relative",children:[(0,s.jsx)(es.Z,{className:"absolute z-[1] left-[10px] pointer-events-none",htmlColor:"#9ca3af"}),(0,s.jsx)(em.ZP,{placeholder:"Search","aria-label":"Search",className:"flex-auto w-full flex items-center md3-input h-10 pl-10 pr-[5px] transition-colors ".concat(tl||e2?"bg-white":"bg-white/70 hover:bg-white"),sx:{color:"#000","& .MuiInputBase-input":{fontSize:"14px",fontWeight:400},"& .MuiInputBase-input::placeholder":{opacity:1,color:"rgba(0, 0, 0, 0.54)"},"&.Mui-focused":{border:"1px solid rgba(0,0,0,0.35)"}},value:e2,onFocus:()=>ti(!0),onBlur:()=>ti(!1),onChange:e=>e5(e.currentTarget.value)}),!!e2&&(0,s.jsx)("div",{className:"absolute right-[5px]",children:(0,s.jsx)(ea.Z,{title:"Clear search",children:(0,s.jsx)(en.Z,{"aria-label":"Clear search",className:"w-6 h-6",sx:{color:"rgba(0,0,0,0.54)"},onClick:()=>e5(""),children:(0,s.jsx)(Q.Z,{})})})})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 w-full",children:[(0,s.jsx)(ex.Z,{size:"small",className:"min-w-0 flex-1",sx:{"& .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0,0,0,0.2)"}},children:(0,s.jsxs)(eh.Z,{value:tr,onChange:e=>to(e.target.value),displayEmpty:!0,renderValue:e=>lT(e),sx:{color:"#222",fontSize:"14px",fontWeight:500,backgroundColor:"#fff"},MenuProps:{PaperProps:{sx:{mt:1.5}},MenuListProps:{sx:{py:0}}},children:[(0,s.jsxs)(er.Z,{value:"all",children:["All (",lC.all,")"]}),(0,s.jsxs)(er.Z,{value:z.n_.VIDEO,disabled:0===lC.videos,children:["Videos (",lC.videos,")"]}),(0,s.jsxs)(er.Z,{value:z.n_.PODCAST,disabled:0===lC.podcasts,children:["Podcasts (",lC.podcasts,")"]}),(0,s.jsxs)(er.Z,{value:z.n_.WEBSITE,disabled:0===lC.websites,children:["Websites (",lC.websites,")"]}),(0,s.jsxs)(er.Z,{value:"documents",disabled:0===lC.documents,children:["Documents (",lC.documents,")"]}),(0,s.jsxs)(er.Z,{value:z.n_.LINKEDIN_POST,disabled:0===lC.linkedInPosts,children:["LinkedIn Posts (",lC.linkedInPosts,")"]}),(0,s.jsxs)(er.Z,{value:z.n_.PROMOTIONAL_LINK,disabled:0===lC.links,children:["Links (",lC.links,")"]})]})}),lP.length>0&&(0,s.jsx)(ex.Z,{size:"small",className:"min-w-0 flex-1",sx:{"& .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0,0,0,0.2)"}},children:(0,s.jsxs)(eh.Z,{value:td,onChange:e=>lD(e.target.value),displayEmpty:!0,renderValue:e=>lZ(e),sx:{color:"#222",fontSize:"14px",fontWeight:500,backgroundColor:"#fff"},MenuProps:{PaperProps:{sx:{mt:1.5}},MenuListProps:{sx:{py:0}}},children:[(0,s.jsx)(er.Z,{value:e7,children:"Edit Tags"}),(0,s.jsx)(er.Z,{value:"all",children:"All Tags"}),lP.map(e=>{var t,l;return(0,s.jsxs)(er.Z,{value:e.id,disabled:(null!==(t=lS.get(e.id))&&void 0!==t?t:0)===0,children:[e.label," (",null!==(l=lS.get(e.id))&&void 0!==l?l:0,")"]},e.id)})]})})]})]}),(eG.length>7||lP.length>0)&&(0,s.jsxs)("div",{className:"hidden md:flex items-center justify-between gap-3 mb-3 w-full",children:[(0,s.jsx)("div",{className:"flex-1 min-w-0",children:eG.length>7&&(0,s.jsxs)("div",{className:"flex items-center relative w-full max-w-[280px]",children:[(0,s.jsx)(es.Z,{className:"absolute z-[1] left-[10px] pointer-events-none",htmlColor:"#9ca3af"}),(0,s.jsx)(em.ZP,{placeholder:"Search","aria-label":"Search",className:"flex-auto w-full flex items-center md3-input h-12 pl-10 pr-[5px] transition-colors ".concat(tl||e2?"bg-white":"bg-white/70 hover:bg-white"),sx:{color:"#000","& .MuiInputBase-input":{fontSize:"16px",fontWeight:400},"& .MuiInputBase-input::placeholder":{opacity:1,color:"rgba(0, 0, 0, 0.54)"},"&.Mui-focused":{border:"1px solid rgba(0,0,0,0.35)"}},value:e2,onFocus:()=>ti(!0),onBlur:()=>ti(!1),onChange:e=>e5(e.currentTarget.value)}),!!e2&&(0,s.jsx)("div",{className:"absolute right-[5px]",children:(0,s.jsx)(ea.Z,{title:"Clear search",children:(0,s.jsx)(en.Z,{"aria-label":"Clear search",className:"w-6 h-6",sx:{color:"rgba(0,0,0,0.54)"},onClick:()=>e5(""),children:(0,s.jsx)(Q.Z,{})})})})]})}),lP.length>0&&(0,s.jsx)(ex.Z,{size:"small",className:"min-w-[110px] max-w-[220px] shrink-0",sx:{"& .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0,0,0,0.2)"}},children:(0,s.jsxs)(eh.Z,{value:td,onChange:e=>lD(e.target.value),displayEmpty:!0,renderValue:e=>lZ(e),sx:{color:"#222",fontSize:"14px",fontWeight:500,backgroundColor:"#fff"},MenuProps:{PaperProps:{sx:{mt:1.5}},MenuListProps:{sx:{py:0}}},children:[(0,s.jsx)(er.Z,{value:e7,children:"Edit Tags"}),(0,s.jsx)(er.Z,{value:"all",children:"All Tags"}),lP.map(e=>{var t,l;return(0,s.jsxs)(er.Z,{value:e.id,disabled:(null!==(t=lS.get(e.id))&&void 0!==t?t:0)===0,children:[e.label," (",null!==(l=lS.get(e.id))&&void 0!==l?l:0,")"]},e.id)})]})})]}),0===lI.length&&!lM&&(0,s.jsxs)("div",{className:"text-sm text-text-color-2 bg-surface-color roun
1ded-md px-4 py-6 text-center",children:[0===eG.length?(0,s.jsx)("p",{className:"text-base font-medium text-text-color-1 mb-4",children:"Upload your first example to sharpen how your system thinks"}):null,(0,s.jsx)("div",{className:"mb-2 font-semibold",children:"What sharpens your system best:"}),(0,s.jsxs)("ul",{className:"list-disc list-inside inline-block text-left space-y-1",children:[(0,s.jsx)("li",{children:"Decision frameworks showing your reasoning (not just templates)"}),(0,s.jsx)("li",{children:"Talks or videos where you walk through real problems"}),(0,s.jsx)("li",{children:"Strategy docs that explain your thinking, not just conclusions"}),(0,s.jsx)("li",{children:"Content where you break down why you made specific choices"}),(0,s.jsx)("li",{children:"Responses you've sent when team members asked for guidance"})]})]}),0===lI.length&&lM&&(0,s.jsx)("div",{className:"text-center text-sm text-text-color-2 bg-surface-color rounded-md px-3 py-3",children:"No matching documents"}),0!=lI.length&&(0,s.jsxs)(s.Fragment,{children:[eB?(0,s.jsx)("div",{className:"w-full min-w-0",children:(0,s.jsx)(ep.Z,{component:eC.Z,children:(0,s.jsxs)(ef.Z,{sx:{tableLayout:"fixed",width:"100%"},"aria-label":"simple table",children:[(0,s.jsxs)("colgroup",{children:[(0,s.jsx)("col",{style:{width:36}}),(0,s.jsx)("col",{style:{width:128}}),(0,s.jsx)("col",{style:{width:64}}),(0,s.jsx)("col",{}),(0,s.jsx)("col",{style:{width:124}}),(0,s.jsx)("col",{style:{width:44}})]}),(0,s.jsx)(eg.Z,{children:(0,s.jsxs)(eb.Z,{children:[(0,s.jsx)(tn,{className:"w-[1%]",children:(0,s.jsx)(eu.Z,{checked:lE,indeterminate:lL,onChange:e=>{e.target.checked?tK(new Set(lI.map(e=>e.id))):tK(new Set)},sx:{padding:0}})}),(0,s.jsx)(tn,{className:"w-[1%]",children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(ex.Z,{size:"small",sx:{minWidth:104,mr:1},children:(0,s.jsxs)(eh.Z,{value:tr,onChange:e=>to(e.target.value),displayEmpty:!0,renderValue:e=>lT(e),sx:{color:"#222",fontSize:"14px",fontWeight:500,"& .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0,0,0,0.3)"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0,0,0,0.5)"},"& .MuiSvgIcon-root":{color:"#222"}},MenuProps:{PaperProps:{sx:{mt:1.5}},MenuListProps:{sx:{py:0}}},children:[(0,s.jsxs)(er.Z,{value:"all",children:["All (",lC.all,")"]}),(0,s.jsxs)(er.Z,{value:z.n_.VIDEO,disabled:0===lC.videos,children:["Videos (",lC.videos,")"]}),(0,s.jsxs)(er.Z,{value:z.n_.PODCAST,disabled:0===lC.podcasts,children:["Podcasts (",lC.podcasts,")"]}),(0,s.jsxs)(er.Z,{value:z.n_.WEBSITE,disabled:0===lC.websites,children:["Websites (",lC.websites,")"]}),(0,s.jsxs)(er.Z,{value:"documents",disabled:0===lC.documents,children:["Documents (",lC.documents,")"]}),(0,s.jsxs)(er.Z,{value:z.n_.LINKEDIN_POST,disabled:0===lC.linkedInPosts,children:["LinkedIn Posts (",lC.linkedInPosts,")"]}),(0,s.jsxs)(er.Z,{value:z.n_.PROMOTIONAL_LINK,disabled:0===lC.links,children:["Links (",lC.links,")"]})]})}),(0,s.jsx)("button",{type:"button",onClick:()=>lz("type"),className:"flex items-center gap-0.5 hover:opacity-80 text-[#222] p-0.5",children:"type"===t6&&("asc"===t9?(0,s.jsx)(n.Z,{fontSize:"small"}):(0,s.jsx)(a.Z,{fontSize:"small"}))})]})}),(0,s.jsx)(tn,{className:"w-[1%]",children:(0,s.jsxs)("button",{type:"button",onClick:()=>lz("premium"),className:"flex items-center gap-0.5 hover:opacity-80",children:["Access","premium"===t6&&("asc"===t9?(0,s.jsx)(n.Z,{fontSize:"small"}):(0,s.jsx)(a.Z,{fontSize:"small"}))]})}),(0,s.jsx)(tn,{children:(0,s.jsxs)("button",{type:"button",onClick:()=>lz("title"),className:"flex items-center gap-0.5 hover:opacity-80",children:["Title","title"===t6&&("asc"===t9?(0,s.jsx)(n.Z,{fontSize:"small"}):(0,s.jsx)(a.Z,{fontSize:"small"}))]})}),(0,s.jsx)(tn,{className:"w-[1%] hidden sm:table-cell",children:(0,s.jsxs)("button",{type:"button",onClick:()=>lz("created"),className:"flex items-center gap-0.5 hover:opacity-80",children:["Added","created"===t6&&("asc"===t9?(0,s.jsx)(n.Z,{fontSize:"small"}):(0,s.jsx)(a.Z,{fontSize:"small"}))]})}),(0,s.jsx)(tn,{className:"w-[1%]"})]})}),(0,s.jsx)(ev.Z,{children:lF.map(e=>{var t;return(0,s.jsx)(ta,{document:e,isPremium:!!(null==tx?void 0:null===(t=tx[e.id])||void 0===t?void 0:t.enabled),isSelected:tH.has(e.id),GetDocumentTypeText:z.eA,formatDocumentDate:k.hs,onOpenLinkedInDialog:sa,onOpenPreview:sx,onToggleSelection:sm,onUpdatePaywall:l2,onDeleteDocument:sh,onRetryFailed:lX,showSpinner:ez,isProcessing:e.isProcessing,isFailed:e.isFailed,onCreatePlaybookFromLibraryR
1ow:t8},e.id)})})]})})}):(0,s.jsx)("div",{className:"flex flex-col gap-3",children:lF.map(e=>{var t;return(0,s.jsx)(ts,{document:e,isPremium:!!(null==tx?void 0:null===(t=tx[e.id])||void 0===t?void 0:t.enabled),isSelected:tH.has(e.id),isCurrentDocument:(null==tA?void 0:tA.id)===e.id,formatDocumentDate:k.hs,onOpenLinkedInDialog:sa,onOpenPreview:sx,onToggleSelection:sm,onUpdatePaywall:l2,onDeleteDocument:sh,onRetryFailed:lX,showSpinner:ez,isProcessing:e.isProcessing,isFailed:e.isFailed,onCreatePlaybookFromLibraryRow:t8},e.id)})}),lA>0&&!et&&(0,s.jsxs)("div",{className:"mt-4 text-sm text-text-color-1",children:["Your learners can already access these"," ",(0,s.jsx)("span",{className:"font-semibold",children:lA})," ","source",1!==lA?"s":""," in chat."," ",(0,s.jsx)(h.R,{href:"/".concat(t.feWebAlias,"?view=dashboard"),className:"font-semibold text-text-color-1 hover:underline",children:"See what they're asking →"})]})]}),!!tu&&eG.length>0&&(lU||tb)&&(0,s.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,s.jsxs)("button",{type:"button",onClick:()=>{lK()},disabled:tb,className:"inline-flex min-w-[180px] items-center justify-center gap-2 rounded-full border border-black/20 bg-white px-5 py-2.5 text-sm font-medium text-text-color-1 shadow-sm transition-all hover:bg-black/[0.03] disabled:cursor-not-allowed disabled:opacity-60",children:[tb&&(0,s.jsx)("span",{className:"inline-block h-4 w-4 shrink-0 rounded-full border-2 border-black/25 border-t-neutral-800 animate-spin","aria-hidden":!0}),(0,s.jsx)("span",{children:tb?"Loading 50 more...":"Load 50 more"})]})})]})]}),(0,s.jsx)(ec.ZP,{open:!!tS,anchorEl:lt,onClose:()=>{tP(void 0),ll(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{width:"fit-content",minWidth:"min(320px, calc(100vw - 32px))",maxWidth:"min(900px, calc(100vw - 32px))",maxHeight:"calc(100vh - 100px)",overflow:"auto",borderRadius:"24px",boxShadow:"0 12px 40px -24px rgba(15,23,42,0.28)",border:"1px solid hsl(var(--border))",backgroundColor:"hsl(var(--background))"}}},children:!!tS&&t&&(0,s.jsx)(eZ.default,{editState:tS,createMode:tT,assistant:tu,leaderId:t.id,uploadedVideoIds:lV,onClose:e=>{tP(void 0),ll(null),li(!1),e&&lH()},onUploadStarted:()=>{tP(void 0),ll(null),li(!0)},onSave:()=>eD(),onAssistantCreated:e=>{tm(e),null==v||v(e)}})}),(0,s.jsx)(m.Z,{showModal:!!(null==tE?void 0:tE.id),maxWidth:"4xl",closeIconClassName:tN?"hidden":"block",onClose:(e,t)=>{tN||t_(void 0)},children:!!(null==tE?void 0:tE.id)&&(0,s.jsx)(x.Z,{documentId:null==tE?void 0:tE.id,leaderName:t.name,onDiscard:()=>t_(void 0),onUpdated:()=>{t_(void 0),lH()},onTranscribing:e=>tC(e)})}),(0,s.jsx)(m.Z,{showModal:!!tA,maxWidth:"5xl",onClose:()=>{tO(void 0),tM(void 0)},children:(0,s.jsxs)("div",{className:"h-full space-y-4",children:[!!tA&&(()=>{var e;let t=sn(tA),l=(0,N.L)(tA),a=[z.n_.VIDEO,z.n_.PODCAST].includes(null==l?void 0:l.metadata.documentType)||(0,C._T)(null==l?void 0:l.metadata.documentUrl)||(0,C.nh)(null==l?void 0:l.metadata.documentUrl)||(0,C.SH)(null==l?void 0:l.metadata.documentUrl);return(0,s.jsxs)(s.Fragment,{children:[t&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"text-lg font-bold mb-2 text-wrap break-words",children:"Source"}),(0,s.jsxs)("div",{className:"bg-text-color-3/10 px-3 py-4 rounded mb-4 flex items-center gap-2",children:[(0,s.jsx)("img",{src:t.image,alt:t.label,width:18,height:18}),(0,s.jsx)("span",{children:t.label})]})]}),(0,s.jsx)("div",{className:"text-lg font-bold mb-2 text-wrap break-words",children:"Title"}),(0,s.jsx)("pre",{className:"bg-text-color-3/10 px-3 py-4 rounded mb-4 text-wrap break-words",children:(null==l?void 0:l.metadata.name)||"Untitled"}),(0,s.jsx)("div",{className:"text-lg font-bold mb-2 text-wrap break-words",children:"Tags"}),(0,s.jsx)("div",{className:"bg-text-color-3/10 px-3 py-4 rounded mb-4",children:(0,s.jsx)(tt,{initialTags:null!==(e=tA.tags)&&void 0!==e?e:[],savedTags:tY,disabled:ez,helperText:"Use tags to organize this content in your Knowledge Library.",onCh
1ange:l9})}),(0,s.jsx)("div",{className:"text-lg font-bold mb-2 text-wrap break-words",children:"Link"}),(0,s.jsx)("div",{className:"bg-text-color-3/10 px-3 py-4 rounded mb-4 text-wrap break-words",children:(null==l?void 0:l.metadata.documentUrl)?(0,s.jsx)("a",{href:l.metadata.documentUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:l.metadata.documentUrl}):(0,s.jsx)("span",{className:"text-text-color-2 italic",children:"No link available. This content has been added to your knowledge base."})}),(0,s.jsx)(d.Z,{sourceData:l}),(0,s.jsx)(c.Z,{sourceData:l}),(0,s.jsx)(u.Z,{sourceData:l}),(0,s.jsx)(o.Z,{sourceData:l}),(0,s.jsx)(r.Z,{sourceData:l}),!a&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"text-lg font-bold mb-2 text-wrap break-words",children:"Preview"}),(0,s.jsx)("pre",{className:"bg-text-color-3/10 px-3 py-4 rounded mb-4 text-wrap break-words text-text-color-2",children:"Embedded preview will appear here for supported content types (e.g., video, podcast)."})]})]})})(),(0,s.jsxs)("div",{className:"text-lg font-bold mb-2",children:["Created"," ",(0,s.jsxs)("span",{className:"text-sm font-normal",children:["(",(0,k.vd)(),")"]})]}),(0,s.jsx)("pre",{className:"bg-text-color-3/10 px-3 py-4 rounded mb-4 text-wrap break-words",children:(0,k.hs)(null==tA?void 0:tA.createdAt)}),![z.n_.PROMOTIONAL_LINK,z.n_.WEBSITE].includes(null==tA?void 0:tA.documentType)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"text-lg font-bold mb-2",children:"File Name"}),(0,s.jsx)("pre",{className:"bg-text-color-3/10 px-3 py-4 rounded mb-4 text-wrap break-words",children:null==tA?void 0:tA.fileName})]}),(0,s.jsx)("div",{className:"text-lg font-bold mb-2",children:"Description"}),(0,s.jsx)("pre",{className:"bg-text-color-3/10 px-3 py-4 rounded mb-4 text-wrap break-words",children:null==tA?void 0:tA.description}),!!tA&&tA.contributors&&0!=tA.contributors.length&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"text-lg font-bold mb-2",children:"Speakers"}),(0,s.jsx)("div",{className:"gap-1.5 flex flex-col mb-4",children:tA.contributors.map((e,t)=>(0,s.jsxs)("div",{className:"flex gap-1.5 items-center",children:[(0,s.jsx)("div",{className:"flex items-center justify-center bg-text-caption-color/40 w-5 h-5 rounded-full",children:(0,s.jsx)(i.Z,{className:"text-white w-[15px] h-[15px]"})}),(0,s.jsx)("div",{className:"text-sm",children:e})]},"document_contributer_".concat(t)))})]}),(null==tA?void 0:tA.documentUrl)&&(null==tA?void 0:tA.documentType)&&[z.n_.VIDEO,z.n_.PODCAST].includes(null==tA?void 0:tA.documentType)&&(0,s.jsx)("div",{className:"flex-none pt-2 flex flex-wrap gap-3 items-center justify-between mb-4",children:(0,s.jsx)("div",{className:"flex-none",children:!!(null==eL?void 0:eL.get(R.E.WEB_P
1LATFORM_IDENTIFY_SPEAKERS_ENABLED))&&(0,s.jsx)("button",{type:"button",className:"bg-white text-black border border-text-caption-color hover:shadow rounded-full py-[6px] px-[14px] flex justify-center items-center transition-all duration-300 mx-auto text-sm text-nowrap",onClick:()=>{tA&&t_(tA)},children:"Identify speakers"})})})]})}),(0,s.jsxs)(ey.Z,{open:!!tL,PaperProps:{sx:{borderRadius:"12px"}},children:[(0,s.jsx)(ej.Z,{children:(0,s.jsxs)("div",{children:["Are you sure you want to delete ",(0,s.jsx)("b",{children:null==tL?void 0:tL.name}),"?"]})}),(0,s.jsx)(ew.Z,{disableSpacing:!0,sx:{px:3,py:2.5},children:(0,s.jsxs)("div",{className:"w-full flex items-center justify-center gap-3",children:[(0,s.jsx)("button",{className:"rounded-full min-w-20 h-10 px-4 text-white bg-black sm:w-auto border border-black/40 hover:scale-[103%] transition-all",onClick:()=>{tL&&st(tL.id)},children:"Yes"}),(0,s.jsx)("button",{autoFocus:!0,className:"rounded-full min-w-20 h-10 px-4 text-black bg-white sm:w-auto border border-black/40 hover:scale-[103%] transition-all",onClick:()=>{tO(void 0),tM(void 0)},children:"Cancel"})]})})]}),(0,s.jsxs)(ey.Z,{open:tF,onClose:()=>tz(!1),PaperProps:{sx:{borderRadius:"12px"}},children:[(0,s.jsx)(ej.Z,{children:(0,s.jsxs)("div",{children:["Are you sure you want to delete ",(0,s.jsx)("b",{children:tH.size})," selected document(s)?"]})}),(0,s.jsx)(ew.Z,{disableSpacing:!0,sx:{px:3,py:2.5},children:(0,s.jsxs)("div",{className:"w-full flex items-center justify-center gap-3",children:[(0,s.jsx)("button",{className:"rounded-full min-w-20 h-10 px-4 text-white bg-black sm:w-auto border border-black/40 hover:scale-[103%] transition-all",onClick:()=>l$(),children:"Yes"}),(0,s.jsx)("button",{autoFocus:!0,className:"rounded-full min-w-20 h-10 px-4 text-black bg-white sm:w-auto border border-black/40 hover:scale-[103%] transition-all",onClick:()=>tz(!1),children:"Cancel"})]})})]}),(0,s.jsxs)(ey.Z,{open:!!tU,onClose:()=>tR(null),PaperProps:{sx:{borderRadius:"12px"}},children:[(0,s.jsx)(ej.Z,{children:(0,s.jsx)("div",{children:(null==tU?void 0:tU.isProcessing)?(0,s.jsxs)(s.Fragment,{children:["Remove ",(0,s.jsx)("b",{children:null==tU?void 0:tU.name})," from the queue?"]}):(0,s.jsxs)(s.Fragment,{children:["Are you sure you want to delete ",(0,s.jsx)("b",{children:null==tU?void 0:tU.name}),"?"]})})}),(0,s.jsx)(ew.Z,{disableSpacing:!0,sx:{px:3,py:2.5},children:(0,s.jsxs)("div",{className:"w-full flex items-center justify-center gap-3",children:[(0,s.jsx)("button",{className:"rounded-full min-w-20 h-10 px-4 text-white bg-black sm:w-auto border border-black/40 hover:scale-[103%] transition-all",onClick:()=>tU&&l0(tU),children:"Yes"}),(0,s.jsx)("button",{autoFocus:!0,className:"rounded-full min-w-20 h-10 px-4 text-black bg-white sm:w-auto border border-black/40 hover:scale-[103%] transition-all",onClick:()=>tR(null),children:"Cancel"})]})})]}),(0,s.jsxs)(ey.Z,{open:tq,onClose:()=>{tX(!1),t$([])},PaperProps:{sx:{borderRadius:"16px",width:"min(560px, calc(100vw - 32px))"}},children:[(0,s.jsx)(ej.Z,{children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-lg font-bold",children:"Add tags to selected documents"}),(0,s.jsx)("div",{className:"text-sm text-text-color-2",children:"Tags will be added to finalized selected documents. Existing tags are kept."})]}),(0,s.jsx)(tt,{initialTags:[],savedTags:tY,disabled:ez||lr,helperText:"Choose existing tags or type a new tag and press Enter.",onChange:async e=>(t$(e),!0)})]})}),(0,s.jsxs)(ew.Z,{disableSpacing:!0,sx:{px:3,py:2.5},children:[(0,s.jsx)("button",{className:"rounded-full min-w-20 h-10 px-4 mr-2 text-white bg-black sm:w-auto border border-black/40 hover:scale-[103%] transition-all disabled:opacity-50",disabled:0===tQ.length||ez||lr,onClick:()=>se(tQ),children:"Add tags"}),(0,s.jsx)("button",{className:"rounded-full min-w-20 h-10 px-4 text-black bg-white sm:w-auto border border-black/40 hover:scale-[103%] transition-all",onClick:()=>{tX(!1),t$([])},children:"Cancel"})]})]}),(0,s.jsxs)(ey.Z,{open:t0,onClose:()=>t1(!1),PaperProps:{sx:{borderRadius:"16px",width:"min(640px, calc(100vw - 32px))"}},children:[(0,s.jsx)(ej.Z,{children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-lg font-bold",children:"Manage tags"}),(0,s.jsx)("div",{className:"text-sm text-text-color-2",children:"Rename saved tags or delete them everywhere they are applied."})]}),(0,s.jsx)("div",{className:"space-y-3 max-h-[55vh] overflow-y-auto pr-1",children:lP.length>0?lP.map(e=>{var t,l,a,n;let i=!!t4[e.id];return(0,s.jsx)("div",{className:"rounded-xl border border-border bg-white px-3 py-3",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,s.jsx)(eo.Z,{value:null!==(t=t2[e.id])&&void 0!==t?t:e.label,disabled:i,onChange:t=>t5(l=>({...l,[e.id]:t.target.value.slice(0,40)})),size:"small",inputProps:{maxLength:40},helperText:"".concat(null!==(l=lS.get(e.id))&&void 0!==l?l:0," document").concat((null!==(a=lS.get(e.id))&&void 0!==a?a:0)===1?"":"s"),sx:{flex:1,"& .MuiOutlinedInput-root":{borderRadius:"12px",backgroundColor:"white"}}}),(0,s.jsxs)("div",{className:"flex items-center gap-2 sm:justify-end",children:[(0,s.jsx)("button",{type:"button",className:"rounded-full border border-black/40 bg-black px-4 py-2 text-sm font-medium text-white transition-all hover:scale-[103%] disabled:opacity-50",disabled:i||e6(null!==(n=t2[e.id])&&void 0!==n?n:e.label)===e.label,onClick:()=>l6(e.id),children:"Save"}),(0,s.jsx)("button",{type:"button",className:"rounded-full border border-warning-color/40 bg-white px-4 py-2 text-sm font-medium text-warning-color transition-all hover:scale-[103%] disabled:opacity-50",disabled:i,onClick:()=>l7(e.id),children:"Delete"})]})]})},e.id)}):(0,s.jsx)("div",{className:"rounded-xl border border-border bg-white px-3 py-4 text-sm text-text-color-2",children:"No saved tags yet."})})]})}),(0,s.jsx)(ew.Z,{disableSpacing:!0,sx:{px:3,py:2.5},children:(0,s.jsx)("button",{className:"rounded-full min-w-20 h-10 px-4 text-black bg-white sm:w-auto border border-black/40 hover:scale-[103%] transition-all",onClick:()=>t1(!1),children:"Done"})})]}),(0,s.jsx)(eV,{document:tW,leader:t,isOpen:!!tW,onClose:()=>{tB(null)}}),(0,s.jsx)(eQ.Z,{open:tD,setShowDialog:tI}),ln&&!et&&(0,s.jsx)(e3,{}),tH.size>0&&"undefined"!=typeof document&&(()=>{let e=lI.filter(e=>tH.has(e.id)),t=e.some(e=>!e.isProcessing&&!e.isFailed),l=e.some(e=>e.isFailed),a=!!eN&&e.some(e=>{var t;return!e.isProcessing&&!e.isFailed&&!!(null===(t=e.documentUrl)||void 0===t?void 0:t.trim())&&e0(e.documentUrl)}),n=e.filter(e=>!e.isProcessing&&!e.isFailed),i="mixed";if(n.length>0){let e=n.filter(e=>{var t;return null==tx?void 0:null===(t=tx[e.id])||void 0===t?void 0:t.enabled}).length;e===n.length?i="paid":0===e&&(i="free")}return(0,eT.createPortal)((0,s.jsx)(e4,{selectedCount:tH.size,isProcessing:lr,hasFinalized:t,hasErrors:l,accessMode:i,onSetAccessFree:()=>l1(!1),onSetAccessPaid:()=>l1(!0),onAddTags:()=>{t$([]),tX(!0)},onDelete:()=>tz(!0),onRetryFailed:lQ,showCreatePlaybook:a,onCreatePlaybook:a?lO:void 0}),document.body)})()]})}let ts=(0,eP.memo)(function(e){let{document:t,isPremium:l,isSelected:a,isCurrentDocument:n,formatDocumentDate:i,onOpenLinkedInDialog:r,onOpenPreview:o,onToggleSelection:d,onUpdatePaywall:c,onDeleteDocument:u,onRetryFailed:m,showSpinner:x,isProcessing:h=!1,isFailed:p=!1,onCreatePlaybookFromLibraryR
1ow:f}=e,[g,b]=(0,eP.useState)(null);return(0,s.jsxs)("div",{className:"flex flex-col gap-2 p-4 rounded-lg border border-[rgba(0,0,0,0.2)] bg-white ".concat(n?"ring-2 ring-[#222] ring-offset-1":""),style:{contentVisibility:"auto",containIntrinsicSize:"108px"},children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(eu.Z,{checked:a,onChange:e=>d(t.id,e.target.checked),onClick:e=>e.stopPropagation(),sx:{padding:0,marginTop:"-4px"}}),(0,s.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-1",children:[(0,s.jsx)("div",{className:"flex items-start gap-2 min-w-0",children:(0,s.jsx)("button",{type:"button",className:"font-medium text-base text-gray-900 line-clamp-3 text-left hover:underline cursor-pointer flex-1 min-w-0",onClick:()=>o(t),children:(0,v.Z)(t)})}),(0,s.jsx)(te,{tags:t.tags,onOpenDocument:()=>o(t)}),(0,s.jsx)("div",{className:"text-xs text-text-color-2",children:h?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium",style:{backgroundColor:"#f3f4f6"},"aria-label":"Processing",children:[(0,s.jsx)("span",{className:"pl-2",children:"Pending"}),(0,s.jsx)("span",{className:"inline-flex p-0.5",children:(0,s.jsx)("span",{className:"inline-block h-4 w-4 border-2 border-gray-600 border-t-transparent rounded-full animate-spin opacity-60"})})]}):p?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,s.jsx)(ea.Z,{title:t.failedErrorMessage||"Processing failed",placement:"top",children:(0,s.jsx)("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-xs font-medium cursor-default",style:{backgroundColor:"#ffe8e8",color:"#b91c1c"},children:"Error"})}),(0,s.jsx)(ea.Z,{title:"Retry",children:(0,s.jsx)("span",{className:"inline-flex items-center justify-center rounded-full p-1",style:{backgroundColor:"#f3f4f6"},children:(0,s.jsx)(en.Z,{size:"small",className:"w-6 h-6 -m-0.5",onClick:e=>{e.stopPropagation(),null==m||m(t)},disabled:x,"aria-label":"Retry",children:(0,s.jsx)(el.Z,{sx:{fontSize:16}})})})}),(0,s.jsx)(ea.Z,{title:"Cancel",children:(0,s.jsx)("span",{className:"inline-flex items-center justify-center rounded-full p-1",style:{backgroundColor:"#f3f4f6"},children:(0,s.jsx)(en.Z,{size:"small",className:"w-6 h-6 -m-0.5",onClick:e=>{e.stopPropagation(),u(t)},disabled:x,"aria-label":"Cancel",children:(0,s.jsx)(Q.Z,{sx:{fontSize:16}})})})})]}):i(t.createdAt)})]}),(0,s.jsxs)("div",{className:"flex flex-col items-end justify-between self-stretch",children:[!h&&!p&&(0,s.jsx)("span",{className:"inline-flex items-center gap-1 shrink-0 px-2 py-0.5 rounded-full text-xs font-medium ".concat(l?"bg-black text-white border border-black":"bg-accent/40 text-muted-foreground border border-border"),children:l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eK.Z,{sx:{fontSize:12,color:"inherit"}}),"Paid"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eY.Z,{sx:{fontSize:12,color:"inherit"}}),"Free"]})}),(0,s.jsx)(ea.Z,{title:"Content options",children:(0,s.jsx)(en.Z,{size:"small",onClick:e=>{e.stopPropagation(),b(e.currentTarget)},className:"w-10 h-10 min-w-[44px] min-h-[44px] ml-auto","aria-label":"Content options",disabled:x,children:(0,s.jsx)(et.Z,{fontSize:"small"})})})]})]}),(0,s.jsxs)(ei.Z,{anchorEl:g,open:!!g,onClose:()=>b(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},MenuListProps:{sx:{py:0}},children:[(0,s.jsx)(er.Z,{onClick:()=>{o(t),b(null)},children:"Preview"}),!h&&!p&&(0,s.jsx)(er.Z,{onClick:()=>{r(t),b(null)},children:"Create LinkedIn Post"}),!h&&!p&&f&&e0(t.documentUrl)&&(0,s.jsx)(er.Z,{onClick:()=>{f(t),b(null)},children:"Make Playbook"}),!h&&!p&&(l?(0,s.jsx)(er.Z,{onClick:()=>{c(t.id,!1),b(null)},children:"Mark as Free"}):(0,s.jsx)(er.Z,{onClick:()=>{c(t.id,!0),b(null)},children:"Mark as Paid"})),(0,s.jsx)(er.Z,{onClick:()=>{u(t),b(null)},sx:{color:"error.main"},children:h?"Remove from queue":p?"Remove":"Delete"})]})]})}),ta=(0,eP.memo)(function(e){let{document:t,isPremium:l,isSelected:a,GetDocumentTypeText:n,formatDocumentDate:i,onOpenLinkedInDialog:r,onOpenPreview:o,onToggleSelection:d,onUpdatePaywall:c,onDeleteDocument:u,onRetryFailed:m,showSpinner:x,isProcessing:h=!1,isFailed:p=!1,onCreatePlaybookFromLibraryR
1ow:f}=e,[g,b]=(0,eP.useState)(null);return(0,s.jsxs)(ti,{sx:{"&:last-child td, &:last-child th":{border:0},contentVisibility:"auto",containIntrinsicSize:"60px"},children:[(0,s.jsx)(tn,{component:"th",scope:"row",children:(0,s.jsx)(eu.Z,{checked:a,onChange:e=>d(t.id,e.target.checked),onClick:e=>e.stopPropagation(),sx:{padding:0}})}),(0,s.jsx)(tn,{component:"th",scope:"row",children:n(null==t?void 0:t.documentType)}),(0,s.jsx)(tn,{component:"th",scope:"row",children:h||p?(0,s.jsx)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap px-2 py-0.5 rounded-full text-xs font-medium text-gray-400",children:"—"}):l?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap px-2 py-0.5 rounded-full text-xs font-medium bg-black text-white border border-black",children:[(0,s.jsx)(eK.Z,{sx:{fontSize:14,color:"inherit"}}),"Paid"]}):(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap px-2 py-0.5 rounded-full text-xs font-medium bg-accent/40 text-muted-foreground border border-border",children:[(0,s.jsx)(eY.Z,{sx:{fontSize:14,color:"inherit"}}),"Free"]})}),(0,s.jsx)(tn,{sx:{minWidth:0,overflow:"hidden",whiteSpace:"normal"},children:(0,s.jsxs)("div",{className:"flex flex-col gap-1 min-w-0",children:[(0,s.jsx)("button",{type:"button",className:"text-left hover:underline cursor-pointer truncate min-w-0 flex-1",onClick:()=>o(t),children:(0,v.Z)(t)}),(0,s.jsx)(te,{tags:t.tags,onOpenDocument:()=>o(t)})]})}),(0,s.jsx)(tn,{component:"th",scope:"row",className:"hidden sm:table-cell",children:h?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium",style:{backgroundColor:p?"#ffe8e8":h?"#f3f4f6":void 0},"aria-label":"Processing",children:[(0,s.jsx)("span",{className:"pl-2",children:"Pending"}),(0,s.jsx)("span",{className:"inline-flex p-0.5",children:(0,s.jsx)("span",{className:"inline-block h-4 w-4 border-2 border-gray-600 border-t-transparent rounded-full animate-spin opacity-60"})})]}):p?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,s.jsx)(ea.Z,{title:t.failedErrorMessage||"Processing failed",placement:"top",children:(0,s.jsx)("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-xs font-medium cursor-default",style:{backgroundColor:"#ffe8e8",color:"#b91c1c"},children:"Error"})}),(0,s.jsx)(ea.Z,{title:"Retry",children:(0,s.jsx)("span",{className:"inline-flex items-center justify-center rounded-full p-1",style:{backgroundColor:"#f3f4f6"},children:(0,s.jsx)(en.Z,{size:"small",className:"w-7 h-7",onClick:e=>{e.stopPropagation(),null==m||m(t)},disabled:x,"aria-label":"Retry",children:(0,s.jsx)(el.Z,{sx:{fontSize:18}})})})}),(0,s.jsx)(ea.Z,{title:"Cancel",children:(0,s.jsx)("span",{className:"inline-flex items-center justify-center rounded-full p-1",style:{backgroundColor:"#f3f4f6"},children:(0,s.jsx)(en.Z,{size:"small",className:"w-7 h-7",onClick:e=>{e.stopPropagation(),u(t)},disabled:x,"aria-label":"Cancel",children:(0,s.jsx)(Q.Z,{sx:{fontSize:18}})})})})]}):i(t.createdAt)}),(0,s.jsxs)(tn,{children:[(0,s.jsx)(ea.Z,{title:"Content options",children:(0,s.jsx)(en.Z,{size:"small",onClick:e=>{e.stopPropagation(),b(e.currentTarget)},className:"w-8 h-8","aria-label":"Content options",disabled:x,children:(0,s.jsx)(et.Z,{fontSize:"small"})})}),(0,s.jsxs)(ei.Z,{anchorEl:g,open:!!g,onClose:()=>b(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},MenuListProps:{sx:{py:0}},children:[(0,s.jsx)(er.Z,{onClick:()=>{o(t),b(null)},children:"Preview"}),!h&&!p&&(0,s.jsx)(er.Z,{onClick:()=>{r(t),b(null)},children:"Create LinkedIn Post"}),!h&&!p&&f&&e0(t.documentUrl)&&(0,s.jsx)(er.Z,{onClick:()=>{f(t),b(null)},children:"Make Playbook"}),!h&&!p&&(l?(0,s.jsx)(er.Z,{onClick:()=>{c(t.id,!1),b(null)},children:"Mark as Free"}):(0,s.jsx)(er.Z,{onClick:()=>{c(t.id,!0),b(null)},children:"Mark as Paid"})),(0,s.jsx)(er.Z,{onClick:()=>{u(t),b(null)},sx:{color:"error.main"},children:h?"Remove from queue":p?"Remove":"Delete"})]})]})]})}),tn=(0,ek.ZP)(eN.Z)(e=>{let{theme:t}=e;return{["&.".concat(eS.Z.head)]:{backgroundColor:"hsl(var(--accent) / 0.35)",color:"hsl(var(--muted-foreground))",padding:"8px 14px",textTransform:"uppercase",letterSpacing:"0.08em",fontSize:12,fontWeight:600},["&.".concat(eS.Z.body)]:{fontSize:14,padding:"10px 14px",whiteSpace:"nowrap"},"&:nth-last-child(1)":{paddingLeft:8,paddingRight:8,textAlign:"center"},"&:nth-last-child(2)":{paddingLeft:8,paddingRight:16}}}),ti=(0,ek.ZP)(eb.Z)(e=>{let{theme:t}=e;return{"&:last-child td, &:last-child th":{border:0},"&:hover":{backgroundColor:"rgba(0,0,0,0.03)"}}})},93844:function(e,t,l){l.d(t,{t:function(){return i}});var s=l(2265);let a=0;function n(){if("undefined"==typeof document)return;let e=document.documentElement;if(a<=0){e.style.removeProperty("--app-toast-bottom");return}let t=4*a;e.style.setProperty("--app-toast-bottom","calc(24px + ".concat(t,"rem + env(safe-area-inset-bottom, 0px))"))}function i(){(0,s.useLayoutEffect)(()=>(a+=1,n(),()=>{a-=1,n()}),[])}}}]);

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.