Files
igny8/frontend/dist/assets/js/page-dashboard-CuOyqq-s.js
IGNY8 VPS (Salman) ca5bf13c74 buid node modules
2025-11-13 14:02:26 +00:00

14 lines
47 KiB
JavaScript

import{r as m,j as t,d as se,a as F}from"./vendor-react-core-DRQGgXXF.js";import{L as T}from"./vendor-react-router-P1WQ4rUN.js";import{S as re,a as ne,P as oe,b as z,c as ie,d as J,e as O,f as L,g as B,h as ce}from"./page-authpages-BaiNliVr.js";import{c as D,p as G}from"./vendor-state-C9hO8g1p.js";import{C as I}from"./page-components.tsx-4vErPdxY.js";import{_ as de}from"./marketing-marketingapp.tsx-D0Y0OkFz.js";function le(){const e=window.location.origin;return e.includes("localhost")||e.includes("127.0.0.1")||/^\d+\.\d+\.\d+\.\d+/.test(e)?e.includes(":3000")?e.replace(":3000",":8011")+"/api":e.includes(":7921")?e.replace(":7921",":7911")+"/api":e.split(":")[0]+":8011/api":"https://api.igny8.com/api"}const C=le();function $(){var e;try{const a=localStorage.getItem("site-storage");if(a){const s=JSON.parse(a),r=(e=s==null?void 0:s.state)==null?void 0:e.activeSite;if(r&&r.id)return r.id}return null}catch(a){return console.warn("Failed to get active site ID from storage:",a),null}}function P(){var e;try{const a=localStorage.getItem("sector-storage");if(a){const s=JSON.parse(a),r=(e=s==null?void 0:s.state)==null?void 0:e.activeSector;if(r&&r.id)return r.id}return null}catch(a){return console.warn("Failed to get active sector ID from storage:",a),null}}const ue=()=>{var e;try{const a=localStorage.getItem("auth-storage");if(a){const s=JSON.parse(a);return((e=s==null?void 0:s.state)==null?void 0:e.token)||null}}catch{}return null},ge=()=>{var e;try{const a=localStorage.getItem("auth-storage");if(a){const s=JSON.parse(a);return((e=s==null?void 0:s.state)==null?void 0:e.refreshToken)||null}}catch{}return null};async function i(e,a){var l,c,d,x,y,b;const s=(a==null?void 0:a.timeout)||3e4,r=new AbortController,n=setTimeout(()=>r.abort(),s);try{const o=ue(),u={"Content-Type":"application/json",...a==null?void 0:a.headers};o&&(u.Authorization=`Bearer ${o}`);const p=await fetch(`${C}${e}`,{headers:u,credentials:"include",signal:r.signal,...a});clearTimeout(n);const S=p.headers.get("content-type")||"",k=p.headers.get("content-length"),v=await p.text();if(p.status===401){const g=ge();if(g)try{const f=await fetch(`${C}/v1/auth/refresh/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh:g}),credentials:"include"});if(f.ok){const h=await f.json();if(h.success&&h.access){try{const N=localStorage.getItem("auth-storage");if(N){const E=JSON.parse(N);E.state.token=h.access,localStorage.setItem("auth-storage",JSON.stringify(E))}}catch{}const j={...u,Authorization:`Bearer ${h.access}`},w=await fetch(`${C}${e}`,{headers:j,credentials:"include",...a}),_=await w.text();if(w.ok){if(_&&_.trim())try{return JSON.parse(_)}catch{return _}return null}}}}catch{}}if(!p.ok){let g=p.statusText,f="HTTP_ERROR",h=null;try{if(S.includes("application/json"))try{if(h=JSON.parse(v),g=h.error||h.message||h.detail||g,h.success===!1&&h.error)return h;(l=h.error)!=null&&l.includes("OperationalError")?f="DATABASE_ERROR":(c=h.error)!=null&&c.includes("ValidationError")?f="VALIDATION_ERROR":(d=h.error)!=null&&d.includes("PermissionDenied")?f="PERMISSION_ERROR":(x=h.error)!=null&&x.includes("NotFound")?f="NOT_FOUND_ERROR":(y=h.error)!=null&&y.includes("IntegrityError")?f="DATABASE_ERROR":(b=h.error)!=null&&b.includes("RelatedObjectDoesNotExist")&&(f="RELATED_OBJECT_ERROR")}catch{g=v.substring(0,200)}else if(v.includes("<!DOCTYPE html>")){const w=v.match(/<title>([^<]+) at ([^<]+)<\/title>/);if(w)f=w[1].trim(),g=`${f} at ${w[2].trim()}`;else{const _=v.match(/<h1[^>]*>([^<]+)<\/h1>/);_?(g=_[1].trim(),f=g.split(" ")[0]):g=`HTTP ${p.status} Error`}}else g=v.substring(0,200)}catch{g=p.statusText}console.error("API Error:",{status:p.status,type:f,message:g,endpoint:e,errorData:h});const j=new Error(`API Error (${p.status}): ${f} - ${g}`);throw j.response=h,j.status=p.status,j}if(p.status===204||k==="0"||!v||v.trim()===""||S&&!S.includes("application/json"))return;try{return JSON.parse(v)}catch{return v}}catch(o){throw clearTimeout(n),o.name==="AbortError"?new Error(`Request timeout after ${s}ms: ${C}${e}`):o instanceof TypeError&&o.message.includes("Failed to fetch")?new Error(`Network Error: Unable to reach API at ${C}${e}. Check CORS and network connectivity.`):o}}async function q(e={}){const a=new URLSearchParams;if(!e.site_id){const n=$();n&&(e.site_id=n)}if(e.sector_id===void 0){const n=P();n!=null&&(e.sector_id=n)}e.search&&a.append("search",e.search),e.status&&a.append("status",e.status),e.cluster_id&&a.append("cluster_id",e.cluster_id),e.intent&&a.append("intent",e.intent),e.difficulty_min!==void 0&&a.append("difficulty_min",e.difficulty_min.toString()),e.difficulty_max!==void 0&&a.append("difficulty_max",e.difficulty_max.toString()),e.volume_min!==void 0&&a.append("volume_min",e.volume_min.toString()),e.volume_max!==void 0&&a.append("volume_max",e.volume_max.toString()),e.site_id&&a.append("site_id",e.site_id.toString()),e.sector_id&&a.append("sector_id",e.sector_id.toString()),e.page&&a.append("page",e.page.toString()),e.page_size!==void 0&&e.page_size!==null&&a.append("page_size",e.page_size.toString()),e.ordering&&a.append("ordering",e.ordering);const s=a.toString(),r=`/v1/planner/keywords/${s?`?${s}`:""}`;return i(r)}async function me(e){return i("/v1/planner/keywords/",{method:"POST",body:JSON.stringify(e)})}async function pe(e,a){return i(`/v1/planner/keywords/${e}/`,{method:"PUT",body:JSON.stringify(a)})}async function he(e){return i(`/v1/planner/keywords/${e}/`,{method:"DELETE"})}async function xe(e){return i("/v1/planner/keywords/bulk_delete/",{method:"POST",body:JSON.stringify({ids:e})})}async function ye(e,a){return i("/v1/planner/keywords/bulk_update/",{method:"POST",body:JSON.stringify({ids:e,status:a})})}async function K(e={}){const a=new URLSearchParams;if(!e.site_id){const n=$();n&&(e.site_id=n)}if(e.sector_id===void 0){const n=P();n!=null&&(e.sector_id=n)}e.search&&a.append("search",e.search),e.status&&a.append("status",e.status),e.difficulty_min!==void 0&&a.append("difficulty_min",e.difficulty_min.toString()),e.difficulty_max!==void 0&&a.append("difficulty_max",e.difficulty_max.toString()),e.volume_min!==void 0&&a.append("volume_min",e.volume_min.toString()),e.volume_max!==void 0&&a.append("volume_max",e.volume_max.toString()),e.site_id&&a.append("site_id",e.site_id.toString()),e.sector_id&&a.append("sector_id",e.sector_id.toString()),e.page&&a.append("page",e.page.toString()),e.page_size!==void 0&&e.page_size!==null&&a.append("page_size",e.page_size.toString()),e.ordering&&a.append("ordering",e.ordering);const s=a.toString(),r=`/v1/planner/clusters/${s?`?${s}`:""}`;return i(r)}async function be(e){return i("/v1/planner/clusters/",{method:"POST",body:JSON.stringify(e)})}async function fe(e,a){return i(`/v1/planner/clusters/${e}/`,{method:"PUT",body:JSON.stringify(a)})}async function ve(e){return i(`/v1/planner/clusters/${e}/`,{method:"DELETE"})}async function Se(e){return i("/v1/planner/clusters/bulk_delete/",{method:"POST",body:JSON.stringify({ids:e})})}async function we(e,a){return i("/v1/planner/clusters/bulk_update/",{method:"POST",body:JSON.stringify({ids:e,status:a})})}async function _e(e,a){const s="/v1/planner/keywords/auto_cluster/",r={ids:e,sector_id:a};try{const n=await i(s,{method:"POST",body:JSON.stringify(r)});return n&&n.success===!1,n}catch(n){throw n}}async function ke(e){const a="/v1/planner/clusters/auto_generate_ideas/",s={ids:e};try{return await i(a,{method:"POST",body:JSON.stringify(s)})}catch(r){throw r}}async function H(e={}){const a=new URLSearchParams;if(!e.site_id){const n=$();n&&(e.site_id=n)}if(e.sector_id===void 0){const n=P();n!=null&&(e.sector_id=n)}e.search&&a.append("search",e.search),e.status&&a.append("status",e.status),e.keyword_cluster_id&&a.append("keyword_cluster_id",e.keyword_cluster_id),e.content_structure&&a.append("content_structure",e.content_structure),e.content_type&&a.append("content_type",e.content_type),e.site_id&&a.append("site_id",e.site_id.toString()),e.sector_id&&a.append("sector_id",e.sector_id.toString()),e.page&&a.append("page",e.page.toString()),e.page_size!==void 0&&e.page_size!==null&&a.append("page_size",e.page_size.toString()),e.ordering&&a.append("ordering",e.ordering);const s=a.toString(),r=`/v1/planner/ideas/${s?`?${s}`:""}`;return i(r)}async function je(e){return i("/v1/planner/ideas/",{method:"POST",body:JSON.stringify(e)})}async function Ne(e,a){return i(`/v1/planner/ideas/${e}/`,{method:"PUT",body:JSON.stringify(a)})}async function Ce(e){return i(`/v1/planner/ideas/${e}/`,{method:"DELETE"})}async function Te(e){return i("/v1/planner/ideas/bulk_delete/",{method:"POST",body:JSON.stringify({ids:e})})}async function Oe(e,a){return i("/v1/planner/ideas/bulk_update/",{method:"POST",body:JSON.stringify({ids:e,status:a})})}async function $e(e){return i("/v1/planner/ideas/bulk_queue_to_writer/",{method:"POST",body:JSON.stringify({ids:e})})}async function W(e={}){const a=new URLSearchParams;if(!e.site_id){const n=$();n&&(e.site_id=n)}if(e.sector_id===void 0){const n=P();n!=null&&(e.sector_id=n)}e.search&&a.append("search",e.search),e.status&&a.append("status",e.status),e.cluster_id&&a.append("cluster_id",e.cluster_id),e.content_type&&a.append("content_type",e.content_type),e.content_structure&&a.append("content_structure",e.content_structure),e.site_id&&a.append("site_id",e.site_id.toString()),e.sector_id&&a.append("sector_id",e.sector_id.toString()),e.page&&a.append("page",e.page.toString()),e.page_size!==void 0&&e.page_size!==null&&a.append("page_size",e.page_size.toString()),e.ordering&&a.append("ordering",e.ordering);const s=a.toString(),r=`/v1/writer/tasks/${s?`?${s}`:""}`;return i(r)}async function Pe(e){return i("/v1/writer/tasks/",{method:"POST",body:JSON.stringify(e)})}async function Ie(e,a){return i(`/v1/writer/tasks/${e}/`,{method:"PUT",body:JSON.stringify(a)})}async function Ee(e){return i(`/v1/writer/tasks/${e}/`,{method:"DELETE"})}async function Re(e){return i("/v1/writer/tasks/bulk_delete/",{method:"POST",body:JSON.stringify({ids:e})})}async function Ae(e,a){return i("/v1/writer/tasks/bulk_update/",{method:"POST",body:JSON.stringify({ids:e,status:a})})}async function ze(e){const a="/v1/writer/tasks/auto_generate_content/",s={ids:e};try{return await i(a,{method:"POST",body:JSON.stringify(s)})}catch(r){throw r}}async function Je(e){const a="/v1/writer/tasks/auto_generate_images/",s={task_ids:e};try{return await i(a,{method:"POST",body:JSON.stringify(s)})}catch(r){throw r}}async function Le(e){return i("/v1/writer/content/generate_image_prompts/",{method:"POST",body:JSON.stringify({ids:e})})}async function V(e={}){const a=new URLSearchParams;if(!e.site_id){const r=$();r&&(e.site_id=r)}if(e.sector_id===void 0){const r=P();r!=null&&(e.sector_id=r)}e.site_id&&a.append("site_id",e.site_id.toString()),e.sector_id&&a.append("sector_id",e.sector_id.toString());const s=a.toString();return i(`/v1/writer/images/content_images/${s?`?${s}`:""}`)}async function Ue(e,a){return i("/v1/writer/images/bulk_update/",{method:"POST",body:JSON.stringify({content_id:e,status:a})})}async function De(e,a){return i("/v1/writer/images/generate_images/",{method:"POST",body:JSON.stringify({ids:e,content_id:a})})}async function Me(e={}){const a=new URLSearchParams;e.content_id&&a.append("content_id",e.content_id.toString()),e.task_id&&a.append("task_id",e.task_id.toString()),e.image_type&&a.append("image_type",e.image_type),e.status&&a.append("status",e.status),e.ordering&&a.append("ordering",e.ordering),e.page&&a.append("page",e.page.toString()),e.page_size&&a.append("page_size",e.page_size.toString());const s=a.toString();return i(`/v1/writer/images/${s?`?${s}`:""}`)}async function Fe(){return i("/v1/system/integrations/image_generation/")}async function U(){return i("/v1/auth/sites/")}async function Be(e){return i("/v1/auth/sites/",{method:"POST",body:JSON.stringify(e)})}async function Ge(e,a){return i(`/v1/auth/sites/${e}/`,{method:"PATCH",body:JSON.stringify(a)})}async function qe(e){return i(`/v1/auth/sites/${e}/`,{method:"DELETE"})}async function Ke(e){return i(`/v1/auth/sites/${e}/set_active/`,{method:"POST"})}async function He(e,a,s){return i(`/v1/auth/sites/${e}/select_sectors/`,{method:"POST",body:JSON.stringify({industry_slug:a,sector_slugs:s})})}async function Y(e){return i(`/v1/auth/sites/${e}/sectors/`)}async function We(){return i("/v1/auth/industries/")}async function Ve(){return i("/v1/system/settings/account/")}async function Ye(e){return i(`/v1/system/settings/account/${e}/`)}async function Qe(e){return i("/v1/system/settings/account/",{method:"POST",body:JSON.stringify(e)})}async function Xe(e,a){return i(`/v1/system/settings/account/${e}/`,{method:"PUT",body:JSON.stringify(a)})}async function Ze(e){return(await i(`/v1/system/settings/modules/module/${e}/`)).results||[]}async function et(e){return i("/v1/system/settings/modules/",{method:"POST",body:JSON.stringify(e)})}async function tt(e,a,s){return i(`/v1/system/settings/modules/${a}/?module_name=${e}`,{method:"PUT",body:JSON.stringify(s)})}async function Q(){return i("/v1/billing/credits/balance/balance/")}async function at(e){const a=new URLSearchParams;e!=null&&e.operation_type&&a.append("operation_type",e.operation_type),e!=null&&e.start_date&&a.append("start_date",e.start_date),e!=null&&e.end_date&&a.append("end_date",e.end_date),e!=null&&e.page&&a.append("page",e.page.toString());const s=a.toString();return i(`/v1/billing/credits/usage/${s?`?${s}`:""}`)}async function X(e,a){const s=new URLSearchParams;e&&s.append("start_date",e),a&&s.append("end_date",a);const r=s.toString();return i(`/v1/billing/credits/usage/summary/${r?`?${r}`:""}`)}async function st(){console.log("Fetching usage limits from:","/v1/billing/credits/usage/limits/");try{const e=await i("/v1/billing/credits/usage/limits/");return console.log("Usage limits API response:",e),e}catch(e){throw console.error("Error fetching usage limits:",e),e}}async function rt(e){const a=new URLSearchParams;e!=null&&e.transaction_type&&a.append("transaction_type",e.transaction_type),e!=null&&e.page&&a.append("page",e.page.toString());const s=a.toString();return i(`/v1/billing/credits/transactions/${s?`?${s}`:""}`)}async function nt(e){const a=new URLSearchParams;e!=null&&e.industry&&(a.append("industry",e.industry.toString()),a.append("industry_id",e.industry.toString())),e!=null&&e.sector&&(a.append("sector",e.sector.toString()),a.append("sector_id",e.sector.toString())),e!=null&&e.intent&&a.append("intent",e.intent),e!=null&&e.search&&a.append("search",e.search),e!=null&&e.page&&a.append("page",e.page.toString()),e!=null&&e.page_size&&a.append("page_size",e.page_size.toString());const s=a.toString();return i(`/v1/auth/seed-keywords/${s?`?${s}`:""}`)}async function ot(e,a,s){return i("/v1/planner/keywords/bulk_add_from_seed/",{method:"POST",body:JSON.stringify({seed_keyword_ids:e,site_id:a,sector_id:s})})}async function it(e){const s=new URLSearchParams().toString();return i(`/v1/system/author-profiles/${s?`?${s}`:""}`)}async function ct(e){return i("/v1/system/author-profiles/",{method:"POST",body:JSON.stringify(e)})}async function dt(e,a){return i(`/v1/system/author-profiles/${e}/`,{method:"PUT",body:JSON.stringify(a)})}async function lt(e){return i(`/v1/system/author-profiles/${e}/`,{method:"DELETE"})}async function Z(e={}){const a=new URLSearchParams;if(!e.site_id){const r=$();r&&(e.site_id=r)}if(e.sector_id===void 0){const r=P();r!=null&&(e.sector_id=r)}e.search&&a.append("search",e.search),e.status&&a.append("status",e.status),e.task_id&&a.append("task_id",e.task_id.toString()),e.site_id&&a.append("site_id",e.site_id.toString()),e.sector_id&&a.append("sector_id",e.sector_id.toString()),e.page&&a.append("page",e.page.toString()),e.page_size!==void 0&&e.page_size!==null&&a.append("page_size",e.page_size.toString()),e.ordering&&a.append("ordering",e.ordering);const s=a.toString();return i(`/v1/writer/content/${s?`?${s}`:""}`)}async function ut(e){return i(`/v1/writer/content/${e}/`)}const Ot=Object.freeze(Object.defineProperty({__proto__:null,API_BASE_URL:C,addSeedKeywordsToWorkflow:ot,autoClusterKeywords:_e,autoGenerateContent:ze,autoGenerateIdeas:ke,autoGenerateImages:Je,bulkDeleteClusters:Se,bulkDeleteContentIdeas:Te,bulkDeleteKeywords:xe,bulkDeleteTasks:Re,bulkQueueIdeasToWriter:$e,bulkUpdateClustersStatus:we,bulkUpdateContentIdeasStatus:Oe,bulkUpdateImagesStatus:Ue,bulkUpdateKeywordsStatus:ye,bulkUpdateTasksStatus:Ae,createAccountSetting:Qe,createAuthorProfile:ct,createCluster:be,createContentIdea:je,createKeyword:me,createModuleSetting:et,createSite:Be,createTask:Pe,deleteAuthorProfile:lt,deleteCluster:ve,deleteContentIdea:Ce,deleteKeyword:he,deleteSite:qe,deleteTask:Ee,fetchAPI:i,fetchAccountSetting:Ye,fetchAccountSettings:Ve,fetchAuthorProfiles:it,fetchClusters:K,fetchContent:Z,fetchContentById:ut,fetchContentIdeas:H,fetchContentImages:V,fetchCreditBalance:Q,fetchCreditTransactions:rt,fetchCreditUsage:at,fetchImageGenerationSettings:Fe,fetchImages:Me,fetchIndustries:We,fetchKeywords:q,fetchModuleSettings:Ze,fetchSeedKeywords:nt,fetchSiteSectors:Y,fetchSites:U,fetchTasks:W,fetchUsageLimits:st,fetchUsageSummary:X,generateImagePrompts:Le,generateImages:De,selectSectorsForSite:He,setActiveSite:Ke,updateAccountSetting:Xe,updateAuthorProfile:dt,updateCluster:fe,updateContentIdea:Ne,updateKeyword:pe,updateModuleSetting:tt,updateSite:Ge,updateTask:Ie},Symbol.toStringTag,{value:"Module"})),gt=D()(G((e,a)=>({activeSite:null,loading:!1,error:null,setActiveSite:s=>{if(e({activeSite:s,error:null}),typeof window<"u")try{const r=a();localStorage.setItem("site-storage",JSON.stringify({state:{activeSite:s},version:0}))}catch(r){console.warn("Failed to persist site to localStorage:",r)}window.dispatchEvent(new CustomEvent("siteChanged",{detail:{siteId:s==null?void 0:s.id}})),s&&typeof window<"u"&&de(async()=>{const{useSectorStore:r}=await Promise.resolve().then(()=>mt);return{useSectorStore:r}},void 0).then(({useSectorStore:r})=>{r.getState().loadSectorsForSite(s.id)}).catch(()=>{})},loadActiveSite:async()=>{e({loading:!0,error:null});try{const r=(await U()).results||[],n=r.filter(d=>d.is_active),l=a().activeSite;let c=null;if(l){const d=r.find(x=>x.id===l.id);d&&d.is_active?c=d:(d&&d.is_active,c=n.length>0?n[0]:null)}else n.length>0&&(c=n[0]);if(e({activeSite:c,loading:!1}),c&&typeof window<"u")try{localStorage.setItem("site-storage",JSON.stringify({state:{activeSite:c},version:0}))}catch(d){console.warn("Failed to persist site to localStorage:",d)}}catch(s){e({error:s.message||"Failed to load active site",loading:!1})}},refreshActiveSite:async()=>{const s=a().activeSite;if(!s){await a().loadActiveSite();return}e({loading:!0,error:null});try{const n=((await U()).results||[]).find(l=>l.id===s.id);n&&n.is_active?e({activeSite:n,loading:!1}):await a().loadActiveSite()}catch(r){e({error:r.message||"Failed to refresh active site",loading:!1})}}}),{name:"site-storage",partialize:e=>({activeSite:e.activeSite})})),ee=D()(G((e,a)=>({activeSector:null,sectors:[],loading:!1,error:null,setActiveSector:s=>{if(e({activeSector:s,error:null}),typeof window<"u")try{const r=a();localStorage.setItem("sector-storage",JSON.stringify({state:{activeSector:s},version:0}))}catch(r){console.warn("Failed to persist sector to localStorage:",r)}window.dispatchEvent(new CustomEvent("sectorChanged",{detail:{sectorId:s==null?void 0:s.id,siteId:s==null?void 0:s.site_id}}))},loadSectorsForSite:async s=>{e({loading:!0,error:null});try{if(!s)return e({sectors:[],loading:!1}),[];const n=(await Y(s)).map(c=>({id:c.id,name:c.name,slug:c.slug,site_id:s,is_active:c.is_active!==!1,industry_sector:c.industry_sector||null}));e({sectors:n,loading:!1});const l=a().activeSector;if(l&&l.site_id!==s){if(e({activeSector:null}),typeof window<"u")try{localStorage.setItem("sector-storage",JSON.stringify({state:{activeSector:null},version:0}))}catch(c){console.warn("Failed to persist sector to localStorage:",c)}window.dispatchEvent(new CustomEvent("sectorChanged",{detail:{sectorId:null,siteId:s}}))}else if(l&&l.site_id===s&&!n.find(d=>d.id===l.id)){if(e({activeSector:null}),typeof window<"u")try{localStorage.setItem("sector-storage",JSON.stringify({state:{activeSector:null},version:0}))}catch(d){console.warn("Failed to persist sector to localStorage:",d)}window.dispatchEvent(new CustomEvent("sectorChanged",{detail:{sectorId:null,siteId:s}}))}return n}catch(r){return r.status===403||r.status===404?(console.warn(`Cannot load sectors for site ${s}: site may be inactive or inaccessible`),e({sectors:[],activeSector:null,loading:!1,error:null}),[]):(e({error:r.message||"Failed to load sectors",loading:!1}),[])}},clearActiveSector:()=>{if(e({activeSector:null,sectors:[],error:null}),typeof window<"u")try{localStorage.setItem("sector-storage",JSON.stringify({state:{activeSector:null},version:0}))}catch(s){console.warn("Failed to persist sector to localStorage:",s)}}}),{name:"sector-storage",partialize:e=>({activeSector:e.activeSector})})),mt=Object.freeze(Object.defineProperty({__proto__:null,useSectorStore:ee},Symbol.toStringTag,{value:"Module"}));function pt({id:e,variant:a,title:s,message:r,onClose:n}){m.useEffect(()=>{const d=setTimeout(()=>{n(e)},5e3);return()=>clearTimeout(d)},[e,n]);const c={success:{container:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-800 dark:text-white shadow-lg",icon:t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"w-5 h-5 text-success-500",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})},error:{container:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-800 dark:text-white shadow-lg",icon:t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"w-5 h-5 text-error-500",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})})},warning:{container:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-800 dark:text-white shadow-lg",icon:t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"w-5 h-5 text-warning-500",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})})},info:{container:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-800 dark:text-white shadow-lg",icon:t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"w-5 h-5 text-blue-light-500",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})})}}[a];return t.jsxs("div",{className:`flex items-start gap-3 p-4 rounded-lg shadow-sm min-w-[320px] max-w-[420px] animate-slide-in-right ${c.container}`,children:[c.icon,t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h4",{className:"text-sm font-semibold mb-0.5",children:s}),r&&t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:r})]}),t.jsx("button",{onClick:()=>n(e),className:"flex-shrink-0 ml-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Close",children:t.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})}const te=m.createContext(void 0);let ht=0;function $t({children:e}){const[a,s]=m.useState([]),r=m.useCallback((y,b,o)=>{const u=`toast-${++ht}`,p={id:u,variant:y,title:b,message:o};return s(S=>[...S,p]),u},[]),n=m.useCallback(y=>{s(b=>b.filter(o=>o.id!==y))},[]),l=m.useCallback((y,b)=>r("success",y,b),[r]),c=m.useCallback((y,b)=>r("error",y,b),[r]),d=m.useCallback((y,b)=>r("warning",y,b),[r]),x=m.useCallback((y,b)=>r("info",y,b),[r]);return t.jsxs(te.Provider,{value:{success:l,error:c,warning:d,info:x},children:[e,t.jsx(yt,{toasts:a,onClose:n})]})}function xt(){const e=m.useContext(te);if(e===void 0)throw new Error("useToast must be used within a ToastProvider");return e}function yt({toasts:e,onClose:a}){return e.length===0?null:se.createPortal(t.jsx("div",{className:"fixed top-6 right-4 z-[999999] flex flex-col gap-3 pointer-events-none",children:e.map((s,r)=>t.jsx("div",{className:"pointer-events-auto",style:{animationDelay:`${r*50}ms`},children:t.jsx(pt,{...s,onClose:a})},s.id))}),document.body)}const ae=D((e,a)=>({balance:null,usageSummary:null,loading:!1,error:null,loadBalance:async()=>{e({loading:!0,error:null});try{const s=await Q();e({balance:s,loading:!1})}catch(s){e({error:s.message,loading:!1})}},loadUsageSummary:async(s,r)=>{e({loading:!0,error:null});try{const n=await X(s,r);e({usageSummary:n,loading:!1})}catch(n){e({error:n.message,loading:!1})}},reset:()=>{e({balance:null,usageSummary:null,loading:!1,error:null})}})),A=({title:e,children:a,className:s="",desc:r=""})=>t.jsxs("div",{className:`rounded-2xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-white/[0.03] overflow-visible ${s}`,children:[t.jsxs("div",{className:"px-6 py-5 relative z-0",children:[t.jsx("h3",{className:"text-base font-medium text-gray-800 dark:text-white/90",children:e}),r&&t.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:r})]}),t.jsx("div",{className:"p-4 border-t border-gray-100 dark:border-gray-800 sm:p-6 overflow-visible",children:t.jsx("div",{className:"space-y-6",children:a})})]});function bt(){const{balance:e,loading:a,loadBalance:s}=ae();if(m.useEffect(()=>{s()},[s]),a&&!e)return t.jsx(A,{title:"Credit Balance",desc:"Loading...",children:t.jsx("div",{className:"animate-pulse",children:"Loading credit balance..."})});if(!e)return null;const r=e.plan_credits_per_month>0?e.credits_used_this_month/e.plan_credits_per_month*100:0;return t.jsx(A,{title:"Credit Balance",desc:"Current credit status and usage",children:t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{children:t.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Current Credits"}),t.jsx("span",{className:"text-2xl font-bold text-primary",children:e.credits})]})}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Used This Month"}),t.jsxs("span",{className:"text-sm font-medium",children:[e.credits_used_this_month," / ",e.plan_credits_per_month]})]}),t.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700",children:t.jsx("div",{className:"bg-primary h-2.5 rounded-full transition-all",style:{width:`${Math.min(r,100)}%`}})})]}),t.jsx("div",{className:"pt-2 border-t border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Remaining"}),t.jsx("span",{className:"text-sm font-medium text-success",children:e.credits_remaining})]})})]})})}function ft(){const{usageSummary:e,loading:a,loadUsageSummary:s}=ae(),[r,n]=m.useState("month");return m.useEffect(()=>{const l=new Date;let c;r==="week"?c=new Date(l.getTime()-6048e5).toISOString().split("T")[0]:r==="month"?c=new Date(l.getFullYear(),l.getMonth(),1).toISOString().split("T")[0]:c=new Date(l.getFullYear(),0,1).toISOString().split("T")[0];const d=l.toISOString().split("T")[0];s(c,d)},[r,s]),a&&!e?t.jsx(A,{title:"Usage Summary",desc:"Loading...",children:t.jsx("div",{className:"animate-pulse",children:"Loading usage data..."})}):e?t.jsx(A,{title:"Usage Summary",desc:"Credit usage breakdown by operation and model",children:t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"flex justify-end items-center mb-4",children:t.jsxs("select",{className:"h-9 rounded-lg border border-gray-300 bg-transparent px-3 py-2 text-sm shadow-theme-xs text-gray-800 focus:border-brand-300 focus:outline-hidden focus:ring-3 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90 dark:focus:border-brand-800",value:r,onChange:l=>n(l.target.value),children:[t.jsx("option",{value:"week",children:"Last 7 Days"}),t.jsx("option",{value:"month",children:"This Month"}),t.jsx("option",{value:"year",children:"This Year"})]})}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Total Credits Used"}),t.jsx("div",{className:"text-2xl font-bold",children:e.total_credits_used})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Total Cost"}),t.jsxs("div",{className:"text-2xl font-bold",children:["$",(Number(e.total_cost_usd)||0).toFixed(2)]})]})]}),t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-semibold mb-2",children:"By Operation"}),t.jsxs("div",{className:"space-y-2",children:[Object.entries(e.by_operation).map(([l,c])=>t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"capitalize",children:l.replace("_"," ")}),t.jsxs("span",{className:"font-medium",children:[c.credits," credits ($",(Number(c.cost)||0).toFixed(2),")"]})]},l)),Object.keys(e.by_operation).length===0&&t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No usage data available"})]})]})]})}):null}const vt=({children:e,content:a,placement:s="top",className:r="",delay:n=200})=>{const[l,c]=m.useState(!1),[d,x]=m.useState({top:0,left:0}),y=m.useRef(null),b=m.useRef(null),o=m.useRef(),u={top:"bottom-full left-1/2 mb-2 -translate-x-1/2 before:top-full before:left-1/2 before:-translate-x-1/2 before:-mt-1 before:border-t-gray-900",bottom:"top-full left-1/2 mt-2 -translate-x-1/2 before:bottom-full before:left-1/2 before:-translate-x-1/2 before:-mb-1 before:border-b-gray-900",left:"right-full top-1/2 mr-2 -translate-y-1/2 before:left-full before:top-1/2 before:-translate-y-1/2 before:-ml-1 before:border-l-gray-900",right:"left-full top-1/2 ml-2 -translate-y-1/2 before:right-full before:top-1/2 before:-translate-y-1/2 before:-mr-1 before:border-r-gray-900"},p=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{c(!0)},n)},S=()=>{o.current&&clearTimeout(o.current),c(!1)};return m.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]),t.jsxs("div",{ref:b,className:`relative inline-flex ${r}`,style:{zIndex:1},onMouseEnter:p,onMouseLeave:S,children:[e,l&&t.jsx("div",{ref:y,className:`
absolute z-[99999] px-3 py-2 text-xs font-medium text-white bg-gray-900 rounded-lg
opacity-100 pointer-events-none transition-opacity duration-200
whitespace-normal max-w-xs shadow-lg
before:absolute before:border-4 before:border-transparent before:content-['']
${u[s]}
`,style:{zIndex:99999},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:typeof a=="string"?t.jsx("span",{children:a}):t.jsx("div",{className:"text-white",children:a})})]})},St={blue:{bg:"bg-blue-50 dark:bg-blue-500/10",hover:"hover:bg-blue-100 dark:hover:bg-blue-500/20",border:"bg-brand-500",icon:"text-brand-500"},green:{bg:"bg-green-50 dark:bg-green-500/10",hover:"hover:bg-green-100 dark:hover:bg-green-500/20",border:"bg-success-500",icon:"text-success-500"},orange:{bg:"bg-amber-50 dark:bg-amber-500/10",hover:"hover:bg-amber-100 dark:hover:bg-amber-500/20",border:"bg-warning-500",icon:"text-warning-500"},purple:{bg:"bg-purple-50 dark:bg-purple-500/10",hover:"hover:bg-purple-100 dark:hover:bg-purple-500/20",border:"bg-purple-500",icon:"text-purple-500"},red:{bg:"bg-red-50 dark:bg-red-500/10",hover:"hover:bg-red-100 dark:hover:bg-red-500/20",border:"bg-error-500",icon:"text-error-500"},success:{bg:"bg-green-50 dark:bg-green-500/10",hover:"hover:bg-green-100 dark:hover:bg-green-500/20",border:"bg-success-500",icon:"text-success-500"}};function R({title:e,value:a,subtitle:s,trend:r,icon:n,accentColor:l,href:c,onClick:d,tooltip:x,details:y,className:b=""}){const[o,u]=m.useState(!1),p=St[l],S=g=>typeof g=="number"?g.toLocaleString():g,k=x||(y?t.jsx("div",{className:"space-y-1",children:y.map((g,f)=>t.jsxs("div",{className:"flex justify-between gap-4 text-xs",children:[t.jsxs("span",{className:"text-gray-300",children:[g.label,":"]}),t.jsx("span",{className:"font-medium text-white",children:g.value})]},f))}):null),v=t.jsxs("div",{className:`
rounded-2xl border border-gray-200 bg-white p-5
dark:border-gray-800 dark:bg-white/[0.03] md:p-6
hover:shadow-lg transition-all cursor-pointer group
relative overflow-hidden
${b}
`,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onClick:d,children:[t.jsx("div",{className:`absolute left-0 top-0 bottom-0 w-1 ${p.border}`}),t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:e}),t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx("h4",{className:"font-bold text-gray-800 text-title-sm dark:text-white/90",children:S(a)}),r!==void 0&&r!==0&&t.jsxs("div",{className:`flex items-center gap-1 text-xs ${r>0?"text-success-500":"text-error-500"}`,children:[r>0?t.jsx(re,{className:"size-3"}):t.jsx(ne,{className:"size-3"}),t.jsx("span",{children:Math.abs(r)})]})]}),s&&t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:s})]}),t.jsx("div",{className:`flex items-center justify-center w-12 h-12 rounded-xl ${p.bg} ${p.hover} transition-colors flex-shrink-0`,children:F.cloneElement(n,{className:`${p.icon} size-6`})})]}),o&&k&&t.jsx("div",{className:"absolute inset-0 bg-black/5 dark:bg-white/5 rounded-2xl"})]});if(k){const g=c?t.jsx(T,{to:c,className:"block",children:v}):v;return t.jsx(vt,{content:k,placement:"top",children:g})}return c?t.jsx(T,{to:c,children:v}):v}const M=[{id:1,title:"Discover Keywords",description:"Find high-volume keywords from our global database",icon:t.jsx(J,{}),color:"blue",path:"/planner/keyword-opportunities"},{id:2,title:"Cluster Keywords",description:"Group related keywords into strategic clusters",icon:t.jsx(ce,{}),color:"purple",path:"/planner/clusters"},{id:3,title:"Generate Ideas",description:"AI creates content ideas from keyword clusters",icon:t.jsx(B,{}),color:"orange",path:"/planner/ideas"},{id:4,title:"Create Tasks",description:"Convert ideas into actionable writing tasks",icon:t.jsx(L,{}),color:"indigo",path:"/writer/tasks"},{id:5,title:"Write Content",description:"AI generates full content pieces automatically",icon:t.jsx(O,{}),color:"green",path:"/writer/content"},{id:6,title:"Generate Images",description:"Create featured and in-article images",icon:t.jsx(O,{}),color:"pink",path:"/writer/images"},{id:7,title:"Publish",description:"Content ready for publication",icon:t.jsx(L,{}),color:"success",path:"/writer/published"}];function wt(){const e=xt(),{activeSite:a}=gt(),{activeSector:s}=ee(),[r,n]=m.useState(null),[l,c]=m.useState(!0),[d,x]=m.useState({keywords:{enabled:!1,keywordsPerCycle:50,autoCluster:!0,maxKeywordsPerCluster:10},ideas:{enabled:!1,autoGenerate:!0,ideasPerCluster:3},content:{enabled:!1,autoCreateTasks:!0,autoGenerateContent:!1},images:{enabled:!1,autoGenerate:!1}}),y=async()=>{try{c(!0);const[o,u,p,S,k,v]=await Promise.all([q({page_size:1,site_id:void 0}),K({page_size:1,site_id:void 0}),H({page_size:1,site_id:void 0}),W({page_size:1,site_id:void 0}),Z({page_size:1,site_id:void 0}),V({page_size:1,site_id:void 0})]),g=o.count||0,f=u.count||0,h=p.count||0,j=S.count||0,w=k.count||0,_=v.count||0,N=0,E=g>0?Math.round(N/g*100):0;n({totalKeywords:g,totalClusters:f,totalIdeas:h,totalTasks:j,totalContent:w,totalImages:_,publishedContent:N,workflowCompletionRate:E})}catch(o){console.error("Error fetching insights:",o),e.error(`Failed to load insights: ${o.message}`)}finally{c(!1)}};m.useEffect(()=>{y()},[a,s]);const b={blue:"bg-blue-100 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400",purple:"bg-purple-100 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400",orange:"bg-orange-100 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400",indigo:"bg-indigo-100 dark:bg-indigo-900/20 text-indigo-600 dark:text-indigo-400",green:"bg-green-100 dark:bg-green-900/20 text-green-600 dark:text-green-400",pink:"bg-pink-100 dark:bg-pink-900/20 text-pink-600 dark:text-pink-400",success:"bg-green-100 dark:bg-green-900/20 text-green-600 dark:text-green-400"};return t.jsxs(t.Fragment,{children:[t.jsx(oe,{title:"Dashboard - IGNY8",description:"IGNY8 AI-Powered Content Creation Dashboard"}),t.jsx("div",{className:"mb-8",children:t.jsxs("div",{className:"bg-gradient-to-r from-brand-500 to-purple-600 rounded-2xl p-8 md:p-12 text-white relative overflow-hidden",children:[t.jsx("div",{className:"absolute inset-0 bg-grid-white/10 [mask-image:linear-gradient(0deg,white,transparent)]"}),t.jsxs("div",{className:"relative z-10",children:[t.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4",children:"AI-Powered Content Creation Workflow"}),t.jsx("p",{className:"text-xl text-white/90 mb-6 max-w-2xl",children:"Transform keywords into published content with intelligent automation. From discovery to publication, IGNY8 streamlines your entire content creation process."}),t.jsxs("div",{className:"flex flex-wrap gap-4",children:[t.jsxs(T,{to:"/planner/keyword-opportunities",className:"px-6 py-3 bg-white text-brand-600 rounded-lg font-semibold hover:bg-gray-100 transition-colors inline-flex items-center gap-2",children:["Get Started",t.jsx(z,{className:"size-5"})]}),t.jsxs(T,{to:"/schedules",className:"px-6 py-3 bg-white/10 text-white rounded-lg font-semibold hover:bg-white/20 transition-colors inline-flex items-center gap-2 border border-white/20",children:["Configure Automation",t.jsx(ie,{className:"size-5"})]})]})]})]})}),t.jsxs("div",{className:"mb-8",children:[t.jsxs("div",{className:"flex items-center justify-between mb-6",children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Account-Wide Insights"}),t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:"All sites aggregated"})]}),l?t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[1,2,3,4].map(o=>t.jsx("div",{className:"h-32 bg-gray-200 dark:bg-gray-700 rounded-lg animate-pulse"},o))}):r?t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsx(R,{title:"Total Keywords",value:r.totalKeywords.toLocaleString(),icon:t.jsx(J,{}),accentColor:"blue",href:"/planner/keywords"}),t.jsx(R,{title:"Content Pieces",value:r.totalContent.toLocaleString(),icon:t.jsx(O,{}),accentColor:"green",href:"/writer/content"}),t.jsx(R,{title:"Images Generated",value:r.totalImages.toLocaleString(),icon:t.jsx(O,{}),accentColor:"purple",href:"/writer/images"}),t.jsx(R,{title:"Workflow Completion",value:`${r.workflowCompletionRate}%`,icon:t.jsx(L,{}),accentColor:"success"})]}):null]}),t.jsxs("div",{className:"mb-8",children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-6",children:"How It Works"}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 xl:grid-cols-7 gap-4",children:M.map((o,u)=>t.jsx(T,{to:o.path,className:"group",children:t.jsx(I,{className:"p-6 hover:shadow-lg transition-all duration-200 border-2 hover:border-brand-500 dark:hover:border-brand-400 h-full",children:t.jsxs("div",{className:"flex flex-col items-center text-center",children:[t.jsx("div",{className:`w-16 h-16 rounded-xl ${b[o.color]} flex items-center justify-center mb-4 group-hover:scale-110 transition-transform`,children:t.jsx("div",{className:"w-8 h-8 flex items-center justify-center flex-shrink-0",children:F.cloneElement(o.icon,{className:"w-8 h-8 flex-shrink-0"})})}),t.jsxs("div",{className:"text-sm font-semibold text-gray-500 dark:text-gray-400 mb-1",children:["Step ",o.id]}),t.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white mb-2",children:o.title}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:o.description}),u<M.length-1&&t.jsx("div",{className:"hidden xl:block absolute top-1/2 -right-2 transform -translate-y-1/2 translate-x-full",children:t.jsx(z,{className:"size-6 text-gray-400"})})]})})},o.id))})]}),t.jsxs("div",{className:"mb-8",children:[t.jsxs("div",{className:"flex items-center justify-between mb-6",children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Automation Setup"}),t.jsxs(T,{to:"/schedules",className:"text-brand-600 dark:text-brand-400 hover:text-brand-700 dark:hover:text-brand-300 font-medium inline-flex items-center gap-2",children:["Advanced Settings",t.jsx(z,{className:"size-4"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs(I,{className:"p-6",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-100 dark:bg-blue-900/20 flex items-center justify-center",children:t.jsx(J,{className:"size-5 text-blue-600 dark:text-blue-400"})}),t.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white",children:"Keywords Automation"})]}),t.jsx("button",{onClick:()=>x(o=>({...o,keywords:{...o.keywords,enabled:!o.keywords.enabled}})),className:`w-12 h-6 rounded-full transition-colors ${d.keywords.enabled?"bg-brand-500":"bg-gray-300 dark:bg-gray-600"}`,children:t.jsx("div",{className:`w-5 h-5 bg-white rounded-full transition-transform ${d.keywords.enabled?"translate-x-6":"translate-x-0.5"}`})})]}),d.keywords.enabled&&t.jsxs("div",{className:"space-y-3 mt-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Keywords per cycle"}),t.jsx("input",{type:"number",value:d.keywords.keywordsPerCycle,onChange:o=>x(u=>({...u,keywords:{...u.keywords,keywordsPerCycle:parseInt(o.target.value)||0}})),className:"mt-1 w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",checked:d.keywords.autoCluster,onChange:o=>x(u=>({...u,keywords:{...u.keywords,autoCluster:o.target.checked}})),className:"rounded"}),t.jsx("label",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Auto-cluster keywords"})]})]})]}),t.jsxs(I,{className:"p-6",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-lg bg-orange-100 dark:bg-orange-900/20 flex items-center justify-center",children:t.jsx(B,{className:"size-5 text-orange-600 dark:text-orange-400"})}),t.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white",children:"Ideas Automation"})]}),t.jsx("button",{onClick:()=>x(o=>({...o,ideas:{...o.ideas,enabled:!o.ideas.enabled}})),className:`w-12 h-6 rounded-full transition-colors ${d.ideas.enabled?"bg-brand-500":"bg-gray-300 dark:bg-gray-600"}`,children:t.jsx("div",{className:`w-5 h-5 bg-white rounded-full transition-transform ${d.ideas.enabled?"translate-x-6":"translate-x-0.5"}`})})]}),d.ideas.enabled&&t.jsx("div",{className:"space-y-3 mt-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",checked:d.ideas.autoGenerate,onChange:o=>x(u=>({...u,ideas:{...u.ideas,autoGenerate:o.target.checked}})),className:"rounded"}),t.jsx("label",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Auto-generate ideas from clusters"})]})})]}),t.jsxs(I,{className:"p-6",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-lg bg-green-100 dark:bg-green-900/20 flex items-center justify-center",children:t.jsx(O,{className:"size-5 text-green-600 dark:text-green-400"})}),t.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white",children:"Content Automation"})]}),t.jsx("button",{onClick:()=>x(o=>({...o,content:{...o.content,enabled:!o.content.enabled}})),className:`w-12 h-6 rounded-full transition-colors ${d.content.enabled?"bg-brand-500":"bg-gray-300 dark:bg-gray-600"}`,children:t.jsx("div",{className:`w-5 h-5 bg-white rounded-full transition-transform ${d.content.enabled?"translate-x-6":"translate-x-0.5"}`})})]}),d.content.enabled&&t.jsxs("div",{className:"space-y-3 mt-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",checked:d.content.autoCreateTasks,onChange:o=>x(u=>({...u,content:{...u.content,autoCreateTasks:o.target.checked}})),className:"rounded"}),t.jsx("label",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Auto-create tasks from ideas"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",checked:d.content.autoGenerateContent,onChange:o=>x(u=>({...u,content:{...u.content,autoGenerateContent:o.target.checked}})),className:"rounded"}),t.jsx("label",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Auto-generate content from tasks"})]})]})]}),t.jsxs(I,{className:"p-6",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-900/20 flex items-center justify-center",children:t.jsx(O,{className:"size-5 text-purple-600 dark:text-purple-400"})}),t.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white",children:"Images Automation"})]}),t.jsx("button",{onClick:()=>x(o=>({...o,images:{...o.images,enabled:!o.images.enabled}})),className:`w-12 h-6 rounded-full transition-colors ${d.images.enabled?"bg-brand-500":"bg-gray-300 dark:bg-gray-600"}`,children:t.jsx("div",{className:`w-5 h-5 bg-white rounded-full transition-transform ${d.images.enabled?"translate-x-6":"translate-x-0.5"}`})})]}),d.images.enabled&&t.jsx("div",{className:"space-y-3 mt-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",checked:d.images.autoGenerate,onChange:o=>x(u=>({...u,images:{...u.images,autoGenerate:o.target.checked}})),className:"rounded"}),t.jsx("label",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Auto-generate images for content"})]})})]})]})]}),t.jsxs("div",{className:"grid grid-cols-12 gap-4 md:gap-6",children:[t.jsx("div",{className:"col-span-12 xl:col-span-4",children:t.jsx(bt,{})}),t.jsx("div",{className:"col-span-12 xl:col-span-8",children:t.jsx(ft,{})})]})]})}const Pt=Object.freeze(Object.defineProperty({__proto__:null,default:wt},Symbol.toStringTag,{value:"Module"}));export{lt as $,C as A,fe as B,A as C,be as D,R as E,Oe as F,$e as G,Te as H,Ce as I,Ne as J,je as K,ot as L,tt as M,et as N,Ze as O,Xe as P,Qe as Q,Ye as R,Ve as S,Ge as T,Y as U,Be as V,He as W,qe as X,it as Y,dt as Z,ct as _,gt as a,Z as a0,Me as a1,Ae as a2,ze as a3,Je as a4,Re as a5,Ee as a6,Ie as a7,Pe as a8,Le as a9,ut as aa,V as ab,Ue as ac,Fe as ad,De as ae,$t as af,Ot as ag,Pt as ah,ee as b,We as c,nt as d,Q as e,U as f,rt as g,at as h,st as i,q as j,K as k,H as l,W as m,i as n,_e as o,ye as p,xe as q,he as r,Ke as s,pe as t,xt as u,me as v,we as w,ke as x,Se as y,ve as z};