@rubytech/create-maxy-code 0.1.378 → 0.1.382
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/plugin-install.test.js +18 -1
- package/dist/index.js +22 -8
- package/dist/lib/plugin-install.js +22 -0
- package/package.json +1 -1
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +11 -3
- package/payload/platform/plugins/docs/references/admin-ui.md +4 -2
- package/payload/platform/plugins/docs/references/internals.md +4 -0
- package/payload/platform/plugins/docs/references/plugins-guide.md +2 -0
- package/payload/platform/plugins/whatsapp/references/channels-whatsapp.md +13 -0
- package/payload/platform/services/claude-session-manager/dist/index.js +32 -0
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.d.ts +51 -0
- package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.js +163 -0
- package/payload/platform/services/claude-session-manager/dist/skill-registration-drift.js.map +1 -0
- package/payload/server/{chunk-AQO6KLIH.js → chunk-ZYS5V5QG.js} +0 -21
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/public/assets/{AdminLoginScreens-B9u1V35g.js → AdminLoginScreens-C_Qn0UPy.js} +1 -1
- package/payload/server/public/assets/AdminShell-iHdYhspw.js +1 -0
- package/payload/server/public/assets/{Checkbox-B2g2SCpw.js → Checkbox-B76SHnPC.js} +1 -1
- package/payload/server/public/assets/admin-RTEhnrPk.js +1 -0
- package/payload/server/public/assets/{browser-B8omhYsK.js → browser-Chmp3Xfv.js} +1 -1
- package/payload/server/public/assets/calendar-CjE7hiqV.js +1 -0
- package/payload/server/public/assets/chat-DiKmCMO1.js +1 -0
- package/payload/server/public/assets/data-5PpEsUR3.js +1 -0
- package/payload/server/public/assets/{graph-DJOKFr_s.js → graph-DEHmvpNl.js} +3 -3
- package/payload/server/public/assets/{graph-labels-DFdBydWC.js → graph-labels-CYAjU3rz.js} +1 -1
- package/payload/server/public/assets/operator-BDTnuQhB.js +1 -0
- package/payload/server/public/assets/page-D8FFXoI9.js +1 -0
- package/payload/server/public/assets/page-HeiBebPq.js +32 -0
- package/payload/server/public/assets/{public-CGl0i1f-.js → public-BIOxrxZK.js} +1 -1
- package/payload/server/public/assets/{rotate-ccw-Cg_V4XIU.js → rotate-ccw-K1xZvf3B.js} +1 -1
- package/payload/server/public/assets/{useSubAccountSwitcher-Ca1GJeBC.css → useSubAccountSwitcher-B44qYovc.css} +1 -1
- package/payload/server/public/assets/useSubAccountSwitcher-DPEkYkYd.js +9 -0
- package/payload/server/public/browser.html +4 -4
- package/payload/server/public/calendar.html +4 -4
- package/payload/server/public/chat.html +6 -6
- package/payload/server/public/data.html +5 -5
- package/payload/server/public/graph.html +7 -7
- package/payload/server/public/index.html +8 -8
- package/payload/server/public/operator.html +8 -8
- package/payload/server/public/public.html +6 -6
- package/payload/server/server.js +387 -122
- package/payload/server/public/assets/AdminShell-C2UXTLSB.js +0 -1
- package/payload/server/public/assets/admin-CRBQgWsm.js +0 -1
- package/payload/server/public/assets/calendar-Blb-5arm.js +0 -1
- package/payload/server/public/assets/chat--1ajLxwi.js +0 -1
- package/payload/server/public/assets/data-BYUmu98z.js +0 -1
- package/payload/server/public/assets/operator-DUVqlubZ.js +0 -1
- package/payload/server/public/assets/page-BMeSKYGZ.js +0 -32
- package/payload/server/public/assets/page-DBkTNfei.js +0 -1
- package/payload/server/public/assets/useSubAccountSwitcher-DAgBUed_.js +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./chunk-CAM3fms7.js";import{
|
|
1
|
+
import{t as e}from"./chunk-CAM3fms7.js";import{z as t}from"./useSubAccountSwitcher-DPEkYkYd.js";var n=t(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),r=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ALL_GRAPH_LABELS=e.FALLBACK_LABEL_COLOUR=e.GRAPH_LABEL_COLOURS=void 0,e.pickDisplayLabel=t,e.colourForLabel=n,e.resolveNodeColour=r,e.formatRunTimestamp=o,e.formatMessageTimestamp=s,e.pickShortLabel=c,e.pickDisplayName=l,e.GRAPH_LABEL_COLOURS={LocalBusiness:`#4F6B8A`,Service:`#6B85A0`,PriceSpecification:`#8AA0B8`,OpeningHoursSpecification:`#A8BACE`,Listing:`#3F5670`,Property:`#5C7A99`,Viewing:`#D4A574`,Offer:`#B08850`,Job:`#8C3B2E`,Quote:`#A65A4A`,Invoice:`#6E4A1F`,InboundInvoice:`#6B2A20`,WhatsAppGroup:`#D4A096`,Customer:`#B5503C`,Site:`#C56B4A`,Asset:`#9E4A35`,Visit:`#C77A4E`,Part:`#7A3326`,PurchaseOrder:`#B07050`,PpmContract:`#8A4A3A`,Organization:`#8A6B47`,Person:`#B86E4A`,UserProfile:`#D08960`,Preference:`#DFA67A`,AdminUser:`#8C5230`,AccessGrant:`#66381F`,KnowledgeDocument:`#6E8A5A`,ConversationArchive:`#4F6B3E`,Section:`#8AA876`,Chunk:`#A6C194`,DigitalDocument:`#5A7548`,CreativeWork:`#B5C9A2`,Question:`#C7D6B5`,FAQPage:`#95B385`,DefinedTerm:`#76906A`,Review:`#3F5A2E`,ImageObject:`#A0BB8C`,Conversation:`#6B5A85`,AdminConversation:`#4F4070`,PublicConversation:`#8A75A8`,Message:`#6B7280`,UserMessage:`#DFA67A`,AssistantMessage:`#C9A876`,ToolCall:`#B5ABCB`,Task:`#B0617A`,Project:`#8E4A60`,Event:`#C68095`,Workflow:`#3A6F77`,WorkflowStep:`#5A8E96`,WorkflowRun:`#7AAAB2`,StepResult:`#9CC4CB`,Email:`#6F7F4A`,EmailAccount:`#91A063`,Agent:`#B8893D`,Objective:`#3D5A98`,KeyResult:`#5E7BC4`,Decision:`#7E60B0`,Risk:`#C15B57`,Source:`#2F8FA6`,Finding:`#4FA389`,Hypothesis:`#9A8C3E`},e.FALLBACK_LABEL_COLOUR=`#94A3B8`,e.ALL_GRAPH_LABELS=Object.freeze(Object.keys(e.GRAPH_LABEL_COLOURS));function t(t){for(let n=1;n<t.length;n++)if(Object.prototype.hasOwnProperty.call(e.GRAPH_LABEL_COLOURS,t[n]))return t[n];return t[0]??null}function n(t){return e.GRAPH_LABEL_COLOURS[t]??e.FALLBACK_LABEL_COLOUR}function r(r){let i=t(r),a=i?n(i):e.FALLBACK_LABEL_COLOUR,o=0;for(let t=1;t<r.length;t++)Object.prototype.hasOwnProperty.call(e.GRAPH_LABEL_COLOURS,r[t])&&o++;return{displayLabel:i,colour:a,driftCandidates:o}}var i=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/,a=/^\d{4}-\d{2}-\d{2}T(\d{2}:\d{2}:\d{2})/;function o(e){let t=e.match(i);return t?`${t[1]} ${t[2]}`:null}function s(e){let t=e.match(a);return t?t[1]:null}function c(e){let t=e.properties,n=e.labels[0];if(n===`ToolCall`){let e=t.toolName;if(typeof e==`string`&&e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`WorkflowRun`){let e=t.startedAt;if(typeof e==`string`&&e.length>0){let t=o(e);if(t)return t}}else if(n===`WorkflowStep`){let e=t.label;if(typeof e==`string`&&e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`Person`){let e=[typeof t.givenName==`string`?t.givenName:``,typeof t.familyName==`string`?t.familyName:``].filter(e=>e.length>0).join(` `);if(e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`Agent`){let e=typeof t.displayName==`string`?t.displayName:``,n=typeof t.slug==`string`?t.slug:``,r=e.length>0?e:n;if(r.length>0)return r.length>24?r.slice(0,24)+`…`:r}else if(n===`Job`){let e=typeof t.client==`string`?t.client:``,n=typeof t.jobId==`string`?t.jobId:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r.length>24?r.slice(0,24)+`…`:r}else if(n===`Quote`){let e=typeof t.ref==`string`?t.ref:``;if(e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`InboundInvoice`){let e=typeof t.supplier==`string`?t.supplier:``,n=typeof t.confirmationNumber==`string`?t.confirmationNumber:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r.length>24?r.slice(0,24)+`…`:r}else if(n===`WhatsAppGroup`){let e=typeof t.clientName==`string`?t.clientName:``;if(e.length>0)return e.length>24?e.slice(0,24)+`…`:e}else if(n===`Message`){let e=typeof t.role==`string`?t.role:``,n=e===`user`?`user`:e===`assistant`?`asst`:e===`system`?`sys`:e===`tool`?`tool`:null,r=typeof t.createdAt==`string`?t.createdAt:``;if(n&&r){let e=s(r);if(e)return`${n} ${e}`}}for(let e of[`name`,`title`,`summary`,`givenName`,`subject`,`text`]){let n=t[e];if(typeof n==`string`&&n.length>0)return n.length>24?n.slice(0,24)+`…`:n}if(n===`Conversation`){let e=typeof t.sessionId==`string`?t.sessionId:null;if(e)return`Conv ${e.slice(0,8)}`}return n??`…`}function l(e){let t=e.properties,n=e.labels[0];if(n===`ToolCall`){let e=t.toolName;if(typeof e==`string`&&e.length>0)return e}else if(n===`WorkflowRun`){let e=t.startedAt;if(typeof e==`string`&&e.length>0){let t=o(e);if(t)return t}}else if(n===`WorkflowStep`){let e=t.label;if(typeof e==`string`&&e.length>0)return e}else if(n===`Person`){let e=[typeof t.givenName==`string`?t.givenName:``,typeof t.familyName==`string`?t.familyName:``].filter(e=>e.length>0).join(` `);if(e.length>0)return e}else if(n===`Agent`){let e=typeof t.displayName==`string`?t.displayName:``,n=typeof t.slug==`string`?t.slug:``,r=e.length>0?e:n;if(r.length>0)return r}else if(n===`Job`){let e=typeof t.client==`string`?t.client:``,n=typeof t.jobId==`string`?t.jobId:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r}else if(n===`Quote`){let e=typeof t.ref==`string`?t.ref:``;if(e.length>0)return e}else if(n===`InboundInvoice`){let e=typeof t.supplier==`string`?t.supplier:``,n=typeof t.confirmationNumber==`string`?t.confirmationNumber:``,r=[e,n.length>0?`#${n}`:``].filter(e=>e.length>0).join(` `);if(r.length>0)return r}else if(n===`WhatsAppGroup`){let e=typeof t.clientName==`string`?t.clientName:``;if(e.length>0)return e}for(let e of[`name`,`title`,`summary`,`givenName`,`subject`,`text`]){let n=t[e];if(typeof n==`string`&&n.length>0)return n}if(n===`Conversation`){let e=typeof t.sessionId==`string`?t.sessionId:null;if(e)return`Conv ${e.slice(0,8)}`}return n??`…`}})),i=r();Object.freeze(new Set([`Chunk`,`GraphPreference`]));var a=Object.freeze(new Set(`LocalBusiness.Service.PriceSpecification.OpeningHoursSpecification.Organization.Person.UserProfile.Preference.AdminUser.AccessGrant.KnowledgeDocument.DigitalDocument.CreativeWork.Question.FAQPage.DefinedTerm.Review.ImageObject.Listing.Property.Viewing.Offer.Job.Quote.Invoice.InboundInvoice.WhatsAppGroup.Customer.Site.Asset.Visit.Part.PurchaseOrder.PpmContract.Task.Project.Event.Workflow.Email.EmailAccount.Agent.Objective.KeyResult.Decision.Risk.Source.Finding.Hypothesis`.split(`.`)));Object.freeze(new Set([`ToolCall`,`StepResult`,`WorkflowStep`,`WorkflowRun`])),Object.freeze(new Set([`HAS_TOOL_CALL`,`RUN_OF`,`HAS_STEP`,`HAS_RESULT`]));export{n as i,i as n,r,a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CAM3fms7.js";import{W as t,Y as n,q as r}from"./useSubAccountSwitcher-DPEkYkYd.js";import{n as i,t as a}from"./AdminLoginScreens-C_Qn0UPy.js";import"./admin-types-DJoj6VJv.js";import"./AdminShell-iHdYhspw.js";import"./Checkbox-B76SHnPC.js";import{t as o}from"./page-HeiBebPq.js";var s=r(),c=e(n(),1),l=t();function u(){let e=i(`operator`),t=(0,c.useRef)(null);return(0,c.useEffect)(()=>{e.appState!==`chat`&&t.current!==e.appState&&(t.current=e.appState,console.info(`[operator-ui] op=auth-gate state=${e.appState}`))},[e.appState]),e.appState===`chat`?(0,l.jsx)(o,{variant:`operator`,forceCanonicalSession:window.location.pathname!==`/chat`}):(0,l.jsx)(a,{auth:e})}(0,s.createRoot)(document.getElementById(`root`)).render((0,l.jsx)(u,{}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CAM3fms7.js";import{A as t,D as n,E as r,F as i,K as a,M as o,O as s,P as c,S as l,T as u,W as d,Y as f,h as p,m as ee,n as m,p as h,t as g,w as te,x as ne,z as _}from"./useSubAccountSwitcher-DPEkYkYd.js";import{i as re,t as ie}from"./graph-labels-CYAjU3rz.js";var ae=_(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),oe=_(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),se=_(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ce=_(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),le=_(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ue=_(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),de=_(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);function fe(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||ie.has(e)&&(t.add(e),n.push(e)));return n}var v=e(f(),1),y=d(),pe=/\.(png|jpe?g|gif|webp|svg)$/i;function me(e){return pe.test(e)}var he=`maxy-data-view`,ge=95*1024*1024,_e=48*1024*1024;function ve(){return typeof window>`u`?`list`:window.localStorage.getItem(he)===`grid`?`grid`:`list`}function ye(){let[e,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let e=!1,t=null;try{t=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!t){n(null),i(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(t)}`).then(r=>{if(!e){if(r.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}n(t),i(!0)}}).catch(()=>{e||(n(t),i(!0))}),()=>{e=!0}},[]),r?e?(0,y.jsx)(l,{cacheKey:e,surface:`data`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=data`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,y.jsx)(`div`,{className:`data-page data-page-full`,children:(0,y.jsx)(b,{cacheKey:e})})}):(0,y.jsx)(`div`,{className:`data-page`,children:(0,y.jsxs)(`div`,{className:`data-empty`,children:[(0,y.jsx)(`p`,{children:`You are not signed in.`}),(0,y.jsxs)(`p`,{children:[`Open the `,(0,y.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,y.jsx)(`div`,{className:`data-page`,children:(0,y.jsxs)(`div`,{className:`data-loading`,children:[(0,y.jsx)(t,{size:18,className:`spin`}),` Loading…`]})})}function b({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=a({initialCacheKey:e,surface:`data`});return(0,y.jsx)(Te,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})}function be(){if(typeof window>`u`)return`.`;let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`path`);return e&&e.length>0?e:`.`}function xe(e){if(typeof window>`u`)return;let t=new URL(window.location.href);t.hash=e===`.`?``:`path=${encodeURIComponent(e)}`,window.history.replaceState(window.history.state,``,t.toString())}function x(e){return new Promise((t,n)=>{let r=[],i=()=>e.readEntries(e=>{e.length===0?t(r):(r.push(...e),i())},n);i()})}function Se(e){return new Promise((t,n)=>e.file(t,n))}async function Ce(e,t=``){let n=[];for(let r of e){if(!r)continue;let e=t?`${t}/${r.name}`:r.name;if(r.isFile)n.push({file:await Se(r),relpath:e});else if(r.isDirectory){let t=await x(r.createReader());n.push(...await Ce(t,e))}}return n}function we(e,t){if(e===422&&typeof t==`string`){if(/exceeds the .* limit/i.test(t))return`size`;if(/unsupported file type/i.test(t))return`mime`}return`http=${e}`}function S({adminFetch:e,cacheKey:a,sessionRefetchNonce:l}){let[d,f]=(0,v.useState)(``),m=(0,v.useRef)(null),[g,ne]=(0,v.useState)(``),[_,ie]=(0,v.useState)(null),[pe,ye]=(0,v.useState)(`hybrid`),[b,x]=(0,v.useState)(!1),[Se,S]=(0,v.useState)(null),[Te,Ee]=(0,v.useState)(null),[ke,Ae]=(0,v.useState)(0),[C,Ne]=(0,v.useState)(!1),[w,Pe]=(0,v.useState)(()=>be()),[T,Fe]=(0,v.useState)(null),[E,Ie]=(0,v.useState)(()=>ve()),[Le,Re]=(0,v.useState)(null),[D,ze]=(0,v.useState)([]),[O,Be]=(0,v.useState)(!1),[Ve,He]=(0,v.useState)(null),[Ue,We]=(0,v.useState)(!1),[k,A]=(0,v.useState)(null),[Ge,j]=(0,v.useState)(null),[Ke,qe]=(0,v.useState)(null),[Je,Ye]=(0,v.useState)(!1),[Xe,Ze]=(0,v.useState)(null),M=(0,v.useRef)(null),[Qe,N]=(0,v.useState)(0),[$e,P]=(0,v.useState)(!1),[et,tt]=(0,v.useState)(``),[F,I]=(0,v.useState)(null),[nt,rt]=(0,v.useState)(``),[it,L]=(0,v.useState)(null),R=(()=>{let e=w===`.`?[]:w.split(`/`).filter(Boolean);return e.length>=2&&e[0]===`accounts`})(),[z,B]=(0,v.useState)(!1),at=(0,v.useRef)(null),[V,H]=(0,v.useState)(!1),ot=(0,v.useRef)(null);(0,v.useEffect)(()=>{let e=d.trim();if(!e){ne(``),ie(null),S(null);return}Ne(!1);let t=setTimeout(()=>ne(e),300);return()=>clearTimeout(t)},[d]),(0,v.useEffect)(()=>{if(!g){x(!1);return}let t=!1;return x(!0),S(null),e(`/api/admin/graph-search?q=${encodeURIComponent(g)}&labels=FileArtifact&limit=20${C?`&threshold=0`:``}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(ie(e.results),ye(e.mode??`hybrid`),Ae(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||S(e instanceof Error?e.message:String(e))}).finally(()=>{t||x(!1)}),()=>{t=!0}},[g,e,l,C]);let st=(0,v.useMemo)(()=>_?fe(_):[],[_]),U=Te&&st.includes(Te)?Te:null,W=(0,v.useMemo)(()=>_?U?_.filter(e=>e.labels.includes(U)):_:null,[_,U]),ct=(0,v.useCallback)(e=>{let t=e.properties.relativePath;if(typeof t!=`string`||t.length===0)return;let n=`/api/admin/files/download?session_key=${encodeURIComponent(a)}&path=${encodeURIComponent(t)}`,r=document.createElement(`a`);r.href=n,r.rel=`noopener noreferrer`,document.body.appendChild(r),r.click(),r.remove()},[a]);(0,v.useEffect)(()=>{if(!_)return;let e=_.filter(e=>{let t=e.properties.relativePath;return typeof t!=`string`||t.length===0});e.length>0&&console.warn(`[data-search] op=locate-link-missing nodeId=${e.map(e=>e.nodeId).join(`,`)}`)},[_]),(0,v.useEffect)(()=>{let t=!1;return Be(!0),He(null),e(`/api/admin/files?path=${encodeURIComponent(w===`.`?``:w)}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(Fe(e.entries),ze(e.displayPath??[]))}).catch(e=>{t||(Fe([]),ze([]),He(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Be(!1)}),()=>{t=!0}},[e,w,Qe,l]),(0,v.useEffect)(()=>{xe(w)},[w]);let lt=(0,v.useCallback)(()=>{N(e=>e+1)},[]),G=(0,v.useCallback)(e=>{B(!1),Pe(e)},[]),ut=(0,v.useCallback)(e=>{let t=e.properties.relativePath;if(typeof t!=`string`||t.length===0)return;let n=t.lastIndexOf(`/`),r=n===-1?`.`:t.slice(0,n);console.log(`[data-search] op=locate nodeId=${e.nodeId} folder=${r}`),f(``),S(null),Ee(null),G(r)},[G]),dt=(0,v.useCallback)(()=>{if(w===`.`||w===``)return;let e=w.split(`/`).filter(Boolean);e.pop(),Pe(e.length===0?`.`:e.join(`/`))},[w]),ft=(0,v.useCallback)(e=>{ee(a,w===`.`?e.name:`${w}/${e.name}`)},[w,a]),[K,pt]=(0,v.useState)(!1),[q,mt]=(0,v.useState)(new Set),ht=(0,v.useRef)(null),J=(0,v.useRef)(!1),Y=typeof navigator<`u`&&typeof navigator.share==`function`&&typeof navigator.canShare==`function`,gt=(0,v.useCallback)(e=>{pt(!0),mt(new Set([e])),console.info(`[data-ui] op=select-enter count=1`)},[]),X=(0,v.useCallback)(e=>{pt(!1),mt(new Set),console.info(`[data-ui] op=select-exit reason=${e}`)},[]),Z=(0,v.useCallback)(e=>{mt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),_t=(0,v.useCallback)(e=>{J.current=!1,ht.current=setTimeout(()=>{J.current=!0,gt(e)},500)},[gt]),Q=(0,v.useCallback)(()=>{ht.current&&=(clearTimeout(ht.current),null)},[]),vt=(0,v.useCallback)(e=>{if(J.current){J.current=!1;return}if(K){Z(e.name);return}ft(e)},[K,Z,ft]),yt=(0,v.useCallback)(e=>{Ie(e),typeof window<`u`&&window.localStorage.setItem(he,e),console.info(`[data] op=view-mode mode=${e}`)},[]),bt=(0,v.useCallback)(e=>{if(J.current){J.current=!1;return}if(K){Z(e.name);return}Re({src:h(a,w===`.`?e.name:`${w}/${e.name}`),alt:e.displayName??e.name})},[K,Z,w,a]),xt=(0,v.useCallback)(()=>(T??[]).filter(e=>e.kind===`file`&&q.has(e.name)),[T,q]),St=(0,v.useCallback)(()=>(T??[]).filter(e=>(e.kind===`file`||e.kind===`directory`)&&q.has(e.name)),[T,q]),Ct=(0,v.useCallback)(()=>{let e=St(),t=e.some(e=>e.kind===`directory`);e.length===1&&!t?ft(e[0]):e.length>=1&&p(a,e.map(e=>w===`.`?e.name:`${w}/${e.name}`)),X(`action`)},[St,ft,w,a,X]),wt=(0,v.useCallback)(async()=>{let t=xt(),n=t.filter(e=>!e.protected),r=t.length-n.length;Ze(r>0?`${r} protected file(s) kept`:null);for(let t of n){let n=w===`.`?t.name:`${w}/${t.name}`;try{let t=await e(`/api/admin/files?path=${encodeURIComponent(n)}`,{method:`DELETE`}),r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));if(!t.ok)throw Error(r.error??`HTTP ${t.status}`)}catch(e){Ze(e instanceof Error?e.message:String(e))}}N(e=>e+1),X(`action`)},[xt,w,e,X]),Tt=(0,v.useCallback)(async()=>{let e=xt();if(console.info(`[data-ui] op=share supported=${Y} count=${e.length}`),Y)try{let t=await Promise.all(e.map(async e=>{let t=w===`.`?e.name:`${w}/${e.name}`,n=`/api/admin/files/download?session_key=${encodeURIComponent(a)}&path=${encodeURIComponent(t)}`,r=await(await fetch(n)).blob();return new File([r],e.name,{type:r.type||`application/octet-stream`})}));navigator.canShare({files:t})&&await navigator.share({files:t})}catch(e){console.warn(`[data-ui] op=share-failed err=${e instanceof Error?e.message:String(e)}`)}},[xt,Y,w,a]),Et=(0,v.useCallback)(()=>{M.current?.click()},[]),Dt=(0,v.useCallback)((e,t={})=>{let n=(n,r,i)=>{let o=new URLSearchParams({session_key:a,path:w===`.`?``:w,filename:e.name});t.relpath&&o.set(`relpath`,t.relpath),t.token&&o.set(`token`,t.token);for(let[e,t]of Object.entries(r))o.set(e,t);return new Promise(t=>{let r=new XMLHttpRequest;r.open(`POST`,`/api/admin/files/upload?${o.toString()}`),r.setRequestHeader(`Content-Type`,e.type||`application/octet-stream`),i&&(r.upload.onprogress=e=>{e.lengthComputable&&i(e.loaded)}),r.onload=()=>{let e={};try{e=JSON.parse(r.responseText)}catch{}t({status:r.status,data:e})},r.onerror=()=>t({status:0,data:{}}),r.onabort=()=>t({status:0,data:{error:`aborted`}}),r.send(n)})};if(e.size<=ge)return n(e,{},n=>t.onProgress?.(n,e.size));let r=`${Date.now().toString(36)}-${Math.random().toString(16).slice(2,10)}`,i=Math.ceil(e.size/_e);return(async()=>{let a={status:0,data:{}};for(let o=0;o<i;o++){let s=o*_e;if(a=await n(e.slice(s,Math.min(s+_e,e.size)),{uploadId:r,seq:String(o),total:String(i)},n=>t.onProgress?.(s+n,e.size)),!(a.status>=200&&a.status<300))return a}return a})()},[a,w]),Ot=(0,v.useCallback)(async e=>{j(null),We(!0),A({loaded:0,total:e.size});try{let{status:t,data:n}=await Dt(e,{onProgress:(e,t)=>A({loaded:e,total:t})});t>=200&&t<300&&n.path?(Pe(n.path.split(`/`).slice(0,-1).join(`/`)||`.`),N(e=>e+1)):j(t===0?`Network error during upload — the connection failed before the server responded.`:n.error??`Upload failed (HTTP ${t}).`)}finally{We(!1),A(null),M.current&&(M.current.value=``)}},[Dt]),kt=(0,v.useCallback)(e=>{R&&Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),Ye(!0))},[R]),At=(0,v.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||Ye(!1)},[]),jt=(0,v.useCallback)(async e=>{e.preventDefault(),Ye(!1);let t=Math.random().toString(16).slice(2,10),n=Array.from(e.dataTransfer.items);if(console.info(`[data-ui] op=drop-received token=${t} items=${n.length}`),n.length===0)return;if(!R){console.info(`[data-ui] op=drop-rejected token=${t} reason=no-write`),j(`Open a folder inside your account to upload`);return}let r=n.map(e=>e.webkitGetAsEntry?.()).filter(e=>!!e);We(!0),j(null),qe(null);let i=performance.now();try{let e=await Ce(r),n=e.reduce((e,t)=>e+t.file.size,0),a=new Set(e.map(e=>e.relpath.split(`/`).slice(0,-1).join(`/`)).filter(Boolean)).size;console.info(`[data-ui] op=drop-walk token=${t} files=${e.length} dirs=${a} bytes=${n}`);let o=0,s=[];for(let n=0;n<e.length;n++){let{file:r,relpath:i}=e[n];console.info(`[data-ui] op=drop-file token=${t} rel="${i}" i=${n+1}/${e.length}`),A({loaded:0,total:r.size});let{status:a,data:c}=await Dt(r,{relpath:i,token:t,onProgress:(e,t)=>A({loaded:e,total:t})});if(a>=200&&a<300)o++,console.info(`[data-ui] op=drop-file-ok token=${t} rel="${i}"`);else{let e=a===0?`http=0`:we(a,c.error);s.push(`${i} (${e})`),console.info(`[data-ui] op=drop-file-skip token=${t} rel="${i}" reason=${e}`)}}let c=Math.round(performance.now()-i);console.info(`[data-ui] op=drop-done token=${t} uploaded=${o} skipped=${s.length} ms=${c}`),qe(`Uploaded ${o}, skipped ${s.length}${s.length?`: ${s.join(`, `)}`:``}`),N(e=>e+1)}catch(e){j(e instanceof Error?e.message:String(e))}finally{We(!1),A(null)}},[R,Dt]),Mt=(0,v.useCallback)(async()=>{let t=et.trim();if(t){L(null);try{let n=await e(`/api/admin/files/folder`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:w===`.`?``:w,name:t})}),r=await n.json().catch(()=>({error:`HTTP ${n.status}`}));if(!n.ok)throw Error(r.error??`HTTP ${n.status}`);P(!1),tt(``),N(e=>e+1)}catch(e){L(e instanceof Error?e.message:String(e))}}},[e,et,w]),Nt=(0,v.useCallback)(async()=>{if(!F)return;let t=nt.trim();if(!t)return;L(null);let n=w===`.`?F:`${w}/${F}`;try{let r=await e(`/api/admin/files/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,newName:t})}),i=await r.json().catch(()=>({error:`HTTP ${r.status}`}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);I(null),rt(``),X(`action`),N(e=>e+1)}catch(e){L(e instanceof Error?e.message:String(e))}},[e,nt,F,w,X]);(0,v.useEffect)(()=>{if(!z)return;let e=e=>{at.current&&!at.current.contains(e.target)&&B(!1)},t=e=>{e.key===`Escape`&&B(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[z]),(0,v.useEffect)(()=>{if(!V)return;let e=e=>{ot.current&&!ot.current.contains(e.target)&&H(!1)},t=e=>{e.key===`Escape`&&H(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[V]);let $=(0,v.useCallback)(e=>D.slice(0,e+1).map(e=>e.name).join(`/`),[D]),Pt=D.length>=2,Ft=Pt?[{name:`.`,label:`data`},...D.slice(0,D.length-2).map((e,t)=>({name:$(t),label:e.displayName??e.name}))]:[];return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`data-toolbar`,children:[K?(0,y.jsxs)(`button`,{type:`button`,className:`data-select-cancel`,onClick:()=>X(`cancel`),"aria-label":`Cancel selection`,children:[(0,y.jsx)(te,{size:14}),` Cancel`]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`data-search-input`,children:[d===``&&(0,y.jsx)(re,{size:14}),(0,y.jsx)(`input`,{ref:m,type:`text`,value:d,onChange:e=>f(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),b&&(0,y.jsx)(t,{size:14,className:`spin`}),d!==``&&(0,y.jsx)(`button`,{type:`button`,className:`data-search-inline-btn`,onClick:()=>{f(``),m.current?.focus()},title:`Clear search`,"aria-label":`Clear search`,children:(0,y.jsx)(te,{size:14})})]}),(0,y.jsxs)(`div`,{className:`data-toolbar-actions`,ref:ot,children:[(0,y.jsx)(`button`,{type:`button`,className:`data-action-overflow`,onClick:()=>H(e=>!e),"aria-haspopup":`menu`,"aria-expanded":V,"aria-label":`File actions`,title:`File actions`,children:(0,y.jsx)(c,{size:16})}),(0,y.jsxs)(`div`,{className:`data-action-group`,role:`group`,"aria-label":`File actions`,"data-open":V?`true`:void 0,children:[(0,y.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{lt(),H(!1)},disabled:O,title:`Refresh this folder`,"aria-label":`Refresh this folder`,children:[O?(0,y.jsx)(t,{size:16,className:`spin`}):(0,y.jsx)(n,{size:16}),(0,y.jsx)(`span`,{className:`data-action-label`,children:`Refresh`})]}),(0,y.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Et(),H(!1)},disabled:Ue||!R,title:R?`Upload a file`:`Open a folder inside your account to upload`,"aria-label":`Upload a file`,children:[Ue?k&&k.total>0?(0,y.jsxs)(`span`,{className:`data-upload-pct`,children:[Math.round(k.loaded/k.total*100),`%`]}):(0,y.jsx)(t,{size:16,className:`spin`}):(0,y.jsx)(de,{size:16}),(0,y.jsx)(`span`,{className:`data-action-label`,children:`Upload`})]}),(0,y.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{P(e=>!e),tt(``),L(null),H(!1)},disabled:Ue||!R,title:R?`New folder`:`Open a folder inside your account to create one`,"aria-label":`New folder`,children:[(0,y.jsx)(oe,{size:16}),(0,y.jsx)(`span`,{className:`data-action-label`,children:`New folder`})]}),(0,y.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{yt(E===`grid`?`list`:`grid`),H(!1)},title:E===`grid`?`List view`:`Grid view`,"aria-label":E===`grid`?`Switch to list view`:`Switch to grid view`,"aria-pressed":E===`grid`,children:[E===`grid`?(0,y.jsx)(le,{size:16}):(0,y.jsx)(ce,{size:16}),(0,y.jsx)(`span`,{className:`data-action-label`,children:E===`grid`?`List view`:`Grid view`})]})]})]})]}),(0,y.jsxs)(`div`,{className:`data-breadcrumbs`,children:[w!==`.`&&(0,y.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-back-btn`,onClick:dt,title:`Up one level`,"aria-label":`Up one level`,children:(0,y.jsx)(ae,{size:14})}),Pt?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`span`,{className:`data-crumb-wrap`,ref:at,children:[(0,y.jsx)(`button`,{type:`button`,className:`data-crumb data-crumb-ellipsis`,onClick:()=>B(e=>!e),"aria-haspopup":`menu`,"aria-expanded":z,"aria-label":`Show parent folders`,title:`Show parent folders`,children:`…`}),z&&(0,y.jsx)(`div`,{className:`data-crumb-menu`,role:`menu`,children:Ft.map(e=>(0,y.jsx)(`button`,{type:`button`,role:`menuitem`,className:`data-crumb-menu-item`,onClick:()=>G(e.name),title:e.label,children:e.label},e.name))})]}),[D.length-2,D.length-1].map(e=>{let t=D[e];return(0,y.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,y.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,y.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>G($(e)),title:t.name,children:t.displayName??t.name})]},$(e))})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>G(`.`),children:`data`}),D.map((e,t)=>(0,y.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,y.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,y.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>G($(t)),title:e.name,children:e.displayName??e.name})]},$(t)))]})]}),$e&&(0,y.jsxs)(`div`,{className:`data-inline-form`,children:[(0,y.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`Folder name`,value:et,autoFocus:!0,onChange:e=>tt(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Mt(),e.key===`Escape`&&P(!1)}}),(0,y.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Mt,children:`Create`}),(0,y.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>P(!1),children:`Cancel`})]}),F&&(0,y.jsxs)(`div`,{className:`data-inline-form`,children:[(0,y.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`New name`,value:nt,autoFocus:!0,onChange:e=>rt(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Nt(),e.key===`Escape`&&I(null)}}),(0,y.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Nt,children:`Rename`}),(0,y.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>I(null),children:`Cancel`})]}),it&&(0,y.jsx)(`div`,{className:`data-error`,children:it}),(0,y.jsx)(`input`,{type:`file`,ref:M,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&Ot(t)}})]}),(0,y.jsxs)(`div`,{className:`data-body`,"data-drag-active":Je?`true`:void 0,onDragEnter:kt,onDragOver:kt,onDragLeave:At,onDrop:jt,children:[(Se!==null||_!==null)&&(0,y.jsxs)(`section`,{className:`data-panel`,children:[Se&&(0,y.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,Se]}),st.length>0&&(0,y.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:st.map(e=>{let t=e===U;return(0,y.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>Ee(t?null:e),children:Oe([e])??e},e)})}),_&&!b&&(0,y.jsxs)(`div`,{className:`data-results-meta`,children:[W.length,` of `,_.length,` result`,_.length===1?``:`s`]}),_&&!b&&!U&&ke>0&&!C&&(0,y.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>Ne(!0),children:[ke,` low-confidence result`,ke===1?``:`s`,` hidden — show all`]}),_&&!b&&!U&&C&&(0,y.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>Ne(!1),children:`Showing all results — hide low-confidence`}),_&&_.length===0&&!b&&(0,y.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),W&&W.length>0&&(0,y.jsx)(`ul`,{className:`data-results`,children:W.map(e=>(0,y.jsx)(De,{hit:e,mode:pe,onDownload:ct,onLocate:ut},e.nodeId))})]}),(0,y.jsxs)(`section`,{className:`data-panel`,children:[k&&(0,y.jsxs)(`div`,{className:`data-upload-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":k.total>0?Math.round(k.loaded/k.total*100):void 0,children:[(0,y.jsx)(`div`,{className:`data-upload-progress-track`,children:(0,y.jsx)(`div`,{className:`data-upload-progress-fill`,style:{width:`${k.total>0?Math.round(k.loaded/k.total*100):0}%`}})}),(0,y.jsxs)(`span`,{className:`data-upload-progress-label`,children:[`Uploading… `,k.total>0?`${Math.round(k.loaded/k.total*100)}%`:``]})]}),Ge&&(0,y.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,Ge]}),Ke&&(0,y.jsx)(`div`,{className:`data-status`,children:Ke}),Xe&&(0,y.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,Xe]}),Ve&&(0,y.jsx)(`div`,{className:`data-error`,children:Ve}),O&&(0,y.jsxs)(`div`,{className:`data-loading`,children:[(0,y.jsx)(t,{size:14,className:`spin`}),` Loading…`]}),!K&&!O&&T&&T.length>0&&(0,y.jsxs)(`div`,{className:`data-select-hint`,children:[(0,y.jsx)(ue,{size:13}),(0,y.jsx)(`span`,{children:`Press and hold a file to select, rename, or delete it.`})]}),!O&&T&&T.length===0&&!Ve&&(0,y.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!O&&T&&T.length>0&&E===`grid`&&(0,y.jsx)(`ul`,{className:`data-grid`,children:T.map(e=>{let t=e.displayName??e.name,n=K&&q.has(e.name);if(e.kind===`directory`)return(0,y.jsx)(`li`,{className:`data-grid-cell`,"data-selected":n?`true`:void 0,children:(0,y.jsxs)(`button`,{type:`button`,className:`data-grid-tile`,onPointerDown:()=>_t(e.name),onPointerUp:Q,onPointerMove:Q,onPointerLeave:Q,onPointerCancel:Q,onClick:()=>{if(J.current){J.current=!1;return}if(K){Z(e.name);return}G(w===`.`?e.name:`${w}/${e.name}`)},children:[K&&(0,y.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,y.jsx)(se,{size:28,className:`data-grid-glyph`}),(0,y.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:t})]})},e.name);if(e.kind===`file`){let r=me(e.name),i=w===`.`?e.name:`${w}/${e.name}`;return(0,y.jsx)(`li`,{className:`data-grid-cell`,"data-selected":n?`true`:void 0,children:(0,y.jsxs)(`button`,{type:`button`,className:`data-grid-tile${r?` data-grid-tile-image`:``}`,onPointerDown:()=>_t(e.name),onPointerUp:Q,onPointerMove:Q,onPointerLeave:Q,onPointerCancel:Q,onClick:()=>r?bt(e):vt(e),title:K?void 0:r?`Preview ${t}`:`Download ${t}`,children:[K&&(0,y.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),r?(0,y.jsx)(`img`,{className:`data-grid-thumb`,src:h(a,i),alt:t,loading:`lazy`,onError:()=>console.warn(`[data] op=thumb-error path=${i}`)}):(0,y.jsx)(o,{size:28,className:`data-grid-glyph`}),(0,y.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:t}),!r&&(0,y.jsx)(`span`,{className:`data-grid-sub`,children:je(e.sizeBytes)})]})},e.name)}return(0,y.jsx)(`li`,{className:`data-grid-cell`,children:(0,y.jsxs)(`div`,{className:`data-grid-tile data-entry-disabled`,children:[(0,y.jsx)(o,{size:28,className:`data-grid-glyph`}),(0,y.jsx)(`span`,{className:`data-grid-label`,children:t}),(0,y.jsx)(`span`,{className:`data-grid-sub`,children:`special`})]})},e.name)})}),!O&&T&&T.length>0&&E===`list`&&(0,y.jsx)(`ul`,{className:`data-entries`,children:T.map(e=>{let t=e.displayName??e.name;if(e.kind===`directory`){let n=K&&q.has(e.name);return(0,y.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,y.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onPointerDown:()=>_t(e.name),onPointerUp:Q,onPointerMove:Q,onPointerLeave:Q,onPointerCancel:Q,onClick:()=>{if(J.current){J.current=!1;return}if(K){Z(e.name);return}G(w===`.`?e.name:`${w}/${e.name}`)},children:[K&&(0,y.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,y.jsx)(se,{size:14}),(0,y.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t})]})},e.name)}if(e.kind===`file`){let n=K&&q.has(e.name);return(0,y.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,y.jsxs)(`button`,{type:`button`,className:`data-entry-btn data-entry-file`,onPointerDown:()=>_t(e.name),onPointerUp:Q,onPointerMove:Q,onPointerLeave:Q,onPointerCancel:Q,onClick:()=>vt(e),title:K?void 0:`Download ${t}`,children:[K&&(0,y.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,y.jsxs)(`span`,{className:`data-entry-text`,children:[(0,y.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t}),(0,y.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${Me(e.modifiedAt)}`,children:[je(e.sizeBytes),` · `,Me(e.modifiedAt)]})]})]})},e.name)}return(0,y.jsx)(`li`,{className:`data-entry`,children:(0,y.jsx)(`div`,{className:`data-entry-btn data-entry-file data-entry-disabled`,children:(0,y.jsxs)(`span`,{className:`data-entry-text`,children:[(0,y.jsx)(`span`,{className:`data-entry-name`,children:t}),(0,y.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})})},e.name)})})]})]}),K&&(0,y.jsx)(`div`,{className:`data-select-bar`,role:`toolbar`,"aria-label":`Selection actions`,children:(0,y.jsxs)(`div`,{className:`data-select-bar-inner`,children:[(0,y.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Tt,disabled:!Y||q.size===0,title:Y?`Share selected files`:`Sharing is not supported on this device`,children:[(0,y.jsx)(r,{size:16}),` Share`]}),(0,y.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Ct,disabled:q.size===0,children:[(0,y.jsx)(i,{size:16}),` Download`]}),(0,y.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:()=>{let e=[...q][0];e&&(I(e),rt(e))},disabled:q.size!==1,children:[(0,y.jsx)(s,{size:16}),` Rename`]}),(0,y.jsxs)(`button`,{type:`button`,className:`data-select-action data-select-delete`,onClick:wt,disabled:q.size===0,children:[(0,y.jsx)(u,{size:16}),` Delete`]})]})}),Le&&(0,y.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":Le.alt,onClick:()=>Re(null),children:(0,y.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:Le.src,alt:Le.alt})})]})}function Te({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){(0,v.useEffect)(()=>{console.info(`[data-ui] op=mount header=operator home=absent`)},[]);let r=(0,v.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),i=(0,v.useCallback)(e=>{e===`chat`&&(window.location.href=`/`)},[]),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(`files`),{subAccounts:l,activeAccountId:u,switching:d,switchAccount:f}=g(t);(0,v.useEffect)(()=>{if(!t)return;let e=!1;return fetch(`/api/whatsapp-reader/conversations?session_key=${encodeURIComponent(t)}`).then(e=>e.ok?e.json():{conversations:[]}).then(t=>{e||o(t.conversations??[])}).catch(()=>{}),()=>{e=!0}},[t]);let p=(0,v.useMemo)(()=>[...new Set(a.map(e=>e.channel))],[a]);return(0,y.jsxs)(`main`,{className:`data-main`,children:[(0,y.jsx)(ne,{variant:`operator`,onNavigate:i,conversationsCount:a.length,conversationsChannels:p,onOpenConversations:()=>c(`conversations`),onToggleSidebar:()=>{},sidebarOpen:!1,onLogout:r,onDisconnect:async()=>!0,disconnecting:!1,subAccounts:l,activeAccountId:u,switchingAccount:d,onSwitchAccount:f}),s===`conversations`?(0,y.jsx)(m,{conversations:a,sessionKey:t,onBack:()=>c(`files`)}):(0,y.jsx)(S,{adminFetch:e,cacheKey:t,sessionRefetchNonce:n})]})}function Ee({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=a({initialCacheKey:e,surface:`data`});return(0,y.jsx)(`div`,{className:`data-page`,children:(0,y.jsx)(`main`,{className:`data-main`,children:(0,y.jsx)(S,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})})})}function De({hit:e,mode:t,onDownload:n,onLocate:r}){let i=ke(e.properties),a=Ae(e.properties),o=Oe(e.labels),s=C(e.properties),[c,l]=(0,v.useState)(!1),u=a&&a.length>280,d=c||!u?a:a?.slice(0,280)+`…`,f=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`,p=e.properties.relativePath,ee=typeof p==`string`&&p.length>0,m=ee?p.lastIndexOf(`/`):-1,h=ee?m===-1?`data`:p.slice(0,m):null;return(0,y.jsxs)(`li`,{className:`data-result`,children:[(0,y.jsxs)(`div`,{role:`button`,tabIndex:0,className:`data-result-open`,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},"aria-label":`Download ${i??o??`file`}`,children:[o&&(0,y.jsx)(`div`,{className:`data-result-header`,children:(0,y.jsx)(`span`,{className:`data-result-labels`,children:o})}),i&&(0,y.jsx)(`div`,{className:`data-result-title`,children:i}),a&&(0,y.jsx)(`pre`,{className:`data-result-body`,children:d}),(0,y.jsxs)(`div`,{className:`data-result-scores`,children:[s&&(0,y.jsxs)(`span`,{className:`data-result-updated`,children:[`Updated `,Me(s),` · `]}),f]})]}),ee&&(0,y.jsxs)(`button`,{type:`button`,className:`data-result-locate`,onClick:()=>r(e),title:`Locate in ${h}`,"aria-label":`Locate in ${h}`,children:[(0,y.jsx)(se,{size:12}),h]}),u&&(0,y.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>l(e=>!e),children:c?`Show less`:`Show more`})]})}function Oe(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function ke(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function Ae(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function C(e){for(let t of[`updatedAt`,`modifiedAt`,`fetchedAt`,`createdAt`,`lastModified`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function je(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function Me(e){try{let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n=typeof navigator<`u`?navigator.languages&&navigator.languages.length>0?[...navigator.languages]:[navigator.language]:void 0;return t.toLocaleString(n,{dateStyle:`medium`,timeStyle:`short`})}catch{return`—`}}export{Ee as n,ye as t};
|