PageSourceSearch

https://ai-hack.ai/assets/space-DQClOdYO.js

js ai-hack.ai collected 2026-10-05 09:45:03 UTC 30,099 bytes, 9 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ServiceRegistrationForm-BPit3K2D.js","assets/ui-radix-DPMeRn1_.js","assets/CompetitorManagement-CApVgaxQ.js","assets/index-BnzzcT0K.js","assets/data-libs-B_9aym9D.js","assets/viz-CbaSADkO.js","assets/firebase-gTDNiNqJ.js","assets/i18n-MoUkp2P5.js","assets/react-vendor-CQ6YG5up.js","assets/sentry-y-Wrhyr9.js","assets/index-BHlr-Txq.css","assets/input-zbgqkESq.js","assets/csv-export-utils-PO1FP5_J.js","assets/table-DypA5-G-.js","assets/alert-dialog-6Ad9VUXl.js","assets/dialog-BOz7qFja.js","assets/checkbox-Bu6erH5d.js","assets/check-BtFNjYFE.js","assets/circle-alert-CSH7hYs9.js","assets/download-BnQC0QO4.js","assets/loader-circle-C447_Yo_.js","assets/plus-B27EmejD.js","assets/trash-2-qZEpmoUs.js","assets/label-BwBWDdQn.js","assets/tabs-B9wdyIcP.js","assets/OwnedServiceFields-Cxh2HyLl.js","assets/select-DXACSwun.js","assets/chevron-down-C4A_SvZU.js","assets/searchAreas-CazgAeiP.js","assets/circle-check-big-poWXYflX.js","assets/save-CB7hd1gJ.js"])))=>i.map(i=>d[i]);
2try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="a91f3235-9686-4fd8-b281-a78d941c405d",e._sentryDebugIdIdentifier="sentry-dbid-a91f3235-9686-4fd8-b281-a78d941c405d")}catch(le){}import{h as e,i as s,j as a,k as t,m as r,n as i,l as n,C as l,B as c,U as d,S as o,X as m,o as x,p as h,P as p,q as u,t as g,v,_ as y,w as f,x as b,y as j}from"./index-BnzzcT0K.js";import{j as N,r as w,R as P}from"./ui-radix-DPMeRn1_.js";import{I as S}from"./input-zbgqkESq.js";import{C}from"./checkbox-Bu6erH5d.js";import{T as k,a as A,b as L,c as D,d as I,e as E}from"./table-DypA5-G-.js";import{u as F}from"./data-libs-B_9aym9D.js";import{D as $}from"./searchAreas-CazgAeiP.js";import{u as M}from"./i18n-MoUkp2P5.js";import{A as _}from"./activity-zL4zItlQ.js";import{A as U,a as T,b as z,c as R,d as q,e as O,f as V,g as J}from"./alert-dialog-6Ad9VUXl.js";import{P as B}from"./plus-B27EmejD.js";import{C as H}from"./check-BtFNjYFE.js";import{T as W}from"./trash-2-qZEpmoUs.js";import{b as K,u as Q,a as Y,L as G}from"./react-vendor-CQ6YG5up.js";import"./viz-CbaSADkO.js";import"./firebase-gTDNiNqJ.js";import"./sentry-y-Wrhyr9.js";
3/**
4 * @license lucide-react v0.475.0 - ISC
5 *
6 * This source code is licensed under the ISC license.
7 * See the LICENSE file in the root directory of this source tree.
8 */const X=e("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),Z=e("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),ee=e("ChartNoAxesColumn",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]),se=e("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);function ae({spaceId:e,className:s}){const{t:r}=M(),{data:i,isLoading:n}=a(e,"ANALYSIS"),l=()=>{if(!(null==i?void 0:i.isLimitActive)||!(null==i?void 0:i.monthlyLimit))return"text-primary-text";const e=(i.remainingCalls||0)/i.monthlyLimit*100;return e<=0?"text-red-600":e<=20?"text-orange-600":"text-primary-text"},c=()=>{if(!(null==i?void 0:i.isLimitActive)||!(null==i?void 0:i.monthlyLimit))return"bg-primary";const e=(i.remainingCalls||0)/i.monthlyLimit*100;return e<=0?"bg-red-500":e<=20?"bg-orange-500":e<=40?"bg-yellow-500":"bg-primary"};return N.jsxs("div",{className:t("p-6 rounded-xl relative overflow-hidden group",s),children:[N.jsx("div",{className:"absolute -right-6 -bottom-6 opacity-5 text-primary-text transform group-hover:translate-x-1 group-hover:translate-y-1 transition-transform duration-300",children:N.jsx(_,{className:"w-28 h-28"})}),N.jsxs("div",{className:"relative",children:[N.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[N.jsx("div",{className:"p-1.5 rounded-md bg-primary/[0.0314] group-hover:bg-primary/[0.0824] transition-colors duration-300",children:N.jsx(_,{className:"w-4 h-4 text-primary-text"})}),N.jsx("span",{className:"text-sm md:text-base 3xl:text-lg font-medium text-primary-text",children:r("sidebar.usage.analysis.label","This month's analysis status")})]}),(()=>{if(n)return N.jsxs("div",{className:"space-y-3",children:[N.jsx("div",{className:"h-4 bg-gray-200 rounded animate-pulse"}),N.jsx("div",{className:"h-2 bg-gray-200 rounded animate-pulse"}),N.jsx("div",{className:"h-3 bg-gray-200 rounded animate-pulse w-2/3"})]});if(!i)return N.jsxs("div",{className:"space-y-2",children:[N.jsx("span",{className:t("text-3xl md:text-4xl 3xl:text-5xl font-bold",l()),children:"-"}),N.jsx("div",{className:"text-xs text-gray-500",children:r("sidebar.usage.noData","No data available")})]});const e=!i.isLimitActive||!i.monthlyLimit;return N.jsxs("div",{className:"space-y-3",children:[N.jsxs("div",{className:"flex items-baseline gap-2",children:[N.jsx("span",{className:t("text-3xl md:text-4xl 3xl:text-5xl font-bold",l()),children:e?i.currentMonthlyUsage||0:i.remainingCalls||0}),!e&&N.jsxs("span",{className:"text-sm md:text-base 3xl:text-lg font-medium text-gray-500",children:["/ ",i.monthlyLimit]})]}),e?N.jsx("div",{className:"text-xs text-gray-500",children:r("sidebar.usage.noLimit","No limit configured")}):N.jsxs(N.Fragment,{children:[N.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2 overflow-hidden",children:N.jsx("div",{className:t(c(),"h-2 rounded-full transition-all duration-300"),style:{width:`${(null==i?void 0:i.isLimitActive)&&(null==i?void 0:i.monthlyLimit)?Math.min((i.remainingCalls||0)/i.monthlyLimit*100,100):0}%`}})}),N.jsxs("div",{className:"flex justify-between text-xs text-gray-500",children:[N.jsxs("span",{children:[r("sidebar.usage.used"),": ",i.currentMonthlyUsage||0]}),N.jsxs("span",{children:[r("sidebar.usage.remaining"),": ",i.remainingCalls||0]})]}),null!==i.remainingCalls&&i.monthlyLimit&&N.jsxs(N.Fragment,{children:[i.remainingCalls/i.monthlyLimit*100<=20&&i.remainingCalls/i.monthlyLimit*100>0&&N.jsx("div",{className:"text-xs text-orange-600 font-medium",children:r("sidebar.usage.warning","Running low on remaining calls")}),i.remainingCalls<=0&&N.jsx("div",{className:"text-xs text-red-600 font-medium",children:r("sidebar.usage.depleted","Usage limit reached")})]})]})]})})()]})]})}function te(e){var s;if(function(e){return e instanceof Error&&"status"in e}(e)&&"number"==typeof e.status)return e.status;const a=null==(s=null==e?void 0:e.response)?void 0:s.status;return"number"==typeof a?a:void 0}const re=w.lazy(async()=>({default:(await y(()=>import("./ServiceRegistrationForm-BPit3K2D.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]))).ServiceRegistrationForm}));function ie({icon:e,label:s,value:a,trend:r,trendColor:i,status:n,statusColor:l,valueColor:c,className:d}){return N.jsxs("div",{className:t("p-6 rounded-xl relative overflow-hidden group",d),children:[N.jsx("div",{className:"absolute -right-6 -bottom-6 opacity-5 text-primary-text transform group-hover:translate-x-1 group-hover:translate-y-1 transition-transform duration-300",children:e&&P.cloneElement(e,{className:"w-28 h-28"})}),N.jsxs("div",{className:"relative",children:[N.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[N.jsx("div",{className:"p-1.5 rounded-md bg-primary/[0.0314] group-hover:bg-primary/[0.0824] transition-colors duration-300",children:e&&P.cloneElement(e,{className:"w-4 h-4"})}),N.jsx("span",{className:"text-sm md:text-base 3xl:text-lg font-medium text-primary-text",children:s})]}),N.jsxs("div",{className:"flex items-baseline gap-2",children:[N.jsx("span",{className:t("text-3xl md:text-4xl 3xl:text-5xl font-bold text-[#333333]",c),children:a}),r&&N.jsxs("span",{className:t("text-sm md:text-base 3xl:text-lg font-medium flex items-center",i),children:[N.jsx("span",{className:"mr-1",children:"▲"})," ",r]})]}
8),n&&N.jsxs("div",{className:t("text-xs font-medium mt-2 flex items-center",l),children:[N.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary mr-1.5 animate-pulse"}),n]})]})]})}function ne(){const{space_id:e}=K(),{t:a}=M(),y=Q(),P=Y(),{toast:ne}=r(),[le,ce]=w.useState(null),[de,oe]=w.useState([]),[me,xe]=w.useState(!0),[he,pe]=w.useState(!1),[ue,ge]=w.useState(null),[ve,ye]=w.useState(""),[fe,be]=w.useState(""),[je,Ne]=w.useState(1),[we,Pe]=w.useState(0),[Se,Ce]=w.useState(!1),{statistics:ke,isLoading:Ae,error:Le}=function(e){const{data:a,isLoading:t,error:r,refetch:i}=F({queryKey:["space-statistics",e],queryFn:async()=>e?await s(e):null,enabled:!!e});return{statistics:a||null,isLoading:t,error:r,refetch:async()=>e&&(await i()).data||null}}(e),[De,Ie]=w.useState(!1),[Ee,Fe]=w.useState([]),[$e,Me]=w.useState(!1),[_e,Ue]=w.useState(!1),[Te,ze]=w.useState(!1),[Re,qe]=w.useState("createdAt"),[Oe,Ve]=w.useState("desc"),[Je,Be]=w.useState(!1),He=w.useCallback(async()=>{var s,t;if(e)try{xe(!0),ge(null);const a=await i(e,{page:je,limit:10,sortField:Re,sortOrder:Oe,searchQuery:fe||void 0});if(n.debug("services API response:",a),n.info("[space.tsx] Received services from API",{spaceId:e,totalServices:a.total,currentPage:a.page,pageLimit:a.limit,hasMore:a.hasMore,servicesWithEmptyNames:(null==(s=a.services)?void 0:s.filter(e=>!e.serviceName||""===e.serviceName.trim()).length)||0,servicesDetail:(null==(t=a.services)?void 0:t.map(e=>{var s;return{id:e.id,serviceName:e.serviceName,serviceNameLength:(null==(s=e.serviceName)?void 0:s.length)||0,isEmpty:!e.serviceName||""===e.serviceName.trim()}}))||[]}),Pe(a.total),Ce(a.hasMore),!a.services||0===a.services.length)return void oe([]);const r=a.services.map(e=>(e.serviceName&&""!==e.serviceName.trim()||n.warn("[space.tsx] Mapping service with empty name",{serviceId:e.id,serviceName:e.serviceName,serviceNameIsNull:null===e.serviceName,serviceNameIsUndefined:void 0===e.serviceName,serviceNameIsEmpty:""===e.serviceName}),{id:e.id,name:e.serviceName,projectName:e.projectName,monitoringDomains:e.monitoringDomains,description:"",isPrivate:!1,createdAt:e.createdAt,updatedAt:e.updatedAt,analyzedAt:void 0,score:void 0,analysisCount:e.analysisCount,inProgress:!1,isPinned:e.isPinned,pinnedAt:e.pinnedAt,defaultSearchArea:e.defaultSearchArea??$}));n.debug("Mapped services for UI:",r),n.info("[space.tsx] Final UI service data",{totalMappedServices:r.length,servicesWithEmptyNamesInUI:r.filter(e=>!e.name||""===e.name.trim()).length,mappedServicesDetail:r.map(e=>{var s;return{id:e.id,name:e.name,nameLength:(null==(s=e.name)?void 0:s.length)||0,isEmpty:!e.name||""===e.name.trim()}})}),oe(r)}catch(r){const e=r instanceof Error?r.message:a("servicePage.errors.fetchFailed");ne({title:a("servicePage.errors.fetchFailed"),description:a("servicePage.errors.checkConnection"),variant:"destructive"}),ge(e)}finally{xe(!1)}},[e,je,10,Re,Oe,fe,a,ne]);w.useEffect(()=>{(async()=>{if(!e){try{const e=await u();e&&e.length>0&&y(`/space/${e[0].id}`,{replace:!0})}catch(r){n.error("Failed to fetch spaces:",r),ne({title:a("spacePage.errors.fetchFailed"),description:a("spacePage.errors.checkConnection"),variant:"destructive"})}return}const s=(t={isLoadingStatistics:Ae,statisticsError:Le}).isLoadingStatistics?"loading":t.statisticsError?404===te(t.statisticsError)?"notFound":"error":"valid";var t;if("loading"!==s)if("valid"!==s)if(n.error("Failed to validate space:",Le),"notFound"===s)try{const e=await u();e&&e.length>0&&(y(`/space/${e[0].id}`,{replace:!0}),ne({title:a("spacePage.errors.spaceNotFound"),description:a("spacePage.errors.redirectedToDefault")}))}catch(i){n.error("Failed to redirect:",i),ce(!1)}else ne({title:a("spacePage.errors.fetchFailed"),description:a("spacePage.errors.checkConnection"),variant:"destructive"}),ce(!1);else ce(!0)})()},[e,Ae,Le,y,a,ne]),w.useEffect(()=>{e&&He()},[e,He]);const We=w.useRef(e),Ke=w.useRef(He);w.useEffect(()=>{We.current=e,Ke.current=He},[e,He]),w.useEffect(()=>{const e=e=>{var s;const a=e;n.info("[space.tsx] Batch analysis completed event received:",a.detail);const t=null==(s=a.detail)?void 0:s.spaceId;t&&t===We.current?Ke.current():t&&t!==We.current&&n.debug("[space.tsx] Ignoring batch completion for different space:",{eventSpaceId:t,currentSpaceId:We.current})};return window.addEventListener("batchAnalysisCompleted",e),()=>{window.removeEventListener("batchAnalysisCompleted",e)}},[]);const Qe=de;w.useEffect(()=>{const e=setTimeout(()=>{be(ve),ve!==fe&&Ne(1)},300);return()=>clearTimeout(e)},[ve,fe]),w.useEffect(()=>{const e=new URLSearchParams(P.search);if("add_service"===e.get("action")){ze(!0),e.delete("action");const s=e.toString();y(`${P.pathname}${s?`?${s}`:""}${P.hash}`,{replace:!0})}},[P.search,P.pathname,P.hash,y]);const Ye=e=>{Fe(s=>s.includes(e)?s.filter(s=>s!==e):[...s,e])},Ge=e=>{const s="name"===e?"serviceName":e;Re===s?Ve("asc"===Oe?"desc":"asc"):(qe(s),Ve("desc"))},Xe=e=>Re!==("name"===e?"serviceName":e)?null:"asc"===Oe?N.jsx(Z,{className:"inline-block w-4 h-4 ml-1 text-primary-text"}):N.jsx(X,{className:"inline-block w-4 h-4 ml-1 text-primary-text"});return!1===le?N.jsxs(l,{className:"max-w-md w-full p-8 text-center bg-white/95 backdrop-blur-sm border border-primary/[0.2] rounded-xl shadow-md",children:[N.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900",children:a("spacePage.errors.spaceNotFound")}),N.jsx("p",{className:"text-gray-600 mb-6",children:a("spacePage.errors.checkSpaceId")}),N.jsx(c,{onClick:()=>y("/"),className:"bg-primary hover:bg-primary-hover text-white px-6 py-2 rounded-md shadow-sm transition-all duration-200",children:a("common.backToHome")})]}):N.jsxs("div",{className:"min-h-screen",children:[N.jsx("div",{className:"pt-12",children:N.jsxs("main",{className:"px-4 sm:px-6 lg:px-8 max-w-[1400px] mx-auto pb-16",children:[N.jsx(l,{className:"mb-8 bg-white/95 backdrop-blur-sm border border-gray-100 rounded-xl shadow-md overflow-hidden",children:N.jsxs("div",{className:"p-6 sm:p-8 space-y-6",children:[N.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[N.jsxs("h1",{className:"text-2xl md:text-3xl 3xl:text-4xl font-bold text-gray-900 flex items-center",children:[N.jsx("span",{className:"bg-primary/[0.0824] p-2 rounded-md mr-3 flex-shrink-0",children:N.jsx(ee,{className:"h-5 w-5 text-primary-text"})}),a("servicePage.overview.title")]}),N.jsxs("span",{className:"text-sm text-gray-500 flex items-center bg-gray-50 px-4 py-1.5 rounded-full shadow-sm",children:[N.jsx(_,{className:"w-4 h-4 mr-2 text-primary-text"}),a("servicePage.overview.lastUpdate",ke?{date:new Date(ke.lastUpdated).toLocaleStr
8ing("ja-JP")}:{date:(new Date).toLocaleString("ja-JP")})]})]}),N.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5 sm:gap-6",children:Ae&&!Je?N.jsx(N.Fragment,{children:Array.from({length:2}).map((e,s)=>N.jsxs("div",{className:"bg-white p-6 rounded-xl animate-pulse border border-gray-100 shadow-sm",children:[N.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[N.jsx("div",{className:"p-2 rounded-md bg-primary/[0.0314] w-10 h-10"}),N.jsx("div",{className:"h-5 bg-primary/[0.0314] rounded w-32"})]}),N.jsx("div",{className:"h-9 bg-primary/[0.0196] rounded w-20 mb-3"}),N.jsx("div",{className:"h-4 bg-primary/[0.0118] rounded w-24"})]},s))}):N.jsxs(N.Fragment,{children:[N.jsx(ie,{className:"bg-white hover:shadow-lg hover:shadow-primary/[0.0627]\n                                transition-all duration-300 transform hover:-translate-y-1 border border-gray-100 rounded-xl",icon:N.jsx(d,{className:"text-primary-text"}),label:a("servicePage.overview.stats.services.label"),value:(null==ke?void 0:ke.totalServices)||0}),N.jsx(ae,{spaceId:e,className:"bg-white hover:shadow-lg hover:shadow-primary/[0.0627] \n                                transition-all duration-300 transform hover:-translate-y-1 border border-gray-100 rounded-xl"})]})})]})}),N.jsx("div",{className:"mb-8 bg-white/95 backdrop-blur-sm rounded-xl p-5 shadow-md border border-gray-100",children:N.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[N.jsxs("div",{className:"relative flex-1",children:[N.jsx(o,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-primary-text h-4 w-4"}),N.jsx(S,{type:"text",value:ve,onChange:e=>{ye(e.target.value)},placeholder:a("servicePage.search.placeholder"),className:"pl-10 bg-white border-gray-200 focus:border-primary/[0.251] focu
8s:ring-2 focus:ring-primary/[0.0824] transition-all duration-200 h-10 rounded-md shadow-sm"})]}),N.jsxs("div",{className:"flex gap-2 flex-shrink-0 items-center",children:[!De&&N.jsxs(c,{onClick:()=>ze(!0),className:"bg-primary hover:bg-primary-hover text-white shadow-sm rounded-md px-4 h-10",children:[N.jsx(B,{className:"h-4 w-4 mr-2"}),a("servicePage.addService.button")]}),N.jsx(c,{variant:"outline",className:t("transition-all duration-200 h-10 rounded-md shadow-sm",De?"bg-primary/[0.0314] border-primary/[0.251] hover:bg-white":"bg-white border-gray-200 hover:bg-primary/[0.0314] hover:border-primary/[0.251]"),onClick:()=>De?(Ie(!1),void Fe([])):Ie(!0),children:De?N.jsxs(N.Fragment,{children:[N.jsx(m,{className:"w-4 h-4 mr-2"}),a("servicePage.selection.exit")]}):N.jsxs(N.Fragment,{children:[N.jsx(H,{className:"w-4 h-4 mr-2"}),a("servicePage.selection.enter")]})}),De&&Ee.length>0&&N.jsxs(c,{variant:"destructive",className:"gap-2 relative overflow-hidden group h-10 rounded-md shadow-sm",onClick:()=>Me(!0),disabled:_e,children:[N.jsxs("span",{className:"relative z-10 flex items-center",children:[N.jsx(W,{className:"w-4 h-4 mr-2"}),a("servicePage.selection.delete.button"),N.jsx("span",{className:"ml-2 inline-flex items-center justify-center bg-white/20 rounded-full h-5 min-w-5 px-1 text-xs",children:Ee.length})]}),N.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-red-600 to-rose-600 opacity-0 group-hover:opacity-100 transition-opacity duration-300"})]})]})]})}),ue?N.jsxs(l,{className:"p-8 text-center bg-white/95 backdrop-blur-sm border border-red-200 shadow-md rounded-xl",children:[N.jsx("div",{className:"text-red-600 mb-6 font-medium text-lg",children:ue}),N.jsx(c,{variant:"outline",onClick:He,className:"bg-white hover:bg-red-50 border-red-200 rounded-md shadow-sm px-6",children:a("common.retry")})]}):me?N.jsx("div",{className:"bg-white/95 backdrop-blur-sm border border-gray-100 shadow-md rounded-xl divide-y animate-pulse",children:Array.from({length:6}).map((e,s)=>N.jsxs("div",{className:"flex items-center p-4",children:[N.jsxs("div",{className:"flex-1 min-w-0",children:[N.jsx("div",{className:"h-5 bg-gray-100 rounded w-1/3 mb-2"}),N.jsx("div",{className:"h-4 bg-gray-100 rounded w-1/4"})]}),N.jsxs("div",{className:"hidden md:flex items-center gap-6 px-4",children:[N.jsx("div",{className:"h-4 bg-gray-100 rounded w-24"}),N.jsx("div",{className:"h-4 bg-gray-100 rounded w-20"})]})]},s))}):0!==Qe.length||De?N.jsxs("div",{className:"bg-white/95 backdrop-blur-sm border border-gray-100 shadow-md rounded-xl overflow-hidden",children:[N.jsxs(k,{children:[N.jsx(A,{className:"bg-gray-50",children:N.jsxs(L,{className:"border-b border-gray-200",children:[De&&N.jsx(D,{className:"w-[40px] px-3 py-3",children:N.jsx(C,{checked:Ee.length===Qe.length&&Qe.length>0,onCheckedChange:e=>{Fe(e?Qe.map(e=>e.id):[])},className:"h-5 w-5 border-2 text-primary-text rounded shadow-sm"})}),N.jsx(D,{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("servicePage.table.projectName","プロジェクト名")}),N.jsx(D,{className:"hidden md:table-cell px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100 transition-colors",onClick:()=>Ge("name"),children:N.jsxs("div",{className:"flex items-center",children:[a("servicePage.table.serviceName","サービス名"),Xe("name")]})}),N.jsx(D,{className:"hidden lg:table-cell px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:a("servicePage.table.domains","ドメイン")}),N.jsx(D,{className:"hidden md:table-cell px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100 transition-colors",onClick:()=>Ge("analysisCount"),children:N.jsxs("div",{className:"flex items-center justify-center",children:[a("servicePage.table.analysisCount","分析回数"),Xe("analysisCount")]})}),N.jsx(D,{className:"hidden md:table-cell px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100 transition-colors",onClick:()=>Ge("createdAt"),children:N.jsxs("div",{className:"flex items-center justify-center",children:[a("servicePage.table.createdAt","作成日"),Xe("createdAt")]})}),!De&&N.jsx(D,{className:"w-[60px] px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider",children:N.jsx(se,{className:"inline-block w-4 h-4 text-primary-text"})})]})}),N.jsx(I,{children:Qe.map(s=>N.jsxs(L,{className:t("hover:bg-gray-50 transition-colors",De&&Ee.includes(s.id
8)&&"bg-indigo-50"),children:[De&&N.jsx(E,{className:"px-3 py-4",children:N.jsx(C,{checked:Ee.includes(s.id),onCheckedChange:()=>Ye(s.id),className:"h-5 w-5 border-2 text-primary-text rounded shadow-sm"})}),N.jsx(E,{className:"px-4 py-4",children:N.jsx(G,{to:De?"#":`/space/${e}/service/${s.id}`,onClick:e=>{De&&(e.preventDefault(),Ye(s.id))},className:"block",children:N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsx("h3",{className:"font-medium text-gray-900 truncate",children:s.projectName||s.name}),s.inProgress&&N.jsxs("span",{className:"inline-flex items-center text-primary-text bg-primary/[0.0824] px-2 py-0.5 rounded-full text-xs font-medium whitespace-nowrap",children:[N.jsx(_,{className:"w-3 h-3 mr-1"}),a("servicePage.serviceCard.inProgress")]})]})})}),N.jsx(E,{className:"hidden md:table-cell px-4 py-4 text-left",children:N.jsx("span",{className:"text-sm text-gray-700 truncate",children:s.name})}),N.jsx(E,{className:"hidden lg:table-cell px-4 py-4 text-left",children:N.jsx("div",{className:"flex flex-wrap gap-1",children:s.monitoringDomains.length>0?s.monitoringDomains.map((e,s)=>N.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-md text-xs bg-gray-100 text-gray-700 truncate max-w-[180px]",title:e.domain,children:e.domain},s)):N.jsx("span",{className:"text-sm text-gray-400",children:"-"})})}),N.jsx(E,{className:"hidden md:table-cell px-4 py-4 text-center",children:N.jsxs("div",{className:"inline-flex items-center text-sm text-gray-600",children:[N.jsx(ee,{className:"w-4 h-4 mr-1 text-primary-text"}),s.analysisCount||0]})}),N.jsx(E,{className:"hidden md:table-cell px-4 py-4 text-center text-sm text-gray-600",children:(()=>{const e=s.analyzedAt?Math.floor((Date.now()-new Date(s.analyzedAt).getTime())/864e5):null;return s.inProgress?a("servicePage.serviceCard.inProgress"):null!==e?e>0?a("servicePage.serviceCard.daysAgo",{days:e}):a("servicePage.serviceCard.today"):new Date(s.createdAt).toLocaleString("ja-JP",{year:"numeric",month:"short",day:"numeric"})})()}),!De&&N.jsx(E,{className:"px-4 py-4 text-center",children:N.jsx("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),(async(s,t)=>{var r;if(!e)return;const i=null==(r=de.find(e=>e.id===s))?void 0:r.pinnedAt;try{Be(!0),oe(e=>e.map(e=>e.id===s?{...e,isPinned:!t,pinnedAt:t?void 0:(new Date).toISOString()}:e)),t?await g(e,s):await v(e,s),await He()}catch(n){oe(e=>e.map(e=>e.id===s?{...e,isPinned:t,pinnedAt:i}:e)),ne({title:a("servicePage.errors.pinFailed"),description:a("servicePage.errors.checkConnection"),variant:"destructive"})}finally{Be(!1)}})(s.id,s.isPinned)},className:t("p-2 rounded-md transition-colors inline-flex items-center justify-center",s.isPinned?"text-primary-text hover:bg-primary/[0.0824]":"text-gray-400 hover:text-primary-text hover:bg-gray-100"),title:s.isPinned?"ピン留めを解除":"ピン留めする",children:N.jsx(se,{className:t("w-4 h-4",s.isPinned&&"fill-current")})})})]},s.id))})]}),we>0&&N.jsxs("div",{className:"mt-6 flex items-center justify-between px-4 py-3 border-t border-gray-200",children:[N.jsxs("div",{className:"flex-1 flex justify-between sm:hidden",children:[N.jsx(c,{onClick:()=>Ne(e=>Math.max(1,e-1)),disabled:1===je,variant:"outline",className:"relative inline-flex items-center px-4 py-2 text-sm font-medium",children:a("common.previous","前へ")}),N.jsx(c,{onClick:()=>Ne(e=>e+1),disabled:!Se,variant:"outline",className:"relative ml-3 inline-flex items-center px-4 py-2 text-sm font-medium",children:a("common.next","次へ")})]}),N.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[N.jsx("div",{className:"text-sm text-gray-700",children:`表示中: ${we>0?10*(je-1)+1:0}-${Math.min(10*(je-1)+de.length,we)} / ${we}件`}),N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsxs(c,{onClick:()=>Ne(e=>Math.max(1,e-1)),disabled:1===je,variant:"outline",size:"sm",className:"relative inline-flex items-center px-3 py-1.5",children:[N.jsx(x,{className:"h-4 w-4"}),a("common.previous","前へ")]}),N.jsx("span",{className:"text-sm text-gray-700",children:`${je} / ${Math.ceil(we/10)}`}),N.jsxs(c,{onClick:()=>Ne(e=>e+1),disabled:!Se,variant:"outline",size:"sm",className:"relative inline-flex items-center px-3 py-1.5",children:[a("common.next","次へ"),N.jsx(h,{className:"h-4 w-4"})]})]})]})]})]}):N.jsx("div",{className:"bg-white/95 backdrop-blur-sm border border-gray-100 shadow-md rounded-xl p-8",children:N.jsxs("div",{className:"text-center py-20",children:[N.jsx("div",{className:"inline-flex justify-center items-center w-20 h-20 rounded-full bg-primary/[0.0824] mb-6",children:N.jsx(d,{className:"h-10 w-10 text-primary-text"})}),N.jsx("h3",{className:"text-xl font-medium text-gray-900 mb-3",children:a("servicePage.emptyState.title")}),N.jsx("p",{className:"text-gray-600 max-w-md mx-auto mb-8",children:a("servicePage.emptyState.description")}),N.jsxs(c,{onClick:()=>ze(!0),className:"bg-primary hover:bg-primary-hover text-white shadow-md hover:shadow-lg hover:shadow-
8primary/[0.1255] transition-all duration-300 px-6 py-2.5 rounded-md",children:[N.jsx(B,{className:"h-5 w-5 mr-2"}),a("servicePage.addService.button")]})]})})]})}),Te&&N.jsx(w.Suspense,{fallback:N.jsx(p,{text:a("common.loading.default")}),children:N.jsx(re,{onClose:()=>{ze(!1);const e=new URLSearchParams(P.search);if(e.has("action")){e.delete("action");const s=e.toString();y(`${P.pathname}${s?`?${s}`:""}${P.hash}`,{replace:!0})}},onSubmit:async s=>{var t;if(n.debug("Service registration form submitted data:",s),e){pe(!0),ge(null);try{n.debug("Creating service in space_id:",e);const r={spaceId:e,serviceName:s.serviceName,projectName:(null==(t=s.projectName)?void 0:t.trim())||void 0,monitoringDomains:s.monitoringDomains,aliases:s.ownedAliases,isPrivate:!1,defaultSearchArea:s.defaultSearchArea||$};n.debug("createService payload:",r);const i=await f(e,r);n.debug("newService response:",i);const l=i.id;let c=[];if(s.competitors&&s.competitors.length>0){n.debug(`Attempting to create ${s.competitors.length} competitors...`);const a=s.competitors.filter(e=>""!==e.serviceName.trim()).map(async s=>{const a=(s.monitoringDomains||[]).map(e=>e.domain.trim()).filter(e=>""!==e),t={serviceName:s.serviceName.trim(),monitoringDomains:a,aliases:(s.aliases??[]).map(e=>e.aliasName).filter(e=>e.trim())};return n.debug(`Creating competitor "${t.serviceName}" for service ${l}`),b(e,l,t)});c=await Promise.allSettled(a),c.forEach((e,s)=>{"rejected"===e.status?n.error(`Failed to create competitor ${s+1}:`,e.reason):e.value&&n.debug(`Successfully created competitor ${s+1}:`,e.value.serviceName)})}await He(),ze(!1);const d=c.filter(e=>"fulfilled"===e.status&&null!==e.value).length,o=c.filter(e=>"rejected"===e.status).length;ne(0===d+o?{title:a("servicePage.addService.success")}:0===o?{title:a("servicePage.addServiceAndCompetitors.success",{count:d})}:d>0?{title:a("servicePage.addServiceAndCompetitors.partialSuccess",{failCount:o}),variant:"destructive"}:{title:a("servicePage.addService.competitorsError"),description:a("servicePage.addService.competitorsErrorDescription"),variant:"destructive"}),l&&e&&y(`/space/${e}/service/${l}?action=start_analysis`)}catch(r){const e=r instanceof Error?r.message:"Failed to process service registration";ge(e),n.error("Service registration failed (createService step):",r),ne({title:a("servicePage.errors.createFailed"),description:e,variant:"destructive"})}finally{pe(!1)}}else ne({title:"Error: Space ID is missing.",variant:"destructive"})},isRegistering:he,spaceId:e})}),N.jsx(U,{open:$e,onOpenChange:Me,children:N.jsxs(T,{className:"bg-white border border-gray-200 rounded-xl shadow-lg p-6 max-w-md mx-auto",children:[N.jsxs(z,{children:[N.jsx(R,{className:"text-xl text-gray-900 font-semibold",children:a("servicePage.selection.delete.confirmTitle",{count:Ee.length})}),N.jsx(q,{className:"text-gray-600 mt-2",children:a("servicePage.selection.delete.confirmDescription")})]}),N.jsxs(O,{className:"mt-6 flex gap-3",children:[N.jsx(V,{disabled:_e,className:"border border-gray-200 hover:bg-gray-50 text-gray-700 rounded-md px-4 py-2 shadow-sm",children:a("servicePage.selection.delete.cancel")}),N.jsx(J,{onClick:async()=>{try{if(Ue(!0),!e)return;const s=Ee.map(s=>j(e,s));await Promise.all(s),ne({title:a("servicePage.selection.delete.success",{count:Ee.length}),className:"bg-gradient-to-r from-emerald-500 to-blue-500 text-white"}),Ie(!1),Fe([]),await He()}catch(s){n.error("Failed to delete services:",s),ne({title:a("servicePage.selection.delete.error"),variant:"destructive",className:"bg-gradient-to-r from-red-500 to-rose-500 text-white"})}finally{Ue(!1),Me(!1)}},disabled:_e,className:"bg-red-500 hover:bg-red-600 text-white rounded-md px-4 py-2 shadow-sm",children:a("servicePage.selection.delete.confirm")})]})]})})]})}export{ne as default};
9//# sourceMappingURL=space-DQClOdYO.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.