@package-broker/ui 2.0.0-rc.4 → 2.0.0-rc.5

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.
Files changed (77) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/api-types.d.ts +848 -22
  3. package/dist/api-types.d.ts.map +1 -1
  4. package/dist/assets/{access.62e9484517a0.js → access.def9a17dc4a8.js} +1 -1
  5. package/dist/assets/app.ec678c27ec0a.css +2 -0
  6. package/dist/assets/{app.c064670cdc0d.js → app.fba0d059b40b.js} +2 -2
  7. package/dist/assets/{audit.b7c40b9dc998.js → audit.453367b59daf.js} +1 -1
  8. package/dist/assets/{chunk.56d473a1587d.js → chunk.2c3648a5bad1.js} +1 -1
  9. package/dist/assets/{chunk.a6d755a9789f.js → chunk.304a2b5d1663.js} +1 -1
  10. package/dist/assets/{chunk.741aec8d1ff9.js → chunk.3f077ff17cea.js} +1 -1
  11. package/dist/assets/{chunk.d18497920e4d.js → chunk.4721d4544d48.js} +1 -1
  12. package/dist/assets/{chunk.6ea6bdcaa465.js → chunk.4acf8fa7653f.js} +1 -1
  13. package/dist/assets/{chunk.28a4d8aab337.js → chunk.53134c7df4e5.js} +1 -1
  14. package/dist/assets/{chunk.965b76812604.js → chunk.56e058d97e0f.js} +1 -1
  15. package/dist/assets/{chunk.3fcd6998795a.js → chunk.75e1357175af.js} +1 -1
  16. package/dist/assets/chunk.837eb41f53ef.js +1 -0
  17. package/dist/assets/{chunk.f54ea1378c8c.js → chunk.ab1a14143dc6.js} +1 -1
  18. package/dist/assets/{chunk.d813fefb410d.js → chunk.dc41ee9219cf.js} +1 -1
  19. package/dist/assets/{chunk.8442124f6802.js → chunk.f0fd799728ef.js} +1 -1
  20. package/dist/assets/chunk.fac952720b72.js +4 -0
  21. package/dist/assets/{import.e7a1e5834631.js → import.4275bbce08ac.js} +1 -1
  22. package/dist/assets/index.html +7 -7
  23. package/dist/assets/manifest.json +30 -30
  24. package/dist/assets/{notifications.19225fe12044.js → notifications.bd7d4c3f9882.js} +1 -1
  25. package/dist/assets/{npm-login.e059678af13d.js → npm-login.d8b60e11fe87.js} +1 -1
  26. package/dist/assets/packages.bdd474bcfc11.js +2 -0
  27. package/dist/assets/{projects.927fe18c785c.js → projects.44006a838c67.js} +1 -1
  28. package/dist/assets/{setup.8e977608d413.js → setup.7bc86366227c.js} +1 -1
  29. package/dist/assets/setup.html +2 -2
  30. package/dist/assets/sources.d95aabfbec73.js +1 -0
  31. package/dist/assets/{tokens.6b86d8d97e07.js → tokens.4ee13a722abb.js} +1 -1
  32. package/dist/auth.d.ts +1 -0
  33. package/dist/auth.d.ts.map +1 -1
  34. package/dist/auth.js +13 -2
  35. package/dist/auth.js.map +1 -1
  36. package/dist/pages/audit.d.ts.map +1 -1
  37. package/dist/pages/packages/discovery-labels.d.ts +8 -0
  38. package/dist/pages/packages/discovery-labels.d.ts.map +1 -0
  39. package/dist/pages/packages/discovery-labels.js +25 -0
  40. package/dist/pages/packages/discovery-labels.js.map +1 -0
  41. package/dist/pages/packages/discovery-picker-view.d.ts +8 -0
  42. package/dist/pages/packages/discovery-picker-view.d.ts.map +1 -0
  43. package/dist/pages/packages/discovery-picker-view.js +109 -0
  44. package/dist/pages/packages/discovery-picker-view.js.map +1 -0
  45. package/dist/pages/packages/discovery-picker.d.ts +67 -0
  46. package/dist/pages/packages/discovery-picker.d.ts.map +1 -0
  47. package/dist/pages/packages/discovery-picker.js +238 -0
  48. package/dist/pages/packages/discovery-picker.js.map +1 -0
  49. package/dist/pages/packages/source-actions.d.ts +3 -1
  50. package/dist/pages/packages/source-actions.d.ts.map +1 -1
  51. package/dist/pages/packages/source-actions.js +19 -9
  52. package/dist/pages/packages/source-actions.js.map +1 -1
  53. package/dist/pages/sources/discovery-rule-prefill.d.ts +13 -0
  54. package/dist/pages/sources/discovery-rule-prefill.d.ts.map +1 -0
  55. package/dist/pages/sources/discovery-rule-prefill.js +9 -0
  56. package/dist/pages/sources/discovery-rule-prefill.js.map +1 -0
  57. package/dist/pages/sources/discovery-rules-view.d.ts +9 -0
  58. package/dist/pages/sources/discovery-rules-view.d.ts.map +1 -0
  59. package/dist/pages/sources/discovery-rules-view.js +144 -0
  60. package/dist/pages/sources/discovery-rules-view.js.map +1 -0
  61. package/dist/pages/sources/discovery-rules.d.ts +57 -0
  62. package/dist/pages/sources/discovery-rules.d.ts.map +1 -0
  63. package/dist/pages/sources/discovery-rules.js +383 -0
  64. package/dist/pages/sources/discovery-rules.js.map +1 -0
  65. package/dist/pages/sources.d.ts.map +1 -1
  66. package/dist/pages/sources.js +4 -1
  67. package/dist/pages/sources.js.map +1 -1
  68. package/dist/pending.d.ts +6 -1
  69. package/dist/pending.d.ts.map +1 -1
  70. package/dist/pending.js +1 -1
  71. package/dist/pending.js.map +1 -1
  72. package/package.json +3 -3
  73. package/dist/assets/app.45b156168495.css +0 -2
  74. package/dist/assets/chunk.51497edc7697.js +0 -4
  75. package/dist/assets/chunk.fd375c54b526.js +0 -1
  76. package/dist/assets/packages.ab5ab25b1c75.js +0 -2
  77. package/dist/assets/sources.ae50f239f80f.js +0 -1
@@ -1,4 +0,0 @@
1
- import{a as Be}from"./chunk.675b635d9462.js";import{b as We}from"./chunk.28a4d8aab337.js";import{a as Xe,b as Je}from"./chunk.56d473a1587d.js";import{b as Ye}from"./chunk.8442124f6802.js";import{a as he}from"./chunk.a6d755a9789f.js";import{a as Ke,b as Ne,c as Q}from"./chunk.965b76812604.js";import{a as ue}from"./chunk.d813fefb410d.js";import{a as ie}from"./chunk.741aec8d1ff9.js";import{A as fe,B as X,C as J,D as U,E as $,F as H,K as Ge,c as B,d as Ve,g as ae,j as Ue,p as _,q as xe,r as _e,s as Ee,t as Pe,x as K,y as Y,z as W}from"./chunk.fd375c54b526.js";var Ae="Sync requested. Waiting for a worker. Sync continues in the background.";function Re(t,e,l){return t===200?`${e} is already available from ${l}.`:`${e}: ${Ae}`}function De(t){return t.status===202?{ok:!0,status:202,data:void 0}:t}var Qe="For proxy sources, packages appear when a client first requests them.";function mt(t,e){return t.sync?.generation!==e.sync?.generation||t.status!==e.status||t.lastPolledAt!==e.lastPolledAt||t.lastSuccessAt!==e.lastSuccessAt||t.lastError!==e.lastError}function Le(t,e){return e.sync&&(e.sync.listing||e.sync.queued+e.sync.running+(e.sync.retrying??0)>0)?"pending":mt(t,e)}function Ze(t,e=typeof document>"u"?void 0:document){let l=Date.now()+6e5,s=!1,a=0,m=!1,o=2e3,h,w=setTimeout(()=>b(),6e5),b=()=>{s=!0,clearTimeout(h),clearTimeout(w),e?.removeEventListener("visibilitychange",S)},S=()=>{e?.hidden&&b()},i=()=>{if(s||e?.hidden||Date.now()>=l||!m&&a>=15){b();return}h=setTimeout(()=>{if(s||e?.hidden||Date.now()>=l){b();return}a++,t().then(g=>{g==="pending"?(a=0,m=!0,o=Math.min(o*2,3e4)):(m=!1,o=2e3),g===!0?b():i()},b)},o)};return e?.addEventListener("visibilitychange",S),i(),b}var R=B(ae(),1);function et({source:t,busy:e,fieldError:l,alert:s,onSubmit:a,onClose:m}){return(0,R.jsx)(K,{open:!0,onOpenChange:o=>{!o&&!e&&m()},children:(0,R.jsxs)(Y,{onCancel:o=>{e&&o.preventDefault()},children:[(0,R.jsxs)(W,{children:[(0,R.jsx)(X,{children:"Add package"}),(0,R.jsxs)(J,{children:["Request a package from ",t.name," for this project."]})]}),(0,R.jsxs)("form",{className:"grid gap-3",onSubmit:o=>{o.preventDefault(),e||a(new FormData(o.currentTarget).get("name")?.toString()??"")},children:[(0,R.jsx)(H,{htmlFor:"add-package-name",children:"Package name"}),(0,R.jsx)($,{id:"add-package-name",name:"name",required:!0,maxLength:428,placeholder:t.ecosystem==="composer"?"vendor/package":"@scope/package",disabled:e,"aria-invalid":l?!0:void 0,"aria-describedby":l?"add-package-error":void 0}),l?(0,R.jsx)("p",{id:"add-package-error",role:"alert",children:l}):null,s?(0,R.jsx)("p",{role:"alert",children:s}):null,(0,R.jsxs)(fe,{children:[(0,R.jsx)(_,{type:"button",variant:"outline",disabled:e,onClick:m,children:"Cancel"}),(0,R.jsx)(_,{type:"submit",disabled:e,children:e?"Requesting\u2026":"Add package"})]})]})]})})}var D=B(Ve(),1);var q=B(Ve(),1);var u=B(ae(),1),tt={github:"GitHub",git:"Git over HTTP(S)",ssh:"Git over SSH"},ft=["github"];function ht(t){return Object.keys(tt).filter(e=>t.includes(e)).map(e=>[e,tt[e]])}var rt={composer:["packagist_proxy","composer_repository","vcs"],npm:["npmjs_proxy","npm_registry","hosted","vcs"]},Ie={packagist_proxy:"https://repo.packagist.org",npmjs_proxy:"https://registry.npmjs.org"},z={packagist_proxy:"Packagist proxy",composer_repository:"Composer repository",vcs:"Git repository",npmjs_proxy:"npmjs proxy",npm_registry:"Private npm registry",hosted:"Hosted repository"},bt={packagist_proxy:"Fetch public Composer packages on demand.",composer_repository:"Import selected packages from Satis, Private Packagist, or another Composer repository.",vcs:"Import a Composer or npm package from the root of a GitHub or Git repository.",npmjs_proxy:"Fetch public npm packages on demand.",npm_registry:"Fetch packages in selected scopes from another npm registry.",hosted:"Reserve private npm package names and publish packages to this broker."},Z={requirePublishApproval:"Require publish approval",name:"Source name",ecosystem:"Ecosystem",type:"Source type",url:"Repository URL",userAgent:"User-Agent override",pollIntervalSeconds:"Sync interval (seconds)",removalPolicy:"When a package disappears upstream",defaultVisibleToNewProjects:"Visible to new projects",retentionDaysOverride:"Archive retention (days)","config/provider":"Repository provider","config/repository":"GitHub repository","config/installationId":"GitHub App installation ID",githubAuthentication:"GitHub authentication","config/packageName":"Package name (optional)","config/refs/branches":"Branches to import","config/refs/tags":"Import tags","config/selection/packages":"Package names (one per line)","config/selection/patterns":"Package patterns (one per line)","config/selection/expandPatterns":"Expand patterns","config/distHosts":"Additional archive hosts","config/mirrorsFallback":"Try repository mirrors if an archive download fails","config/scopes":"Package scopes (one per line)","config/githubToken":"Use GitHub token"},oe={requirePublishApproval:"Choose whether new publishes require approval.",name:"Enter a source name.",ecosystem:"Choose an ecosystem.",type:"Choose a source type.",url:"Enter a valid HTTP or HTTPS URL without credentials, a query, or a fragment.",userAgent:"Enter a valid User-Agent header without line breaks.",pollIntervalSeconds:"Enter a whole number of seconds greater than 0.",removalPolicy:"Choose what happens when a package disappears upstream.",defaultVisibleToNewProjects:"Choose whether this source is visible to new projects.",retentionDaysOverride:"Enter a whole number of days that does not shorten organization retention.","config/provider":"Choose a repository provider this broker supports.","config/repository":"Enter a valid repository for the selected provider: owner/repository for GitHub, or a clone URL for Git.","config/installationId":"Enter a positive whole-number installation ID.",githubAuthentication:"Choose GitHub App or Personal access token.","config/packageName":"Enter a package name matching the source ecosystem.","config/refs/branches":"Enter valid branch names, one per line, without duplicates.","config/refs/tags":"Choose whether to import tags.","config/selection/packages":"Enter valid Composer package names, one per line, without duplicates.","config/selection/patterns":"Enter valid package patterns, such as acme/*, without duplicates.","config/selection/expandPatterns":"Choose whether to expand patterns.","config/distHosts":"Enter hostnames only, one per line, without schemes, paths, or duplicates.","config/mirrorsFallback":"Choose whether to try repository mirrors.","config/scopes":"Enter at least one scope, such as @acme, one per line without duplicates.","config/githubToken":"Save a bearer credential before enabling the GitHub token option."},je={requirePublishApproval:"New versions wait for approval before installation. Versions already held remain held when this setting is turned off.",pollIntervalSeconds:"How often to check for upstream changes. 300 seconds = 5 minutes.",retentionDaysOverride:"Leave blank to use the organization setting. An override can only lengthen retention.","config/distHosts":"One hostname per line. Archive downloads may come from these hosts; the source credential is also sent to them.","config/selection/packages":"Packages matching either list are selected. Empty lists select no packages.","config/scopes":"One scope per line, including @. Only these scopes use this registry. Register @scope/* for each scope before enabling the source.","config/packageName":"Leave blank to use the root manifest name (composer.json or package.json). For npm, this must match the name in package.json.","config/refs/branches":"One branch name per line. Leave blank to import no branches.","config/installationId":"Enter the numeric installation ID for the account that owns this repository."},yt={userAgent:"Use broker default",retentionDaysOverride:"Use organization default","config/selection/packages":"acme/payments","config/selection/patterns":"acme/*","config/scopes":"@acme","config/distHosts":"downloads.example.com","config/packageName":"acme/payments","config/refs/branches":"main","config/installationId":"12345678"};function it(t){let e={};for(let l of t){let s=l.path.replace(/^\/body\//,"").replace(/^\//,""),a=Object.keys(Z).find(m=>s===m||s.startsWith(`${m}/`));a&&(e[a]=oe[a]??"Review this setting.")}return e}function vt(t,e,l,s=null,a=s?ye(s):null){let m={},o=b=>String(t.get(b)??"").trim(),h=(b,S)=>{let i=Number(o(b));(!o(b)||!Number.isSafeInteger(i)||i<S)&&(m[b]=oe[b]??"Review this setting.")};!l&&!o("name")&&(m.name=oe.name),(e==="composer_repository"||e==="npm_registry")&&(!l||o("url")!==String(a?.get("url")??""))&&!o("url")&&(m.url=oe.url),h("pollIntervalSeconds",1),o("retentionDaysOverride")&&h("retentionDaysOverride",0);let w=!a||Object.keys(Z).some(b=>(b.startsWith("config/")||e==="vcs"&&b==="githubAuthentication")&&String(t.get(b)??"")!==String(a.get(b)??""));return ot(s,t)&&(w||t.has("replaceConfig"))&&(t.has("config/provider")||t.has("config/scopes")||t.has("config/selection/packages")||!l)&&(e==="composer_repository"&&!o("config/selection/packages")&&!o("config/selection/patterns")&&(m["config/selection/packages"]="Add at least one package name or pattern"),e==="npm_registry"&&!o("config/scopes")&&(m["config/scopes"]=oe["config/scopes"]),e==="vcs"&&!o("config/repository")&&(m["config/repository"]=oe["config/repository"]),e==="vcs"&&o("config/provider")==="github"&&o("githubAuthentication")!=="token"&&h("config/installationId",1)),m}function Te(t,e){let l=Number(t);if(!t.trim()||!Number.isSafeInteger(l)||l<e)throw new Error("Enter valid whole numbers for the numeric fields.");return l}function nt(t,e,l,s=!0){let a=w=>String(t.get(w)??""),m=w=>t.has(w),o=w=>a(w).split(/\r?\n/).map(b=>b.trim()).filter(Boolean),h={pollIntervalSeconds:Te(a("pollIntervalSeconds"),1),removalPolicy:a("removalPolicy")};if(e==="hosted"&&(h.requirePublishApproval=m("requirePublishApproval")),h.defaultVisibleToNewProjects=m("defaultVisibleToNewProjects"),h.retentionDaysOverride=a("retentionDaysOverride").trim()===""?null:Te(a("retentionDaysOverride"),0),h.userAgent=a("userAgent")||null,e!=="vcs"&&(h.url=a("url")||null),s&&(!l||t.has("config/provider")||t.has("config/scopes")||t.has("config/selection/packages")||e==="packagist_proxy"||e==="npmjs_proxy"))switch(e){case"vcs":h.config={provider:a("config/provider"),repository:a("config/repository"),...a("config/provider")==="github"&&a("githubAuthentication")!=="token"?{installationId:Te(a("config/installationId"),1)}:{},...a("config/packageName")?{packageName:a("config/packageName")}:{},refs:{branches:o("config/refs/branches"),tags:m("config/refs/tags")}};break;case"composer_repository":h.config={selection:{packages:o("config/selection/packages"),patterns:o("config/selection/patterns"),expandPatterns:m("config/selection/expandPatterns")},distHosts:o("config/distHosts"),mirrorsFallback:m("config/mirrorsFallback")};break;case"npm_registry":h.config={scopes:o("config/scopes"),distHosts:o("config/distHosts")};break;case"packagist_proxy":h.config={githubToken:l&&m("config/githubToken")};break;case"hosted":case"npmjs_proxy":h.config={};break}return h}function ot(t,e){return t===null||t.config!==void 0&&t.configComplete!==!1||e.has("replaceConfig")}function kt(t,e,l,s,a=s?ye(s):null){let m=nt(t,l,s!==null,ot(s,t));if(!s)return{name:String(t.get("name")??""),ecosystem:e,type:l,...m};let o=nt(a??ye(s),l,!0,s.config!==void 0&&s.configComplete!==!1);return Object.fromEntries(Object.entries(m).filter(([h,w])=>JSON.stringify(w)!==JSON.stringify(o[h])))}function be(t,e){let l=t?.config;for(let s of e.split("/")){if(typeof l!="object"||l===null)return;l=l[s]}return l}function ye(t){let e=new FormData;for(let l of Object.keys(Z)){let s=l.startsWith("config/")?be(t,l.slice(7)):t[l];typeof s=="boolean"?s&&e.set(l,"on"):Array.isArray(s)?e.set(l,s.join(`
2
- `)):s!=null&&e.set(l,String(s))}return(t.type==="packagist_proxy"||t.type==="npmjs_proxy")&&e.set("url",Ie[t.type]),e.set("pollIntervalSeconds",String(t.pollIntervalSeconds)),e.set("removalPolicy",t.removalPolicy),e.set("githubAuthentication",t.githubAuthentication??(be(t,"installationId")?"app":"token")),e}function Oe(t){return[...new Set(t.split(/\r?\n/).map(e=>e.trim()).filter(e=>/^@[a-z0-9][a-z0-9._~-]*$/.test(e)))].map(e=>`${e}/*`)}function at(t,e){if(!t)return;let l=Array.from(t.elements).find(a=>(a.getAttribute("name")??"")in e);if(!l)return;let s=l.closest("details");s&&(s.open=!0),l.focus()}function st({source:t,busy:e,errors:l,alert:s,onSubmit:a,onClose:m,vcsProviders:o=ft,initialType:h,initialProvider:w,organization:b=!0}){let[S,i]=(0,q.useState)(t?.ecosystem??(h==="hosted"?"npm":"composer")),[g,L]=(0,q.useState)(t?.type??h??"packagist_proxy"),E=ht(o),C=E[0]?.[0]??"github",[T,ee]=(0,q.useState)(be(t,"provider")??w??C),te=E.some(([p])=>p===T),V=g==="vcs"&&(E.length===0||!te);(0,q.useEffect)(()=>{!t&&!te&&E.length>0&&ee(C)},[t,te,E.length,C]);let[I,n]=(0,q.useState)(t?.githubAuthentication??(t?be(t,"installationId")?"app":"token":"app")),[d,c]=(0,q.useState)(""),f=t?ye(t):null,y=t!==null&&(t.configComplete===!1||t.config===void 0),[v,N]=(0,q.useState)(!1),[re,M]=(0,q.useState)({}),F=(0,q.useRef)(null),P={...l,...re},j=t!==null,x=g==="packagist_proxy"||g==="npmjs_proxy",ge=!V&&(!y||v);(0,q.useEffect)(()=>{at(F.current,l)},[l]);function ne(p){return[je[p]&&`source-${p}-help`,P[p]&&`source-${p}-error`].filter(Boolean).join(" ")||void 0}function Se(p){return(0,u.jsxs)(u.Fragment,{children:[je[p]?(0,u.jsx)("p",{id:`source-${p}-help`,className:"text-sm text-neutral-600",children:je[p]}):null,P[p]?(0,u.jsx)("p",{id:`source-${p}-error`,className:"text-sm text-red-700",children:P[p]}):null]})}function le(p,k,A=Z[p]){return(0,u.jsxs)("div",{className:"grid gap-1",children:[(0,u.jsx)(H,{htmlFor:`source-${p}`,children:A}),k,Se(p)]},p)}function O(p,k={}){let A={id:`source-${p}`,name:p,required:k.required,defaultValue:k.value??f?.get(p)?.toString(),onChange:p==="config/scopes"?ce=>c(ce.currentTarget.value):void 0,placeholder:k.placeholder??yt[p],"aria-invalid":!!P[p],"aria-describedby":ne(p)};return le(p,k.multiline?(0,u.jsx)(Je,{...A,rows:3,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-base sm:text-sm"}):(0,u.jsx)($,{...A,className:"h-11 text-base sm:text-sm",type:k.number?"number":"text",inputMode:k.number?"numeric":void 0,min:k.minimum,max:k.number?Number.MAX_SAFE_INTEGER:void 0,step:k.number?1:void 0,maxLength:p==="url"?2048:void 0}),`${k.label??Z[p]}${k.required?" (required)":""}`)}function G(p,k=Z[p],A,ce){return(0,u.jsxs)("div",{className:"grid gap-1",children:[(0,u.jsxs)(H,{className:"flex min-h-11 items-center gap-2",htmlFor:`source-${p}`,children:[(0,u.jsx)("input",{type:"checkbox",id:`source-${p}`,name:p,defaultChecked:t?f?.has(p):ce,onChange:A?Ce=>A(Ce.currentTarget.checked):void 0,"aria-invalid":!!P[p],"aria-describedby":ne(p)}),k]}),Se(p)]},p)}function we(p,k,A,ce,Ce=!1){return(0,u.jsxs)("fieldset",{className:"grid gap-1","aria-describedby":ne(p),"aria-invalid":!!P[p],children:[(0,u.jsx)("legend",{className:"text-sm font-medium",children:Z[p]}),(0,u.jsx)("div",{className:Ce?"flex gap-4":"grid gap-1",children:A.map(([me,gt,ze])=>(0,u.jsxs)("label",{className:"flex min-h-11 cursor-pointer items-center gap-2 py-1",children:[(0,u.jsx)("input",{type:"radio",name:p,value:me,checked:k===me,onChange:()=>ce(me),"aria-invalid":!!P[p],"aria-describedby":ne(p)}),(0,u.jsxs)("span",{children:[(0,u.jsx)("span",{className:"text-sm font-medium",children:gt}),ze?(0,u.jsx)("span",{className:"block text-sm text-neutral-600",children:ze}):null]})]},me))}),Se(p)]})}let pt={packagist_proxy:"Packagist",npmjs_proxy:"npmjs",composer_repository:"Acme Composer",npm_registry:"Acme npm",vcs:"Acme payments",hosted:""}[g];return(0,u.jsx)(K,{open:!0,onOpenChange:p=>{!p&&!e&&m()},children:(0,u.jsxs)(Y,{variant:"source",onCancel:p=>{e&&p.preventDefault()},children:[(0,u.jsxs)(W,{className:"shrink-0 p-6 pr-16",children:[(0,u.jsx)(X,{children:j?"Edit source":"Add source"}),(0,u.jsx)(J,{children:j?`${t.name} \xB7 ${S==="composer"?"Composer":"npm"} \xB7 ${z[g]}. Name, ecosystem and source type cannot be changed.`:"Add an upstream source for this organization or project."})]}),(0,u.jsxs)("form",{noValidate:!0,ref:F,className:"flex min-h-0 min-w-0 flex-1 flex-col",onSubmit:p=>{if(p.preventDefault(),e)return;let k=new FormData(p.currentTarget),A=vt(k,g,j,t,f);if(M(A),Object.keys(A).length){at(F.current,A);return}a(kt(k,S,g,t,f))},onInvalidCapture:p=>{let A=p.target.closest("details");A&&(A.open=!0)},children:[(0,u.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-6",children:[s||Object.keys(P).length?(0,u.jsx)("p",{role:"alert",className:"mb-4 text-sm text-red-700",children:Object.keys(P).length?"Review the highlighted fields.":s}):null,t?(0,u.jsxs)("dl",{className:"detail-list mb-4","aria-label":"Source identity",children:[(0,u.jsx)("dt",{children:"Source ID"}),(0,u.jsx)("dd",{children:(0,u.jsx)(U,{value:t.id,label:"source ID"})}),(0,u.jsx)("dt",{children:"Source URL"}),(0,u.jsx)("dd",{className:"break-all",children:de(t.url)??"No displayable URL"}),(0,u.jsx)("dt",{children:"Credential"}),(0,u.jsx)("dd",{children:t.hasCredential?"credential set \xB7 write-only":"No credential set"}),"attached"in t?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("dt",{children:"Attached to this project"}),(0,u.jsx)("dd",{children:t.attached?"Yes":"No"})]}):null]}):null,(0,u.jsxs)("fieldset",{disabled:e,className:"grid min-w-0 gap-4",children:[j?(0,u.jsx)(u.Fragment,{children:V?(0,u.jsx)("p",{className:"text-sm",children:`Source type: ${z[g]}. This broker cannot change its repository settings.`}):null}):(0,u.jsxs)(u.Fragment,{children:[we("ecosystem",S,[["composer","Composer"],["npm","npm"]],p=>{let k=p;i(k),L(rt[k][0]),c(""),M({})},!0),we("type",g,rt[S].filter(p=>(p!=="vcs"||E.length>0)&&(p!=="hosted"||b)).map(p=>[p,z[p],bt[p]]),p=>{L(p),c(""),ee(C),n("app"),M({})}),O("name",{required:!0,placeholder:pt})]}),x?(0,u.jsxs)("p",{className:"break-words text-sm",children:["Upstream URL: ",Ie[g]]}):null,x?(0,u.jsx)("input",{type:"hidden",name:"url",value:Ie[g]}):null,!x&&g!=="vcs"&&g!=="hosted"?(0,u.jsx)("div",{children:O("url",{required:!j||t.url!==null,value:t?.url??"",label:g==="npm_registry"?"Registry URL":"Repository URL",placeholder:g==="npm_registry"?"https://npm.example.com":"https://composer.example.com"})},`network:${g}`):null,y&&!V?(0,u.jsxs)("div",{className:"grid gap-1",children:[(0,u.jsx)("p",{className:"text-sm text-neutral-600",children:"Some saved settings cannot be displayed. Replace the configuration only if you intend to overwrite all saved type-specific settings."}),G("replaceConfig","Replace type-specific configuration",N)]}):null,ge?(0,u.jsxs)("div",{className:"grid gap-4",children:[g==="vcs"?(0,u.jsxs)(u.Fragment,{children:[le("config/provider",(0,u.jsx)(ie,{id:"source-config/provider",name:"config/provider",value:T,className:"h-11 text-base sm:text-sm","aria-invalid":!!P["config/provider"],"aria-describedby":ne("config/provider"),onChange:p=>ee(p.currentTarget.value),children:E.map(([p,k])=>(0,u.jsx)("option",{value:p,children:k},p))})),(0,u.jsxs)("div",{children:[O("config/repository",{required:!0,label:T==="github"?"GitHub repository":T==="git"?"Git repository URL":"SSH repository",placeholder:T==="github"?"acme/payments":T==="git"?"https://git.example.com/acme/payments.git":"git@git.example.com:acme/payments.git"}),T==="github"?(0,u.jsx)("p",{className:"mt-1 text-sm text-neutral-600",children:"Use owner/repository for GitHub, such as acme/payments."}):null]},T),T==="github"?(0,u.jsxs)(u.Fragment,{children:[j?(0,u.jsxs)(u.Fragment,{children:[le("githubAuthentication",(0,u.jsx)($,{id:"source-githubAuthentication",name:"githubAuthenticationDisplay",className:"h-11 text-base sm:text-sm",value:I==="app"?"GitHub App":"Personal access token",readOnly:!0})),(0,u.jsx)("input",{type:"hidden",name:"githubAuthentication",value:I})]}):we("githubAuthentication",I,[["app","GitHub App","Use an app installation with access to this repository."],["token","Personal access token","Add your token after creating the source."]],p=>n(p)),I==="app"?O("config/installationId",{required:!0,number:!0,minimum:1}):null]}):null]}):null,g==="composer_repository"?(0,u.jsxs)(u.Fragment,{children:[O("config/selection/packages",{multiline:!0}),O("config/selection/patterns",{multiline:!0})]}):null,g==="npm_registry"?(0,u.jsxs)(u.Fragment,{children:[O("config/scopes",{multiline:!0}),j?null:le("registeredPatterns",(0,u.jsx)("textarea",{id:"source-registeredPatterns",name:"registeredPatterns",rows:3,readOnly:!0,value:Oe(d).join(`
3
- `)}),"Names to register after adding this source")]}):null]},`primary:${g}`):null,g==="hosted"?(0,u.jsx)("p",{className:"text-sm text-neutral-600",children:"npm publishing is available. Register package names, then enable this source. A claim immediately stops the npmjs proxy from serving that name, even while this source is paused. Use an exact lowercase npm name or @scope/*. A scope claim hides public packages in that scope that are not yet cached."}):null,!j&&g!=="hosted"?(0,u.jsx)("p",{className:"text-sm text-neutral-600",children:x?"No credentials are needed to add this proxy.":g==="vcs"&&T==="github"?I==="app"?"After adding this source, save the GitHub App credentials.":"After adding this source, save your GitHub personal access token as a bearer credential.":g==="vcs"&&T==="ssh"?"After adding this source, save an SSH private key and known hosts.":"After adding this source, save its credentials to finish setup."}):null,g==="hosted"&&S==="npm"?G("requirePublishApproval"):null,(0,u.jsxs)("details",{className:"min-w-0",children:[(0,u.jsx)("summary",{className:"min-h-11 cursor-pointer py-3 text-sm font-medium",children:"Advanced settings"}),(0,u.jsxs)("div",{className:"grid gap-4 pt-2",children:[(0,u.jsx)("p",{className:"text-sm text-neutral-600",children:"Optional sync, visibility, retention, and connection settings."}),ge?(0,u.jsxs)("div",{className:"grid gap-4",children:[g==="composer_repository"||g==="npm_registry"?O("config/distHosts",{multiline:!0}):null,g==="composer_repository"?(0,u.jsxs)(u.Fragment,{children:[G("config/mirrorsFallback"),j?G("config/selection/expandPatterns"):null]}):null,g==="vcs"?(0,u.jsxs)(u.Fragment,{children:[O("config/packageName",{placeholder:S==="npm"?"@acme/payments":"acme/payments"}),O("config/refs/branches",{multiline:!0}),G("config/refs/tags",void 0,void 0,!0)]}):null,g==="packagist_proxy"&&j?G("config/githubToken"):null]},`advanced:${g}`):null,g==="packagist_proxy"&&j?(0,u.jsx)("p",{className:"text-sm text-neutral-600",children:"To enable Use GitHub token, save a bearer credential with your GitHub token, then select Use GitHub token and save the source."}):null,O("pollIntervalSeconds",{number:!0,minimum:1,value:t?.pollIntervalSeconds??300}),le("removalPolicy",(0,u.jsxs)(ie,{id:"source-removalPolicy",name:"removalPolicy",className:"h-11 text-base sm:text-sm","aria-invalid":!!P.removalPolicy,"aria-describedby":ne("removalPolicy"),defaultValue:t?.removalPolicy??"flag",children:[(0,u.jsx)("option",{value:"flag",children:"Keep available and mark removed"}),(0,u.jsx)("option",{value:"exclude",children:"Exclude from package resolution"})]})),G("defaultVisibleToNewProjects"),O("retentionDaysOverride",{number:!0,minimum:0}),O("userAgent")]})]})]})]}),(0,u.jsxs)(fe,{className:"shrink-0 border-t border-neutral-200 bg-white px-6 pt-4 pb-[max(1rem,env(safe-area-inset-bottom))]",children:[(0,u.jsx)(_,{className:"min-h-11",type:"button",variant:"outline",disabled:e,onClick:m,children:"Cancel"}),(0,u.jsx)(_,{type:"submit",className:"min-h-11",disabled:e,children:j?"Save source":"Add source"})]})]})]})})}var r=B(ae(),1),$e={http_basic:["username","password"],bearer:["token"],header:["name","value"],query:["param","value"],github_app:["appId","privateKeyPem","webhookSecret"],npm_token:["token"],ssh_key:["privateKeyPem","knownHosts"]},dt=Object.keys($e);function Fe(t,{scope:e,github:l,vcsProviders:s}){switch(t){case"packagist_proxy":return["bearer"];case"npmjs_proxy":case"hosted":return[];case"composer_repository":return["http_basic","bearer","header","query","npm_token"];case"npm_registry":return["npm_token","http_basic","bearer","header"];case"vcs":return l?e==="organization"?["bearer","github_app"]:["bearer"]:["bearer","http_basic","header","npm_token",...s?.includes("ssh")?["ssh_key"]:[]]}}function He(t,e){return{scope:t.projectId===null?"organization":"project",github:t.githubAuthentication!==void 0,vcsProviders:e}}function ve(t){return["packagist_proxy","npmjs_proxy","npm_registry"].includes(t.type)&&"attached"in t&&t.attached===!0}function St(t){if(t.type==="composer_repository")return"http_basic";if(t.type==="npm_registry")return"npm_token";if(t.type==="vcs"){let e=t.config;if(e?.provider==="ssh")return"ssh_key";if(e?.provider==="github"&&e.installationId!==void 0)return"github_app"}return"bearer"}function se(t){return["packagist_proxy","npmjs_proxy"].includes(t.type)}var ke="An organization admin must enable this source.",Me="Register package names, then enable the source.";function wt(t,e){let l=t?.config;return t?.type!=="npm_registry"||!Array.isArray(l?.scopes)?[]:Oe(l.scopes.join(`
4
- `)).filter(s=>!e.includes(s))}function de(t){if(t===null)return null;try{let e=new URL(t);return["https:","http:","ssh:","git:"].includes(e.protocol)?(e.username="",e.password="",e.search="",e.hash="",e.toString()):null}catch{return null}}function Ct(t,e,l=()=>new Date().toISOString()){let{client:s}=t,a={ownership:"organization",editor:null,fieldErrors:{},formError:null,available:[],availableNext:null,availableLoading:!1,availableError:!1,items:[],next:null,loading:!0,listError:!1,settingsVersion:0,vcsProviders:void 0,busy:!1,error:null,notice:null,createdSource:null,credentialSource:null,credentialVersion:0,credentialKind:"bearer",credentialKinds:dt,packageSource:null,packageFieldError:null,packageAlert:null,savedCredential:null,names:null,preview:null,order:[],etag:null,canEnableProjectSource:!1,canWriteSources:!1,enableDenied:[],enableConflicts:[]},m=new Set,o=n=>{a={...a,...n};for(let d of m)d()},h,w=()=>{},b=0,S=0,i=0,g=0,L=0;function E(n,d=!1){return n.ok?!1:(n.code==="reauth_required"?(t.requireReauth(d?{method:n.request.method,path:n.request.path}:n.request,{credential:d,secretFields:[]}),o({enableDenied:[],error:d?"Reauthenticate, then enter the credential again.":"Reauthentication is required."})):n.code==="claim_overlap"?o({error:"Another source already claims this package name or scope."}):n.code==="name_public"?o({error:"This name is already available from a public registry."}):n.code==="name_public_unverified"?o({error:"The public registry could not be checked. Try registering the name again later."}):o({error:"The request could not be saved or loaded. Refresh and try again."}),!0)}async function C(n=!1){if(n&&(a.loading||a.next===null))return;let d=++S,c=n?a.next:null,f=a.etag;++L,o({loading:!0,listError:!1,error:null,etag:null,preview:null,order:[],enableDenied:[],enableConflicts:[],notice:null});let y={limit:"100",...c===null?{}:{after:c}},[v,N]=await Promise.all([e!==null||a.ownership!=="organization"?h??=s.request("get","/_pb/me/permissions").then(x=>(x.ok||(h=void 0),x)):null,e===null?s.request("get","/_pb/sources",{query:{...y,...a.ownership==="organization"?{}:{ownership:a.ownership}}}):s.request("get","/_pb/projects/{project}/sources",{params:{project:e},query:y})]);if(d!==S)return;let re=!N.ok&&N.code==="reauth_required";if(v&&!v.ok&&!re&&(v.status!==403||v.code==="reauth_required")&&E(v),E(N)||!N.ok){o({loading:!1,listError:!0});return}o({canEnableProjectSource:v?.ok===!0&&v.data.organization.includes("org:sources:write")});let M=Be(N,"etag")??null;if(e!==null&&n&&M!==f){await C();return}let F=N.data.items.map(x=>({...x,url:de(x.url)})),P=n?[...a.items,...F]:F,j=P.flatMap(x=>"attached"in x&&x.attached===!0&&"precedence"in x&&typeof x.precedence=="number"?[{id:x.id,precedence:x.precedence}]:[]);o({items:P,settingsVersion:a.settingsVersion+1,next:N.data.next,vcsProviders:N.data.vcsProviders,loading:!1,etag:M,order:j.sort((x,ge)=>x.precedence-ge.precedence).map(({id:x})=>x)})}async function T(n=!1){if(e===null||n&&(a.availableLoading||a.availableNext===null))return;let d=++i,c=n?a.availableNext:null;o({availableLoading:!0,availableError:!1});let f=await s.request("get","/_pb/sources",{query:{limit:"100",...c===null?{}:{after:c}}});if(d!==i)return;if(!f.ok){o({available:[],availableNext:null,availableLoading:!1,availableError:!0});return}let y=f.data.items.map(v=>({...v,attached:!1,url:de(v.url)}));o({available:n?[...a.available,...y]:y,availableNext:f.data.next,availableLoading:!1})}async function ee(n){for(;!a.items.some(d=>d.id===n)&&a.next!==null&&!a.listError;)await C(!0);return a.items.find(d=>d.id===n)}async function te(n,d){let c=await ee(n);if(c&&o({createdSource:n,notice:`Next steps for ${c.name}`}),c&&!se(c)&&c.type!=="hosted"){let f=Fe(c.type,He(c,a.vcsProviders)),y=d?St(d):c.githubAuthentication==="app"?"github_app":f[0];o({credentialSource:n,credentialVersion:a.credentialVersion+1,credentialKinds:f,credentialKind:y!==void 0&&f.includes(y)?y:f[0]})}}async function V(n,d=!1){let c=a.names;if(d||o({credentialSource:null,error:null}),d&&(c?.source!==n||c.next===null))return;let f=++g,y=d?c?.next:null,v=await s.request("get","/_pb/sources/{source}/names",{params:{source:n},query:{limit:"100",...y==null?{}:{after:y}}});f!==g||E(v)||!v.ok||o({names:{...v.data,source:n,items:d?[...c.items,...v.data.items]:v.data.items}})}async function I(n,d,c=()=>!1){if(!a.busy){o({busy:!0,error:null,notice:null});try{let f=await n();!c(f)&&!E(f)&&await d()}finally{o({busy:!1})}}}return{project:e,dispose(){++b,w()},snapshot:()=>a,enableNeedsAdmin(n){return n.projectId!==null&&(!a.canEnableProjectSource||a.enableDenied.includes(n.id))},subscribe(n){return m.add(n),()=>{m.delete(n)}},load:C,async setOwnership(n){e!==null||a.busy||(o({ownership:n,items:[],next:null}),await C())},loadAvailable:T,names:V,openEditor(n=null){a.busy||n&&e!==null&&n.projectId===null||o({editor:n??"create",fieldErrors:{},formError:null,error:null,credentialSource:null,savedCredential:null})},closeEditor(){a.busy||o({editor:null,fieldErrors:{},formError:null})},async saveSource(n){if(a.busy||a.editor===null)return;let d=a.editor;if(d!=="create"&&Object.keys(n).length===0){o({editor:null,fieldErrors:{},formError:null});return}o({busy:!0,error:null,formError:null,fieldErrors:{}});try{let c=d==="create"?e===null?await s.request("post","/_pb/sources",{body:n}):await s.request("post","/_pb/projects/{project}/sources",{params:{project:e},body:n}):e===null?await s.request("patch","/_pb/sources/{source}",{params:{source:d.id},headers:{"If-Match":`"r${d.revision}"`},body:n}):await s.request("patch","/_pb/projects/{project}/sources/{source}",{params:{project:e,source:d.id},headers:{"If-Match":`"r${d.revision}"`},body:n});if(!c.ok){E(c),c.status===412&&o({error:"This source changed while you were editing. Reload the latest settings before saving."}),o({fieldErrors:it(c.details),formError:a.error});return}o({editor:null,fieldErrors:{},formError:null,...d==="create"&&e===null&&a.ownership==="project"?{ownership:"organization"}:{}}),await C(),d==="create"&&c.data&&"id"in c.data&&await te(c.data.id,n)}finally{o({busy:!1})}},attachment(n,d){return e===null?Promise.resolve():I(()=>d?s.request("put","/_pb/projects/{project}/sources/{source}/attachment",{params:{project:e,source:n},body:{}}):s.request("delete","/_pb/projects/{project}/sources/{source}/attachment",{params:{project:e,source:n}}),()=>C())},async replayed(n){let d=e===null?"/_pb/sources":`/_pb/projects/${encodeURIComponent(e)}/sources`,c=/^\/_pb\/sources\/[^/]+\/names(?:\/[^/]+)?$/.test(n.path),f=/^\/_pb\/sources\/([^/]+)\/enable$/.exec(n.path);if(n.path!==d&&!n.path.startsWith(`${d}/`)&&!c&&!f)return;let y=a.names?.source;o({enableDenied:[],enableConflicts:[]}),n.ok&&o({editor:null,fieldErrors:{},formError:null,...n.createdSourceId&&e===null&&a.ownership==="project"?{ownership:"organization"}:{}}),await C(),f&&!n.ok&&(n.status===403&&n.code==="forbidden"&&a.items.some(v=>v.id===f[1]&&v.projectId!==null)?o({enableDenied:[f[1]],notice:ke}):n.status===409&&n.code==="conflict"?o({enableConflicts:[f[1]],notice:Me}):o({error:"The request could not be saved or loaded. Refresh and try again."})),n.ok&&n.createdSourceId&&await te(n.createdSourceId),y!==void 0&&await V(y)},moveSource(n,d){if(a.loading||a.busy||a.next!==null)return;let c=[...a.order],f=c.indexOf(n),y=f+d;f<0||y<0||y>=c.length||([c[f],c[y]]=[c[y],c[f]],o({order:c}))},async saveOrder(){if(e===null||a.loading||a.busy||a.next!==null||a.etag===null)return;let n=a.etag,d=[...a.order];o({busy:!0,error:null,preview:null}),++L;try{let c=await s.request("put","/_pb/projects/{project}/sources/order",{params:{project:e},headers:{"If-Match":n},body:{sourceIds:d}});!c.ok&&c.status===412?(await C(),o({error:"Source ordering changed. Review the reloaded list before saving again."})):E(c)||await C()}finally{o({busy:!1})}},closeCredential(){a.busy||o({credentialSource:null})},closeNames(){a.busy||(++g,o({names:null}))},chooseCredential(n){if(a.busy)return;let d=a.items.find(f=>f.id===n),c=d?Fe(d.type,He(d,a.vcsProviders)):["bearer"];c.length!==0&&(++g,o({credentialSource:n,names:null,savedCredential:null,credentialVersion:a.credentialVersion+1,credentialKind:d?.githubAuthentication==="app"&&c.includes("github_app")?"github_app":c[0],credentialKinds:c,error:null}))},openPackage(n){a.busy||e===null||!ve(n)||n.status==="paused"||o({packageSource:n,packageFieldError:null,packageAlert:null,notice:null})},closePackage(){a.busy||o({packageSource:null,packageFieldError:null,packageAlert:null})},async addPackage(n){let d=a.packageSource;if(!(a.busy||e===null||!d||!ve(d))){if(n=n.trim(),!n||n.length>428){o({packageFieldError:"Enter a package name of 1 to 428 characters."});return}o({busy:!0,packageFieldError:null,packageAlert:null,notice:null});try{let c=await s.request("post","/_pb/projects/{project}/sources/{source}/packages",{params:{project:e,source:d.id},body:{name:n}});c.ok?o({packageSource:null,notice:c.status===202?Re(202,c.data.name,d.name):Re(200,c.data.name,d.name)}):c.status===400&&c.code==="invalid_request"?o({packageFieldError:"Enter a valid package name for this source."}):c.code==="package_not_found"?o({packageAlert:"Not found upstream. Check the package name or use another source."}):c.status===400?o({packageFieldError:"This source does not support that package. Check the name or use another source."}):c.code==="forbidden"?o({packageAlert:"You do not have permission to add packages to this project."}):c.status===502?o({packageAlert:"The upstream registry refused or failed the request. Check the source credential or try again later."}):c.status===404?o({packageAlert:"The package or attached source could not be found. Check the name and refresh sources."}):c.status===503?o({packageAlert:"Package requests are temporarily unavailable. Try again shortly."}):c.status===409?o({packageAlert:"This source is paused. Enable it before adding a package."}):(E(c),o({packageAlert:a.error,error:null}))}finally{o({busy:!1})}}},async credential(n,d,c){if(!a.busy){o({busy:!0,error:null,credentialSource:n,credentialVersion:a.credentialVersion+1,savedCredential:null});try{let f=e===null?await s.request("put","/_pb/sources/{source}/credential",{params:{source:n},body:{kind:d,material:c}}):await s.request("put","/_pb/projects/{project}/sources/{source}/credential",{params:{project:e,source:n},body:{kind:d,material:c}});E(f,!0)||o({savedCredential:{source:n,at:l()},notice:"Credential set.",items:a.items.map(y=>y.id===n?{...y,hasCredential:!0}:y)})}finally{o({busy:!1})}}},edit(n,d,c){if(!Number.isSafeInteger(d)||d<=0)return o({error:"Polling interval must be a positive whole number."}),Promise.resolve();let f=a.items.find(N=>N.id===n)?.revision;if(f===void 0)return o({error:"Reload sources before saving."}),Promise.resolve();let y={"If-Match":`"r${f}"`},v={pollIntervalSeconds:d,removalPolicy:c};return I(()=>e===null?s.request("patch","/_pb/sources/{source}",{params:{source:n},body:v,headers:y}):s.request("patch","/_pb/projects/{project}/sources/{source}",{params:{project:e,source:n},body:v,headers:y}),()=>C())},async loadMutationPermissions(){let n=e===null?await s.request("get","/_pb/me/permissions"):await s.request("get","/_pb/projects/{project}/permissions",{params:{project:e}});o({canWriteSources:n.ok&&("organization"in n.data?n.data.organization.includes("org:sources:write"):n.data.project.includes("project:sources:write"))})},syncNow(n){if(a.busy||n.status==="paused"||e!==null&&n.projectId===null)return Promise.resolve();w();let d=++b;return I(()=>e===null?s.request("post","/_pb/sources/{source}/sync",{params:{source:n.id}}).then(De):s.request("post","/_pb/projects/{project}/sources/{source}/sync",{params:{project:e,source:n.id}}).then(De),async()=>{if(d!==b)return;let c=async()=>{let y=S,v=a.ownership,N=null;do{let re={limit:"100",...N===null?{}:{after:N}},M=e===null?await s.request("get","/_pb/sources",{query:{...re,...v==="organization"?{}:{ownership:v}}}):await s.request("get","/_pb/projects/{project}/sources",{params:{project:e},query:re});if(d!==b||y!==S||!M.ok)return!0;let F=M.data.items.find(P=>P.id===n.id);if(F)return o({items:a.items.map(P=>P.id===n.id?{...F,url:de(F.url)}:P)}),Le(n,F);N=M.data.next}while(N!==null);return!0},f;if(a.loading&&a.items.length===0){await C();let y=await ee(n.id);f=a.listError||!y||Le(n,y)}else f=await c();d===b&&(o({notice:Ae}),f!==!0&&d===b&&(w=Ze(c)))})},async togglePause(n){if(e!==null&&n.projectId===null)return;if(n.status==="paused"&&!se(n)){if(a.busy||n.projectId!==null&&(!a.canEnableProjectSource||a.enableDenied.includes(n.id)))return;o({enableConflicts:a.enableConflicts.filter(c=>c!==n.id)}),await I(()=>s.request("post","/_pb/sources/{source}/enable",{params:{source:n.id}}),()=>C(),c=>n.projectId!==null&&!c.ok&&c.status===403&&c.code==="forbidden"?(o({enableDenied:[...new Set([...a.enableDenied,n.id])],notice:ke}),!0):!c.ok&&c.status===409&&c.code==="conflict"?(o({enableConflicts:[...new Set([...a.enableConflicts,n.id])],notice:Me}),!0):!1);return}let d=n.status==="paused"?"resume":"pause";return I(()=>e===null?s.request("post",`/_pb/sources/{source}/${d}`,{params:{source:n.id}}):s.request("post",`/_pb/projects/{project}/sources/{source}/${d}`,{params:{project:e,source:n.id}}),()=>C())},addName(n,d){let c=a.items.find(f=>f.id===n)?.ecosystem==="npm"?214:50;return d.length===0||d.length>c||!/^[a-z0-9._~@!/*-]+$/.test(d)?(o({error:`Enter a registered pattern of 1 to ${c} supported characters.`}),Promise.resolve()):I(()=>s.request("post","/_pb/sources/{source}/names",{params:{source:n},body:{pattern:d}}),()=>V(n))},removeName(n,d){return I(()=>s.request("delete","/_pb/sources/{source}/names/{name}",{params:{source:n,name:d}}),async()=>{await V(n),await C()})},async resolve(n){let d=++L;if(o({preview:null,error:null}),e===null||n.length===0||n.length>214){o({error:`Choose a project and enter a package name of 1 to ${214} characters.`});return}let c=await s.request("get","/_pb/projects/{project}/resolve",{params:{project:e},query:{name:n}});d===L&&!E(c)&&c.ok&&o({preview:c.data})}}}function xt(t,e,l){let s=l.elements.namedItem("kind")?.value,a=dt.includes(s)?$e[s]:null,m=a===null?null:JSON.stringify(Object.fromEntries(a.map(o=>[o,l.elements.namedItem(o)?.value??""])));return l.reset(),m===null?Promise.resolve():t.credential(e,s,m)}function _t({kind:t,busy:e}){return(0,r.jsx)(r.Fragment,{children:$e[t].map(l=>(0,r.jsxs)("div",{children:[(0,r.jsx)(H,{htmlFor:`credential-${l}`,children:l}),(0,r.jsx)($,{id:`credential-${l}`,name:l,type:"password",autoComplete:"off",defaultValue:"",maxLength:16384,required:!0,disabled:e})]},l))})}function Et({model:t,source:e,busy:l,initialKind:s,kinds:a}){let[m,o]=(0,D.useState)(s);return(0,r.jsxs)("form",{className:"grid gap-3",autoComplete:"off",onSubmit:h=>{h.preventDefault(),!l&&xt(t,e,h.currentTarget)},children:[(0,r.jsx)(H,{htmlFor:"credential-kind",children:"Credential kind"}),(0,r.jsx)(ie,{id:"credential-kind",name:"kind",value:m,disabled:l,onChange:h=>o(h.currentTarget.value),children:a.map(h=>(0,r.jsx)("option",{value:h,children:h},h))}),(0,r.jsx)(_t,{kind:m,busy:l},m),(0,r.jsx)(_,{type:"submit",className:"w-fit",disabled:l,children:"Save credential"})]})}function lt(t,e){return new FormData(t).get(e)?.toString()??""}var qe={network:"Network failure",timeout:"Sync timed out",http_error:"HTTP error",unauthorized:"Authorization failed",rate_limited:"Rate limited",not_found:"Not found",invalid_response:"Invalid response",tag_limit_exceeded:"Tag limit exceeded",mass_absence:"Mass package absence",too_large:"Response too large",policy_denied:"Policy denied",credential_unavailable:"Credential unavailable",internal:"Internal error",name_mismatch:"Package name differs from configuration",version_mismatch:"Manifest version differs from tag",invalid_manifest:"Invalid package manifest",unsupported_files_pattern:"Unsupported package file pattern",invalid_packlist:"Package files could not be packed",invalid_tarball:"Invalid repository archive",archive_changed:"Repository archive changed during packing"};function Pt({source:t}){let e=t.lastError!==null&&Object.hasOwn(qe,t.lastError)?qe[t.lastError]:null;return(0,r.jsxs)("div",{className:"grid gap-1 text-sm",children:[(0,r.jsxs)("p",{children:["Last listing: ",(0,r.jsx)(ue,{value:t.lastSuccessAt,fallback:"Never"})]}),(0,r.jsxs)("p",{children:["Last listing error:"," ",t.lastError===null?"None":(0,r.jsxs)(r.Fragment,{children:[e&&`${e} \xB7 `,(0,r.jsx)("code",{children:t.lastError})]})]}),t.sync&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{children:["Latest sync: ",t.sync.queued," queued \xB7 ",t.sync.running," running \xB7"," ",t.sync.retrying," retrying \xB7 ",t.sync.failed," failed \xB7 ",t.sync.completed," ","completed"]}),t.sync.errors.slice(0,3).map(({code:l,count:s})=>(0,r.jsxs)("p",{children:[qe[l]," \xB7 ",(0,r.jsx)("code",{children:l}),": ",s]},l))]}),se(t)?(0,r.jsx)("p",{children:Qe}):null,(0,r.jsxs)("p",{children:["Next poll: ",(0,r.jsx)(ue,{value:t.nextPollAt,fallback:"None"})]})]})}function Nt({source:t,model:e,busy:l}){let[s,a]=(0,D.useState)(null);(0,D.useEffect)(()=>{s&&(s.id!==t.id||s.status!==t.status)&&a(null)},[s,t.id,t.status]);let m=e.project===null?t.projectId===null:t.projectId!==null,o=e.project===null&&t.projectId!==null,h=(m||o)&&t.status==="paused"&&!se(t)&&e.enableNeedsAdmin(t),w=e.snapshot().enableConflicts.includes(t.id),b=`source-actions-note-${t.id}`,S=!m&&!o?"Manage this organization source in organization scope.":[h&&ke,w&&Me].filter(Boolean).join(" "),i=m?[{id:"edit",label:"Edit",disabled:l,onSelect:()=>e.openEditor(t)},...e.snapshot().canWriteSources&&t.type!=="hosted"?[{id:"sync",label:"Sync now",disabled:l||t.status==="paused",...t.status==="paused"?{describedBy:`sync-paused-${t.id}`}:{},onSelect:()=>{e.syncNow(t)}}]:[]]:[],g=[];return m||o?(o&&(t.status!=="paused"||se(t))||g.push(t.status==="paused"?{id:"enable",label:"Enable",disabled:l||h,...h||w?{describedBy:b}:{},onSelect:()=>{e.togglePause(t)}}:{id:"pause",label:"Pause source\u2026",disabled:l,onSelect:()=>a(t)}),m&&Fe(t.type,He(t,e.snapshot().vcsProviders)).length>0&&g.push({id:"credential",label:t.type==="packagist_proxy"?"Add GitHub token (optional)":"Set credential",disabled:l,onSelect:()=>e.chooseCredential(t.id)})):g.push({id:"manage",label:"Manage source",disabled:!0,describedBy:b,onSelect:()=>{}}),e.project!==null&&e.snapshot().canWriteSources&&ve(t)&&g.push({id:"add-package",label:"Add package",disabled:l||t.status==="paused",...t.status==="paused"?{describedBy:`add-package-paused-${t.id}`}:{},onSelect:()=>e.openPackage(t)}),g.push({id:"names",label:"Registered names",disabled:l,onSelect:()=>{e.names(t.id)}}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Xe,{entityLabel:t.name,actions:i,overflow:g}),m&&t.status==="paused"?(0,r.jsx)("p",{id:`sync-paused-${t.id}`,children:"Enable before syncing."}):null,e.project!==null&&ve(t)&&t.status==="paused"?(0,r.jsx)("p",{id:`add-package-paused-${t.id}`,children:"Enable before adding a package."}):null,S?(0,r.jsx)("p",{id:b,children:S}):null,(0,r.jsx)(he,{action:"Pause",target:`${t.name} (${t.id})`,scope:e.project===null?"Organization":`Project: ${e.project}`,description:"Pausing this source stops it from resolving packages in this scope. You can enable it again later.",disabled:l,open:s?.id===t.id&&s.status===t.status&&t.status!=="paused",onOpenChange:L=>{L||a(null)},hideTrigger:!0,onConfirm:()=>{e.togglePause(t)}})]})}function At(t,e){return t.filter(l=>l.name.toLowerCase().includes(e.q.toLowerCase())&&(!e.type||l.type===e.type)&&(!e.scope||(e.scope==="organization"?l.projectId===null:l.projectId!==null)))}function Rt({model:t}){let e=(0,D.useSyncExternalStore)(t.subscribe,t.snapshot,t.snapshot),[l,s]=(0,D.useState)({q:"",type:"",scope:""}),a=!!(l.q||l.type||l.scope),m=e.items.find(i=>i.id===e.createdSource),o=(0,D.useMemo)(()=>{let i=e.names;return i===null?[]:wt(e.items.find(g=>g.id===i.source),i.items.map(g=>g.pattern))},[e.items,e.names]),h=!e.loading&&!e.listError&&e.next===null,w=e.items.find(i=>i.id===e.credentialSource)?.type==="packagist_proxy",b=[...e.items,...h?e.available.filter(i=>!e.items.some(g=>g.id===i.id)):[]],S=At(b,l).sort((i,g)=>{let L=E=>{let C=e.order.indexOf(E);return C<0?1/0:C};return L(i.id)-L(g.id)});return(0,r.jsxs)("section",{"aria-labelledby":"page-heading",className:"grid gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsx)("h1",{tabIndex:-1,id:"page-heading",className:"text-xl font-semibold",children:"Sources"}),(0,r.jsx)(_,{type:"button",disabled:e.busy,onClick:()=>t.openEditor(),children:"Add source"})]}),e.editor!==null?(0,r.jsx)(st,{organization:t.project===null,source:e.editor==="create"?null:e.editor,busy:e.busy,errors:e.fieldErrors,alert:e.formError,onSubmit:i=>{e.editor==="create"&&s({q:"",type:"",scope:""}),t.saveSource(i)},onClose:()=>t.closeEditor(),vcsProviders:e.vcsProviders,initialType:typeof window<"u"&&new URLSearchParams(window.location.hash.split("?")[1]).get("create")==="vcs"?"vcs":void 0,initialProvider:typeof window<"u"&&new URLSearchParams(window.location.hash.split("?")[1]).get("provider")==="github"?"github":void 0}):null,(0,r.jsx)("p",{className:"text-neutral-600",children:"Upstream registries and private repositories. Attached sources are tried in precedence order."}),t.project===null?(0,r.jsxs)(H,{children:["Ownership",(0,r.jsxs)(ie,{value:e.ownership,disabled:e.busy,onChange:i=>{t.setOwnership(i.target.value)},children:[(0,r.jsx)("option",{value:"organization",children:"Organization"}),(0,r.jsx)("option",{value:"project",children:"Project-owned"}),(0,r.jsx)("option",{value:"all",children:"All"})]})]}):null,(0,r.jsx)(We,{values:{...l,scope:l.scope==="organization"?"Organization":l.scope==="project"?"Project":"",type:z[l.type]??""},fields:[{key:"q",label:"Name (loaded sources)"},{key:"type",label:"Type",options:[...new Set(b.map(i=>z[i.type]))].sort()},...t.project===null?[]:[{key:"scope",label:"Source scope",options:["Organization","Project"]}]],onChange:i=>s({q:i.q??"",scope:t.project===null?"":i.scope==="Organization"?"organization":i.scope==="Project"?"project":"",type:Object.keys(z).find(g=>z[g]===i.type)??""})}),(0,r.jsx)("p",{role:"status","aria-live":"polite",children:e.notice}),m?.status==="paused"&&!se(m)?(0,r.jsxs)("p",{children:["Next steps for ",m.name,":"," ",t.enableNeedsAdmin(m)?ke:e.names?.source===m.id&&e.names.items.length>0?"Enable the source.":"Register names, then Enable the source."]}):null,e.error&&!e.listError?(0,r.jsx)(Q,{kind:"error",title:e.error}):null,e.listError?(0,r.jsxs)(Q,{kind:"error",title:"Sources could not be loaded.",children:[e.error?(0,r.jsx)("p",{children:e.error}):null,(0,r.jsx)(_,{type:"button",className:"w-fit",disabled:e.loading||e.busy,onClick:()=>{t.load()},children:"Retry sources"})]}):null,!e.listError&&!e.availableError?(0,r.jsx)(_,{type:"button",className:"w-fit",variant:"outline",disabled:e.loading||e.busy,onClick:()=>{t.load(),t.loadAvailable()},children:"Refresh sources"}):null,t.project!==null&&!h&&e.available.length>0?(0,r.jsx)("p",{className:"text-sm text-neutral-600",children:"Load all project sources before attaching organization sources."}):null,e.availableLoading?(0,r.jsx)(Q,{kind:"loading",title:"Loading organization sources\u2026"}):null,e.availableError?(0,r.jsx)(Q,{kind:"error",title:"Organization sources could not be loaded.",children:(0,r.jsx)(_,{type:"button",className:"w-fit",disabled:e.availableLoading||e.busy,onClick:()=>{t.loadAvailable()},children:"Retry organization sources"})}):null,e.loading?(0,r.jsx)(Q,{kind:"loading",title:"Loading sources\u2026"}):!e.listError&&S.length===0?(0,r.jsx)(Q,{kind:a?"filtered-empty":"empty",title:a?"No sources match these filters.":"No sources."}):null,!e.loading&&!e.listError&&S.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"text-sm text-neutral-600",children:[S.length," sources loaded",a?" matching filters":""]}),(0,r.jsx)(Ke,{label:"Sources in precedence order",items:S,columns:[{key:"name",label:"Source",value:i=>i.name,render:i=>(0,r.jsxs)("div",{className:"grid gap-1",children:[(0,r.jsx)("strong",{children:i.name}),"projectName"in i&&i.projectName!==null?(0,r.jsx)("span",{children:`Project: ${i.projectName}`}):null,(0,r.jsxs)("span",{className:"text-xs text-neutral-600",children:[i.ecosystem==="composer"?"Composer":"npm"," \xB7"," ",z[i.type]]}),(0,r.jsx)(Ye,{status:i.status})]})},{key:"precedence",label:"Precedence",value:i=>e.order.indexOf(i.id)<0?"\u2014":e.order.indexOf(i.id)+1,render:i=>{let g=e.order.indexOf(i.id);return g<0?"\u2014":(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,r.jsx)("strong",{children:g+1}),(0,r.jsx)(_,{type:"button",size:"sm",variant:"ghost","aria-label":`Move up ${i.name}`,disabled:e.busy||e.next!==null||g===0,onClick:()=>t.moveSource(i.id,-1),children:"Move up"}),(0,r.jsx)(_,{type:"button",size:"sm",variant:"ghost","aria-label":`Move down ${i.name}`,disabled:e.busy||e.next!==null||g===e.order.length-1,onClick:()=>t.moveSource(i.id,1),children:"Move down"})]})}},{key:"scope",label:"Attached to",value:i=>i.projectId===null?"Organization source":"Project source",render:i=>(0,r.jsxs)("div",{className:"grid gap-1",children:[(0,r.jsx)("span",{children:i.projectId===null?"Organization source":"Project source"}),t.project===null&&"attachedProjectCount"in i?(0,r.jsx)(Ne,{variant:"secondary",children:`Attached to ${i.attachedProjectCount} projects`}):null,"attached"in i?(0,r.jsx)("span",{className:"text-xs text-neutral-600",children:i.attached?"Attached to this project":"Not attached to this project"}):null]})},{key:"credential",label:"Credentials",value:i=>i.hasCredential?"Set \xB7 write-only":"None",render:i=>i.hasCredential?(0,r.jsx)(Ne,{variant:"outline",children:"Set \xB7 write-only"}):"None"},{key:"sync",label:"Sync status",value:i=>i.lastSuccessAt??"",render:i=>(0,r.jsx)(Pt,{source:i})},{key:"id",label:"Source ID",value:i=>i.id,priority:3,render:i=>(0,r.jsx)(U,{value:i.id,label:"source ID"})},{key:"actions",label:"Actions",value:()=>"",sortable:!1,render:i=>(0,r.jsxs)("div",{className:"flex flex-wrap items-start gap-2",children:[t.project!==null&&"attached"in i?i.attached?(0,r.jsx)(he,{action:"Detach",target:`${i.name} (${i.id})`,scope:`Project: ${t.project}`,description:"Detaching this source stops this project from resolving packages through it. You can attach it again later.",disabled:e.busy,onConfirm:()=>{t.attachment(i.id,!1)}}):(0,r.jsx)(_,{type:"button",size:"sm",variant:"outline",disabled:e.busy,onClick:()=>{t.attachment(i.id,!0)},children:"Attach"}):null,(0,r.jsx)(Nt,{source:i,model:t,busy:e.busy})]})}]})]}):null,e.next!==null?(0,r.jsx)(_,{type:"button",className:"w-fit",disabled:e.loading||e.busy,onClick:()=>{t.load(!0)},children:"Load more sources"}):null,e.availableNext!==null?(0,r.jsx)(_,{type:"button",className:"w-fit",disabled:e.availableLoading||e.busy,onClick:()=>{t.loadAvailable(!0)},children:"Load more organization sources"}):null,e.packageSource!==null?(0,r.jsx)(et,{source:e.packageSource,busy:e.busy,fieldError:e.packageFieldError,alert:e.packageAlert,onSubmit:i=>{t.addPackage(i)},onClose:()=>t.closePackage()},e.packageSource.id):null,e.credentialSource!==null?(0,r.jsx)(K,{open:!0,onOpenChange:i=>{i||t.closeCredential()},children:(0,r.jsxs)(Y,{variant:"source",onCancel:i=>{e.busy&&i.preventDefault()},children:[(0,r.jsxs)(W,{className:"shrink-0 p-6 pr-16",children:[(0,r.jsx)(X,{children:w?"Add GitHub token (optional)":"Set credential"}),(0,r.jsxs)(J,{children:["Credentials are write-only. Save a new credential to rotate a secret.",w?" This optional bearer token is used only for GitHub archive downloads and their rate limits. Enable Use GitHub token in Edit after saving it.":""]})]}),(0,r.jsxs)("div",{className:"grid min-h-0 gap-3 overflow-y-auto px-6 pb-6",children:[(0,r.jsx)(U,{value:e.credentialSource,label:"source ID"}),(0,r.jsx)(Et,{model:t,source:e.credentialSource,initialKind:e.credentialKind,kinds:e.credentialKinds,busy:e.busy},e.credentialVersion),e.error?(0,r.jsx)("p",{role:"alert",children:e.error}):null,e.savedCredential?.source===e.credentialSource?(0,r.jsxs)("p",{children:["credential set \xB7 ",(0,r.jsx)(ue,{value:e.savedCredential.at})]}):null]})]})}):null,e.savedCredential&&e.credentialSource===null?(0,r.jsxs)("p",{children:["credential set \xB7 ",e.savedCredential.source," \xB7"," ",(0,r.jsx)(ue,{value:e.savedCredential.at})]}):null,e.names?(0,r.jsx)(K,{open:!0,onOpenChange:i=>{i||t.closeNames()},children:(0,r.jsxs)(Y,{variant:"source",onCancel:i=>{e.busy&&i.preventDefault()},children:[(0,r.jsxs)(W,{className:"shrink-0 p-6 pr-16",children:[(0,r.jsx)(X,{children:"Registered names"}),(0,r.jsx)(J,{children:"Manage the package patterns registered for this source. For npm, use an exact lowercase name or @scope/*. A scope claim hides public packages in that scope that are not yet cached."})]}),(0,r.jsxs)("div",{className:"grid min-h-0 gap-3 overflow-y-auto px-6 pb-6",children:[e.error?(0,r.jsx)("p",{role:"alert",children:e.error}):null,(0,r.jsx)(U,{value:e.names.source,label:"source ID"}),(0,r.jsx)("ul",{children:e.names.items.map(i=>(0,r.jsxs)("li",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{children:i.pattern}),(0,r.jsx)(he,{action:`Remove ${i.pattern}`,target:i.pattern,scope:t.project===null?"Organization":`Project: ${t.project}`,description:"Removing this registered pattern can stop the source from resolving matching packages. Add the pattern again to restore it.",disabled:e.busy,onConfirm:()=>{t.removeName(i.sourceId,i.id)}})]},i.id))}),e.names.next!==null?(0,r.jsx)(_,{type:"button",disabled:e.busy,onClick:()=>{t.names(e.names.source,!0)},children:"Load more names"}):null,(0,r.jsxs)("form",{className:"grid gap-3",onSubmit:i=>{if(i.preventDefault(),e.busy)return;let g=i.currentTarget,L=lt(g,"pattern");t.addName(e.names.source,L)},children:[(0,r.jsx)(H,{htmlFor:"registered-pattern",children:"Registered pattern"}),(0,r.jsx)($,{id:"registered-pattern",name:"pattern",maxLength:e.items.find(i=>i.id===e.names?.source)?.ecosystem==="npm"?214:50,required:!0,defaultValue:o[0]??""},`${e.names.source}:${e.names.items.map(i=>i.pattern).join(",")}`),o.map(i=>(0,r.jsxs)("p",{className:"text-sm",children:["Register ",i," before enabling this source."]},i)),(0,r.jsx)(_,{type:"submit",className:"w-fit",disabled:e.busy,children:"Add name"})]})]})]})}):null,t.project!==null&&!e.listError&&e.items.some(i=>"attached"in i&&i.attached)?(0,r.jsxs)(xe,{children:[(0,r.jsx)(_e,{children:(0,r.jsx)(Ee,{children:"Source order"})}),(0,r.jsxs)(Pe,{className:"grid gap-3",children:[(0,r.jsx)("p",{children:"Earlier sources take precedence. Only attached sources are ordered."}),e.next!==null?(0,r.jsx)("p",{children:"Load all sources before changing their order."}):null,(0,r.jsx)(_,{type:"button",className:"w-fit",disabled:e.loading||e.busy||e.next!==null||e.etag===null,onClick:()=>{t.saveOrder()},children:"Save source order"})]})]}):null,t.project!==null?(0,r.jsxs)(xe,{children:[(0,r.jsx)(_e,{children:(0,r.jsx)(Ee,{children:"Who wins"})}),(0,r.jsxs)(Pe,{className:"grid gap-3",children:[(0,r.jsxs)("form",{className:"grid gap-3",onSubmit:i=>{i.preventDefault(),!e.busy&&t.resolve(lt(i.currentTarget,"name"))},children:[(0,r.jsx)(H,{htmlFor:"resolve-name",children:"Package name"}),(0,r.jsx)($,{id:"resolve-name",name:"name",maxLength:214,required:!0}),(0,r.jsx)(_,{type:"submit",className:"w-fit",disabled:e.busy,children:"Preview"})]}),e.preview?(0,r.jsxs)("div",{"aria-live":"polite",children:[(0,r.jsx)("p",{children:e.preview.name}),(0,r.jsxs)("p",{children:["Winning source: ",(0,r.jsx)(U,{value:e.preview.winner,label:"winning source ID"})]}),(0,r.jsx)("ol",{children:e.preview.candidates.map(i=>(0,r.jsxs)("li",{children:[i.sourceName," \xB7"," ",(0,r.jsx)(U,{value:i.sourceId,label:"candidate source ID"})," \xB7"," ",i.eligible?"Eligible":"Ineligible"]},i.sourceId))})]}):null]})]}):null]})}function ct(){if(typeof window>"u")return null;let t=new URLSearchParams(window.location.hash.split("?")[1]??"").get("project");return new URLSearchParams(Ue("sources",{project:t}).split("?")[1]??"").get("project")}function yr(){let t=Ge(),[e,l]=(0,D.useState)(ct);(0,D.useEffect)(()=>{let a=()=>l(ct());return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]);let s=(0,D.useMemo)(()=>Ct(t,e),[t,e]);return(0,D.useEffect)(()=>(s.load(),s.loadAvailable(),s.loadMutationPermissions().then(()=>{s.snapshot().canWriteSources&&new URLSearchParams(window.location.hash.split("?")[1]).get("create")==="vcs"&&s.openEditor()}),()=>s.dispose()),[s]),(0,D.useEffect)(()=>t.subscribeReplay?.(a=>{s.replayed(a)}),[t,s]),(0,r.jsx)(Rt,{model:s},e??"organization")}export{Ae as a,Re as b,De as c,Qe as d,z as e,Fe as f,St as g,wt as h,de as i,Ct as j,xt as k,_t as l,qe as m,Nt as n,At as o,Rt as p,yr as q};
@@ -1 +0,0 @@
1
- var Nn=Object.create;var Qe=Object.defineProperty;var Mn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var Ln=Object.getPrototypeOf,Dn=Object.prototype.hasOwnProperty;var ge=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Zi=(e,t)=>{for(var r in t)Qe(e,r,{get:t[r],enumerable:!0})},Hn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of In(t))!Dn.call(e,o)&&o!==r&&Qe(e,o,{get:()=>t[o],enumerable:!(n=Mn(t,o))||n.enumerable});return e};var C=(e,t,r)=>(r=e!=null?Nn(Ln(e)):{},Hn(t||!e||!e.__esModule?Qe(r,"default",{value:e,enumerable:!0}):r,e));var qt=ge(x=>{"use strict";var Je=Symbol.for("react.transitional.element"),jn=Symbol.for("react.portal"),zn=Symbol.for("react.fragment"),$n=Symbol.for("react.strict_mode"),Fn=Symbol.for("react.profiler"),Gn=Symbol.for("react.consumer"),Vn=Symbol.for("react.context"),qn=Symbol.for("react.forward_ref"),Yn=Symbol.for("react.suspense"),Un=Symbol.for("react.memo"),Dt=Symbol.for("react.lazy"),Bn=Symbol.for("react.activity"),Wn=Symbol.for("react.view_transition"),Nt=Symbol.iterator;function Kn(e){return e===null||typeof e!="object"?null:(e=Nt&&e[Nt]||e["@@iterator"],typeof e=="function"?e:null)}var Ht={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},jt=Object.assign,zt={};function he(e,t,r){this.props=e,this.context=t,this.refs=zt,this.updater=r||Ht}he.prototype.isReactComponent={};he.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};he.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function $t(){}$t.prototype=he.prototype;function et(e,t,r){this.props=e,this.context=t,this.refs=zt,this.updater=r||Ht}var tt=et.prototype=new $t;tt.constructor=et;jt(tt,he.prototype);tt.isPureReactComponent=!0;var Mt=Array.isArray;function Ze(){}var E={H:null,A:null,T:null,S:null},Ft=Object.prototype.hasOwnProperty;function rt(e,t,r){var n=r.ref;return{$$typeof:Je,type:e,key:t,ref:n!==void 0?n:null,props:r}}function Qn(e,t){return rt(e.type,t,e.props)}function nt(e){return typeof e=="object"&&e!==null&&e.$$typeof===Je}function Xn(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var It=/\/+/g;function Xe(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Xn(""+e.key):t.toString(36)}function Zn(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Ze,Ze):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function be(e,t,r,n,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Je:case jn:s=!0;break;case Dt:return s=e._init,be(s(e._payload),t,r,n,o)}}if(s)return o=o(e),s=n===""?"."+Xe(e,0):n,Mt(o)?(r="",s!=null&&(r=s.replace(It,"$&/")+"/"),be(o,t,r,"",function(d){return d})):o!=null&&(nt(o)&&(o=Qn(o,r+(o.key==null||e&&e.key===o.key?"":(""+o.key).replace(It,"$&/")+"/")+s)),t.push(o)),1;s=0;var l=n===""?".":n+":";if(Mt(e))for(var c=0;c<e.length;c++)n=e[c],i=l+Xe(n,c),s+=be(n,t,r,i,o);else if(c=Kn(e),typeof c=="function")for(e=c.call(e),c=0;!(n=e.next()).done;)n=n.value,i=l+Xe(n,c++),s+=be(n,t,r,i,o);else if(i==="object"){if(typeof e.then=="function")return be(Zn(e),t,r,n,o);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return s}function Ne(e,t,r){if(e==null)return e;var n=[],o=0;return be(e,n,"","",function(i){return t.call(r,i,o++)}),n}function Jn(e){if(e._status===-1){var t=e._result,r=t();r.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n,r.status===void 0&&(r.status="fulfilled",r.value=n))},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n,r.status===void 0&&(r.status="rejected",r.reason=n))}),e._status===-1&&(e._status=0,e._result=r)}if(e._status===1)return e._result.default;throw e._result}var Lt=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function Gt(e){var t=E.T,r={};r.types=t!==null?t.types:null,E.T=r;try{var n=e(),o=E.S;o!==null&&o(r,n),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n.then(Ze,Lt)}catch(i){Lt(i)}finally{t!==null&&r.types!==null&&(t.types=r.types),E.T=t}}function Vt(e){var t=E.T;if(t!==null){var r=t.types;r===null?t.types=[e]:r.indexOf(e)===-1&&r.push(e)}else Gt(Vt.bind(null,e))}var eo={map:Ne,forEach:function(e,t,r){Ne(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Ne(e,function(){t++}),t},toArray:function(e){return Ne(e,function(t){return t})||[]},only:function(e){if(!nt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};x.Activity=Bn;x.Children=eo;x.Component=he;x.Fragment=zn;x.Profiler=Fn;x.PureComponent=et;x.StrictMode=$n;x.Suspense=Yn;x.ViewTransition=Wn;x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=E;x.__COMPILER_RUNTIME={__proto__:null,c:function(e){return E.H.useMemoCache(e)}};x.addTransitionType=Vt;x.cache=function(e){return function(){return e.apply(null,arguments)}};x.cacheSignal=function(){return null};x.cloneElement=function(e,t,r){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var n=jt({},e.props),o=e.key;if(t!=null)for(i in t.key!==void 0&&(o=""+t.key),t)!Ft.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(n[i]=t[i]);var i=arguments.length-2;if(i===1)n.children=r;else if(1<i){for(var s=Array(i),l=0;l<i;l++)s[l]=arguments[l+2];n.children=s}return rt(e.type,o,n)};x.createContext=function(e){return e={$$typeof:Vn,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Gn,_context:e},e};x.createElement=function(e,t,r){var n,o={},i=null;if(t!=null)for(n in t.key!==void 0&&(i=""+t.key),t)Ft.call(t,n)&&n!=="key"&&n!=="__self"&&n!=="__source"&&(o[n]=t[n]);var s=arguments.length-2;if(s===1)o.children=r;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(n in s=e.defaultProps,s)o[n]===void 0&&(o[n]=s[n]);return rt(e,i,o)};x.createRef=function(){return{current:null}};x.forwardRef=function(e){return{$$typeof:qn,render:e}};x.isValidElement=nt;x.lazy=function(e){return{$$typeof:Dt,_payload:{_status:-1,_result:e},_init:Jn}};x.memo=function(e,t){return{$$typeof:Un,type:e,compare:t===void 0?null:t}};x.startTransition=Gt;x.unstable_useCacheRefresh=function(){return E.H.useCacheRefresh()};x.use=function(e){return E.H.use(e)};x.useActionState=function(e,t,r){return E.H.useActionState(e,t,r)};x.useCallback=function(e,t){return E.H.useCallback(e,t)};x.useContext=function(e){return E.H.useContext(e)};x.useDebugValue=function(){};x.useDeferredValue=function(e,t){return E.H.useDeferredValue(e,t)};x.useEffect=function(e,t){return E.H.useEffect(e,t)};x.useEffectEvent=function(e){return E.H.useEffectEvent(e)};x.useId=function(){return E.H.useId()};x.useImperativeHandle=function(e,t,r){return E.H.useImperativeHandle(e,t,r)};x.useInsertionEffect=function(e,t){return E.H.useInsertionEffect(e,t)};x.useLayoutEffect=function(e,t){return E.H.useLayoutEffect(e,t)};x.useMemo=function(e,t){return E.H.useMemo(e,t)};x.useOptimistic=function(e,t){return E.H.useOptimistic(e,t)};x.useReducer=function(e,t,r){return E.H.useReducer(e,t,r)};x.useRef=function(e){return E.H.useRef(e)};x.useState=function(e){return E.H.useState(e)};x.useSyncExternalStore=function(e,t,r){return E.H.useSyncExternalStore(e,t,r)};x.useTransition=function(){return E.H.useTransition()};x.version="19.3.0"});var B=ge((ts,Yt)=>{"use strict";Yt.exports=qt()});var Bt=ge(Me=>{"use strict";var to=Symbol.for("react.transitional.element"),ro=Symbol.for("react.fragment");function Ut(e,t,r){var n=null;if(r!==void 0&&(n=""+r),t.key!==void 0&&(n=""+t.key),"key"in t){r={};for(var o in t)o!=="key"&&(r[o]=t[o])}else r=t;return t=r.ref,{$$typeof:to,type:e,key:n,ref:t!==void 0?t:null,props:r}}Me.Fragment=ro;Me.jsx=Ut;Me.jsxs=Ut});var P=ge((ns,Wt)=>{"use strict";Wt.exports=Bt()});var zr=ge(j=>{"use strict";var ui=B();function jr(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function se(){}var F={d:{f:se,r:function(){throw Error(jr(522))},D:se,C:se,L:se,m:se,X:se,S:se,M:se},p:0,findDOMNode:null},fi=Symbol.for("react.portal"),pi=Symbol.for("react.recoverable"),Hr=Symbol.for("react.optimistic_key");function mi(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:fi,key:n==null?null:n===Hr?Hr:""+n,children:e,containerInfo:t,implementation:r}}var _e=ui.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Fe(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}j.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F;j.browser=function(e){return{$$typeof:pi,_reason:e}};j.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(jr(299));return mi(e,t,null,r)};j.flushSync=function(e){var t=_e.T,r=F.p;try{if(_e.T=null,F.p=2,e)return e()}finally{_e.T=t,F.p=r,F.d.f()}};j.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,F.d.C(e,t))};j.prefetchDNS=function(e){typeof e=="string"&&F.d.D(e)};j.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var r=t.as,n=Fe(r,t.crossOrigin),o=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;r==="style"?F.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):r==="script"&&F.d.X(e,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};j.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var r=Fe(t.as,t.crossOrigin);F.d.M(e,{crossOrigin:r,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0})}}else t==null&&F.d.M(e)};j.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var r=t.as,n=Fe(r,t.crossOrigin);F.d.L(e,r,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};j.preloadModule=function(e,t){if(typeof e=="string")if(t){var r=Fe(t.as,t.crossOrigin);F.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:r,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0})}else F.d.m(e)};j.requestFormReset=function(e){F.d.r(e)};j.unstable_batchedUpdates=function(e,t){return e(t)};j.useFormState=function(e,t,r){return _e.H.useFormState(e,t,r)};j.useFormStatus=function(){return _e.H.useHostTransitionStatus()};j.version="19.3.0"});var gt=ge((Es,Fr)=>{"use strict";function $r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($r)}catch(e){console.error(e)}}$r(),Fr.exports=zr()});var ot="pb.pending-action.v2",no="pb.pending-action";var oo=new Set(["method","path","idempotencyKey","body","headers","requiresCredential","savedAt","display"]),Kt=["If-Match","If-None-Match"],io=4096;function Ie(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Qt(e){return typeof e=="string"&&e.length<=io&&![...e].some(t=>{let r=t.charCodeAt(0);return r<32||r>=127&&r<=159})}function so(e){let t={};if(e===void 0)return t;if(!Ie(e))return!1;for(let[r,n]of Object.entries(e)){let o=Kt.find(i=>i.toLowerCase()===r.toLowerCase());if(o!==void 0){if(Object.hasOwn(t,o)||!Qt(n))return!1;t[o]=n}}return t}function ao(e){return e===void 0||Ie(e)&&Object.entries(e).every(([t,r])=>Kt.some(n=>n===t)&&Qt(r))}function lo(e){return typeof e=="string"&&e.startsWith("/_pb/")&&!e.includes("//")&&!/[\\:?#{}\s]/.test(e)&&!e.split("/").some(t=>{let r=t.replace(/%2e/gi,".");return r==="."||r===".."})}function Xt(e){return typeof e.method=="string"&&/^(GET|HEAD|OPTIONS|POST|PUT|PATCH|DELETE)$/.test(e.method)&&lo(e.path)&&(e.idempotencyKey===void 0||typeof e.idempotencyKey=="string")}function Zt(e){return Ie(e)&&Object.keys(e).length===3&&["packageName","version","scope"].every(t=>typeof e[t]=="string"&&e[t].length>0&&e[t].length<=256)}function co(e){return Ie(e)&&Object.keys(e).every(t=>oo.has(t))&&Xt(e)&&(e.display===void 0||Zt(e.display))&&ao(e.headers)&&(e.requiresCredential===void 0||e.requiresCredential===!0&&e.body===void 0)&&typeof e.savedAt=="number"&&Number.isFinite(e.savedAt)}function uo(e,t){let r=JSON.parse(JSON.stringify(e));for(let n of t){let o=n.split("."),i=r;for(let l of o.slice(0,-1)){if(i===null||typeof i!="object"||!Object.hasOwn(i,l)){i=void 0;break}i=i[l]}let s=o[o.length-1];i!==null&&typeof i=="object"&&Object.hasOwn(i,s)&&delete i[s]}return r}function Jt(e,t){try{if(!Xt(t)||t.display!==void 0&&!Zt(t.display)||typeof t.credential!="boolean"||!Array.isArray(t.secretFields)||!t.secretFields.every(o=>typeof o=="string"))return{ok:!1};let r=so(t.headers);if(r===!1)return{ok:!1};let n={method:t.method,path:t.path,...t.idempotencyKey===void 0?{}:{idempotencyKey:t.idempotencyKey},...Object.keys(r).length===0?{}:{headers:r},...t.credential?{requiresCredential:!0}:{},...!t.credential&&t.body!==void 0?{body:uo(t.body,t.secretFields)}:{},...t.display===void 0?{}:{display:{...t.display}},savedAt:Date.now()};return e.setItem(ot,JSON.stringify(n)),{ok:!0}}catch{return{ok:!1}}}function it(e,t){try{e.removeItem(no);let r=e.getItem(ot);if(e.removeItem(ot),r===null)return{ok:!0,action:null};let n;try{n=JSON.parse(r)}catch{return{ok:!0,action:null}}return!co(n)||!Number.isFinite(t)||t<n.savedAt||t-n.savedAt>6e5?{ok:!0,action:null}:{ok:!0,action:n}}catch{return{ok:!1}}}var er={project:64,status:64,source:26,projectId:26,q:200,after:4096,package:26,versionAfter:4096,cursor:4096,run:26,actor:200,action:200,filterProject:200,limit:3};function tr(e,t={}){let r=[];for(let n of Object.keys(er)){let o=t[n];if(!(o==null||o.length===0||o.length>er[n])&&!(n==="project"&&/[^A-Za-z0-9._-]/.test(o))&&!((n==="source"||n==="projectId")&&(e!=="packages"||!/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/.test(o)))&&!((n==="package"||n==="versionAfter")&&e!=="packages")&&!((n==="run"||n==="cursor")&&e!=="import")&&!(["actor","action","filterProject","limit"].includes(n)&&e!=="audit")&&!((n==="package"||n==="run")&&!/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/.test(o)))try{r.push(`${n}=${encodeURIComponent(o)}`)}catch{}}return`#/${e}${r.length===0?"":`?${r.join("&")}`}`}function rr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=rr(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Le(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=rr(e))&&(n&&(n+=" "),n+=t);return n}var nr=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,or=Le,De=(e,t)=>r=>{var n;if(t?.variants==null)return or(e,r?.class,r?.className);let{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(d=>{let _=r?.[d],S=i?.[d];if(_===null)return null;let k=nr(_)||nr(S);return o[d][k]}),l=r&&Object.entries(r).reduce((d,_)=>{let[S,k]=_;return k===void 0||(d[S]=k),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,_)=>{let{class:S,className:k,...y}=_;return Object.entries(y).every(h=>{let[v,u]=h;return Array.isArray(u)?u.includes({...i,...l}[v]):{...i,...l}[v]===u})?[...d,S,k]:d},[]);return or(e,s,c,r?.class,r?.className)};var fo=(e,t)=>{let r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},po=(e,t)=>({classGroupId:e,validator:t}),dr=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r});var ir=[],mo="arbitrary..",go=e=>{let t=ho(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return bo(s);let l=s.split("-"),c=l[0]===""&&l.length>1?1:0;return ur(l,c,t)},getConflictingClassGroupIds:(s,l)=>{if(l){let c=n[s],d=r[s];return c?d?fo(d,c):c:d||ir}return r[s]||ir}}},ur=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;let o=e[t],i=r.nextPart.get(o);if(i){let d=ur(e,t+1,i);if(d)return d}let s=r.validators;if(s===null)return;let l=t===0?e.join("-"):e.slice(t).join("-"),c=s.length;for(let d=0;d<c;d++){let _=s[d];if(_.validator(l))return _.classGroupId}},bo=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?mo+n:void 0})(),ho=e=>{let{theme:t,classGroups:r}=e;return yo(r,t)},yo=(e,t)=>{let r=dr();for(let n in e){let o=e[n];at(o,r,n,t)}return r},at=(e,t,r,n)=>{let o=e.length;for(let i=0;i<o;i++){let s=e[i];vo(s,t,r,n)}},vo=(e,t,r,n)=>{if(typeof e=="string"){wo(e,t,r);return}if(typeof e=="function"){xo(e,t,r,n);return}ko(e,t,r,n)},wo=(e,t,r)=>{let n=e===""?t:fr(t,e);n.classGroupId=r},xo=(e,t,r,n)=>{if(So(e)){at(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(po(r,e))},ko=(e,t,r,n)=>{let o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){let[l,c]=o[s];at(c,fr(t,l),r,n)}},fr=(e,t)=>{let r=e,n=t.split("-"),o=n.length;for(let i=0;i<o;i++){let s=n[i],l=r.nextPart.get(s);l||(l=dr(),r.nextPart.set(s,l)),r=l}return r},So=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,_o=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),o=(i,s)=>{r[i]=s,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(i){let s=r[i];if(s!==void 0)return s;if((s=n[i])!==void 0)return o(i,s),s},set(i,s){i in r?r[i]=s:o(i,s)}}};var Ro=[],sr=(e,t,r,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:o}),Co=e=>{let{prefix:t,experimentalParseClassName:r}=e,n=o=>{let i=[],s=0,l=0,c=0,d,_=o.length;for(let v=0;v<_;v++){let u=o[v];if(s===0&&l===0){if(u===":"){i.push(o.slice(c,v)),c=v+1;continue}if(u==="/"){d=v;continue}}u==="["?s++:u==="]"?s--:u==="("?l++:u===")"&&l--}let S=i.length===0?o:o.slice(c),k=S,y=!1;S.endsWith("!")?(k=S.slice(0,-1),y=!0):S.startsWith("!")&&(k=S.slice(1),y=!0);let h=d&&d>c?d-c:void 0;return sr(i,y,k,h)};if(t){let o=t+":",i=n;n=s=>s.startsWith(o)?i(s.slice(o.length)):sr(Ro,!1,s,void 0,!0)}if(r){let o=n;n=i=>r({className:i,parseClassName:o})}return n},Eo=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{let n=[],o=[];for(let i=0;i<r.length;i++){let s=r[i],l=s[0]==="[",c=t.has(s);l||c?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(s)):o.push(s)}return o.length>0&&(o.sort(),n.push(...o)),n}},Ao=e=>({cache:_o(e.cacheSize),parseClassName:Co(e),sortModifiers:Eo(e),postfixLookupClassGroupIds:To(e),...go(e)}),To=e=>{let t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let n=0;n<r.length;n++)t[r[n]]=!0;return t},Po=/\s+/,Oo=(e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:i,postfixLookupClassGroupIds:s}=t,l=[],c=e.trim().split(Po),d="";for(let _=c.length-1;_>=0;_-=1){let S=c[_],{isExternal:k,modifiers:y,hasImportantModifier:h,baseClassName:v,maybePostfixModifierPosition:u}=r(S);if(k){d=S+(d.length>0?" "+d:d);continue}let w=!!u,m;if(w){let Y=v.substring(0,u);m=n(Y);let g=m&&s[m]?n(v):void 0;g&&g!==m&&(m=g,w=!1)}else m=n(v);if(!m){if(!w){d=S+(d.length>0?" "+d:d);continue}if(m=n(v),!m){d=S+(d.length>0?" "+d:d);continue}w=!1}let T=y.length===0?"":y.length===1?y[0]:i(y).join(":"),W=h?T+"!":T,K=W+m;if(l.indexOf(K)>-1)continue;l.push(K);let q=o(m,w);for(let Y=0;Y<q.length;++Y){let g=q[Y];l.push(W+g)}d=S+(d.length>0?" "+d:d)}return d},No=(...e)=>{let t=0,r,n,o="";for(;t<e.length;)(r=e[t++])&&(n=pr(r))&&(o&&(o+=" "),o+=n);return o},pr=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=pr(e[n]))&&(r&&(r+=" "),r+=t);return r},Mo=(e,...t)=>{let r,n,o,i,s=c=>{let d=t.reduce((_,S)=>S(_),e());return r=Ao(d),n=r.cache.get,o=r.cache.set,i=l,l(c)},l=c=>{let d=n(c);if(d)return d;let _=Oo(c,r);return o(c,_),_};return i=s,(...c)=>i(No(...c))},Io=[],O=e=>{let t=r=>r[e]||Io;return t.isThemeGetter=!0,t.themeKey=e,t},mr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gr=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Lo=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Do=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ho=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jo=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,zo=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$o=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oe=e=>Lo.test(e),R=e=>!!e&&!Number.isNaN(Number(e)),X=e=>!!e&&Number.isInteger(Number(e)),st=e=>e.endsWith("%")&&R(e.slice(0,-1)),J=e=>Do.test(e),br=()=>!0,Fo=e=>Ho.test(e)&&!jo.test(e),lt=()=>!1,Go=e=>zo.test(e),Vo=e=>$o.test(e),qo=e=>!f(e)&&!p(e),Yo=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Uo=e=>ie(e,vr,lt),f=e=>mr.test(e),ue=e=>ie(e,wr,Fo),ar=e=>ie(e,ei,R),Bo=e=>ie(e,kr,br),Wo=e=>ie(e,xr,lt),lr=e=>ie(e,hr,lt),Ko=e=>ie(e,yr,Vo),He=e=>ie(e,Sr,Go),p=e=>gr.test(e),we=e=>fe(e,wr),Qo=e=>fe(e,xr),cr=e=>fe(e,hr),Xo=e=>fe(e,vr),Zo=e=>fe(e,yr),je=e=>fe(e,Sr,!0),Jo=e=>fe(e,kr,!0),ie=(e,t,r)=>{let n=mr.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},fe=(e,t,r=!1)=>{let n=gr.exec(e);return n?n[1]?t(n[1]):r:!1},hr=e=>e==="position"||e==="percentage",yr=e=>e==="image"||e==="url",vr=e=>e==="length"||e==="size"||e==="bg-size",wr=e=>e==="length",ei=e=>e==="number",xr=e=>e==="family-name",kr=e=>e==="number"||e==="weight",Sr=e=>e==="shadow";var ti=()=>{let e=O("color"),t=O("font"),r=O("text"),n=O("font-weight"),o=O("tracking"),i=O("leading"),s=O("breakpoint"),l=O("container"),c=O("spacing"),d=O("radius"),_=O("shadow"),S=O("inset-shadow"),k=O("text-shadow"),y=O("drop-shadow"),h=O("blur"),v=O("perspective"),u=O("aspect"),w=O("ease"),m=O("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],K=()=>[...W(),p,f],q=()=>["auto","hidden","clip","visible","scroll"],Y=()=>["auto","contain","none"],g=()=>[p,f,c],N=()=>[oe,"full","auto",...g()],Ee=()=>[X,"none","subgrid",p,f],Z=()=>["auto",{span:["full",X,p,f]},X,p,f],ae=()=>[X,"auto",p,f],le=()=>["auto","min","max","fr",p,f],ce=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],re=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...g()],ne=()=>[oe,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...g()],de=()=>[l,oe,"screen","full","dvw","lvw","svw","min","max","fit",...g()],ve=()=>[oe,"screen","full","lh","dvh","lvh","svh","min","max","fit",...g()],b=()=>[e,p,f],Et=()=>[...W(),cr,lr,{position:[p,f]}],At=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Tt=()=>["auto","cover","contain",Xo,Uo,{size:[p,f]}],We=()=>[st,we,ue],z=()=>["","none","full",d,p,f],$=()=>["",R,we,ue],Ae=()=>["solid","dashed","dotted","double"],Pt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>[R,st,cr,lr],Ot=()=>["","none",h,p,f],Te=()=>["none",R,p,f],Pe=()=>["none",R,p,f],Ke=()=>[R,p,f],Oe=()=>[oe,"full",...g()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[J],breakpoint:[J],color:[br],container:[J],"drop-shadow":[J],ease:["in","out","in-out"],font:[qo],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[J],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[J],shadow:[J],spacing:["px",R],text:[J],"text-shadow":[J],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",oe,f,p,u]}],container:["container"],"container-type":[{"@container":["","normal","size",p,f]}],"container-named":[Yo],columns:[{columns:[R,"auto",f,p,l]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:K()}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[X,"auto",p,f]}],basis:[{basis:[oe,"full","auto",l,...g()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[R,oe,"auto","initial","none",f]}],grow:[{grow:["",R,p,f]}],shrink:[{shrink:["",R,p,f]}],order:[{order:[X,"first","last","none",p,f]}],"grid-cols":[{"grid-cols":Ee()}],"col-start-end":[{col:Z()}],"col-start":[{"col-start":ae()}],"col-end":[{"col-end":ae()}],"grid-rows":[{"grid-rows":Ee()}],"row-start-end":[{row:Z()}],"row-start":[{"row-start":ae()}],"row-end":[{"row-end":ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":le()}],"auto-rows":[{"auto-rows":le()}],gap:[{gap:g()}],"gap-x":[{"gap-x":g()}],"gap-y":[{"gap-y":g()}],"justify-content":[{justify:[...ce(),"normal"]}],"justify-items":[{"justify-items":[...re(),"normal"]}],"justify-self":[{"justify-self":["auto",...re()]}],"align-content":[{content:["normal",...ce()]}],"align-items":[{items:[...re(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...re(),{baseline:["","last"]}]}],"place-content":[{"place-content":ce()}],"place-items":[{"place-items":[...re(),"baseline"]}],"place-self":[{"place-self":["auto",...re()]}],p:[{p:g()}],px:[{px:g()}],py:[{py:g()}],ps:[{ps:g()}],pe:[{pe:g()}],pbs:[{pbs:g()}],pbe:[{pbe:g()}],pt:[{pt:g()}],pr:[{pr:g()}],pb:[{pb:g()}],pl:[{pl:g()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mbs:[{mbs:H()}],mbe:[{mbe:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":g()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":g()}],"space-y-reverse":["space-y-reverse"],size:[{size:ne()}],"inline-size":[{inline:["auto",...de()]}],"min-inline-size":[{"min-inline":["auto",...de()]}],"max-inline-size":[{"max-inline":["none",...de()]}],"block-size":[{block:["auto",...ve()]}],"min-block-size":[{"min-block":["auto",...ve()]}],"max-block-size":[{"max-block":["none",...ve()]}],w:[{w:[l,"screen",...ne()]}],"min-w":[{"min-w":[l,"screen","none",...ne()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[s]},...ne()]}],h:[{h:["screen","lh",...ne()]}],"min-h":[{"min-h":["screen","lh","none",...ne()]}],"max-h":[{"max-h":["screen","lh","none",...ne()]}],"font-size":[{text:["base",r,we,ue]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Jo,Bo]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",st,f]}],"font-family":[{font:[Qo,Wo,t]}],"font-features":[{"font-features":[f]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,p,f]}],"line-clamp":[{"line-clamp":[R,"none",p,ar]}],leading:[{leading:["none",i,...g()]}],"list-image":[{"list-image":["none",p,f]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",p,f]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:b()}],"text-color":[{text:b()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[R,"from-font","auto",p,ue]}],"text-decoration-color":[{decoration:b()}],"underline-offset":[{"underline-offset":[R,"auto",p,f]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:g()}],"tab-size":[{tab:[X,p,f]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",p,f]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",p,f]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Et()}],"bg-repeat":[{bg:At()}],"bg-size":[{bg:Tt()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},X,p,f],radial:["",p,f],conic:["",X,p,f]},Zo,Ko]}],"bg-color":[{bg:b()}],"gradient-from-pos":[{from:We()}],"gradient-via-pos":[{via:We()}],"gradient-to-pos":[{to:We()}],"gradient-from":[{from:b()}],"gradient-via":[{via:b()}],"gradient-to":[{to:b()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-bs":[{"border-bs":$()}],"border-w-be":[{"border-be":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ae(),"hidden","none"]}],"divide-style":[{divide:[...Ae(),"hidden","none"]}],"border-color":[{border:b()}],"border-color-x":[{"border-x":b()}],"border-color-y":[{"border-y":b()}],"border-color-s":[{"border-s":b()}],"border-color-e":[{"border-e":b()}],"border-color-bs":[{"border-bs":b()}],"border-color-be":[{"border-be":b()}],"border-color-t":[{"border-t":b()}],"border-color-r":[{"border-r":b()}],"border-color-b":[{"border-b":b()}],"border-color-l":[{"border-l":b()}],"divide-color":[{divide:b()}],"outline-style":[{outline:[...Ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[R,p,f]}],"outline-w":[{outline:["",R,we,ue]}],"outline-color":[{outline:b()}],shadow:[{shadow:["","inner","none",_,je,He]}],"shadow-color":[{shadow:b()}],"inset-shadow":[{"inset-shadow":["none",S,je,He]}],"inset-shadow-color":[{"inset-shadow":b()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:b()}],"ring-offset-w":[{"ring-offset":[R,ue]}],"ring-offset-color":[{"ring-offset":b()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":b()}],"text-shadow":[{"text-shadow":["none",k,je,He]}],"text-shadow-color":[{"text-shadow":b()}],opacity:[{opacity:[R,p,f]}],"mix-blend":[{"mix-blend":[...Pt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Pt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[R]}],"mask-image-linear-from-pos":[{"mask-linear-from":M()}],"mask-image-linear-to-pos":[{"mask-linear-to":M()}],"mask-image-linear-from-color":[{"mask-linear-from":b()}],"mask-image-linear-to-color":[{"mask-linear-to":b()}],"mask-image-t-from-pos":[{"mask-t-from":M()}],"mask-image-t-to-pos":[{"mask-t-to":M()}],"mask-image-t-from-color":[{"mask-t-from":b()}],"mask-image-t-to-color":[{"mask-t-to":b()}],"mask-image-r-from-pos":[{"mask-r-from":M()}],"mask-image-r-to-pos":[{"mask-r-to":M()}],"mask-image-r-from-color":[{"mask-r-from":b()}],"mask-image-r-to-color":[{"mask-r-to":b()}],"mask-image-b-from-pos":[{"mask-b-from":M()}],"mask-image-b-to-pos":[{"mask-b-to":M()}],"mask-image-b-from-color":[{"mask-b-from":b()}],"mask-image-b-to-color":[{"mask-b-to":b()}],"mask-image-l-from-pos":[{"mask-l-from":M()}],"mask-image-l-to-pos":[{"mask-l-to":M()}],"mask-image-l-from-color":[{"mask-l-from":b()}],"mask-image-l-to-color":[{"mask-l-to":b()}],"mask-image-x-from-pos":[{"mask-x-from":M()}],"mask-image-x-to-pos":[{"mask-x-to":M()}],"mask-image-x-from-color":[{"mask-x-from":b()}],"mask-image-x-to-color":[{"mask-x-to":b()}],"mask-image-y-from-pos":[{"mask-y-from":M()}],"mask-image-y-to-pos":[{"mask-y-to":M()}],"mask-image-y-from-color":[{"mask-y-from":b()}],"mask-image-y-to-color":[{"mask-y-to":b()}],"mask-image-radial":[{"mask-radial":[p,f]}],"mask-image-radial-from-pos":[{"mask-radial-from":M()}],"mask-image-radial-to-pos":[{"mask-radial-to":M()}],"mask-image-radial-from-color":[{"mask-radial-from":b()}],"mask-image-radial-to-color":[{"mask-radial-to":b()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":W()}],"mask-image-conic-pos":[{"mask-conic":[R]}],"mask-image-conic-from-pos":[{"mask-conic-from":M()}],"mask-image-conic-to-pos":[{"mask-conic-to":M()}],"mask-image-conic-from-color":[{"mask-conic-from":b()}],"mask-image-conic-to-color":[{"mask-conic-to":b()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Et()}],"mask-repeat":[{mask:At()}],"mask-size":[{mask:Tt()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",p,f]}],filter:[{filter:["","none",p,f]}],blur:[{blur:Ot()}],brightness:[{brightness:[R,p,f]}],contrast:[{contrast:[R,p,f]}],"drop-shadow":[{"drop-shadow":["","none",y,je,He]}],"drop-shadow-color":[{"drop-shadow":b()}],grayscale:[{grayscale:["",R,p,f]}],"hue-rotate":[{"hue-rotate":[R,p,f]}],invert:[{invert:["",R,p,f]}],saturate:[{saturate:[R,p,f]}],sepia:[{sepia:["",R,p,f]}],"backdrop-filter":[{"backdrop-filter":["","none",p,f]}],"backdrop-blur":[{"backdrop-blur":Ot()}],"backdrop-brightness":[{"backdrop-brightness":[R,p,f]}],"backdrop-contrast":[{"backdrop-contrast":[R,p,f]}],"backdrop-grayscale":[{"backdrop-grayscale":["",R,p,f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[R,p,f]}],"backdrop-invert":[{"backdrop-invert":["",R,p,f]}],"backdrop-opacity":[{"backdrop-opacity":[R,p,f]}],"backdrop-saturate":[{"backdrop-saturate":[R,p,f]}],"backdrop-sepia":[{"backdrop-sepia":["",R,p,f]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":g()}],"border-spacing-x":[{"border-spacing-x":g()}],"border-spacing-y":[{"border-spacing-y":g()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",p,f]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[R,"initial",p,f]}],ease:[{ease:["linear","initial",w,p,f]}],delay:[{delay:[R,p,f]}],animate:[{animate:["none",m,p,f]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,p,f]}],"perspective-origin":[{"perspective-origin":K()}],rotate:[{rotate:Te()}],"rotate-x":[{"rotate-x":Te()}],"rotate-y":[{"rotate-y":Te()}],"rotate-z":[{"rotate-z":Te()}],scale:[{scale:Pe()}],"scale-x":[{"scale-x":Pe()}],"scale-y":[{"scale-y":Pe()}],"scale-z":[{"scale-z":Pe()}],"scale-3d":["scale-3d"],skew:[{skew:Ke()}],"skew-x":[{"skew-x":Ke()}],"skew-y":[{"skew-y":Ke()}],transform:[{transform:[p,f,"","none","gpu","cpu"]}],"transform-origin":[{origin:K()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],zoom:[{zoom:[X,p,f]}],accent:[{accent:b()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:b()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",p,f]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":b()}],"scrollbar-track-color":[{"scrollbar-track":b()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":g()}],"scroll-mx":[{"scroll-mx":g()}],"scroll-my":[{"scroll-my":g()}],"scroll-ms":[{"scroll-ms":g()}],"scroll-me":[{"scroll-me":g()}],"scroll-mbs":[{"scroll-mbs":g()}],"scroll-mbe":[{"scroll-mbe":g()}],"scroll-mt":[{"scroll-mt":g()}],"scroll-mr":[{"scroll-mr":g()}],"scroll-mb":[{"scroll-mb":g()}],"scroll-ml":[{"scroll-ml":g()}],"scroll-p":[{"scroll-p":g()}],"scroll-px":[{"scroll-px":g()}],"scroll-py":[{"scroll-py":g()}],"scroll-ps":[{"scroll-ps":g()}],"scroll-pe":[{"scroll-pe":g()}],"scroll-pbs":[{"scroll-pbs":g()}],"scroll-pbe":[{"scroll-pbe":g()}],"scroll-pt":[{"scroll-pt":g()}],"scroll-pr":[{"scroll-pr":g()}],"scroll-pb":[{"scroll-pb":g()}],"scroll-pl":[{"scroll-pl":g()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",p,f]}],fill:[{fill:["none",...b()]}],"stroke-w":[{stroke:[R,we,ue,ar]}],stroke:[{stroke:["none",...b()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}};var _r=Mo(ti);function A(...e){return _r(Le(e))}function Rr(){if(!(typeof document>"u"))return document.getElementById("root")??void 0}var ct=C(P(),1),ri=De("relative w-full rounded-lg border px-4 py-3 text-sm",{variants:{variant:{default:"border-neutral-200 bg-white text-neutral-900",destructive:"border-red-300 bg-red-50 text-red-900"}},defaultVariants:{variant:"default"}});function pe({className:e,variant:t,...r}){return(0,ct.jsx)("div",{role:"alert",className:A(ri({variant:t}),e),...r})}function me({className:e,...t}){return(0,ct.jsx)("div",{className:A("text-sm",e),...t})}var I=C(B(),1);var Cr=C(B(),1),ni=Object.defineProperty,ut=(e,t)=>ni(e,"name",{value:t,configurable:!0});function dt(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}ut(dt,"setRef");function Er(...e){return t=>{let r=!1,n=e.map(o=>{let i=dt(o,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():dt(e[o],null)}}}}ut(Er,"composeRefs");function ft(...e){return Cr.useCallback(Er(...e),e)}ut(ft,"useComposedRefs");var oi=Object.defineProperty,U=(e,t)=>oi(e,"name",{value:t,configurable:!0});function $e(e){let t=I.forwardRef((r,n)=>{let{children:o,...i}=r,s=null,l=!1,c=[];o=Ir(o),I.Children.forEach(o,k=>{if(Nr(k)){l=!0;let y=k,h="child"in y.props?y.props.child:y.props.children;for(;pt(h)&&typeof ze=="function";)h=ze(h._payload);s=si(y,h),c.push(s?.props?.children)}else c.push(k)}),s?s=I.cloneElement(s,void 0,c):!l&&I.Children.count(o)===1&&I.isValidElement(o)&&(s=o);let d=s?Or(s):void 0,_=ft(n,d);if(!s){if(o||o===0)throw new Error(l?ci(e):li(e));return o}let S=Pr(i,s.props??{});return s.type!==I.Fragment&&(S.ref=n?_:d),I.cloneElement(s,S)});return t.displayName=`${e}.Slot`,t}U($e,"createSlot");var Ar=$e("Slot"),Tr=Symbol.for("radix.slottable");function ii(e){let t=U(r=>"child"in r?r.children(r.child):r.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Tr,t}U(ii,"createSlottable");var si=U((e,t)=>"child"in e.props?I.isValidElement(t)?I.cloneElement(t,void 0,e.props.children(t.props.children)):null:I.isValidElement(t)?t:null,"getSlottableElementFromSlottable");function Pr(e,t){let r={...t};for(let n in t){let o=e[n],i=t[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...l)=>{let c=i(...l);return o(...l),c}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"?r[n]=[o,i].filter(Boolean).join(" "):n==="aria-describedby"&&(r[n]=Lr(i,o))}return{...e,...r}}U(Pr,"mergeProps");function Or(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}U(Or,"getElementRef");function Nr(e){return I.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Tr}U(Nr,"isSlottable");var ai=Symbol.for("react.lazy");function pt(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ai&&"_payload"in e&&Mr(e._payload)}U(pt,"isLazyComponent");function Mr(e){return typeof e=="object"&&e!==null&&"then"in e}U(Mr,"isPromiseLike");function Ir(e){let t=e;for(;pt(t)&&typeof ze=="function";)t=ze(t._payload);return t}U(Ir,"useUnwrappedLazy");function Lr(...e){let t=new Set;for(let r of e)if(typeof r=="string")for(let n of String(r).trim().split(/\s+/))n&&t.add(n);return t.size>0?Array.from(t).join(" "):void 0}U(Lr,"concatAriaDescribedby");var li=U(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),ci=U(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),ze=I[" use ".trim().toString()];var Dr=C(P(),1),di=De("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-blue-700 text-white hover:bg-blue-800",destructive:"bg-red-700 text-white hover:bg-red-800",outline:"border border-neutral-300 bg-white hover:bg-neutral-100",secondary:"bg-neutral-100 text-neutral-900 hover:bg-neutral-200",ghost:"hover:bg-neutral-100",link:"text-blue-700 underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8"}},defaultVariants:{variant:"default",size:"default"}});function Q({className:e,variant:t,size:r,asChild:n=!1,type:o,...i}){return(0,Dr.jsx)(n?Ar:"button",{type:o??(n?void 0:"button"),"data-variant":t??"default",className:A(di({variant:t,size:r}),e),...i})}var ye=C(P(),1);function xe({className:e,...t}){return(0,ye.jsx)("div",{className:A("rounded-xl border border-neutral-200 bg-white shadow-sm",e),...t})}function ke({className:e,...t}){return(0,ye.jsx)("div",{className:A("flex flex-col gap-1.5 p-6",e),...t})}function _s({className:e,...t}){return(0,ye.jsx)("h2",{className:A("font-semibold leading-none tracking-tight",e),...t})}function mt({className:e,...t}){return(0,ye.jsx)("p",{className:A("text-sm text-neutral-600",e),...t})}function Se({className:e,...t}){return(0,ye.jsx)("div",{className:A("p-6 pt-0",e),...t})}var L=C(B(),1),Ur=C(gt(),1);var ee=C(B(),1),Ge=C(P(),1),Gr=(0,ee.createContext)(void 0),bt=new WeakMap;function Vr({children:e}){let[t,r]=(0,ee.useState)(null);return(0,Ge.jsxs)(Gr.Provider,{value:t,children:[e,(0,Ge.jsx)("div",{"data-overlay-host":!0,ref:r})]})}function As(){let e=(0,ee.useContext)(Gr),[t,r]=(0,ee.useState)(null);return(0,ee.useEffect)(()=>{if(e!==void 0)return;let n=bt.get(document);if(!n){let s=document.createElement("div");s.setAttribute("data-overlay-host",""),document.body.append(s),n={element:s,users:0},bt.set(document,n)}let o=document,i=n;return i.users++,r(i.element),()=>{--i.users===0&&(i.element.remove(),bt.delete(o))}},[e]),e===void 0?t:e}var qr=C(B(),1);function Yr(e,t){return(0,qr.useCallback)(r=>{let n=[e,t].map(o=>{if(typeof o=="function"){let i=o(r);return typeof i=="function"?i:()=>o(null)}return o&&(o.current=r),()=>{o&&(o.current=null)}});return()=>{for(let o of n)o()}},[e,t])}var G=C(P(),1),Re=(0,L.createContext)(null);function Br(e){let[t,r]=(0,L.useState)(e.defaultOpen??!1),n=(0,L.useId)(),o=(0,L.useId)();return(0,G.jsx)(Re.Provider,{value:{open:e.open??t,setOpen:i=>{r(i),e.onOpenChange?.(i)},titleId:n,descriptionId:o},children:e.children})}function gi({onClick:e,...t}){let r=(0,L.useContext)(Re);return(0,G.jsx)("button",{type:"button",...t,onClick:n=>{e?.(n),n.defaultPrevented||r?.setOpen(!1)}})}function Wr({className:e,children:t,variant:r,ref:n,...o}){let i=(0,L.useContext)(Re),s=(0,L.useRef)(null),l=Yr(n,s),c=i?.open??!1,d=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!c||(d.current?.(),!s.current))return;let k=s.current,y=k.ownerDocument,h=y.activeElement,u=h?.closest('[role="menu"]')?.getAttribute("aria-labelledby"),w=u?y.getElementById(u):h===y.body?null:h;k.showModal();let m=q=>!q.matches(":disabled")&&q.getClientRects().length>0,T=q=>Array.from(k.querySelectorAll(q)).find(m);(T('input:not([type="hidden"]), select, textarea')??T("[data-initial-focus]")??T('[data-dialog-footer] button:not([data-variant="destructive"])')??k.querySelector('button[aria-label="Close"]'))?.focus();let K=!1;return()=>{k.close();let q=()=>{K=!0};d.current=q,queueMicrotask(()=>{if(K)return;let Y=!1,g=!1,N=new MutationObserver(()=>ce()),Ee=setTimeout(()=>{ce(!0),Z()},5e3);function Z(){K=!0,N.disconnect(),clearTimeout(Ee),y.removeEventListener("focusin",ae),y.removeEventListener("keydown",le,!0),y.removeEventListener("pointerdown",le,!0)}function ae(){!Y&&y.activeElement!==null&&y.activeElement!==y.body&&!k.contains(y.activeElement)&&Z()}function le(){y.activeElement!==null&&y.activeElement!==y.body&&!k.contains(y.activeElement)&&Z()}function ce(re=!1){if(K)return;let H=y.activeElement;if(H!==null&&H!==y.body&&H!==w&&!k.contains(H)){Z();return}if(g&&w?.isConnected)return;let de=w?.closest("details:not([open])")?.querySelector("summary")??w,ve=y.querySelector("#page-heading"),b=!de?.isConnected||re&&!m(de)?ve:de;!b||!m(b)||(Y=!0,b.focus(),Y=!1,b!==w?Z():(g=!0,N.disconnect(),N.observe(y.documentElement,{subtree:!0,childList:!0})))}d.current=Z,N.observe(y.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["disabled","hidden","style","class","open"]}),y.addEventListener("focusin",ae),y.addEventListener("keydown",le,!0),y.addEventListener("pointerdown",le,!0),ce()})}},[c]);let _=Rr(),S=(0,G.jsx)("dialog",{...o,ref:l,"aria-labelledby":i?.titleId,"aria-describedby":i?.descriptionId,onCancel:k=>{o.onCancel?.(k),k.defaultPrevented||(k.preventDefault(),i?.setOpen(!1))},onClose:k=>{o.onClose?.(k),c&&!k.currentTarget.open&&i?.setOpen(!1)},className:A("fixed inset-0 m-auto w-[calc(100%_-_2rem)] min-w-0 max-w-lg max-h-[90dvh] overflow-visible rounded-lg border-0 bg-transparent p-0 text-neutral-900 shadow-lg backdrop:bg-black/50",r==="source"&&"h-dvh max-h-none w-full max-w-none rounded-none sm:h-auto sm:max-h-[90dvh] sm:w-[calc(100%_-_2rem)] sm:max-w-lg sm:rounded-lg",e),children:(0,G.jsx)(Vr,{children:(0,G.jsxs)("div",{className:A("relative grid min-w-0 max-h-[90dvh] gap-4 overflow-y-auto rounded-lg border border-neutral-200 bg-white p-6",r==="source"&&"flex h-dvh max-h-none flex-col gap-0 overflow-hidden rounded-none p-0 sm:h-auto sm:max-h-[90dvh] sm:rounded-lg"),children:[t,(0,G.jsx)(gi,{className:A("absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600",r==="source"&&"flex h-11 w-11 items-center justify-center"),"aria-label":"Close",children:(0,G.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,G.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})})]})})});return _?(0,Ur.createPortal)(S,_):S}function Kr({className:e,...t}){return(0,G.jsx)("div",{className:A("flex min-w-0 flex-col gap-1.5 pr-7",e),...t})}function Qr({className:e,...t}){return(0,G.jsx)("div",{"data-dialog-footer":!0,className:A("flex flex-wrap justify-end gap-2",e),...t})}function Xr({className:e,...t}){let r=(0,L.useContext)(Re);return(0,G.jsx)("h2",{id:r?.titleId,className:A("break-words text-lg font-semibold leading-snug tracking-tight",e),...t})}function Zr({className:e,...t}){let r=(0,L.useContext)(Re);return(0,G.jsx)("p",{id:r?.descriptionId,className:A("text-sm text-neutral-600",e),...t})}var Jr=C(B(),1);var V=C(P(),1);function bi(e,t=18){if(e.length<=t)return e;let r=Math.floor((t-1)/2);return`${e.slice(0,r)}\u2026${e.slice(-r)}`}function ht({value:e,label:t}){let[r,n]=(0,Jr.useState)("");return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Q,{type:"button",variant:"ghost",size:"sm",className:"h-7 shrink-0 px-1.5","aria-label":t,title:t,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>n("Copied."),()=>n("Unable to copy.")),navigator.clipboard||n("Unable to copy.")},children:(0,V.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[(0,V.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),(0,V.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),(0,V.jsx)("span",{className:"sr-only",role:"status",children:r})]})}function Ve({value:e,label:t="ID",full:r=!1}){return e?(0,V.jsxs)("span",{className:"inline-flex max-w-full min-w-0 items-center gap-1",children:[(0,V.jsx)("code",{title:e,className:r?"min-w-0 break-all font-mono text-xs":"font-mono text-xs whitespace-nowrap",children:r?e:bi(e)}),(0,V.jsx)(ht,{value:e,label:`Copy ${t}`})]}):(0,V.jsx)("span",{className:"text-neutral-600",children:"\u2014"})}var tn=C(P(),1);function en({className:e,type:t,...r}){return(0,tn.jsx)("input",{type:t,className:A("flex h-9 w-full rounded-md border border-neutral-300 bg-white px-3 py-1 text-sm shadow-sm placeholder:text-neutral-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:cursor-not-allowed disabled:opacity-50",e),...r})}var an=C(B(),1);var rn=C(B(),1),nn=C(gt(),1);var on=C(P(),1),hi=Object.defineProperty,yi=(e,t)=>hi(e,"name",{value:t,configurable:!0}),vi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],sn=vi.reduce((e,t)=>{let r=$e(`Primitive.${t}`),n=rn.forwardRef((o,i)=>{let{asChild:s,...l}=o,c=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,on.jsx)(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function wi(e,t){e&&nn.flushSync(()=>e.dispatchEvent(t))}yi(wi,"dispatchDiscreteCustomEvent");var ln=C(P(),1),xi=Object.defineProperty,ki=(e,t)=>xi(e,"name",{value:t,configurable:!0}),cn=an.forwardRef(ki(function(t,r){return(0,ln.jsx)(sn.label,{...t,ref:r,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(t.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}})},"Label"));var un=C(P(),1);function dn({className:e,...t}){return(0,un.jsx)(cn,{className:A("text-sm font-medium leading-none peer-disabled:opacity-70",e),...t})}var pn=C(B(),1);var qe={brand:"PACKAGE.broker",description:"open-source package registry broker",version:"2.0.0-rc.4",links:[{label:"AGPL-3.0",href:"https://github.com/package-broker/broker/blob/main/LICENSE"},{label:"Source code",href:"https://github.com/package-broker/broker"},{label:"Documentation",href:"https://package.broker/docs/"}]};function fn(e){return e("footer",{className:"product-footer"},e("span",{},e("strong",{},qe.brand),` ${qe.description}`),e("span",{},`Version ${qe.version}`),...qe.links.map(({label:t,href:r})=>e("a",{href:r,target:"_blank",rel:"noopener noreferrer","aria-label":`${t} (opens externally in a new tab)`},t)))}function mn(){return fn((e,t,...r)=>(0,pn.createElement)(e,t,...r))}var D=C(B(),1);var yn=[10,16,26,18,24,16,18,22,22,26,30,22,22,24],vn=[1,1,1,2,2,4,4,4,5,5,5,8,9,9],_i=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66]],Ri=[236,17],Ci=21522,Ei=1335,Ai=7973,wn=8;function xn(e){let t=(16*e+128)*e+64;if(e>=2){let r=Math.floor(e/7)+2;t-=(25*r-10)*r-55,e>=7&&(t-=36)}return t}function vt(e){let t=e-1;return Math.floor(xn(e)/8)-yn[t]*vn[t]}function kn(e){return e<=9?8:16}function Sn(e){if(!Number.isInteger(e)||e<1||e>14)throw new RangeError("unsupported QR version");return Math.floor((vt(e)*8-4-kn(e))/8)}var gn=Sn(14),Ce=new Uint8Array(512),wt=new Uint8Array(256);{let e=1;for(let t=0;t<255;t+=1)Ce[t]=e,wt[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t+=1)Ce[t]=Ce[t-255]}function yt(e,t){return e===0||t===0?0:Ce[wt[e]+wt[t]]}function Ti(e,t){let r=[1];for(let o=0;o<t;o+=1){let i=new Array(r.length+1).fill(0);for(let s=0;s<r.length;s+=1)i[s]=i[s]^yt(r[s],1),i[s+1]=i[s+1]^yt(r[s],Ce[o]);r=i}let n=new Array(t).fill(0);for(let o of e){let i=o^n.shift();n.push(0);for(let s=0;s<t;s+=1)n[s]=n[s]^yt(r[s+1],i)}return n}function Pi(e,t){let r=[],n=(u,w)=>{for(let m=w-1;m>=0;m-=1)r.push(u>>>m&1)};n(4,4),n(t.length,kn(e));for(let u of t)n(u,8);let o=vt(e)*8;n(0,Math.min(4,o-r.length)),n(0,(8-r.length%8)%8);let i=[];for(let u=0;u<r.length;u+=8)i.push(parseInt(r.slice(u,u+8).join(""),2));for(let u=0;i.length<vt(e);u+=1)i.push(Ri[u%2]);let s=e-1,l=vn[s],c=yn[s],d=Math.floor(xn(e)/8),_=l-d%l,S=Math.floor(d/l)-c,k=[],y=[],h=0;for(let u=0;u<l;u+=1){let w=S+(u<_?0:1),m=i.slice(h,h+w);h+=w,k.push(m),y.push(Ti(m,c))}let v=[];for(let u=0;u<S+1;u+=1)for(let w of k)u<w.length&&v.push(w[u]);for(let u=0;u<c;u+=1)for(let w of y)v.push(w[u]);return v}function bn(e,t,r){let n=e;for(let o=0;o<r;o+=1)n=n<<1^(n>>>r-1)*t;return n}function Oi(e,t,r){switch(e){case 0:return(t+r)%2===0;case 1:return r%2===0;case 2:return t%3===0;case 3:return(t+r)%3===0;case 4:return(Math.floor(t/3)+Math.floor(r/2))%2===0;case 5:return t*r%2+t*r%3===0;case 6:return(t*r%2+t*r%3)%2===0;default:return((t+r)%2+t*r%3)%2===0}}function hn(e){let t=0,r=1;for(let o=1;o<=e.length;o+=1){if(o<e.length&&e[o]===e[o-1]){r+=1;continue}r>=5&&(t+=3+(r-5)),r=1}let n=`0000${e.map(o=>o?"1":"0").join("")}0000`;for(let o=0;o+11<=n.length;o+=1){let i=n.slice(o,o+11);(i==="10111010000"||i==="00001011101")&&(t+=40)}return t}function Ni(e){let t=e.length,r=0,n=0;for(let i=0;i<t;i+=1){let s=e[i];r+=hn(s),r+=hn(e.map(l=>l[i]));for(let l=0;l<t;l+=1)s[l]&&(n+=1),l+1<t&&i+1<t&&s[l]===s[l+1]&&s[l]===e[i+1][l]&&s[l]===e[i+1][l+1]&&(r+=3)}let o=t*t;return r+=(Math.ceil(Math.abs(n*20-o*10)/o)-1)*10,r}function Mi(e,t,r){let n=e*4+17,o=Array.from({length:n},()=>new Array(n).fill(!1)),i=Array.from({length:n},()=>new Array(n).fill(!1)),s=(h,v,u)=>{o[v][h]=u,i[v][h]=!0};for(let h=0;h<n;h+=1)s(6,h,h%2===0),s(h,6,h%2===0);let l=(h,v)=>{for(let u=-4;u<=4;u+=1)for(let w=-4;w<=4;w+=1){let m=Math.max(Math.abs(w),Math.abs(u)),T=h+w,W=v+u;T>=0&&T<n&&W>=0&&W<n&&s(T,W,m!==2&&m!==4)}};l(3,3),l(n-4,3),l(3,n-4);let c=_i[e-1],d=c.length-1;c.forEach((h,v)=>{c.forEach((u,w)=>{if(!(v===0&&w===0||v===0&&w===d||v===d&&w===0))for(let m=-2;m<=2;m+=1)for(let T=-2;T<=2;T+=1)s(u+T,h+m,Math.max(Math.abs(T),Math.abs(m))!==1)})});let _=h=>{let v=h,u=(v<<10|bn(v,Ei,10))^Ci,w=m=>(u>>>m&1)!==0;for(let m=0;m<=5;m+=1)s(8,m,w(m));s(8,7,w(6)),s(8,8,w(7)),s(7,8,w(8));for(let m=9;m<15;m+=1)s(14-m,8,w(m));for(let m=0;m<8;m+=1)s(n-1-m,8,w(m));for(let m=8;m<15;m+=1)s(8,n-15+m,w(m));s(8,n-8,!0)};if(_(0),e>=7){let h=e<<12|bn(e,Ai,12);for(let v=0;v<18;v+=1){let u=(h>>>v&1)!==0,w=n-11+v%3,m=Math.floor(v/3);s(w,m,u),s(m,w,u)}}let S=0;for(let h=n-1;h>=1;h-=2){h===6&&(h=5);for(let v=0;v<n;v+=1)for(let u=0;u<2;u+=1){let w=h-u,T=(h+1&2)===0?n-1-v:v;!i[T][w]&&S<t.length*8&&(o[T][w]=(t[S>>>3]>>>7-(S&7)&1)!==0,S+=1)}}let k=h=>o.map((v,u)=>v.map((w,m)=>!i[u][m]&&Oi(h,m,u)?!w:w)),y=r??0;if(r===void 0){let h=1/0;for(let v=0;v<wn;v+=1){_(v);let u=Ni(k(v));u<h&&(h=u,y=v)}}return _(y),{version:e,size:n,mask:y,modules:k(y)}}function _n(e,t={}){let{mask:r}=t;if(r!==void 0&&(!Number.isInteger(r)||r<0||r>=wn))throw new RangeError("unsupported QR mask");if(typeof e!="string"||e.length===0)throw new TypeError("QR text is empty");if(e.length>gn)throw new RangeError("QR text is too long");let n=new TextEncoder().encode(e);if(n.length>gn)throw new RangeError("QR text is too long");let o=1;for(;Sn(o)<n.length;)o+=1;return Mi(o,Pi(o,n),r)}var Rn="/_pb/ui/";var a=C(P(),1);function St(e){let t=e,r=new Set;return{get:()=>t,set(n){t={...t,...n};for(let o of[...r])o()},subscribe(n){return r.add(n),()=>{r.delete(n)}}}}function _t(e){return(0,D.useSyncExternalStore)(e.subscribe,e.snapshot,e.snapshot)}function Ii(e){if(e.startsWith("/")){if(e.startsWith("//")||e.includes("\\")||[...e].some(r=>r.charCodeAt(0)<=32||r.charCodeAt(0)===127))return!1;let t="https://broker.invalid";return new URL(e,t).origin===t}try{let{protocol:t}=new URL(e);return t==="https:"||t==="http:"}catch{return!1}}function Be(e){let t=/^#\/packages\/([0-7][0-9A-HJKMNP-TV-Z]{25})(\?[\s\S]*)?$/.exec(e);if(t)return Be(`#/packages${t[2]??""}`).replace("#/packages",`#/packages/${t[1]}`);if(/^#\/npm-login\/[A-Za-z0-9_-]{43}$/.test(e))return e;let r=/^#\/(projects|access|sources|packages|tokens|notifications|audit|import|login)(?:\?([\s\S]*))?$/.exec(e);if(r===null||r[0]!==e)return"#/projects";let n=new URLSearchParams(r[2]);return tr(r[1]==="login"?"projects":r[1],{project:n.get("project"),status:n.get("status"),source:n.get("source"),projectId:n.get("projectId"),q:n.get("q"),after:n.get("after"),package:n.get("package"),versionAfter:n.get("versionAfter"),cursor:n.get("cursor"),run:n.get("run"),actor:n.get("actor"),action:n.get("action"),filterProject:n.get("filterProject"),limit:n.get("limit")})}function En(e){let t=new URLSearchParams(e.split("?")[1]??"");return Be(`#${t.get("return")??"/projects"}`)}async function An(e,t,r,n,o){let i=r==="login"?Be(o??""):`#/reauth?return=${encodeURIComponent(En(o??"").slice(1))}&sso=complete`,s={params:{provider:t},body:{purpose:r,...o===void 0?{}:{returnTo:`/_pb/ui${i}`}},headers:{Accept:"application/json"}},l=await e.request("post","/_pb/auth/sso/{provider}/start",s);if(!l.ok)return"failed";let d=l.data?.location;return typeof d!="string"||!Ii(d)?"refused":(n(d),"navigated")}function Ye(e){return!e.ok&&e.status===403&&e.code==="local_auth_disabled"}function Li(e){let t=St({status:"idle",error:null});return{snapshot:t.get,subscribe:t.subscribe,async submit(r){if(t.get().status==="busy")return;t.set({status:"busy",error:null});let n=await e.client.request("post","/_pb/auth/local/login",{body:{email:r.email,password:r.password,code:r.code}});if(n.ok){t.set({status:"signed-in",error:null}),e.onSignedIn();return}t.set({status:"error",error:Ye(n)?"disabled":n.status===0?"unavailable":"invalid"})}}}function aa(e){let t=new Set,r=St({dialog:"closed",action:null,busy:!1,outcome:null});return{snapshot:r.get,subscribe:r.subscribe,subscribeReplay(n){return t.add(n),()=>{t.delete(n)}},requireReauth(n,o,i){if(!Jt(e.storage,{method:n.method,path:n.path,...n.idempotencyKey===void 0?{}:{idempotencyKey:n.idempotencyKey},...n.body===void 0?{}:{body:n.body},...n.headers===void 0?{}:{headers:n.headers},...o.display===void 0?{}:{display:o.display},credential:o.credential,secretFields:o.secretFields}).ok){r.set({dialog:"closed",action:null,outcome:"save-failed"});return}r.set({dialog:"closed",action:null,outcome:null}),e.navigate(`#/reauth?return=${encodeURIComponent(Be(i).slice(1))}`)},restore(){let n=it(e.storage,e.now());n.ok&&n.action!==null&&r.set(n.action.requiresCredential?{dialog:"closed",action:null,outcome:"credential-required"}:{dialog:"confirm",action:n.action,outcome:null})},clear(){it(e.storage,e.now()),r.set({dialog:"closed",action:null,busy:!1,outcome:null})},decline(){r.set({dialog:"closed",action:null,outcome:null})},async confirm(){let{action:n,busy:o}=r.get();if(n===null||n.requiresCredential||o)return;r.set({busy:!0,action:null});let i={...n.idempotencyKey===void 0?{}:{idempotencyKey:n.idempotencyKey},...n.body===void 0?{}:{body:n.body},...n.headers===void 0?{}:{headers:n.headers}},s=e.client.request,l;try{let c=await s(n.method.toLowerCase(),n.path,i);l={path:n.path,ok:c.ok,status:c.status,...c.ok?{}:{code:c.code},...c.ok&&c.status===201&&n.method==="POST"&&/^\/_pb\/(?:projects\/[^/]+\/)?sources$/.test(n.path)&&c.data!==null&&typeof c.data=="object"&&"id"in c.data&&typeof c.data.id=="string"&&/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/.test(c.data.id)?{createdSourceId:c.data.id}:{}},r.set({dialog:"closed",busy:!1,outcome:c.ok?"replayed":"failed"})}catch{l={path:n.path,ok:!1,status:0},r.set({dialog:"closed",busy:!1,outcome:"failed"})}for(let c of t)c(l)},async submitLocal(n){let o=await e.client.request("post","/_pb/auth/local/reauth",{body:{password:n.password,code:n.code}});return o.ok?"done":Ye(o)?"disabled":"refused"}}}var Di={bad_token_shape:"That does not look like a setup token. Paste the whole token as it was issued.",token_refused:"This setup token was not accepted. It may be wrong, expired or already used.",origin_refused:"The broker refused this request because it came from a different address.",rate_limited:"Too many attempts. Wait a few minutes and try again.",unavailable:"The broker could not be reached or answered unexpectedly. Try again in a moment.",password_mismatch:"The password and its confirmation do not match.",missing_fields:"Enter a password and the six digit code from your authenticator.",finish_refused:"Setup was not completed. Check the password requirements and the six digit code, then try again."},Hi=43,Cn=1024;function ji(e){try{return _n(e)}catch{return null}}function zi(e){return e===400||e===401?"token_refused":e===403?"origin_refused":e===429?"rate_limited":"unavailable"}function $i(e){let t=St({stage:"token",busy:!1,notice:null,enrollment:null}),r=null;return{snapshot:t.get,subscribe:t.subscribe,async submitToken(n){let o=t.get();if(o.busy||o.stage!=="token")return;let i=n.trim();if(i.length!==Hi||!/^[A-Za-z0-9_-]+$/.test(i)){t.set({notice:"bad_token_shape"});return}t.set({busy:!0,notice:null});let s=await e.client.request("post","/_pb/auth/local/setup/start",{body:{token:i}});if(Ye(s)){r=null,t.set({busy:!1,stage:"disabled",notice:null,enrollment:null});return}if(!s.ok){t.set({busy:!1,notice:zi(s.status)});return}let l=s.data;if(typeof l?.provisioningUri!="string"||typeof l.secret!="string"||l.secret===""){t.set({busy:!1,notice:"unavailable"});return}r=i,t.set({busy:!1,stage:"enroll",notice:null,enrollment:{secret:l.secret,qr:ji(l.provisioningUri)}})},async finish(n){let o=t.get();if(o.busy||o.stage!=="enroll"||r===null)return;let i=n.code.replace(/\s+/g,"");if(n.password===""||i===""){t.set({notice:"missing_fields"});return}if(n.password.length>Cn||i.length>Cn||n.password!==n.confirmation){t.set({notice:"password_mismatch"});return}t.set({busy:!0,notice:null});let s=await e.client.request("post","/_pb/auth/local/setup/finish",{body:{token:r,password:n.password,code:i}});if(s.ok){r=null,t.set({busy:!1,stage:"done",enrollment:null}),e.onSignedIn?.();return}if(Ye(s)){r=null,t.set({busy:!1,stage:"disabled",notice:null,enrollment:null});return}if(s.status===0||s.status>=500){r=null,t.set({busy:!1,stage:"uncertain",enrollment:null});return}t.set({busy:!1,notice:s.status===403?"origin_refused":s.status===429?"rate_limited":"finish_refused"})}}}var Fi=(0,D.createContext)(null);function la(){let e=(0,D.useContext)(Fi);if(e===null)throw new Error("ServicesContext is missing");return e}function Ue(e){e.preventDefault();let t=e.currentTarget,r={};for(let[n,o]of new FormData(t))typeof o=="string"&&(r[n]=o);return t.reset(),r}function te(e){return(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(dn,{htmlFor:e.id,children:e.label}),(0,a.jsx)(en,{id:e.id,name:e.id,type:e.type??"text",required:!0,autoComplete:e.autoComplete??"off",...e.inputMode?{inputMode:e.inputMode}:{},...e.hint?{"aria-describedby":`${e.id}-hint`}:{}}),e.hint?(0,a.jsx)("p",{id:`${e.id}-hint`,className:"text-xs text-neutral-600",children:e.hint}):null]})}var Gi={refused:"The sign-in provider returned an address the broker will not open.",failed:"Single sign-on could not be started. Try again in a moment."};function Tn(e){return e.providers.length===0?null:(0,a.jsx)("div",{className:"grid gap-2",children:e.providers.map(t=>(0,a.jsxs)(Q,{type:"button",variant:"outline",disabled:e.busy,onClick:()=>e.onSso(t.id),children:[e.verb," ",t.displayName]},t.id))})}function Rt(e){return e.status==="loading"?(0,a.jsx)("p",{role:"status",children:"Loading sign-in options\u2026"}):e.status==="error"?(0,a.jsx)("p",{role:"alert",children:"Sign-in options could not be loaded. Reload the page to try again."}):!e.local&&e.providers.length===0?(0,a.jsx)("p",{children:"Contact your administrator for help signing in."}):null}var xt={state_invalid:"The sign-in request expired or could not be verified. Start sign-in again.",state_mismatch:"The sign-in response did not match your request. Start sign-in again.",no_session:"Your session ended. Sign in again, then retry the action within 10 minutes.",session_inactive:"Your session ended. Sign in again, then retry the action within 10 minutes.",no_auth_time:"Your provider did not confirm a fresh sign-in. Sign out and sign in again, then retry the action within 10 minutes.",stale_auth_time:"Your provider returned an older sign-in. Sign out and sign in again, then retry the action within 10 minutes.",not_supported:"Your provider cannot confirm a fresh sign-in. Sign out and sign in again, then retry the action within 10 minutes.",not_sso_session:"Use the sign-in method associated with your current session to confirm this action.",identity_mismatch:"Sign in with the same account used for your current session.",anchor_mismatch:"Your sign-in provider configuration changed. Contact your administrator.",provider_rebound:"Your sign-in provider configuration changed. Contact your administrator.",provider_error:"The sign-in provider could not complete the request. Try signing in again.",missing_credentials:"The provider did not return a sign-in response. Start sign-in again.",invalid_token:"The provider response could not be verified. Start sign-in again.",email_missing:"Your provider did not supply the account details needed to sign in. Contact your administrator.",email_unverified:"Your provider has not verified your account address. Contact your administrator.",domain_not_verified:"Your account domain is not approved for this organization. Contact your administrator.",not_invited:"Your account has not been granted access. Contact your administrator.",user_suspended:"Your account is suspended. Contact your administrator.",hook_denied:"Organization policy refused this sign-in. Contact your administrator.",policy:"Organization policy refused confirmation. Contact your administrator.",too_many_groups:"Your provider returned more groups than allowed. Contact your administrator.",already_linked:"This provider account is already linked. Contact your administrator.",link_requires_admin:"An administrator needs to link your provider account.",invalid_identity:"Your provider returned account details that could not be verified. Contact your administrator.",email_changed:"Your provider account details changed. Contact your administrator.",conflict:"Your account changed during sign-in. Start sign-in again.",not_updated:"Confirmation could not be saved. Try again.",direct_reauth:"Your provider cannot complete confirmation. Sign out and sign in again, then retry within 10 minutes.",reauth_refused:"Confirmation was refused. Try again or contact your administrator.",login_refused:"Sign-in could not be completed. Try again or contact your administrator."};function Vi(e){return(e!==null&&Object.hasOwn(xt,e)?xt[e]:void 0)??xt.login_refused}function ca(e){return(0,a.jsxs)(xe,{className:"mx-auto mt-12 max-w-md",children:[(0,a.jsx)(ke,{children:(0,a.jsx)("h1",{id:"page-heading",tabIndex:-1,className:"font-semibold leading-none tracking-tight",children:"Sign-in failed"})}),(0,a.jsxs)(Se,{className:"grid gap-4",children:[(0,a.jsx)(pe,{variant:"destructive",children:(0,a.jsx)(me,{children:Vi(e.reason)})}),(0,a.jsx)("a",{href:e.signedIn?`#/reauth?return=${encodeURIComponent(En(e.hash??"").slice(1))}`:"#/login",children:e.signedIn?"Return to confirmation":"Return to sign in"})]})]})}function qi(e){let t=e.state.status==="busy",r=e.local&&e.state.error!=="disabled";return(0,a.jsxs)(xe,{className:"mx-auto mt-12 max-w-md",children:[(0,a.jsxs)(ke,{children:[(0,a.jsx)("h1",{id:"page-heading",tabIndex:-1,className:"font-semibold leading-none tracking-tight",children:"Sign in"}),(0,a.jsx)(mt,{children:"Package Broker"})]}),(0,a.jsxs)(Se,{className:"grid gap-4",children:[(0,a.jsx)(Rt,{status:e.availability??"ready",local:r,providers:e.providers}),e.state.error===null||e.state.error==="disabled"?null:(0,a.jsx)(pe,{variant:"destructive",children:(0,a.jsx)(me,{children:e.state.error==="unavailable"?"The broker could not be reached. Try again in a moment.":"Sign-in failed. Check your details and try again."})}),e.ssoError?(0,a.jsx)(pe,{variant:"destructive",children:(0,a.jsx)(me,{children:Gi[e.ssoError]})}):null,r&&(e.availability??"ready")==="ready"?(0,a.jsxs)("form",{className:"grid gap-4",onSubmit:n=>{if(n.preventDefault(),t)return;let o=Ue(n);e.onSubmit({email:o.email??"",password:o.password??"",code:(o.code??"").replace(/\s+/g,"")})},children:[(0,a.jsx)(te,{id:"email",label:"E-mail",type:"email",autoComplete:"username"}),(0,a.jsx)(te,{id:"password",label:"Password",type:"password",autoComplete:"current-password"}),(0,a.jsx)(te,{id:"code",label:"Authenticator code",autoComplete:"one-time-code",inputMode:"numeric"}),(0,a.jsx)(Q,{type:"submit",disabled:t,children:t?"Signing in\u2026":"Sign in"})]}):null,(0,a.jsx)(Tn,{providers:e.providers,busy:t,onSso:e.onSso,verb:"Sign in with"})]})]})}function Yi(e){let t=e.providers.filter(r=>r.supportsReauth);return(0,a.jsxs)(xe,{className:"mx-auto mt-12 max-w-md",children:[(0,a.jsxs)(ke,{children:[(0,a.jsx)("h1",{id:"page-heading",tabIndex:-1,className:"font-semibold leading-none tracking-tight",children:"Confirm it is you"}),(0,a.jsx)(mt,{children:"This action needs a fresh sign-in."})]}),(0,a.jsxs)(Se,{className:"grid gap-4",children:[(0,a.jsx)(Rt,{status:e.availability??"ready",local:e.local,providers:t}),e.error?(0,a.jsx)(pe,{variant:"destructive",children:(0,a.jsx)(me,{children:"Confirmation failed. Check your details and try again."})}):null,e.local&&(e.availability??"ready")==="ready"?(0,a.jsxs)("form",{className:"grid gap-4",onSubmit:r=>{if(r.preventDefault(),e.busy)return;let n=Ue(r);e.onSubmit({password:n.password??"",code:(n.code??"").replace(/\s+/g,"")})},children:[(0,a.jsx)(te,{id:"password",label:"Password",type:"password",autoComplete:"current-password"}),(0,a.jsx)(te,{id:"code",label:"Authenticator code",autoComplete:"one-time-code",inputMode:"numeric"}),(0,a.jsx)(Q,{type:"submit",disabled:e.busy,children:"Confirm"})]}):null,e.providers.some(r=>!r.supportsReauth)?(0,a.jsxs)("p",{role:"status",children:["Your sign-in provider cannot confirm a fresh sign-in. Sign out and sign in again, then retry this action within 10 minutes.",e.local?" You can also use the local sign-in form to confirm.":""]}):null,(0,a.jsx)(Tn,{providers:t,busy:e.busy,onSso:e.onSso,verb:"Confirm with"}),!e.local&&(e.availability??"ready")==="ready"&&t.length>0?(0,a.jsxs)("p",{children:["Signed in with a password? Sign out and sign in with"," ",t.map(r=>r.displayName).join(" or ")," to continue."]}):null]})]})}function Ui(e){return(0,a.jsx)(Br,{open:e.open,onOpenChange:t=>{t||e.onDecline()},children:(0,a.jsx)(Wr,{children:(0,a.jsx)(Wi,{...e})})})}function Pn(e){return e?.path.match(/^\/_pb\/projects\/([^/]+)\/restore$/)?.[1]}function Bi(e){if(Pn(e))return{label:"Restore project",effect:"Restore this archived project.",destructive:!1};let r=e?.path.match(/\/(quarantine|tombstone|release|approve|apply|cancel|rollback)$/)?.[1],n={quarantine:"Quarantine version",tombstone:"Tombstone version",release:"Release version",approve:"Approve import run",apply:"Apply import run",cancel:"Cancel import run",rollback:"Roll back import run"},o={quarantine:"Clients cannot resolve this version until it is released. Only this version is affected.",tombstone:"Clients can no longer install this version. Only this version is affected. This cannot be undone.",release:"Clients can resolve this version again. Only this version is affected.",approve:"Approve the reviewed plan hash for this run.",apply:"Apply the approved import plan.",cancel:"Cancel this planned import run.",rollback:"Restore retained before-images where rollback is possible."};return{label:r?n[r]??"Send held action":"Send held action",effect:r?o[r]??"Send the request you started before confirming your identity.":"Send the request you started before confirming your identity.",destructive:["tombstone","cancel","rollback"].includes(r??"")}}function Wi(e){let t=Bi(e.action),r=e.action?.display,n=Pn(e.action),o=e.action?.path.match(/\/packages\/([^/]+)\/versions\/([^/]+)/),i=e.action?.path.match(/\/import-runs\/([^/]+)/)?.[1],s=e.action?`${e.action.method} ${e.action.path}`:"";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(Kr,{children:[(0,a.jsx)(Xr,{children:"Send the held action now?"}),(0,a.jsx)(Zr,{children:"You confirmed your identity. The action below was held while you signed in and has not been sent yet."})]}),(0,a.jsxs)("dl",{className:"detail-list",children:[(0,a.jsx)("dt",{children:"Action"}),(0,a.jsx)("dd",{className:"font-medium",children:t.label}),n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("dt",{children:"Project"}),(0,a.jsx)("dd",{children:n})]}):null,r?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("dt",{children:"Package"}),(0,a.jsx)("dd",{children:r.packageName}),(0,a.jsx)("dt",{children:"Version"}),(0,a.jsx)("dd",{className:"font-mono",children:r.version})]}):o?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("dt",{children:"Package ID"}),(0,a.jsx)("dd",{children:(0,a.jsx)(Ve,{value:o[1],label:"package ID"})}),(0,a.jsx)("dt",{children:"Version ID"}),(0,a.jsx)("dd",{children:(0,a.jsx)(Ve,{value:o[2],label:"version ID"})})]}):null,i?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("dt",{children:"Run"}),(0,a.jsx)("dd",{children:(0,a.jsx)(Ve,{value:i,label:"run ID"})})]}):null,(0,a.jsx)("dt",{children:"Scope"}),(0,a.jsx)("dd",{children:r?.scope??(e.action?.path.startsWith("/_pb/projects/")?"Project":"Organization")}),(0,a.jsx)("dt",{children:"Effect"}),(0,a.jsx)("dd",{children:t.effect})]}),s?(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{className:"cursor-pointer text-sm text-blue-700",children:"Request details"}),(0,a.jsxs)("div",{className:"mt-2 flex min-w-0 items-start gap-2 rounded-md border border-neutral-200 bg-neutral-50 p-3",children:[(0,a.jsx)("code",{className:"min-w-0 break-all text-xs",children:s}),(0,a.jsx)(ht,{value:s,label:"Copy request"})]})]}):null,(0,a.jsxs)(Qr,{children:[(0,a.jsx)(Q,{type:"button",variant:"outline",onClick:e.onDecline,children:"Discard"}),(0,a.jsx)(Q,{type:"button",variant:t.destructive?"destructive":"default",onClick:e.onConfirm,children:t.label})]})]})}var kt=4;function Ki({matrix:e}){let t=e.size+kt*2,r=[];return e.modules.forEach((n,o)=>{n.forEach((i,s)=>{i&&r.push(`M${s+kt} ${o+kt}h1v1h-1z`)})}),(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${t} ${t}`,width:"192",height:"192",role:"img","aria-label":"Authenticator QR code",shapeRendering:"crispEdges",children:[(0,a.jsx)("rect",{width:t,height:t,fill:"#ffffff"}),(0,a.jsx)("path",{d:r.join(""),fill:"#000000"})]})}function Qi(e){let{state:t}=e;return(0,a.jsxs)(xe,{className:"mx-auto mt-12 max-w-md",children:[(0,a.jsx)(ke,{children:(0,a.jsx)("h1",{id:"page-heading",tabIndex:-1,className:"font-semibold leading-none tracking-tight",children:"First-run setup"})}),(0,a.jsxs)(Se,{className:"grid gap-4",children:[t.notice===null?null:(0,a.jsx)(pe,{variant:"destructive",children:(0,a.jsx)(me,{children:Di[t.notice]})}),t.stage==="token"?(0,a.jsxs)("form",{className:"grid gap-4",onSubmit:r=>{r.preventDefault(),!t.busy&&e.onToken(Ue(r).token??"")},children:[(0,a.jsx)(te,{id:"token",label:"Setup token",hint:"Paste the token the broker printed at start."}),(0,a.jsx)(Q,{type:"submit",disabled:t.busy,children:"Continue"})]}):null,t.stage==="enroll"&&t.enrollment?(0,a.jsxs)("form",{className:"grid gap-4",onSubmit:r=>{if(r.preventDefault(),t.busy)return;let n=Ue(r);e.onFinish({password:n.password??"",confirmation:n.confirmation??"",code:n.code??""})},children:[t.enrollment.qr?(0,a.jsx)(Ki,{matrix:t.enrollment.qr}):null,(0,a.jsxs)("p",{className:"text-sm",children:["Setup key: ",(0,a.jsx)("code",{className:"break-all",children:t.enrollment.secret})]}),(0,a.jsx)(te,{id:"password",label:"Password",type:"password",autoComplete:"new-password"}),(0,a.jsx)(te,{id:"confirmation",label:"Confirm password",type:"password",autoComplete:"new-password"}),(0,a.jsx)(te,{id:"code",label:"Authenticator code",autoComplete:"one-time-code",inputMode:"numeric"}),(0,a.jsx)(Q,{type:"submit",disabled:t.busy,children:"Finish setup"})]}):null,t.stage==="done"?(0,a.jsx)("p",{children:"Setup is complete. You can now sign in."}):null,t.stage==="uncertain"?(0,a.jsx)("p",{children:"The broker did not confirm the result. Try signing in; if that fails, ask for a fresh setup token."}):null]})]})}function Ct(e){let[t,r]=(0,D.useState)({client:e,providers:[],local:!1,availability:"loading"});return(0,D.useEffect)(()=>{let n=!0;return e.request("get","/_pb/auth/providers").then(o=>{n&&(o.ok&&o.data&&typeof o.data.local=="boolean"&&Array.isArray(o.data.providers)?r({client:e,providers:o.data.providers,local:o.data.local,availability:"ready"}):r({client:e,providers:[],local:!1,availability:"error"}))}).catch(()=>{n&&r({client:e,providers:[],local:!1,availability:"error"})}),()=>{n=!1}},[e]),t.client===e?t:{providers:[],local:!1,availability:"loading"}}var On=e=>{window.location.assign(e)};function da(e){let{client:t,onSignedIn:r}=e,n=(0,D.useMemo)(()=>Li({client:t,onSignedIn:r}),[t,r]),o=_t(n),{providers:i,local:s,availability:l}=Ct(t),[c,d]=(0,D.useState)(null);return(0,a.jsx)(qi,{state:o,providers:i,local:s,availability:l,ssoError:c,onSubmit:_=>{n.submit(_)},onSso:_=>{d(null),An(t,_,"login",On,window.location.hash).then(S=>{S!=="navigated"&&d(S)})}})}function Xi(e){return(0,a.jsxs)("div",{className:"mx-auto mt-12 max-w-md grid gap-4",children:[(0,a.jsx)("h1",{id:"page-heading",tabIndex:-1,className:"font-semibold",children:"First-run setup"}),e.availability!=="loading"?(0,a.jsx)("h2",{className:"font-semibold",children:e.availability==="error"?"Setup is unavailable":"Sign in with your organization's account"}):null,(0,a.jsx)(Rt,{status:e.availability,local:e.local,providers:e.providers}),e.availability==="ready"?(0,a.jsx)("p",{children:"Password setup is unavailable. Sign in to continue."}):null,(0,a.jsx)("a",{href:`${Rn}#/login`,children:"Go to sign in"})]})}function ua(e){let{client:t,onSignedIn:r}=e,n=(0,D.useMemo)(()=>$i({client:t,onSignedIn:r}),[t,r]),o=_t(n),{providers:i,local:s,availability:l}=Ct(t);return l!=="ready"||!s||o.stage==="disabled"?(0,a.jsx)(Xi,{availability:l,local:!1,providers:i}):(0,a.jsx)(Qi,{state:o,onToken:c=>{n.submitToken(c)},onFinish:c=>{n.finish(c)}})}function fa(e){let{client:t,flow:r,onDone:n}=e,{providers:o,local:i,availability:s}=Ct(t),[l,c]=(0,D.useState)(!1),[d,_]=(0,D.useState)(!1),[S,k]=(0,D.useState)(!1);return(0,a.jsx)(Yi,{providers:o,local:i&&!d,availability:s,error:l,busy:S,onSubmit:y=>{k(!0),c(!1),r.submitLocal(y).then(h=>{k(!1),h==="done"?(r.restore(),n()):h==="disabled"?_(!0):c(!0)})},onSso:y=>{c(!1),An(t,y,"reauth",On,window.location.hash).then(h=>{h!=="navigated"&&c(!0)})}})}function pa(e){let t=_t(e.flow);return t.outcome==="save-failed"||t.outcome==="failed"||t.outcome==="credential-required"?(0,a.jsxs)(pe,{variant:"destructive",className:"mx-auto my-4 max-w-lg",children:[(0,a.jsx)(me,{children:t.outcome==="credential-required"?"Enter the credential again to complete your action.":t.outcome==="save-failed"?"Your action could not be saved. Try the action again after dismissing this message.":"Your action could not be completed. Review the current data and try the action again."}),(0,a.jsx)(Q,{type:"button",variant:"outline",onClick:()=>e.flow.decline(),children:"Dismiss"})]}):(0,a.jsx)(Ui,{open:t.dialog==="confirm",action:t.action,onConfirm:()=>{e.flow.confirm()},onDecline:()=>e.flow.decline()})}function ma({children:e}){return(0,a.jsxs)("div",{className:"flex min-h-screen flex-col",children:[(0,a.jsx)("main",{className:"flex-1 px-4",children:e}),(0,a.jsx)(mn,{})]})}export{ge as a,Zi as b,C as c,B as d,gt as e,mn as f,P as g,Jt as h,it as i,tr as j,De as k,A as l,pe as m,me as n,di as o,Q as p,xe as q,ke as r,_s as s,Se as t,Vr as u,As as v,Yr as w,Br as x,Wr as y,Kr as z,Qr as A,Xr as B,Zr as C,Ve as D,en as E,dn as F,Be as G,En as H,aa as I,Fi as J,la as K,ca as L,da as M,ua as N,fa as O,pa as P,ma as Q};