@fgbg/mdocs 0.8.16 → 0.8.18
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/README.md +114 -76
- package/agent-skills/changelog/SKILL.md +15 -1
- package/agent-skills/index/SKILL.md +1 -1
- package/agent-skills/index.json +4 -4
- package/agent-skills/usage-agent-dev-loop/SKILL.md +7 -7
- package/agent-skills/usage-onboarding-ai/SKILL.md +98 -29
- package/agent-skills/usage-settings/SKILL.md +4 -4
- package/dist/server/agent/Agent/almost-empty.js +15 -0
- package/dist/server/agent/Agent/almost-empty.js.map +1 -0
- package/dist/server/agent/Agent/almost-empty.test.js +20 -0
- package/dist/server/agent/Agent/almost-empty.test.js.map +1 -0
- package/dist/server/agent/Agent/choice-pending.js +71 -0
- package/dist/server/agent/Agent/choice-pending.js.map +1 -0
- package/dist/server/agent/Agent/choice-pending.test.js +58 -0
- package/dist/server/agent/Agent/choice-pending.test.js.map +1 -0
- package/dist/server/agent/Agent/run.js +49 -3
- package/dist/server/agent/Agent/run.js.map +1 -1
- package/dist/server/agent/Agent/system-prompt.js +6 -5
- package/dist/server/agent/Agent/system-prompt.js.map +1 -1
- package/dist/server/agent/Agent/tools-account.js +16 -3
- package/dist/server/agent/Agent/tools-account.js.map +1 -1
- package/dist/server/agent/Agent/tools-choice.js +70 -0
- package/dist/server/agent/Agent/tools-choice.js.map +1 -0
- package/dist/server/agent/Agent/tools-coding.js +6 -3
- package/dist/server/agent/Agent/tools-coding.js.map +1 -1
- package/dist/server/agent/Agent/tools-overwrite.js +158 -0
- package/dist/server/agent/Agent/tools-overwrite.js.map +1 -0
- package/dist/server/routes/agent.routes.js +54 -0
- package/dist/server/routes/agent.routes.js.map +1 -1
- package/dist/server/search/document-index-manager.js +11 -8
- package/dist/server/search/document-index-manager.js.map +1 -1
- package/dist/web/assets/AgentChatPanel-DHy3KgSW.js +1 -0
- package/dist/web/assets/AiWriteWorkbench-Ce_OaED4.js +6 -0
- package/dist/web/assets/DocumentEditor-B2H3rHSg.js +21 -0
- package/dist/web/assets/{MergeView-BqQuuHxp.js → MergeView-Cy4Pi3Je.js} +2 -2
- package/dist/web/assets/PlaygroundPage-hHfIzPO5.js +8 -0
- package/dist/web/assets/SettingsPage-BRAPdqW9.js +1 -0
- package/dist/web/assets/Toolbar-DPkTtGNL.js +126 -0
- package/dist/web/assets/VisitorPickerModal-CJ0K2gj8.js +1 -0
- package/dist/web/assets/copy-DCKasK29.js +11 -0
- package/dist/web/assets/diagram-BJFhx-27.js +3016 -0
- package/dist/web/assets/editor-BBXgdU3Q.js +16 -0
- package/dist/web/assets/history-BQkmetJ0.js +6 -0
- package/dist/web/assets/index-BksNm27A.css +1 -0
- package/dist/web/assets/index-CA7lpALZ.js +185 -0
- package/dist/web/assets/motion-D-I76zAi.js +8 -0
- package/dist/web/assets/plus-B2rZTPWV.js +6 -0
- package/dist/web/assets/react-CQByW0Rg.js +2236 -0
- package/dist/web/assets/react-vendor-BNpqFP9B.js +242 -0
- package/dist/web/assets/ui-C3xtW1w8.js +3126 -0
- package/dist/web/index.html +28 -3
- package/package.json +1 -1
- package/dist/web/assets/_baseUniq-CTLDRefi.js +0 -1
- package/dist/web/assets/arc-C6HVu_cL.js +0 -1
- package/dist/web/assets/architectureDiagram-Q4EWVU46-BGZyIwfI.js +0 -36
- package/dist/web/assets/blockDiagram-DXYQGD6D-BnmQmYk5.js +0 -132
- package/dist/web/assets/c4Diagram-AHTNJAMY-D5ZSFyGW.js +0 -10
- package/dist/web/assets/channel-ComR_5wI.js +0 -1
- package/dist/web/assets/chunk-4BX2VUAB-bB7dqglW.js +0 -1
- package/dist/web/assets/chunk-4TB4RGXK-DLOuFWAV.js +0 -206
- package/dist/web/assets/chunk-55IACEB6-F-vn8P_5.js +0 -1
- package/dist/web/assets/chunk-EDXVE4YY-DJggdpTr.js +0 -1
- package/dist/web/assets/chunk-FMBD7UC4-CGFWLCLP.js +0 -15
- package/dist/web/assets/chunk-OYMX7WX6-nDiR5vU7.js +0 -231
- package/dist/web/assets/chunk-QZHKN3VN-D29FhQRL.js +0 -1
- package/dist/web/assets/chunk-YZCP3GAM-BmFALtIq.js +0 -1
- package/dist/web/assets/classDiagram-6PBFFD2Q-CxGT_r56.js +0 -1
- package/dist/web/assets/classDiagram-v2-HSJHXN6E-CxGT_r56.js +0 -1
- package/dist/web/assets/clone-J85LHgdR.js +0 -1
- package/dist/web/assets/cose-bilkent-S5V4N54A-J4Iar7P4.js +0 -1
- package/dist/web/assets/cytoscape.esm-BiciSPf8.js +0 -331
- package/dist/web/assets/dagre-KV5264BT-Cg07vwKD.js +0 -4
- package/dist/web/assets/defaultLocale-DX6XiGOO.js +0 -1
- package/dist/web/assets/diagram-5BDNPKRD-D0FP-ifV.js +0 -10
- package/dist/web/assets/diagram-G4DWMVQ6-CNejTsu2.js +0 -24
- package/dist/web/assets/diagram-MMDJMWI5-DEQjM6f7.js +0 -43
- package/dist/web/assets/diagram-TYMM5635-CRGZl6sR.js +0 -24
- package/dist/web/assets/erDiagram-SMLLAGMA-BGOATwuq.js +0 -85
- package/dist/web/assets/flowDiagram-DWJPFMVM-DVHizH8q.js +0 -162
- package/dist/web/assets/ganttDiagram-T4ZO3ILL-dLF_Rbaw.js +0 -292
- package/dist/web/assets/gitGraphDiagram-UUTBAWPF-BNMxCpkL.js +0 -106
- package/dist/web/assets/graph-p7_cO2pv.js +0 -1
- package/dist/web/assets/index-5eJ_7IuO.css +0 -1
- package/dist/web/assets/index-DoJ58x_f.js +0 -6291
- package/dist/web/assets/infoDiagram-42DDH7IO-BDffsV8g.js +0 -2
- package/dist/web/assets/ishikawaDiagram-UXIWVN3A-C7fw-Hwt.js +0 -70
- package/dist/web/assets/journeyDiagram-VCZTEJTY-CuEYHG93.js +0 -139
- package/dist/web/assets/kanban-definition-6JOO6SKY-iodYb2rc.js +0 -89
- package/dist/web/assets/layout-Dblo7Nv4.js +0 -1
- package/dist/web/assets/linear-Dj7ICVZv.js +0 -1
- package/dist/web/assets/min-BC0MiAVU.js +0 -1
- package/dist/web/assets/mindmap-definition-QFDTVHPH-Bi8kR-nH.js +0 -96
- package/dist/web/assets/pieDiagram-DEJITSTG-DFXNJaaz.js +0 -30
- package/dist/web/assets/quadrantDiagram-34T5L4WZ-eG750Sg7.js +0 -7
- package/dist/web/assets/requirementDiagram-MS252O5E-BOS23lbk.js +0 -84
- package/dist/web/assets/sankeyDiagram-XADWPNL6-iuLPdF16.js +0 -10
- package/dist/web/assets/sequenceDiagram-FGHM5R23-9dOhL1F_.js +0 -157
- package/dist/web/assets/stateDiagram-FHFEXIEX-DiYubp3u.js +0 -1
- package/dist/web/assets/stateDiagram-v2-QKLJ7IA2-C0u2afgY.js +0 -1
- package/dist/web/assets/timeline-definition-GMOUNBTQ-B7K2SCHF.js +0 -120
- package/dist/web/assets/vennDiagram-DHZGUBPP-DwsDXISO.js +0 -34
- package/dist/web/assets/wardley-RL74JXVD-DOtyNPcb.js +0 -162
- package/dist/web/assets/wardleyDiagram-NUSXRM2D-IO3BUkVB.js +0 -20
- package/dist/web/assets/xychartDiagram-5P7HB3ND-B_eC9Ig0.js +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,j as e}from"./react-vendor-BNpqFP9B.js";import{b as Z,q as $e,s as We,D as Ue,l as ie,t as _e,v as He,w as _,x as ce,y as qe,z as Ge,A as Ze,a as Je,d as je,B as be,C as ve,E as Qe,G as Xe,H as Ye,I as es,J as ss,K as ke,L as ne,N as ts,O as as,P as ns,Q as is,R as cs,f as ls,T as os,U as rs,V as ds,W as ms,X as us,i as hs,Y as ps,Z as gs,_ as fs,$ as xs,a0 as js,a1 as ys,a2 as Ns,a3 as bs,a4 as vs,r as ks,j as ws,a5 as Ss,n as Cs,o as Ds}from"./index-CA7lpALZ.js";import{V as we,a as Is,M as Ts}from"./VisitorPickerModal-CJ0K2gj8.js";import"./ui-C3xtW1w8.js";import"./motion-D-I76zAi.js";function As({draft:t,onClose:s,onSuccess:y}){const{t:u,lang:m}=Z(),[E,p]=a.useState([]),[k,N]=a.useState(t.domainId??""),[C,i]=a.useState([]),[v,g]=a.useState(""),[o,x]=a.useState(`${t.displayName||"untitled"}_recovered.md`),[h,V]=a.useState(!1),[I,z]=a.useState(null),D=a.useRef(null),M=a.useRef(!0);a.useEffect(()=>(M.current=!0,()=>{M.current=!1}),[]),a.useEffect(()=>{$e().then(f=>{M.current&&p(f)})},[]),a.useEffect(()=>{k&&(i([]),g(""),We(k).then(f=>{M.current&&i(f)}).catch(()=>{M.current&&i([])}))},[k]),a.useEffect(()=>{const f=window.setTimeout(()=>{var A;return(A=D.current)==null?void 0:A.focus()},0);return()=>window.clearTimeout(f)},[]),a.useEffect(()=>{const f=A=>{A.key==="Escape"&&s()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s]);function F(f,A){for(const w of f){if(w.type==="folder"&&w.path===A)return w.documentId;if(w.type==="folder"){const S=F(w.children,A);if(S)return S}}return null}async function L(f){f.preventDefault(),V(!0),z(null);const A=o.replace(/\s+/g,"_").replace(/[^a-zA-Z0-9_\-.]/g,""),w=A.endsWith(".md")?A:A+".md",S=w.replace(/\.md$/i,"");try{const P=v?`${v}/${w}`:w,c=v?F(C,v)??void 0:void 0;await He({fileName:w,displayName:S,content:t.content,domainId:k,parentId:c}),y()}catch(P){z(_(u,P))}finally{V(!1)}}return e.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:f=>{f.target===f.currentTarget&&!h&&s()},children:e.jsxs("div",{className:"mdocs-dialog card mdocs-recovery-dialog",role:"dialog","aria-modal":"true",children:[e.jsx("h1",{children:u("recoverDraft")}),e.jsx("p",{className:"muted",children:u("recoverDraftDesc",{name:t.displayName||u("unknownTitle")})}),e.jsxs("form",{onSubmit:L,className:"mdocs-dialog-form",children:[e.jsxs("label",{className:"mdocs-dialog-label",children:[u("domainLabel"),E.length>0&&e.jsx(Ue,{domains:E,value:k,onChange:N,onDomainsChange:p,ariaLabel:u("domainLabel"),localizeName:f=>ie(f,m,u)})]}),e.jsxs("label",{className:"mdocs-dialog-label mdocs-recovery-tree-label",children:[u("recoverTargetFolder"),e.jsx("div",{className:"mdocs-recovery-tree",children:e.jsx(_e,{nodes:C,activeDocumentId:null,selectedParentPath:v,onOpen:()=>{},onOpenFolder:f=>g(f),onContextMenu:()=>{},onDeselect:()=>g("")})})]}),e.jsxs("label",{className:"mdocs-dialog-label",children:[u("fileNameLabel"),e.jsx("input",{ref:D,value:o,onChange:f=>x(f.target.value),placeholder:"recovered.md",maxLength:200,disabled:h})]}),I&&e.jsx("div",{className:"mdocs-dialog-error",children:I}),e.jsxs("div",{className:"mdocs-dialog-actions",children:[e.jsx("button",{type:"button",onClick:()=>!h&&s(),disabled:h,children:u("cancel")}),e.jsx("button",{type:"submit",className:"primary",disabled:h,children:u(h?"creating":"create")})]})]})]})})}function Ps({onPublish:t,onClose:s,onCountChange:y,onRecover:u}){const{t:m}=Z(),[E,p]=a.useState([]),[k,N]=a.useState(new Set),[C,i]=a.useState(!1),[v,g]=a.useState(null),[o,x]=a.useState(null),[h,V]=a.useState(null),I=a.useRef(null),z=a.useRef(!0);a.useEffect(()=>(z.current=!0,ce().then(c=>{if(!z.current)return;const d=c.filter(j=>!j.published);p(d),y==null||y(d.length)}),()=>{z.current=!1,I.current&&(clearTimeout(I.current),I.current=null)}),[]),a.useEffect(()=>{const c=d=>{d.key==="Escape"&&s()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s]);const D=a.useCallback((c,d)=>{V({message:c,type:d}),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>V(null),3e3)},[]);async function M(c){await Ge(c),N(d=>new Set(d).add(c));try{await t(c),p(d=>{const j=d.filter(R=>R.documentId!==c);return y==null||y(j.length),j}),D(m("published"),"success")}catch(d){d instanceof Ze||D(m("publishFailed"),"error");const j=await Je(c);j&&p(R=>R.map(O=>O.documentId===c?j:O))}finally{N(d=>{const j=new Set(d);return j.delete(c),j})}}async function F(c){g(null),await je(c),p(d=>{const j=d.filter(R=>R.documentId!==c);return y==null||y(j.length),j}),D(m("draftDeleted"),"success")}function L(c){const d=E.find(j=>j.documentId===c);d&&x(d)}function f(c){x(null),je(c),p(d=>{const j=d.filter(R=>R.documentId!==c);return y==null||y(j.length),j}),u==null||u(E.find(d=>d.documentId===c)),D(m("published"),"success")}async function A(){i(!0);let c=0,d=0;for(const O of E)try{await t(O.documentId),c++}catch{d++}const R=(await ce()).filter(O=>!O.published);p(R),y==null||y(R.length),d===0?D(m("publishAll"),"success"):D(`${c} published, ${d} failed`,"error"),i(!1)}const w=c=>new Date(c).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),S=c=>qe(m,c,c.publishError??"UNKNOWN"),P=E;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mdocs-drawer-overlay",onClick:s}),e.jsxs("div",{className:"mdocs-drawer",role:"dialog","aria-modal":"true",children:[e.jsxs("header",{className:"mdocs-drawer-header",children:[e.jsxs("div",{className:"mdocs-drawer-header-text",children:[e.jsxs("h2",{className:"mdocs-drawer-title",children:[m("unpublishedDrafts"),P.length>0&&e.jsx("span",{className:"mdocs-drawer-count-badge",children:P.length})]}),e.jsx("span",{className:"mdocs-drawer-subtitle",children:m("draftCount",{count:String(P.length)})})]}),e.jsx("button",{type:"button",className:"mdocs-drawer-close-btn",onClick:s,"aria-label":m("close"),children:"×"})]}),e.jsx("div",{className:"mdocs-drawer-body",children:P.length===0?e.jsxs("div",{className:"mdocs-drawer-empty",children:[e.jsx("div",{className:"mdocs-drawer-empty-icon","aria-hidden":"true",children:"✓"}),e.jsx("p",{className:"mdocs-drawer-empty-text",children:m("draftsEmptyState")})]}):e.jsx("div",{className:"mdocs-drawer-items",children:P.map(c=>{const d=!!c.publishError;return e.jsxs("div",{className:d?"mdocs-drawer-item mdocs-drawer-item-failed":"mdocs-drawer-item",children:[e.jsx("div",{className:"mdocs-drawer-item-icon","aria-hidden":"true",children:"📄"}),e.jsxs("div",{className:"mdocs-drawer-item-info",children:[e.jsx("span",{className:"mdocs-drawer-item-name",children:c.displayName||m("unknownTitle")}),d?e.jsxs("span",{className:"mdocs-drawer-item-error",children:[w(c.publishErrorAt)," · ",S(c)]}):e.jsxs("span",{className:"mdocs-drawer-item-meta",children:[w(c.updatedAt)," · ",m("localSnapshot")]})]}),e.jsxs("div",{className:"mdocs-drawer-item-actions",children:[d?e.jsx("button",{type:"button",className:"mdocs-btn-ghost mdocs-btn-ghost-primary",disabled:C,onClick:()=>L(c.documentId),children:m("recoverDraft")}):e.jsx("button",{type:"button",className:"mdocs-btn-ghost mdocs-btn-ghost-primary",disabled:k.has(c.documentId)||C,onClick:()=>void M(c.documentId),children:k.has(c.documentId)?m("publishing"):m("publish")}),e.jsx("button",{type:"button",className:"mdocs-btn-ghost mdocs-btn-ghost-danger",disabled:C,onClick:()=>g(c.documentId),children:m("delete")})]})]},c.documentId)})})}),e.jsxs("footer",{className:"mdocs-drawer-footer",children:[e.jsx("button",{type:"button",onClick:s,children:m("close")}),e.jsx("button",{type:"button",className:"primary",disabled:P.length===0||C,onClick:()=>void A(),children:C?m("publishing"):`${m("publishAll")} (${P.length})`})]}),h&&e.jsx("div",{className:"mdocs-drawer-toast mdocs-drawer-toast--"+h.type,role:"status",children:h.message})]}),v&&e.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:c=>{c.target===c.currentTarget&&g(null)},children:e.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true",children:[e.jsx("h1",{children:m("delete")}),e.jsx("p",{className:"muted",children:m("confirmDeleteDraft")}),e.jsxs("div",{className:"mdocs-dialog-actions",children:[e.jsx("button",{type:"button",onClick:()=>g(null),children:m("cancel")}),e.jsx("button",{type:"button",className:"danger",onClick:()=>void F(v),children:m("delete")})]})]})}),o&&e.jsx(As,{draft:o,onClose:()=>x(null),onSuccess:()=>f(o.documentId)})]})}function Ms(){const{t,lang:s}=Z(),y=be(),u=a.useRef(!1),[m,E]=a.useState([]),[p,k]=a.useState(!1),[N,C]=a.useState(""),[i,v]=a.useState("restricted"),[g,o]=a.useState(!1),[x,h]=a.useState(null),[V,I]=a.useState(null),[z,D]=a.useState(""),[M,F]=a.useState(""),[L,f]=a.useState("all"),[A,w]=a.useState(null);a.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]);const S=a.useCallback(async()=>{k(!0),h(null);try{const r=await ve();if(!u.current)return;E(r)}catch(r){if(!u.current)return;h(_(t,r))}finally{u.current&&k(!1)}},[t]);a.useEffect(()=>{S()},[S]);async function P(r){if(r.preventDefault(),!N.trim()){h(t("domainNameRequired"));return}o(!0),h(null);try{if(await ss({domainName:N.trim(),permission:i}),!u.current)return;C(""),v("restricted"),await S()}catch(K){if(!u.current)return;h(_(t,K))}finally{u.current&&o(!1)}}async function c(r){if(z.trim()){h(null);try{if(await es(r,z.trim()),!u.current)return;I(null),w(null),await S()}catch(K){if(!u.current)return;h(_(t,K))}}}function d(r){I(r.domainId),D(r.domainName),w(null)}function j(){I(null),w(null)}async function R(r,K){h(null);try{if(await Ye(r,K),!u.current)return;w(null),await S()}catch($){if(!u.current)return;h(_(t,$))}}async function O(r){if(window.confirm(t("deleteDomainConfirmDetail",{name:r.domainName,count:String(r.docCount)}))){h(null);try{if(await Xe(r.domainId),!u.current)return;await S()}catch(K){if(!u.current)return;h(_(t,K))}}}const H=a.useCallback(r=>Qe(r,t),[t]),q=a.useCallback(r=>ie(r.domainName,s,t),[s,t]),G=a.useMemo(()=>{const r=M.trim().toLowerCase();return m.filter(K=>L!=="all"&&K.permission!==L?!1:r?ie(K.domainName,s,t).toLowerCase().includes(r)||K.domainName.toLowerCase().includes(r):!0)},[m,M,L,s,t]),b=a.useCallback((r,K)=>{const $=H(r.permission);return K?`${$} ${t("domainTypeBuiltinSuffix")}`:$},[H,t]);return{domains:m,loadingDomains:p,domainError:x,newDomainName:N,setNewDomainName:C,newDomainPermission:i,setNewDomainPermission:v,creating:g,handleCreateDomain:P,renamingId:V,setRenamingId:I,renameDraft:z,setRenameDraft:D,startRename:d,cancelRename:j,handleRename:c,changeTypeForId:A,setChangeTypeForId:w,handlePermissionChange:R,handleDelete:O,domainSearch:M,setDomainSearch:F,domainFilter:L,setDomainFilter:f,filteredDomains:G,visitorId:y,plabel:H,localizeDomain:q,domainTypeLabel:b}}function Es(){const{t}=Z(),s=Ms(),[y,u]=a.useState([]),[m,E]=a.useState(null),[p,k]=a.useState(null),N=a.useCallback(async()=>{try{const i=await ke();u(i)}catch{u([])}},[]);a.useEffect(()=>{N()},[N]);async function C(i){E(null);try{const v=await cs(i.domainId);k({domainId:i.domainId,creatorVisitorId:i.creatorVisitorId,initialIds:v.map(g=>g.visitorId),memberRows:v})}catch(v){E({kind:"err",text:_(t,v)})}}return e.jsxs("div",{className:"mdocs-settings",children:[e.jsx("div",{className:"mdocs-settings-header",children:e.jsx("h2",{className:"mdocs-settings-title",children:t("domainManagement")})}),e.jsx("p",{className:"mdocs-domain-mgmt-restricted-hint",children:t("domainMgmtRestrictedMemberHint")}),e.jsxs("div",{className:"mdocs-settings-cards",children:[e.jsxs("div",{className:"mdocs-settings-card mdocs-domain-mgmt-create",children:[e.jsx("div",{className:"mdocs-settings-card-title",children:t("createDomain")}),e.jsxs("form",{onSubmit:s.handleCreateDomain,className:"mdocs-domain-mgmt-create-form",children:[e.jsxs("label",{className:"mdocs-domain-mgmt-field",children:[e.jsx("span",{className:"mdocs-domain-mgmt-label",children:t("domainName")}),e.jsx("input",{value:s.newDomainName,onChange:i=>s.setNewDomainName(i.target.value),placeholder:t("domainName"),maxLength:100,disabled:s.creating,className:"mdocs-domain-name-input"})]}),e.jsxs("fieldset",{className:"mdocs-domain-mgmt-fieldset",children:[e.jsx("legend",{className:"mdocs-domain-mgmt-label",children:t("domainPermission")}),e.jsx("div",{className:"mdocs-domain-mgmt-type-radios",children:ne.map(i=>e.jsxs("label",{className:"mdocs-domain-mgmt-radio",children:[e.jsx("input",{type:"radio",name:"newDomainPermission",checked:s.newDomainPermission===i,onChange:()=>s.setNewDomainPermission(i),disabled:s.creating}),e.jsx("span",{children:s.plabel(i)})]},i))})]}),e.jsx("button",{type:"submit",className:"primary mdocs-domain-mgmt-submit",disabled:s.creating,children:s.creating?t("creating"):t("create")})]})]}),m&&e.jsx("div",{className:"mdocs-settings-card",style:{color:m.kind==="ok"?"var(--mdocs-success, #0a7)":"var(--mdocs-danger)"},children:e.jsx("span",{className:"mdocs-settings-item-desc",children:m.text})}),s.domainError&&e.jsx("div",{className:"mdocs-settings-card mdocs-domain-error",children:e.jsx("span",{className:"mdocs-settings-item-desc",style:{color:"var(--mdocs-danger)"},children:s.domainError})}),e.jsxs("div",{className:"mdocs-settings-card mdocs-domain-mgmt-toolbar",children:[e.jsx("input",{type:"search",value:s.domainSearch,onChange:i=>s.setDomainSearch(i.target.value),placeholder:t("domainSearchPlaceholder"),className:"mdocs-domain-mgmt-search","aria-label":t("domainSearchPlaceholder")}),e.jsx("div",{className:"mdocs-domain-mgmt-filters",role:"group","aria-label":t("domainPermission"),children:["all",...ne].map(i=>e.jsx("button",{type:"button",className:"mdocs-domain-mgmt-filter"+(s.domainFilter===i?" active":""),"aria-pressed":s.domainFilter===i,onClick:()=>s.setDomainFilter(i),children:i==="all"?t("domainFilterAll"):s.plabel(i)},i))})]}),s.loadingDomains?e.jsx("div",{className:"mdocs-settings-card",children:e.jsx("span",{className:"mdocs-settings-item-desc",children:t("loading")})}):s.domains.length===0?e.jsx("div",{className:"mdocs-settings-card mdocs-settings-draft-empty",children:e.jsx("span",{className:"mdocs-settings-item-desc",children:t("noDomains")})}):s.filteredDomains.length===0?e.jsx("div",{className:"mdocs-settings-card mdocs-settings-draft-empty",children:e.jsx("span",{className:"mdocs-settings-item-desc",children:t("domainNoMatch")})}):e.jsx("div",{className:"mdocs-settings-card mdocs-domain-table-wrap",children:e.jsxs("table",{className:"mdocs-domain-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:t("domainColName")}),e.jsx("th",{scope:"col",children:t("domainColType")}),e.jsx("th",{scope:"col",className:"mdocs-domain-table-num",children:t("domainColDocCount")}),e.jsx("th",{scope:"col",children:t("domainColActions")})]})}),e.jsx("tbody",{children:s.filteredDomains.map(i=>{const v=ts(i,s.visitorId),g=as(i.domainId),o=ns(i),x=o?t("domainTooltipTypeLocked",{count:String(i.docCount)}):void 0;return e.jsxs("tr",{className:g?"mdocs-domain-table-row-builtin":void 0,children:[e.jsx("td",{children:s.renamingId===i.domainId?e.jsxs("div",{className:"mdocs-domain-table-rename",children:[e.jsx("input",{value:s.renameDraft,onChange:h=>s.setRenameDraft(h.target.value),maxLength:100,autoFocus:!0,className:"mdocs-domain-name-input"}),e.jsx("button",{type:"button",className:"primary",onClick:()=>void s.handleRename(i.domainId),children:t("save")}),e.jsx("button",{type:"button",onClick:s.cancelRename,children:t("cancel")})]}):e.jsxs("div",{className:"mdocs-domain-table-name-cell",children:[e.jsx("span",{className:"mdocs-domain-table-name",children:s.localizeDomain(i)}),g&&e.jsx("span",{className:"mdocs-domain-badge-builtin",children:t("domainBuiltIn")}),!v&&!g&&e.jsx("span",{className:"mdocs-domain-badge-shared",children:t("shared")})]})}),e.jsx("td",{children:e.jsxs("span",{className:"mdocs-domain-table-type",title:x,children:[e.jsx("span",{className:"mdocs-domain-permission-badge","data-permission":i.permission,children:s.domainTypeLabel(i,g)}),o&&!g&&e.jsx("span",{className:"mdocs-domain-type-lock","aria-hidden":"true",children:"🔒"})]})}),e.jsx("td",{className:"mdocs-domain-table-num",children:i.docCount}),e.jsxs("td",{className:"mdocs-domain-table-actions",children:[g&&e.jsx("span",{className:"mdocs-domain-not-modifiable",children:t("domainNotModifiable")}),!g&&!v&&e.jsx("span",{className:"mdocs-domain-not-creator-inline",children:t("domainNotCreator")}),!g&&v&&s.changeTypeForId===i.domainId&&e.jsxs("div",{className:"mdocs-domain-change-type-panel",children:[e.jsx("div",{className:"mdocs-domain-permission-select",children:ne.map(h=>e.jsx("button",{type:"button",className:i.permission===h?"active":"",onClick:()=>void s.handlePermissionChange(i.domainId,h),children:s.plabel(h)},h))}),e.jsx("button",{type:"button",className:"secondary",onClick:()=>s.setChangeTypeForId(null),children:t("cancel")})]}),!g&&v&&s.renamingId!==i.domainId&&s.changeTypeForId!==i.domainId&&e.jsxs("div",{className:"mdocs-domain-action-buttons",children:[e.jsx("button",{type:"button",className:"secondary",title:o?t("domainLocked"):void 0,onClick:()=>{s.setChangeTypeForId(null),s.startRename(i)},disabled:o,children:t("rename")}),e.jsx("button",{type:"button",className:"secondary",title:o?x:void 0,onClick:()=>{s.setRenamingId(null),s.setChangeTypeForId(i.domainId)},disabled:o,children:t("domainChangeType")}),e.jsx("button",{type:"button",className:"secondary",title:o?t("domainLocked"):void 0,onClick:()=>void s.handleDelete(i),disabled:o,children:t("deleteDomain")}),i.permission==="restricted"&&!g&&e.jsx("button",{type:"button",className:"secondary",onClick:()=>void C(i),children:t("domainMembersManageButton")})]})]})]},i.domainId)})})]})})]}),e.jsx(we,{open:p!==null,title:t("domainMembersPickerTitle"),initialSelectedIds:(p==null?void 0:p.initialIds)??[],lockedIds:p?[p.creatorVisitorId]:[],seedMembers:p==null?void 0:p.memberRows,templates:y,onClose:()=>k(null),onConfirm:async i=>{p&&(await is(p.domainId,i),E({kind:"ok",text:t("domainMembersSaved",{count:String(i.length)})}))}})]})}function ye(t){return t.length<=6?t:`${t.slice(0,6)}…`}function Ls(){const{t}=Z(),s=a.useRef(!0),[y,u]=a.useState([]),[m,E]=a.useState(!0),[p,k]=a.useState(null),[N,C]=a.useState(1),[i,v]=a.useState(null),[g,o]=a.useState(""),[x,h]=a.useState([]),[V,I]=a.useState(!1),[z,D]=a.useState(null),[M,F]=a.useState(!1),L=be(),[f,A]=a.useState([]),[w,S]=a.useState("idle"),[P,c]=a.useState("");a.useEffect(()=>(s.current=!0,()=>{s.current=!1}),[]),a.useEffect(()=>{S("loading"),ls().then(l=>{s.current&&(A(l),S("ok"))}).catch(()=>{s.current&&S("err")})},[]);const d=a.useMemo(()=>{const l=new Map;for(const T of f)l.set(T.visitorId,T.visitorName);return l},[f]),j=a.useCallback(async()=>{E(!0),D(null);try{const l=await ke();s.current&&u(l)}catch(l){s.current&&D(_(t,l))}finally{s.current&&E(!1)}},[t]);a.useEffect(()=>{j()},[j]);const R=a.useMemo(()=>x.map(l=>{const T=f.find(W=>W.visitorId===l);return{visitorId:l,name:T?T.visitorName:t("visitorPickerUnknownVisitor"),muted:!T}}),[x,f,t]);function O(l){h(T=>T.includes(l)?T.filter(W=>W!==l):[...T,l])}const H=N===1?g.trim().length>0:N===2?x.length>0:!0;function q(){if(!(N>=3)){if(!H){F(!0);return}F(!1),C(N+1),c("")}}function G(){N<=1||(F(!1),C(N-1))}function b(){k(null),v(null),o(""),h(L?[L]:[]),D(null),C(1),c(""),F(!1)}function r(l){k(null),v(l.id),o(l.displayName);const T=L&&!l.visitorIds.includes(L)?[...l.visitorIds,L]:[...l.visitorIds];h(T),D(null),C(1),c(""),F(!1)}async function K(){if(!(!g.trim()||x.length===0)){I(!0),D(null);try{if(i===null?await os({displayName:g.trim(),visitorIds:x}):await rs(i,{displayName:g.trim(),visitorIds:x}),!s.current)return;b(),await j()}catch(l){if(!s.current)return;D(_(t,l))}finally{s.current&&I(!1)}}}async function $(l){I(!0),D(null);try{if(await ds(l),!s.current)return;k(null),i===l&&b(),await j()}catch(T){if(!s.current)return;D(_(t,T))}finally{s.current&&I(!1)}}const Q=[{key:1,label:t("memberTemplateStepName")},{key:2,label:t("memberTemplateStepMembers")},{key:3,label:t("memberTemplateStepSave")}],ee=`${(N-1)/2*100}%`;return e.jsxs("div",{className:"mdocs-settings",children:[e.jsxs("div",{className:"mdocs-settings-header",children:[e.jsx("h2",{className:"mdocs-settings-title",children:t(i!==null?"memberTemplateUpdate":"memberTemplateFormNew")}),i!==null&&e.jsx("button",{type:"button",className:"secondary",onClick:b,style:{fontSize:12},children:t("memberTemplateCancelEdit")})]}),e.jsxs("div",{className:"mdocs-wizard-progress",children:[e.jsx("div",{className:"mdocs-wizard-progress-track",children:e.jsx("div",{className:"mdocs-wizard-progress-fill",style:{width:ee}})}),e.jsx("div",{className:"mdocs-wizard-progress-steps",children:Q.map(l=>{const T=N===l.key,W=N>l.key;return e.jsxs("div",{className:"mdocs-wizard-step-indicator",children:[e.jsx("div",{className:`mdocs-wizard-step-circle${T?" current":""}${W?" done":""}`,children:W?"✓":l.key}),e.jsx("span",{className:`mdocs-wizard-step-label${T?" current":""}${W?" done":""}`,children:l.label})]},l.key)})})]}),z&&e.jsx("div",{className:"mdocs-settings-item-desc",style:{color:"var(--mdocs-danger)",marginBottom:12,marginTop:12},children:z}),e.jsxs("div",{className:"mdocs-settings-cards",children:[e.jsxs("div",{className:"mdocs-settings-card mdocs-wizard-card",children:[N===1&&e.jsxs("div",{className:"mdocs-wizard-step-content",children:[e.jsx("input",{className:"mdocs-wizard-name-input",value:g,onChange:l=>o(l.target.value),placeholder:t("memberTemplateNamePlaceholder"),maxLength:200,disabled:V,autoFocus:!0,"aria-invalid":M&&!g.trim()}),M&&!g.trim()&&e.jsx("p",{className:"mdocs-wizard-hint",style:{color:"var(--mdocs-danger)"},children:t("domainNameRequired")})]}),N===2&&e.jsxs("div",{className:"mdocs-wizard-step-content",children:[e.jsx(Is,{visitors:f,loadState:w,searchFilter:P,onSearchChange:c,selectedIds:new Set(x),onToggle:O,selectedRows:R,myVisitorId:L}),e.jsx("p",{className:`mdocs-wizard-hint${M&&x.length===0?" danger":""}`,children:"💡 "+t("memberTemplateStep2Hint")})]}),N===3&&e.jsx("div",{className:"mdocs-wizard-step-content",children:e.jsxs("div",{className:"mdocs-wizard-preview-card",children:[e.jsxs("div",{className:"mdocs-wizard-preview-row",children:[e.jsx("span",{className:"mdocs-wizard-preview-label",children:t("memberTemplateNameLabel")}),e.jsx("span",{className:"mdocs-wizard-preview-value",children:g})]}),e.jsxs("div",{className:"mdocs-wizard-preview-row",children:[e.jsx("span",{className:"mdocs-wizard-preview-label",children:t("memberTemplateIdsLabel")}),e.jsx("span",{className:"mdocs-wizard-preview-value",children:t("memberTemplateSelectedSummary",{count:String(x.length)})})]}),x.length>0&&e.jsxs("div",{className:"mdocs-wizard-preview-tags",children:[x.slice(0,15).map(l=>e.jsx("span",{className:"mdocs-wizard-preview-tag",children:ye(l)},l)),x.length>15&&e.jsxs("span",{className:"mdocs-wizard-preview-tag mdocs-wizard-preview-tag-more",children:["+",x.length-15]})]})]})}),e.jsxs("div",{className:"mdocs-wizard-footer",children:[e.jsxs("button",{type:"button",className:"secondary",onClick:G,children:["← ",t("memberTemplateWizardBack")]}),N<3?e.jsxs("button",{type:"button",className:"primary",onClick:q,children:[t("memberTemplateWizardNext")," →"]}):e.jsx("button",{type:"button",className:"primary",onClick:()=>void K(),children:t(V?"saving":i===null?"memberTemplateCreate":"memberTemplateUpdate")})]})]}),e.jsxs("div",{className:"mdocs-settings-card",children:[e.jsx("div",{className:"mdocs-settings-card-title",children:t("memberTemplateSavedList")}),m?e.jsx("span",{className:"mdocs-settings-item-desc",children:t("loading")}):y.length===0?e.jsxs("div",{className:"mdocs-member-template-empty",children:[e.jsx("span",{className:"mdocs-settings-item-desc",children:t("memberTemplateEmpty")}),i===null&&e.jsx("button",{type:"button",className:"primary",onClick:b,children:t("memberTemplateEmptyAction")})]}):e.jsx("ul",{className:"mdocs-member-template-list",children:y.map(l=>e.jsx("li",{className:"mdocs-member-template-row",children:p===l.id?e.jsxs("div",{className:"mdocs-member-template-confirm-row",children:[e.jsx("span",{className:"mdocs-member-template-confirm-text",children:t("memberTemplateConfirmDeleteDesc",{name:l.displayName})}),e.jsxs("div",{className:"mdocs-member-template-confirm-actions",children:[e.jsx("button",{type:"button",className:"secondary",style:{color:"var(--mdocs-danger)"},onClick:()=>void $(l.id),children:t(V?"saving":"memberTemplateConfirmDeleteSubmit")}),e.jsx("button",{type:"button",className:"secondary",onClick:()=>k(null),children:t("memberTemplateConfirmDeleteCancel")})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mdocs-member-template-row-head",children:[e.jsx("strong",{children:l.displayName}),e.jsx("span",{className:"mdocs-settings-item-desc",children:t("memberTemplateCount",{count:String(l.visitorIds.length)})}),l.visitorIds.length>0&&e.jsx("div",{className:"mdocs-member-template-tags mdocs-member-template-tags-scroll",children:l.visitorIds.map(T=>e.jsx("span",{className:"mdocs-member-template-tag",children:d.get(T)??ye(T)},T))})]}),e.jsxs("div",{className:"mdocs-member-template-row-actions",children:[e.jsx("button",{type:"button",className:"secondary",onClick:()=>r(l),children:t("edit")}),e.jsx("button",{type:"button",className:"secondary",onClick:()=>k(l.id),children:t("memberTemplateDelete")})]})]})},l.id))})]})]})]})}const Rs=[{value:"deepseek-v4-flash",label:"deepseek-v4-flash"},{value:"deepseek-v4-pro",label:"deepseek-v4-pro"}];function Bs(){const{t}=Z(),s=a.useRef(!0),[y,u]=a.useState(""),[m,E]=a.useState(null),[p,k]=a.useState(""),[N,C]=a.useState("deepseek-v4-flash"),[i,v]=a.useState(128e3),[g,o]=a.useState(""),[x,h]=a.useState(!1),[V,I]=a.useState(null),[z,D]=a.useState(!0),[M,F]=a.useState(!1),[L,f]=a.useState(null),[A,w]=a.useState(!1),[S,P]=a.useState(!1),[c,d]=a.useState(!1),[j,R]=a.useState(null);a.useEffect(()=>(s.current=!0,()=>{s.current=!1}),[]),a.useEffect(()=>{(async()=>{try{const[b,r]=await Promise.all([ms(),us()]);if(!s.current)return;u(b.visitorName),r?(E(r.id),k(r.name),C(r.modelId),v(r.contextWindow||128e3),h(r.hasApiKey),I(r.apiKeyMasked),P(!1)):P(!0)}catch(b){if(!s.current)return;f(b instanceof Error?b.message:String(b)),P(!0)}finally{s.current&&D(!1)}})()},[]);function O(){R({name:p,modelId:N,contextWindow:i}),o(""),d(!1),w(!1),f(null),P(!0)}function H(){j&&(k(j.name),C(j.modelId),v(j.contextWindow)),o(""),d(!1),f(null),w(!1),P(!1),R(null)}async function q(){F(!0),f(null),w(!1);try{const b={modelId:N,name:p,contextWindow:i};g.trim()&&(b.apiKey=g.trim());const r=await ps(b);if(!s.current)return;E(r.id),k(r.name),C(r.modelId),v(r.contextWindow||128e3),h(r.hasApiKey),I(r.apiKeyMasked),o(""),d(!1),w(!0),P(!1),R(null)}catch(b){if(!s.current)return;f(b instanceof Error?b.message:String(b))}finally{s.current&&F(!1)}}const G=t("agentConfigNameDefault").replace("{{name}}",y||"…");return e.jsxs("div",{className:"mdocs-settings",children:[e.jsxs("div",{className:"mdocs-settings-header",children:[e.jsxs("h2",{className:"mdocs-settings-title mdocs-agent-config-title",children:[e.jsx("img",{src:hs,alt:"DeepSeek",className:"mdocs-agent-config-logo"}),t("agentConfig")]}),!z&&m&&!S?e.jsx("button",{type:"button",className:"secondary",onClick:O,children:t("edit")}):null]}),e.jsx("div",{className:"mdocs-settings-cards",children:e.jsxs("div",{className:"mdocs-settings-card",children:[e.jsx("p",{className:"mdocs-settings-item-desc",style:{marginBottom:12},children:t("agentConfigDesc")}),z?e.jsx("p",{children:t("loading")}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"mdocs-settings-item",style:{display:"block",marginBottom:12},children:[e.jsx("span",{className:"mdocs-settings-card-title",children:t("agentConfigName")}),e.jsx("input",{type:"text",value:p,onChange:b=>k(b.target.value),placeholder:G,disabled:!S,style:{width:"100%",marginTop:6}})]}),e.jsxs("div",{className:"mdocs-settings-item mdocs-agent-config-field",style:{marginBottom:12},children:[e.jsx("span",{className:"mdocs-settings-card-title",children:t("agentConfigModel")}),S?e.jsx("div",{className:"mdocs-agent-config-select",children:e.jsx(Ts,{options:Rs,value:N,onChange:b=>C(b)})}):e.jsx("p",{className:"mdocs-agent-config-readonly",children:N})]}),e.jsxs("label",{className:"mdocs-settings-item",style:{display:"block",marginBottom:12},children:[e.jsx("span",{className:"mdocs-settings-card-title",children:t("agentConfigContextWindow")}),e.jsx("p",{className:"mdocs-settings-item-desc",style:{margin:"4px 0 6px"},children:t("agentConfigContextWindowDesc")}),S?e.jsx("input",{type:"number",min:1e3,max:2e6,step:1e3,value:i,onChange:b=>v(Number(b.target.value)||128e3),style:{width:"100%"}}):e.jsx("p",{className:"mdocs-agent-config-readonly",children:i})]}),e.jsxs("div",{className:"mdocs-settings-item mdocs-agent-config-field",style:{marginBottom:12},children:[e.jsx("span",{className:"mdocs-settings-card-title",children:t("agentConfigApiKey")}),S?e.jsxs("div",{className:"mdocs-agent-config-apikey",children:[e.jsx("input",{type:c?"text":"password",value:g,onChange:b=>o(b.target.value),placeholder:x?t("agentConfigApiKeyConfigured").replace("{{masked}}",V??"…"):t("agentConfigApiKeyPlaceholder"),autoComplete:"off"}),e.jsx("button",{type:"button",className:"mdocs-agent-config-eye","aria-label":t(c?"agentConfigHideKey":"agentConfigShowKey"),onClick:()=>d(b=>!b),children:c?e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":!0,children:[e.jsx("path",{d:"M3 3l18 18"}),e.jsx("path",{d:"M10.6 10.6a2 2 0 002.8 2.8"}),e.jsx("path",{d:"M9.9 5.1A10.5 10.5 0 0121 12c-.6 1.1-1.4 2.1-2.4 2.9"}),e.jsx("path",{d:"M6.1 6.1C4.5 7.4 3.2 9.1 2.5 12c1.5 3.5 5 7 9.5 7 1.4 0 2.7-.3 3.9-.8"})]}):e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":!0,children:[e.jsx("path",{d:"M2.5 12C4 8.5 7.5 5 12 5s8 3.5 9.5 7c-1.5 3.5-5 7-9.5 7s-8-3.5-9.5-7z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})})]}):e.jsx("p",{className:"mdocs-agent-config-readonly",children:x?V??"…":t("agentConfigApiKeyPlaceholder")})]}),m?e.jsxs("p",{className:"mdocs-settings-item-desc",style:{marginBottom:12},children:[t("agentConfigId"),": ",m]}):null,L?e.jsx("p",{style:{color:"var(--mdocs-danger, #c00)",marginBottom:12},children:L}):null,A&&!S?e.jsx("p",{className:"mdocs-settings-item-desc",style:{marginBottom:12},children:t("saved")}):null,S?e.jsxs("div",{className:"mdocs-agent-config-actions",children:[e.jsx("button",{type:"button",onClick:()=>void q(),disabled:M,children:t(M?"saving":"save")}),m?e.jsx("button",{type:"button",className:"secondary",onClick:H,disabled:M,children:t("cancel")}):null]}):null]})]})})]})}function Ne(t,s){const y=localStorage.getItem(t);return y===null?s:y==="true"}function $s(t){const{t:s,lang:y,setLang:u}=Z(),{onBack:m,onPublishDraft:E}=t,p=a.useRef(!0);a.useEffect(()=>(p.current=!0,()=>{p.current=!1}),[]);const[k,N]=a.useState(()=>Ne("mdocs.autoPublish",!1)),[C,i]=a.useState(()=>Ne("mdocs.autoEdit",!0)),[v,g]=a.useState(!1),[o,x]=a.useState("general"),[h,V]=a.useState([]),[I,z]=a.useState(!0),[D,M]=a.useState(null),[F,L]=a.useState(!1),[f,A]=a.useState(!1),[w,S]=a.useState(!1),[P,c]=a.useState(!1),[d,j]=a.useState(null),[R,O]=a.useState(!1),[H,q]=a.useState(!1),[G,b]=a.useState(!1),[r,K]=a.useState(""),[$,Q]=a.useState(!1),[ee,l]=a.useState(!1),[T,W]=a.useState(0),[Se,le]=a.useState([]),[Ce,oe]=a.useState(!1),[X,De]=a.useState(""),[Ie,Te]=a.useState([]),[Ae,re]=a.useState(!1),[Y,Pe]=a.useState(""),[Me,Ee]=a.useState([]),[Le,se]=a.useState(!1),[te,de]=a.useState(null),[ae,me]=a.useState(new Map);a.useEffect(()=>{localStorage.setItem("mdocs.autoPublish",String(k))},[k]),a.useEffect(()=>{localStorage.setItem("mdocs.autoEdit",String(C))},[C]),a.useEffect(()=>{o==="savePublish"&&ce().then(n=>{p.current&&W(n.filter(B=>!B.published).length)})},[o]),a.useEffect(()=>{o==="bookmarks"&&Re(),o==="myDocuments"&&pe()},[o]),a.useEffect(()=>{he()},[]),a.useEffect(()=>{ve().then(n=>{p.current&&Ee(n)}).catch(()=>{})},[]);const ue=new Map(Me.map(n=>[n.domainId,n.domainName]));async function he(){try{z(!0);const n=await gs();if(!p.current)return;V(n)}catch{}finally{p.current&&z(!1)}}async function Re(){try{oe(!0);const n=await fs();if(!p.current)return;le(n)}catch{}finally{p.current&&oe(!1)}}async function pe(){try{re(!0);const n=await xs();if(!p.current)return;Te(n)}catch{}finally{p.current&&re(!1)}}async function Be(n){try{await ks(n),le(B=>B.filter(J=>J.documentId!==n))}catch{}}function ze(){if(h.some(B=>!B.revoked)){A(!0);return}ge()}async function ge(){try{L(!0);const n=await Ss();M({token:n.token,name:n.name}),await he()}finally{L(!1)}}async function Fe(){try{b(!0);const n=await bs();j(n.recoveryCode)}finally{b(!1)}}async function Ke(n){n.preventDefault();const B=r.trim();if(!(B&&B.length<4))try{Q(!0),await vs(B),K(""),l(!0),setTimeout(()=>l(!1),3e3)}finally{Q(!1)}}async function Ve(n){de(n);try{const B=await ws(n),J=new Map;B.forEach(U=>{J.set(U.visitorId,U.permission)}),me(J)}catch{me(new Map)}se(!0)}async function Oe(n){if(te)try{const B=new Set(n.map(U=>U.visitorId)),J=new Set(ae.keys());for(const U of J)B.has(U)||await Cs(te,U);for(const U of n)await Ds(te,U.visitorId,U.permission);await pe()}finally{se(!1),de(null)}}const fe=Se.filter(n=>{if(!X.trim())return!0;const B=X.toLowerCase();return(n.displayName||n.relativePath||"").toLowerCase().includes(B)||(n.ownerVisitorName||"").toLowerCase().includes(B)||(n.domainId||"").toLowerCase().includes(B)}),xe=Ie.filter(n=>{if(!Y.trim())return!0;const B=Y.toLowerCase();return(n.displayName||n.relativePath||"").toLowerCase().includes(B)||(n.domainId||"").toLowerCase().includes(B)});return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:"mdocs-sidebar",children:[e.jsx("header",{className:"mdocs-sidebar-header",children:e.jsxs("div",{className:"mdocs-brand",children:[e.jsx("img",{src:js,alt:s("brand"),className:"mdocs-brand-logo"}),e.jsx("span",{children:s("brand")})]})}),e.jsxs("nav",{className:"mdocs-config-tree",children:[e.jsx("div",{className:"mdocs-config-item"+(o==="general"?" active":""),onClick:()=>x("general"),children:s("general")}),e.jsx("div",{className:"mdocs-config-item"+(o==="bookmarks"?" active":""),onClick:()=>x("bookmarks"),children:s("bookmarkTitle")}),e.jsx("div",{className:"mdocs-config-item"+(o==="myDocuments"?" active":""),onClick:()=>x("myDocuments"),children:s("myDocuments")}),e.jsx("div",{className:"mdocs-config-item"+(o==="domainManagement"?" active":""),onClick:()=>x("domainManagement"),children:s("domainManagement")}),e.jsx("div",{className:"mdocs-config-item"+(o==="memberTemplates"?" active":""),onClick:()=>x("memberTemplates"),children:s("memberTemplates")}),e.jsx("div",{className:"mdocs-config-item"+(o==="agentConfig"?" active":""),onClick:()=>x("agentConfig"),children:s("agentConfig")}),e.jsx("div",{className:"mdocs-config-item"+(o==="savePublish"?" active":""),onClick:()=>x("savePublish"),children:s("saveAndPublish")})]}),e.jsx("footer",{className:"mdocs-settings-sidebar-footer",onClick:m,children:s("backToDocs")})]}),e.jsxs("main",{className:"mdocs-main",children:[ys(),o==="general"?e.jsxs("div",{className:"mdocs-settings",children:[e.jsx("div",{className:"mdocs-settings-header",children:e.jsx("h2",{className:"mdocs-settings-title",children:s("general")})}),e.jsxs("div",{className:"mdocs-settings-cards",children:[e.jsx("div",{className:"mdocs-settings-card",children:e.jsxs("label",{className:"mdocs-settings-item",children:[e.jsx("span",{className:"mdocs-settings-item-info",children:e.jsx("span",{className:"mdocs-settings-card-title",children:s("language")})}),e.jsxs("span",{className:"mdocs-settings-lang",children:[e.jsx("button",{type:"button",className:y==="en"?"active":"",onClick:()=>u("en"),children:"EN"}),e.jsx("span",{children:"/"}),e.jsx("button",{type:"button",className:y==="zh"?"active":"",onClick:()=>u("zh"),children:"中"})]})]})}),e.jsx("div",{className:"mdocs-settings-card",children:e.jsxs("label",{className:"mdocs-settings-item",children:[e.jsxs("span",{className:"mdocs-settings-item-info",children:[e.jsx("span",{className:"mdocs-settings-card-title",children:s("autoEdit")}),e.jsx("span",{className:"mdocs-settings-item-desc",children:s("autoEditDesc")})]}),e.jsx("button",{type:"button",className:"mdocs-toggle"+(C?" active":""),role:"switch","aria-checked":C,onClick:()=>i(n=>!n),children:e.jsx("span",{className:"mdocs-toggle-knob"})})]})}),e.jsxs("div",{className:"mdocs-settings-card",children:[e.jsxs("div",{className:"mdocs-settings-item",children:[e.jsxs("span",{className:"mdocs-settings-item-info",children:[e.jsx("span",{className:"mdocs-settings-card-title",children:s("cliToken")}),e.jsx("span",{className:"mdocs-settings-item-desc",children:s("cliTokenDesc")}),!I&&h.length>0&&e.jsx("span",{className:"mdocs-settings-item-desc",style:{marginTop:8,fontSize:"0.85em",opacity:.8},children:h.map(n=>e.jsxs("span",{style:{display:"block"},children:[n.name," — ",new Date(n.createdAt).toLocaleString()," ",n.revoked?`(${s("cliTokenRevoked")})`:`(${s("cliTokenActive")})`]},n.tokenId))})]}),e.jsx("button",{type:"button",className:"secondary",onClick:ze,disabled:F||I,children:F?"…":h.some(n=>!n.revoked)?s("cliTokenReset"):s("cliTokenCreate")})]}),D&&e.jsxs("div",{className:"mdocs-settings-secret-result mdocs-settings-secret-result--ok",children:[e.jsxs("div",{className:"mdocs-settings-secret-result-head",children:[e.jsx("span",{className:"mdocs-settings-card-title",children:s("cliTokenGenerated")}),e.jsx("span",{className:"mdocs-settings-secret-value",children:D.token})]}),e.jsxs("div",{className:"mdocs-settings-secret-result-actions",children:[e.jsx("button",{type:"button",className:"secondary",onClick:()=>{(async()=>{try{await navigator.clipboard.writeText(D.token),c(!1),S(!0),window.setTimeout(()=>S(!1),2e3)}catch{S(!1),c(!0),window.setTimeout(()=>c(!1),3e3)}})()},children:s(w?"cliTokenCopied":"cliTokenCopy")}),e.jsx("button",{type:"button",onClick:()=>M(null),children:s("close")})]}),w&&e.jsxs("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--ok",role:"status",children:["✓ ",s("cliTokenCopied")]}),P&&e.jsx("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--err",role:"status",children:s("cliTokenCopyFailed")})]})]}),e.jsxs("div",{className:"mdocs-settings-card",children:[e.jsxs("div",{className:"mdocs-settings-item",children:[e.jsxs("span",{className:"mdocs-settings-item-info",children:[e.jsx("span",{className:"mdocs-settings-card-title",children:"🔑 恢复码"}),e.jsx("span",{className:"mdocs-settings-item-desc",children:"当 Token 丢失时,可用恢复码找回身份。生成后请立即保存,仅显示一次。"})]}),e.jsx("button",{type:"button",className:"secondary",onClick:Fe,disabled:G,children:G?"…":"生成恢复码"})]}),d&&e.jsxs("div",{className:"mdocs-settings-secret-result mdocs-settings-secret-result--warn",children:[e.jsxs("div",{className:"mdocs-settings-secret-result-head",children:[e.jsx("span",{className:"mdocs-settings-card-title",children:"🔑 你的恢复码"}),e.jsx("span",{className:"mdocs-settings-item-desc",style:{marginTop:8},children:"请立即复制保存,关闭后不可再查看。"}),e.jsx("div",{className:"mdocs-settings-secret-code",children:d})]}),e.jsxs("div",{className:"mdocs-settings-secret-result-actions",children:[e.jsx("button",{type:"button",className:"primary",onClick:()=>{(async()=>{try{await navigator.clipboard.writeText(d),q(!1),O(!0),window.setTimeout(()=>O(!1),2e3)}catch{O(!1),q(!0),window.setTimeout(()=>q(!1),3e3)}})()},children:R?"已复制":"复制恢复码"}),e.jsx("button",{type:"button",onClick:()=>j(null),children:s("close")})]}),R&&e.jsx("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--ok",role:"status",children:"✓ 已复制到剪贴板"}),H&&e.jsx("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--err",role:"status",children:"复制失败,请手动选中上方内容复制"})]})]}),e.jsxs("div",{className:"mdocs-settings-card",children:[e.jsx("div",{className:"mdocs-settings-item",children:e.jsxs("span",{className:"mdocs-settings-item-info",children:[e.jsx("span",{className:"mdocs-settings-card-title",children:"🔐 登录密码"}),e.jsx("span",{className:"mdocs-settings-item-desc",children:"设置密码后,可在其他浏览器或设备用「用户名+密码」登录。"})]})}),e.jsxs("form",{onSubmit:Ke,style:{marginTop:12},children:[e.jsx("input",{type:"password",placeholder:"输入新密码(至少 4 位,留空则清除密码)",value:r,onChange:n=>K(n.target.value),minLength:0,style:{marginBottom:8}}),ee&&e.jsx("div",{style:{color:"#4caf50",marginBottom:8,fontSize:"0.875rem"},children:"✓ 密码设置成功"}),e.jsx("button",{type:"submit",className:"secondary",disabled:$,children:$?"设置中…":"保存密码"})]})]})]})]}):o==="bookmarks"?e.jsxs("div",{className:"mdocs-settings",children:[e.jsx("div",{className:"mdocs-settings-header",children:e.jsx("h2",{className:"mdocs-settings-title",children:s("bookmarkTitle")})}),e.jsxs("div",{className:"mdocs-settings-card",children:[e.jsx("input",{type:"text",className:"mdocs-settings-search",placeholder:s("bookmarkSearch"),value:X,onChange:n=>De(n.target.value)}),Ce?e.jsx("div",{style:{textAlign:"center",padding:"40px 0"},children:s("loading")}):e.jsx(e.Fragment,{children:fe.length===0?e.jsx("div",{style:{textAlign:"center",padding:"40px 0",opacity:.6},children:s(X?"bookmarkNoMatch":"bookmarkEmpty")}):e.jsxs("table",{className:"mdocs-settings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("bookmarkColTitle")}),e.jsx("th",{children:s("bookmarkColDomain")}),e.jsx("th",{children:s("bookmarkColAuthor")}),e.jsx("th",{children:s("bookmarkColTime")}),e.jsx("th",{style:{textAlign:"right"}})]})}),e.jsx("tbody",{children:fe.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:{cursor:"pointer",fontWeight:500},onClick:()=>t.onOpenDocument(n.documentId),children:n.displayName||n.relativePath||"Untitled"}),e.jsx("td",{children:n.isDeleted?e.jsx("span",{style:{opacity:.5,fontStyle:"italic"},children:"已删除"}):ue.get(n.domainId||"")||n.domainId||"—"}),e.jsx("td",{children:n.ownerVisitorName||"—"}),e.jsx("td",{children:new Date(n.bookmarkedAt).toLocaleDateString()}),e.jsx("td",{style:{textAlign:"right"},children:e.jsx("button",{type:"button",className:"secondary small",onClick:()=>Be(n.documentId),children:s("bookmarkRemove")})})]},n.documentId))})]})})]})]}):o==="myDocuments"?e.jsxs("div",{className:"mdocs-settings",children:[e.jsx("div",{className:"mdocs-settings-header",children:e.jsx("h2",{className:"mdocs-settings-title",children:s("myDocuments")})}),e.jsxs("div",{className:"mdocs-settings-card",children:[e.jsx("input",{type:"text",className:"mdocs-settings-search",placeholder:"搜索文章…",value:Y,onChange:n=>Pe(n.target.value)}),Ae?e.jsx("div",{style:{textAlign:"center",padding:"40px 0"},children:s("loading")}):e.jsx(e.Fragment,{children:xe.length===0?e.jsx("div",{style:{textAlign:"center",padding:"40px 0",opacity:.6},children:s(Y?"myDocumentsNoMatch":"myDocumentsEmpty")}):e.jsxs("table",{className:"mdocs-settings-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("myDocumentsColTitle")}),e.jsx("th",{children:s("myDocumentsColDomain")}),e.jsx("th",{children:s("myDocumentsColUpdated")}),e.jsx("th",{children:s("myDocumentsColCreated")}),e.jsx("th",{colSpan:2})]})}),e.jsx("tbody",{children:xe.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:{cursor:"pointer",fontWeight:500},onClick:()=>t.onOpenDocument(n.documentId),children:n.displayName||n.relativePath||"Untitled"}),e.jsx("td",{children:ue.get(n.domainId||"")||n.domainId||"—"}),e.jsx("td",{children:new Date(n.updatedAt).toLocaleDateString()}),e.jsx("td",{children:new Date(n.createdAt).toLocaleDateString()}),e.jsx("td",{style:{textAlign:"right"},children:e.jsx("button",{type:"button",className:"secondary small",onClick:()=>Ve(n.documentId),children:s("docInfoInviteMember")})}),e.jsx("td",{style:{textAlign:"right",paddingLeft:0},children:e.jsx("button",{type:"button",className:"primary small",onClick:()=>t.onOpenDocument(n.documentId),children:s("bookmarkOpen")})})]},n.documentId))})]})})]})]}):o==="domainManagement"?e.jsx(Es,{}):o==="memberTemplates"?e.jsx(Ls,{}):o==="agentConfig"?e.jsx(Bs,{}):e.jsxs("div",{className:"mdocs-settings",children:[e.jsxs("div",{className:"mdocs-settings-header",children:[e.jsx("h2",{className:"mdocs-settings-title",children:s("saveAndPublish")}),e.jsx("button",{type:"button",className:"secondary",onClick:m,children:s("backToDocs")})]}),e.jsxs("div",{className:"mdocs-settings-cards",children:[e.jsx("div",{className:"mdocs-settings-card",children:e.jsxs("label",{className:"mdocs-settings-item",children:[e.jsxs("span",{className:"mdocs-settings-item-info",children:[e.jsx("span",{className:"mdocs-settings-card-title",children:s("autoSave")}),e.jsx("span",{className:"mdocs-settings-item-desc",children:s("autoSaveAlwaysOnDesc")})]}),e.jsx("span",{className:"mdocs-toggle active",role:"switch","aria-checked":"true","aria-disabled":"true",style:{opacity:.6,cursor:"not-allowed"},children:e.jsx("span",{className:"mdocs-toggle-knob"})})]})}),e.jsx("div",{className:"mdocs-settings-card",children:e.jsxs("label",{className:"mdocs-settings-item",children:[e.jsxs("span",{className:"mdocs-settings-item-info",children:[e.jsx("span",{className:"mdocs-settings-card-title",children:s("autoPublish")}),e.jsx("span",{className:"mdocs-settings-item-desc",children:s("autoPublishDesc")})]}),e.jsx("button",{type:"button",className:"mdocs-toggle"+(k?" active":""),role:"switch","aria-checked":k,onClick:()=>N(n=>!n),children:e.jsx("span",{className:"mdocs-toggle-knob"})})]})}),T>0?e.jsxs("button",{className:"mdocs-settings-card mdocs-settings-draft-link",onClick:()=>g(!0),children:[e.jsxs("span",{className:"mdocs-settings-draft-link-text",children:["📄 ",s("viewDrafts")," (",T,")"]}),e.jsx("span",{className:"mdocs-settings-draft-arrow","aria-hidden":"true",children:"›"})]}):e.jsx("div",{className:"mdocs-settings-card mdocs-settings-draft-empty",children:e.jsx("span",{className:"mdocs-settings-item-desc",children:s("noDrafts")})})]})]}),v&&e.jsx(Ps,{onPublish:E,onClose:()=>g(!1),onCountChange:W,onRecover:t.onRecoverDraft})]}),f&&e.jsx(Ns,{title:s("cliToken"),message:s("cliTokenResetConfirm"),confirmLabel:s("cliTokenReset"),cancelLabel:s("cancel"),busy:F,onConfirm:()=>{A(!1),ge()},onCancel:()=>A(!1)}),e.jsx(we,{open:Le,title:s("docInfoInviteMember"),initialSelectedIds:[...ae.keys()],initialPermissions:ae,templates:[],showPermissionSelect:!0,permissionOptions:[{value:"read",label:s("invitePermissionRead")},{value:"edit",label:s("invitePermissionEdit")}],onClose:()=>se(!1),onConfirm:n=>{Oe(n)}})]})}export{$s as SettingsPage};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import{c as o}from"./index-CA7lpALZ.js";import{r as u,j as r}from"./react-vendor-BNpqFP9B.js";import{F as _,G as C,L as v,H as c,J as l,K as N,M as L,q as j,N as z,P as w}from"./react-CQByW0Rg.js";import{z as g,V as b}from"./editor-BBXgdU3Q.js";/**
|
|
2
|
+
* @license lucide-react v0.562.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const $=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],H=o("arrow-down-to-line",$);/**
|
|
7
|
+
* @license lucide-react v0.562.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const q=[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]],V=o("arrow-up-to-line",q);/**
|
|
12
|
+
* @license lucide-react v0.562.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const I=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],B=o("bold",I);/**
|
|
17
|
+
* @license lucide-react v0.562.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const T=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],A=o("code-xml",T);/**
|
|
22
|
+
* @license lucide-react v0.562.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const P=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],E=o("file-up",P);/**
|
|
27
|
+
* @license lucide-react v0.562.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const U=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],Ne=o("heading-1",U);/**
|
|
32
|
+
* @license lucide-react v0.562.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const F=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Le=o("heading-2",F);/**
|
|
37
|
+
* @license lucide-react v0.562.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const R=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],je=o("heading-3",R);/**
|
|
42
|
+
* @license lucide-react v0.562.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const S=[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]],D=o("highlighter",S);/**
|
|
47
|
+
* @license lucide-react v0.562.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const O=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],G=o("image",O);/**
|
|
52
|
+
* @license lucide-react v0.562.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const W=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],X=o("italic",W);/**
|
|
57
|
+
* @license lucide-react v0.562.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const J=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],K=o("list-ordered",J);/**
|
|
62
|
+
* @license lucide-react v0.562.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const Q=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Y=o("list-todo",Q);/**
|
|
67
|
+
* @license lucide-react v0.562.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const Z=[["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"}]],ee=o("list",Z);/**
|
|
72
|
+
* @license lucide-react v0.562.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const oe=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],te=o("message-square-quote",oe);/**
|
|
77
|
+
* @license lucide-react v0.562.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/const ae=[["path",{d:"M5 12h14",key:"1ays0h"}]],ze=o("minus",ae);/**
|
|
82
|
+
* @license lucide-react v0.562.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const ne=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],we=o("network",ne);/**
|
|
87
|
+
* @license lucide-react v0.562.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/const ie=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],ce=o("redo-2",ie);/**
|
|
92
|
+
* @license lucide-react v0.562.0 - ISC
|
|
93
|
+
*
|
|
94
|
+
* This source code is licensed under the ISC license.
|
|
95
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
+
*/const le=[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]],se=o("sigma",le);/**
|
|
97
|
+
* @license lucide-react v0.562.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/const de=[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]],he=o("square-dashed-bottom-code",de);/**
|
|
102
|
+
* @license lucide-react v0.562.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/const ke=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],ye=o("strikethrough",ke);/**
|
|
107
|
+
* @license lucide-react v0.562.0 - ISC
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the ISC license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/const re=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],$e=o("table-2",re);/**
|
|
112
|
+
* @license lucide-react v0.562.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const pe=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],ue=o("underline",pe);/**
|
|
117
|
+
* @license lucide-react v0.562.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/const me=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Me=o("undo-2",me);/**
|
|
122
|
+
* @license lucide-react v0.562.0 - ISC
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the ISC license.
|
|
125
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
+
*/const ge=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],He=o("workflow",ge);function m(e,n="*/*"){if(typeof document>"u")return;const a=document.createElement("input");a.type="file",a.accept=n,a.multiple=!1;const i=setTimeout(()=>a.remove(),5e3);a.onchange=s=>{var y;clearTimeout(i);const k=(y=s.target)==null?void 0:y.files;k&&k.length>0&&e(k),a.remove()},a.oncancel=()=>{clearTimeout(i),a.remove()},a.click()}function be(e){const n=e.getLexicalEditor();n&&(n.update(()=>{const a=g(),i=b(),s=a.getFirstChild();s?s.insertBefore(i):a.append(i),i.selectStart()}),e.focus())}function fe(e){const n=e.getLexicalEditor();n&&(n.update(()=>{const a=g(),i=b();a.append(i),i.selectStart()}),e.focus())}function M(e,n){return[{active:e.isBold,icon:B,key:"bold",label:"Bold",onClick:e.bold,tooltipProps:{hotkey:c(l.Bold).keys}},{active:e.isItalic,icon:X,key:"italic",label:"Italic",onClick:e.italic,tooltipProps:{hotkey:c(l.Italic).keys}},{active:e.isUnderline,icon:ue,key:"underline",label:"Underline",onClick:e.underline,tooltipProps:{hotkey:c(l.Underline).keys}},{active:e.isStrikethrough,icon:ye,key:"strikethrough",label:"Strikethrough",onClick:e.strikethrough,tooltipProps:{hotkey:c(l.Strikethrough).keys}},{type:"divider"},{active:!!e.textColor,editor:n,key:"textColor",label:"Text Color",onChange:e.setTextColor,type:"colorPicker",value:e.textColor},{active:!!e.bgColor,defaultColor:"#ffffff",editor:n,icon:D,key:"bgColor",label:"Background Color",onChange:e.setBgColor,type:"colorPicker",value:e.bgColor}]}const qe=({editor:e,floating:n,outlineCollapseTitle:a,outlineExpandTitle:i,outlineToggle:s,style:k,className:y})=>{const t=_(e),d=C({collapseTitle:a,expandTitle:i}),f=u.useMemo(()=>[{disabled:!t.canUndo,icon:Me,key:"undo",label:"Undo",onClick:t.undo,tooltipProps:{hotkey:c(l.Undo).keys}},{disabled:!t.canRedo,icon:ce,key:"redo",label:"Redo",onClick:t.redo,tooltipProps:{hotkey:c(l.Redo).keys}},{icon:V,key:"insertLineTop",label:"Insert line at top",onClick:()=>be(e)},{icon:H,key:"insertLineBottom",label:"Insert line at end",onClick:()=>fe(e)},{type:"divider"},...M(t,e),{type:"divider"},{icon:ee,key:"bulletList",label:"Bullet List",onClick:t.bulletList,tooltipProps:{hotkey:c(l.BulletList).keys}},{icon:K,key:"numberlist",label:"Number list",onClick:t.numberList,tooltipProps:{hotkey:c(l.NumberList).keys}},{icon:Y,key:"tasklist",label:"Task list",onClick:t.checkList},{type:"divider"},{active:t.isBlockquote,icon:te,key:"blockquote",label:"Blockquote",onClick:t.blockquote},{icon:v,key:"link",label:"Link",onClick:t.insertLink,tooltipProps:{hotkey:c(l.Link).keys}},{icon:se,key:"math",label:"TeX",onClick:t.insertMath},{type:"divider"},{active:t.isCode,icon:A,key:"code",label:"Code",onClick:t.code,tooltipProps:{hotkey:c(l.CodeInline).keys}},{active:t.isCodeblock,icon:he,key:"codeblock",label:"Codeblock",onClick:t.codeblock},t.isCodeblock&&{children:r.jsx(N,{onSelect:h=>{console.log(h),t.updateCodeblockLang(h)},value:t.codeblockLang}),disabled:!t.isCodeblock,key:"codeblockLang"},{type:"divider"},{icon:G,key:"image",label:"Image",onClick:()=>{m(h=>{for(const p of h)e.dispatchCommand(L,{file:p})},"image/*")}},{icon:E,key:"file",label:"File",onClick:()=>{m(h=>{for(const p of h)e.dispatchCommand(j,{file:p})})}},...s&&d?[{type:"divider"},d]:[]].filter(Boolean),[e,t,d,s]),x=u.useMemo(()=>[...M(t,e),...s&&d?[{type:"divider"},d]:[]],[e,t,d,s]);return n?r.jsx(z,{items:x}):r.jsx("div",{className:["mdocs-toolbar",y].filter(Boolean).join(" "),style:k,children:r.jsx(w,{items:f})})};export{Ne as H,ze as M,we as N,se as S,$e as T,He as W,Le as a,je as b,qe as c,m as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,j as e}from"./react-vendor-BNpqFP9B.js";import{b as G,B as ee,f as se,w as z}from"./index-CA7lpALZ.js";function ie({options:v,value:a,onChange:b}){const[d,f]=r.useState(!1),y=r.useRef(null),x=r.useRef(null),p=v.find(o=>o.value===a);r.useEffect(()=>{if(!d)return;const o=u=>{var N,k;!((N=y.current)!=null&&N.contains(u.target))&&!((k=x.current)!=null&&k.contains(u.target))&&f(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[d]),r.useEffect(()=>{if(!d)return;const o=u=>{var N;u.key==="Escape"&&(f(!1),(N=y.current)==null||N.focus())};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[d]);function j(o){b(o),f(!1)}return e.jsxs("div",{className:"mdocs-mini-select",style:{position:"relative"},children:[e.jsxs("button",{ref:y,type:"button",className:"mdocs-mini-select-trigger","aria-expanded":d,"aria-haspopup":"listbox",onClick:()=>f(o=>!o),children:[e.jsx("span",{children:p==null?void 0:p.label}),e.jsx("svg",{className:"mdocs-mini-select-chevron"+(d?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M1 1l4 4 4-4"})})]}),d&&e.jsx("div",{ref:x,className:"mdocs-mini-select-menu card",role:"listbox",children:v.map(o=>e.jsx("button",{type:"button",className:"mdocs-mini-select-option"+(o.value===a?" active":""),role:"option","aria-selected":o.value===a,onClick:()=>j(o.value),children:o.label},o.value))})]})}function te(v){return v.length<=6?v:`${v.slice(0,6)}…`}function re(v){const{visitors:a,loadState:b,searchFilter:d,onSearchChange:f,selectedIds:y,onToggle:x,selectedRows:p,lockedIds:j=new Set,myVisitorId:o,showPermissionSelect:u=!1,permissionOptions:N=[],onPermissionChange:k}=v,{t:i}=G(),w=r.useMemo(()=>{const t=d.trim().toLowerCase();let g=t?a.filter(m=>m.visitorName.toLowerCase().includes(t)||m.visitorId.toLowerCase().includes(t)):a;return o&&(g=[...g].sort((m,R)=>m.visitorId===o?-1:R.visitorId===o?1:0)),g},[a,d,o]);return e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"search",className:"mdocs-visitor-picker-search",placeholder:i("visitorPickerSearchPlaceholder"),value:d,onChange:t=>f(t.target.value),disabled:b!=="ok"}),b==="loading"&&e.jsx("div",{className:"mdocs-visitor-picker-loading",children:i("loading")}),b==="err"&&e.jsx("div",{className:"mdocs-visitor-picker-error",children:i("visitorPickerLoadError")}),b==="ok"&&e.jsxs("div",{className:"mdocs-visitor-picker-columns",children:[e.jsxs("div",{className:"mdocs-visitor-picker-col",children:[e.jsx("h3",{className:"mdocs-visitor-picker-col-title",children:i("visitorPickerColumnAll")}),e.jsx("div",{className:"mdocs-visitor-picker-table-wrap",children:e.jsxs("table",{className:"mdocs-visitor-picker-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:i("visitorPickerColIdShort")}),e.jsx("th",{scope:"col",children:i("visitorPickerColName")}),e.jsx("th",{scope:"col",className:"mdocs-visitor-picker-check-col",children:i("visitorPickerColPick")})]})}),e.jsx("tbody",{children:w.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"mdocs-visitor-picker-empty-cell",children:a.length===0?i("visitorPickerEmptyDirectory"):i("domainNoMatch")})}):w.map(t=>{const g=j.has(t.visitorId),m=y.has(t.visitorId);return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{className:"mdocs-visitor-picker-id-short",children:te(t.visitorId)})}),e.jsxs("td",{children:[t.visitorName,t.visitorId===o&&e.jsx("span",{className:"mdocs-visitor-picker-self-marker",children:i("visitorPickerSelfMarker")})]}),e.jsx("td",{className:"mdocs-visitor-picker-check-col",children:e.jsx("input",{type:"checkbox",checked:m,disabled:g,onChange:()=>x(t.visitorId),"aria-label":t.visitorName})})]},t.visitorId)})})]})})]}),e.jsxs("div",{className:"mdocs-visitor-picker-col",children:[e.jsx("h3",{className:"mdocs-visitor-picker-col-title",children:i("visitorPickerColumnSelected")}),e.jsx("div",{className:"mdocs-visitor-picker-table-wrap",children:e.jsxs("table",{className:"mdocs-visitor-picker-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:i("visitorPickerColIdFull")}),e.jsx("th",{scope:"col",children:i("visitorPickerColName")}),u&&e.jsx("th",{scope:"col",children:i("permissionLabel")}),e.jsx("th",{scope:"col",className:"mdocs-visitor-picker-check-col"})]})}),e.jsx("tbody",{children:p.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:u?4:3,className:"mdocs-visitor-picker-empty-cell",children:i("visitorPickerNoSelection")})}):p.map(t=>{const g=j.has(t.visitorId);return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{className:"mdocs-visitor-picker-id-full",children:t.visitorId})}),e.jsx("td",{className:t.muted?"mdocs-visitor-picker-name-muted":void 0,children:t.name}),u&&e.jsx("td",{children:e.jsx(ie,{options:N,value:t.permission??"read",onChange:m=>k==null?void 0:k(t.visitorId,m)})}),e.jsx("td",{className:"mdocs-visitor-picker-check-col",children:g?e.jsx("span",{className:"mdocs-visitor-picker-locked",title:i("visitorPickerLockedHint"),children:"—"}):e.jsx("button",{type:"button",className:"mdocs-visitor-picker-remove",onClick:()=>x(t.visitorId),"aria-label":i("visitorPickerRemove"),children:"×"})})]},t.visitorId)})})]})})]})]})]})}function ne(v){var U;const{open:a,title:b,initialSelectedIds:d,lockedIds:f=[],seedMembers:y,excludeTemplateId:x,templates:p,onClose:j,onConfirm:o,showPermissionSelect:u=!1,permissionOptions:N=[],initialPermissions:k}=v,{t:i}=G(),w=r.useRef(i);w.current=i;const t=r.useMemo(()=>new Set(f),[f]),g=ee(),[m,R]=r.useState([]),[E,T]=r.useState("idle"),[P,V]=r.useState(()=>new Set),[O,L]=r.useState(()=>new Map),[J,F]=r.useState(""),[C,A]=r.useState(""),[M,B]=r.useState(!1),$=r.useRef(null),[K,W]=r.useState(!1),[q,I]=r.useState(null),D=r.useMemo(()=>p.filter(s=>x==null||s.id!==x),[p,x]),H=r.useMemo(()=>new Map((y??[]).map(s=>[s.visitorId,s])),[y]);r.useEffect(()=>{a&&(V(new Set(d)),L(k?new Map(k):new Map),F(""),A(""),I(null))},[a,d,k]),r.useEffect(()=>{if(!a)return;let s=!1;return T("loading"),se().then(n=>{s||(R(n),T("ok"))}).catch(n=>{s||(T("err"),I(z(w.current,n)))}),()=>{s=!0}},[a]),r.useEffect(()=>{if(!M)return;const s=n=>{var c;(c=$.current)!=null&&c.contains(n.target)||B(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[M]);const Q=r.useMemo(()=>{const s=new Map(m.map(c=>[c.visitorId,c])),n=[];for(const c of P){const l=O.get(c),h=s.get(c);if(h){n.push({visitorId:c,name:h.visitorName,muted:!1,permission:l});continue}const S=H.get(c);if(S){S.missing?n.push({visitorId:c,name:i("visitorPickerMemberMissing"),muted:!0,permission:l}):S.disabled?n.push({visitorId:c,name:`${S.visitorName} · ${i("visitorPickerDisabledTag")}`,muted:!0,permission:l}):n.push({visitorId:c,name:S.visitorName,muted:!1,permission:l});continue}n.push({visitorId:c,name:i("visitorPickerUnknownVisitor"),muted:!0,permission:l})}return n.sort((c,l)=>c.name.localeCompare(l.name,void 0,{sensitivity:"base"})),n},[m,P,H,O,i]),X=r.useCallback(s=>{t.has(s)||V(n=>{const c=new Set(n);return c.has(s)?(c.delete(s),L(l=>{const h=new Map(l);return h.delete(s),h})):(c.add(s),L(l=>{const h=new Map(l);return h.set(s,"read"),h})),c})},[t]),Y=r.useCallback((s,n)=>{L(c=>{const l=new Map(c);return l.set(s,n),l})},[]),Z=r.useCallback(()=>{const s=Number(C);if(!Number.isInteger(s)||s<1)return;const n=p.find(l=>l.id===s);if(!n)return;const c=new Set(m.map(l=>l.visitorId));V(l=>{const h=new Set(l);for(const S of n.visitorIds)c.has(S)&&h.add(S);return h})},[C,p,m]);async function _(){I(null),W(!0);try{if(u){const s=[...P].sort().map(n=>({visitorId:n,permission:O.get(n)??"read"}));await o(s)}else{const s=[...P].sort();await o(s)}j()}catch(s){I(z(i,s))}finally{W(!1)}}return a?e.jsx("div",{className:"mdocs-visitor-picker-overlay",role:"presentation",onMouseDown:s=>s.target===s.currentTarget&&j(),children:e.jsxs("div",{className:"mdocs-visitor-picker-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"mdocs-visitor-picker-title",children:[e.jsxs("header",{className:"mdocs-visitor-picker-header",children:[e.jsx("h2",{id:"mdocs-visitor-picker-title",className:"mdocs-visitor-picker-title",children:b}),e.jsx("button",{type:"button",className:"mdocs-visitor-picker-close",onClick:j,"aria-label":i("close"),children:"×"})]}),D.length>0&&e.jsx("div",{className:"mdocs-visitor-picker-toolbar",children:e.jsxs("div",{className:"mdocs-visitor-picker-template-bar",children:[e.jsxs("div",{ref:$,className:"mdocs-template-picker",children:[e.jsxs("button",{type:"button",className:"mdocs-template-picker-trigger",onClick:()=>B(s=>!s),disabled:E!=="ok","aria-haspopup":"listbox","aria-expanded":M,children:[e.jsx("span",{className:"mdocs-template-picker-text",children:C?(U=D.find(s=>String(s.id)===C))==null?void 0:U.displayName:i("visitorPickerPickTemplate")}),e.jsx("svg",{className:"mdocs-template-picker-chevron"+(M?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M1 1l4 4 4-4"})})]}),M&&e.jsx("div",{className:"mdocs-template-picker-menu card",role:"listbox",children:D.map(s=>e.jsx("button",{type:"button",className:"mdocs-template-picker-option"+(String(s.id)===C?" active":""),role:"option","aria-selected":String(s.id)===C,onClick:()=>{A(String(s.id)),B(!1)},children:s.displayName},s.id))})]}),e.jsx("button",{type:"button",className:"secondary",onClick:()=>{if(E!=="ok"){I(i("loading"));return}if(!C){I(i("visitorPickerPickTemplate"));return}Z()},children:i("visitorPickerApplyTemplate")})]})}),q&&e.jsx("div",{className:"mdocs-visitor-picker-error",role:"alert",children:q}),e.jsx("div",{style:{padding:"8px 18px 12px"},children:e.jsx(re,{visitors:m,loadState:E,searchFilter:J,onSearchChange:F,selectedIds:P,onToggle:X,selectedRows:Q,lockedIds:t,myVisitorId:g,showPermissionSelect:u,permissionOptions:N,onPermissionChange:Y})}),e.jsxs("footer",{className:"mdocs-visitor-picker-footer",children:[e.jsx("button",{type:"button",className:"secondary",onClick:j,children:i("cancel")}),e.jsx("button",{type:"button",className:"primary",onClick:()=>{if(E!=="ok"){I(i("loading"));return}_()},children:i(K?"saving":"visitorPickerConfirm")})]})]})}):null}export{ie as M,ne as V,re as a};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{c}from"./index-CA7lpALZ.js";/**
|
|
2
|
+
* @license lucide-react v0.562.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],a=c("check",e);/**
|
|
7
|
+
* @license lucide-react v0.562.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const o=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],h=c("copy",o);export{a as C,h as a};
|