@velora-cms/server 0.11.0 → 0.12.0

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 (75) hide show
  1. package/dist/admin/sync-admin-bundle.d.ts +9 -0
  2. package/dist/admin/sync-admin-bundle.js +120 -0
  3. package/dist/admin-bundle/.velora-version +1 -0
  4. package/dist/admin-bundle/assets/{_virtual_mf-localSharedImportMap___mfe_internal__velora_admin__mf_owner__1-DOKdWYyj.js → _virtual_mf-localSharedImportMap___mfe_internal__velora_admin__mf_owner__1-DlIgIuFP.js} +1 -1
  5. package/dist/admin-bundle/assets/{_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare___mf_0_velora_mf_2_cms_mf_1_plugin_mf_2_sdk__loadShare__.js-C1-ZAxwO.js → _virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare___mf_0_velora_mf_2_cms_mf_1_plugin_mf_2_sdk__loadShare__.js-Bm9EahCG.js} +2 -2
  6. package/dist/admin-bundle/assets/{content-trash.schema-DfXHkC-w.js → content-trash.schema-tvJ4Lbos.js} +5 -5
  7. package/dist/admin-bundle/assets/{hostInit--C4xK6nj.js → hostInit-B-6-34XY.js} +1 -1
  8. package/dist/admin-bundle/assets/{index-DhMY-0sC.js → index-CHCGuSbb.js} +1 -1
  9. package/dist/admin-bundle/assets/{index-BIAF0ShP.js → index-DYO7-IK8.js} +33 -33
  10. package/dist/admin-bundle/assets/{mf-entry-bootstrap-0-aef015cd.js → mf-entry-bootstrap-0-7b0ce2fe.js} +2 -2
  11. package/dist/admin-bundle/assets/{remoteEntry-CNyN68bc.js → remoteEntry-J2yJXsGB.js} +2 -2
  12. package/dist/admin-bundle/index.html +4 -4
  13. package/dist/app.d.ts +16 -1
  14. package/dist/app.js +63 -4
  15. package/dist/auth/api-keys.d.ts +1 -0
  16. package/dist/auth/api-keys.js +5 -1
  17. package/dist/auth/route-rate-limits.d.ts +4 -0
  18. package/dist/auth/route-rate-limits.js +13 -0
  19. package/dist/bin-sync-admin.d.ts +2 -0
  20. package/dist/bin-sync-admin.js +39 -0
  21. package/dist/bundled-templates/com.velora.blog/package.tar.gz +0 -0
  22. package/dist/config/public-url.d.ts +3 -0
  23. package/dist/config/public-url.js +45 -0
  24. package/dist/db/core-migrations/steps.js +95 -16
  25. package/dist/docs-bundle/pagefind/fragment/en_42f5356.pf_fragment +0 -0
  26. package/dist/docs-bundle/pagefind/fragment/en_67dccf8.pf_fragment +0 -0
  27. package/dist/docs-bundle/pagefind/fragment/en_80941b8.pf_fragment +0 -0
  28. package/dist/docs-bundle/pagefind/fragment/en_a64440b.pf_fragment +0 -0
  29. package/dist/docs-bundle/pagefind/fragment/en_eb168aa.pf_fragment +0 -0
  30. package/dist/docs-bundle/pagefind/index/en_8450ec7.pf_index +0 -0
  31. package/dist/docs-bundle/pagefind/index/en_c285f7b.pf_index +0 -0
  32. package/dist/docs-bundle/pagefind/index/en_e8cada7.pf_index +0 -0
  33. package/dist/docs-bundle/pagefind/pagefind-entry.json +1 -1
  34. package/dist/docs-bundle/pagefind/pagefind.en_57d2f8922f.pf_meta +0 -0
  35. package/dist/docs-bundle/v1/using-velora/getting-started/index.html +5 -3
  36. package/dist/docs-bundle/v1/using-velora/headless-api/index.html +10 -4
  37. package/dist/docs-bundle/v1/using-velora/index.html +6 -4
  38. package/dist/docs-bundle/v1/using-velora/installation/index.html +73 -15
  39. package/dist/docs-bundle/v1/using-velora/media/index.html +118 -34
  40. package/dist/graphql/schema.d.ts +1 -0
  41. package/dist/graphql/schema.js +5 -2
  42. package/dist/lib.d.ts +1 -0
  43. package/dist/lib.js +45 -11
  44. package/dist/media/media-service.d.ts +14 -15
  45. package/dist/media/media-service.js +121 -59
  46. package/dist/media/media-tokens.d.ts +6 -0
  47. package/dist/media/media-tokens.js +88 -0
  48. package/dist/media/storage/local.d.ts +16 -0
  49. package/dist/media/storage/local.js +99 -0
  50. package/dist/media/storage/s3.d.ts +25 -0
  51. package/dist/media/storage/s3.js +134 -0
  52. package/dist/media/storage/types.d.ts +21 -0
  53. package/dist/media/storage/types.js +44 -0
  54. package/dist/routes/admin-static.d.ts +2 -0
  55. package/dist/routes/admin-static.js +42 -4
  56. package/dist/routes/media-public.d.ts +6 -0
  57. package/dist/routes/media-public.js +265 -0
  58. package/dist/routes/media.d.ts +2 -1
  59. package/dist/routes/media.js +95 -5
  60. package/dist/routes/plugin-storage.js +5 -1
  61. package/dist/routes/public-api.js +5 -3
  62. package/dist/routes/published-item.d.ts +2 -1
  63. package/dist/routes/published-item.js +28 -5
  64. package/dist/scripts/copy-admin-bundle.js +9 -1
  65. package/package.json +7 -6
  66. package/prisma/schema.prisma +16 -3
  67. package/dist/docs-bundle/pagefind/fragment/en_1d9eb24.pf_fragment +0 -0
  68. package/dist/docs-bundle/pagefind/fragment/en_3099406.pf_fragment +0 -0
  69. package/dist/docs-bundle/pagefind/fragment/en_9aa652e.pf_fragment +0 -0
  70. package/dist/docs-bundle/pagefind/fragment/en_d855550.pf_fragment +0 -0
  71. package/dist/docs-bundle/pagefind/fragment/en_e6d88d8.pf_fragment +0 -0
  72. package/dist/docs-bundle/pagefind/index/en_5feeed7.pf_index +0 -0
  73. package/dist/docs-bundle/pagefind/index/en_c6981f9.pf_index +0 -0
  74. package/dist/docs-bundle/pagefind/index/en_ce4f6bf.pf_index +0 -0
  75. package/dist/docs-bundle/pagefind/pagefind.en_1e94abd852.pf_meta +0 -0
@@ -1,5 +1,5 @@
1
- var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=(e,t,n)=>(gl(e,t,"read from private field"),n?n.call(e):t.get(e)),yl=(e,t,n)=>t.has(e)?ml("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Eo=(e,t,n,r)=>(gl(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import"./remoteEntry-CNyN68bc.js";import{_ as i,a as Ie,b as x}from"./_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DMaku-HC.js";import{a as Te,b as ne,c as Q,d as M,e as H,f as E,g as O,h as Wn,i as ie,j as bd,k as fn,l as Wa,m as ph,n as xd,o as qs,p as W,R as _r,q as wd,r as Cd,s as Tr,t as Ze,u as Nd,v as hh}from"./_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react__loadShare__.js-BuUBskgj.js";import{_ as mh}from"./_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BPoj3DC9.js";import{r as gh,l as yh}from"./index-Do71v6NZ.js";import{_ as vh,a as xa,b as bh,c as Ed,d as xh,e as Fr,f as Gs,g as qa,h as wh,i as Ch}from"./_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare___mf_0_velora_mf_2_cms_mf_1_plugin_mf_2_sdk__loadShare__.js-C1-ZAxwO.js";import{_ as Ga,a as Nh,b as Zr}from"./_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react_mf_2_dom__loadShare__.js-DYfqn12F.js";import{s as Eh,u as Ya,a as ft,P as qe,c as Me,d as Sd,b as Td,e as Xa,f as Ja,g as ss,h as se,i as Tt,j as qn,k as Ye,l as kr,m as ot,n as xe,o as kd,p as rn,q as Sh,r as Rd,t as Th,I as ye,B as K,v as Ne,w as kh,x as de,S as Rh,T as Ph,C as Dh}from"./content-trash.schema-DfXHkC-w.js";import"./vite-preload-helper-Cgledu0r.js";import"./__virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react__loadShare__.js_commonjs-proxy-Ng0fOpdU.js";import"./__virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react_mf_2_dom__loadShare__.js_commonjs-proxy-oc1i_iBU.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const re=e=>typeof e=="string",mr=()=>{let e,t;const n=new Promise((r,a)=>{e=r,t=a});return n.resolve=e,n.reject=t,n},vl=e=>e==null?"":String(e),Ih=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},Lh=/###/g,bl=e=>e&&e.includes("###")?e.replace(Lh,"."):e,xl=e=>!e||re(e),br=(e,t,n)=>{const r=re(t)?t.split("."):t;let a=0;for(;a<r.length-1;){if(xl(e))return{};const o=bl(r[a]);!e[o]&&n&&(e[o]=new n),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={},++a}return xl(e)?{}:{obj:e,k:bl(r[a])}},wl=(e,t,n)=>{const{obj:r,k:a}=br(e,t,Object);if(r!==void 0||t.length===1){r[a]=n;return}let o=t[t.length-1],s=t.slice(0,t.length-1),l=br(e,s,Object);for(;l.obj===void 0&&s.length;)o=`${s[s.length-1]}.${o}`,s=s.slice(0,s.length-1),l=br(e,s,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${o}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${o}`]=n},Ah=(e,t,n,r)=>{const{obj:a,k:o}=br(e,t,Object);a[o]=a[o]||[],a[o].push(n)},wa=(e,t)=>{const{obj:n,k:r}=br(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Mh=(e,t,n)=>{const r=wa(e,n);return r!==void 0?r:wa(t,n)},Pd=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(Object.prototype.hasOwnProperty.call(e,r)?re(e[r])||e[r]instanceof String||re(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Pd(e[r],t[r],n):e[r]=t[r]);return e},Ot=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Oh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},_h=e=>re(e)?e.replace(/[&<>"'\/]/g,t=>Oh[t]):e;class Fh{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const $h=[" ",",","?","!",";"],Bh=new Fh(20),Uh=(e,t,n)=>{t=t||"",n=n||"";const r=$h.filter(s=>!t.includes(s)&&!n.includes(s));if(r.length===0)return!0;const a=Bh.getRegExp(`(${r.map(s=>s==="?"?"\\?":s).join("|")})`);let o=!a.test(e);if(!o){const s=e.indexOf(n);s>0&&!a.test(e.substring(0,s))&&(o=!0)}return o},is=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(n);let a=e;for(let o=0;o<r.length;){if(!a||typeof a!="object")return;let s,l="";for(let c=o;c<r.length;++c)if(c!==o&&(l+=n),l+=r[c],s=a[l],s!==void 0){if(["string","number","boolean"].includes(typeof s)&&c<r.length-1)continue;o+=c-o+1;break}a=s}return a},Rr=e=>e==null?void 0:e.replace(/_/g,"-"),zh={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var n,r;(r=(n=console==null?void 0:console[e])==null?void 0:n.apply)==null||r.call(n,console,t)}};class Ca{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||zh,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,a){return a&&!this.debug?null:(t=t.map(o=>re(o)?o.replace(/[\r\n\x00-\x1F\x7F]/g," "):o),re(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Ca(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Ca(this.logger,t)}}var Et=new Ca;class Za{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const a=this.observers[r].get(n)||0;this.observers[r].set(n,a+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}once(t,n){const r=(...a)=>{n(...a),this.off(t,r)};return this.on(t,r),this}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([a,o])=>{for(let s=0;s<o;s++)a(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,o])=>{for(let s=0;s<o;s++)a(t,...n)})}}class Cl extends Za{constructor(t,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r,a={}){var d,f;const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,s=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.includes(".")?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):re(r)&&o?l.push(...r.split(o)):l.push(r)));const c=wa(this.data,l);return!c&&!n&&!r&&t.includes(".")&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!s||!re(r)?c:is((f=(d=this.data)==null?void 0:d[t])==null?void 0:f[n],r,o)}addResource(t,n,r,a,o={silent:!1}){const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let l=[t,n];r&&(l=l.concat(s?r.split(s):r)),t.includes(".")&&(l=t.split("."),a=n,n=l[1]),this.addNamespaces(n),wl(this.data,l,a),o.silent||this.emit("added",t,n,r,a)}addResources(t,n,r,a={silent:!1}){for(const o in r)(re(r[o])||Array.isArray(r[o]))&&this.addResource(t,n,o,r[o],{silent:!0});a.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,a,o,s={silent:!1,skipCopy:!1}){let l=[t,n];t.includes(".")&&(l=t.split("."),a=r,r=n,n=l[1]),this.addNamespaces(n);let c=wa(this.data,l)||{};s.skipCopy||(r=JSON.parse(JSON.stringify(r))),a?Pd(c,r,o):c={...c,...r},wl(this.data,l,c),s.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(a=>n[a]&&Object.keys(n[a]).length>0)}toJSON(){return this.data}}var Dd={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,a){return e.forEach(o=>{var s;t=((s=this.processors[o])==null?void 0:s.process(t,n,r,a))??t}),t}};const Id=Symbol("i18next/PATH_KEY");function jh(){const e=[],t=Object.create(null);let n;return t.get=(r,a)=>{var o;return(o=n==null?void 0:n.revoke)==null||o.call(n),a===Id?e:(e.push(a),n=Proxy.revocable(r,t),n.proxy)},Proxy.revocable(Object.create(null),t).proxy}function On(e,t){const{[Id]:n}=e(jh()),r=(t==null?void 0:t.keySeparator)??".",a=(t==null?void 0:t.nsSeparator)??":",o=(t==null?void 0:t.enableSelector)==="strict";if(n.length>1&&a){const s=t==null?void 0:t.ns,l=o?Array.isArray(s)?s:s?[s]:null:Array.isArray(s)?s:null;if(l&&(o?l:l.length>1?l.slice(1):[]).includes(n[0]))return`${n[0]}${a}${n.slice(1).join(r)}`}return n.join(r)}const So=e=>!re(e)&&typeof e!="boolean"&&typeof e!="number";class Na extends Za{constructor(t,n={}){super(),Ih(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Et.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const r={...n};if(t==null)return!1;const a=this.resolve(t,r);if((a==null?void 0:a.res)===void 0)return!1;const o=So(a.res);return!(r.returnObjects===!1&&o)}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const s=r&&t.includes(r),l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Uh(t,r,a);if(s&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:re(o)?[o]:o};const d=t.split(r);(r!==a||r===a&&this.options.ns.includes(d[0]))&&(o=d.shift()),t=d.join(a)}return{key:t,namespaces:re(o)?[o]:o}}translate(t,n,r){let a=typeof n=="object"?{...n}:n;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),t==null)return"";typeof t=="function"&&(t=On(t,{...this.options,...a})),Array.isArray(t)||(t=[String(t)]),t=t.map(A=>typeof A=="function"?On(A,{...this.options,...a}):String(A));const o=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:l,namespaces:c}=this.extractFromKey(t[t.length-1],a),d=c[c.length-1];let f=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;f===void 0&&(f=":");const u=a.lng||this.language,p=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((u==null?void 0:u.toLowerCase())==="cimode")return p?o?{res:`${d}${f}${l}`,usedKey:l,exactUsedKey:l,usedLng:u,usedNS:d,usedParams:this.getUsedParamsDetails(a)}:`${d}${f}${l}`:o?{res:l,usedKey:l,exactUsedKey:l,usedLng:u,usedNS:d,usedParams:this.getUsedParamsDetails(a)}:l;const m=this.resolve(t,a);let h=m==null?void 0:m.res;const g=(m==null?void 0:m.usedKey)||l,y=(m==null?void 0:m.exactUsedKey)||l,w=["[object Number]","[object Function]","[object RegExp]"],b=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,C=a.count!==void 0&&!re(a.count),N=Na.hasDefaultValue(a),T=C?this.pluralResolver.getSuffix(u,a.count,a):"",k=a.ordinal&&C?this.pluralResolver.getSuffix(u,a.count,{ordinal:!1}):"",L=C&&!a.ordinal&&a.count===0,R=L&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${T}`]||a[`defaultValue${k}`]||a.defaultValue;let P=h;v&&!h&&N&&(P=R);const I=So(P),S=Object.prototype.toString.apply(P);if(v&&P&&I&&!w.includes(S)&&!(re(b)&&Array.isArray(P))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const A=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,P,{...a,ns:c}):`key '${l} (${this.language})' returned an object instead of string.`;return o?(m.res=A,m.usedParams=this.getUsedParamsDetails(a),m):A}if(s){const A=Array.isArray(P),D=A?[]:{},U=A?y:g;for(const z in P)if(Object.prototype.hasOwnProperty.call(P,z)){const B=`${U}${s}${z}`;N&&!h?D[z]=this.translate(B,{...a,defaultValue:So(R)?R[z]:void 0,joinArrays:!1,ns:c}):D[z]=this.translate(B,{...a,joinArrays:!1,ns:c}),D[z]===B&&(D[z]=P[z])}h=D}}else if(v&&re(b)&&Array.isArray(h))h=h.join(b),h&&(h=this.extendTranslation(h,t,a,r));else{let A=!1,D=!1;!this.isValidLookup(h)&&N&&(A=!0,h=R),this.isValidLookup(h)||(D=!0,h=l);const z=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&D?void 0:h,B=N&&R!==h&&this.options.updateMissing;if(D||A||B){if(this.logger.log(B?"updateKey":"missingKey",u,d,C&&!B?`${l}${this.pluralResolver.getSuffix(u,a.count,a)}`:l,B?R:h),s){const ee=this.resolve(l,{...a,keySeparator:!1});ee&&ee.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let _=[];const G=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&G&&G[0])for(let ee=0;ee<G.length;ee++)_.push(G[ee]);else this.options.saveMissingTo==="all"?_=this.languageUtils.toResolveHierarchy(a.lng||this.language):_.push(a.lng||this.language);const V=(ee,Z,j)=>{var Ee;const le=N&&j!==h?j:z;this.options.missingKeyHandler?this.options.missingKeyHandler(ee,d,Z,le,B,a):(Ee=this.backendConnector)!=null&&Ee.saveMissing&&this.backendConnector.saveMissing(ee,d,Z,le,B,a),this.emit("missingKey",ee,d,Z,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?_.forEach(ee=>{const Z=this.pluralResolver.getSuffixes(ee,a);L&&a[`defaultValue${this.options.pluralSeparator}zero`]&&!Z.includes(`${this.options.pluralSeparator}zero`)&&Z.push(`${this.options.pluralSeparator}zero`),Z.forEach(j=>{V([ee],l+j,a[`defaultValue${j}`]||R)})}):V(_,l,R))}h=this.extendTranslation(h,t,a,m,r),D&&h===l&&this.options.appendNamespaceToMissingKey&&(h=`${d}${f}${l}`),(D||A)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${d}${f}${l}`:l,A?h:void 0,a))}return o?(m.res=h,m.usedParams=this.getUsedParamsDetails(a),m):h}extendTranslation(t,n,r,a,o){var c,d;if((c=this.i18nFormat)!=null&&c.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const f=re(t)&&(((d=r==null?void 0:r.interpolation)==null?void 0:d.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(f){const m=t.match(this.interpolator.nestingRegexp);u=m&&m.length}let p=r.replace&&!re(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),t=this.interpolator.interpolate(t,p,r.lng||this.language||a.usedLng,r),f){const m=t.match(this.interpolator.nestingRegexp),h=m&&m.length;u<h&&(r.nest=!1)}!r.lng&&a&&a.res&&(r.lng=this.language||a.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...m)=>(o==null?void 0:o[0])===m[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${m[0]} in key: ${n[0]}`),null):this.translate(...m,n),r)),r.interpolation&&this.interpolator.reset()}const s=r.postProcess||this.options.postProcess,l=re(s)?[s]:s;return t!=null&&(l!=null&&l.length)&&r.applyPostProcessor!==!1&&(t=Dd.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,n={}){let r,a,o,s,l;return re(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(c=>typeof c=="function"?On(c,{...this.options,...n}):c)),t.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),f=d.key;a=f;let u=d.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const p=n.count!==void 0&&!re(n.count),m=p&&!n.ordinal&&n.count===0,h=n.context!==void 0&&(re(n.context)||typeof n.context=="number")&&n.context!=="",g=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);u.forEach(y=>{var w,b;this.isValidLookup(r)||(l=y,!this.checkedLoadedFor[`${g[0]}-${y}`]&&((w=this.utils)!=null&&w.hasLoadedNamespace)&&!((b=this.utils)!=null&&b.hasLoadedNamespace(l))&&(this.checkedLoadedFor[`${g[0]}-${y}`]=!0,this.logger.warn(`key "${a}" for languages "${g.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(v=>{var T;if(this.isValidLookup(r))return;s=v;const C=[f];if((T=this.i18nFormat)!=null&&T.addLookupKeys)this.i18nFormat.addLookupKeys(C,f,v,y,n);else{let k;p&&(k=this.pluralResolver.getSuffix(v,n.count,n));const L=`${this.options.pluralSeparator}zero`,R=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(n.ordinal&&k.startsWith(R)&&C.push(f+k.replace(R,this.options.pluralSeparator)),C.push(f+k),m&&C.push(f+L)),h){const P=`${f}${this.options.contextSeparator||"_"}${n.context}`;C.push(P),p&&(n.ordinal&&k.startsWith(R)&&C.push(P+k.replace(R,this.options.pluralSeparator)),C.push(P+k),m&&C.push(P+L))}}let N;for(;N=C.pop();)this.isValidLookup(r)||(o=N,r=this.getResource(v,y,N,n))}))})}),{res:r,usedKey:a,exactUsedKey:o,usedLng:s,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r,a={}){var o;return(o=this.i18nFormat)!=null&&o.getResource?this.i18nFormat.getResource(t,n,r,a):this.resourceStore.getResource(t,n,r,a)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!re(t.replace);let a=r?t.replace:t;if(r&&typeof t.count<"u"&&(a.count=t.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!r){a={...a};for(const o of n)delete a[o]}return a}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&r.startsWith(n)&&t[r]!==void 0)return!0;return!1}}class Nl{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Et.create("languageUtils")}getScriptPartFromCode(t){if(t=Rr(t),!t||!t.includes("-"))return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Rr(t),!t||!t.includes("-"))return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(re(t)&&t.includes("-")){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const a=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(a))&&(n=a)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const a=this.getScriptPartFromCode(r);if(this.isSupportedCode(a))return n=a;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(s=>s===o?!0:!s.includes("-")&&!o.includes("-")?!1:!!(s.includes("-")&&!o.includes("-")&&s.slice(0,s.indexOf("-"))===o||s.startsWith(o)&&o.length>1))}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),re(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),a=[],o=s=>{s&&(this.isSupportedCode(s)?a.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return re(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):re(t)&&o(this.formatLanguageCode(t)),r.forEach(s=>{a.includes(s)||o(this.formatLanguageCode(s))}),a}}const El={zero:0,one:1,two:2,few:3,many:4,other:5},Sl={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Vh{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=Et.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const r=Rr(t==="dev"?"en":t),a=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:a});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let s;try{s=new Intl.PluralRules(r,{type:a})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Sl;if(!t.match(/-|_/))return Sl;const c=this.languageUtils.getLanguagePartFromCode(t);s=this.getRule(c,n)}return this.pluralRulesCache[o]=s,s}needsPlural(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,n,r={}){return this.getSuffixes(t,r).map(a=>`${n}${a}`)}getSuffixes(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((a,o)=>El[a]-El[o]).map(a=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(t,n,r={}){const a=this.getRule(t,r);return a?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,r))}}const Tl=(e,t,n,r=".",a=!0)=>{let o=Mh(e,t,n);return!o&&a&&re(n)&&(o=is(e,n,r),o===void 0&&(o=is(t,n,r))),o},To=e=>e.replace(/\$/g,"$$$$");class kl{constructor(t={}){var n;this.logger=Et.create("interpolator"),this.options=t,this.format=((n=t==null?void 0:t.interpolation)==null?void 0:n.format)||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:a,prefix:o,prefixEscaped:s,suffix:l,suffixEscaped:c,formatSeparator:d,unescapeSuffix:f,unescapePrefix:u,nestingPrefix:p,nestingPrefixEscaped:m,nestingSuffix:h,nestingSuffixEscaped:g,nestingOptionsSeparator:y,maxReplaces:w,alwaysFormat:b}=t.interpolation;this.escape=n!==void 0?n:_h,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=o?Ot(o):s||"{{",this.suffix=l?Ot(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=f?"":u?Ot(u):"-",this.unescapeSuffix=this.unescapePrefix?"":f?Ot(f):"",this.nestingPrefix=p?Ot(p):m||Ot("$t("),this.nestingSuffix=h?Ot(h):g||Ot(")"),this.nestingOptionsSeparator=y||",",this.maxReplaces=w||1e3,this.alwaysFormat=b!==void 0?b:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>(n==null?void 0:n.source)===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,n,r,a){var m;let o,s,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=h=>{if(!h.includes(this.formatSeparator)){const b=Tl(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,r,{...a,...n,interpolationkey:h}):b}const g=h.split(this.formatSeparator),y=g.shift().trim(),w=g.join(this.formatSeparator).trim();return this.format(Tl(n,c,y,this.options.keySeparator,this.options.ignoreJSONStructure),w,r,{...a,...n,interpolationkey:y})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const f=(a==null?void 0:a.missingInterpolationHandler)||this.options.missingInterpolationHandler,u=((m=a==null?void 0:a.interpolation)==null?void 0:m.skipOnVariables)!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>To(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?To(this.escape(h)):To(h)}].forEach(h=>{for(l=0;o=h.regex.exec(t);){const g=o[1].trim();if(s=d(g),s===void 0)if(typeof f=="function"){const w=f(t,o,a);s=re(w)?w:""}else if(a&&Object.prototype.hasOwnProperty.call(a,g))s="";else if(u){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),s="";else!re(s)&&!this.useRawValueToEscape&&(s=vl(s));const y=h.safeValue(s);if(t=t.replace(o[0],y),u?(h.regex.lastIndex+=s.length,h.regex.lastIndex-=o[0].length):h.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n,r={}){let a,o,s;const l=(c,d)=>{const f=this.nestingOptionsSeparator;if(!c.includes(f))return c;const u=c.split(new RegExp(`${Ot(f)}[ ]*{`));let p=`{${u[1]}`;c=u[0],p=this.interpolate(p,s);const m=p.match(/'/g),h=p.match(/"/g);(((m==null?void 0:m.length)??0)%2===0&&!h||((h==null?void 0:h.length)??0)%2!==0)&&(p=p.replace(/'/g,'"'));try{s=JSON.parse(p),d&&(s={...d,...s})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,g),`${c}${f}${p}`}return s.defaultValue&&s.defaultValue.includes(this.prefix)&&delete s.defaultValue,c};for(;a=this.nestingRegexp.exec(t);){let c=[];s={...r},s=s.replace&&!re(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;const d=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(d!==-1&&(c=a[1].slice(d).split(this.formatSeparator).map(f=>f.trim()).filter(Boolean),a[1]=a[1].slice(0,d)),o=n(l.call(this,a[1].trim(),s),s),o&&a[0]===t&&!re(o))return o;re(o)||(o=vl(o)),o||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${t}`),o=""),c.length&&(o=c.reduce((f,u)=>this.format(f,u,r.lng,{...r,interpolationkey:a[1].trim()}),o.trim())),t=t.replace(a[0],o),this.regexp.lastIndex=0}return t}}const Hh=e=>{let t=e.toLowerCase().trim();const n={};if(e.includes("(")){const r=e.split("(");t=r[0].toLowerCase().trim();const a=r[1].slice(0,-1);t==="currency"&&!a.includes(":")?n.currency||(n.currency=a.trim()):t==="relativetime"&&!a.includes(":")?n.range||(n.range=a.trim()):a.split(";").forEach(s=>{if(s){const[l,...c]=s.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),f=l.trim();n[f]||(n[f]=d),d==="false"&&(n[f]=!1),d==="true"&&(n[f]=!0),isNaN(d)||(n[f]=parseInt(d,10))}})}return{formatName:t,formatOptions:n}},Rl=e=>{const t={};return(n,r,a)=>{let o=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(o={...o,[a.interpolationkey]:void 0});const s=r+JSON.stringify(o);let l=t[s];return l||(l=e(Rr(r),a),t[s]=l),l(n)}},Kh=e=>(t,n,r)=>e(Rr(n),r)(t);class Wh{constructor(t={}){this.logger=Et.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?Rl:Kh;this.formats={number:r((a,o)=>{const s=new Intl.NumberFormat(a,{...o});return l=>s.format(l)}),currency:r((a,o)=>{const s=new Intl.NumberFormat(a,{...o,style:"currency"});return l=>s.format(l)}),datetime:r((a,o)=>{const s=new Intl.DateTimeFormat(a,{...o});return l=>s.format(l)}),relativetime:r((a,o)=>{const s=new Intl.RelativeTimeFormat(a,{...o});return l=>s.format(l,o.range||"day")}),list:r((a,o)=>{const s=new Intl.ListFormat(a,{...o});return l=>s.format(l)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Rl(n)}format(t,n,r,a={}){if(!n||t==null)return t;const o=n.split(this.formatSeparator),s=[];for(let c=0;c<o.length;c++){let d=o[c];for(;d.indexOf("(")>-1&&!d.includes(")")&&c+1<o.length;)d=`${d}${this.formatSeparator}${o[++c]}`;s.push(d)}return s.reduce((c,d)=>{var p;const{formatName:f,formatOptions:u}=Hh(d);if(this.formats[f]){let m=c;try{const h=((p=a==null?void 0:a.formatParams)==null?void 0:p[a.interpolationkey])||{},g=h.locale||h.lng||a.locale||a.lng||r;m=this.formats[f](c,g,{...u,...a,...h})}catch(h){this.logger.warn(h)}return m}else this.logger.warn(`there was no format function for ${f}`);return c},t)}}const qh=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class Gh extends Za{constructor(t,n,r,a={}){var o,s;super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=a,this.logger=Et.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],(s=(o=this.backend)==null?void 0:o.init)==null||s.call(o,r,a.backend,a)}queueLoad(t,n,r,a){const o={},s={},l={},c={};return t.forEach(d=>{let f=!0;n.forEach(u=>{const p=`${d}|${u}`;!r.reload&&this.store.hasResourceBundle(d,u)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?s[p]===void 0&&(s[p]=!0):(this.state[p]=1,f=!1,s[p]===void 0&&(s[p]=!0),o[p]===void 0&&(o[p]=!0),c[u]===void 0&&(c[u]=!0)))}),f||(l[d]=!0)}),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const a=t.split("|"),o=a[0],s=a[1];n&&this.emit("failedLoading",o,s,n),!n&&r&&this.store.addResourceBundle(o,s,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const l={};this.queue.forEach(c=>{Ah(c.loaded,[o],s),qh(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const f=c.loaded[d];f.length&&f.forEach(u=>{l[d][u]===void 0&&(l[d][u]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r,a=0,o=this.retryTimeout,s){if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:a,wait:o,callback:s});return}this.readingCalls++;const l=(d,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const u=this.waitingReads.shift();this.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}if(d&&f&&a<this.maxRetries){setTimeout(()=>{this.read(t,n,r,a+1,o*2,s)},o);return}s(d,f)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(t,n);d&&typeof d.then=="function"?d.then(f=>l(null,f)).catch(l):l(null,d)}catch(d){l(d)}return}return c(t,n,l)}prepareLoading(t,n,r={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();re(t)&&(t=this.languageUtils.toResolveHierarchy(t)),re(n)&&(n=[n]);const o=this.queueLoad(t,n,r,a);if(!o.toLoad.length)return o.pending.length||a(),null;o.toLoad.forEach(s=>{this.loadOne(s)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t,n=""){const r=t.split("|"),a=r[0],o=r[1];this.read(a,o,"read",void 0,void 0,(s,l)=>{s&&this.logger.warn(`${n}loading namespace ${o} for language ${a} failed`,s),!s&&l&&this.logger.log(`${n}loaded namespace ${o} for language ${a}`,l),this.loaded(t,s,l)})}saveMissing(t,n,r,a,o,s={},l=()=>{}){var c,d,f,u,p;if((d=(c=this.services)==null?void 0:c.utils)!=null&&d.hasLoadedNamespace&&!((u=(f=this.services)==null?void 0:f.utils)!=null&&u.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((p=this.backend)!=null&&p.create){const m={...s,isUpdate:o},h=this.backend.create.bind(this.backend);if(h.length<6)try{let g;h.length===5?g=h(t,n,r,a,m):g=h(t,n,r,a),g&&typeof g.then=="function"?g.then(y=>l(null,y)).catch(l):l(null,g)}catch(g){l(g)}else h(t,n,r,a,l,m)}!t||!t[0]||this.store.addResource(t[0],n,r,a)}}}const ko=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),re(e[1])&&(t.defaultValue=e[1]),re(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Pl=e=>(re(e.ns)&&(e.ns=[e.ns]),re(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),re(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Qr=()=>{},Yh=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class xr extends Za{constructor(t={},n){if(super(),this.options=Pl(t),this.services={},this.logger=Et,this.modules={external:[]},Yh(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(re(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));const r=ko();this.options={...r,...this.options,...Pl(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler);const a=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?Et.init(a(this.modules.logger),this.options):Et.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:d=Wh;const f=new Nl(this.options);this.store=new Cl(this.options.resources,this.options);const u=this.services;u.logger=Et,u.resourceStore=this.store,u.languageUtils=f,u.pluralResolver=new Vh(f,{prepend:this.options.pluralSeparator}),d&&(u.formatter=a(d),u.formatter.init&&u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new kl(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Gh(a(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",(p,...m)=>{this.emit(p,...m)}),this.modules.languageDetector&&(u.languageDetector=a(this.modules.languageDetector),u.languageDetector.init&&u.languageDetector.init(u,this.options.detection,this.options)),this.modules.i18nFormat&&(u.i18nFormat=a(this.modules.i18nFormat),u.i18nFormat.init&&u.i18nFormat.init(this)),this.translator=new Na(this.services,this.options),this.translator.on("*",(p,...m)=>{this.emit(p,...m)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Qr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=(...f)=>this.store[d](...f)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=(...f)=>(this.store[d](...f),this)});const l=mr(),c=()=>{const d=(f,u)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(u),n(f,u)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),l}loadResources(t,n=Qr){var o,s;let r=n;const a=re(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if((a==null?void 0:a.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const l=[],c=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(u=>{u!=="cimode"&&(l.includes(u)||l.push(u))})};a?c(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(f=>c(f)),(s=(o=this.options.preload)==null?void 0:o.forEach)==null||s.call(o,d=>c(d)),this.services.backendConnector.load(l,this.options.ns,d=>{!d&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(d)})}else r(null)}reloadResources(t,n,r){const a=mr();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=Qr),this.services.backendConnector.reload(t,n,o=>{a.resolve(),r(o)}),a}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Dd.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!["cimode","dev"].includes(r)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,n){this.isLanguageChangingTo=t;const r=mr();this.emit("languageChanging",t);const a=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,c)=>{c?this.isLanguageChangingTo===t&&(a(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve((...d)=>this.t(...d)),n&&n(l,(...d)=>this.t(...d))},s=l=>{var f,u;!t&&!l&&this.services.languageDetector&&(l=[]);const c=re(l)?l:l&&l[0],d=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(re(l)?[l]:l);d&&(this.language||a(d),this.translator.language||this.translator.changeLanguage(d),(u=(f=this.services.languageDetector)==null?void 0:f.cacheUserLanguage)==null||u.call(f,d)),this.loadResources(d,p=>{o(p,d)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),r}getFixedT(t,n,r,a){const o=a==null?void 0:a.scopeNs,s=(l,c,...d)=>{let f;typeof c!="object"?f=this.options.overloadTranslationOptionHandler([l,c].concat(d)):f={...c},f.lng=f.lng||s.lng,f.lngs=f.lngs||s.lngs;const u=f.ns!==void 0&&f.ns!==null;f.ns=f.ns||s.ns,f.keyPrefix!==""&&(f.keyPrefix=f.keyPrefix||r||s.keyPrefix);const p={...this.options,...f};Array.isArray(o)&&!u&&(p.ns=o),typeof f.keyPrefix=="function"&&(f.keyPrefix=On(f.keyPrefix,p));const m=this.options.keySeparator||".";let h;return f.keyPrefix&&Array.isArray(l)?h=l.map(g=>(typeof g=="function"&&(g=On(g,p)),`${f.keyPrefix}${m}${g}`)):(typeof l=="function"&&(l=On(l,p)),h=f.keyPrefix?`${f.keyPrefix}${m}${l}`:l),this.t(h,f)};return re(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}t(...t){var n;return(n=this.translator)==null?void 0:n.translate(...t)}exists(...t){var n;return(n=this.translator)==null?void 0:n.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(l,c)=>{const d=this.services.backendConnector.state[`${l}|${c}`];return d===-1||d===0||d===2};if(n.precheck){const l=n.precheck(this,s);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(r,t)&&(!a||s(o,t)))}loadNamespaces(t,n){const r=mr();return this.options.ns?(re(t)&&(t=[t]),t.forEach(a=>{this.options.ns.includes(a)||this.options.ns.push(a)}),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=mr();re(t)&&(t=[t]);const a=this.options.preload||[],o=t.filter(s=>!a.includes(s)&&this.services.languageUtils.isSupportedCode(s));return o.length?(this.options.preload=a.concat(o),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}dir(t){var a,o;if(t||(t=this.resolvedLanguage||(((a=this.languages)==null?void 0:a.length)>0?this.languages[0]:this.language)),!t)return"rtl";try{const s=new Intl.Locale(t);if(s&&s.getTextInfo){const l=s.getTextInfo();if(l&&l.direction)return l.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((o=this.services)==null?void 0:o.languageUtils)||new Nl(ko());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.includes(r.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){const r=new xr(t,n);return r.createInstance=xr.createInstance,r}cloneInstance(t={},n=Qr){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const a={...this.options,...t,isClone:!0},o=new xr(a);if((t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(l=>{o[l]=this[l]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r){const l=Object.keys(this.store.data).reduce((c,d)=>(c[d]={...this.store.data[d]},c[d]=Object.keys(c[d]).reduce((f,u)=>(f[u]={...c[d][u]},f),c[d]),c),{});o.store=new Cl(l,a),o.services.resourceStore=o.store}if(t.interpolation){const c={...ko().interpolation,...this.options.interpolation,...t.interpolation},d={...a,interpolation:c};o.services.interpolator=new kl(d)}return o.translator=new Na(o.services,a),o.translator.on("*",(l,...c)=>{o.emit(l,...c)}),o.init(a,n),o.translator.options=a,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const $e=xr.createInstance();$e.createInstance;$e.dir;$e.init;$e.loadResources;$e.reloadResources;$e.use;$e.changeLanguage;$e.getFixedT;$e.t;$e.exists;$e.setDefaultNamespace;$e.hasLoadedNamespace;$e.loadNamespaces;$e.loadLanguages;const Xh=(e,t,n,r)=>{var o,s,l,c;const a=[n,{code:t,...r||{}}];if((s=(o=e==null?void 0:e.services)==null?void 0:o.logger)!=null&&s.forward)return e.services.logger.forward(a,"warn","react-i18next::",!0);yn(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),(c=(l=e==null?void 0:e.services)==null?void 0:l.logger)!=null&&c.warn?e.services.logger.warn(...a):console!=null&&console.warn&&console.warn(...a)},Dl={},ls=(e,t,n,r)=>{yn(n)&&Dl[n]||(yn(n)&&(Dl[n]=new Date),Xh(e,t,n,r))},Ld=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},cs=(e,t,n)=>{e.loadNamespaces(t,Ld(e,n))},Il=(e,t,n,r)=>{if(yn(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return cs(e,n,r);n.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,Ld(e,r))},Jh=(e,t,n={})=>!t.languages||!t.languages.length?(ls(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!a(r.isLanguageChangingTo,e))return!1}}),yn=e=>typeof e=="string",Zh=e=>typeof e=="object"&&e!==null,Qh=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,em={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},tm=e=>em[e],nm=e=>e.replace(Qh,tm);let ds={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:nm,transDefaultProps:void 0};const rm=(e={})=>{ds={...ds,...e}},am=()=>ds;let Ad;const om=e=>{Ad=e},sm=()=>Ad,im={type:"3rdParty",init(e){rm(e.options.react),om(e)}},lm=Te();class cm{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const dm=(e,t)=>{if(yn(t))return t;if(Zh(t)&&yn(t.defaultValue))return t.defaultValue;if(typeof e=="function")return"";if(Array.isArray(e)){const n=e[e.length-1];return typeof n=="function"?"":n}return e},um={t:dm,ready:!1},fm=()=>()=>{},ae=(e,t={})=>{var R,P,I;const{i18n:n}=t,{i18n:r,defaultNS:a}=ne(lm)||{},o=n||r||sm();o&&!o.reportNamespaces&&(o.reportNamespaces=new cm),o||ls(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const s=Q(()=>{var S;return{...am(),...(S=o==null?void 0:o.options)==null?void 0:S.react,...t}},[o,t]),{useSuspense:l,keyPrefix:c}=s,d=a||((R=o==null?void 0:o.options)==null?void 0:R.defaultNS),f=yn(d)?[d]:d||["translation"],u=Q(()=>f,f);(I=(P=o==null?void 0:o.reportNamespaces)==null?void 0:P.addUsedNamespaces)==null||I.call(P,u);const p=M(0),m=H(S=>{if(!o)return fm;const{bindI18n:A,bindI18nStore:D}=s,U=()=>{p.current+=1,S()};return A&&o.on(A,U),D&&o.store.on(D,U),()=>{A&&A.split(" ").forEach(z=>o.off(z,U)),D&&D.split(" ").forEach(z=>o.store.off(z,U))}},[o,s]),h=M(),g=H(()=>{if(!o)return um;const S=!!(o.isInitialized||o.initializedStoreOnce)&&u.every(_=>Jh(_,o,s)),A=t.lng||o.language,D=p.current,U=h.current;if(U&&U.ready===S&&U.lng===A&&U.keyPrefix===c&&U.revision===D)return U;const B={t:o.getFixedT(A,s.nsMode==="fallback"?u:u[0],c,{scopeNs:u}),ready:S,lng:A,keyPrefix:c,revision:D};return h.current=B,B},[o,u,c,s,t.lng]),[y,w]=E(0),{t:b,ready:v}=Eh.useSyncExternalStore(m,g,g);O(()=>{if(o&&!v&&!l){const S=()=>w(A=>A+1);t.lng?Il(o,t.lng,u,S):cs(o,u,S)}},[o,t.lng,u,v,l,y]);const C=o||{},N=M(null),T=M(),k=S=>{const A=Object.getOwnPropertyDescriptors(S);A.__original&&delete A.__original;const D=Object.create(Object.getPrototypeOf(S),A);if(!Object.prototype.hasOwnProperty.call(D,"__original"))try{Object.defineProperty(D,"__original",{value:S,writable:!1,enumerable:!1,configurable:!1})}catch{}return D},L=Q(()=>{const S=C,A=S==null?void 0:S.language;let D=S;S&&(N.current&&N.current.__original===S?T.current!==A?(D=k(S),N.current=D,T.current=A):D=N.current:(D=k(S),N.current=D,T.current=A));const U=!v&&!l?(...B)=>(ls(o,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),b(...B)):b,z=[U,D,v];return z.t=U,z.i18n=D,z.ready=v,z},[b,C,v,C.resolvedLanguage,C.language,C.languages]);if(o&&l&&!v)throw new Promise(S=>{const A=()=>S();t.lng?Il(o,t.lng,u,A):cs(o,u,A)});return L},pm={required:"Required"},hm={skipToContent:"Skip to content"},mm={title:"API Keys",newButton:"New API key",createTitle:"Create API key",nameLabel:"Name",scopeLabel:"Access",scopeRead:"Read only",scopeReadHelp:"Can read published content, media and document types through the headless API.",scopeWrite:"Read and write",scopeWriteHelp:"Can also create, save and publish content. Treat it like a password.",createButton:"Create key",creating:"Creating…",cancel:"Cancel",genericError:"Something went wrong. Try again.",createdToast:'API key "{{name}}" created',secretTitle:"Copy your key now",secretWarning:"This key is shown only once. It cannot be retrieved after you dismiss this panel.",copyButton:"Copy key",copiedToast:"Key copied to clipboard",copyFailedToast:"Could not copy — select and copy it manually",dismissButton:"I saved my key",statusActive:"Active",statusRevoked:"Revoked",createdAt:"Created {{date}}",lastUsedAt:"Last used {{date}}",neverUsed:"Never used",revokeButton:"Revoke",revokeConfirmBody:"Requests using this key will fail immediately. This cannot be undone.",revokeConfirmButton:"Revoke key",revokeCancelButton:"Keep",revokedToast:'API key "{{name}}" revoked',empty:"No API keys yet. Create one to let an external app read the public API.",loading:"Loading API keys"},gm={title:"API Playground",description:"Pick a public API endpoint, paste an API key, and send a request to see the live status and body.",keyLabel:"API key",keyPlaceholder:"vk_…",keyNamesHint:"Existing keys: {{names}}",endpointLabel:"Endpoint",sendButton:"Send",sending:"Sending…",statusLabel:"Status",responseLabel:"Response",noEndpoints:"No parameter-free GET endpoints are available to try.",genericError:"Something went wrong. Try again.",emptyState:"Pick an endpoint and send a request to see the response here."},ym={title:"Velora Admin",logout:"Sign out",sessionExpiresIn:"Session: {{time}}",sessionExpiringSoon:"Your session expires in less than a minute.",idleLoggedOut:"You've been logged out due to inactivity",sessionExpired:"Your session has expired. Please log in again."},vm={light:"Light",dark:"Dark",system:"System"},bm={open:"Account menu for {{name}}",theme:"Theme",themeInert:"Mode is set by the active theme.",language:"Language",languageName:{en:"English",ar:"العربية"}},xm={navLabel:"Appearance",intro:"Themes re-skin the entire admin — including screens contributed by installed plugins — because every surface consumes the same design tokens rather than hardcoded colors.",themeSectionTitle:"Theme",defaultName:"Velora",defaultBadge:"(Default)",defaultDescription:"Light & dark variants.",activeBadge:"Active",byAuthor:"by {{author}}",browseMarketplace:"Browse themes on the Marketplace",noInstalledThemes:"No installed themes yet.",loadErrorNote:"Couldn't refresh the installed themes list. Showing what's cached.",loadingLabel:"Loading themes…",modeSectionTitle:"Mode",modeGroupLabel:"Mode",modeCaptionDefault:`Applies to the "Velora" theme's light/dark variants.`,modeCaptionCustom:"{{themeName}} provides a single palette. Mode switching applies to the default theme."},wm={content:"Content",media:"Media",settings:"Settings",users:"Users",plugins:"Plugins",snapshots:"Content snapshots",docs:"Docs",sectionsLabel:"Sections"},Cm={dismiss:"Dismiss",notification:"Notification"},Nm={viewCrashed:"The {{name}} plugin view crashed — the rest of this page still works."},Em={loading:"Loading plugin section…",notFoundTitle:"Plugin section not found",notFoundDescription:"This plugin section is no longer available."},Sm={treeTitle:"Plugins",installed:"Installed",marketplace:"Marketplace",marketplaceTitle:"Marketplace",marketplaceSearchLabel:"Search marketplace",marketplaceSearchPlaceholder:"Search plugins by name…",filterType:"Type",filterDatabase:"Database",filterAll:"All",free:"Free",marketplaceIncompatible:"Not compatible with this site's database ({{dialect}})",marketplaceEmpty:"No plugins found.",marketplaceErrorTitle:"Couldn't load the marketplace.",marketplaceOffTitle:"No marketplace connected",marketplaceOffDescription:"This instance runs without a plugin marketplace. Set VELORA_MARKETPLACE_URL in the server's environment and restart to connect one.",detailBack:"Back to marketplace",detailTabsLabel:"Plugin details",detailOverview:"Overview",detailVersions:"Versions",detailVersionReleased:"Released {{date}}",detailLatestVersion:"Latest",detailPermissionsTab:"Permissions & compatibility",detailPermissions:"Permissions",detailPermissionsEmpty:"No permissions declared.",permissionRow:"{{label}}: {{value}}",detailCompatibility:"Database compatibility",permissionYes:"yes",permissionNo:"no",documentTypesTitle:"Provisioned document types",starterTitle:"Starter frontend",bundleMembersTitle:"Included plugins",bundleMembersHelp:"One purchase, one license key — installs all {{count}}.",bundleMemberFree:"Free",bundleStarterNone:"None — this bundle does not include a starter frontend.",bundleInstalledMembers_one:"{{count}} included plugin installed, {{skipped}} already installed.",bundleInstalledMembers_other:"{{count}} included plugins installed, {{skipped}} already installed.",starterDeliveryPrefix:"Delivered as a downloadable archive — unpack, ",starterDeliverySuffix:", point it at this site.",getStarter:"Get the starter",viewSource:"View source",buyOnMarketplace:"Buy on marketplace",detailNotFound:"This plugin isn't in the marketplace.",install:"Install",installUnavailable:"Not yet available for download",installing:"Installing…",installDone:"Installed",installFailed:"Couldn't install the plugin. Please try again.",installKeyTitle:"Install {{name}} — license required",installKeyDescription:"This plugin requires a valid license key to install.",installKeyLabel:"License key",installKeyHelp:"Paste the key from your marketplace purchase. The key binds to this site's domain on first use.",installKeyPlaceholder:"vlic_…",installKeySubmit:"Validate & install",cancel:"Cancel",title:"Installed plugins",columns:{name:"Name",version:"Version",trust:"Trust",storage:"Storage",license:"License",actions:"Actions"},loadMore:"Load more",empty:"No plugins installed yet.",errorTitle:"Couldn't load installed plugins.",retry:"Retry",toggleAria:"Toggle {{name}}",rowActionsAria:"More actions for {{name}}",uninstall:"Uninstall",verified:"Verified",unverified:"Unverified",toggleFailed:"Couldn't update the plugin's status. Please try again.",uninstallTitle:"Uninstall {{name}}?",uninstallDoneTitle:"{{name}} uninstalled",uninstallBody:"This removes the plugin from your site. You can reinstall it later, but any settings it stored may not carry over.",uninstallConfirm:"Uninstall plugin",uninstallCancel:"Cancel",uninstallClose:"Close",uninstalling:"Uninstalling…",uninstallStructuredBody:"This plugin stores structured data. A snapshot of its data was taken before deletion (snapshot {{snapshotGroupId}}). Its tables and their rows will be permanently deleted.",uninstallStructuredConfirm:"Delete data and uninstall",uninstallStructuredRestoreHint:"You can restore this data later from Data snapshots (group {{snapshotGroupId}}).",uninstallBundleStructuredBody:"This bundle stores structured data for the member plugins below. A snapshot of each was taken before deletion — their tables and rows will be permanently deleted.",uninstallBundleStructuredRestoreHint:"You can restore each member's data later from its own Data snapshots page:",uninstallBundleMemberSnapshot:"{{pluginId}} — snapshot {{snapshotGroupId}}",uninstallBlockedLeadIn:"These document types still have content:",uninstallBlockedItemWithCount_one:"{{documentType}} ({{count}} item)",uninstallBlockedItemWithCount_other:"{{documentType}} ({{count}} items)",uninstallBlockedItemNoCount:"{{documentType}}",uninstalledToast:"{{name}} uninstalled.",snapshotsTitle:"{{name}} — data snapshots",snapshotsAction:"Data snapshots",snapshotsScope:"Snapshots are copies of {{name}}'s structured tables, taken automatically before an operation that could delete them — like uninstalling the plugin. They aren't a general backup: only tables this plugin owns are captured.",snapshotsUnionCallout:"No single snapshot below is both complete and freshest. Restoring uses the union: the newest available copy of each table, across groups.",snapshotsColGroup:"Group",snapshotsColTaken:"Taken",snapshotsColTrigger:"Trigger",snapshotsColTables:"Tables",snapshotsColStatus:"Status",snapshotsTablesOf:"{{count}} of {{total}}",snapshotsStatusComplete:"Complete",snapshotsStatusPartial:"Partial",snapshotsTriggerUninstall:"Uninstall",snapshotsTriggerRestore:"Restore",snapshotsRestoreAction:"Restore data…",snapshotsRestoreTitle:"Restore {{name}} data?",snapshotsRestoreIntro:"This writes {{count}} tables, using the newest available copy of each:",snapshotsRestoreProvenance:"{{tables}} — from group {{group}} ({{when}})",snapshotsRestoreSafety:"Current {{name}} tables are snapshotted first, before being replaced — nothing is deleted without a copy.",snapshotsRestoreTypeLabel:'Type "restore" to confirm',snapshotsRestoreConfirm:"Restore {{count}} tables",snapshotsRestoring:"Restoring…",snapshotsRestoredToast:"Restored {{count}} tables.",snapshotsEmpty:"No data snapshots exist for this plugin yet.",snapshotsError:"Couldn't load data snapshots.",snapshotsLoading:"Loading data snapshots…",licenseNone:"No license required",licenseValid:"Valid",licenseCheckedAgo:"Checked {{time}}",licenseUnreachable:"License server unreachable — last valid {{time}}",licenseDomainMismatch:"Domain mismatch: bound to {{domain}} — reset the domain binding from the marketplace",licenseDomainMismatchBare:"Domain mismatch — reset the domain binding from the marketplace",licenseRevoked:"Revoked: {{reason}}",licenseRevokedBare:"Revoked",licenseRecheck:"Re-check",licenseRecheckFailed:"Couldn't re-check the license. Please try again.",licenseValidButDisabled:"License is valid. The plugin stays off until you turn it back on with the switch."},Tm={loading:"Loading…",loadMore:"Load more",empty:"No content yet.",emptyDescription:"Content you create will appear here.",newContent:"New content",toggle:"Toggle children of {{name}}",createChild:"Create under {{name}}",dragHandle:"Reorder {{name}}",reorderError:"Couldn't save the new order — reverted.",rowActionsAria:"More actions for {{name}}",deleteAction:"Delete",deleteTitle:'Delete "{{name}}"?',deleteBody:'This moves "{{name}}" and its {{count}} descendants to the trash. Content in the trash is restorable.',deleteConfirm:"Delete {{total}} items",deleteCancel:"Cancel",deletedToast:"Moved {{total}} items to the trash.",deleteError:`Couldn't delete "{{name}}" — nothing changed.`},km={title:"New content",typeLabel:"Document type",typeHelp:"Only page types allowed at the root are listed.",typePlaceholder:"Choose a document type…",nameLabel:"Name",nameHelp:"Will live at {{path}}",submit:"Create",creating:"Creating…",cancel:"Cancel",noTypes:"No page document types are allowed at the root yet — allow one in Document Types first.",createdToast:'"{{name}}" created.',genericError:"Something went wrong. Please try again.",underCrumb:"Create under {{name}}",atRootCrumb:"Create at the root",typeHelpChild:"Only types allowed under this parent are listed.",noTypesUnder:'No document types are allowed under "{{name}}".'},Rm={labelLabel:"Snapshot label",labelHelp:`e.g. "before bulk edit" — captures every content item's published state right now.`,createButton:"Create snapshot",creating:"Creating…",createdToast:'Snapshot "{{label}}" created.',empty:"No snapshots yet.",emptyDescription:"Create a snapshot before risky changes — you can restore the whole site's published state from it later.",restore:"Restore",restoring:"Restoring…",confirmTitle:'Restore "{{label}}"?',confirmBody:"This points every content item's published version back to how it was when this snapshot was taken. Nothing is deleted — drafts and versions created since stay in each item's history, and items created after this snapshot are left untouched.",confirmRestore:"Restore snapshot",cancel:"Cancel",restoredToast_one:'Restored "{{label}}" — {{count}} item repointed.',restoredToast_other:'Restored "{{label}}" — {{count}} items repointed.',loadMore:"Load more",genericError:"Something went wrong. Please try again."},Pm={newButton:"New user",createTitle:"Create a user",emailLabel:"Email",nameLabel:"Name",passwordLabel:"Password",passwordHelp:"At least 8 characters.",roleLabel:"Role",role:{admin:"Admin",editor:"Editor"},roleSelectLabel:"Change role for {{email}}",youHint:"That's you — ask another admin to change your role.",createButton:"Create user",creating:"Creating…",cancel:"Cancel",createdToast:"User {{email}} created.",roleChangedToast:"{{email}} is now {{role}}.",loadMore:"Load more",genericError:"Something went wrong. Please try again."},Dm={upload:"Upload files",uploading:"Uploading…",dropHint:"Drag and drop files here, or choose from your computer.",searchLabel:"Search",searchPlaceholder:"Search by filename…",empty:"No media yet.",emptyDescription:"Upload images and files to use them in your content.",noResults:'No files match "{{search}}".',uploadedToast:'"{{name}}" uploaded.',uploadFailedToast:'Upload failed for "{{name}}".',deletedToast:'"{{name}}" deleted.',delete:"Delete",deleteLabel:"Delete {{name}}",confirmBody:"This permanently deletes the file. It cannot be undone.",confirmDelete:"Delete permanently",cancel:"Cancel",loadMore:"Load more",genericError:"Something went wrong. Please try again."},Im={save:"Save draft",saving:"Saving…",publishing:"Publishing…",publishedToast:"Published version {{version}}.",historyTitle:"Version history",versionRow:"Version {{version}}",latestBadge:"Latest",view:"View",publishThis:"Publish this version",viewingVersion:"Viewing version {{version}} (read-only)",closeView:"Close",loadMore:"Load more",statusPublished:"Published",statusDraft:"Draft",statusUnpublishedChanges:"Unpublished changes",unsavedChanges:"Unsaved changes",savedToast:"Saved as version {{version}}.",savedToastDescription:"Every version is kept.",unpublishedSince:"Unpublished changes since v{{version}}",metaPublished:"Published {{when}}",railLabel:"Version history",railTickPublished:"Version {{version}}, published",railTickDraft:"Version {{version}}, draft",railHidden:"+{{count}}",railSaved:"saved {{when}}",railCount_one:"{{count}} version · Every version is kept.",railCount_other:"{{count}} versions · Every version is kept.",railCountSince_one:"{{count}} version since {{since}} · Every version is kept.",railCountSince_other:"{{count}} versions since {{since}} · Every version is kept.",railOpenHistory:"Open history",validationToast:"Fix the highlighted fields before saving.",loadError:"Couldn't load this content item.",loadErrorTitle:"Couldn't load this content",loadingTitle:"Loading content…",unknownDocumentType:"This item's document type isn't available.",genericError:"Something went wrong. Please try again.",saveAndPublish:"Publish",allSaved:"All changes saved",contentTab:"Content",infoTab:"Info & History",appsLabel:"Content apps",tabHasError:"Has an invalid field",infoDocumentType:"Document type",infoUrl:"URL",infoLocale:"Locale",infoLocaleDefault:"{{locale}} (default)",infoLastSaved:"Last saved",infoPublished:"Published",infoNotPublished:"Not published yet",previewButton:"Preview",previewNotConfigured:"Preview isn't configured for this site yet.",previewError:"Couldn't create a preview link. Please try again."},Lm={nameLabel:"Name",iconLabel:"Icon",iconHelp:"Shown next to content of this type. Leave the default for a plain document icon.",iconDefault:"Default (document icon)",kindLabel:"Kind",kind:{page:"Page",element:"Element"},tabsLabel:"Tabs",addTab:"Add tab",removeTab:"Remove tab",noTabs:"No tabs yet — fields render in a single default group.",tabNameLabel:"Tab name",addField:"Add field",removeField:"Remove",fieldKeyLabel:"Key",fieldNameLabel:"Label",fieldDatatypeLabel:"Datatype",fieldTabLabel:"Tab",fieldTabNone:"No tab",previewLabel:"Preview",dragHandle:"Drag to reorder",validationLabel:"Validation rules",validation:{required:"Required",minLength:"Min length",maxLength:"Max length",min:"Min",max:"Max",pattern:"Pattern",patternPlaceholder:"^[a-z0-9-]+$"},allowedAtRoot:"Allowed at root",allowedParentTypes:"Allowed parent types",allowedChildTypes:"Allowed child types",unnamedField:"Unnamed field",unnamedTab:"Unnamed tab",editField:"Edit",doneField:"Done",chip:{minLength:"min {{value}}",maxLength:"max {{value}}",min:"min {{value}}",max:"max {{value}}",pattern:"pattern"}},Am={noTemplates:"No templates yet for this document type.",nameLabel:"New template name",addButton:"Add template",adding:"Adding…",defaultBadge:"Default",setDefault:"Set as default",clearDefault:"Clear default",loadMore:"Load more",addedToast:'Template "{{name}}" added.',defaultSetToast:'"{{name}}" is now the default template.',defaultClearedToast:"Default template cleared.",genericError:"Something went wrong. Please try again."},Mm={generalTab:"General",tabListLabel:"Content tabs",unknownDatatype:`Unknown datatype "{{datatypeId}}" — the plugin that registers it isn't available.`,errors:{required:"This field is required.",minLength:"Must be at least {{minLength}} characters.",maxLength:"Must be no more than {{maxLength}} characters.",min:"Must be at least {{min}}.",max:"Must be no more than {{max}}.",pattern:"Doesn't match the required format."},help:{lengthRange:"Between {{min}} and {{max}} characters.",minLength:"At least {{min}} characters.",maxLength:"At most {{max}} characters.",range:"Between {{min}} and {{max}}.",min:"At least {{min}}.",max:"At most {{max}}."}},Om={title:"Sign in",subtitle:"Continue to the Velora admin.",tagline:"Every version of everything you write is kept.",emailLabel:"Email",passwordLabel:"Password",submit:"Sign in",submitting:"Signing in…",genericError:"Something went wrong. Please try again."},_m={title:"Set up Velora",subtitle:"Create the first admin account to get started.",emailLabel:"Email",nameLabel:"Name",passwordLabel:"Password",confirmPasswordLabel:"Confirm password",continue:"Continue",back:"Back",databaseStepTitle:"Choose your database",databaseStepSubtitle:"Pick where Velora stores its data.",dialectLabel:"Database type",filePathLabel:"File path",hostLabel:"Host",portLabel:"Port",databaseNameLabel:"Database name",usernameLabel:"Username",databasePasswordLabel:"Password",finish:"Finish setup",finishing:"Setting up…",starterSteps:"1 Admin account ✓ · 2 Database ✓ · 3 Starter",starterTitle:"Start from a template?",blankName:"Blank site",blankDescription:"Just the CMS — add document types yourself.",officialBadge:"Official",includeSampleContent:"Include sample content — a few posts you can explore and delete",installAndFinish:"Install {{name}} & finish",starterFailedWarning:"The {{name}} template could not be installed — your site is set up, and you can add it later from the marketplace.",completeTitle:"Setup complete",completeInstructions:"Restart the server, then reload this page to sign in.",submitError:"Something went wrong completing setup. Please check your database details and try again.",errors:{invalidEmail:"Enter a valid email address.",passwordTooShort:"Password must be at least 8 characters.",passwordMismatch:"Passwords do not match.",hostRequired:"Enter a host.",portInvalid:"Enter a valid port number.",databaseNameRequired:"Enter a database name.",usernameRequired:"Enter a username.",filePathRequired:"Enter a file path."}},Fm={welcomeTitle:"Select a content item",welcomeDescription:"Pick something from the tree, or create new content with the + button."},$m={recycleBin:"Recycle Bin",title:"Trash",empty:"Nothing in the trash.",loadFailed:"Couldn't load the trash.",retry:"Retry",nodeCount_one:"{{count}} item",nodeCount_other:"{{count}} items",deletedAt:"deleted {{when}}",unknownTime:"at an unknown time",orphanedBadge:"Orphaned",orphanedExplain:"Its original location no longer exists — restoring puts it at the top level.",restore:"Restore",restoreConfirm:"Confirm restore",restoreBlocked:'Restore "{{ancestor}}" first — it is still in the trash.',restoreFailed:"Could not restore. Try again."},Bm={documentTypes:"Document Types",dataTypes:"Data Types",templates:"Templates",apiKeys:"API Keys",apiPlayground:"API Playground",noTemplates:"No templates yet.",system:"System",noDocumentTypes:"No document types yet — create one with the + above.",welcomeTitle:"Settings",welcomeDescription:"Pick a document type, data type, or template from the tree — or create a new one.",itemLoading:"Loading…",itemNotFoundTitle:"Not found",itemNotFoundDescription:"This item is no longer available."},Um={all:"All media"},zm={all:"All users"},jm={designTab:"Design",templatesTab:"Templates",structureTab:"Structure",panesLabel:"Document type apps",createTitle:"New document type",newDocumentType:"New document type",allowedAtRootBadge:"Allowed at root",tabGroupTitle:"{{name}} tab",generalGroupTitle:"General (no tab)",fieldsTitle:"Fields",noFieldsInGroup:"No fields in this group yet.",emptyMeansAny:"Leave empty to allow any type.",templatesTitle:"Templates for {{name}}",templatesInertNote:"Templates are inert data in v1.0 — rendering arrives with the template engine after launch. The selected default travels with the headless API response.",save:"Save",saving:"Saving…",createdToast:'"{{name}}" created.',savedToast:'"{{name}}" saved.',genericError:"Something went wrong. Please try again.",delete:"Delete",deleting:"Deleting…",deletedToast:'"{{name}}" deleted.',deleteConfirmTitle:'Delete "{{name}}"?',deleteConfirmBody:"This can't be undone. Blocked if any content or templates still use this document type.",deleteCancel:"Cancel",deleteConfirm:"Delete"},Vm={createTitle:"New data type",newDataType:"New data type",nameLabel:"Name",nameHelp:"How this data type appears when building document types.",editorLabel:"Property editor",editorHelp:"The input control this data type configures. New editors come from plugins.",editorImmutableHelp:"The property editor is fixed after creation — create a new data type to use a different editor.",editorPlaceholder:"Choose a property editor…",settingsTitle:"Editor settings",settingsHelp:"Provided by the {{editor}} editor.",noSettings:"The {{editor}} editor has no configurable settings yet.",usedBy_one:"Used by {{count}} document type: {{list}}. Changing this data type applies everywhere it is used.",usedBy_other:"Used by {{count}} document types: {{list}}. Changing this data type applies everywhere it is used.",save:"Save",saving:"Saving…",createdToast:'"{{name}}" created.',savedToast:'"{{name}}" saved.',genericError:"Something went wrong. Please try again."},Hm={contentTitle:"This is a content URL",contentBody:"This Velora instance is headless — content URLs don't render pages. The content lives in the API and in the editor.",apiUrlLabel:"Headless API URL (requires an API key)",openInEditor:"Open in editor",notFoundTitle:"Nothing exists at this URL",notFoundBody:"No admin page or content matches this address.",backToContent:"Go to Content",resolving:"Checking this URL…"},Km={common:pm,a11y:hm,apiKeys:mm,apiPlayground:gm,app:ym,theme:vm,userMenu:bm,appearance:xm,nav:wm,toast:Cm,pluginBoundary:Nm,pluginSection:Em,pluginsManage:Sm,contentTree:Tm,contentCreate:km,snapshots:Rm,users:Pm,mediaLibrary:Dm,contentEditor:Im,documentTypeBuilder:Lm,templatePicker:Am,documentTypeForm:Mm,login:Om,setup:_m,contentSection:Fm,trash:$m,settingsTree:Bm,mediaTree:Um,usersTree:zm,documentTypeEditor:jm,dataTypeEditor:Vm,headlessBridge:Hm};$e.use(im).init({resources:{en:{translation:Km}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});function Md(e){typeof document>"u"||(document.documentElement.lang=e,document.documentElement.dir=$e.dir(e))}$e.on("languageChanged",Md);Md($e.language);const je={color:{primary:{50:"#EAF4FB",100:"#CFE6F6",200:"#A9D5F0",300:"#7CC0E8",400:"#4E9CCB",500:"#2A82BC",600:"#1F6FA8",700:"#1A5E8F",800:"#154D75",900:"#113D5C",950:"#0B2A40"},secondary:{50:"#F0F0FA",100:"#E9E9F8",200:"#D3D4F1",300:"#B4B6E6",400:"#8F92D8",500:"#5B5FC7",600:"#4B4FB0",700:"#3E4194",800:"#333676",900:"#282A5C",950:"#181A3A"},success:{50:"#EEF5EB",100:"#E4F0DF",200:"#C6E0BD",300:"#9CC78E",400:"#6CA85C",500:"#4E9340",600:"#3B7D2E",700:"#306626",800:"#27521F",900:"#1F4119",950:"#122A0E"},warning:{50:"#FBF5E8",100:"#F7EBD2",200:"#EFD8A6",300:"#E4BF72",400:"#D6A245",500:"#C98E2D",600:"#B7791F",700:"#96631A",800:"#764E15",900:"#5B3C11",950:"#3B260A"},danger:{50:"#FBEFEE",100:"#F6E0DE",200:"#EEC3BF",300:"#E39B95",400:"#D66E66",500:"#C94F46",600:"#B93A32",700:"#9A2F29",800:"#7B2621",900:"#611E1A",950:"#3F120F"},neutral:{50:"#FAF9F5",100:"#F3F1EB",200:"#ECEAE3",300:"#E1DED5",400:"#CFCBC0",500:"#8C9490",600:"#5C6663",700:"#3E4644",800:"#2A3230",900:"#1B2321",950:"#111614"},background:{base:"#F3F1EB",elevated:"#FFFFFF",subtle:"#FAF9F5",overlay:"rgba(27, 35, 33, 0.5)",hover:"#F0EEE7"},text:{primary:"#1B2321",secondary:"#5C6663",tertiary:"#616966",disabled:"#8C9490",inverse:"#FFFFFF"},border:{default:"#E1DED5",subtle:"#ECEAE3",strong:"#CFCBC0"}},typography:{fontSize:{xs:"0.75rem",sm:"0.8125rem",base:"0.875rem",lg:"1rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{0:"0",px:"1px",1:"0.25rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",72:"18rem"},radius:{none:"0",sm:"0.375rem",md:"0.5rem",lg:"0.75rem",xl:"1rem",full:"9999px"},shadow:{sm:"0 1px 2px 0 rgba(43, 38, 24, 0.06)",md:"0 1px 2px 0 rgba(43, 38, 24, 0.05), 0 6px 18px 0 rgba(43, 38, 24, 0.07)",lg:"0 2px 4px 0 rgba(43, 38, 24, 0.06), 0 16px 40px 0 rgba(43, 38, 24, 0.12)",xl:"0 4px 8px 0 rgba(43, 38, 24, 0.08), 0 24px 56px 0 rgba(43, 38, 24, 0.16)"},motion:{duration:{fast:"150ms",normal:"250ms",slow:"400ms"},easing:{standard:"cubic-bezier(0.4, 0, 0.2, 1)",enter:"cubic-bezier(0, 0, 0.2, 1)",exit:"cubic-bezier(0.4, 0, 1, 1)"}}};function Ve(e,t){const n={};for(const r of Object.keys(e))n[r]=`var(--${t}-${r})`;return n}Ve(je.color.primary,"color-primary"),Ve(je.color.secondary,"color-secondary"),Ve(je.color.success,"color-success"),Ve(je.color.warning,"color-warning"),Ve(je.color.danger,"color-danger"),Ve(je.color.neutral,"color-neutral"),Ve(je.color.background,"color-background"),Ve(je.color.text,"color-text"),Ve(je.color.border,"color-border"),Ve(je.typography.fontSize,"font-size"),Ve(je.typography.fontWeight,"font-weight"),Ve(je.typography.lineHeight,"line-height"),Ve(je.spacing,"spacing"),Ve(je.radius,"radius"),Ve(je.shadow,"shadow"),Ve(je.motion.duration,"motion-duration"),Ve(je.motion.easing,"motion-easing");function Wm(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Od(e,t,n){if(typeof e=="object"&&e!==null)for(const[r,a]of Object.entries(e))Od(a,[...t,Wm(r)],n);else n[`--${t.join("-")}`]=String(e)}const Ll=new RegExp("[{};\\u0000-\\u001f\\u007f]");function qm(e,t){const n={};Od(t,[],n);const r=Object.entries(n).filter(([a,o])=>Ll.test(a)||Ll.test(o)?(console.warn(`themeOverridesToCss: skipping unsafe token "${a}" for theme "${e}" (contains CSS-escaping characters)`),!1):!0);return r.length===0?"":[`[data-theme="${e}"] {`,...r.map(([a,o])=>` ${a}: ${o};`),"}"].join(`
2
- `)}const Gm={id:"light",name:"Light",type:"theme",contributions:{themeTokens:{}}},Ym={id:"dark",name:"Dark",type:"theme",contributions:{themeTokens:{color:{background:{base:"#1A1C1B",elevated:"#232625",subtle:"#1F2221",overlay:"rgba(0, 0, 0, 0.6)",hover:"#2C302E"},text:{primary:"#ECEAE3",secondary:"#A3A8A6",tertiary:"#969C99",disabled:"#6F7573",inverse:"#14181B"},border:{default:"#33373A",subtle:"#2C302E",strong:"#444A4D"},primary:{50:"#1D2A34",100:"#22364A",200:"#2A4A66",300:"#7CC0E8",600:"#7CC0E8",700:"#9AD0EE",800:"#BFE1F5"},secondary:{100:"#2A2C46",500:"#9A9DE3",600:"#9A9DE3"},success:{100:"#223A1E",600:"#7FC46E",700:"#8FD07F"},warning:{100:"#3D3016",600:"#E0AA4B",800:"#EABB6A"},danger:{100:"#45201D",600:"#E8776E",700:"#F0918A"},neutral:{50:"#1F2221",100:"#232625",200:"#2C302E",300:"#33373A",400:"#444A4D",500:"#6F7573",600:"#A3A8A6",700:"#C5C9C6",800:"#DAD9D3",900:"#ECEAE3",950:"#F5F4F0"}}}}},Xm=[Gm,Ym],_d="velora-theme",Al="velora-theme-mode",Ml="velora-runtime-themes",Jm=new Set(Xm.map(e=>e.id));function Ol(e){return e==="light"||e==="dark"||e==="system"}function Zm(e){return{mode:e,themeId:null,css:""}}function $r(){const e=localStorage.getItem(_d);if(e!==null)try{const r=JSON.parse(e);if(r&&typeof r=="object"){const{mode:a,themeId:o,css:s}=r;return{mode:Ol(a)?a:"system",themeId:typeof o=="string"&&o!==""?o:null,css:typeof s=="string"?s:""}}}catch{}const t=localStorage.getItem(Al),n=Zm(Ol(t)?t:"system");return Qa(n),t!==null&&localStorage.removeItem(Al),n}function Qa(e){localStorage.setItem(_d,JSON.stringify(e))}let Pn=null;function us(){const{mode:e,themeId:t}=$r();return Pn&&Pn.mode===e&&Pn.themeId===t||(Pn={mode:e,themeId:t}),Pn}const fs=new Set;function Fd(e){return fs.add(e),()=>{fs.delete(e)}}function Ys(){for(const e of fs)e()}function $d(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Bd(e){const t=e==="system"?$d():e;return Jm.has(t)?t:"light"}function ps(e){document.documentElement.dataset.theme=e}function Xs(e){ps(e.themeId??Bd(e.mode))}function Ud(e){let t=document.getElementById(Ml);t||(t=document.createElement("style"),t.id=Ml,document.head.appendChild(t)),t.textContent=e}function Qm(e){const n={...$r(),mode:e};Qa(n),n.themeId===null&&Xs(n),Ys()}function zd(e){const n={...$r(),themeId:e};Qa(n),Xs(n),Ys()}function eg(e){const n={...$r(),css:e};Qa(n),Ud(e),Ys()}function tg(){const e=$r();Ud(e.css),Xs(e)}function ng(e){return e.type==="datatype"||e.type==="section"?e.contributions.dataTypes??[]:[]}function rg(e){return e.type==="section"?e.contributions.adminSections??[]:[]}async function ag(e){gh([{name:e.name,entry:e.url,type:"module"}]);const t=await yh(`${e.name}${e.module??"/plugin"}`);if(!t||typeof t!="object"||!("default"in t)||!t.default)throw new Error(`Remote "${e.name}" (${e.url}) did not default-export a plugin from its exposed module`);return t.default}function og(e){return ng(e).map(t=>{const n=vh(t),r=xa(n.id);return r||(bh(n),n)})}function sg(e){const t=rg(e);for(const n of t)Ed(n.id)||xh(n);return t}async function ig(){}/**
1
+ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=(e,t,n)=>(gl(e,t,"read from private field"),n?n.call(e):t.get(e)),yl=(e,t,n)=>t.has(e)?ml("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),So=(e,t,n,r)=>(gl(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import"./remoteEntry-J2yJXsGB.js";import{_ as i,a as Ie,b as x}from"./_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DMaku-HC.js";import{a as Te,b as ne,c as Q,d as M,e as K,f as E,g as O,h as Wn,i as ie,j as bd,k as fn,l as Wa,m as hh,n as xd,o as qs,p as W,R as _r,q as wd,r as Cd,s as Tr,t as Ze,u as Nd,v as mh}from"./_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react__loadShare__.js-BuUBskgj.js";import{_ as gh}from"./_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BPoj3DC9.js";import{r as yh,l as vh}from"./index-Do71v6NZ.js";import{_ as bh,a as xa,b as xh,c as Sd,d as wh,e as Fr,f as Gs,g as qa,h as Ch,i as Nh}from"./_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare___mf_0_velora_mf_2_cms_mf_1_plugin_mf_2_sdk__loadShare__.js-Bm9EahCG.js";import{_ as Ga,a as Sh,b as Zr}from"./_virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react_mf_2_dom__loadShare__.js-DYfqn12F.js";import{s as Eh,u as Ya,a as ft,P as qe,c as Me,d as Ed,b as Td,e as Xa,f as Ja,g as ss,h as se,i as Tt,j as qn,k as Ye,l as kr,m as ot,n as xe,o as kd,p as rn,q as Th,r as Rd,t as kh,I as ye,B as H,v as Ne,w as Rh,x as de,C as Pd,S as Ph,T as Dh}from"./content-trash.schema-tvJ4Lbos.js";import"./vite-preload-helper-Cgledu0r.js";import"./__virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react__loadShare__.js_commonjs-proxy-Ng0fOpdU.js";import"./__virtual_mf___mfe_internal__velora_admin__mf_owner__1__loadShare__react_mf_2_dom__loadShare__.js_commonjs-proxy-oc1i_iBU.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const ae=e=>typeof e=="string",mr=()=>{let e,t;const n=new Promise((r,a)=>{e=r,t=a});return n.resolve=e,n.reject=t,n},vl=e=>e==null?"":String(e),Ih=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},Lh=/###/g,bl=e=>e&&e.includes("###")?e.replace(Lh,"."):e,xl=e=>!e||ae(e),br=(e,t,n)=>{const r=ae(t)?t.split("."):t;let a=0;for(;a<r.length-1;){if(xl(e))return{};const o=bl(r[a]);!e[o]&&n&&(e[o]=new n),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={},++a}return xl(e)?{}:{obj:e,k:bl(r[a])}},wl=(e,t,n)=>{const{obj:r,k:a}=br(e,t,Object);if(r!==void 0||t.length===1){r[a]=n;return}let o=t[t.length-1],s=t.slice(0,t.length-1),l=br(e,s,Object);for(;l.obj===void 0&&s.length;)o=`${s[s.length-1]}.${o}`,s=s.slice(0,s.length-1),l=br(e,s,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${o}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${o}`]=n},Ah=(e,t,n,r)=>{const{obj:a,k:o}=br(e,t,Object);a[o]=a[o]||[],a[o].push(n)},wa=(e,t)=>{const{obj:n,k:r}=br(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Mh=(e,t,n)=>{const r=wa(e,n);return r!==void 0?r:wa(t,n)},Dd=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(Object.prototype.hasOwnProperty.call(e,r)?ae(e[r])||e[r]instanceof String||ae(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Dd(e[r],t[r],n):e[r]=t[r]);return e},Ot=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Oh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},_h=e=>ae(e)?e.replace(/[&<>"'\/]/g,t=>Oh[t]):e;class Fh{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const $h=[" ",",","?","!",";"],Bh=new Fh(20),Uh=(e,t,n)=>{t=t||"",n=n||"";const r=$h.filter(s=>!t.includes(s)&&!n.includes(s));if(r.length===0)return!0;const a=Bh.getRegExp(`(${r.map(s=>s==="?"?"\\?":s).join("|")})`);let o=!a.test(e);if(!o){const s=e.indexOf(n);s>0&&!a.test(e.substring(0,s))&&(o=!0)}return o},is=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(n);let a=e;for(let o=0;o<r.length;){if(!a||typeof a!="object")return;let s,l="";for(let c=o;c<r.length;++c)if(c!==o&&(l+=n),l+=r[c],s=a[l],s!==void 0){if(["string","number","boolean"].includes(typeof s)&&c<r.length-1)continue;o+=c-o+1;break}a=s}return a},Rr=e=>e==null?void 0:e.replace(/_/g,"-"),zh={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var n,r;(r=(n=console==null?void 0:console[e])==null?void 0:n.apply)==null||r.call(n,console,t)}};class Ca{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||zh,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,a){return a&&!this.debug?null:(t=t.map(o=>ae(o)?o.replace(/[\r\n\x00-\x1F\x7F]/g," "):o),ae(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Ca(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Ca(this.logger,t)}}var St=new Ca;class Za{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const a=this.observers[r].get(n)||0;this.observers[r].set(n,a+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}once(t,n){const r=(...a)=>{n(...a),this.off(t,r)};return this.on(t,r),this}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([a,o])=>{for(let s=0;s<o;s++)a(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,o])=>{for(let s=0;s<o;s++)a(t,...n)})}}class Cl extends Za{constructor(t,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r,a={}){var d,f;const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,s=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.includes(".")?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):ae(r)&&o?l.push(...r.split(o)):l.push(r)));const c=wa(this.data,l);return!c&&!n&&!r&&t.includes(".")&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!s||!ae(r)?c:is((f=(d=this.data)==null?void 0:d[t])==null?void 0:f[n],r,o)}addResource(t,n,r,a,o={silent:!1}){const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let l=[t,n];r&&(l=l.concat(s?r.split(s):r)),t.includes(".")&&(l=t.split("."),a=n,n=l[1]),this.addNamespaces(n),wl(this.data,l,a),o.silent||this.emit("added",t,n,r,a)}addResources(t,n,r,a={silent:!1}){for(const o in r)(ae(r[o])||Array.isArray(r[o]))&&this.addResource(t,n,o,r[o],{silent:!0});a.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,a,o,s={silent:!1,skipCopy:!1}){let l=[t,n];t.includes(".")&&(l=t.split("."),a=r,r=n,n=l[1]),this.addNamespaces(n);let c=wa(this.data,l)||{};s.skipCopy||(r=JSON.parse(JSON.stringify(r))),a?Dd(c,r,o):c={...c,...r},wl(this.data,l,c),s.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(a=>n[a]&&Object.keys(n[a]).length>0)}toJSON(){return this.data}}var Id={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,a){return e.forEach(o=>{var s;t=((s=this.processors[o])==null?void 0:s.process(t,n,r,a))??t}),t}};const Ld=Symbol("i18next/PATH_KEY");function jh(){const e=[],t=Object.create(null);let n;return t.get=(r,a)=>{var o;return(o=n==null?void 0:n.revoke)==null||o.call(n),a===Ld?e:(e.push(a),n=Proxy.revocable(r,t),n.proxy)},Proxy.revocable(Object.create(null),t).proxy}function On(e,t){const{[Ld]:n}=e(jh()),r=(t==null?void 0:t.keySeparator)??".",a=(t==null?void 0:t.nsSeparator)??":",o=(t==null?void 0:t.enableSelector)==="strict";if(n.length>1&&a){const s=t==null?void 0:t.ns,l=o?Array.isArray(s)?s:s?[s]:null:Array.isArray(s)?s:null;if(l&&(o?l:l.length>1?l.slice(1):[]).includes(n[0]))return`${n[0]}${a}${n.slice(1).join(r)}`}return n.join(r)}const Eo=e=>!ae(e)&&typeof e!="boolean"&&typeof e!="number";class Na extends Za{constructor(t,n={}){super(),Ih(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=St.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const r={...n};if(t==null)return!1;const a=this.resolve(t,r);if((a==null?void 0:a.res)===void 0)return!1;const o=Eo(a.res);return!(r.returnObjects===!1&&o)}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const s=r&&t.includes(r),l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Uh(t,r,a);if(s&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:ae(o)?[o]:o};const d=t.split(r);(r!==a||r===a&&this.options.ns.includes(d[0]))&&(o=d.shift()),t=d.join(a)}return{key:t,namespaces:ae(o)?[o]:o}}translate(t,n,r){let a=typeof n=="object"?{...n}:n;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),t==null)return"";typeof t=="function"&&(t=On(t,{...this.options,...a})),Array.isArray(t)||(t=[String(t)]),t=t.map(A=>typeof A=="function"?On(A,{...this.options,...a}):String(A));const o=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:l,namespaces:c}=this.extractFromKey(t[t.length-1],a),d=c[c.length-1];let f=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;f===void 0&&(f=":");const u=a.lng||this.language,p=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((u==null?void 0:u.toLowerCase())==="cimode")return p?o?{res:`${d}${f}${l}`,usedKey:l,exactUsedKey:l,usedLng:u,usedNS:d,usedParams:this.getUsedParamsDetails(a)}:`${d}${f}${l}`:o?{res:l,usedKey:l,exactUsedKey:l,usedLng:u,usedNS:d,usedParams:this.getUsedParamsDetails(a)}:l;const m=this.resolve(t,a);let h=m==null?void 0:m.res;const g=(m==null?void 0:m.usedKey)||l,y=(m==null?void 0:m.exactUsedKey)||l,w=["[object Number]","[object Function]","[object RegExp]"],b=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,C=a.count!==void 0&&!ae(a.count),N=Na.hasDefaultValue(a),T=C?this.pluralResolver.getSuffix(u,a.count,a):"",R=a.ordinal&&C?this.pluralResolver.getSuffix(u,a.count,{ordinal:!1}):"",L=C&&!a.ordinal&&a.count===0,I=L&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${T}`]||a[`defaultValue${R}`]||a.defaultValue;let P=h;v&&!h&&N&&(P=I);const k=Eo(P),S=Object.prototype.toString.apply(P);if(v&&P&&k&&!w.includes(S)&&!(ae(b)&&Array.isArray(P))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const A=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,P,{...a,ns:c}):`key '${l} (${this.language})' returned an object instead of string.`;return o?(m.res=A,m.usedParams=this.getUsedParamsDetails(a),m):A}if(s){const A=Array.isArray(P),D=A?[]:{},B=A?y:g;for(const U in P)if(Object.prototype.hasOwnProperty.call(P,U)){const z=`${B}${s}${U}`;N&&!h?D[U]=this.translate(z,{...a,defaultValue:Eo(I)?I[U]:void 0,joinArrays:!1,ns:c}):D[U]=this.translate(z,{...a,joinArrays:!1,ns:c}),D[U]===z&&(D[U]=P[U])}h=D}}else if(v&&ae(b)&&Array.isArray(h))h=h.join(b),h&&(h=this.extendTranslation(h,t,a,r));else{let A=!1,D=!1;!this.isValidLookup(h)&&N&&(A=!0,h=I),this.isValidLookup(h)||(D=!0,h=l);const U=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&D?void 0:h,z=N&&I!==h&&this.options.updateMissing;if(D||A||z){if(this.logger.log(z?"updateKey":"missingKey",u,d,C&&!z?`${l}${this.pluralResolver.getSuffix(u,a.count,a)}`:l,z?I:h),s){const ee=this.resolve(l,{...a,keySeparator:!1});ee&&ee.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let _=[];const G=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&G&&G[0])for(let ee=0;ee<G.length;ee++)_.push(G[ee]);else this.options.saveMissingTo==="all"?_=this.languageUtils.toResolveHierarchy(a.lng||this.language):_.push(a.lng||this.language);const V=(ee,Z,j)=>{var Se;const le=N&&j!==h?j:U;this.options.missingKeyHandler?this.options.missingKeyHandler(ee,d,Z,le,z,a):(Se=this.backendConnector)!=null&&Se.saveMissing&&this.backendConnector.saveMissing(ee,d,Z,le,z,a),this.emit("missingKey",ee,d,Z,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?_.forEach(ee=>{const Z=this.pluralResolver.getSuffixes(ee,a);L&&a[`defaultValue${this.options.pluralSeparator}zero`]&&!Z.includes(`${this.options.pluralSeparator}zero`)&&Z.push(`${this.options.pluralSeparator}zero`),Z.forEach(j=>{V([ee],l+j,a[`defaultValue${j}`]||I)})}):V(_,l,I))}h=this.extendTranslation(h,t,a,m,r),D&&h===l&&this.options.appendNamespaceToMissingKey&&(h=`${d}${f}${l}`),(D||A)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${d}${f}${l}`:l,A?h:void 0,a))}return o?(m.res=h,m.usedParams=this.getUsedParamsDetails(a),m):h}extendTranslation(t,n,r,a,o){var c,d;if((c=this.i18nFormat)!=null&&c.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const f=ae(t)&&(((d=r==null?void 0:r.interpolation)==null?void 0:d.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(f){const m=t.match(this.interpolator.nestingRegexp);u=m&&m.length}let p=r.replace&&!ae(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),t=this.interpolator.interpolate(t,p,r.lng||this.language||a.usedLng,r),f){const m=t.match(this.interpolator.nestingRegexp),h=m&&m.length;u<h&&(r.nest=!1)}!r.lng&&a&&a.res&&(r.lng=this.language||a.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...m)=>(o==null?void 0:o[0])===m[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${m[0]} in key: ${n[0]}`),null):this.translate(...m,n),r)),r.interpolation&&this.interpolator.reset()}const s=r.postProcess||this.options.postProcess,l=ae(s)?[s]:s;return t!=null&&(l!=null&&l.length)&&r.applyPostProcessor!==!1&&(t=Id.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,n={}){let r,a,o,s,l;return ae(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(c=>typeof c=="function"?On(c,{...this.options,...n}):c)),t.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),f=d.key;a=f;let u=d.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const p=n.count!==void 0&&!ae(n.count),m=p&&!n.ordinal&&n.count===0,h=n.context!==void 0&&(ae(n.context)||typeof n.context=="number")&&n.context!=="",g=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);u.forEach(y=>{var w,b;this.isValidLookup(r)||(l=y,!this.checkedLoadedFor[`${g[0]}-${y}`]&&((w=this.utils)!=null&&w.hasLoadedNamespace)&&!((b=this.utils)!=null&&b.hasLoadedNamespace(l))&&(this.checkedLoadedFor[`${g[0]}-${y}`]=!0,this.logger.warn(`key "${a}" for languages "${g.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(v=>{var T;if(this.isValidLookup(r))return;s=v;const C=[f];if((T=this.i18nFormat)!=null&&T.addLookupKeys)this.i18nFormat.addLookupKeys(C,f,v,y,n);else{let R;p&&(R=this.pluralResolver.getSuffix(v,n.count,n));const L=`${this.options.pluralSeparator}zero`,I=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(n.ordinal&&R.startsWith(I)&&C.push(f+R.replace(I,this.options.pluralSeparator)),C.push(f+R),m&&C.push(f+L)),h){const P=`${f}${this.options.contextSeparator||"_"}${n.context}`;C.push(P),p&&(n.ordinal&&R.startsWith(I)&&C.push(P+R.replace(I,this.options.pluralSeparator)),C.push(P+R),m&&C.push(P+L))}}let N;for(;N=C.pop();)this.isValidLookup(r)||(o=N,r=this.getResource(v,y,N,n))}))})}),{res:r,usedKey:a,exactUsedKey:o,usedLng:s,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r,a={}){var o;return(o=this.i18nFormat)!=null&&o.getResource?this.i18nFormat.getResource(t,n,r,a):this.resourceStore.getResource(t,n,r,a)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!ae(t.replace);let a=r?t.replace:t;if(r&&typeof t.count<"u"&&(a.count=t.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!r){a={...a};for(const o of n)delete a[o]}return a}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&r.startsWith(n)&&t[r]!==void 0)return!0;return!1}}class Nl{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=St.create("languageUtils")}getScriptPartFromCode(t){if(t=Rr(t),!t||!t.includes("-"))return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Rr(t),!t||!t.includes("-"))return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(ae(t)&&t.includes("-")){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const a=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(a))&&(n=a)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const a=this.getScriptPartFromCode(r);if(this.isSupportedCode(a))return n=a;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(s=>s===o?!0:!s.includes("-")&&!o.includes("-")?!1:!!(s.includes("-")&&!o.includes("-")&&s.slice(0,s.indexOf("-"))===o||s.startsWith(o)&&o.length>1))}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),ae(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),a=[],o=s=>{s&&(this.isSupportedCode(s)?a.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return ae(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):ae(t)&&o(this.formatLanguageCode(t)),r.forEach(s=>{a.includes(s)||o(this.formatLanguageCode(s))}),a}}const Sl={zero:0,one:1,two:2,few:3,many:4,other:5},El={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Vh{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=St.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const r=Rr(t==="dev"?"en":t),a=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:a});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let s;try{s=new Intl.PluralRules(r,{type:a})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),El;if(!t.match(/-|_/))return El;const c=this.languageUtils.getLanguagePartFromCode(t);s=this.getRule(c,n)}return this.pluralRulesCache[o]=s,s}needsPlural(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,n,r={}){return this.getSuffixes(t,r).map(a=>`${n}${a}`)}getSuffixes(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((a,o)=>Sl[a]-Sl[o]).map(a=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(t,n,r={}){const a=this.getRule(t,r);return a?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,r))}}const Tl=(e,t,n,r=".",a=!0)=>{let o=Mh(e,t,n);return!o&&a&&ae(n)&&(o=is(e,n,r),o===void 0&&(o=is(t,n,r))),o},To=e=>e.replace(/\$/g,"$$$$");class kl{constructor(t={}){var n;this.logger=St.create("interpolator"),this.options=t,this.format=((n=t==null?void 0:t.interpolation)==null?void 0:n.format)||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:a,prefix:o,prefixEscaped:s,suffix:l,suffixEscaped:c,formatSeparator:d,unescapeSuffix:f,unescapePrefix:u,nestingPrefix:p,nestingPrefixEscaped:m,nestingSuffix:h,nestingSuffixEscaped:g,nestingOptionsSeparator:y,maxReplaces:w,alwaysFormat:b}=t.interpolation;this.escape=n!==void 0?n:_h,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=o?Ot(o):s||"{{",this.suffix=l?Ot(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=f?"":u?Ot(u):"-",this.unescapeSuffix=this.unescapePrefix?"":f?Ot(f):"",this.nestingPrefix=p?Ot(p):m||Ot("$t("),this.nestingSuffix=h?Ot(h):g||Ot(")"),this.nestingOptionsSeparator=y||",",this.maxReplaces=w||1e3,this.alwaysFormat=b!==void 0?b:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>(n==null?void 0:n.source)===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,n,r,a){var m;let o,s,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=h=>{if(!h.includes(this.formatSeparator)){const b=Tl(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,r,{...a,...n,interpolationkey:h}):b}const g=h.split(this.formatSeparator),y=g.shift().trim(),w=g.join(this.formatSeparator).trim();return this.format(Tl(n,c,y,this.options.keySeparator,this.options.ignoreJSONStructure),w,r,{...a,...n,interpolationkey:y})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const f=(a==null?void 0:a.missingInterpolationHandler)||this.options.missingInterpolationHandler,u=((m=a==null?void 0:a.interpolation)==null?void 0:m.skipOnVariables)!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>To(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?To(this.escape(h)):To(h)}].forEach(h=>{for(l=0;o=h.regex.exec(t);){const g=o[1].trim();if(s=d(g),s===void 0)if(typeof f=="function"){const w=f(t,o,a);s=ae(w)?w:""}else if(a&&Object.prototype.hasOwnProperty.call(a,g))s="";else if(u){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),s="";else!ae(s)&&!this.useRawValueToEscape&&(s=vl(s));const y=h.safeValue(s);if(t=t.replace(o[0],y),u?(h.regex.lastIndex+=s.length,h.regex.lastIndex-=o[0].length):h.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n,r={}){let a,o,s;const l=(c,d)=>{const f=this.nestingOptionsSeparator;if(!c.includes(f))return c;const u=c.split(new RegExp(`${Ot(f)}[ ]*{`));let p=`{${u[1]}`;c=u[0],p=this.interpolate(p,s);const m=p.match(/'/g),h=p.match(/"/g);(((m==null?void 0:m.length)??0)%2===0&&!h||((h==null?void 0:h.length)??0)%2!==0)&&(p=p.replace(/'/g,'"'));try{s=JSON.parse(p),d&&(s={...d,...s})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,g),`${c}${f}${p}`}return s.defaultValue&&s.defaultValue.includes(this.prefix)&&delete s.defaultValue,c};for(;a=this.nestingRegexp.exec(t);){let c=[];s={...r},s=s.replace&&!ae(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;const d=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(d!==-1&&(c=a[1].slice(d).split(this.formatSeparator).map(f=>f.trim()).filter(Boolean),a[1]=a[1].slice(0,d)),o=n(l.call(this,a[1].trim(),s),s),o&&a[0]===t&&!ae(o))return o;ae(o)||(o=vl(o)),o||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${t}`),o=""),c.length&&(o=c.reduce((f,u)=>this.format(f,u,r.lng,{...r,interpolationkey:a[1].trim()}),o.trim())),t=t.replace(a[0],o),this.regexp.lastIndex=0}return t}}const Hh=e=>{let t=e.toLowerCase().trim();const n={};if(e.includes("(")){const r=e.split("(");t=r[0].toLowerCase().trim();const a=r[1].slice(0,-1);t==="currency"&&!a.includes(":")?n.currency||(n.currency=a.trim()):t==="relativetime"&&!a.includes(":")?n.range||(n.range=a.trim()):a.split(";").forEach(s=>{if(s){const[l,...c]=s.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),f=l.trim();n[f]||(n[f]=d),d==="false"&&(n[f]=!1),d==="true"&&(n[f]=!0),isNaN(d)||(n[f]=parseInt(d,10))}})}return{formatName:t,formatOptions:n}},Rl=e=>{const t={};return(n,r,a)=>{let o=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(o={...o,[a.interpolationkey]:void 0});const s=r+JSON.stringify(o);let l=t[s];return l||(l=e(Rr(r),a),t[s]=l),l(n)}},Kh=e=>(t,n,r)=>e(Rr(n),r)(t);class Wh{constructor(t={}){this.logger=St.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?Rl:Kh;this.formats={number:r((a,o)=>{const s=new Intl.NumberFormat(a,{...o});return l=>s.format(l)}),currency:r((a,o)=>{const s=new Intl.NumberFormat(a,{...o,style:"currency"});return l=>s.format(l)}),datetime:r((a,o)=>{const s=new Intl.DateTimeFormat(a,{...o});return l=>s.format(l)}),relativetime:r((a,o)=>{const s=new Intl.RelativeTimeFormat(a,{...o});return l=>s.format(l,o.range||"day")}),list:r((a,o)=>{const s=new Intl.ListFormat(a,{...o});return l=>s.format(l)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Rl(n)}format(t,n,r,a={}){if(!n||t==null)return t;const o=n.split(this.formatSeparator),s=[];for(let c=0;c<o.length;c++){let d=o[c];for(;d.indexOf("(")>-1&&!d.includes(")")&&c+1<o.length;)d=`${d}${this.formatSeparator}${o[++c]}`;s.push(d)}return s.reduce((c,d)=>{var p;const{formatName:f,formatOptions:u}=Hh(d);if(this.formats[f]){let m=c;try{const h=((p=a==null?void 0:a.formatParams)==null?void 0:p[a.interpolationkey])||{},g=h.locale||h.lng||a.locale||a.lng||r;m=this.formats[f](c,g,{...u,...a,...h})}catch(h){this.logger.warn(h)}return m}else this.logger.warn(`there was no format function for ${f}`);return c},t)}}const qh=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class Gh extends Za{constructor(t,n,r,a={}){var o,s;super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=a,this.logger=St.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],(s=(o=this.backend)==null?void 0:o.init)==null||s.call(o,r,a.backend,a)}queueLoad(t,n,r,a){const o={},s={},l={},c={};return t.forEach(d=>{let f=!0;n.forEach(u=>{const p=`${d}|${u}`;!r.reload&&this.store.hasResourceBundle(d,u)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?s[p]===void 0&&(s[p]=!0):(this.state[p]=1,f=!1,s[p]===void 0&&(s[p]=!0),o[p]===void 0&&(o[p]=!0),c[u]===void 0&&(c[u]=!0)))}),f||(l[d]=!0)}),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const a=t.split("|"),o=a[0],s=a[1];n&&this.emit("failedLoading",o,s,n),!n&&r&&this.store.addResourceBundle(o,s,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const l={};this.queue.forEach(c=>{Ah(c.loaded,[o],s),qh(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const f=c.loaded[d];f.length&&f.forEach(u=>{l[d][u]===void 0&&(l[d][u]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r,a=0,o=this.retryTimeout,s){if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:a,wait:o,callback:s});return}this.readingCalls++;const l=(d,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const u=this.waitingReads.shift();this.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}if(d&&f&&a<this.maxRetries){setTimeout(()=>{this.read(t,n,r,a+1,o*2,s)},o);return}s(d,f)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(t,n);d&&typeof d.then=="function"?d.then(f=>l(null,f)).catch(l):l(null,d)}catch(d){l(d)}return}return c(t,n,l)}prepareLoading(t,n,r={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();ae(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ae(n)&&(n=[n]);const o=this.queueLoad(t,n,r,a);if(!o.toLoad.length)return o.pending.length||a(),null;o.toLoad.forEach(s=>{this.loadOne(s)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t,n=""){const r=t.split("|"),a=r[0],o=r[1];this.read(a,o,"read",void 0,void 0,(s,l)=>{s&&this.logger.warn(`${n}loading namespace ${o} for language ${a} failed`,s),!s&&l&&this.logger.log(`${n}loaded namespace ${o} for language ${a}`,l),this.loaded(t,s,l)})}saveMissing(t,n,r,a,o,s={},l=()=>{}){var c,d,f,u,p;if((d=(c=this.services)==null?void 0:c.utils)!=null&&d.hasLoadedNamespace&&!((u=(f=this.services)==null?void 0:f.utils)!=null&&u.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((p=this.backend)!=null&&p.create){const m={...s,isUpdate:o},h=this.backend.create.bind(this.backend);if(h.length<6)try{let g;h.length===5?g=h(t,n,r,a,m):g=h(t,n,r,a),g&&typeof g.then=="function"?g.then(y=>l(null,y)).catch(l):l(null,g)}catch(g){l(g)}else h(t,n,r,a,l,m)}!t||!t[0]||this.store.addResource(t[0],n,r,a)}}}const ko=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),ae(e[1])&&(t.defaultValue=e[1]),ae(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Pl=e=>(ae(e.ns)&&(e.ns=[e.ns]),ae(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ae(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Qr=()=>{},Yh=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class xr extends Za{constructor(t={},n){if(super(),this.options=Pl(t),this.services={},this.logger=St,this.modules={external:[]},Yh(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(ae(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));const r=ko();this.options={...r,...this.options,...Pl(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler);const a=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?St.init(a(this.modules.logger),this.options):St.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:d=Wh;const f=new Nl(this.options);this.store=new Cl(this.options.resources,this.options);const u=this.services;u.logger=St,u.resourceStore=this.store,u.languageUtils=f,u.pluralResolver=new Vh(f,{prepend:this.options.pluralSeparator}),d&&(u.formatter=a(d),u.formatter.init&&u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new kl(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Gh(a(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",(p,...m)=>{this.emit(p,...m)}),this.modules.languageDetector&&(u.languageDetector=a(this.modules.languageDetector),u.languageDetector.init&&u.languageDetector.init(u,this.options.detection,this.options)),this.modules.i18nFormat&&(u.i18nFormat=a(this.modules.i18nFormat),u.i18nFormat.init&&u.i18nFormat.init(this)),this.translator=new Na(this.services,this.options),this.translator.on("*",(p,...m)=>{this.emit(p,...m)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Qr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=(...f)=>this.store[d](...f)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=(...f)=>(this.store[d](...f),this)});const l=mr(),c=()=>{const d=(f,u)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(u),n(f,u)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),l}loadResources(t,n=Qr){var o,s;let r=n;const a=ae(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if((a==null?void 0:a.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const l=[],c=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(u=>{u!=="cimode"&&(l.includes(u)||l.push(u))})};a?c(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(f=>c(f)),(s=(o=this.options.preload)==null?void 0:o.forEach)==null||s.call(o,d=>c(d)),this.services.backendConnector.load(l,this.options.ns,d=>{!d&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(d)})}else r(null)}reloadResources(t,n,r){const a=mr();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=Qr),this.services.backendConnector.reload(t,n,o=>{a.resolve(),r(o)}),a}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Id.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!["cimode","dev"].includes(r)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,n){this.isLanguageChangingTo=t;const r=mr();this.emit("languageChanging",t);const a=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,c)=>{c?this.isLanguageChangingTo===t&&(a(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve((...d)=>this.t(...d)),n&&n(l,(...d)=>this.t(...d))},s=l=>{var f,u;!t&&!l&&this.services.languageDetector&&(l=[]);const c=ae(l)?l:l&&l[0],d=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(ae(l)?[l]:l);d&&(this.language||a(d),this.translator.language||this.translator.changeLanguage(d),(u=(f=this.services.languageDetector)==null?void 0:f.cacheUserLanguage)==null||u.call(f,d)),this.loadResources(d,p=>{o(p,d)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),r}getFixedT(t,n,r,a){const o=a==null?void 0:a.scopeNs,s=(l,c,...d)=>{let f;typeof c!="object"?f=this.options.overloadTranslationOptionHandler([l,c].concat(d)):f={...c},f.lng=f.lng||s.lng,f.lngs=f.lngs||s.lngs;const u=f.ns!==void 0&&f.ns!==null;f.ns=f.ns||s.ns,f.keyPrefix!==""&&(f.keyPrefix=f.keyPrefix||r||s.keyPrefix);const p={...this.options,...f};Array.isArray(o)&&!u&&(p.ns=o),typeof f.keyPrefix=="function"&&(f.keyPrefix=On(f.keyPrefix,p));const m=this.options.keySeparator||".";let h;return f.keyPrefix&&Array.isArray(l)?h=l.map(g=>(typeof g=="function"&&(g=On(g,p)),`${f.keyPrefix}${m}${g}`)):(typeof l=="function"&&(l=On(l,p)),h=f.keyPrefix?`${f.keyPrefix}${m}${l}`:l),this.t(h,f)};return ae(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}t(...t){var n;return(n=this.translator)==null?void 0:n.translate(...t)}exists(...t){var n;return(n=this.translator)==null?void 0:n.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(l,c)=>{const d=this.services.backendConnector.state[`${l}|${c}`];return d===-1||d===0||d===2};if(n.precheck){const l=n.precheck(this,s);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(r,t)&&(!a||s(o,t)))}loadNamespaces(t,n){const r=mr();return this.options.ns?(ae(t)&&(t=[t]),t.forEach(a=>{this.options.ns.includes(a)||this.options.ns.push(a)}),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=mr();ae(t)&&(t=[t]);const a=this.options.preload||[],o=t.filter(s=>!a.includes(s)&&this.services.languageUtils.isSupportedCode(s));return o.length?(this.options.preload=a.concat(o),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}dir(t){var a,o;if(t||(t=this.resolvedLanguage||(((a=this.languages)==null?void 0:a.length)>0?this.languages[0]:this.language)),!t)return"rtl";try{const s=new Intl.Locale(t);if(s&&s.getTextInfo){const l=s.getTextInfo();if(l&&l.direction)return l.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((o=this.services)==null?void 0:o.languageUtils)||new Nl(ko());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.includes(r.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){const r=new xr(t,n);return r.createInstance=xr.createInstance,r}cloneInstance(t={},n=Qr){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const a={...this.options,...t,isClone:!0},o=new xr(a);if((t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(l=>{o[l]=this[l]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r){const l=Object.keys(this.store.data).reduce((c,d)=>(c[d]={...this.store.data[d]},c[d]=Object.keys(c[d]).reduce((f,u)=>(f[u]={...c[d][u]},f),c[d]),c),{});o.store=new Cl(l,a),o.services.resourceStore=o.store}if(t.interpolation){const c={...ko().interpolation,...this.options.interpolation,...t.interpolation},d={...a,interpolation:c};o.services.interpolator=new kl(d)}return o.translator=new Na(o.services,a),o.translator.on("*",(l,...c)=>{o.emit(l,...c)}),o.init(a,n),o.translator.options=a,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const $e=xr.createInstance();$e.createInstance;$e.dir;$e.init;$e.loadResources;$e.reloadResources;$e.use;$e.changeLanguage;$e.getFixedT;$e.t;$e.exists;$e.setDefaultNamespace;$e.hasLoadedNamespace;$e.loadNamespaces;$e.loadLanguages;const Xh=(e,t,n,r)=>{var o,s,l,c;const a=[n,{code:t,...r||{}}];if((s=(o=e==null?void 0:e.services)==null?void 0:o.logger)!=null&&s.forward)return e.services.logger.forward(a,"warn","react-i18next::",!0);yn(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),(c=(l=e==null?void 0:e.services)==null?void 0:l.logger)!=null&&c.warn?e.services.logger.warn(...a):console!=null&&console.warn&&console.warn(...a)},Dl={},ls=(e,t,n,r)=>{yn(n)&&Dl[n]||(yn(n)&&(Dl[n]=new Date),Xh(e,t,n,r))},Ad=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},cs=(e,t,n)=>{e.loadNamespaces(t,Ad(e,n))},Il=(e,t,n,r)=>{if(yn(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return cs(e,n,r);n.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,Ad(e,r))},Jh=(e,t,n={})=>!t.languages||!t.languages.length?(ls(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!a(r.isLanguageChangingTo,e))return!1}}),yn=e=>typeof e=="string",Zh=e=>typeof e=="object"&&e!==null,Qh=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,em={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},tm=e=>em[e],nm=e=>e.replace(Qh,tm);let ds={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:nm,transDefaultProps:void 0};const rm=(e={})=>{ds={...ds,...e}},am=()=>ds;let Md;const om=e=>{Md=e},sm=()=>Md,im={type:"3rdParty",init(e){rm(e.options.react),om(e)}},lm=Te();class cm{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const dm=(e,t)=>{if(yn(t))return t;if(Zh(t)&&yn(t.defaultValue))return t.defaultValue;if(typeof e=="function")return"";if(Array.isArray(e)){const n=e[e.length-1];return typeof n=="function"?"":n}return e},um={t:dm,ready:!1},fm=()=>()=>{},oe=(e,t={})=>{var I,P,k;const{i18n:n}=t,{i18n:r,defaultNS:a}=ne(lm)||{},o=n||r||sm();o&&!o.reportNamespaces&&(o.reportNamespaces=new cm),o||ls(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const s=Q(()=>{var S;return{...am(),...(S=o==null?void 0:o.options)==null?void 0:S.react,...t}},[o,t]),{useSuspense:l,keyPrefix:c}=s,d=a||((I=o==null?void 0:o.options)==null?void 0:I.defaultNS),f=yn(d)?[d]:d||["translation"],u=Q(()=>f,f);(k=(P=o==null?void 0:o.reportNamespaces)==null?void 0:P.addUsedNamespaces)==null||k.call(P,u);const p=M(0),m=K(S=>{if(!o)return fm;const{bindI18n:A,bindI18nStore:D}=s,B=()=>{p.current+=1,S()};return A&&o.on(A,B),D&&o.store.on(D,B),()=>{A&&A.split(" ").forEach(U=>o.off(U,B)),D&&D.split(" ").forEach(U=>o.store.off(U,B))}},[o,s]),h=M(),g=K(()=>{if(!o)return um;const S=!!(o.isInitialized||o.initializedStoreOnce)&&u.every(_=>Jh(_,o,s)),A=t.lng||o.language,D=p.current,B=h.current;if(B&&B.ready===S&&B.lng===A&&B.keyPrefix===c&&B.revision===D)return B;const z={t:o.getFixedT(A,s.nsMode==="fallback"?u:u[0],c,{scopeNs:u}),ready:S,lng:A,keyPrefix:c,revision:D};return h.current=z,z},[o,u,c,s,t.lng]),[y,w]=E(0),{t:b,ready:v}=Eh.useSyncExternalStore(m,g,g);O(()=>{if(o&&!v&&!l){const S=()=>w(A=>A+1);t.lng?Il(o,t.lng,u,S):cs(o,u,S)}},[o,t.lng,u,v,l,y]);const C=o||{},N=M(null),T=M(),R=S=>{const A=Object.getOwnPropertyDescriptors(S);A.__original&&delete A.__original;const D=Object.create(Object.getPrototypeOf(S),A);if(!Object.prototype.hasOwnProperty.call(D,"__original"))try{Object.defineProperty(D,"__original",{value:S,writable:!1,enumerable:!1,configurable:!1})}catch{}return D},L=Q(()=>{const S=C,A=S==null?void 0:S.language;let D=S;S&&(N.current&&N.current.__original===S?T.current!==A?(D=R(S),N.current=D,T.current=A):D=N.current:(D=R(S),N.current=D,T.current=A));const B=!v&&!l?(...z)=>(ls(o,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),b(...z)):b,U=[B,D,v];return U.t=B,U.i18n=D,U.ready=v,U},[b,C,v,C.resolvedLanguage,C.language,C.languages]);if(o&&l&&!v)throw new Promise(S=>{const A=()=>S();t.lng?Il(o,t.lng,u,A):cs(o,u,A)});return L},pm={required:"Required"},hm={skipToContent:"Skip to content"},mm={title:"API Keys",newButton:"New API key",createTitle:"Create API key",nameLabel:"Name",scopeLabel:"Access",scopeRead:"Read only",scopeReadHelp:"Can read published content, media and document types through the headless API.",scopeWrite:"Read and write",scopeWriteHelp:"Can also create, save and publish content. Treat it like a password.",createButton:"Create key",creating:"Creating…",cancel:"Cancel",genericError:"Something went wrong. Try again.",createdToast:'API key "{{name}}" created',secretTitle:"Copy your key now",secretWarning:"This key is shown only once. It cannot be retrieved after you dismiss this panel.",copyButton:"Copy key",copiedToast:"Key copied to clipboard",copyFailedToast:"Could not copy — select and copy it manually",dismissButton:"I saved my key",statusActive:"Active",statusRevoked:"Revoked",createdAt:"Created {{date}}",lastUsedAt:"Last used {{date}}",neverUsed:"Never used",revokeButton:"Revoke",revokeConfirmBody:"Requests using this key will fail immediately. This cannot be undone.",revokeConfirmButton:"Revoke key",revokeCancelButton:"Keep",revokedToast:'API key "{{name}}" revoked',empty:"No API keys yet. Create one to let an external app read the public API.",loading:"Loading API keys"},gm={title:"API Playground",description:"Pick a public API endpoint, paste an API key, and send a request to see the live status and body.",keyLabel:"API key",keyPlaceholder:"vk_…",keyNamesHint:"Existing keys: {{names}}",endpointLabel:"Endpoint",sendButton:"Send",sending:"Sending…",statusLabel:"Status",responseLabel:"Response",noEndpoints:"No parameter-free GET endpoints are available to try.",genericError:"Something went wrong. Try again.",emptyState:"Pick an endpoint and send a request to see the response here."},ym={title:"Velora Admin",logout:"Sign out",sessionExpiresIn:"Session: {{time}}",sessionExpiringSoon:"Your session expires in less than a minute.",idleLoggedOut:"You've been logged out due to inactivity",sessionExpired:"Your session has expired. Please log in again."},vm={light:"Light",dark:"Dark",system:"System"},bm={open:"Account menu for {{name}}",theme:"Theme",themeInert:"Mode is set by the active theme.",language:"Language",languageName:{en:"English",ar:"العربية"}},xm={navLabel:"Appearance",intro:"Themes re-skin the entire admin — including screens contributed by installed plugins — because every surface consumes the same design tokens rather than hardcoded colors.",themeSectionTitle:"Theme",defaultName:"Velora",defaultBadge:"(Default)",defaultDescription:"Light & dark variants.",activeBadge:"Active",byAuthor:"by {{author}}",browseMarketplace:"Browse themes on the Marketplace",noInstalledThemes:"No installed themes yet.",loadErrorNote:"Couldn't refresh the installed themes list. Showing what's cached.",loadingLabel:"Loading themes…",modeSectionTitle:"Mode",modeGroupLabel:"Mode",modeCaptionDefault:`Applies to the "Velora" theme's light/dark variants.`,modeCaptionCustom:"{{themeName}} provides a single palette. Mode switching applies to the default theme."},wm={content:"Content",media:"Media",settings:"Settings",users:"Users",plugins:"Plugins",snapshots:"Content snapshots",docs:"Docs",sectionsLabel:"Sections"},Cm={dismiss:"Dismiss",notification:"Notification"},Nm={viewCrashed:"The {{name}} plugin view crashed — the rest of this page still works."},Sm={loading:"Loading plugin section…",notFoundTitle:"Plugin section not found",notFoundDescription:"This plugin section is no longer available."},Em={treeTitle:"Plugins",installed:"Installed",marketplace:"Marketplace",marketplaceTitle:"Marketplace",marketplaceSearchLabel:"Search marketplace",marketplaceSearchPlaceholder:"Search plugins by name…",filterType:"Type",filterDatabase:"Database",filterAll:"All",free:"Free",marketplaceIncompatible:"Not compatible with this site's database ({{dialect}})",marketplaceEmpty:"No plugins found.",marketplaceErrorTitle:"Couldn't load the marketplace.",marketplaceOffTitle:"No marketplace connected",marketplaceOffDescription:"This instance runs without a plugin marketplace. Set VELORA_MARKETPLACE_URL in the server's environment and restart to connect one.",detailBack:"Back to marketplace",detailTabsLabel:"Plugin details",detailOverview:"Overview",detailVersions:"Versions",detailVersionReleased:"Released {{date}}",detailLatestVersion:"Latest",detailPermissionsTab:"Permissions & compatibility",detailPermissions:"Permissions",detailPermissionsEmpty:"No permissions declared.",permissionRow:"{{label}}: {{value}}",detailCompatibility:"Database compatibility",permissionYes:"yes",permissionNo:"no",documentTypesTitle:"Provisioned document types",starterTitle:"Starter frontend",bundleMembersTitle:"Included plugins",bundleMembersHelp:"One purchase, one license key — installs all {{count}}.",bundleMemberFree:"Free",bundleStarterNone:"None — this bundle does not include a starter frontend.",bundleInstalledMembers_one:"{{count}} included plugin installed, {{skipped}} already installed.",bundleInstalledMembers_other:"{{count}} included plugins installed, {{skipped}} already installed.",starterDeliveryPrefix:"Delivered as a downloadable archive — unpack, ",starterDeliverySuffix:", point it at this site.",getStarter:"Get the starter",viewSource:"View source",buyOnMarketplace:"Buy on marketplace",detailNotFound:"This plugin isn't in the marketplace.",install:"Install",installUnavailable:"Not yet available for download",installing:"Installing…",installDone:"Installed",installFailed:"Couldn't install the plugin. Please try again.",installKeyTitle:"Install {{name}} — license required",installKeyDescription:"This plugin requires a valid license key to install.",installKeyLabel:"License key",installKeyHelp:"Paste the key from your marketplace purchase. The key binds to this site's domain on first use.",installKeyPlaceholder:"vlic_…",installKeySubmit:"Validate & install",cancel:"Cancel",title:"Installed plugins",columns:{name:"Name",version:"Version",trust:"Trust",storage:"Storage",license:"License",actions:"Actions"},loadMore:"Load more",empty:"No plugins installed yet.",errorTitle:"Couldn't load installed plugins.",retry:"Retry",toggleAria:"Toggle {{name}}",rowActionsAria:"More actions for {{name}}",uninstall:"Uninstall",verified:"Verified",unverified:"Unverified",toggleFailed:"Couldn't update the plugin's status. Please try again.",uninstallTitle:"Uninstall {{name}}?",uninstallDoneTitle:"{{name}} uninstalled",uninstallBody:"This removes the plugin from your site. You can reinstall it later, but any settings it stored may not carry over.",uninstallConfirm:"Uninstall plugin",uninstallCancel:"Cancel",uninstallClose:"Close",uninstalling:"Uninstalling…",uninstallStructuredBody:"This plugin stores structured data. A snapshot of its data was taken before deletion (snapshot {{snapshotGroupId}}). Its tables and their rows will be permanently deleted.",uninstallStructuredConfirm:"Delete data and uninstall",uninstallStructuredRestoreHint:"You can restore this data later from Data snapshots (group {{snapshotGroupId}}).",uninstallBundleStructuredBody:"This bundle stores structured data for the member plugins below. A snapshot of each was taken before deletion — their tables and rows will be permanently deleted.",uninstallBundleStructuredRestoreHint:"You can restore each member's data later from its own Data snapshots page:",uninstallBundleMemberSnapshot:"{{pluginId}} — snapshot {{snapshotGroupId}}",uninstallBlockedLeadIn:"These document types still have content:",uninstallBlockedItemWithCount_one:"{{documentType}} ({{count}} item)",uninstallBlockedItemWithCount_other:"{{documentType}} ({{count}} items)",uninstallBlockedItemNoCount:"{{documentType}}",uninstalledToast:"{{name}} uninstalled.",snapshotsTitle:"{{name}} — data snapshots",snapshotsAction:"Data snapshots",snapshotsScope:"Snapshots are copies of {{name}}'s structured tables, taken automatically before an operation that could delete them — like uninstalling the plugin. They aren't a general backup: only tables this plugin owns are captured.",snapshotsUnionCallout:"No single snapshot below is both complete and freshest. Restoring uses the union: the newest available copy of each table, across groups.",snapshotsColGroup:"Group",snapshotsColTaken:"Taken",snapshotsColTrigger:"Trigger",snapshotsColTables:"Tables",snapshotsColStatus:"Status",snapshotsTablesOf:"{{count}} of {{total}}",snapshotsStatusComplete:"Complete",snapshotsStatusPartial:"Partial",snapshotsTriggerUninstall:"Uninstall",snapshotsTriggerRestore:"Restore",snapshotsRestoreAction:"Restore data…",snapshotsRestoreTitle:"Restore {{name}} data?",snapshotsRestoreIntro:"This writes {{count}} tables, using the newest available copy of each:",snapshotsRestoreProvenance:"{{tables}} — from group {{group}} ({{when}})",snapshotsRestoreSafety:"Current {{name}} tables are snapshotted first, before being replaced — nothing is deleted without a copy.",snapshotsRestoreTypeLabel:'Type "restore" to confirm',snapshotsRestoreConfirm:"Restore {{count}} tables",snapshotsRestoring:"Restoring…",snapshotsRestoredToast:"Restored {{count}} tables.",snapshotsEmpty:"No data snapshots exist for this plugin yet.",snapshotsError:"Couldn't load data snapshots.",snapshotsLoading:"Loading data snapshots…",licenseNone:"No license required",licenseValid:"Valid",licenseCheckedAgo:"Checked {{time}}",licenseUnreachable:"License server unreachable — last valid {{time}}",licenseDomainMismatch:"Domain mismatch: bound to {{domain}} — reset the domain binding from the marketplace",licenseDomainMismatchBare:"Domain mismatch — reset the domain binding from the marketplace",licenseRevoked:"Revoked: {{reason}}",licenseRevokedBare:"Revoked",licenseRecheck:"Re-check",licenseRecheckFailed:"Couldn't re-check the license. Please try again.",licenseValidButDisabled:"License is valid. The plugin stays off until you turn it back on with the switch."},Tm={loading:"Loading…",loadMore:"Load more",empty:"No content yet.",emptyDescription:"Content you create will appear here.",newContent:"New content",toggle:"Toggle children of {{name}}",createChild:"Create under {{name}}",dragHandle:"Reorder {{name}}",reorderError:"Couldn't save the new order — reverted.",rowActionsAria:"More actions for {{name}}",deleteAction:"Delete",deleteTitle:'Delete "{{name}}"?',deleteBody:'This moves "{{name}}" and its {{count}} descendants to the trash. Content in the trash is restorable.',deleteConfirm:"Delete {{total}} items",deleteCancel:"Cancel",deletedToast:"Moved {{total}} items to the trash.",deleteError:`Couldn't delete "{{name}}" — nothing changed.`},km={title:"New content",typeLabel:"Document type",typeHelp:"Only page types allowed at the root are listed.",typePlaceholder:"Choose a document type…",nameLabel:"Name",nameHelp:"Will live at {{path}}",submit:"Create",creating:"Creating…",cancel:"Cancel",noTypes:"No page document types are allowed at the root yet — allow one in Document Types first.",createdToast:'"{{name}}" created.',genericError:"Something went wrong. Please try again.",underCrumb:"Create under {{name}}",atRootCrumb:"Create at the root",typeHelpChild:"Only types allowed under this parent are listed.",noTypesUnder:'No document types are allowed under "{{name}}".'},Rm={labelLabel:"Snapshot label",labelHelp:`e.g. "before bulk edit" — captures every content item's published state right now.`,createButton:"Create snapshot",creating:"Creating…",createdToast:'Snapshot "{{label}}" created.',empty:"No snapshots yet.",emptyDescription:"Create a snapshot before risky changes — you can restore the whole site's published state from it later.",restore:"Restore",restoring:"Restoring…",confirmTitle:'Restore "{{label}}"?',confirmBody:"This points every content item's published version back to how it was when this snapshot was taken. Nothing is deleted — drafts and versions created since stay in each item's history, and items created after this snapshot are left untouched.",confirmRestore:"Restore snapshot",cancel:"Cancel",restoredToast_one:'Restored "{{label}}" — {{count}} item repointed.',restoredToast_other:'Restored "{{label}}" — {{count}} items repointed.',loadMore:"Load more",genericError:"Something went wrong. Please try again."},Pm={newButton:"New user",createTitle:"Create a user",emailLabel:"Email",nameLabel:"Name",passwordLabel:"Password",passwordHelp:"At least 8 characters.",roleLabel:"Role",role:{admin:"Admin",editor:"Editor"},roleSelectLabel:"Change role for {{email}}",youHint:"That's you — ask another admin to change your role.",createButton:"Create user",creating:"Creating…",cancel:"Cancel",createdToast:"User {{email}} created.",roleChangedToast:"{{email}} is now {{role}}.",loadMore:"Load more",genericError:"Something went wrong. Please try again."},Dm={upload:"Upload files",uploading:"Uploading…",dropHint:"Drag and drop files here, or choose from your computer.",searchLabel:"Search",searchPlaceholder:"Search by filename…",empty:"No media yet.",emptyDescription:"Upload images and files to use them in your content.",noResults:'No files match "{{search}}".',uploadedToast:'"{{name}}" uploaded.',uploadFailedToast:'Upload failed for "{{name}}".',deletedToast:'"{{name}}" deleted.',delete:"Delete",deleteLabel:"Delete {{name}}",confirmBody:"This permanently deletes the file. It cannot be undone.",confirmDelete:"Delete permanently",cancel:"Cancel",loadMore:"Load more",genericError:"Something went wrong. Please try again.",privateLabel:"Private — requires sign-in or a temporary link",privateHelp:"A copy already saved by a visitor's browser or a CDN can keep working for up to a year even after you check this.",privateBadge:"Private",copyLink:"Copy temporary link",copyLinkLabel:"Copy temporary link for {{name}}",linkCopiedToast:"Temporary link copied to clipboard.",copyLinkFailedToast:"Could not create a temporary link."},Im={save:"Save draft",saving:"Saving…",publishing:"Publishing…",publishedToast:"Published version {{version}}.",historyTitle:"Version history",versionRow:"Version {{version}}",latestBadge:"Latest",view:"View",publishThis:"Publish this version",viewingVersion:"Viewing version {{version}} (read-only)",closeView:"Close",loadMore:"Load more",statusPublished:"Published",statusDraft:"Draft",statusUnpublishedChanges:"Unpublished changes",unsavedChanges:"Unsaved changes",savedToast:"Saved as version {{version}}.",savedToastDescription:"Every version is kept.",unpublishedSince:"Unpublished changes since v{{version}}",metaPublished:"Published {{when}}",railLabel:"Version history",railTickPublished:"Version {{version}}, published",railTickDraft:"Version {{version}}, draft",railHidden:"+{{count}}",railSaved:"saved {{when}}",railCount_one:"{{count}} version · Every version is kept.",railCount_other:"{{count}} versions · Every version is kept.",railCountSince_one:"{{count}} version since {{since}} · Every version is kept.",railCountSince_other:"{{count}} versions since {{since}} · Every version is kept.",railOpenHistory:"Open history",validationToast:"Fix the highlighted fields before saving.",loadError:"Couldn't load this content item.",loadErrorTitle:"Couldn't load this content",loadingTitle:"Loading content…",unknownDocumentType:"This item's document type isn't available.",genericError:"Something went wrong. Please try again.",saveAndPublish:"Publish",allSaved:"All changes saved",contentTab:"Content",infoTab:"Info & History",appsLabel:"Content apps",tabHasError:"Has an invalid field",infoDocumentType:"Document type",infoUrl:"URL",infoLocale:"Locale",infoLocaleDefault:"{{locale}} (default)",infoLastSaved:"Last saved",infoPublished:"Published",infoNotPublished:"Not published yet",previewButton:"Preview",previewNotConfigured:"Preview isn't configured for this site yet.",previewError:"Couldn't create a preview link. Please try again."},Lm={nameLabel:"Name",iconLabel:"Icon",iconHelp:"Shown next to content of this type. Leave the default for a plain document icon.",iconDefault:"Default (document icon)",kindLabel:"Kind",kind:{page:"Page",element:"Element"},tabsLabel:"Tabs",addTab:"Add tab",removeTab:"Remove tab",noTabs:"No tabs yet — fields render in a single default group.",tabNameLabel:"Tab name",addField:"Add field",removeField:"Remove",fieldKeyLabel:"Key",fieldNameLabel:"Label",fieldDatatypeLabel:"Datatype",fieldTabLabel:"Tab",fieldTabNone:"No tab",previewLabel:"Preview",dragHandle:"Drag to reorder",validationLabel:"Validation rules",validation:{required:"Required",minLength:"Min length",maxLength:"Max length",min:"Min",max:"Max",pattern:"Pattern",patternPlaceholder:"^[a-z0-9-]+$"},allowedAtRoot:"Allowed at root",allowedParentTypes:"Allowed parent types",allowedChildTypes:"Allowed child types",unnamedField:"Unnamed field",unnamedTab:"Unnamed tab",editField:"Edit",doneField:"Done",chip:{minLength:"min {{value}}",maxLength:"max {{value}}",min:"min {{value}}",max:"max {{value}}",pattern:"pattern"}},Am={noTemplates:"No templates yet for this document type.",nameLabel:"New template name",addButton:"Add template",adding:"Adding…",defaultBadge:"Default",setDefault:"Set as default",clearDefault:"Clear default",loadMore:"Load more",addedToast:'Template "{{name}}" added.',defaultSetToast:'"{{name}}" is now the default template.',defaultClearedToast:"Default template cleared.",genericError:"Something went wrong. Please try again."},Mm={generalTab:"General",tabListLabel:"Content tabs",unknownDatatype:`Unknown datatype "{{datatypeId}}" — the plugin that registers it isn't available.`,errors:{required:"This field is required.",minLength:"Must be at least {{minLength}} characters.",maxLength:"Must be no more than {{maxLength}} characters.",min:"Must be at least {{min}}.",max:"Must be no more than {{max}}.",pattern:"Doesn't match the required format."},help:{lengthRange:"Between {{min}} and {{max}} characters.",minLength:"At least {{min}} characters.",maxLength:"At most {{max}} characters.",range:"Between {{min}} and {{max}}.",min:"At least {{min}}.",max:"At most {{max}}."}},Om={title:"Sign in",subtitle:"Continue to the Velora admin.",tagline:"Every version of everything you write is kept.",emailLabel:"Email",passwordLabel:"Password",submit:"Sign in",submitting:"Signing in…",genericError:"Something went wrong. Please try again."},_m={title:"Set up Velora",subtitle:"Create the first admin account to get started.",emailLabel:"Email",nameLabel:"Name",passwordLabel:"Password",confirmPasswordLabel:"Confirm password",continue:"Continue",back:"Back",databaseStepTitle:"Choose your database",databaseStepSubtitle:"Pick where Velora stores its data.",dialectLabel:"Database type",filePathLabel:"File path",hostLabel:"Host",portLabel:"Port",databaseNameLabel:"Database name",usernameLabel:"Username",databasePasswordLabel:"Password",finish:"Finish setup",finishing:"Setting up…",starterSteps:"1 Admin account ✓ · 2 Database ✓ · 3 Starter",starterTitle:"Start from a template?",blankName:"Blank site",blankDescription:"Just the CMS — add document types yourself.",officialBadge:"Official",includeSampleContent:"Include sample content — a few posts you can explore and delete",installAndFinish:"Install {{name}} & finish",starterFailedWarning:"The {{name}} template could not be installed — your site is set up, and you can add it later from the marketplace.",completeTitle:"Setup complete",completeInstructions:"Restart the server, then reload this page to sign in.",submitError:"Something went wrong completing setup. Please check your database details and try again.",errors:{invalidEmail:"Enter a valid email address.",passwordTooShort:"Password must be at least 8 characters.",passwordMismatch:"Passwords do not match.",hostRequired:"Enter a host.",portInvalid:"Enter a valid port number.",databaseNameRequired:"Enter a database name.",usernameRequired:"Enter a username.",filePathRequired:"Enter a file path."}},Fm={welcomeTitle:"Select a content item",welcomeDescription:"Pick something from the tree, or create new content with the + button."},$m={recycleBin:"Recycle Bin",title:"Trash",empty:"Nothing in the trash.",loadFailed:"Couldn't load the trash.",retry:"Retry",nodeCount_one:"{{count}} item",nodeCount_other:"{{count}} items",deletedAt:"deleted {{when}}",unknownTime:"at an unknown time",orphanedBadge:"Orphaned",orphanedExplain:"Its original location no longer exists — restoring puts it at the top level.",restore:"Restore",restoreConfirm:"Confirm restore",restoreBlocked:'Restore "{{ancestor}}" first — it is still in the trash.',restoreFailed:"Could not restore. Try again."},Bm={documentTypes:"Document Types",dataTypes:"Data Types",templates:"Templates",apiKeys:"API Keys",apiPlayground:"API Playground",noTemplates:"No templates yet.",system:"System",noDocumentTypes:"No document types yet — create one with the + above.",welcomeTitle:"Settings",welcomeDescription:"Pick a document type, data type, or template from the tree — or create a new one.",itemLoading:"Loading…",itemNotFoundTitle:"Not found",itemNotFoundDescription:"This item is no longer available."},Um={all:"All media"},zm={all:"All users"},jm={designTab:"Design",templatesTab:"Templates",structureTab:"Structure",panesLabel:"Document type apps",createTitle:"New document type",newDocumentType:"New document type",allowedAtRootBadge:"Allowed at root",tabGroupTitle:"{{name}} tab",generalGroupTitle:"General (no tab)",fieldsTitle:"Fields",noFieldsInGroup:"No fields in this group yet.",emptyMeansAny:"Leave empty to allow any type.",templatesTitle:"Templates for {{name}}",templatesInertNote:"Templates are inert data in v1.0 — rendering arrives with the template engine after launch. The selected default travels with the headless API response.",save:"Save",saving:"Saving…",createdToast:'"{{name}}" created.',savedToast:'"{{name}}" saved.',genericError:"Something went wrong. Please try again.",delete:"Delete",deleting:"Deleting…",deletedToast:'"{{name}}" deleted.',deleteConfirmTitle:'Delete "{{name}}"?',deleteConfirmBody:"This can't be undone. Blocked if any content or templates still use this document type.",deleteCancel:"Cancel",deleteConfirm:"Delete"},Vm={createTitle:"New data type",newDataType:"New data type",nameLabel:"Name",nameHelp:"How this data type appears when building document types.",editorLabel:"Property editor",editorHelp:"The input control this data type configures. New editors come from plugins.",editorImmutableHelp:"The property editor is fixed after creation — create a new data type to use a different editor.",editorPlaceholder:"Choose a property editor…",settingsTitle:"Editor settings",settingsHelp:"Provided by the {{editor}} editor.",noSettings:"The {{editor}} editor has no configurable settings yet.",usedBy_one:"Used by {{count}} document type: {{list}}. Changing this data type applies everywhere it is used.",usedBy_other:"Used by {{count}} document types: {{list}}. Changing this data type applies everywhere it is used.",save:"Save",saving:"Saving…",createdToast:'"{{name}}" created.',savedToast:'"{{name}}" saved.',genericError:"Something went wrong. Please try again."},Hm={contentTitle:"This is a content URL",contentBody:"This Velora instance is headless — content URLs don't render pages. The content lives in the API and in the editor.",apiUrlLabel:"Headless API URL (requires an API key)",openInEditor:"Open in editor",notFoundTitle:"Nothing exists at this URL",notFoundBody:"No admin page or content matches this address.",backToContent:"Go to Content",resolving:"Checking this URL…"},Km={common:pm,a11y:hm,apiKeys:mm,apiPlayground:gm,app:ym,theme:vm,userMenu:bm,appearance:xm,nav:wm,toast:Cm,pluginBoundary:Nm,pluginSection:Sm,pluginsManage:Em,contentTree:Tm,contentCreate:km,snapshots:Rm,users:Pm,mediaLibrary:Dm,contentEditor:Im,documentTypeBuilder:Lm,templatePicker:Am,documentTypeForm:Mm,login:Om,setup:_m,contentSection:Fm,trash:$m,settingsTree:Bm,mediaTree:Um,usersTree:zm,documentTypeEditor:jm,dataTypeEditor:Vm,headlessBridge:Hm};$e.use(im).init({resources:{en:{translation:Km}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});function Od(e){typeof document>"u"||(document.documentElement.lang=e,document.documentElement.dir=$e.dir(e))}$e.on("languageChanged",Od);Od($e.language);const je={color:{primary:{50:"#EAF4FB",100:"#CFE6F6",200:"#A9D5F0",300:"#7CC0E8",400:"#4E9CCB",500:"#2A82BC",600:"#1F6FA8",700:"#1A5E8F",800:"#154D75",900:"#113D5C",950:"#0B2A40"},secondary:{50:"#F0F0FA",100:"#E9E9F8",200:"#D3D4F1",300:"#B4B6E6",400:"#8F92D8",500:"#5B5FC7",600:"#4B4FB0",700:"#3E4194",800:"#333676",900:"#282A5C",950:"#181A3A"},success:{50:"#EEF5EB",100:"#E4F0DF",200:"#C6E0BD",300:"#9CC78E",400:"#6CA85C",500:"#4E9340",600:"#3B7D2E",700:"#306626",800:"#27521F",900:"#1F4119",950:"#122A0E"},warning:{50:"#FBF5E8",100:"#F7EBD2",200:"#EFD8A6",300:"#E4BF72",400:"#D6A245",500:"#C98E2D",600:"#B7791F",700:"#96631A",800:"#764E15",900:"#5B3C11",950:"#3B260A"},danger:{50:"#FBEFEE",100:"#F6E0DE",200:"#EEC3BF",300:"#E39B95",400:"#D66E66",500:"#C94F46",600:"#B93A32",700:"#9A2F29",800:"#7B2621",900:"#611E1A",950:"#3F120F"},neutral:{50:"#FAF9F5",100:"#F3F1EB",200:"#ECEAE3",300:"#E1DED5",400:"#CFCBC0",500:"#8C9490",600:"#5C6663",700:"#3E4644",800:"#2A3230",900:"#1B2321",950:"#111614"},background:{base:"#F3F1EB",elevated:"#FFFFFF",subtle:"#FAF9F5",overlay:"rgba(27, 35, 33, 0.5)",hover:"#F0EEE7"},text:{primary:"#1B2321",secondary:"#5C6663",tertiary:"#616966",disabled:"#8C9490",inverse:"#FFFFFF"},border:{default:"#E1DED5",subtle:"#ECEAE3",strong:"#CFCBC0"}},typography:{fontSize:{xs:"0.75rem",sm:"0.8125rem",base:"0.875rem",lg:"1rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{0:"0",px:"1px",1:"0.25rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",72:"18rem"},radius:{none:"0",sm:"0.375rem",md:"0.5rem",lg:"0.75rem",xl:"1rem",full:"9999px"},shadow:{sm:"0 1px 2px 0 rgba(43, 38, 24, 0.06)",md:"0 1px 2px 0 rgba(43, 38, 24, 0.05), 0 6px 18px 0 rgba(43, 38, 24, 0.07)",lg:"0 2px 4px 0 rgba(43, 38, 24, 0.06), 0 16px 40px 0 rgba(43, 38, 24, 0.12)",xl:"0 4px 8px 0 rgba(43, 38, 24, 0.08), 0 24px 56px 0 rgba(43, 38, 24, 0.16)"},motion:{duration:{fast:"150ms",normal:"250ms",slow:"400ms"},easing:{standard:"cubic-bezier(0.4, 0, 0.2, 1)",enter:"cubic-bezier(0, 0, 0.2, 1)",exit:"cubic-bezier(0.4, 0, 1, 1)"}}};function Ve(e,t){const n={};for(const r of Object.keys(e))n[r]=`var(--${t}-${r})`;return n}Ve(je.color.primary,"color-primary"),Ve(je.color.secondary,"color-secondary"),Ve(je.color.success,"color-success"),Ve(je.color.warning,"color-warning"),Ve(je.color.danger,"color-danger"),Ve(je.color.neutral,"color-neutral"),Ve(je.color.background,"color-background"),Ve(je.color.text,"color-text"),Ve(je.color.border,"color-border"),Ve(je.typography.fontSize,"font-size"),Ve(je.typography.fontWeight,"font-weight"),Ve(je.typography.lineHeight,"line-height"),Ve(je.spacing,"spacing"),Ve(je.radius,"radius"),Ve(je.shadow,"shadow"),Ve(je.motion.duration,"motion-duration"),Ve(je.motion.easing,"motion-easing");function Wm(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function _d(e,t,n){if(typeof e=="object"&&e!==null)for(const[r,a]of Object.entries(e))_d(a,[...t,Wm(r)],n);else n[`--${t.join("-")}`]=String(e)}const Ll=new RegExp("[{};\\u0000-\\u001f\\u007f]");function qm(e,t){const n={};_d(t,[],n);const r=Object.entries(n).filter(([a,o])=>Ll.test(a)||Ll.test(o)?(console.warn(`themeOverridesToCss: skipping unsafe token "${a}" for theme "${e}" (contains CSS-escaping characters)`),!1):!0);return r.length===0?"":[`[data-theme="${e}"] {`,...r.map(([a,o])=>` ${a}: ${o};`),"}"].join(`
2
+ `)}const Gm={id:"light",name:"Light",type:"theme",contributions:{themeTokens:{}}},Ym={id:"dark",name:"Dark",type:"theme",contributions:{themeTokens:{color:{background:{base:"#1A1C1B",elevated:"#232625",subtle:"#1F2221",overlay:"rgba(0, 0, 0, 0.6)",hover:"#2C302E"},text:{primary:"#ECEAE3",secondary:"#A3A8A6",tertiary:"#969C99",disabled:"#6F7573",inverse:"#14181B"},border:{default:"#33373A",subtle:"#2C302E",strong:"#444A4D"},primary:{50:"#1D2A34",100:"#22364A",200:"#2A4A66",300:"#7CC0E8",600:"#7CC0E8",700:"#9AD0EE",800:"#BFE1F5"},secondary:{100:"#2A2C46",500:"#9A9DE3",600:"#9A9DE3"},success:{100:"#223A1E",600:"#7FC46E",700:"#8FD07F"},warning:{100:"#3D3016",600:"#E0AA4B",800:"#EABB6A"},danger:{100:"#45201D",600:"#E8776E",700:"#F0918A"},neutral:{50:"#1F2221",100:"#232625",200:"#2C302E",300:"#33373A",400:"#444A4D",500:"#6F7573",600:"#A3A8A6",700:"#C5C9C6",800:"#DAD9D3",900:"#ECEAE3",950:"#F5F4F0"}}}}},Xm=[Gm,Ym],Fd="velora-theme",Al="velora-theme-mode",Ml="velora-runtime-themes",Jm=new Set(Xm.map(e=>e.id));function Ol(e){return e==="light"||e==="dark"||e==="system"}function Zm(e){return{mode:e,themeId:null,css:""}}function $r(){const e=localStorage.getItem(Fd);if(e!==null)try{const r=JSON.parse(e);if(r&&typeof r=="object"){const{mode:a,themeId:o,css:s}=r;return{mode:Ol(a)?a:"system",themeId:typeof o=="string"&&o!==""?o:null,css:typeof s=="string"?s:""}}}catch{}const t=localStorage.getItem(Al),n=Zm(Ol(t)?t:"system");return Qa(n),t!==null&&localStorage.removeItem(Al),n}function Qa(e){localStorage.setItem(Fd,JSON.stringify(e))}let Pn=null;function us(){const{mode:e,themeId:t}=$r();return Pn&&Pn.mode===e&&Pn.themeId===t||(Pn={mode:e,themeId:t}),Pn}const fs=new Set;function $d(e){return fs.add(e),()=>{fs.delete(e)}}function Ys(){for(const e of fs)e()}function Bd(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ud(e){const t=e==="system"?Bd():e;return Jm.has(t)?t:"light"}function ps(e){document.documentElement.dataset.theme=e}function Xs(e){ps(e.themeId??Ud(e.mode))}function zd(e){let t=document.getElementById(Ml);t||(t=document.createElement("style"),t.id=Ml,document.head.appendChild(t)),t.textContent=e}function Qm(e){const n={...$r(),mode:e};Qa(n),n.themeId===null&&Xs(n),Ys()}function jd(e){const n={...$r(),themeId:e};Qa(n),Xs(n),Ys()}function eg(e){const n={...$r(),css:e};Qa(n),zd(e),Ys()}function tg(){const e=$r();zd(e.css),Xs(e)}function ng(e){return e.type==="datatype"||e.type==="section"?e.contributions.dataTypes??[]:[]}function rg(e){return e.type==="section"?e.contributions.adminSections??[]:[]}async function ag(e){yh([{name:e.name,entry:e.url,type:"module"}]);const t=await vh(`${e.name}${e.module??"/plugin"}`);if(!t||typeof t!="object"||!("default"in t)||!t.default)throw new Error(`Remote "${e.name}" (${e.url}) did not default-export a plugin from its exposed module`);return t.default}function og(e){return ng(e).map(t=>{const n=bh(t),r=xa(n.id);return r||(xh(n),n)})}function sg(e){const t=rg(e);for(const n of t)Sd(n.id)||wh(n);return t}async function ig(){}/**
3
3
  * react-router v8.3.1
4
4
  *
5
5
  * Copyright (c) Remix Software Inc.
@@ -8,7 +8,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
8
8
  * LICENSE.md file in the root directory of this source tree.
9
9
  *
10
10
  * @license MIT
11
- */const Js=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,jd=/^[\\/]{2}/;function lg(e,t){return t+e.replace(/\\/g,"/")}/**
11
+ */const Js=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Vd=/^[\\/]{2}/;function lg(e,t){return t+e.replace(/\\/g,"/")}/**
12
12
  * react-router v8.3.1
13
13
  *
14
14
  * Copyright (c) Remix Software Inc.
@@ -17,7 +17,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
17
17
  * LICENSE.md file in the root directory of this source tree.
18
18
  *
19
19
  * @license MIT
20
- */const _l="popstate";function Fl(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function cg(e={}){function t(r,a){var d;let o=(d=a.state)==null?void 0:d.masked,{pathname:s,search:l,hash:c}=o||r.location;return hs("",{pathname:s,search:l,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,a){return typeof a=="string"?a:vn(a)}return ug(t,n,null,e)}function Se(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Kt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function dg(){return Math.random().toString(36).substring(2,10)}function $l(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function hs(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Gn(t):t,state:n,key:t&&t.key||r||dg(),mask:a}}function vn({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Gn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ug(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:o=!1}=r,s=a.history,l="POP",c=null,d=f();d==null&&(d=0,s.replaceState({...s.state,idx:d},""));function f(){return(s.state||{idx:null}).idx}function u(){l="POP";let y=f(),w=y==null?null:y-d;d=y,c&&c({action:l,location:g.location,delta:w})}function p(y,w){l="PUSH";let b=Fl(y)?y:hs(g.location,y,w);d=f()+1;let v=$l(b,d),C=g.createHref(b.mask||b);try{s.pushState(v,"",C)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;a.location.assign(C)}o&&c&&c({action:l,location:g.location,delta:1})}function m(y,w){l="REPLACE";let b=Fl(y)?y:hs(g.location,y,w);d=f();let v=$l(b,d),C=g.createHref(b.mask||b);s.replaceState(v,"",C),o&&c&&c({action:l,location:g.location,delta:0})}function h(y){return fg(a,y)}let g={get action(){return l},get location(){return e(a,s)},listen(y){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(_l,u),c=y,()=>{a.removeEventListener(_l,u),c=null}},createHref(y){return t(a,y)},createURL:h,encodeLocation(y){let w=h(y);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:p,replace:m,go(y){return s.go(y)}};return g}function fg(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Se(r,"No window.location.(origin|href) available to create URL");let a=typeof t=="string"?t:vn(t);return a=a.replace(/ $/,"%20"),!n&&jd.test(a)&&(a=r+a),new URL(a,r)}/**
20
+ */const _l="popstate";function Fl(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function cg(e={}){function t(r,a){var d;let o=(d=a.state)==null?void 0:d.masked,{pathname:s,search:l,hash:c}=o||r.location;return hs("",{pathname:s,search:l,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,a){return typeof a=="string"?a:vn(a)}return ug(t,n,null,e)}function Ee(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Kt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function dg(){return Math.random().toString(36).substring(2,10)}function $l(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function hs(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Gn(t):t,state:n,key:t&&t.key||r||dg(),mask:a}}function vn({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Gn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ug(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:o=!1}=r,s=a.history,l="POP",c=null,d=f();d==null&&(d=0,s.replaceState({...s.state,idx:d},""));function f(){return(s.state||{idx:null}).idx}function u(){l="POP";let y=f(),w=y==null?null:y-d;d=y,c&&c({action:l,location:g.location,delta:w})}function p(y,w){l="PUSH";let b=Fl(y)?y:hs(g.location,y,w);d=f()+1;let v=$l(b,d),C=g.createHref(b.mask||b);try{s.pushState(v,"",C)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;a.location.assign(C)}o&&c&&c({action:l,location:g.location,delta:1})}function m(y,w){l="REPLACE";let b=Fl(y)?y:hs(g.location,y,w);d=f();let v=$l(b,d),C=g.createHref(b.mask||b);s.replaceState(v,"",C),o&&c&&c({action:l,location:g.location,delta:0})}function h(y){return fg(a,y)}let g={get action(){return l},get location(){return e(a,s)},listen(y){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(_l,u),c=y,()=>{a.removeEventListener(_l,u),c=null}},createHref(y){return t(a,y)},createURL:h,encodeLocation(y){let w=h(y);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:p,replace:m,go(y){return s.go(y)}};return g}function fg(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Ee(r,"No window.location.(origin|href) available to create URL");let a=typeof t=="string"?t:vn(t);return a=a.replace(/ $/,"%20"),!n&&Vd.test(a)&&(a=r+a),new URL(a,r)}/**
21
21
  * react-router v8.3.1
22
22
  *
23
23
  * Copyright (c) Remix Software Inc.
@@ -26,7 +26,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
26
26
  * LICENSE.md file in the root directory of this source tree.
27
27
  *
28
28
  * @license MIT
29
- */function Vd(e,t,n="/"){return pg(e,t,n,!1)}function pg(e,t,n,r,a){let o=ln((typeof t=="string"?Gn(t):t).pathname||"/",n);if(o==null)return null;let s=hg(e),l=null,c=Gd(o);for(let d=0;l==null&&d<s.length;++d)l=Tg(s[d],c,r);return l}function hg(e){let t=Hd(e);return mg(t),t}function Hd(e,t=[],n=[],r="",a=!1){let o=(s,l,c=a,d)=>{let f={relativePath:d===void 0?s.path||"":d,caseSensitive:s.caseSensitive===!0,childrenIndex:l,route:s};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&c)return;Se(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let u=ht([r,f.relativePath]),p=n.concat(f);s.children&&s.children.length>0&&(Se(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),Hd(s.children,t,p,u,c)),!(s.path==null&&!s.index)&&t.push({path:u,score:Eg(u,s.index),routesMeta:p.map((m,h)=>{let[g,y]=qd(m.relativePath,m.caseSensitive,h===p.length-1);return{...m,matcher:g,compiledParams:y}})})};return e.forEach((s,l)=>{var c;if(s.path===""||!((c=s.path)!=null&&c.includes("?")))o(s,l);else for(let d of Kd(s.path))o(s,l,!0,d)}),t}function Kd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return a?[o,""]:[o];let s=Kd(r.join("/")),l=[];return l.push(...s.map(c=>c===""?o:[o,c].join("/"))),a&&l.push(...s),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function mg(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Sg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const gg=/^:[\w-]+$/,yg=/^:[\w-]+/,vg=3.5,bg=3,xg=2,wg=1,Cg=10,Ng=-2,Bl=e=>e==="*";function Eg(e,t){let n=e.split("/"),r=n.length;return n.some(Bl)&&(r+=Ng),t&&(r+=xg),n.filter(a=>!Bl(a)).reduce((a,o)=>a+(gg.test(o)?bg:yg.test(o)?vg:o===""?wg:Cg),r)}function Sg(e,t){return e.length===t.length&&e.slice(0,-1).every((n,r)=>n===t[r])?e[e.length-1]-t[t.length-1]:0}function Tg(e,t,n=!1){let{routesMeta:r}=e,a={},o="/",s=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,f=o==="/"?t:t.slice(o.length)||"/",u={path:c.relativePath,caseSensitive:c.caseSensitive,end:d},p=c.matcher&&c.compiledParams?Wd(u,f,c.matcher,c.compiledParams):Pr(u,f),m=c.route;if(!p&&d&&n&&!r[r.length-1].route.index&&(p=Pr({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},f)),!p)return null;Object.assign(a,p.params),s.push({params:a,pathname:ht([o,p.pathname]),pathnameBase:Pg(ht([o,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(o=ht([o,p.pathnameBase]))}return s}function Pr(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=qd(e.path,e.caseSensitive,e.end);return Wd(e,t,n,r)}function Wd(e,t,n,r){let a=t.match(n);if(!a)return null;let o=a[0],s=Ea(o,1),l=a.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:f},u)=>{if(d==="*"){let m=l[u]||"";s=Ea(o.slice(0,o.length-m.length),1)}const p=l[u];return f&&!p?c[d]=void 0:c[d]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:o,pathnameBase:s,pattern:e}}function qd(e,t=!1,n=!0){Kt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,s,l,c,d)=>{if(r.push({paramName:s,isOptional:l!=null}),l){let f=d.charAt(c+o.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,"(?:/$1)?");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function Gd(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Kt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ln(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function kg(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Gn(e):e,o;return n?(n=Yd(n),n.startsWith("/")||n.startsWith("\\")?o=Ul(n.substring(1),"/"):o=Ul(n,t)):o=t,{pathname:o,search:Dg(r),hash:Ig(a)}}function Ul(e,t){let n=Ea(t).split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function Ro(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Rg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Zs(e){let t=Rg(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function eo(e,t,n,r=!1){let a;typeof e=="string"?a=Gn(e):(a={...e},Se(!a.pathname||!a.pathname.includes("?"),Ro("?","pathname","search",a)),Se(!a.pathname||!a.pathname.includes("#"),Ro("#","pathname","hash",a)),Se(!a.search||!a.search.includes("#"),Ro("#","search","hash",a)));let o=e===""||a.pathname==="",s=o?"/":a.pathname,l;if(s==null)l=n;else{let u=t.length-1;if(!r&&s.startsWith("..")){let p=s.split("/");for(;p[0]==="..";)p.shift(),u-=1;a.pathname=p.join("/")}l=u>=0?t[u]:"/"}let c=kg(a,l),d=s&&s!=="/"&&s.endsWith("/"),f=(o||s===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||f)&&(c.pathname+="/"),c}const Yd=e=>e.replace(/[\\/]{2,}/g,"/"),ht=e=>Yd(e.join("/"));function Ea(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}const Pg=e=>Ea(e).replace(/^\/*/,"/"),Dg=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ig=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var Lg=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Ag(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Mg(e){return ht(e.map(t=>t.route.path).filter(Boolean))||"/"}const Xd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Jd(e,t){let n=e;if(typeof n!="string"||!Js.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(Xd)try{let o=new URL(window.location.href),s=jd.test(n)?new URL(lg(n,o.protocol)):new URL(n),l=ln(s.pathname,t);s.origin===o.origin&&l!=null?n=l+s.search+s.hash:a=!0}catch{Kt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}/**
29
+ */function Hd(e,t,n="/"){return pg(e,t,n,!1)}function pg(e,t,n,r,a){let o=ln((typeof t=="string"?Gn(t):t).pathname||"/",n);if(o==null)return null;let s=hg(e),l=null,c=Yd(o);for(let d=0;l==null&&d<s.length;++d)l=Tg(s[d],c,r);return l}function hg(e){let t=Kd(e);return mg(t),t}function Kd(e,t=[],n=[],r="",a=!1){let o=(s,l,c=a,d)=>{let f={relativePath:d===void 0?s.path||"":d,caseSensitive:s.caseSensitive===!0,childrenIndex:l,route:s};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&c)return;Ee(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let u=ht([r,f.relativePath]),p=n.concat(f);s.children&&s.children.length>0&&(Ee(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),Kd(s.children,t,p,u,c)),!(s.path==null&&!s.index)&&t.push({path:u,score:Sg(u,s.index),routesMeta:p.map((m,h)=>{let[g,y]=Gd(m.relativePath,m.caseSensitive,h===p.length-1);return{...m,matcher:g,compiledParams:y}})})};return e.forEach((s,l)=>{var c;if(s.path===""||!((c=s.path)!=null&&c.includes("?")))o(s,l);else for(let d of Wd(s.path))o(s,l,!0,d)}),t}function Wd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return a?[o,""]:[o];let s=Wd(r.join("/")),l=[];return l.push(...s.map(c=>c===""?o:[o,c].join("/"))),a&&l.push(...s),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function mg(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Eg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const gg=/^:[\w-]+$/,yg=/^:[\w-]+/,vg=3.5,bg=3,xg=2,wg=1,Cg=10,Ng=-2,Bl=e=>e==="*";function Sg(e,t){let n=e.split("/"),r=n.length;return n.some(Bl)&&(r+=Ng),t&&(r+=xg),n.filter(a=>!Bl(a)).reduce((a,o)=>a+(gg.test(o)?bg:yg.test(o)?vg:o===""?wg:Cg),r)}function Eg(e,t){return e.length===t.length&&e.slice(0,-1).every((n,r)=>n===t[r])?e[e.length-1]-t[t.length-1]:0}function Tg(e,t,n=!1){let{routesMeta:r}=e,a={},o="/",s=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,f=o==="/"?t:t.slice(o.length)||"/",u={path:c.relativePath,caseSensitive:c.caseSensitive,end:d},p=c.matcher&&c.compiledParams?qd(u,f,c.matcher,c.compiledParams):Pr(u,f),m=c.route;if(!p&&d&&n&&!r[r.length-1].route.index&&(p=Pr({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},f)),!p)return null;Object.assign(a,p.params),s.push({params:a,pathname:ht([o,p.pathname]),pathnameBase:Pg(ht([o,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(o=ht([o,p.pathnameBase]))}return s}function Pr(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Gd(e.path,e.caseSensitive,e.end);return qd(e,t,n,r)}function qd(e,t,n,r){let a=t.match(n);if(!a)return null;let o=a[0],s=Sa(o,1),l=a.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:f},u)=>{if(d==="*"){let m=l[u]||"";s=Sa(o.slice(0,o.length-m.length),1)}const p=l[u];return f&&!p?c[d]=void 0:c[d]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:o,pathnameBase:s,pattern:e}}function Gd(e,t=!1,n=!0){Kt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,s,l,c,d)=>{if(r.push({paramName:s,isOptional:l!=null}),l){let f=d.charAt(c+o.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,"(?:/$1)?");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function Yd(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Kt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ln(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function kg(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Gn(e):e,o;return n?(n=Xd(n),n.startsWith("/")||n.startsWith("\\")?o=Ul(n.substring(1),"/"):o=Ul(n,t)):o=t,{pathname:o,search:Dg(r),hash:Ig(a)}}function Ul(e,t){let n=Sa(t).split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function Ro(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Rg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Zs(e){let t=Rg(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function eo(e,t,n,r=!1){let a;typeof e=="string"?a=Gn(e):(a={...e},Ee(!a.pathname||!a.pathname.includes("?"),Ro("?","pathname","search",a)),Ee(!a.pathname||!a.pathname.includes("#"),Ro("#","pathname","hash",a)),Ee(!a.search||!a.search.includes("#"),Ro("#","search","hash",a)));let o=e===""||a.pathname==="",s=o?"/":a.pathname,l;if(s==null)l=n;else{let u=t.length-1;if(!r&&s.startsWith("..")){let p=s.split("/");for(;p[0]==="..";)p.shift(),u-=1;a.pathname=p.join("/")}l=u>=0?t[u]:"/"}let c=kg(a,l),d=s&&s!=="/"&&s.endsWith("/"),f=(o||s===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||f)&&(c.pathname+="/"),c}const Xd=e=>e.replace(/[\\/]{2,}/g,"/"),ht=e=>Xd(e.join("/"));function Sa(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}const Pg=e=>Sa(e).replace(/^\/*/,"/"),Dg=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ig=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var Lg=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Ag(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Mg(e){return ht(e.map(t=>t.route.path).filter(Boolean))||"/"}const Jd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Zd(e,t){let n=e;if(typeof n!="string"||!Js.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(Jd)try{let o=new URL(window.location.href),s=Vd.test(n)?new URL(lg(n,o.protocol)):new URL(n),l=ln(s.pathname,t);s.origin===o.origin&&l!=null?n=l+s.search+s.hash:a=!0}catch{Kt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}/**
30
30
  * react-router v8.3.1
31
31
  *
32
32
  * Copyright (c) Remix Software Inc.
@@ -44,7 +44,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
44
44
  * LICENSE.md file in the root directory of this source tree.
45
45
  *
46
46
  * @license MIT
47
- */const Zd=["POST","PUT","PATCH","DELETE"];new Set(Zd);const _g=["GET",...Zd];new Set(_g);const Fg=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function $g(e){try{return Fg.includes(new URL(e).protocol)}catch{return!1}}/**
47
+ */const Qd=["POST","PUT","PATCH","DELETE"];new Set(Qd);const _g=["GET",...Qd];new Set(_g);const Fg=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function $g(e){try{return Fg.includes(new URL(e).protocol)}catch{return!1}}/**
48
48
  * react-router v8.3.1
49
49
  *
50
50
  * Copyright (c) Remix Software Inc.
@@ -53,7 +53,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
53
53
  * LICENSE.md file in the root directory of this source tree.
54
54
  *
55
55
  * @license MIT
56
- */const Yn=Te(null);Yn.displayName="DataRouter";const to=Te(null);to.displayName="DataRouterState";const Qd=Te(!1);function Bg(){return ne(Qd)}const eu=Te({isTransitioning:!1});eu.displayName="ViewTransition";const Ug=Te(new Map);Ug.displayName="Fetchers";const zg=Te(null);zg.displayName="Await";const pt=Te(null);pt.displayName="Navigation";const Br=Te(null);Br.displayName="Location";const gt=Te({outlet:null,matches:[],isDataRoute:!1});gt.displayName="Route";const ti=Te(null);ti.displayName="RouteError";/**
56
+ */const Yn=Te(null);Yn.displayName="DataRouter";const to=Te(null);to.displayName="DataRouterState";const eu=Te(!1);function Bg(){return ne(eu)}const tu=Te({isTransitioning:!1});tu.displayName="ViewTransition";const Ug=Te(new Map);Ug.displayName="Fetchers";const zg=Te(null);zg.displayName="Await";const pt=Te(null);pt.displayName="Navigation";const Br=Te(null);Br.displayName="Location";const gt=Te({outlet:null,matches:[],isDataRoute:!1});gt.displayName="Route";const ti=Te(null);ti.displayName="RouteError";/**
57
57
  * react-router v8.3.1
58
58
  *
59
59
  * Copyright (c) Remix Software Inc.
@@ -62,7 +62,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
62
62
  * LICENSE.md file in the root directory of this source tree.
63
63
  *
64
64
  * @license MIT
65
- */const tu="REACT_ROUTER_ERROR",jg="REDIRECT",Vg="ROUTE_ERROR_RESPONSE";function Hg(e){if(e.startsWith(`${tu}:${jg}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Kg(e){if(e.startsWith(`${tu}:${Vg}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Lg(t.status,t.statusText,t.data)}catch{}}/**
65
+ */const nu="REACT_ROUTER_ERROR",jg="REDIRECT",Vg="ROUTE_ERROR_RESPONSE";function Hg(e){if(e.startsWith(`${nu}:${jg}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Kg(e){if(e.startsWith(`${nu}:${Vg}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Lg(t.status,t.statusText,t.data)}catch{}}/**
66
66
  * react-router v8.3.1
67
67
  *
68
68
  * Copyright (c) Remix Software Inc.
@@ -71,7 +71,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
71
71
  * LICENSE.md file in the root directory of this source tree.
72
72
  *
73
73
  * @license MIT
74
- */function Wg(e,{relative:t}={}){Se(Nn(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=ne(pt),{hash:a,pathname:o,search:s}=Ur(e,{relative:t}),l=o;return n!=="/"&&(l=o==="/"?n:ht([n,o])),r.createHref({pathname:l,search:s,hash:a})}function Nn(){return ne(Br)!=null}function Xe(){return Se(Nn(),"useLocation() may be used only in the context of a <Router> component."),ne(Br).location}function _t(e){Se(Nn(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=Xe();return Q(()=>Pr(e,Gd(t)),[t,e])}const nu="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Wt(){let{isDataRoute:e}=ne(gt);return e?sy():qg()}function qg(){Se(Nn(),"useNavigate() may be used only in the context of a <Router> component.");let e=ne(Yn),{basename:t,navigator:n}=ne(pt),{matches:r}=ne(gt),{pathname:a}=Xe(),o=JSON.stringify(Zs(r)),s=M(!1);return Wn(()=>{s.current=!0}),H((l,c={})=>{if(Kt(s.current,nu),!s.current)return;if(typeof l=="number"){n.go(l);return}let d=eo(l,JSON.parse(o),a,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:ht([t,d.pathname])),ei(typeof l=="string"?l:vn(l),n.createHref(d),Qs(n),"reject"),(c.replace?n.replace:n.push)(d,c.state,c)},[t,n,o,a,e])}Te(null);function Xn(){var t;let{matches:e}=ne(gt);return((t=e[e.length-1])==null?void 0:t.params)??{}}function Ur(e,{relative:t}={}){let{matches:n}=ne(gt),{pathname:r}=Xe(),a=JSON.stringify(Zs(n));return Q(()=>eo(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function Gg(e,t){return ru(e,t)}function ru(e,t,n){var h;Se(Nn(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=ne(pt),{matches:a}=ne(gt),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=Xe(),d;if(t){let g=typeof t=="string"?Gn(t):t;Se(l==="/"||((h=g.pathname)==null?void 0:h.startsWith(l)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${g.pathname}" was given in the \`location\` prop.`),d=g}else d=c;let f=d.pathname||"/",u=f;if(l!=="/"){let g=l.replace(/^\//,"").split("/");u="/"+f.replace(/^\//,"").split("/").slice(g.length).join("/")}let p=n&&n.state.matches.length?n.state.matches.map(g=>Object.assign(g,{route:n.manifest[g.route.id]||g.route})):Vd(e,{pathname:u}),m=ey(p&&p.map(g=>Object.assign({},g,{params:Object.assign({},s,g.params),pathname:ht([l,r.encodeLocation?r.encodeLocation(g.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?l:ht([l,r.encodeLocation?r.encodeLocation(g.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathnameBase])})),a,n);return t&&m?ie(Br.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},m):m}function Yg(){let e=oy(),t=Ag(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return ie(fn,null,ie("h2",null,"Unexpected Application Error!"),ie("h3",{style:{fontStyle:"italic"}},t),n?ie("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"}},n):null,null)}const Xg=ie(Yg,null);var Jg=class extends bd{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=Qd;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Kg(e.digest);n&&(e=n)}let t=e!==void 0?ie(gt.Provider,{value:this.props.routeContext},ie(ti.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?ie(Zg,{error:e},t):t}};const Do=new WeakMap;function Zg({children:e,error:t}){let{basename:n,navigator:r}=ne(pt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=Hg(t.digest);if(a){let o=Do.get(t);if(o)throw o;let s=Jd(a.location,n),l=s.absoluteURL||s.to;if(ei(a.location,l,Qs(r),"allow-explicit"),$g(l))throw new Error("Invalid redirect location");if(Xd&&!Do.get(t))if(s.isExternal||a.reloadDocument)window.location.href=l;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:a.replace}));throw Do.set(t,c),c}return ie("meta",{httpEquiv:"refresh",content:`0;url=${l}`})}}return e}function Qg({routeContext:e,match:t,children:n}){let r=ne(Yn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),ie(gt.Provider,{value:e},n)}function ey(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,o=r==null?void 0:r.errors;if(o!=null){let f=a.findIndex(u=>u.route.id&&(o==null?void 0:o[u.route.id])!==void 0);Se(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,f+1))}let s=!1,l=-1;if(n&&r){s=r.renderFallback;for(let f=0;f<a.length;f++){let u=a[f];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(l=f),u.route.id){let{loaderData:p,errors:m}=r,h=u.route.loader&&!p.hasOwnProperty(u.route.id)&&(!m||m[u.route.id]===void 0);if(u.route.lazy||h){n.isStatic&&(s=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,d=r&&c?(f,u)=>{var p,m;c(f,{location:r.location,params:((m=(p=r.matches)==null?void 0:p[0])==null?void 0:m.params)??{},pattern:Mg(r.matches),errorInfo:u})}:void 0;return a.reduceRight((f,u,p)=>{let m,h=!1,g=null,y=null;r&&(m=o&&u.route.id?o[u.route.id]:void 0,g=u.route.errorElement||Xg,s&&(l<0&&p===0?(iy("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,y=null):l===p&&(h=!0,y=u.route.hydrateFallbackElement||null)));let w=t.concat(a.slice(0,p+1)),b=()=>{let v;return m?v=g:h?v=y:u.route.Component?v=ie(u.route.Component,null):u.route.element?v=u.route.element:v=f,ie(Qg,{match:u,routeContext:{outlet:f,matches:w,isDataRoute:r!=null},children:v})};return r&&(u.route.ErrorBoundary||u.route.errorElement||p===0)?ie(Jg,{location:r.location,revalidation:r.revalidation,component:g,error:m,children:b(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:d}):b()},null)}function ni(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ty(e){let t=ne(Yn);return Se(t,ni(e)),t}function ny(e){let t=ne(to);return Se(t,ni(e)),t}function ry(e){let t=ne(gt);return Se(t,ni(e)),t}function ri(e){let t=ry(e),n=t.matches[t.matches.length-1];return Se(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ay(){return ri("useRouteId")}function oy(){var r;let e=ne(ti),t=ny("useRouteError"),n=ri("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function sy(){let{router:e}=ty("useNavigate"),t=ri("useNavigate"),n=M(!1);return Wn(()=>{n.current=!0}),H(async(r,a={})=>{Kt(n.current,nu),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...a}))},[e,t])}const jl={};function iy(e,t,n){jl[e]||(jl[e]=!0,Kt(!1,n))}/**
74
+ */function Wg(e,{relative:t}={}){Ee(Nn(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=ne(pt),{hash:a,pathname:o,search:s}=Ur(e,{relative:t}),l=o;return n!=="/"&&(l=o==="/"?n:ht([n,o])),r.createHref({pathname:l,search:s,hash:a})}function Nn(){return ne(Br)!=null}function Xe(){return Ee(Nn(),"useLocation() may be used only in the context of a <Router> component."),ne(Br).location}function _t(e){Ee(Nn(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=Xe();return Q(()=>Pr(e,Yd(t)),[t,e])}const ru="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Wt(){let{isDataRoute:e}=ne(gt);return e?sy():qg()}function qg(){Ee(Nn(),"useNavigate() may be used only in the context of a <Router> component.");let e=ne(Yn),{basename:t,navigator:n}=ne(pt),{matches:r}=ne(gt),{pathname:a}=Xe(),o=JSON.stringify(Zs(r)),s=M(!1);return Wn(()=>{s.current=!0}),K((l,c={})=>{if(Kt(s.current,ru),!s.current)return;if(typeof l=="number"){n.go(l);return}let d=eo(l,JSON.parse(o),a,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:ht([t,d.pathname])),ei(typeof l=="string"?l:vn(l),n.createHref(d),Qs(n),"reject"),(c.replace?n.replace:n.push)(d,c.state,c)},[t,n,o,a,e])}Te(null);function Xn(){var t;let{matches:e}=ne(gt);return((t=e[e.length-1])==null?void 0:t.params)??{}}function Ur(e,{relative:t}={}){let{matches:n}=ne(gt),{pathname:r}=Xe(),a=JSON.stringify(Zs(n));return Q(()=>eo(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function Gg(e,t){return au(e,t)}function au(e,t,n){var h;Ee(Nn(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=ne(pt),{matches:a}=ne(gt),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=Xe(),d;if(t){let g=typeof t=="string"?Gn(t):t;Ee(l==="/"||((h=g.pathname)==null?void 0:h.startsWith(l)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${g.pathname}" was given in the \`location\` prop.`),d=g}else d=c;let f=d.pathname||"/",u=f;if(l!=="/"){let g=l.replace(/^\//,"").split("/");u="/"+f.replace(/^\//,"").split("/").slice(g.length).join("/")}let p=n&&n.state.matches.length?n.state.matches.map(g=>Object.assign(g,{route:n.manifest[g.route.id]||g.route})):Hd(e,{pathname:u}),m=ey(p&&p.map(g=>Object.assign({},g,{params:Object.assign({},s,g.params),pathname:ht([l,r.encodeLocation?r.encodeLocation(g.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?l:ht([l,r.encodeLocation?r.encodeLocation(g.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathnameBase])})),a,n);return t&&m?ie(Br.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},m):m}function Yg(){let e=oy(),t=Ag(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return ie(fn,null,ie("h2",null,"Unexpected Application Error!"),ie("h3",{style:{fontStyle:"italic"}},t),n?ie("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"}},n):null,null)}const Xg=ie(Yg,null);var Jg=class extends bd{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=eu;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Kg(e.digest);n&&(e=n)}let t=e!==void 0?ie(gt.Provider,{value:this.props.routeContext},ie(ti.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?ie(Zg,{error:e},t):t}};const Do=new WeakMap;function Zg({children:e,error:t}){let{basename:n,navigator:r}=ne(pt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=Hg(t.digest);if(a){let o=Do.get(t);if(o)throw o;let s=Zd(a.location,n),l=s.absoluteURL||s.to;if(ei(a.location,l,Qs(r),"allow-explicit"),$g(l))throw new Error("Invalid redirect location");if(Jd&&!Do.get(t))if(s.isExternal||a.reloadDocument)window.location.href=l;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:a.replace}));throw Do.set(t,c),c}return ie("meta",{httpEquiv:"refresh",content:`0;url=${l}`})}}return e}function Qg({routeContext:e,match:t,children:n}){let r=ne(Yn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),ie(gt.Provider,{value:e},n)}function ey(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,o=r==null?void 0:r.errors;if(o!=null){let f=a.findIndex(u=>u.route.id&&(o==null?void 0:o[u.route.id])!==void 0);Ee(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,f+1))}let s=!1,l=-1;if(n&&r){s=r.renderFallback;for(let f=0;f<a.length;f++){let u=a[f];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(l=f),u.route.id){let{loaderData:p,errors:m}=r,h=u.route.loader&&!p.hasOwnProperty(u.route.id)&&(!m||m[u.route.id]===void 0);if(u.route.lazy||h){n.isStatic&&(s=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,d=r&&c?(f,u)=>{var p,m;c(f,{location:r.location,params:((m=(p=r.matches)==null?void 0:p[0])==null?void 0:m.params)??{},pattern:Mg(r.matches),errorInfo:u})}:void 0;return a.reduceRight((f,u,p)=>{let m,h=!1,g=null,y=null;r&&(m=o&&u.route.id?o[u.route.id]:void 0,g=u.route.errorElement||Xg,s&&(l<0&&p===0?(iy("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,y=null):l===p&&(h=!0,y=u.route.hydrateFallbackElement||null)));let w=t.concat(a.slice(0,p+1)),b=()=>{let v;return m?v=g:h?v=y:u.route.Component?v=ie(u.route.Component,null):u.route.element?v=u.route.element:v=f,ie(Qg,{match:u,routeContext:{outlet:f,matches:w,isDataRoute:r!=null},children:v})};return r&&(u.route.ErrorBoundary||u.route.errorElement||p===0)?ie(Jg,{location:r.location,revalidation:r.revalidation,component:g,error:m,children:b(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:d}):b()},null)}function ni(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ty(e){let t=ne(Yn);return Ee(t,ni(e)),t}function ny(e){let t=ne(to);return Ee(t,ni(e)),t}function ry(e){let t=ne(gt);return Ee(t,ni(e)),t}function ri(e){let t=ry(e),n=t.matches[t.matches.length-1];return Ee(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ay(){return ri("useRouteId")}function oy(){var r;let e=ne(ti),t=ny("useRouteError"),n=ri("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function sy(){let{router:e}=ty("useNavigate"),t=ri("useNavigate"),n=M(!1);return Wn(()=>{n.current=!0}),K(async(r,a={})=>{Kt(n.current,ru),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...a}))},[e,t])}const jl={};function iy(e,t,n){jl[e]||(jl[e]=!0,Kt(!1,n))}/**
75
75
  * react-router v8.3.1
76
76
  *
77
77
  * Copyright (c) Remix Software Inc.
@@ -80,7 +80,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
80
80
  * LICENSE.md file in the root directory of this source tree.
81
81
  *
82
82
  * @license MIT
83
- */xd(ly);function ly({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:o}){return ru(e,void 0,{manifest:t,state:r,isStatic:a,onError:o})}function nn({to:e,replace:t,state:n,relative:r}){Se(Nn(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a,navigator:o}=ne(pt);Kt(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=ne(gt),{pathname:l}=Xe(),c=Wt(),d=eo(e,Zs(s),l,r==="path");ei(typeof e=="string"?e:vn(e),o.createHref(d),Qs(o),"reject");let f=JSON.stringify(d);return O(()=>{c(JSON.parse(f),{replace:t,state:n,relative:r})},[c,f,r,t,n]),null}function Ce(e){Se(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function cy({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:o=!1,useTransitions:s}){Se(!Nn(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=Q(()=>({basename:l,navigator:a,static:o,useTransitions:s,future:{}}),[l,a,o,s]);typeof n=="string"&&(n=Gn(n));let{pathname:d="/",search:f="",hash:u="",state:p=null,key:m="default",mask:h}=n,g=Q(()=>{let y=ln(d,l);return y==null?null:{location:{pathname:y,search:f,hash:u,state:p,key:m,mask:h},navigationType:r}},[l,d,f,u,p,m,r,h]);return Kt(g!=null,`<Router basename="${l}"> is not able to match the URL "${d}${f}${u}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:ie(pt.Provider,{value:c},ie(Br.Provider,{children:t,value:g}))}function ai({children:e,location:t}){return Gg(ms(e),t)}function ms(e,t=[]){let n=[];return Wa.forEach(e,(r,a)=>{if(!ph(r))return;let o=[...t,a];if(r.type===fn){n.push.apply(n,ms(r.props.children,o));return}Se(r.type===Ce,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let s=r.props;Se(!s.index||!s.children,"An index route cannot have child routes.");let l={id:s.id||o.join("-"),caseSensitive:s.caseSensitive,element:s.element,Component:s.Component,index:s.index,path:s.path,middleware:s.middleware,loader:s.loader,action:s.action,hydrateFallbackElement:s.hydrateFallbackElement,HydrateFallback:s.HydrateFallback,errorElement:s.errorElement,ErrorBoundary:s.ErrorBoundary,shouldRevalidate:s.shouldRevalidate,handle:s.handle,lazy:s.lazy};s.children&&(l.children=ms(s.children,o)),n.push(l)}),n}/**
83
+ */xd(ly);function ly({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:o}){return au(e,void 0,{manifest:t,state:r,isStatic:a,onError:o})}function nn({to:e,replace:t,state:n,relative:r}){Ee(Nn(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a,navigator:o}=ne(pt);Kt(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=ne(gt),{pathname:l}=Xe(),c=Wt(),d=eo(e,Zs(s),l,r==="path");ei(typeof e=="string"?e:vn(e),o.createHref(d),Qs(o),"reject");let f=JSON.stringify(d);return O(()=>{c(JSON.parse(f),{replace:t,state:n,relative:r})},[c,f,r,t,n]),null}function Ce(e){Ee(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function cy({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:o=!1,useTransitions:s}){Ee(!Nn(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=Q(()=>({basename:l,navigator:a,static:o,useTransitions:s,future:{}}),[l,a,o,s]);typeof n=="string"&&(n=Gn(n));let{pathname:d="/",search:f="",hash:u="",state:p=null,key:m="default",mask:h}=n,g=Q(()=>{let y=ln(d,l);return y==null?null:{location:{pathname:y,search:f,hash:u,state:p,key:m,mask:h},navigationType:r}},[l,d,f,u,p,m,r,h]);return Kt(g!=null,`<Router basename="${l}"> is not able to match the URL "${d}${f}${u}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:ie(pt.Provider,{value:c},ie(Br.Provider,{children:t,value:g}))}function ai({children:e,location:t}){return Gg(ms(e),t)}function ms(e,t=[]){let n=[];return Wa.forEach(e,(r,a)=>{if(!hh(r))return;let o=[...t,a];if(r.type===fn){n.push.apply(n,ms(r.props.children,o));return}Ee(r.type===Ce,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let s=r.props;Ee(!s.index||!s.children,"An index route cannot have child routes.");let l={id:s.id||o.join("-"),caseSensitive:s.caseSensitive,element:s.element,Component:s.Component,index:s.index,path:s.path,middleware:s.middleware,loader:s.loader,action:s.action,hydrateFallbackElement:s.hydrateFallbackElement,HydrateFallback:s.HydrateFallback,errorElement:s.errorElement,ErrorBoundary:s.ErrorBoundary,shouldRevalidate:s.shouldRevalidate,handle:s.handle,lazy:s.lazy};s.children&&(l.children=ms(s.children,o)),n.push(l)}),n}/**
84
84
  * react-router v8.3.1
85
85
  *
86
86
  * Copyright (c) Remix Software Inc.
@@ -107,7 +107,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
107
107
  * LICENSE.md file in the root directory of this source tree.
108
108
  *
109
109
  * @license MIT
110
- */function au(e,t){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${t}`:n.pathname=`${n.pathname}.${t}`,n}/**
110
+ */function ou(e,t){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${t}`:n.pathname=`${n.pathname}.${t}`,n}/**
111
111
  * react-router v8.3.1
112
112
  *
113
113
  * Copyright (c) Remix Software Inc.
@@ -125,7 +125,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
125
125
  * LICENSE.md file in the root directory of this source tree.
126
126
  *
127
127
  * @license MIT
128
- */function by(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function xy(e,t,n){return Ey((await Promise.all(e.map(async r=>{let a=t.routes[r.route.id];if(a){let o=await vy(a,n);return o.links?o.links():[]}return[]}))).flat(1).filter(by).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function Vl(e,t,n,r,a,o){let s=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,l=(c,d)=>{var f;return n[d].pathname!==c.pathname||((f=n[d].route.path)==null?void 0:f.endsWith("*"))&&n[d].params["*"]!==c.params["*"]};return o==="assets"?t.filter((c,d)=>s(c,d)||l(c,d)):o==="data"?t.filter((c,d)=>{var u;let f=r.routes[c.route.id];if(!f||!f.hasLoader)return!1;if(s(c,d)||l(c,d))return!0;if(c.route.shouldRevalidate){let p=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((u=n[0])==null?void 0:u.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function wy(e,t,{includeHydrateFallback:n}={}){return Cy(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let o=[a.module];return a.clientActionModule&&(o=o.concat(a.clientActionModule)),a.clientLoaderModule&&(o=o.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(o=o.concat(a.hydrateFallbackModule)),a.imports&&(o=o.concat(a.imports)),o}).flat(1))}function Cy(e){return[...new Set(e)]}function Ny(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Ey(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let o=JSON.stringify(Ny(a));return n.has(o)||(n.add(o),r.push({key:o,link:a})),r},[])}/**
128
+ */function by(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function xy(e,t,n){return Sy((await Promise.all(e.map(async r=>{let a=t.routes[r.route.id];if(a){let o=await vy(a,n);return o.links?o.links():[]}return[]}))).flat(1).filter(by).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function Vl(e,t,n,r,a,o){let s=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,l=(c,d)=>{var f;return n[d].pathname!==c.pathname||((f=n[d].route.path)==null?void 0:f.endsWith("*"))&&n[d].params["*"]!==c.params["*"]};return o==="assets"?t.filter((c,d)=>s(c,d)||l(c,d)):o==="data"?t.filter((c,d)=>{var u;let f=r.routes[c.route.id];if(!f||!f.hasLoader)return!1;if(s(c,d)||l(c,d))return!0;if(c.route.shouldRevalidate){let p=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((u=n[0])==null?void 0:u.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function wy(e,t,{includeHydrateFallback:n}={}){return Cy(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let o=[a.module];return a.clientActionModule&&(o=o.concat(a.clientActionModule)),a.clientLoaderModule&&(o=o.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(o=o.concat(a.hydrateFallbackModule)),a.imports&&(o=o.concat(a.imports)),o}).flat(1))}function Cy(e){return[...new Set(e)]}function Ny(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Sy(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let o=JSON.stringify(Ny(a));return n.has(o)||(n.add(o),r.push({key:o,link:a})),r},[])}/**
129
129
  * react-router v8.3.1
130
130
  *
131
131
  * Copyright (c) Remix Software Inc.
@@ -134,7 +134,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
134
134
  * LICENSE.md file in the root directory of this source tree.
135
135
  *
136
136
  * @license MIT
137
- */function Sy(){let e=ne(Yn);return oi(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Ty(){let e=ne(to);return oi(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}const si=Te(void 0);si.displayName="FrameworkContext";function ii(){let e=ne(si);return oi(e,"You must render this element inside a <HydratedRouter> element"),e}function ky(e,t){let n=ne(si),[r,a]=E(!1),[o,s]=E(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:f,onTouchStart:u}=t,p=M(null);O(()=>{if(e==="render"&&s(!0),e==="viewport"){let g=w=>{w.forEach(b=>{s(b.isIntersecting)})},y=new IntersectionObserver(g,{threshold:.5});return p.current&&y.observe(p.current),()=>{y.disconnect()}}},[e]),O(()=>{if(r){let g=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(g)}}},[r]);let m=()=>{a(!0)},h=()=>{a(!1),s(!1)};return n?e!=="intent"?[o,p,{}]:[o,p,{onFocus:gr(l,m),onBlur:gr(c,h),onMouseEnter:gr(d,m),onMouseLeave:gr(f,h),onTouchStart:gr(u,m)}]:[!1,p,{}]}function gr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ry({page:e,...t}){let n=Bg(),{nonce:r}=ii(),{router:a}=Sy(),o=Q(()=>Vd(a.routes,e,a.basename),[a.routes,e,a.basename]);return o?(t.nonce==null&&r&&(t={...t,nonce:r}),n?ie(Dy,{page:e,matches:o,...t}):ie(Iy,{page:e,matches:o,...t})):null}function Py(e){let{manifest:t,routeModules:n}=ii(),[r,a]=E([]);return O(()=>{let o=!1;return xy(e,t,n).then(s=>{o||a(s)}),()=>{o=!0}},[e,t,n]),r}function Dy({page:e,matches:t,...n}){let r=Xe(),a=Q(()=>{if(e===r.pathname+r.search+r.hash)return[];let o=au(e,"rsc"),s=!1,l=[];for(let c of t)typeof c.route.shouldRevalidate=="function"?s=!0:l.push(c.route.id);return s&&l.length>0&&o.searchParams.set("_routes",l.join(",")),[o.pathname+o.search]},[e,r,t]);return ie(fn,null,a.map(o=>ie("link",{key:o,rel:"prefetch",as:"fetch",href:o,...n})))}function Iy({page:e,matches:t,...n}){let r=Xe(),{manifest:a,routeModules:o}=ii(),{loaderData:s,matches:l}=Ty(),c=Q(()=>Vl(e,t,l,a,r,"data"),[e,t,l,a,r]),d=Q(()=>Vl(e,t,l,a,r,"assets"),[e,t,l,a,r]),f=Q(()=>{if(e===r.pathname+r.search+r.hash)return[];let m=new Set,h=!1;if(t.forEach(y=>{var b;let w=a.routes[y.route.id];!w||!w.hasLoader||(!c.some(v=>v.route.id===y.route.id)&&y.route.id in s&&((b=o[y.route.id])!=null&&b.shouldRevalidate)||w.hasClientLoader?h=!0:m.add(y.route.id))}),m.size===0)return[];let g=au(e,"data");return h&&m.size>0&&g.searchParams.set("_routes",t.filter(y=>m.has(y.route.id)).map(y=>y.route.id).join(",")),[g.pathname+g.search]},[s,r,a,c,t,e,o]),u=Q(()=>wy(d,a),[d,a]),p=Py(d);return ie(fn,null,f.map(m=>ie("link",{key:m,rel:"prefetch",as:"fetch",href:m,...n})),u.map(m=>ie("link",{key:m,rel:"modulepreload",href:m,...n})),p.map(({key:m,link:h})=>ie("link",{key:m,nonce:n.nonce,...h,crossOrigin:h.crossOrigin??n.crossOrigin})))}function Ly(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}/**
137
+ */function Ey(){let e=ne(Yn);return oi(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Ty(){let e=ne(to);return oi(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}const si=Te(void 0);si.displayName="FrameworkContext";function ii(){let e=ne(si);return oi(e,"You must render this element inside a <HydratedRouter> element"),e}function ky(e,t){let n=ne(si),[r,a]=E(!1),[o,s]=E(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:f,onTouchStart:u}=t,p=M(null);O(()=>{if(e==="render"&&s(!0),e==="viewport"){let g=w=>{w.forEach(b=>{s(b.isIntersecting)})},y=new IntersectionObserver(g,{threshold:.5});return p.current&&y.observe(p.current),()=>{y.disconnect()}}},[e]),O(()=>{if(r){let g=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(g)}}},[r]);let m=()=>{a(!0)},h=()=>{a(!1),s(!1)};return n?e!=="intent"?[o,p,{}]:[o,p,{onFocus:gr(l,m),onBlur:gr(c,h),onMouseEnter:gr(d,m),onMouseLeave:gr(f,h),onTouchStart:gr(u,m)}]:[!1,p,{}]}function gr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ry({page:e,...t}){let n=Bg(),{nonce:r}=ii(),{router:a}=Ey(),o=Q(()=>Hd(a.routes,e,a.basename),[a.routes,e,a.basename]);return o?(t.nonce==null&&r&&(t={...t,nonce:r}),n?ie(Dy,{page:e,matches:o,...t}):ie(Iy,{page:e,matches:o,...t})):null}function Py(e){let{manifest:t,routeModules:n}=ii(),[r,a]=E([]);return O(()=>{let o=!1;return xy(e,t,n).then(s=>{o||a(s)}),()=>{o=!0}},[e,t,n]),r}function Dy({page:e,matches:t,...n}){let r=Xe(),a=Q(()=>{if(e===r.pathname+r.search+r.hash)return[];let o=ou(e,"rsc"),s=!1,l=[];for(let c of t)typeof c.route.shouldRevalidate=="function"?s=!0:l.push(c.route.id);return s&&l.length>0&&o.searchParams.set("_routes",l.join(",")),[o.pathname+o.search]},[e,r,t]);return ie(fn,null,a.map(o=>ie("link",{key:o,rel:"prefetch",as:"fetch",href:o,...n})))}function Iy({page:e,matches:t,...n}){let r=Xe(),{manifest:a,routeModules:o}=ii(),{loaderData:s,matches:l}=Ty(),c=Q(()=>Vl(e,t,l,a,r,"data"),[e,t,l,a,r]),d=Q(()=>Vl(e,t,l,a,r,"assets"),[e,t,l,a,r]),f=Q(()=>{if(e===r.pathname+r.search+r.hash)return[];let m=new Set,h=!1;if(t.forEach(y=>{var b;let w=a.routes[y.route.id];!w||!w.hasLoader||(!c.some(v=>v.route.id===y.route.id)&&y.route.id in s&&((b=o[y.route.id])!=null&&b.shouldRevalidate)||w.hasClientLoader?h=!0:m.add(y.route.id))}),m.size===0)return[];let g=ou(e,"data");return h&&m.size>0&&g.searchParams.set("_routes",t.filter(y=>m.has(y.route.id)).map(y=>y.route.id).join(",")),[g.pathname+g.search]},[s,r,a,c,t,e,o]),u=Q(()=>wy(d,a),[d,a]),p=Py(d);return ie(fn,null,f.map(m=>ie("link",{key:m,rel:"prefetch",as:"fetch",href:m,...n})),u.map(m=>ie("link",{key:m,rel:"modulepreload",href:m,...n})),p.map(({key:m,link:h})=>ie("link",{key:m,nonce:n.nonce,...h,crossOrigin:h.crossOrigin??n.crossOrigin})))}function Ly(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}/**
138
138
  * react-router v8.3.1
139
139
  *
140
140
  * Copyright (c) Remix Software Inc.
@@ -143,7 +143,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
143
143
  * LICENSE.md file in the root directory of this source tree.
144
144
  *
145
145
  * @license MIT
146
- */const Ay=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ay&&(window.__reactRouterVersion="8")}catch{}function My({basename:e,children:t,useTransitions:n,window:r}){let a=M(null);a.current==null&&(a.current=cg({window:r,v5Compat:!0}));let o=a.current,[s,l]=E({action:o.action,location:o.location}),c=H(d=>{n===!1?l(d):qs(()=>l(d))},[n]);return Wn(()=>o.listen(c),[o,c]),ie(cy,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,useTransitions:n})}const Ut=W(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:o,replace:s,mask:l,state:c,target:d,to:f,preventScrollReset:u,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:y,navigator:w,useTransitions:b}=ne(pt),v=typeof f=="string"&&Js.test(f),C=Jd(f,y);f=C.to;let N=Wg(f,{relative:a}),T=Xe(),k=null;if(l){let U=eo(l,[],T.mask?T.mask.pathname:"/",!0);y!=="/"&&(U.pathname=U.pathname==="/"?y:ht([y,U.pathname])),k=w.createHref(U)}let[L,R,P]=ky(r,h),I=$y(f,{replace:s,mask:l,state:c,target:d,preventScrollReset:u,relative:a,viewTransition:p,defaultShouldRevalidate:m,useTransitions:b});function S(U){t&&t(U),U.defaultPrevented||I(U)}let A=!(C.isExternal||o),D=ie("a",{...h,...P,href:(A?k:void 0)||C.absoluteURL||N,onClick:A?S:t,ref:Ly(g,R),target:d,"data-discover":!v&&n==="render"?"true":void 0});return L&&!v?ie(fn,null,D,ie(Ry,{page:N})):D});Ut.displayName="Link";const Oy=W(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:o,to:s,viewTransition:l,children:c,...d},f){let u=Ur(s,{relative:d.relative}),p=Xe(),m=ne(to),{navigator:h,basename:g}=ne(pt),y=m!=null&&Vy(u)&&l===!0,w=h.encodeLocation?h.encodeLocation(u).pathname:u.pathname,b=p.pathname,v=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;n||(b=b.toLowerCase(),v=v?v.toLowerCase():null,w=w.toLowerCase()),v&&g&&(v=ln(v,g)||v);const C=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let N=b===w||!a&&b.startsWith(w)&&b.charAt(C)==="/",T=v!=null&&(v===w||!a&&v.startsWith(w)&&v.charAt(C)==="/"),k={isActive:N,isPending:T,isTransitioning:y},L=N?t:void 0,R;typeof r=="function"?R=r(k):R=[r,N?"active":null,T?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let P=typeof o=="function"?o(k):o;return ie(Ut,{...d,"aria-current":L,className:R,ref:f,style:P,to:s,viewTransition:l},typeof c=="function"?c(k):c)});Oy.displayName="NavLink";const _y=W(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:s="get",action:l,onSubmit:c,relative:d,preventScrollReset:f,viewTransition:u,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=ne(pt),y=zy(),w=jy(l,{relative:d}),b=s.toLowerCase()==="get"?"get":"post",v=typeof l=="string"&&Js.test(l);return ie("form",{ref:h,method:b,action:w,onSubmit:r?c:N=>{if(c&&c(N),N.defaultPrevented)return;N.preventDefault();let T=N.nativeEvent.submitter,k=(T==null?void 0:T.getAttribute("formmethod"))||s,L=()=>y(T||N.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:a,state:o,relative:d,preventScrollReset:f,viewTransition:u,defaultShouldRevalidate:p});g&&n!==!1?qs(()=>L()):L()},...m,"data-discover":!v&&e==="render"?"true":void 0})});_y.displayName="Form";function Fy(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ou(e){let t=ne(Yn);return Se(t,Fy(e)),t}function $y(e,{target:t,replace:n,mask:r,state:a,preventScrollReset:o,relative:s,viewTransition:l,defaultShouldRevalidate:c,useTransitions:d}={}){let f=Wt(),u=Xe(),p=Ur(e,{relative:s});return H(m=>{if(hy(m,t)){m.preventDefault();let h=n!==void 0?n:vn(u)===vn(p),g=()=>f(e,{replace:h,mask:r,state:a,preventScrollReset:o,relative:s,viewTransition:l,defaultShouldRevalidate:c});d?qs(()=>g()):g()}},[u,f,p,n,r,a,t,e,o,s,l,c,d])}let By=0,Uy=()=>`__${String(++By)}__`;function zy(){let{router:e}=ou("useSubmit"),{basename:t}=ne(pt),n=ay(),r=e.fetch,a=e.navigate;return H(async(o,s={})=>{let{action:l,method:c,encType:d,formData:f,body:u}=yy(o,t);s.navigate===!1?await r(s.fetcherKey||Uy(),n,s.action||l,{defaultShouldRevalidate:s.defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,relative:s.relative,formData:f,body:u,formMethod:s.method||c,formEncType:s.encType||d,flushSync:s.flushSync}):await a(s.action||l,{defaultShouldRevalidate:s.defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,relative:s.relative,formData:f,body:u,formMethod:s.method||c,formEncType:s.encType||d,replace:s.replace,state:s.state,fromRouteId:n,flushSync:s.flushSync,viewTransition:s.viewTransition})},[r,a,t,n])}function jy(e,{relative:t}={}){let{basename:n}=ne(pt),r=ne(gt);Se(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),o={...Ur(e||".",{relative:t})},s=Xe();if(e==null){o.search=s.search;let l=new URLSearchParams(o.search),c=l.getAll("index");if(c.some(d=>d==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let d=l.toString();o.search=d?`?${d}`:""}}return(!e||e===".")&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:ht([n,o.pathname])),vn(o)}function Vy(e,{relative:t}={}){let n=ne(eu);Se(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ou("useViewTransitionState"),a=Ur(e,{relative:t});if(!n.isTransitioning)return!1;let o=ln(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=ln(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Pr(a.pathname,s)!=null||Pr(a.pathname,o)!=null}var Hl=_r[" useEffectEvent ".trim().toString()],Kl=_r[" useInsertionEffect ".trim().toString()];function Hy(e){if(typeof Hl=="function")return Hl(e);const t=M(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Kl=="function"?Kl(()=>{t.current=e}):Ya(()=>{t.current=e}),Q(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}var Ky=_r[" useId ".trim().toString()]||(()=>{}),Wy=0;function Lo(e){const[t,n]=E(Ky());return Ya(()=>{n(r=>r??String(Wy++))},[e]),e||(t?`radix-${t}`:"")}function cn(e){const t=M(e);return O(()=>{t.current=e}),Q(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}var qy="DismissableLayer",gs="dismissableLayer.update",Gy="dismissableLayer.pointerDownOutside",Yy="dismissableLayer.focusOutside",Wl,li=Te({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ci=W((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...d}=e,f=ne(li),[u,p]=E(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=E({}),g=ft(t,p),y=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=y.indexOf(w),v=u?y.indexOf(u):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,N=v>=b,T=M(!1),k=Zy(I=>{const S=I.target;if(!(S instanceof Node))return;const A=[...f.branches].some(D=>D.contains(S));!N||A||(o==null||o(I),l==null||l(I),I.defaultPrevented||c==null||c())},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:f.dismissableSurfaces}),L=Qy(I=>{if(r&&T.current)return;const S=I.target;[...f.branches].some(D=>D.contains(S))||(s==null||s(I),l==null||l(I),I.defaultPrevented||c==null||c())},m),R=u?v===y.length-1:!1,P=Hy(I=>{I.key==="Escape"&&(a==null||a(I),!I.defaultPrevented&&c&&(I.preventDefault(),c()))});return O(()=>{if(R)return m.addEventListener("keydown",P,{capture:!0}),()=>m.removeEventListener("keydown",P,{capture:!0})},[m,R]),O(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Wl=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),ql(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(u),f.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Wl))}},[u,m,n,f]),O(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),ql())},[u,f]),O(()=>{const I=()=>h({});return document.addEventListener(gs,I),()=>document.removeEventListener(gs,I)},[]),i(qe.div,{...d,ref:g,style:{pointerEvents:C?N?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,L.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,k.onPointerDownCapture)})});ci.displayName=qy;var Xy="DismissableLayerBranch",su=W((e,t)=>{const n=ne(li),r=M(null),a=ft(t,r);return O(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),i(qe.div,{...e,ref:a})});su.displayName=Xy;function Jy(){const e=ne(li),[t,n]=E(null);return O(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function Zy(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o}=t,s=cn(e),l=M(!1),c=M(!1),d=M(new Map),f=M(()=>{});return O(()=>{function u(){c.current=!1,a.current=!1,d.current.clear()}function p(){return Array.from(d.current.values()).some(Boolean)}function m(b){if(!c.current)return;const v=b.target;v instanceof Node&&[...o].some(N=>N.contains(v))||d.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{c.current&&f.current()},0)}function h(b){c.current&&d.current.set(b.type,!1)}const g=b=>{if(b.target&&!l.current){let v=function(){n.removeEventListener("click",f.current);const N=p();u(),N||iu(Gy,s,C,{discrete:!0})};const C={originalEvent:b};c.current=!0,a.current=r&&b.button===0,d.current.clear(),!r||b.button!==0?v():(n.removeEventListener("click",f.current),f.current=v,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),u();l.current=!1},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of y)n.addEventListener(b,m,!0),n.addEventListener(b,h);const w=window.setTimeout(()=>{n.addEventListener("pointerdown",g)},0);return()=>{window.clearTimeout(w),n.removeEventListener("pointerdown",g),n.removeEventListener("click",f.current);for(const b of y)n.removeEventListener(b,m,!0),n.removeEventListener(b,h)}},[n,s,r,a,o]),{onPointerDownCapture:()=>l.current=!0}}function Qy(e,t=globalThis==null?void 0:globalThis.document){const n=cn(e),r=M(!1);return O(()=>{const a=o=>{o.target&&!r.current&&iu(Yy,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ql(){const e=new CustomEvent(gs);document.dispatchEvent(e)}function iu(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Sd(a,o):a.dispatchEvent(o)}var ev=ci,tv=su,Ao="focusScope.autoFocusOnMount",Mo="focusScope.autoFocusOnUnmount",Gl={bubbles:!1,cancelable:!0},nv="FocusScope",lu=W((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[l,c]=E(null),d=cn(a),f=cn(o),u=M(null),p=ft(t,c),m=M({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;O(()=>{if(r){let g=function(v){if(m.paused||!l)return;const C=v.target;l.contains(C)?u.current=C:en(u.current,{select:!0})},y=function(v){if(m.paused||!l)return;const C=v.relatedTarget;C!==null&&(l.contains(C)||en(u.current,{select:!0}))},w=function(v){if(document.activeElement===document.body)for(const N of v)N.removedNodes.length>0&&en(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const b=new MutationObserver(w);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),b.disconnect()}}},[r,l,m.paused]),O(()=>{if(l){Xl.add(m);const g=document.activeElement;if(!l.contains(g)){const w=new CustomEvent(Ao,Gl);l.addEventListener(Ao,d),l.dispatchEvent(w),w.defaultPrevented||(rv(lv(cu(l)),{select:!0}),document.activeElement===g&&en(l))}return()=>{l.removeEventListener(Ao,d),setTimeout(()=>{const w=new CustomEvent(Mo,Gl);l.addEventListener(Mo,f),l.dispatchEvent(w),w.defaultPrevented||en(g??document.body,{select:!0}),l.removeEventListener(Mo,f),Xl.remove(m)},0)}}},[l,d,f,m]);const h=H(g=>{if(!n&&!r||m.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,w=document.activeElement;if(y&&w){const b=g.currentTarget,[v,C]=av(b);v&&C?!g.shiftKey&&w===C?(g.preventDefault(),n&&en(v,{select:!0})):g.shiftKey&&w===v&&(g.preventDefault(),n&&en(C,{select:!0})):w===b&&g.preventDefault()}},[n,r,m.paused]);return i(qe.div,{tabIndex:-1,...s,ref:p,onKeyDown:h})});lu.displayName=nv;function rv(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(en(r,{select:t}),document.activeElement!==n)return}function av(e){const t=cu(e),n=Yl(t,e),r=Yl(t.reverse(),e);return[n,r]}function cu(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Yl(e,t){for(const n of e)if(!ov(n,{upTo:t}))return n}function ov(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function sv(e){return e instanceof HTMLInputElement&&"select"in e}function en(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&sv(e)&&t&&e.select()}}var Xl=iv();function iv(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Jl(e,t),e.unshift(t)},remove(t){var n;e=Jl(e,t),(n=e[0])==null||n.resume()}}}function Jl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function lv(e){return e.filter(t=>t.tagName!=="A")}var cv="Portal",di=W((e,t)=>{var l;const{container:n,...r}=e,[a,o]=E(!1);Ya(()=>o(!0),[]);const s=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?Ga(i(qe.div,{...r,ref:t}),s):null});di.displayName=cv;var ta=0,wt=null;function dv(){O(()=>{wt||(wt={start:Zl(),end:Zl()});const{start:e,end:t}=wt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),ta++,()=>{ta===1&&(wt==null||wt.start.remove(),wt==null||wt.end.remove(),wt=null),ta=Math.max(0,ta-1)}},[])}function Zl(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Nt=function(){return Nt=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Nt.apply(this,arguments)};function du(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function uv(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,o;r<a;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var ha="right-scroll-bar-position",ma="width-before-scroll-bar",fv="with-scroll-bars-hidden",pv="--removed-body-scroll-bar-size";function Oo(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function hv(e,t){var n=E(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var mv=typeof window<"u"?Wn:O,Ql=new WeakMap;function gv(e,t){var n=hv(null,function(r){return e.forEach(function(a){return Oo(a,r)})});return mv(function(){var r=Ql.get(n);if(r){var a=new Set(r),o=new Set(e),s=n.current;a.forEach(function(l){o.has(l)||Oo(l,null)}),o.forEach(function(l){a.has(l)||Oo(l,s)})}Ql.set(n,e)},[e]),n}function yv(e){return e}function vv(e,t){t===void 0&&(t=yv);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var s=t(o,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(o){for(r=!0;n.length;){var s=n;n=[],s.forEach(o)}n={push:function(l){return o(l)},filter:function(){return n}}},assignMedium:function(o){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(o),s=n}var c=function(){var f=s;s=[],f.forEach(o)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){s.push(f),d()},filter:function(f){return s=s.filter(f),n}}}};return a}function bv(e){e===void 0&&(e={});var t=vv(null);return t.options=Nt({async:!0,ssr:!1},e),t}var uu=function(e){var t=e.sideCar,n=du(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return ie(r,Nt({},n))};uu.isSideCarExport=!0;function xv(e,t){return e.useMedium(t),uu}var fu=bv(),_o=function(){},ro=W(function(e,t){var n=M(null),r=E({onScrollCapture:_o,onWheelCapture:_o,onTouchMoveCapture:_o}),a=r[0],o=r[1],s=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,y=e.allowPinchZoom,w=e.as,b=w===void 0?"div":w,v=e.gapMode,C=du(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=p,T=gv([n,t]),k=Nt(Nt({},C),a);return ie(fn,null,f&&ie(N,{sideCar:fu,removeScrollBar:d,shards:u,noRelative:m,noIsolation:h,inert:g,setCallbacks:o,allowPinchZoom:!!y,lockRef:n,gapMode:v}),s?wd(Wa.only(l),Nt(Nt({},k),{ref:T})):ie(b,Nt({},k,{className:c,ref:T}),l))});ro.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ro.classNames={fullWidth:ma,zeroRight:ha};var wv=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Cv(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wv();return t&&e.setAttribute("nonce",t),e}function Nv(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ev(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Sv=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Cv())&&(Nv(t,n),Ev(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Tv=function(){var e=Sv();return function(t,n){O(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pu=function(){var e=Tv(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},kv={left:0,top:0,right:0,gap:0},Fo=function(e){return parseInt(e||"",10)||0},Rv=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[Fo(n),Fo(r),Fo(a)]},Pv=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return kv;var t=Rv(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Dv=pu(),_n="data-scroll-locked",Iv=function(e,t,n,r){var a=e.left,o=e.top,s=e.right,l=e.gap;return n===void 0&&(n="margin"),`
146
+ */const Ay=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ay&&(window.__reactRouterVersion="8")}catch{}function My({basename:e,children:t,useTransitions:n,window:r}){let a=M(null);a.current==null&&(a.current=cg({window:r,v5Compat:!0}));let o=a.current,[s,l]=E({action:o.action,location:o.location}),c=K(d=>{n===!1?l(d):qs(()=>l(d))},[n]);return Wn(()=>o.listen(c),[o,c]),ie(cy,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,useTransitions:n})}const Ut=W(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:o,replace:s,mask:l,state:c,target:d,to:f,preventScrollReset:u,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:y,navigator:w,useTransitions:b}=ne(pt),v=typeof f=="string"&&Js.test(f),C=Zd(f,y);f=C.to;let N=Wg(f,{relative:a}),T=Xe(),R=null;if(l){let B=eo(l,[],T.mask?T.mask.pathname:"/",!0);y!=="/"&&(B.pathname=B.pathname==="/"?y:ht([y,B.pathname])),R=w.createHref(B)}let[L,I,P]=ky(r,h),k=$y(f,{replace:s,mask:l,state:c,target:d,preventScrollReset:u,relative:a,viewTransition:p,defaultShouldRevalidate:m,useTransitions:b});function S(B){t&&t(B),B.defaultPrevented||k(B)}let A=!(C.isExternal||o),D=ie("a",{...h,...P,href:(A?R:void 0)||C.absoluteURL||N,onClick:A?S:t,ref:Ly(g,I),target:d,"data-discover":!v&&n==="render"?"true":void 0});return L&&!v?ie(fn,null,D,ie(Ry,{page:N})):D});Ut.displayName="Link";const Oy=W(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:o,to:s,viewTransition:l,children:c,...d},f){let u=Ur(s,{relative:d.relative}),p=Xe(),m=ne(to),{navigator:h,basename:g}=ne(pt),y=m!=null&&Vy(u)&&l===!0,w=h.encodeLocation?h.encodeLocation(u).pathname:u.pathname,b=p.pathname,v=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;n||(b=b.toLowerCase(),v=v?v.toLowerCase():null,w=w.toLowerCase()),v&&g&&(v=ln(v,g)||v);const C=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let N=b===w||!a&&b.startsWith(w)&&b.charAt(C)==="/",T=v!=null&&(v===w||!a&&v.startsWith(w)&&v.charAt(C)==="/"),R={isActive:N,isPending:T,isTransitioning:y},L=N?t:void 0,I;typeof r=="function"?I=r(R):I=[r,N?"active":null,T?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let P=typeof o=="function"?o(R):o;return ie(Ut,{...d,"aria-current":L,className:I,ref:f,style:P,to:s,viewTransition:l},typeof c=="function"?c(R):c)});Oy.displayName="NavLink";const _y=W(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:s="get",action:l,onSubmit:c,relative:d,preventScrollReset:f,viewTransition:u,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=ne(pt),y=zy(),w=jy(l,{relative:d}),b=s.toLowerCase()==="get"?"get":"post",v=typeof l=="string"&&Js.test(l);return ie("form",{ref:h,method:b,action:w,onSubmit:r?c:N=>{if(c&&c(N),N.defaultPrevented)return;N.preventDefault();let T=N.nativeEvent.submitter,R=(T==null?void 0:T.getAttribute("formmethod"))||s,L=()=>y(T||N.currentTarget,{fetcherKey:t,method:R,navigate:n,replace:a,state:o,relative:d,preventScrollReset:f,viewTransition:u,defaultShouldRevalidate:p});g&&n!==!1?qs(()=>L()):L()},...m,"data-discover":!v&&e==="render"?"true":void 0})});_y.displayName="Form";function Fy(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function su(e){let t=ne(Yn);return Ee(t,Fy(e)),t}function $y(e,{target:t,replace:n,mask:r,state:a,preventScrollReset:o,relative:s,viewTransition:l,defaultShouldRevalidate:c,useTransitions:d}={}){let f=Wt(),u=Xe(),p=Ur(e,{relative:s});return K(m=>{if(hy(m,t)){m.preventDefault();let h=n!==void 0?n:vn(u)===vn(p),g=()=>f(e,{replace:h,mask:r,state:a,preventScrollReset:o,relative:s,viewTransition:l,defaultShouldRevalidate:c});d?qs(()=>g()):g()}},[u,f,p,n,r,a,t,e,o,s,l,c,d])}let By=0,Uy=()=>`__${String(++By)}__`;function zy(){let{router:e}=su("useSubmit"),{basename:t}=ne(pt),n=ay(),r=e.fetch,a=e.navigate;return K(async(o,s={})=>{let{action:l,method:c,encType:d,formData:f,body:u}=yy(o,t);s.navigate===!1?await r(s.fetcherKey||Uy(),n,s.action||l,{defaultShouldRevalidate:s.defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,relative:s.relative,formData:f,body:u,formMethod:s.method||c,formEncType:s.encType||d,flushSync:s.flushSync}):await a(s.action||l,{defaultShouldRevalidate:s.defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,relative:s.relative,formData:f,body:u,formMethod:s.method||c,formEncType:s.encType||d,replace:s.replace,state:s.state,fromRouteId:n,flushSync:s.flushSync,viewTransition:s.viewTransition})},[r,a,t,n])}function jy(e,{relative:t}={}){let{basename:n}=ne(pt),r=ne(gt);Ee(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),o={...Ur(e||".",{relative:t})},s=Xe();if(e==null){o.search=s.search;let l=new URLSearchParams(o.search),c=l.getAll("index");if(c.some(d=>d==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let d=l.toString();o.search=d?`?${d}`:""}}return(!e||e===".")&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:ht([n,o.pathname])),vn(o)}function Vy(e,{relative:t}={}){let n=ne(tu);Ee(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=su("useViewTransitionState"),a=Ur(e,{relative:t});if(!n.isTransitioning)return!1;let o=ln(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=ln(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Pr(a.pathname,s)!=null||Pr(a.pathname,o)!=null}var Hl=_r[" useEffectEvent ".trim().toString()],Kl=_r[" useInsertionEffect ".trim().toString()];function Hy(e){if(typeof Hl=="function")return Hl(e);const t=M(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Kl=="function"?Kl(()=>{t.current=e}):Ya(()=>{t.current=e}),Q(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}var Ky=_r[" useId ".trim().toString()]||(()=>{}),Wy=0;function Lo(e){const[t,n]=E(Ky());return Ya(()=>{n(r=>r??String(Wy++))},[e]),e||(t?`radix-${t}`:"")}function cn(e){const t=M(e);return O(()=>{t.current=e}),Q(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}var qy="DismissableLayer",gs="dismissableLayer.update",Gy="dismissableLayer.pointerDownOutside",Yy="dismissableLayer.focusOutside",Wl,li=Te({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ci=W((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...d}=e,f=ne(li),[u,p]=E(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=E({}),g=ft(t,p),y=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=y.indexOf(w),v=u?y.indexOf(u):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,N=v>=b,T=M(!1),R=Zy(k=>{const S=k.target;if(!(S instanceof Node))return;const A=[...f.branches].some(D=>D.contains(S));!N||A||(o==null||o(k),l==null||l(k),k.defaultPrevented||c==null||c())},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:f.dismissableSurfaces}),L=Qy(k=>{if(r&&T.current)return;const S=k.target;[...f.branches].some(D=>D.contains(S))||(s==null||s(k),l==null||l(k),k.defaultPrevented||c==null||c())},m),I=u?v===y.length-1:!1,P=Hy(k=>{k.key==="Escape"&&(a==null||a(k),!k.defaultPrevented&&c&&(k.preventDefault(),c()))});return O(()=>{if(I)return m.addEventListener("keydown",P,{capture:!0}),()=>m.removeEventListener("keydown",P,{capture:!0})},[m,I]),O(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Wl=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),ql(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(u),f.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Wl))}},[u,m,n,f]),O(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),ql())},[u,f]),O(()=>{const k=()=>h({});return document.addEventListener(gs,k),()=>document.removeEventListener(gs,k)},[]),i(qe.div,{...d,ref:g,style:{pointerEvents:C?N?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,L.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,R.onPointerDownCapture)})});ci.displayName=qy;var Xy="DismissableLayerBranch",iu=W((e,t)=>{const n=ne(li),r=M(null),a=ft(t,r);return O(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),i(qe.div,{...e,ref:a})});iu.displayName=Xy;function Jy(){const e=ne(li),[t,n]=E(null);return O(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function Zy(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o}=t,s=cn(e),l=M(!1),c=M(!1),d=M(new Map),f=M(()=>{});return O(()=>{function u(){c.current=!1,a.current=!1,d.current.clear()}function p(){return Array.from(d.current.values()).some(Boolean)}function m(b){if(!c.current)return;const v=b.target;v instanceof Node&&[...o].some(N=>N.contains(v))||d.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{c.current&&f.current()},0)}function h(b){c.current&&d.current.set(b.type,!1)}const g=b=>{if(b.target&&!l.current){let v=function(){n.removeEventListener("click",f.current);const N=p();u(),N||lu(Gy,s,C,{discrete:!0})};const C={originalEvent:b};c.current=!0,a.current=r&&b.button===0,d.current.clear(),!r||b.button!==0?v():(n.removeEventListener("click",f.current),f.current=v,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),u();l.current=!1},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of y)n.addEventListener(b,m,!0),n.addEventListener(b,h);const w=window.setTimeout(()=>{n.addEventListener("pointerdown",g)},0);return()=>{window.clearTimeout(w),n.removeEventListener("pointerdown",g),n.removeEventListener("click",f.current);for(const b of y)n.removeEventListener(b,m,!0),n.removeEventListener(b,h)}},[n,s,r,a,o]),{onPointerDownCapture:()=>l.current=!0}}function Qy(e,t=globalThis==null?void 0:globalThis.document){const n=cn(e),r=M(!1);return O(()=>{const a=o=>{o.target&&!r.current&&lu(Yy,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ql(){const e=new CustomEvent(gs);document.dispatchEvent(e)}function lu(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Ed(a,o):a.dispatchEvent(o)}var ev=ci,tv=iu,Ao="focusScope.autoFocusOnMount",Mo="focusScope.autoFocusOnUnmount",Gl={bubbles:!1,cancelable:!0},nv="FocusScope",cu=W((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[l,c]=E(null),d=cn(a),f=cn(o),u=M(null),p=ft(t,c),m=M({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;O(()=>{if(r){let g=function(v){if(m.paused||!l)return;const C=v.target;l.contains(C)?u.current=C:en(u.current,{select:!0})},y=function(v){if(m.paused||!l)return;const C=v.relatedTarget;C!==null&&(l.contains(C)||en(u.current,{select:!0}))},w=function(v){if(document.activeElement===document.body)for(const N of v)N.removedNodes.length>0&&en(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const b=new MutationObserver(w);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),b.disconnect()}}},[r,l,m.paused]),O(()=>{if(l){Xl.add(m);const g=document.activeElement;if(!l.contains(g)){const w=new CustomEvent(Ao,Gl);l.addEventListener(Ao,d),l.dispatchEvent(w),w.defaultPrevented||(rv(lv(du(l)),{select:!0}),document.activeElement===g&&en(l))}return()=>{l.removeEventListener(Ao,d),setTimeout(()=>{const w=new CustomEvent(Mo,Gl);l.addEventListener(Mo,f),l.dispatchEvent(w),w.defaultPrevented||en(g??document.body,{select:!0}),l.removeEventListener(Mo,f),Xl.remove(m)},0)}}},[l,d,f,m]);const h=K(g=>{if(!n&&!r||m.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,w=document.activeElement;if(y&&w){const b=g.currentTarget,[v,C]=av(b);v&&C?!g.shiftKey&&w===C?(g.preventDefault(),n&&en(v,{select:!0})):g.shiftKey&&w===v&&(g.preventDefault(),n&&en(C,{select:!0})):w===b&&g.preventDefault()}},[n,r,m.paused]);return i(qe.div,{tabIndex:-1,...s,ref:p,onKeyDown:h})});cu.displayName=nv;function rv(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(en(r,{select:t}),document.activeElement!==n)return}function av(e){const t=du(e),n=Yl(t,e),r=Yl(t.reverse(),e);return[n,r]}function du(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Yl(e,t){for(const n of e)if(!ov(n,{upTo:t}))return n}function ov(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function sv(e){return e instanceof HTMLInputElement&&"select"in e}function en(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&sv(e)&&t&&e.select()}}var Xl=iv();function iv(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Jl(e,t),e.unshift(t)},remove(t){var n;e=Jl(e,t),(n=e[0])==null||n.resume()}}}function Jl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function lv(e){return e.filter(t=>t.tagName!=="A")}var cv="Portal",di=W((e,t)=>{var l;const{container:n,...r}=e,[a,o]=E(!1);Ya(()=>o(!0),[]);const s=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?Ga(i(qe.div,{...r,ref:t}),s):null});di.displayName=cv;var ta=0,wt=null;function dv(){O(()=>{wt||(wt={start:Zl(),end:Zl()});const{start:e,end:t}=wt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),ta++,()=>{ta===1&&(wt==null||wt.start.remove(),wt==null||wt.end.remove(),wt=null),ta=Math.max(0,ta-1)}},[])}function Zl(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Nt=function(){return Nt=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Nt.apply(this,arguments)};function uu(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function uv(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,o;r<a;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var ha="right-scroll-bar-position",ma="width-before-scroll-bar",fv="with-scroll-bars-hidden",pv="--removed-body-scroll-bar-size";function Oo(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function hv(e,t){var n=E(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var mv=typeof window<"u"?Wn:O,Ql=new WeakMap;function gv(e,t){var n=hv(null,function(r){return e.forEach(function(a){return Oo(a,r)})});return mv(function(){var r=Ql.get(n);if(r){var a=new Set(r),o=new Set(e),s=n.current;a.forEach(function(l){o.has(l)||Oo(l,null)}),o.forEach(function(l){a.has(l)||Oo(l,s)})}Ql.set(n,e)},[e]),n}function yv(e){return e}function vv(e,t){t===void 0&&(t=yv);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var s=t(o,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(o){for(r=!0;n.length;){var s=n;n=[],s.forEach(o)}n={push:function(l){return o(l)},filter:function(){return n}}},assignMedium:function(o){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(o),s=n}var c=function(){var f=s;s=[],f.forEach(o)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){s.push(f),d()},filter:function(f){return s=s.filter(f),n}}}};return a}function bv(e){e===void 0&&(e={});var t=vv(null);return t.options=Nt({async:!0,ssr:!1},e),t}var fu=function(e){var t=e.sideCar,n=uu(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return ie(r,Nt({},n))};fu.isSideCarExport=!0;function xv(e,t){return e.useMedium(t),fu}var pu=bv(),_o=function(){},ro=W(function(e,t){var n=M(null),r=E({onScrollCapture:_o,onWheelCapture:_o,onTouchMoveCapture:_o}),a=r[0],o=r[1],s=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,y=e.allowPinchZoom,w=e.as,b=w===void 0?"div":w,v=e.gapMode,C=uu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=p,T=gv([n,t]),R=Nt(Nt({},C),a);return ie(fn,null,f&&ie(N,{sideCar:pu,removeScrollBar:d,shards:u,noRelative:m,noIsolation:h,inert:g,setCallbacks:o,allowPinchZoom:!!y,lockRef:n,gapMode:v}),s?wd(Wa.only(l),Nt(Nt({},R),{ref:T})):ie(b,Nt({},R,{className:c,ref:T}),l))});ro.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ro.classNames={fullWidth:ma,zeroRight:ha};var wv=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Cv(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wv();return t&&e.setAttribute("nonce",t),e}function Nv(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Sv(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ev=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Cv())&&(Nv(t,n),Sv(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Tv=function(){var e=Ev();return function(t,n){O(function(){return e.add(t),function(){e.remove()}},[t&&n])}},hu=function(){var e=Tv(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},kv={left:0,top:0,right:0,gap:0},Fo=function(e){return parseInt(e||"",10)||0},Rv=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[Fo(n),Fo(r),Fo(a)]},Pv=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return kv;var t=Rv(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Dv=hu(),_n="data-scroll-locked",Iv=function(e,t,n,r){var a=e.left,o=e.top,s=e.right,l=e.gap;return n===void 0&&(n="margin"),`
147
147
  .`.concat(fv,` {
148
148
  overflow: hidden `).concat(r,`;
149
149
  padding-right: `).concat(l,"px ").concat(r,`;
@@ -180,15 +180,15 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
180
180
  body[`).concat(_n,`] {
181
181
  `).concat(pv,": ").concat(l,`px;
182
182
  }
183
- `)},ec=function(){var e=parseInt(document.body.getAttribute(_n)||"0",10);return isFinite(e)?e:0},Lv=function(){O(function(){return document.body.setAttribute(_n,(ec()+1).toString()),function(){var e=ec()-1;e<=0?document.body.removeAttribute(_n):document.body.setAttribute(_n,e.toString())}},[])},Av=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;Lv();var o=Q(function(){return Pv(a)},[a]);return ie(Dv,{styles:Iv(o,!t,a,n?"":"!important")})},ys=!1;if(typeof window<"u")try{var na=Object.defineProperty({},"passive",{get:function(){return ys=!0,!0}});window.addEventListener("test",na,na),window.removeEventListener("test",na,na)}catch{ys=!1}var Dn=ys?{passive:!1}:!1,Mv=function(e){return e.tagName==="TEXTAREA"},hu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Mv(e)&&n[t]==="visible")},Ov=function(e){return hu(e,"overflowY")},_v=function(e){return hu(e,"overflowX")},tc=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=mu(e,r);if(a){var o=gu(e,r),s=o[1],l=o[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Fv=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},$v=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},mu=function(e,t){return e==="v"?Ov(t):_v(t)},gu=function(e,t){return e==="v"?Fv(t):$v(t)},Bv=function(e,t){return e==="h"&&t==="rtl"?-1:1},Uv=function(e,t,n,r,a){var o=Bv(e,window.getComputedStyle(t).direction),s=o*r,l=n.target,c=t.contains(l),d=!1,f=s>0,u=0,p=0;do{if(!l)break;var m=gu(e,l),h=m[0],g=m[1],y=m[2],w=g-y-o*h;(h||w)&&mu(e,l)&&(u+=w,p+=h);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(f&&Math.abs(u)<1||!f&&Math.abs(p)<1)&&(d=!0),d},ra=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nc=function(e){return[e.deltaX,e.deltaY]},rc=function(e){return e&&"current"in e?e.current:e},zv=function(e,t){return e[0]===t[0]&&e[1]===t[1]},jv=function(e){return`
183
+ `)},ec=function(){var e=parseInt(document.body.getAttribute(_n)||"0",10);return isFinite(e)?e:0},Lv=function(){O(function(){return document.body.setAttribute(_n,(ec()+1).toString()),function(){var e=ec()-1;e<=0?document.body.removeAttribute(_n):document.body.setAttribute(_n,e.toString())}},[])},Av=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;Lv();var o=Q(function(){return Pv(a)},[a]);return ie(Dv,{styles:Iv(o,!t,a,n?"":"!important")})},ys=!1;if(typeof window<"u")try{var na=Object.defineProperty({},"passive",{get:function(){return ys=!0,!0}});window.addEventListener("test",na,na),window.removeEventListener("test",na,na)}catch{ys=!1}var Dn=ys?{passive:!1}:!1,Mv=function(e){return e.tagName==="TEXTAREA"},mu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Mv(e)&&n[t]==="visible")},Ov=function(e){return mu(e,"overflowY")},_v=function(e){return mu(e,"overflowX")},tc=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=gu(e,r);if(a){var o=yu(e,r),s=o[1],l=o[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Fv=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},$v=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},gu=function(e,t){return e==="v"?Ov(t):_v(t)},yu=function(e,t){return e==="v"?Fv(t):$v(t)},Bv=function(e,t){return e==="h"&&t==="rtl"?-1:1},Uv=function(e,t,n,r,a){var o=Bv(e,window.getComputedStyle(t).direction),s=o*r,l=n.target,c=t.contains(l),d=!1,f=s>0,u=0,p=0;do{if(!l)break;var m=yu(e,l),h=m[0],g=m[1],y=m[2],w=g-y-o*h;(h||w)&&gu(e,l)&&(u+=w,p+=h);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(f&&Math.abs(u)<1||!f&&Math.abs(p)<1)&&(d=!0),d},ra=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nc=function(e){return[e.deltaX,e.deltaY]},rc=function(e){return e&&"current"in e?e.current:e},zv=function(e,t){return e[0]===t[0]&&e[1]===t[1]},jv=function(e){return`
184
184
  .block-interactivity-`.concat(e,` {pointer-events: none;}
185
185
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
186
- `)},Vv=0,In=[];function Hv(e){var t=M([]),n=M([0,0]),r=M(),a=E(Vv++)[0],o=E(pu)[0],s=M(e);O(function(){s.current=e},[e]),O(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var g=uv([e.lockRef.current],(e.shards||[]).map(rc),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=H(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!s.current.allowPinchZoom;var w=ra(g),b=n.current,v="deltaX"in g?g.deltaX:b[0]-w[0],C="deltaY"in g?g.deltaY:b[1]-w[1],N,T=g.target,k=Math.abs(v)>Math.abs(C)?"h":"v";if("touches"in g&&k==="h"&&T.type==="range")return!1;var L=window.getSelection(),R=L&&L.anchorNode,P=R?R===T||R.contains(T):!1;if(P)return!1;var I=tc(k,T);if(!I)return!0;if(I?N=k:(N=k==="v"?"h":"v",I=tc(k,T)),!I)return!1;if(!r.current&&"changedTouches"in g&&(v||C)&&(r.current=N),!N)return!0;var S=r.current||N;return Uv(S,y,g,S==="h"?v:C)},[]),c=H(function(g){var y=g;if(!(!In.length||In[In.length-1]!==o)){var w="deltaY"in y?nc(y):ra(y),b=t.current.filter(function(N){return N.name===y.type&&(N.target===y.target||y.target===N.shadowParent)&&zv(N.delta,w)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var v=(s.current.shards||[]).map(rc).filter(Boolean).filter(function(N){return N.contains(y.target)}),C=v.length>0?l(y,v[0]):!s.current.noIsolation;C&&y.cancelable&&y.preventDefault()}}},[]),d=H(function(g,y,w,b){var v={name:g,delta:y,target:w,should:b,shadowParent:Kv(w)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(C){return C!==v})},1)},[]),f=H(function(g){n.current=ra(g),r.current=void 0},[]),u=H(function(g){d(g.type,nc(g),g.target,l(g,e.lockRef.current))},[]),p=H(function(g){d(g.type,ra(g),g.target,l(g,e.lockRef.current))},[]);O(function(){return In.push(o),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Dn),document.addEventListener("touchmove",c,Dn),document.addEventListener("touchstart",f,Dn),function(){In=In.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,Dn),document.removeEventListener("touchmove",c,Dn),document.removeEventListener("touchstart",f,Dn)}},[]);var m=e.removeScrollBar,h=e.inert;return ie(fn,null,h?ie(o,{styles:jv(a)}):null,m?ie(Av,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Kv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Wv=xv(fu,Hv);var ui=W(function(e,t){return ie(ro,Nt({},e,{ref:t,sideCar:Wv}))});ui.classNames=ro.classNames;var qv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ln=new WeakMap,aa=new WeakMap,oa={},$o=0,yu=function(e){return e&&(e.host||yu(e.parentNode))},Gv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=yu(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Yv=function(e,t,n,r){var a=Gv(t,Array.isArray(e)?e:[e]);oa[n]||(oa[n]=new WeakMap);var o=oa[n],s=[],l=new Set,c=new Set(a),d=function(u){!u||l.has(u)||(l.add(u),d(u.parentNode))};a.forEach(d);var f=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(p){if(l.has(p))f(p);else try{var m=p.getAttribute(r),h=m!==null&&m!=="false",g=(Ln.get(p)||0)+1,y=(o.get(p)||0)+1;Ln.set(p,g),o.set(p,y),s.push(p),g===1&&h&&aa.set(p,!0),y===1&&p.setAttribute(n,"true"),h||p.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",p,w)}})};return f(t),l.clear(),$o++,function(){s.forEach(function(u){var p=Ln.get(u)-1,m=o.get(u)-1;Ln.set(u,p),o.set(u,m),p||(aa.has(u)||u.removeAttribute(r),aa.delete(u)),m||u.removeAttribute(n)}),$o--,$o||(Ln=new WeakMap,Ln=new WeakMap,aa=new WeakMap,oa={})}},vu=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=qv(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),Yv(r,a,n,"aria-hidden")):function(){return null}},ao="Dialog",[bu,xu]=Xa(ao),[Xv,yt]=bu(ao),wu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,l=M(null),c=M(null),[d,f]=Td({prop:r,defaultProp:a??!1,onChange:o,caller:ao});return i(Xv,{scope:t,triggerRef:l,contentRef:c,contentId:Lo(),titleId:Lo(),descriptionId:Lo(),open:d,onOpenChange:f,onOpenToggle:H(()=>f(u=>!u),[f]),modal:s,children:n})};wu.displayName=ao;var Cu="DialogTrigger",Nu=W((e,t)=>{const{__scopeDialog:n,...r}=e,a=yt(Cu,n),o=ft(t,a.triggerRef);return i(qe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":hi(a.open),...r,ref:o,onClick:Me(e.onClick,a.onOpenToggle)})});Nu.displayName=Cu;var fi="DialogPortal",[Jv,Eu]=bu(fi,{forceMount:void 0}),Su=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=yt(fi,t);return i(Jv,{scope:t,forceMount:n,children:Wa.map(r,s=>i(Ja,{present:n||o.open,children:i(di,{asChild:!0,container:a,children:s})}))})};Su.displayName=fi;var Sa="DialogOverlay",Tu=W((e,t)=>{const n=Eu(Sa,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=yt(Sa,e.__scopeDialog);return o.modal?i(Ja,{present:r||o.open,children:i(Qv,{...a,ref:t})}):null});Tu.displayName=Sa;var Zv=ss("DialogOverlay.RemoveScroll"),Qv=W((e,t)=>{const{__scopeDialog:n,...r}=e,a=yt(Sa,n),o=Jy(),s=ft(t,o);return i(ui,{as:Zv,allowPinchZoom:!0,shards:[a.contentRef],children:i(qe.div,{"data-state":hi(a.open),...r,ref:s,style:{pointerEvents:"auto",...r.style}})})}),zn="DialogContent",ku=W((e,t)=>{const n=Eu(zn,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=yt(zn,e.__scopeDialog);return i(Ja,{present:r||o.open,children:o.modal?i(eb,{...a,ref:t}):i(tb,{...a,ref:t})})});ku.displayName=zn;var eb=W((e,t)=>{const n=yt(zn,e.__scopeDialog),r=M(null),a=ft(t,n.contentRef,r);return O(()=>{const o=r.current;if(o)return vu(o)},[]),i(Ru,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Me(e.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Me(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&o.preventDefault()}),onFocusOutside:Me(e.onFocusOutside,o=>o.preventDefault())})}),tb=W((e,t)=>{const n=yt(zn,e.__scopeDialog),r=M(!1),a=M(!1);return i(Ru,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,o),o.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),o.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:o=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),Ru=W((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...s}=e,l=yt(zn,n);return dv(),i(Ie,{children:i(lu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:i(ci,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":hi(l.open),...s,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})}),Pu="DialogTitle",Du=W((e,t)=>{const{__scopeDialog:n,...r}=e,a=yt(Pu,n);return i(qe.h2,{id:a.titleId,...r,ref:t})});Du.displayName=Pu;var Iu="DialogDescription",Lu=W((e,t)=>{const{__scopeDialog:n,...r}=e,a=yt(Iu,n);return i(qe.p,{id:a.descriptionId,...r,ref:t})});Lu.displayName=Iu;var Au="DialogClose",pi=W((e,t)=>{const{__scopeDialog:n,...r}=e,a=yt(Au,n);return i(qe.button,{type:"button",...r,ref:t,onClick:Me(e.onClick,()=>a.onOpenChange(!1))})});pi.displayName=Au;function hi(e){return e?"open":"closed"}var Mu="AlertDialog",[nb]=Xa(Mu,[xu]),qt=xu(),Ou=e=>{const{__scopeAlertDialog:t,...n}=e,r=qt(t);return i(wu,{...r,...n,modal:!0})};Ou.displayName=Mu;var rb="AlertDialogTrigger",ab=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qt(n);return i(Nu,{...a,...r,ref:t})});ab.displayName=rb;var ob="AlertDialogPortal",_u=e=>{const{__scopeAlertDialog:t,...n}=e,r=qt(t);return i(Su,{...r,...n})};_u.displayName=ob;var sb="AlertDialogOverlay",Fu=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qt(n);return i(Tu,{...a,...r,ref:t})});Fu.displayName=sb;var $u="AlertDialogContent",[ib,lb]=nb($u),Bu=W((e,t)=>{const{__scopeAlertDialog:n,children:r,...a}=e,o=qt(n),s=M(null),l=ft(t,s),c=M(null);return i(ib,{scope:n,cancelRef:c,children:i(ku,{role:"alertdialog",...o,...a,ref:l,onOpenAutoFocus:Me(a.onOpenAutoFocus,d=>{var f;d.preventDefault(),(f=c.current)==null||f.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:r})})});Bu.displayName=$u;var cb="AlertDialogTitle",Uu=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qt(n);return i(Du,{...a,...r,ref:t})});Uu.displayName=cb;var db="AlertDialogDescription",zu=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qt(n);return i(Lu,{...a,...r,ref:t})});zu.displayName=db;var ub="AlertDialogAction",ju=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qt(n);return i(pi,{...a,...r,ref:t})});ju.displayName=ub;var Vu="AlertDialogCancel",Hu=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=lb(Vu,n),o=qt(n),s=ft(t,a);return i(pi,{...o,...r,ref:s})});Hu.displayName=Vu;var fb=Ou,pb=_u,hb=Fu,mb=Bu,gb=ju,yb=Hu,vb=Uu,bb=zu;const Jn=fb,xb=pb;function wb({className:e,...t}){return i(hb,{className:se("fixed inset-0 z-50 bg-background-overlay",e),...t})}function Zn({className:e,...t}){return x(xb,{children:[i(wb,{}),i(mb,{className:se("fixed start-1/2 top-1/2 z-50 w-full max-w-lg -translate-y-1/2 ltr:-translate-x-1/2 rtl:translate-x-1/2 rounded-xl border border-border-default bg-background-elevated p-6 shadow-xl",e),...t})]})}function Qn({className:e,...t}){return i("div",{className:se("flex flex-col gap-2 text-start",e),...t})}function er({className:e,...t}){return i("div",{className:se("mt-6 flex justify-end gap-2",e),...t})}function tr({className:e,...t}){return i(vb,{className:se("text-base font-semibold text-text-primary",e),...t})}function nr({className:e,...t}){return i(bb,{className:se("text-sm text-text-secondary",e),...t})}function rr({className:e,...t}){return i(gb,{className:se(Tt(),e),...t})}function ar({className:e,...t}){return i(yb,{className:se(Tt({variant:"outline"}),e),...t})}var Cb=Object.defineProperty,Fe=(e,t)=>Cb(e,"name",{value:t,configurable:!0});function mi(e){const t=e+"CollectionProvider",[n,r]=qn(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=Fe(g=>{const{scope:y,children:w}=g,b=M(null),v=M(new Map).current;return i(a,{scope:y,itemMap:v,collectionRef:b,children:w})},"CollectionProvider");s.displayName=t;const l=e+"CollectionSlot",c=kr(l),d=W((g,y)=>{const{scope:w,children:b}=g,v=o(l,w),C=Ye(y,v.collectionRef);return i(c,{ref:C,children:b})});d.displayName=l;const f=e+"CollectionItemSlot",u="data-radix-collection-item",p=kr(f),m=W((g,y)=>{const{scope:w,children:b,...v}=g,C=M(null),N=Ye(y,C),T=o(f,w);return O(()=>(T.itemMap.set(C,{ref:C,...v}),()=>void T.itemMap.delete(C))),i(p,{[u]:"",ref:N,children:b})});m.displayName=f;function h(g){const y=o(e+"CollectionConsumer",g);return H(()=>{const b=y.collectionRef.current;if(!b)return[];const v=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((T,k)=>v.indexOf(T.ref.current)-v.indexOf(k.ref.current))},[y.collectionRef,y.itemMap])}return Fe(h,"useCollection"),[{Provider:s,Slot:d,ItemSlot:m},h,r]}Fe(mi,"createCollection");var ac=new WeakMap,De,at,Bo=(at=class extends Map{constructor(n){super(n);yl(this,De);Eo(this,De,[...super.keys()]),ac.set(this,!0)}set(n,r){return ac.get(this)&&(this.has(n)?We(this,De)[We(this,De).indexOf(n)]=n:We(this,De).push(n)),super.set(n,r),this}insert(n,r,a){const o=this.has(r),s=We(this,De).length,l=gi(n);let c=l>=0?l:s+l;const d=c<0||c>=s?-1:c;if(d===this.size||o&&d===this.size-1||d===-1)return this.set(r,a),this;const f=this.size+(o?0:1);l<0&&c++;const u=[...We(this,De)];let p,m=!1;for(let h=c;h<f;h++)if(c===h){let g=u[h];u[h]===r&&(g=u[h+1]),o&&this.delete(r),p=this.get(g),this.set(r,a)}else{!m&&u[h-1]===r&&(m=!0);const g=u[m?h:h-1],y=p;p=this.get(g),this.delete(g),this.set(g,y)}return this}with(n,r,a){const o=new at(this);return o.insert(n,r,a),o}before(n){const r=We(this,De).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,a){const o=We(this,De).indexOf(n);return o===-1?this:this.insert(o,r,a)}after(n){let r=We(this,De).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,a){const o=We(this,De).indexOf(n);return o===-1?this:this.insert(o+1,r,a)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Eo(this,De,[]),super.clear()}delete(n){const r=super.delete(n);return r&&We(this,De).splice(We(this,De).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=ga(We(this,De),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=ga(We(this,De),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return We(this,De).indexOf(n)}keyAt(n){return ga(We(this,De),n)}from(n,r){const a=this.indexOf(n);if(a===-1)return;let o=a+r;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.at(o)}keyFrom(n,r){const a=this.indexOf(n);if(a===-1)return;let o=a+r;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.keyAt(o)}find(n,r){let a=0;for(const o of this){if(Reflect.apply(n,r,[o,a,this]))return o;a++}}findIndex(n,r){let a=0;for(const o of this){if(Reflect.apply(n,r,[o,a,this]))return a;a++}return-1}filter(n,r){const a=[];let o=0;for(const s of this)Reflect.apply(n,r,[s,o,this])&&a.push(s),o++;return new at(a)}map(n,r){const a=[];let o=0;for(const s of this)a.push([s[0],Reflect.apply(n,r,[s,o,this])]),o++;return new at(a)}reduce(...n){const[r,a]=n;let o=0,s=a??this.at(0);for(const l of this)o===0&&n.length===1?s=l:s=Reflect.apply(r,this,[s,l,o,this]),o++;return s}reduceRight(...n){const[r,a]=n;let o=a??this.at(-1);for(let s=this.size-1;s>=0;s--){const l=this.at(s);s===this.size-1&&n.length===1?o=l:o=Reflect.apply(r,this,[o,l,s,this])}return o}toSorted(n){const r=[...this.entries()].sort(n);return new at(r)}toReversed(){const n=new at;for(let r=this.size-1;r>=0;r--){const a=this.keyAt(r),o=this.get(a);n.set(a,o)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new at(r)}slice(n,r){const a=new at;let o=this.size-1;if(n===void 0)return a;n<0&&(n=n+this.size),r!==void 0&&r>0&&(o=r-1);for(let s=n;s<=o;s++){const l=this.keyAt(s),c=this.get(l);a.set(l,c)}return a}every(n,r){let a=0;for(const o of this){if(!Reflect.apply(n,r,[o,a,this]))return!1;a++}return!0}some(n,r){let a=0;for(const o of this){if(Reflect.apply(n,r,[o,a,this]))return!0;a++}return!1}},De=new WeakMap,Fe(at,"OrderedDict"),at);function ga(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Ku(e,t);return n===-1?void 0:e[n]}Fe(ga,"at");function Ku(e,t){const n=e.length,r=gi(t),a=r>=0?r:n+r;return a<0||a>=n?-1:a}Fe(Ku,"toSafeIndex");function gi(e){return e!==e||e===0?0:Math.trunc(e)}Fe(gi,"toSafeInteger");function Nb(e){const t=e+"CollectionProvider",[n,r]=qn(t),[a,o]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Bo,setItemMap:Fe(()=>{},"setItemMap")}),s=Fe(({state:v,...C})=>v?i(c,{...C,state:v}):i(l,{...C}),"CollectionProvider");s.displayName=t;const l=Fe(v=>{const C=y();return i(c,{...v,state:C})},"CollectionInit");l.displayName=t+"Init";const c=Fe(v=>{const{scope:C,children:N,state:T}=v,k=M(null),[L,R]=E(null),P=Ye(k,R),[I,S]=T;return O(()=>{if(!L)return;const A=Gu(()=>{});return A.observe(L,{childList:!0,subtree:!0}),()=>{A.disconnect()}},[L]),i(a,{scope:C,itemMap:I,setItemMap:S,collectionRef:P,collectionRefObject:k,collectionElement:L,children:N})},"CollectionProviderImpl");c.displayName=t+"Impl";const d=e+"CollectionSlot",f=kr(d),u=W((v,C)=>{const{scope:N,children:T}=v,k=o(d,N),L=Ye(C,k.collectionRef);return i(f,{ref:L,children:T})});u.displayName=d;const p=e+"CollectionItemSlot",m="data-radix-collection-item",h=kr(p),g=W((v,C)=>{const{scope:N,children:T,...k}=v,L=M(null),[R,P]=E(null),I=Ye(C,L,P),S=o(p,N),{setItemMap:A}=S,D=M(k);Wu(D.current,k)||(D.current=k);const U=D.current;return O(()=>{const z=U;return A(B=>R?B.has(R)?B.set(R,{...z,element:R}).toSorted(vs):(B.set(R,{...z,element:R}),B.toSorted(vs)):B),()=>{A(B=>!R||!B.has(R)?B:(B.delete(R),new Bo(B)))}},[R,U,A]),i(h,{[m]:"",ref:I,children:T})});g.displayName=p;function y(){return E(new Bo)}Fe(y,"useInitCollection");function w(v){const{itemMap:C}=o(e+"CollectionConsumer",v);return C}return Fe(w,"useCollection"),[{Provider:s,Slot:u,ItemSlot:g},{createCollectionScope:r,useCollection:w,useInitCollection:y}]}Fe(Nb,"createCollection");function Wu(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const a of n)if(!Object.prototype.hasOwnProperty.call(t,a)||e[a]!==t[a])return!1;return!0}Fe(Wu,"shallowEqual");function qu(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Fe(qu,"isElementPreceding");function vs(e,t){return!e[1].element||!t[1].element?0:qu(e[1].element,t[1].element)?-1:1}Fe(vs,"sortByDocumentPosition");function Gu(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}Fe(Gu,"getChildListObserver");var Eb=Object.defineProperty,Sb=(e,t)=>Eb(e,"name",{value:t,configurable:!0}),Tb=Te(void 0);function yi(e){const t=ne(Tb);return e||t||"ltr"}Sb(yi,"useDirection");var kb=Object.defineProperty,Rb=(e,t)=>kb(e,"name",{value:t,configurable:!0});function kt(e){const t=M(e);return O(()=>{t.current=e}),Q(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}Rb(kt,"useCallbackRef");var Pb=Object.defineProperty,_e=(e,t)=>Pb(e,"name",{value:t,configurable:!0}),bs="dismissableLayer.update",Db="dismissableLayer.pointerDownOutside",Ib="dismissableLayer.focusOutside",oc,Yu=Te({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Lb=W(_e(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:a=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:c,onDismiss:d,...f}=t,u=ne(Yu),[p,m]=E(null),h=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=E({}),y=Ye(n,m),w=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=b?w.indexOf(b):-1,C=p?w.indexOf(p):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,T=C>=v,k=M(!1),L=Xu(S=>{s==null||s(S),c==null||c(S),S.defaultPrevented||d==null||d()},{ownerDocument:h,deferPointerDownOutside:a,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:H(S=>{if(!(S instanceof Node))return!1;const A=[...u.branches].some(D=>D.contains(S));return T&&!A},[u.branches,T])}),R=Ju(S=>{if(a&&k.current)return;const A=S.target;[...u.branches].some(U=>U.contains(A))||(l==null||l(S),c==null||c(S),S.defaultPrevented||d==null||d())},h),P=p?C===w.length-1:!1,I=kt(S=>{S.key==="Escape"&&(o==null||o(S),!S.defaultPrevented&&d&&(S.preventDefault(),d()))});return O(()=>{if(P)return h.addEventListener("keydown",I,{capture:!0}),()=>h.removeEventListener("keydown",I,{capture:!0})},[h,P,I]),O(()=>{if(p)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(oc=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),xs(),()=>{r&&(u.layersWithOutsidePointerEventsDisabled.delete(p),u.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=oc))}},[p,h,r,u]),O(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),xs())},[p,u]),O(()=>{const S=_e(()=>g({}),"handleUpdate");return document.addEventListener(bs,S),()=>document.removeEventListener(bs,S)},[]),i(ot.div,{...f,ref:y,style:{pointerEvents:N?T?"auto":"none":void 0,...t.style},onFocusCapture:xe(t.onFocusCapture,R.onFocusCapture),onBlurCapture:xe(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:xe(t.onPointerDownCapture,L.onPointerDownCapture)})},"DismissableLayer"));function Ab(){const e=ne(Yu),[t,n]=E(null);return O(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}_e(Ab,"useDismissableLayerSurface");var Mb=_e(()=>!0,"IS_TRUE");function Xu(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o,shouldHandlePointerDownOutside:s=Mb}=t,l=kt(e),c=M(!1),d=M(!1),f=M(new Map),u=M(()=>{});return O(()=>{function p(){d.current=!1,a.current=!1,f.current.clear()}_e(p,"resetOutsideInteraction");function m(){return Array.from(f.current.values()).some(Boolean)}_e(m,"isOutsideInteractionIntercepted");function h(v){if(!d.current)return;const C=v.target;C instanceof Node&&[...o].some(T=>T.contains(C))||f.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{d.current&&u.current()},0)}_e(h,"handleInteractionCapture");function g(v){d.current&&f.current.set(v.type,!1)}_e(g,"handleInteractionBubble");const y=_e(v=>{if(v.target&&!c.current){let C=function(){n.removeEventListener("click",u.current);const T=m();p(),T||vi(Db,l,N,{discrete:!0})};if(_e(C,"handleAndDispatchPointerDownOutsideEvent"),!s(v.target)){n.removeEventListener("click",u.current),p(),c.current=!1;return}const N={originalEvent:v};d.current=!0,a.current=r&&v.button===0,f.current.clear(),!r||v.button!==0?C():(n.removeEventListener("click",u.current),u.current=C,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),p();c.current=!1},"handlePointerDown"),w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of w)n.addEventListener(v,h,!0),n.addEventListener(v,g);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",y),n.removeEventListener("click",u.current);for(const v of w)n.removeEventListener(v,h,!0),n.removeEventListener(v,g)}},[n,l,r,a,o,s]),{onPointerDownCapture:_e(()=>c.current=!0,"onPointerDownCapture")}}_e(Xu,"usePointerDownOutside");function Ju(e,t=globalThis==null?void 0:globalThis.document){const n=kt(e),r=M(!1);return O(()=>{const a=_e(o=>{o.target&&!r.current&&vi(Ib,n,{originalEvent:o},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:_e(()=>r.current=!0,"onFocusCapture"),onBlurCapture:_e(()=>r.current=!1,"onBlurCapture")}}_e(Ju,"useFocusOutside");function xs(){const e=new CustomEvent(bs);document.dispatchEvent(e)}_e(xs,"dispatchUpdate");function vi(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?kd(a,o):a.dispatchEvent(o)}_e(vi,"handleAndDispatchCustomEvent");var Ob=Object.defineProperty,bi=(e,t)=>Ob(e,"name",{value:t,configurable:!0}),sa=0,Ct=null;function _b(e){return xi(),e.children}bi(_b,"FocusGuards");function xi(){O(()=>{Ct||(Ct={start:ws(),end:ws()});const{start:e,end:t}=Ct;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),sa++,()=>{sa===1&&(Ct==null||Ct.start.remove(),Ct==null||Ct.end.remove(),Ct=null),sa=Math.max(0,sa-1)}},[])}bi(xi,"useFocusGuards");function ws(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}bi(ws,"createFocusGuard");var Fb=Object.defineProperty,Ge=(e,t)=>Fb(e,"name",{value:t,configurable:!0}),Uo="focusScope.autoFocusOnMount",zo="focusScope.autoFocusOnUnmount",sc={bubbles:!1,cancelable:!0},$b=W(Ge(function(t,n){const{loop:r=!1,trapped:a=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...l}=t,[c,d]=E(null),f=kt(o),u=kt(s),p=M(null),m=Ye(n,d),h=M({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;O(()=>{if(a){let y=function(C){if(h.paused||!c)return;const N=C.target;c.contains(N)?p.current=N:Ft(p.current,{select:!0})},w=function(C){if(h.paused||!c)return;const N=C.relatedTarget;N!==null&&(c.contains(N)||Ft(p.current,{select:!0}))},b=function(C){if(document.activeElement===document.body)for(const T of C)T.removedNodes.length>0&&Ft(c)};Ge(y,"handleFocusIn"),Ge(w,"handleFocusOut"),Ge(b,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",w);const v=new MutationObserver(b);return c&&v.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",w),v.disconnect()}}},[a,c,h.paused]),O(()=>{if(c){ic.add(h);const y=document.activeElement;if(!c.contains(y)){const b=new CustomEvent(Uo,sc);c.addEventListener(Uo,f),c.dispatchEvent(b),b.defaultPrevented||(Zu(rf(wi(c)),{select:!0}),document.activeElement===y&&Ft(c))}return()=>{c.removeEventListener(Uo,f),setTimeout(()=>{const b=new CustomEvent(zo,sc);c.addEventListener(zo,u),c.dispatchEvent(b),b.defaultPrevented||Ft(y??document.body,{select:!0}),c.removeEventListener(zo,u),ic.remove(h)},0)}}},[c,f,u,h]);const g=H(y=>{if(!r&&!a||h.paused)return;const w=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,b=document.activeElement;if(w&&b){const v=y.currentTarget,[C,N]=Qu(v);C&&N?!y.shiftKey&&b===N?(y.preventDefault(),r&&Ft(C,{select:!0})):y.shiftKey&&b===C&&(y.preventDefault(),r&&Ft(N,{select:!0})):b===v&&y.preventDefault()}},[r,a,h.paused]);return i(ot.div,{tabIndex:-1,...l,ref:m,onKeyDown:g})},"FocusScope"));function Zu(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ft(r,{select:t}),document.activeElement!==n)return}Ge(Zu,"focusFirst");function Qu(e){const t=wi(e),n=Cs(t,e),r=Cs(t.reverse(),e);return[n,r]}Ge(Qu,"getTabbableEdges");function wi(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Ge(r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Ge(wi,"getTabbableCandidates");function Cs(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ef(r,{upTo:t})))return r}Ge(Cs,"findVisible");function ef(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Ge(ef,"isHidden");function tf(e){return e instanceof HTMLInputElement&&"select"in e}Ge(tf,"isSelectableInput");function Ft(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&tf(e)&&t&&e.select()}}Ge(Ft,"focus");var ic=nf();function nf(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ns(e,t),e.unshift(t)},remove(t){var n;e=Ns(e,t),(n=e[0])==null||n.resume()}}}Ge(nf,"createFocusScopesStack");function Ns(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Ge(Ns,"arrayRemove");function rf(e){return e.filter(t=>t.tagName!=="A")}Ge(rf,"removeLinks");var Bb=Object.defineProperty,Ub=(e,t)=>Bb(e,"name",{value:t,configurable:!0}),zb=_r[" useId ".trim().toString()]||(()=>{}),jb=0;function Ta(e){const[t,n]=E(zb());return rn(()=>{e||n(r=>r??String(jb++))},[e]),e||(t?`radix-${t}`:"")}Ub(Ta,"useId");const Vb=["top","right","bottom","left"],dn=Math.min,zt=Math.max,ka=Math.round,ia=Math.floor,jt=e=>({x:e,y:e}),Hb={left:"right",right:"left",bottom:"top",top:"bottom"};function af(e,t,n){return zt(e,dn(t,n))}function Vt(e,t){return typeof e=="function"?e(t):e}function un(e){return e.split("-")[0]}function or(e){return e.split("-")[1]}function Ci(e){return e==="x"?"y":"x"}function Ni(e){return e==="y"?"height":"width"}function St(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ei(e){return Ci(St(e))}function Kb(e,t,n){n===void 0&&(n=!1);const r=or(e),a=Ei(e),o=Ni(a);let s=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Ra(s)),[s,Ra(s)]}function Wb(e){const t=Ra(e);return[Es(e),t,Es(t)]}function Es(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const lc=["left","right"],cc=["right","left"],qb=["top","bottom"],Gb=["bottom","top"];function Yb(e,t,n){switch(e){case"top":case"bottom":return n?t?cc:lc:t?lc:cc;case"left":case"right":return t?qb:Gb;default:return[]}}function Xb(e,t,n,r){const a=or(e);let o=Yb(un(e),n==="start",r);return a&&(o=o.map(s=>s+"-"+a),t&&(o=o.concat(o.map(Es)))),o}function Ra(e){const t=un(e);return Hb[t]+e.slice(t.length)}function Jb(e){var t,n,r,a;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(a=e.left)!=null?a:0}}function of(e){return typeof e!="number"?Jb(e):{top:e,right:e,bottom:e,left:e}}function Pa(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function dc(e,t,n){let{reference:r,floating:a}=e;const o=St(t),s=Ei(t),l=Ni(s),c=un(t),d=o==="y",f=r.x+r.width/2-a.width/2,u=r.y+r.height/2-a.height/2,p=r[l]/2-a[l]/2;let m;switch(c){case"top":m={x:f,y:r.y-a.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:u};break;case"left":m={x:r.x-a.width,y:u};break;default:m={x:r.x,y:r.y}}const h=or(t);return h&&(m[s]+=p*(h==="end"?1:-1)*(n&&d?-1:1)),m}async function Zb(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:o,rects:s,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:m=0}=Vt(t,e),h=of(m),y=l[p?u==="floating"?"reference":"floating":u],w=Pa(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),b=u==="floating"?{x:r,y:a,width:s.floating.width,height:s.floating.height}:s.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),C=await(o.isElement==null?void 0:o.isElement(v))&&await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1},N=Pa(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:v,strategy:c}):b);return{top:(w.top-N.top+h.top)/C.y,bottom:(N.bottom-w.bottom+h.bottom)/C.y,left:(w.left-N.left+h.left)/C.x,right:(N.right-w.right+h.right)/C.x}}const Qb=50,ex=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:Zb},c=await(s.isRTL==null?void 0:s.isRTL(t));let d=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:f,y:u}=dc(d,r,c),p=r,m=0;const h={};for(let g=0;g<o.length;g++){const y=o[g];if(!y)continue;const{name:w,fn:b}=y,{x:v,y:C,data:N,reset:T}=await b({x:f,y:u,initialPlacement:r,placement:p,strategy:a,middlewareData:h,rects:d,platform:l,elements:{reference:e,floating:t}});f=v??f,u=C??u,h[w]={...h[w],...N},T&&m<Qb&&(m++,typeof T=="object"&&(T.placement&&(p=T.placement),T.rects&&(d=T.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:a}):T.rects),{x:f,y:u}=dc(d,p,c)),g=-1)}return{x:f,y:u,placement:p,strategy:a,middlewareData:h}},tx=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:o,platform:s,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=Vt(e,t)||{};if(d==null)return{};const u=of(f),p={x:n,y:r},m=Ei(a),h=Ni(m),g=await s.getDimensions(d),y=m==="y",w=y?"top":"left",b=y?"bottom":"right",v=y?"clientHeight":"clientWidth",C=o.reference[h]+o.reference[m]-p[m]-o.floating[h],N=p[m]-o.reference[m],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let k=T?T[v]:0;(!k||!await(s.isElement==null?void 0:s.isElement(T)))&&(k=l.floating[v]||o.floating[h]);const L=C/2-N/2,R=k/2-g[h]/2-1,P=dn(u[w],R),I=dn(u[b],R),S=k-g[h]-I,A=k/2-g[h]/2+L,D=af(P,A,S),U=!c.arrow&&or(a)!=null&&A!==D&&o.reference[h]/2-(A<P?P:I)-g[h]/2<0,z=U?A<P?A-P:A-S:0;return{[m]:p[m]+z,data:{[m]:D,centerOffset:A-D-z,...U&&{alignmentOffset:z}},reset:U}}}),nx=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:o,rects:s,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...y}=Vt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=un(a),b=St(l),v=un(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=p||(v||!g?[Ra(l)]:Wb(l)),T=h!=="none";!p&&T&&N.push(...Xb(l,g,h,C));const k=[l,...N],L=await c.detectOverflow(t,y),R=[];let P=((r=o.flip)==null?void 0:r.overflows)||[];if(f&&R.push(L[w]),u){const D=Kb(a,s,C);R.push(L[D[0]],L[D[1]])}if(P=[...P,{placement:a,overflows:R}],!R.every(D=>D<=0)){var I,S;const D=(((I=o.flip)==null?void 0:I.index)||0)+1,U=k[D];if(U&&(!(u==="alignment"?b!==St(U):!1)||P.every(_=>St(_.placement)===b?_.overflows[0]>0:!0)))return{data:{index:D,overflows:P},reset:{placement:U}};let z=(S=P.filter(B=>B.overflows[0]<=0).sort((B,_)=>B.overflows[1]-_.overflows[1])[0])==null?void 0:S.placement;if(!z)switch(m){case"bestFit":{var A;const B=(A=P.filter(_=>{if(T){const G=St(_.placement);return G===b||G==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(G=>G>0).reduce((G,V)=>G+V,0)]).sort((_,G)=>_[1]-G[1])[0])==null?void 0:A[0];B&&(z=B);break}case"initialPlacement":z=l;break}if(a!==z)return{reset:{placement:z}}}return{}}}};function uc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fc(e){return Vb.some(t=>e[t]>=0)}const rx=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...o}=Vt(e,t);switch(a){case"referenceHidden":{const s=await r.detectOverflow(t,{...o,elementContext:"reference"}),l=uc(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:fc(l)}}}case"escaped":{const s=await r.detectOverflow(t,{...o,altBoundary:!0}),l=uc(s,n.floating);return{data:{escapedOffsets:l,escaped:fc(l)}}}default:return{}}}}},sf=new Set(["left","top"]);async function ax(e,t){const{placement:n,platform:r,elements:a}=e,o=await(r.isRTL==null?void 0:r.isRTL(a.floating)),s=un(n),l=or(n),c=St(n)==="y",d=sf.has(s)?-1:1,f=o&&c?-1:1,u=Vt(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof h=="number"&&(m=l==="end"?h*-1:h),c?{x:m*f,y:p*d}:{x:p*d,y:m*f}}const ox=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:o,placement:s,middlewareData:l}=t,c=await ax(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:s}}}}},sx=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a,platform:o}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:v,y:C}=b;return{x:v,y:C}}},...d}=Vt(e,t),f={x:n,y:r},u=await o.detectOverflow(t,d),p=St(a),m=Ci(p);let h=f[m],g=f[p];const y=(b,v)=>af(v+u[b==="y"?"top":"left"],v,v-u[b==="y"?"bottom":"right"]);s&&(h=y(m,h)),l&&(g=y(p,g));const w=c.fn({...t,[m]:h,[p]:g});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[m]:s,[p]:l}}}}}},ix=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:a,y:o,placement:s,rects:l,middlewareData:c}=t,{offset:d=0,mainAxis:f=!0,crossAxis:u=!0}=Vt(e,t),p={x:a,y:o},m=St(s),h=Ci(m);let g=p[h],y=p[m];const w=Vt(d,t),b=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:(n=w.mainAxis)!=null?n:0,crossAxis:(r=w.crossAxis)!=null?r:0};if(f){const N=h==="y"?"height":"width",T=l.reference[h]-l.floating[N]+b.mainAxis,k=l.reference[h]+l.reference[N]-b.mainAxis;g<T?g=T:g>k&&(g=k)}if(u){var v,C;const N=h==="y"?"width":"height",T=sf.has(un(s)),k=l.reference[m]-l.floating[N]+(T&&((v=c.offset)==null?void 0:v[m])||0)+(T?0:b.crossAxis),L=l.reference[m]+l.reference[N]+(T?0:((C=c.offset)==null?void 0:C[m])||0)-(T?b.crossAxis:0);y<k?y=k:y>L&&(y=L)}return{[h]:g,[m]:y}}}},lx=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:a,elements:o}=t,{apply:s=()=>{},...l}=Vt(e,t),c=await a.detectOverflow(t,l),d=un(n),f=or(n),u=St(n)==="y",{width:p,height:m}=r.floating;let h,g;d==="top"||d==="bottom"?(h=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(g=d,h=f==="end"?"top":"bottom");const y=m-c.top-c.bottom,w=p-c.left-c.right,b=dn(m-c[h],y),v=dn(p-c[g],w),C=t.middlewareData.shift,N=!C;let T=b,k=v;C!=null&&C.enabled.x&&(k=w),C!=null&&C.enabled.y&&(T=y),N&&!f&&(u?k=p-2*zt(c.left,c.right):T=m-2*zt(c.top,c.bottom)),await s({...t,availableWidth:k,availableHeight:T});const L=await a.getDimensions(o.floating);return p!==L.width||m!==L.height?{reset:{rects:!0}}:{}}}};function oo(){return typeof window<"u"}function sr(e){return lf(e)?(e.nodeName||"").toLowerCase():"#document"}function Qe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Gt(e){var t;return(t=(lf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lf(e){return oo()?e instanceof Node||e instanceof Qe(e).Node:!1}function Rt(e){return oo()?e instanceof Element||e instanceof Qe(e).Element:!1}function pn(e){return oo()?e instanceof HTMLElement||e instanceof Qe(e).HTMLElement:!1}function pc(e){return!oo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qe(e).ShadowRoot}function so(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Pt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function cx(e){return/^(table|td|th)$/.test(sr(e))}function io(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const dx=/transform|translate|scale|rotate|perspective|filter/,ux=/paint|layout|strict|content/,gn=e=>!!e&&e!=="none";let jo;function Si(e){const t=Rt(e)?Pt(e):e;return gn(t.transform)||gn(t.translate)||gn(t.scale)||gn(t.rotate)||gn(t.perspective)||!Ti()&&(gn(t.backdropFilter)||gn(t.filter))||dx.test(t.willChange||"")||ux.test(t.contain||"")}function fx(e){let t=bn(e);for(;pn(t)&&!Dr(t);){if(Si(t))return t;if(io(t))return null;t=bn(t)}return null}function Ti(){return jo==null&&(jo=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),jo}function Dr(e){return/^(html|body|#document)$/.test(sr(e))}function Pt(e){return Qe(e).getComputedStyle(e)}function lo(e){return Rt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bn(e){if(sr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||pc(e)&&e.host||Gt(e);return pc(t)?t.host:t}function cf(e){const t=bn(e);return Dr(t)?(e.ownerDocument||e).body:pn(t)&&so(t)?t:cf(t)}function Ir(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=cf(e),o=a===((r=e.ownerDocument)==null?void 0:r.body),s=Qe(a);if(o){const l=Ss(s);return t.concat(s,s.visualViewport||[],so(a)?a:[],l&&n?Ir(l):[])}else return t.concat(a,Ir(a,[],n))}function Ss(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function df(e){const t=Pt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=pn(e),o=a?e.offsetWidth:n,s=a?e.offsetHeight:r,l=ka(n)!==o||ka(r)!==s;return l&&(n=o,r=s),{width:n,height:r,$:l}}function ki(e){return Rt(e)?e:e.contextElement}function Fn(e){const t=ki(e);if(!pn(t))return jt(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:o}=df(t);let s=(o?ka(n.width):n.width)/r,l=(o?ka(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const px=jt(0);function uf(e){const t=Qe(e);return!Ti()||!t.visualViewport?px:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hx(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Qe(e)}function xn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),o=ki(e);let s=jt(1);t&&(r?Rt(r)&&(s=Fn(r)):s=Fn(e));const l=hx(o,n,r)?uf(o):jt(0);let c=(a.left+l.x)/s.x,d=(a.top+l.y)/s.y,f=a.width/s.x,u=a.height/s.y;if(o&&r){const p=Qe(o),m=Rt(r)?Qe(r):r;let h=p,g=Ss(h);for(;g&&m!==h;){const y=Fn(g),w=g.getBoundingClientRect(),b=Pt(g),v=w.left+(g.clientLeft+parseFloat(b.paddingLeft))*y.x,C=w.top+(g.clientTop+parseFloat(b.paddingTop))*y.y;c*=y.x,d*=y.y,f*=y.x,u*=y.y,c+=v,d+=C,h=Qe(g),g=Ss(h)}}return Pa({width:f,height:u,x:c,y:d})}function co(e,t){const n=lo(e).scrollLeft;return t?t.left+n:xn(Gt(e)).left+n}function ff(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-co(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function mx(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const o=a==="fixed",s=Gt(r),l=t?io(t.floating):!1;if(r===s||l&&o)return n;let c={scrollLeft:0,scrollTop:0},d=jt(1);const f=jt(0),u=pn(r);if((u||!o)&&((sr(r)!=="body"||so(s))&&(c=lo(r)),u)){const m=xn(r);d=Fn(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const p=s&&!u&&!o?ff(s,c):jt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+p.x,y:n.y*d.y-c.scrollTop*d.y+f.y+p.y}}function gx(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function yx(e){const t=lo(e),n=e.ownerDocument.body,r=zt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),a=zt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+co(e);const s=-t.scrollTop;return Pt(n).direction==="rtl"&&(o+=zt(e.clientWidth,n.clientWidth)-r),{width:r,height:a,x:o,y:s}}const vx=25;function bx(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",a=Qe(e),o=Gt(e),s=a.visualViewport;let l=o.clientWidth,c=o.clientHeight,d=0,f=0;if(s){const p=!Ti()||t==="fixed";r?p||(d=-s.offsetLeft,f=-s.offsetTop):(l=s.width,c=s.height,p&&(d=s.offsetLeft,f=s.offsetTop))}if(co(o)<=0){const p=o.ownerDocument,m=p.body,h=getComputedStyle(m),g=p.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(o.clientWidth-m.clientWidth-g),w=getComputedStyle(o).scrollbarGutter==="stable both-edges"?y/2:y;w<=vx&&(l-=w)}return{width:l,height:c,x:d,y:f}}function xx(e,t){const n=xn(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=Fn(e),s=e.clientWidth*o.x,l=e.clientHeight*o.y,c=a*o.x,d=r*o.y;return{width:s,height:l,x:c,y:d}}function hc(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=bx(e,n,t);else if(t==="document")r=yx(Gt(e));else if(Rt(t))r=xx(t,n);else{const a=uf(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Pa(r)}function wx(e,t){const n=t.get(e);if(n)return n;let r=Ir(e,[],!1).filter(l=>Rt(l)&&sr(l)!=="body"),a=null;const o=Pt(e).position==="fixed";let s=o?bn(e):e;for(;Rt(s)&&!Dr(s);){const l=Pt(s),c=Si(s),d=a?a.position:o?"fixed":"";!c&&(d==="fixed"||d==="absolute"&&l.position==="static")?r=r.filter(u=>u!==s):a=l,s=bn(s)}return t.set(e,r),r}function Cx(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const s=[...n==="clippingAncestors"?io(t)?[]:wx(t,this._c):[].concat(n),r],l=hc(t,s[0],a);let c=l.top,d=l.right,f=l.bottom,u=l.left;for(let p=1;p<s.length;p++){const m=hc(t,s[p],a);c=zt(m.top,c),d=dn(m.right,d),f=dn(m.bottom,f),u=zt(m.left,u)}return{width:d-u,height:f-c,x:u,y:c}}function Nx(e){const{width:t,height:n}=df(e);return{width:t,height:n}}function Ex(e,t,n){const r=pn(t),a=Gt(t),o=n==="fixed",s=xn(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=jt(0);if((r||!o)&&((sr(t)!=="body"||so(a))&&(l=lo(t)),r)){const p=xn(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}!r&&a&&(c.x=co(a));const d=a&&!r&&!o?ff(a,l):jt(0),f=s.left+l.scrollLeft-c.x-d.x,u=s.top+l.scrollTop-c.y-d.y;return{x:f,y:u,width:s.width,height:s.height}}function Vo(e){return Pt(e).position==="static"}function mc(e,t){if(!pn(e)||Pt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Gt(e)===n&&(n=n.ownerDocument.body),n}function pf(e,t){const n=Qe(e);if(io(e))return n;if(!pn(e)){let a=bn(e);for(;a&&!Dr(a);){if(Rt(a)&&!Vo(a))return a;a=bn(a)}return n}let r=mc(e,t);for(;r&&cx(r)&&Vo(r);)r=mc(r,t);return r&&Dr(r)&&Vo(r)&&!Si(r)?n:r||fx(e)||n}const Sx=async function(e){const t=this.getOffsetParent||pf,n=this.getDimensions,r=await n(e.floating);return{reference:Ex(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tx(e){return Pt(e).direction==="rtl"}const kx={convertOffsetParentRelativeRectToViewportRelativeRect:mx,getDocumentElement:Gt,getClippingRect:Cx,getOffsetParent:pf,getElementRects:Sx,getClientRects:gx,getDimensions:Nx,getScale:Fn,isElement:Rt,isRTL:Tx};function hf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rx(e,t,n){let r=null,a;const o=Gt(e);function s(){var f;clearTimeout(a),(f=r)==null||f.disconnect(),r=null}function l(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),s();const p=e.getBoundingClientRect(),{left:m,top:h,width:g,height:y}=p;if(f||t(),!g||!y)return;const w=ia(h),b=ia(o.clientWidth-(m+g)),v=ia(o.clientHeight-(h+y)),C=ia(m),T={rootMargin:-w+"px "+-b+"px "+-v+"px "+-C+"px",threshold:zt(0,dn(1,u))||1};let k=!0;function L(R){const P=R[0].intersectionRatio;if(!hf(p,e.getBoundingClientRect()))return l();if(P!==u){if(!k)return l();P?l(!1,P):a=setTimeout(()=>{l(!1,1e-7)},1e3)}k=!1}try{r=new IntersectionObserver(L,{...T,root:o.ownerDocument})}catch{r=new IntersectionObserver(L,T)}r.observe(e)}const c=Qe(e),d=()=>l(n);return c.addEventListener("resize",d),l(!0),()=>{c.removeEventListener("resize",d),s()}}function Px(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=ki(e),f=a||o?[...d?Ir(d):[],...t?Ir(t):[]]:[];f.forEach(w=>{a&&w.addEventListener("scroll",n),o&&w.addEventListener("resize",n)});const u=d&&l?Rx(d,n,o):null;let p=-1,m=null;s&&(m=new ResizeObserver(w=>{let[b]=w;b&&b.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),d&&!c&&m.observe(d),t&&m.observe(t));let h,g=c?xn(e):null;c&&y();function y(){const w=xn(e);g&&!hf(g,w)&&n(),g=w,h=requestAnimationFrame(y)}return n(),()=>{var w;f.forEach(b=>{a&&b.removeEventListener("scroll",n),o&&b.removeEventListener("resize",n)}),u==null||u(),(w=m)==null||w.disconnect(),m=null,c&&cancelAnimationFrame(h)}}const Dx=ox,Ix=sx,Lx=nx,Ax=lx,Mx=rx,gc=tx,Ox=ix,_x=(e,t,n)=>{const r=new Map,a=n??{},o={...kx,...a.platform,_c:r};return ex(e,t,{...a,platform:o})};var Fx=typeof document<"u",$x=function(){},ya=Fx?Wn:$x;function Da(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Da(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const o=a[r];if(!(o==="_owner"&&e.$$typeof)&&!Da(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function mf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yc(e,t){const n=mf(e);return Math.round(t*n)/n}function Ho(e){const t=M(e);return ya(()=>{t.current=e}),t}function Bx(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,u]=E({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=E(r);Da(p,r)||m(r);const[h,g]=E(null),[y,w]=E(null),b=H(_=>{_!==T.current&&(T.current=_,g(_))},[]),v=H(_=>{_!==k.current&&(k.current=_,w(_))},[]),C=o||h,N=s||y,T=M(null),k=M(null),L=M(f),R=c!=null,P=Ho(c),I=Ho(a),S=Ho(d),A=H(()=>{if(!T.current||!k.current)return;const _={placement:t,strategy:n,middleware:p};I.current&&(_.platform=I.current),_x(T.current,k.current,_).then(G=>{const V={...G,isPositioned:S.current!==!1};D.current&&!Da(L.current,V)&&(L.current=V,Nh(()=>{u(V)}))})},[p,t,n,I,S]);ya(()=>{d===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,u(_=>({..._,isPositioned:!1})))},[d]);const D=M(!1);ya(()=>(D.current=!0,()=>{D.current=!1}),[]),ya(()=>{if(C&&(T.current=C),N&&(k.current=N),C&&N){if(P.current)return P.current(C,N,A);A()}},[C,N,A,P,R]);const U=Q(()=>({reference:T,floating:k,setReference:b,setFloating:v}),[b,v]),z=Q(()=>({reference:C,floating:N}),[C,N]),B=Q(()=>{const _={position:n,left:0,top:0};if(!z.floating)return _;const G=yc(z.floating,f.x),V=yc(z.floating,f.y);return l?{..._,transform:"translate("+G+"px, "+V+"px)",...mf(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:V}},[n,l,z.floating,f.x,f.y]);return Q(()=>({...f,update:A,refs:U,elements:z,floatingStyles:B}),[f,A,U,z,B])}const Ux=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?gc({element:r.current,padding:a}).fn(n):{}:r?gc({element:r,padding:a}).fn(n):{}}}},zx=(e,t)=>{const n=Dx(e);return{name:n.name,fn:n.fn,options:[e,t]}},jx=(e,t)=>{const n=Ix(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vx=(e,t)=>({fn:Ox(e).fn,options:[e,t]}),Hx=(e,t)=>{const n=Lx(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kx=(e,t)=>{const n=Ax(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wx=(e,t)=>{const n=Mx(e);return{name:n.name,fn:n.fn,options:[e,t]}},qx=(e,t)=>{const n=Ux(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Gx=Object.defineProperty,an=(e,t)=>Gx(e,"name",{value:t,configurable:!0}),gf="Popper",[yf,vf]=qn(gf),[Yx,bf]=yf(gf),Xx=an(e=>{const{__scopePopper:t,children:n}=e,[r,a]=E(null),[o,s]=E(void 0);return i(Yx,{scope:t,anchor:r,onAnchorChange:a,placementState:o,setPlacementState:s,children:n})},"Popper"),Jx="PopperAnchor",Zx=W(an(function(t,n){const{__scopePopper:r,virtualRef:a,...o}=t,s=bf(Jx,r),l=M(null),c=s.onAnchorChange,d=H(g=>{l.current=g,g&&c(g)},[c]),f=Ye(n,d),u=M(null);O(()=>{if(!a)return;const g=u.current;u.current=a.current,g!==u.current&&c(u.current)});const p=s.placementState&&uo(s.placementState),m=p==null?void 0:p[0],h=p==null?void 0:p[1];return a?null:i(ot.div,{"data-radix-popper-side":m,"data-radix-popper-align":h,...o,ref:f})},"PopperAnchor")),xf="PopperContent",[Qx,mk]=yf(xf),e0=W(an(function(t,n){var F,q,be,Pe,He,Be,Ue;const{__scopePopper:r,side:a="bottom",sideOffset:o=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:u=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...y}=t,w=bf(xf,r),[b,v]=E(null),C=Ye(n,v),[N,T]=E(null),k=Sh(N),L=(k==null?void 0:k.width)??0,R=(k==null?void 0:k.height)??0,P=a+(s!=="center"?"-"+s:""),I=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},S=Array.isArray(f)?f:[f],A=S.length>0,D={padding:I,boundary:S.filter(wf),altBoundary:A},{refs:U,floatingStyles:z,placement:B,isPositioned:_,middlewareData:G}=Bx({strategy:"fixed",placement:P,whileElementsMounted:an((...st)=>Px(...st,{animationFrame:h==="always"}),"whileElementsMounted"),elements:{reference:w.anchor},middleware:[zx({mainAxis:o+R,alignmentAxis:l}),d&&jx({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Vx():void 0,...D}),d&&Hx({...D}),Kx({...D,apply:an(({elements:st,rects:hn,availableWidth:kn,availableHeight:mn})=>{const{width:it,height:Yt}=hn.reference,$=st.floating.style;$.setProperty("--radix-popper-available-width",`${kn}px`),$.setProperty("--radix-popper-available-height",`${mn}px`),$.setProperty("--radix-popper-anchor-width",`${it}px`),$.setProperty("--radix-popper-anchor-height",`${Yt}px`)},"apply")}),N&&qx({element:N,padding:c}),t0({arrowWidth:L,arrowHeight:R}),m&&Wx({strategy:"referenceHidden",...D,boundary:A?D.boundary:void 0})]}),V=w.setPlacementState;rn(()=>(V(B),()=>{V(void 0)}),[B,V]);const[ee,Z]=uo(B),j=kt(g);rn(()=>{_&&(j==null||j())},[_,j]);const le=(F=G.arrow)==null?void 0:F.x,Ee=(q=G.arrow)==null?void 0:q.y,ge=((be=G.arrow)==null?void 0:be.centerOffset)!==0,[Le,ue]=E();return rn(()=>{b&&ue(window.getComputedStyle(b).zIndex)},[b]),i("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:_?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Le,"--radix-popper-transform-origin":[(Pe=G.transformOrigin)==null?void 0:Pe.x,(He=G.transformOrigin)==null?void 0:He.y].join(" "),...((Be=G.hide)==null?void 0:Be.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i(Qx,{scope:r,placedSide:ee,placedAlign:Z,onArrowChange:T,arrowX:le,arrowY:Ee,shouldHideArrow:ge,children:i(ot.div,{"data-side":ee,"data-align":Z,...y,ref:C,style:{...y.style,animation:_?(Ue=y.style)==null?void 0:Ue.animation:"none"}})})})},"PopperContent"));function wf(e){return e!==null}an(wf,"isNotNull");var t0=an(e=>({name:"transformOrigin",options:e,fn(t){var y,w,b;const{placement:n,rects:r,middlewareData:a}=t,s=((y=a.arrow)==null?void 0:y.centerOffset)!==0,l=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[d,f]=uo(n),u={start:"0%",center:"50%",end:"100%"}[f],p=(((w=a.arrow)==null?void 0:w.x)??0)+l/2,m=(((b=a.arrow)==null?void 0:b.y)??0)+c/2;let h="",g="";return d==="bottom"?(h=s?u:`${p}px`,g=`${-c}px`):d==="top"?(h=s?u:`${p}px`,g=`${r.floating.height+c}px`):d==="right"?(h=`${-c}px`,g=s?u:`${m}px`):d==="left"&&(h=`${r.floating.width+c}px`,g=s?u:`${m}px`),{data:{x:h,y:g}}}}),"transformOrigin");function uo(e){const[t,n="center"]=e.split("-");return[t,n]}an(uo,"getSideAndAlignFromPlacement");var n0=Xx,r0=Zx,a0=e0,o0=Object.defineProperty,s0=(e,t)=>o0(e,"name",{value:t,configurable:!0}),i0=W(s0(function(t,n){var c;const{container:r,...a}=t,[o,s]=E(!1);rn(()=>s(!0),[]);const l=r||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?Ga(i(ot.div,{...a,ref:n}),l):null},"Portal")),l0=Object.defineProperty,Ht=(e,t)=>l0(e,"name",{value:t,configurable:!0});function Cf(e,t){return Cd((n,r)=>t[n][r]??n,e)}Ht(Cf,"useStateMachine");var Ri=Ht(e=>{const{present:t,children:n}=e,r=Nf(t),a=typeof n=="function"?n({present:r.isPresent}):Wa.only(n),o=Ef(r.ref,Sf(a));return typeof n=="function"||r.isPresent?wd(a,{ref:o}):null},"Presence");function Nf(e){const[t,n]=E(),r=M(null),a=M(e),o=M("none"),s=M(void 0),l=e?"mounted":"unmounted",[c,d]=Cf(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return O(()=>{c==="mounted"?(o.current=s.current??An(r.current),s.current=void 0):o.current="none"},[c]),rn(()=>{const f=r.current,u=a.current;if(u!==e){const m=o.current,h=An(f);e?(s.current=h,d("MOUNT")):h==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(u&&m!==h?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,d]),rn(()=>{if(t){let f;const u=t.ownerDocument.defaultView??window,p=Ht(h=>{const y=An(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&y&&(d("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},"handleAnimationEnd"),m=Ht(h=>{h.target===t&&(o.current=An(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(f),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:H(f=>{if(f){const u=getComputedStyle(f);r.current=u,s.current=An(u)}else r.current=null;n(f)},[])}}Ht(Nf,"usePresence");function Ts(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ht(Ts,"setRef");function Ef(...e){const t=M(e);return t.current=e,H(n=>{const r=t.current;let a=!1;const o=r.map(s=>{const l=Ts(s,n);return!a&&typeof l=="function"&&(a=!0),l});if(a)return()=>{for(let s=0;s<o.length;s++){const l=o[s];typeof l=="function"?l():Ts(r[s],null)}}},[])}Ht(Ef,"useStableComposedRefs");function An(e){return(e==null?void 0:e.animationName)||"none"}Ht(An,"getAnimationName");function Sf(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ht(Sf,"getElementRef");var c0=Object.defineProperty,Pi=(e,t)=>c0(e,"name",{value:t,configurable:!0}),Ko=!1;function Tf(){const[e,t]=E(Ko);return O(()=>{Ko||(Ko=!0,t(!0))},[]),e}Pi(Tf,"useIsHydrated");var kf=_r[" useSyncExternalStore ".trim().toString()];function Rf(){return()=>{}}Pi(Rf,"subscribe");function Pf(){return kf(Rf,()=>!0,()=>!1)}Pi(Pf,"useIsHydratedModern");var d0=typeof kf=="function"?Pf:Tf,u0=Object.defineProperty,En=(e,t)=>u0(e,"name",{value:t,configurable:!0}),Wo="rovingFocusGroup.onEntryFocus",f0={bubbles:!1,cancelable:!0},fo="RovingFocusGroup",[ks,Df,p0]=mi(fo),[h0,If]=qn(fo,[p0]),[m0,g0]=h0(fo),y0=W(En(function(t,n){return i(ks.Provider,{scope:t.__scopeRovingFocusGroup,children:i(ks.Slot,{scope:t.__scopeRovingFocusGroup,children:i(v0,{...t,ref:n})})})},"RovingFocusGroup")),v0=W(En(function(t,n){const{__scopeRovingFocusGroup:r,orientation:a,loop:o=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...p}=t,m=M(null),h=Ye(n,m),g=yi(s),[y,w]=Rd({prop:l,defaultProp:c??null,onChange:d,caller:fo}),[b,v]=E(!1),C=kt(f),N=Df(r),T=M(!1),[k,L]=E(0);return O(()=>{const R=m.current;if(R)return R.addEventListener(Wo,C),()=>R.removeEventListener(Wo,C)},[C]),i(m0,{scope:r,orientation:a,dir:g,loop:o,currentTabStopId:y,onItemFocus:H(R=>w(R),[w]),onItemShiftTab:H(()=>v(!0),[]),onFocusableItemAdd:H(()=>L(R=>R+1),[]),onFocusableItemRemove:H(()=>L(R=>R-1),[]),children:i(ot.div,{tabIndex:b||k===0?-1:0,"data-orientation":a,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:xe(t.onMouseDown,()=>{T.current=!0}),onFocus:xe(t.onFocus,R=>{const P=!T.current;if(R.target===R.currentTarget&&P&&!b){const I=new CustomEvent(Wo,f0);if(R.currentTarget.dispatchEvent(I),!I.defaultPrevented){const S=N().filter(B=>B.focusable),A=S.find(B=>B.active),D=S.find(B=>B.id===y),z=[A,D,...S].filter(Boolean).map(B=>B.ref.current);Di(z,u)}}T.current=!1}),onBlur:xe(t.onBlur,()=>v(!1))})})},"RovingFocusGroupImpl")),b0="RovingFocusGroupItem",x0=W(En(function(t,n){const{__scopeRovingFocusGroup:r,focusable:a=!0,active:o=!1,tabStopId:s,children:l,...c}=t,d=Ta(),f=s||d,u=g0(b0,r),p=u.currentTabStopId===f,m=Df(r),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:y}=u,w=d0();return rn(()=>{if(!(!w||!a))return h(),()=>g()},[w,a,h,g]),O(()=>{if(!(w||!a))return h(),()=>g()},[w,a,h,g]),i(ks.ItemSlot,{scope:r,id:f,focusable:a,active:o,children:i(ot.span,{tabIndex:p?0:-1,"data-orientation":u.orientation,...c,ref:n,onMouseDown:xe(t.onMouseDown,b=>{a?u.onItemFocus(f):b.preventDefault()}),onFocus:xe(t.onFocus,()=>u.onItemFocus(f)),onKeyDown:xe(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const v=Af(b,u.orientation,u.dir);if(v!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let N=m().filter(T=>T.focusable).map(T=>T.ref.current);if(v==="last")N.reverse();else if(v==="prev"||v==="next"){v==="prev"&&N.reverse();const T=N.indexOf(b.currentTarget);N=u.loop?Mf(N,T+1):N.slice(T+1)}setTimeout(()=>Di(N))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:y!=null}):l})})},"RovingFocusGroupItem")),w0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Lf(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}En(Lf,"getDirectionAwareKey");function Af(e,t,n){const r=Lf(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return w0[r]}En(Af,"getFocusIntent");function Di(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}En(Di,"focusFirst");function Mf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}En(Mf,"wrapArray");var C0=y0,N0=x0,E0=Object.defineProperty,he=(e,t)=>E0(e,"name",{value:t,configurable:!0}),S0=["Enter"," "],T0=["ArrowDown","PageUp","Home"],Of=["ArrowUp","PageDown","End"],k0=[...T0,...Of],po="Menu",[Rs,R0,P0]=mi(po),[Sn,_f]=qn(po,[P0,vf,If]),Ii=vf(),Ff=If(),[D0,zr]=Sn(po),[I0,Li]=Sn(po),L0=he(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:o,modal:s=!0}=e,l=Ii(t),[c,d]=E(null),f=M(!1),u=kt(o),p=yi(a);return O(()=>{const m=he(()=>{f.current=!0,document.addEventListener("pointerdown",h,{capture:!0,once:!0}),document.addEventListener("pointermove",h,{capture:!0,once:!0})},"handleKeyDown"),h=he(()=>f.current=!1,"handlePointer");return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",h,{capture:!0}),document.removeEventListener("pointermove",h,{capture:!0})}},[]),O(()=>{if(!n)return;const m=he(()=>u(!1),"handleBlur");return window.addEventListener("blur",m),()=>window.removeEventListener("blur",m)},[n,u]),i(n0,{...l,children:i(D0,{scope:t,open:n,onOpenChange:u,content:c,onContentChange:d,children:i(I0,{scope:t,onClose:H(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:p,modal:s,children:r})})})},"Menu"),A0=W(he(function(t,n){const{__scopeMenu:r,...a}=t,o=Ii(r);return i(r0,{...o,...a,ref:n})},"MenuAnchor")),$f="MenuPortal",[M0,O0]=Sn($f,{forceMount:void 0}),_0=he(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,o=zr($f,t);return i(M0,{scope:t,forceMount:n,children:i(Ri,{present:n||o.open,children:i(i0,{asChild:!0,container:a,children:r})})})},"MenuPortal"),on="MenuContent",[F0,Bf]=Sn(on),$0=W(he(function(t,n){const r=O0(on,t.__scopeMenu),{forceMount:a=r.forceMount,...o}=t,s=zr(on,t.__scopeMenu),l=Li(on,t.__scopeMenu);return i(Rs.Provider,{scope:t.__scopeMenu,children:i(Ri,{present:a||s.open,children:i(Rs.Slot,{scope:t.__scopeMenu,children:l.modal?i(B0,{...o,ref:n}):i(U0,{...o,ref:n})})})})},"MenuContent")),B0=W(he(function(t,n){const r=zr(on,t.__scopeMenu),a=M(null),o=Ye(n,a);return O(()=>{const s=a.current;if(s)return vu(s)},[]),i(Uf,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:xe(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),U0=W(he(function(t,n){const r=zr(on,t.__scopeMenu);return i(Uf,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),z0=kr("MenuContent.ScrollLock"),Uf=W(he(function(t,n){const{__scopeMenu:r,loop:a=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,...y}=t,w=zr(on,r),b=Li(on,r),v=Ii(r),C=Ff(r),N=R0(r),[T,k]=E(null),L=M(null),R=Ye(n,L,w.onContentChange),P=M(0),I=M(""),S=M(0),A=M(null),D=M("right"),U=M(0),z=g?ui:fn,B=g?{as:z0,allowPinchZoom:!0}:void 0,_=he(V=>{var ue,F;const ee=I.current+V,Z=N().filter(q=>!q.disabled),j=document.activeElement,le=(ue=Z.find(q=>q.ref.current===j))==null?void 0:ue.textValue,Ee=Z.map(q=>q.textValue),ge=Wf(Ee,ee,le),Le=(F=Z.find(q=>q.textValue===ge))==null?void 0:F.ref.current;he((function q(be){I.current=be,window.clearTimeout(P.current),be!==""&&(P.current=window.setTimeout(()=>q(""),1e3))}),"updateSearch")(ee),Le&&setTimeout(()=>Le.focus())},"handleTypeaheadSearch");O(()=>()=>window.clearTimeout(P.current),[]),xi();const G=H(V=>{var Z,j;return D.current===((Z=A.current)==null?void 0:Z.side)&&Gf(V,(j=A.current)==null?void 0:j.area)},[]);return i(F0,{scope:r,searchRef:I,onItemEnter:H(V=>{G(V)&&V.preventDefault()},[G]),onItemLeave:H(V=>{var ee;G(V)||((ee=L.current)==null||ee.focus(),k(null))},[G]),onTriggerLeave:H(V=>{G(V)&&V.preventDefault()},[G]),pointerGraceTimerRef:S,onPointerGraceIntentChange:H(V=>{A.current=V},[]),children:i(z,{...B,children:i($b,{asChild:!0,trapped:o,onMountAutoFocus:xe(s,V=>{var ee;V.preventDefault(),(ee=L.current)==null||ee.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:i(Lb,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:i(C0,{asChild:!0,...C,dir:b.dir,orientation:"vertical",loop:a,currentTabStopId:T,onCurrentTabStopIdChange:k,onEntryFocus:xe(d,V=>{b.isUsingKeyboardRef.current||V.preventDefault()}),preventScrollOnEntryFocus:!0,children:i(a0,{role:"menu","aria-orientation":"vertical","data-state":Vf(w.open),"data-radix-menu-content":"",dir:b.dir,...v,...y,ref:R,style:{outline:"none",...y.style},onKeyDown:xe(y.onKeyDown,V=>{const Z=V.target.closest("[data-radix-menu-content]")===V.currentTarget,j=V.ctrlKey||V.altKey||V.metaKey,le=V.key.length===1;Z&&(V.key==="Tab"&&V.preventDefault(),!j&&le&&_(V.key));const Ee=L.current;if(V.target!==Ee||!k0.includes(V.key))return;V.preventDefault();const Le=N().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);Of.includes(V.key)&&Le.reverse(),Hf(Le)}),onBlur:xe(t.onBlur,V=>{V.currentTarget.contains(V.target)||(window.clearTimeout(P.current),I.current="")}),onPointerMove:xe(t.onPointerMove,Ia(V=>{const ee=V.target,Z=U.current!==V.clientX;if(V.currentTarget.contains(ee)&&Z){const j=V.clientX>U.current?"right":"left";D.current=j,U.current=V.clientX}}))})})})})})})},"MenuContentImpl")),j0=W(he(function(t,n){const{__scopeMenu:r,...a}=t;return i(ot.div,{role:"group",...a,ref:n})},"MenuGroup")),V0=W(he(function(t,n){const{__scopeMenu:r,...a}=t;return i(ot.div,{...a,ref:n})},"MenuLabel")),Ps="MenuItem",vc="menu.itemSelect",zf=W(he(function(t,n){const{disabled:r=!1,onSelect:a,...o}=t,s=M(null),l=Li(Ps,t.__scopeMenu),c=Bf(Ps,t.__scopeMenu),d=Ye(n,s),f=M(!1),u=he(()=>{const p=s.current;if(!r&&p){const m=new CustomEvent(vc,{bubbles:!0,cancelable:!0});p.addEventListener(vc,h=>a==null?void 0:a(h),{once:!0}),kd(p,m),m.defaultPrevented?f.current=!1:l.onClose()}},"handleSelect");return i(H0,{...o,ref:d,disabled:r,onClick:xe(t.onClick,u),onPointerDown:p=>{var m;(m=t.onPointerDown)==null||m.call(t,p),f.current=!0},onPointerUp:xe(t.onPointerUp,p=>{var m;f.current||(m=p.currentTarget)==null||m.click()}),onKeyDown:xe(t.onKeyDown,p=>{r||p.target!==p.currentTarget||c.searchRef.current!==""&&p.key===" "||S0.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})},"MenuItem")),H0=W(he(function(t,n){const{__scopeMenu:r,disabled:a=!1,textValue:o,...s}=t,l=Bf(Ps,r),c=Ff(r),d=M(null),f=Ye(n,d),[u,p]=E(!1),[m,h]=E("");return O(()=>{const g=d.current;g&&h((g.textContent??"").trim())},[s.children]),i(Rs.ItemSlot,{scope:r,disabled:a,textValue:o??m,children:i(N0,{asChild:!0,...c,focusable:!a,children:i(ot.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...s,ref:f,onPointerMove:xe(t.onPointerMove,Ia(g=>{a?l.onItemLeave(g):(l.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:xe(t.onPointerLeave,Ia(g=>l.onItemLeave(g))),onFocus:xe(t.onFocus,()=>p(!0)),onBlur:xe(t.onBlur,()=>p(!1))})})})},"MenuItemImpl")),K0="MenuRadioGroup",[W0,q0]=Sn(K0,{value:void 0,onValueChange:he(()=>{},"onValueChange")}),G0=W(he(function(t,n){const{value:r,onValueChange:a,...o}=t,s=kt(a);return i(W0,{scope:t.__scopeMenu,value:r,onValueChange:s,children:i(j0,{...o,ref:n})})},"MenuRadioGroup")),Y0="MenuRadioItem",X0=W(he(function(t,n){const{value:r,...a}=t,o=q0(Y0,t.__scopeMenu),s=r===o.value;return i(J0,{scope:t.__scopeMenu,checked:s,children:i(zf,{role:"menuitemradio","aria-checked":s,...a,ref:n,"data-state":Mi(s),onSelect:xe(a.onSelect,()=>{var l;return(l=o.onValueChange)==null?void 0:l.call(o,r)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),jf="MenuItemIndicator",[J0,Z0]=Sn(jf,{checked:!1}),Q0=W(he(function(t,n){const{__scopeMenu:r,forceMount:a,...o}=t,s=Z0(jf,r);return i(Ri,{present:a||Ai(s.checked)||s.checked===!0,children:i(ot.span,{...o,ref:n,"data-state":Mi(s.checked)})})},"MenuItemIndicator")),ew=W(he(function(t,n){const{__scopeMenu:r,...a}=t;return i(ot.div,{role:"separator","aria-orientation":"horizontal",...a,ref:n})},"MenuSeparator")),tw="MenuSub",[gk,yk]=Sn(tw);function Vf(e){return e?"open":"closed"}he(Vf,"getOpenState");function Ai(e){return e==="indeterminate"}he(Ai,"isIndeterminate");function Mi(e){return Ai(e)?"indeterminate":e?"checked":"unchecked"}he(Mi,"getCheckedState");function Hf(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}he(Hf,"focusFirst");function Kf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}he(Kf,"wrapArray");function Wf(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=Kf(e,Math.max(o,0));a.length===1&&(s=s.filter(d=>d!==n));const c=s.find(d=>d.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}he(Wf,"getNextMatch");function qf(e,t){const{x:n,y:r}=e;let a=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const l=t[o],c=t[s],d=l.x,f=l.y,u=c.x,p=c.y;f>r!=p>r&&n<(u-d)*(r-f)/(p-f)+d&&(a=!a)}return a}he(qf,"isPointInPolygon");function Gf(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return qf(n,t)}he(Gf,"isPointerInGraceArea");function Ia(e){return t=>t.pointerType==="mouse"?e(t):void 0}he(Ia,"whenMouse");var nw=L0,rw=A0,aw=_0,ow=$0,sw=V0,iw=zf,lw=G0,cw=X0,dw=Q0,uw=ew,fw=Object.defineProperty,It=(e,t)=>fw(e,"name",{value:t,configurable:!0}),Oi="DropdownMenu",[pw,vk]=qn(Oi,[_f]),Lt=_f(),[hw,Yf]=pw(Oi),mw=It(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:o,onOpenChange:s,modal:l=!0}=e,c=Lt(t),d=M(null),[f,u]=Rd({prop:a,defaultProp:o??!1,onChange:s,caller:Oi});return i(hw,{scope:t,triggerId:Ta(),triggerRef:d,contentId:Ta(),open:f,onOpenChange:u,onOpenToggle:H(()=>u(p=>!p),[u]),modal:l,children:i(nw,{...c,open:f,onOpenChange:u,dir:r,modal:l,children:n})})},"DropdownMenu"),gw="DropdownMenuTrigger",yw=W(It(function(t,n){const{__scopeDropdownMenu:r,disabled:a=!1,...o}=t,s=Yf(gw,r),l=Lt(r),c=Ye(n,s.triggerRef);return i(rw,{asChild:!0,...l,children:i(ot.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...o,ref:c,onPointerDown:xe(t.onPointerDown,d=>{!a&&d.button===0&&d.ctrlKey===!1&&(s.onOpenToggle(),s.open||d.preventDefault())}),onKeyDown:xe(t.onKeyDown,d=>{a||(["Enter"," "].includes(d.key)&&s.onOpenToggle(),d.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})},"DropdownMenuTrigger")),vw=It(e=>{const{__scopeDropdownMenu:t,...n}=e,r=Lt(t);return i(aw,{...r,...n})},"DropdownMenuPortal"),bw="DropdownMenuContent",xw=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Yf(bw,r),s=Lt(r),l=M(!1);return i(ow,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...a,ref:n,onCloseAutoFocus:xe(t.onCloseAutoFocus,c=>{var d;l.current||(d=o.triggerRef.current)==null||d.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:xe(t.onInteractOutside,c=>{const d=c.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,u=d.button===2||f;(!o.modal||u)&&(l.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),ww=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(sw,{...o,...a,ref:n})},"DropdownMenuLabel")),Cw=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(iw,{...o,...a,ref:n})},"DropdownMenuItem")),Nw=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(lw,{...o,...a,ref:n})},"DropdownMenuRadioGroup")),Ew=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(cw,{...o,...a,ref:n})},"DropdownMenuRadioItem")),Sw=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(dw,{...o,...a,ref:n})},"DropdownMenuItemIndicator")),Tw=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(uw,{...o,...a,ref:n})},"DropdownMenuSeparator")),kw=mw,Rw=yw,Pw=vw,Dw=xw,Iw=ww,Lw=Cw,Aw=Nw,Mw=Ew,Ow=Sw,_w=Tw;function _i({modal:e=!1,...t}){return i(kw,{modal:e,...t})}const Fi=Rw,bc=Aw;function xc({className:e,children:t,...n}){return x(Mw,{className:se("relative flex cursor-pointer select-none items-center gap-2 rounded-sm py-2 pe-2 ps-8 text-sm text-text-primary outline-none transition-colors data-[highlighted]:bg-background-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i("span",{className:"absolute start-2 flex size-4 items-center justify-center",children:i(Ow,{children:i("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4 text-primary-600",children:i("path",{d:"M20 6 9 17l-5-5"})})})}),t]})}function $i({className:e,sideOffset:t=4,...n}){return i(Pw,{children:i(Dw,{sideOffset:t,className:se("z-50 min-w-[10rem] overflow-hidden rounded-lg border border-border-default bg-background-elevated p-1 text-text-primary shadow-lg",e),...n})})}function La({className:e,inset:t,variant:n="default",...r}){return i(Lw,{className:se("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n==="destructive"?"text-danger-600 data-[highlighted]:bg-danger-100 data-[highlighted]:text-danger-700":"text-text-primary data-[highlighted]:bg-background-hover",t&&"ps-8",e),...r})}function wc({className:e,inset:t,...n}){return i(Iw,{className:se("px-2 py-1.5 text-xs font-semibold text-text-secondary",t&&"ps-8",e),...n})}function qo({className:e,...t}){return i(_w,{className:se("-mx-1 my-1 h-px bg-border-default",e),...t})}function ke({icon:e,title:t,description:n,action:r,className:a,titleAs:o="p",titleProps:s,...l}){return x("div",{"data-slot":"empty-state",className:se("flex flex-col items-center justify-center gap-2 px-6 py-14 text-center",a),...l,children:[e&&i("div",{className:"text-text-tertiary [&>svg]:h-8 [&>svg]:w-8",children:e}),i(o,{...s,className:se("font-serif text-xl font-medium text-text-primary",s==null?void 0:s.className),children:t}),n&&i("p",{className:"max-w-sm text-sm text-text-secondary",children:n}),r&&i("div",{className:"mt-2",children:r})]})}function pe({className:e,...t}){return i("div",{"data-slot":"skeleton","aria-hidden":"true",className:se("animate-pulse rounded-md bg-background-hover",e),...t})}function Fw(e){const t=e+"CollectionProvider",[n,r]=Xa(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:y,children:w}=g,b=M(null),v=M(new Map).current;return i(a,{scope:y,itemMap:v,collectionRef:b,children:w})};s.displayName=t;const l=e+"CollectionSlot",c=ss(l),d=W((g,y)=>{const{scope:w,children:b}=g,v=o(l,w),C=ft(y,v.collectionRef);return i(c,{ref:C,children:b})});d.displayName=l;const f=e+"CollectionItemSlot",u="data-radix-collection-item",p=ss(f),m=W((g,y)=>{const{scope:w,children:b,...v}=g,C=M(null),N=ft(y,C),T=o(f,w);return O(()=>(T.itemMap.set(C,{ref:C,...v}),()=>void T.itemMap.delete(C))),i(p,{[u]:"",ref:N,children:b})});m.displayName=f;function h(g){const y=o(e+"CollectionConsumer",g);return H(()=>{const b=y.collectionRef.current;if(!b)return[];const v=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((T,k)=>v.indexOf(T.ref.current)-v.indexOf(k.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:d,ItemSlot:m},h,r]}var $w=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Bw="VisuallyHidden",Bi=W((e,t)=>i(qe.span,{...e,ref:t,style:{...$w,...e.style}}));Bi.displayName=Bw;var Ui="ToastProvider",[zi,Uw,zw]=Fw("Toast"),[Xf]=Xa("Toast",[zw]),[jw,ho]=Xf(Ui),Jf=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:o=50,announcerContainer:s,children:l}=e,[c,d]=E(null),[f,u]=E(0),p=M(!1),m=M(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Ui}\`. Expected non-empty \`string\`.`),i(zi.Provider,{scope:t,children:i(jw,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:o,toastCount:f,viewport:c,onViewportChange:d,onToastAdd:H(()=>u(h=>h+1),[]),onToastRemove:H(()=>u(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:m,announcerContainer:s,children:l})})};Jf.displayName=Ui;var Zf="ToastViewport",Vw=["F8"],Ds="toast.viewportPause",Is="toast.viewportResume",Qf=W((e,t)=>{const{__scopeToast:n,hotkey:r=Vw,label:a="Notifications ({hotkey})",...o}=e,s=ho(Zf,n),l=Uw(n),c=M(null),d=M(null),f=M(null),u=M(null),p=ft(t,u,s.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),h=s.toastCount>0;O(()=>{const y=w=>{var v;r.length!==0&&r.every(C=>w[C]||w.code===C)&&((v=u.current)==null||v.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),O(()=>{const y=c.current,w=u.current;if(h&&y&&w){const b=()=>{if(!s.isClosePausedRef.current){const T=new CustomEvent(Ds);w.dispatchEvent(T),s.isClosePausedRef.current=!0}},v=()=>{if(s.isClosePausedRef.current){const T=new CustomEvent(Is);w.dispatchEvent(T),s.isClosePausedRef.current=!1}},C=T=>{!y.contains(T.relatedTarget)&&v()},N=()=>{y.contains(document.activeElement)||v()};return y.addEventListener("focusin",b),y.addEventListener("focusout",C),y.addEventListener("pointermove",b),y.addEventListener("pointerleave",N),window.addEventListener("blur",b),window.addEventListener("focus",v),()=>{y.removeEventListener("focusin",b),y.removeEventListener("focusout",C),y.removeEventListener("pointermove",b),y.removeEventListener("pointerleave",N),window.removeEventListener("blur",b),window.removeEventListener("focus",v)}}},[h,s.isClosePausedRef]);const g=H(({tabbingDirection:y})=>{const b=l().map(v=>{const C=v.ref.current,N=[C,...r1(C)];return y==="forwards"?N:N.reverse()});return(y==="forwards"?b.reverse():b).flat()},[l]);return O(()=>{const y=u.current;if(y){const w=b=>{var N,T,k;const v=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!v){const L=document.activeElement,R=b.shiftKey;if(b.target===y&&R){(N=d.current)==null||N.focus();return}const S=g({tabbingDirection:R?"backwards":"forwards"}),A=S.findIndex(D=>D===L);Go(S.slice(A+1))?b.preventDefault():R?(T=d.current)==null||T.focus():(k=f.current)==null||k.focus()}};return y.addEventListener("keydown",w),()=>y.removeEventListener("keydown",w)}},[l,g]),x(tv,{ref:c,role:"region","aria-label":a.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:h?void 0:"none"},children:[h&&i(Ls,{ref:d,onFocusFromOutsideViewport:()=>{const y=g({tabbingDirection:"forwards"});Go(y)}}),i(zi.Slot,{scope:n,children:i(qe.ol,{tabIndex:-1,...o,ref:p})}),h&&i(Ls,{ref:f,onFocusFromOutsideViewport:()=>{const y=g({tabbingDirection:"backwards"});Go(y)}})]})});Qf.displayName=Zf;var ep="ToastFocusProxy",Ls=W((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,o=ho(ep,n);return i(Bi,{tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:s=>{var d;const l=s.relatedTarget;!((d=o.viewport)!=null&&d.contains(l))&&r()}})});Ls.displayName=ep;var jr="Toast",Hw="toast.swipeStart",Kw="toast.swipeMove",Ww="toast.swipeCancel",qw="toast.swipeEnd",tp=W((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:o,...s}=e,[l,c]=Td({prop:r,defaultProp:a??!0,onChange:o,caller:jr});return i(Ja,{present:n||l,children:i(Xw,{open:l,...s,ref:t,onClose:()=>c(!1),onPause:cn(e.onPause),onResume:cn(e.onResume),onSwipeStart:Me(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Me(e.onSwipeMove,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`)}),onSwipeCancel:Me(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Me(e.onSwipeEnd,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),c(!1)})})})});tp.displayName=jr;var[Gw,Yw]=Xf(jr,{onClose(){}}),Xw=W((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:a,open:o,onClose:s,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:f,onSwipeMove:u,onSwipeCancel:p,onSwipeEnd:m,...h}=e,g=ho(jr,n),[y,w]=E(null),b=ft(t,w),v=M(null),C=M(null),N=a||g.duration,T=M(0),k=M(N),L=M(0),{onToastAdd:R,onToastRemove:P}=g,I=cn(()=>{var U;(y==null?void 0:y.contains(document.activeElement))&&((U=g.viewport)==null||U.focus()),s()}),S=H(D=>{!D||D===1/0||(window.clearTimeout(L.current),T.current=new Date().getTime(),L.current=window.setTimeout(I,D))},[I]);O(()=>{const D=g.viewport;if(D){const U=()=>{S(k.current),d==null||d()},z=()=>{const B=new Date().getTime()-T.current;k.current=k.current-B,window.clearTimeout(L.current),c==null||c()};return D.addEventListener(Ds,z),D.addEventListener(Is,U),()=>{D.removeEventListener(Ds,z),D.removeEventListener(Is,U)}}},[g.viewport,N,c,d,S]),O(()=>{o&&!g.isClosePausedRef.current&&S(N)},[o,N,g.isClosePausedRef,S]),O(()=>()=>{window.clearTimeout(L.current)},[]),O(()=>(R(),()=>P()),[R,P]);const A=Q(()=>y?ip(y):null,[y]);return g.viewport?x(Ie,{children:[A&&i(Jw,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:A}),i(Gw,{scope:n,onClose:I,children:Ga(i(zi.ItemSlot,{scope:n,children:i(ev,{asChild:!0,onEscapeKeyDown:Me(l,()=>{g.isFocusedToastEscapeKeyDownRef.current||I(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:i(qe.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":g.swipeDirection,...h,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Me(e.onKeyDown,D=>{D.key==="Escape"&&(l==null||l(D.nativeEvent),D.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,I()))}),onPointerDown:Me(e.onPointerDown,D=>{D.button===0&&(v.current={x:D.clientX,y:D.clientY})}),onPointerMove:Me(e.onPointerMove,D=>{if(!v.current)return;const U=D.clientX-v.current.x,z=D.clientY-v.current.y,B=!!C.current,_=["left","right"].includes(g.swipeDirection),G=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,V=_?G(0,U):0,ee=_?0:G(0,z),Z=D.pointerType==="touch"?10:2,j={x:V,y:ee},le={originalEvent:D,delta:j};B?(C.current=j,la(Kw,u,le,{discrete:!1})):Cc(j,g.swipeDirection,Z)?(C.current=j,la(Hw,f,le,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(U)>Z||Math.abs(z)>Z)&&(v.current=null)}),onPointerUp:Me(e.onPointerUp,D=>{const U=C.current,z=D.target;if(z.hasPointerCapture(D.pointerId)&&z.releasePointerCapture(D.pointerId),C.current=null,v.current=null,U){const B=D.currentTarget,_={originalEvent:D,delta:U};Cc(U,g.swipeDirection,g.swipeThreshold)?la(qw,m,_,{discrete:!0}):la(Ww,p,_,{discrete:!0}),B.addEventListener("click",G=>G.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),Jw=e=>{const{__scopeToast:t,children:n,...r}=e,a=ho(jr,t),[o,s]=E(!1),[l,c]=E(!1);return t1(()=>s(!0)),O(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:i(di,{asChild:!0,container:a.announcerContainer||void 0,children:i(Bi,{...r,children:o&&x(Ie,{children:[a.label," ",n]})})})},Zw="ToastTitle",np=W((e,t)=>{const{__scopeToast:n,...r}=e;return i(qe.div,{...r,ref:t})});np.displayName=Zw;var Qw="ToastDescription",rp=W((e,t)=>{const{__scopeToast:n,...r}=e;return i(qe.div,{...r,ref:t})});rp.displayName=Qw;var ap="ToastAction",e1=W((e,t)=>{const{altText:n,...r}=e;return n.trim()?i(sp,{altText:n,asChild:!0,children:i(ji,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ap}\`. Expected non-empty \`string\`.`),null)});e1.displayName=ap;var op="ToastClose",ji=W((e,t)=>{const{__scopeToast:n,...r}=e,a=Yw(op,n);return i(sp,{asChild:!0,children:i(qe.button,{type:"button",...r,ref:t,onClick:Me(e.onClick,a.onClose)})})});ji.displayName=op;var sp=W((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return i(qe.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function ip(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),n1(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",o=r.dataset.radixToastAnnounceExclude==="";if(!a)if(o){const s=r.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...ip(r))}}),t}function la(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Sd(a,o):a.dispatchEvent(o)}var Cc=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),o=r>a;return t==="left"||t==="right"?o&&r>n:!o&&a>n};function t1(e=()=>{}){const t=cn(e);Ya(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function n1(e){return e.nodeType===e.ELEMENT_NODE}function r1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Go(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var a1=Jf,o1=Qf,s1=tp,i1=np,l1=rp,c1=ji;const d1=a1;function u1({className:e,...t}){return i(o1,{className:se("fixed bottom-0 end-0 z-50 flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm",e),...t})}const f1=Th("group pointer-events-auto relative flex w-full items-center justify-between gap-4 overflow-hidden rounded-lg border bg-text-primary p-4 pe-8 text-background-elevated shadow-lg transition-opacity data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[swipe=cancel]:translate-x-0 data-[swipe=end]:opacity-0 data-[state=closed]:opacity-0",{variants:{variant:{default:"border-text-primary",success:"border-primary-300",danger:"border-danger-300"}},defaultVariants:{variant:"default"}});function p1({className:e,variant:t,...n}){return i(s1,{className:se(f1({variant:t,className:e})),...n})}function h1({className:e,...t}){return i(i1,{className:se("text-sm font-semibold",e),...t})}function m1({className:e,...t}){return i(l1,{className:se("text-sm text-background-elevated opacity-80",e),...t})}function g1({className:e,...t}){return i(c1,{className:se("absolute end-2 top-2 rounded-md p-1 text-background-elevated opacity-70 transition-colors duration-fast hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600",e),...t,children:x("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4",children:[i("path",{d:"M18 6 6 18"}),i("path",{d:"m6 6 12 12"})]})})}const y1=3,v1=300;let Yo=0;function b1(){return Yo=(Yo+1)%Number.MAX_SAFE_INTEGER,Yo.toString()}const As=new Set;let wn={toasts:[]};const Xo=new Map;function Vi(e){wn=e,As.forEach(t=>t(wn))}function x1(e){Xo.has(e)||Xo.set(e,setTimeout(()=>{Xo.delete(e),Vi({toasts:wn.toasts.filter(t=>t.id!==e)})},v1))}function Ms(e){const t=e===void 0?wn.toasts.map(n=>n.id):[e];Vi({toasts:wn.toasts.map(n=>t.includes(n.id)?{...n,open:!1}:n)}),t.forEach(x1)}function J(e){const t=b1(),n={...e,id:t,open:!0,onOpenChange:r=>{r||Ms(t)}};return Vi({toasts:[n,...wn.toasts].slice(0,y1)}),{id:t,dismiss:()=>Ms(t)}}function w1(){const[e,t]=E(wn);return O(()=>(As.add(t),()=>{As.delete(t)}),[]),{...e,toast:J,dismiss:Ms}}function C1({closeLabel:e,label:t}){const{toasts:n}=w1(),r=typeof document<"u"&&document.documentElement.dir==="rtl"?"left":"right";return x(d1,{label:t,swipeDirection:r,children:[n.map(({id:a,title:o,description:s,...l})=>x(p1,{...l,children:[x("div",{className:"grid gap-1",children:[o&&i(h1,{children:o}),s&&i(m1,{children:s})]}),i(g1,{"aria-label":e})]},a)),i(u1,{})]})}function jn(e,t){return`${e}-tab-${t}`}function Vr(e,t){return`${e}-panel-${t}`}function mo({tabs:e,activeId:t,onChange:n,label:r,errorLabel:a,idPrefix:o,className:s}){function l(c){var m;const d=e.findIndex(h=>h.id===t);if(d===-1)return;const f=c.currentTarget.ownerDocument.documentElement.dir==="rtl";let u;switch(c.key){case"ArrowRight":u=f?d-1:d+1;break;case"ArrowLeft":u=f?d+1:d-1;break;case"Home":u=0;break;case"End":u=e.length-1;break;default:return}c.preventDefault();const p=e[(u+e.length)%e.length];p&&(n(p.id),(m=c.currentTarget.querySelector(`#${CSS.escape(jn(o,p.id))}`))==null||m.focus())}return i("div",{role:"tablist","aria-label":r,onKeyDown:l,className:se("flex items-end gap-1 overflow-x-auto border-b border-border-default",s),children:e.map(c=>{const d=c.id===t;return x("button",{type:"button",role:"tab",id:jn(o,c.id),"aria-selected":d,"aria-controls":Vr(o,c.id),"aria-label":c.hasError&&a?`${c.label} — ${a}`:void 0,tabIndex:d?0:-1,onClick:()=>n(c.id),className:se("-mb-px inline-flex items-center gap-1 whitespace-nowrap rounded-t-md border-b-2 px-3 py-2 text-sm transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600 focus-visible:ring-offset-2 focus-visible:ring-offset-background-base",d?"border-primary-300 font-medium text-text-primary":"border-transparent text-text-secondary hover:text-text-primary"),children:[c.label,c.hasError&&i("span",{"aria-hidden":"true",className:"size-1 shrink-0 rounded-full bg-danger-500"})]},c.id)})})}let lp=null;function N1(){return lp}function Aa(e){lp=e}let va=null;function Nc(e){va=e}let Os=!1;function E1(){Os||(Os=!0,va==null||va())}function S1(){Os=!1}class Hi extends Error{constructor(t,n){super(t),this.status=n}}async function Ki(e){const t=await e.json().catch(()=>null);if(!e.ok){const n=t&&typeof t=="object"&&typeof t.message=="string"?t.message:e.statusText;throw new Hi(n,e.status)}return t}async function T1(e){const t=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await Ki(t);return Aa(n.accessToken),S1(),n}async function Ec(){Aa(null),await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{})}let yr=null;async function cp(){if(yr)return yr;yr=(async()=>{const e=await fetch("/api/auth/refresh",{method:"POST"});if(!e.ok)return Aa(null),null;const t=await e.json();return Aa(t.accessToken),t})();try{return await yr}finally{yr=null}}async function k1(){return cp()}const R1=new Set(["/api/auth/login","/api/auth/refresh","/api/auth/logout"]);function P1(e){const t=e.split("?")[0];return R1.has(t)}async function X(e,t={}){const n=()=>({...t,headers:{...t.headers,Authorization:`Bearer ${N1()??""}`}});let r=await fetch(e,n());return r.status===401&&(await cp()?r=await fetch(e,n()):P1(e)||E1()),r}const D1=1800*1e3,I1=5e3,go="velora.session.idleDeadline",Sc=["click","keydown","mousemove","scroll","touchstart"];function dp(){const e=localStorage.getItem(go);if(!e)return null;const t=Number(e);return Number.isFinite(t)?t:null}function vr(){localStorage.removeItem(go)}function Tc(){const e=Date.now()+D1;return localStorage.setItem(go,String(e)),e}function L1(e,t){const[n,r]=E(null),[a,o]=E(()=>Date.now()),s=M(t);return s.current=t,O(()=>{if(!e){r(null);return}r(dp()??Tc());let l=0;function c(){const f=Date.now();f-l<I1||(l=f,r(Tc()))}function d(f){if(f.key!==go)return;if(f.newValue===null){s.current();return}const u=Number(f.newValue);Number.isFinite(u)&&r(u)}for(const f of Sc)window.addEventListener(f,c,{passive:!0});return window.addEventListener("storage",d),()=>{for(const f of Sc)window.removeEventListener(f,c);window.removeEventListener("storage",d)}},[e]),O(()=>{if(!e||n===null)return;const l=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(l)},[e,n]),O(()=>{e&&n!==null&&a>=n&&(vr(),s.current())},[e,n,a]),!e||n===null?null:Math.max(0,n-a)}const up=Te(null);function A1({children:e}){const{t}=ae(),[n,r]=E("restoring"),[a,o]=E(null),[s,l]=E(null),c=H(async()=>{vr(),await Ec(),o(null),r("anonymous")},[]),d=H(m=>{o(null),r("anonymous"),Ec(),J({variant:"danger",title:m})},[]),f=L1(n==="authenticated",()=>{d(t("app.idleLoggedOut"))});O(()=>(Nc(()=>d(t("app.sessionExpired"))),()=>Nc(null)),[d,t]),O(()=>{const m=dp();if(m!==null&&m<=Date.now()){vr(),r("anonymous");return}k1().then(h=>{h?(o(h.user),r("authenticated")):(vr(),r("anonymous"))}).catch(()=>{vr(),r("anonymous")})},[]);const u=H(async m=>{r("authenticating"),l(null);try{const h=await T1(m);o(h.user),r("authenticated")}catch(h){r("anonymous"),l(h instanceof Hi?h.message:t("login.genericError"))}},[t]),p=Q(()=>({status:n,user:a,error:s,idleMsRemaining:f,login:u,logout:c}),[n,a,s,f,u,c]);return i(up.Provider,{value:p,children:e})}function Tn(){const e=ne(up);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}function Re(e){const{t}=ae(),n=e.filter(a=>!!a),r=n.length>0?[...n,t("app.title")].join(" · "):void 0;O(()=>{const a=document.title;return()=>{document.title=a}},[]),O(()=>{r!==void 0&&(document.title=r)},[r])}function fp({className:e}){return x("span",{"aria-hidden":"true",className:se("relative grid size-7 shrink-0 place-items-center rounded-md bg-primary-600 font-serif text-lg font-semibold italic leading-none text-text-inverse",e),children:["V",i("span",{className:"absolute -bottom-px -end-px size-2 rounded-full bg-primary-300 ring-2 ring-background-elevated"})]})}function M1(){const{t:e}=ae(),{login:t,status:n,error:r}=Tn();Re([e("login.title")]);const[a,o]=E(""),[s,l]=E(""),c=n==="authenticating";function d(f){f.preventDefault(),t({email:a,password:s})}return x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-background-base p-8 font-sans text-text-primary",children:[x("div",{className:"w-full max-w-sm rounded-xl border border-border-default bg-background-elevated p-8 shadow-lg",children:[x("div",{className:"mb-5 flex items-center gap-2 text-base font-semibold tracking-tight",children:[i(fp,{}),e("app.title")]}),i("h1",{className:"mb-1 text-xl font-semibold tracking-tight",children:e("login.title")}),i("p",{className:"mb-6 text-sm text-text-secondary",children:e("login.subtitle")}),x("form",{className:"flex flex-col gap-4",onSubmit:d,children:[x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"email",className:"text-sm font-medium",children:e("login.emailLabel")}),i(ye,{id:"email",name:"email",type:"email",autoComplete:"username",required:!0,value:a,onChange:f=>o(f.target.value),disabled:c})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"password",className:"text-sm font-medium",children:e("login.passwordLabel")}),i(ye,{id:"password",name:"password",type:"password",autoComplete:"current-password",required:!0,value:s,onChange:f=>l(f.target.value),disabled:c})]}),r&&i("p",{role:"alert",className:"text-sm text-danger-600",children:r}),i(K,{type:"submit",disabled:c,children:e(c?"login.submitting":"login.submit")})]})]}),i("p",{className:"max-w-sm text-center font-serif text-base italic text-text-secondary",children:e("login.tagline")})]})}/**
186
+ `)},Vv=0,In=[];function Hv(e){var t=M([]),n=M([0,0]),r=M(),a=E(Vv++)[0],o=E(hu)[0],s=M(e);O(function(){s.current=e},[e]),O(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var g=uv([e.lockRef.current],(e.shards||[]).map(rc),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=K(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!s.current.allowPinchZoom;var w=ra(g),b=n.current,v="deltaX"in g?g.deltaX:b[0]-w[0],C="deltaY"in g?g.deltaY:b[1]-w[1],N,T=g.target,R=Math.abs(v)>Math.abs(C)?"h":"v";if("touches"in g&&R==="h"&&T.type==="range")return!1;var L=window.getSelection(),I=L&&L.anchorNode,P=I?I===T||I.contains(T):!1;if(P)return!1;var k=tc(R,T);if(!k)return!0;if(k?N=R:(N=R==="v"?"h":"v",k=tc(R,T)),!k)return!1;if(!r.current&&"changedTouches"in g&&(v||C)&&(r.current=N),!N)return!0;var S=r.current||N;return Uv(S,y,g,S==="h"?v:C)},[]),c=K(function(g){var y=g;if(!(!In.length||In[In.length-1]!==o)){var w="deltaY"in y?nc(y):ra(y),b=t.current.filter(function(N){return N.name===y.type&&(N.target===y.target||y.target===N.shadowParent)&&zv(N.delta,w)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var v=(s.current.shards||[]).map(rc).filter(Boolean).filter(function(N){return N.contains(y.target)}),C=v.length>0?l(y,v[0]):!s.current.noIsolation;C&&y.cancelable&&y.preventDefault()}}},[]),d=K(function(g,y,w,b){var v={name:g,delta:y,target:w,should:b,shadowParent:Kv(w)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(C){return C!==v})},1)},[]),f=K(function(g){n.current=ra(g),r.current=void 0},[]),u=K(function(g){d(g.type,nc(g),g.target,l(g,e.lockRef.current))},[]),p=K(function(g){d(g.type,ra(g),g.target,l(g,e.lockRef.current))},[]);O(function(){return In.push(o),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Dn),document.addEventListener("touchmove",c,Dn),document.addEventListener("touchstart",f,Dn),function(){In=In.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,Dn),document.removeEventListener("touchmove",c,Dn),document.removeEventListener("touchstart",f,Dn)}},[]);var m=e.removeScrollBar,h=e.inert;return ie(fn,null,h?ie(o,{styles:jv(a)}):null,m?ie(Av,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Kv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Wv=xv(pu,Hv);var ui=W(function(e,t){return ie(ro,Nt({},e,{ref:t,sideCar:Wv}))});ui.classNames=ro.classNames;var qv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ln=new WeakMap,aa=new WeakMap,oa={},$o=0,vu=function(e){return e&&(e.host||vu(e.parentNode))},Gv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=vu(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Yv=function(e,t,n,r){var a=Gv(t,Array.isArray(e)?e:[e]);oa[n]||(oa[n]=new WeakMap);var o=oa[n],s=[],l=new Set,c=new Set(a),d=function(u){!u||l.has(u)||(l.add(u),d(u.parentNode))};a.forEach(d);var f=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(p){if(l.has(p))f(p);else try{var m=p.getAttribute(r),h=m!==null&&m!=="false",g=(Ln.get(p)||0)+1,y=(o.get(p)||0)+1;Ln.set(p,g),o.set(p,y),s.push(p),g===1&&h&&aa.set(p,!0),y===1&&p.setAttribute(n,"true"),h||p.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",p,w)}})};return f(t),l.clear(),$o++,function(){s.forEach(function(u){var p=Ln.get(u)-1,m=o.get(u)-1;Ln.set(u,p),o.set(u,m),p||(aa.has(u)||u.removeAttribute(r),aa.delete(u)),m||u.removeAttribute(n)}),$o--,$o||(Ln=new WeakMap,Ln=new WeakMap,aa=new WeakMap,oa={})}},bu=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=qv(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),Yv(r,a,n,"aria-hidden")):function(){return null}},ao="Dialog",[xu,wu]=Xa(ao),[Xv,yt]=xu(ao),Cu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,l=M(null),c=M(null),[d,f]=Td({prop:r,defaultProp:a??!1,onChange:o,caller:ao});return i(Xv,{scope:t,triggerRef:l,contentRef:c,contentId:Lo(),titleId:Lo(),descriptionId:Lo(),open:d,onOpenChange:f,onOpenToggle:K(()=>f(u=>!u),[f]),modal:s,children:n})};Cu.displayName=ao;var Nu="DialogTrigger",Su=W((e,t)=>{const{__scopeDialog:n,...r}=e,a=yt(Nu,n),o=ft(t,a.triggerRef);return i(qe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":hi(a.open),...r,ref:o,onClick:Me(e.onClick,a.onOpenToggle)})});Su.displayName=Nu;var fi="DialogPortal",[Jv,Eu]=xu(fi,{forceMount:void 0}),Tu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=yt(fi,t);return i(Jv,{scope:t,forceMount:n,children:Wa.map(r,s=>i(Ja,{present:n||o.open,children:i(di,{asChild:!0,container:a,children:s})}))})};Tu.displayName=fi;var Ea="DialogOverlay",ku=W((e,t)=>{const n=Eu(Ea,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=yt(Ea,e.__scopeDialog);return o.modal?i(Ja,{present:r||o.open,children:i(Qv,{...a,ref:t})}):null});ku.displayName=Ea;var Zv=ss("DialogOverlay.RemoveScroll"),Qv=W((e,t)=>{const{__scopeDialog:n,...r}=e,a=yt(Ea,n),o=Jy(),s=ft(t,o);return i(ui,{as:Zv,allowPinchZoom:!0,shards:[a.contentRef],children:i(qe.div,{"data-state":hi(a.open),...r,ref:s,style:{pointerEvents:"auto",...r.style}})})}),zn="DialogContent",Ru=W((e,t)=>{const n=Eu(zn,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=yt(zn,e.__scopeDialog);return i(Ja,{present:r||o.open,children:o.modal?i(eb,{...a,ref:t}):i(tb,{...a,ref:t})})});Ru.displayName=zn;var eb=W((e,t)=>{const n=yt(zn,e.__scopeDialog),r=M(null),a=ft(t,n.contentRef,r);return O(()=>{const o=r.current;if(o)return bu(o)},[]),i(Pu,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Me(e.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Me(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&o.preventDefault()}),onFocusOutside:Me(e.onFocusOutside,o=>o.preventDefault())})}),tb=W((e,t)=>{const n=yt(zn,e.__scopeDialog),r=M(!1),a=M(!1);return i(Pu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,o),o.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),o.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:o=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),Pu=W((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...s}=e,l=yt(zn,n);return dv(),i(Ie,{children:i(cu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:i(ci,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":hi(l.open),...s,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})}),Du="DialogTitle",Iu=W((e,t)=>{const{__scopeDialog:n,...r}=e,a=yt(Du,n);return i(qe.h2,{id:a.titleId,...r,ref:t})});Iu.displayName=Du;var Lu="DialogDescription",Au=W((e,t)=>{const{__scopeDialog:n,...r}=e,a=yt(Lu,n);return i(qe.p,{id:a.descriptionId,...r,ref:t})});Au.displayName=Lu;var Mu="DialogClose",pi=W((e,t)=>{const{__scopeDialog:n,...r}=e,a=yt(Mu,n);return i(qe.button,{type:"button",...r,ref:t,onClick:Me(e.onClick,()=>a.onOpenChange(!1))})});pi.displayName=Mu;function hi(e){return e?"open":"closed"}var Ou="AlertDialog",[nb]=Xa(Ou,[wu]),qt=wu(),_u=e=>{const{__scopeAlertDialog:t,...n}=e,r=qt(t);return i(Cu,{...r,...n,modal:!0})};_u.displayName=Ou;var rb="AlertDialogTrigger",ab=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qt(n);return i(Su,{...a,...r,ref:t})});ab.displayName=rb;var ob="AlertDialogPortal",Fu=e=>{const{__scopeAlertDialog:t,...n}=e,r=qt(t);return i(Tu,{...r,...n})};Fu.displayName=ob;var sb="AlertDialogOverlay",$u=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qt(n);return i(ku,{...a,...r,ref:t})});$u.displayName=sb;var Bu="AlertDialogContent",[ib,lb]=nb(Bu),Uu=W((e,t)=>{const{__scopeAlertDialog:n,children:r,...a}=e,o=qt(n),s=M(null),l=ft(t,s),c=M(null);return i(ib,{scope:n,cancelRef:c,children:i(Ru,{role:"alertdialog",...o,...a,ref:l,onOpenAutoFocus:Me(a.onOpenAutoFocus,d=>{var f;d.preventDefault(),(f=c.current)==null||f.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:r})})});Uu.displayName=Bu;var cb="AlertDialogTitle",zu=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qt(n);return i(Iu,{...a,...r,ref:t})});zu.displayName=cb;var db="AlertDialogDescription",ju=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qt(n);return i(Au,{...a,...r,ref:t})});ju.displayName=db;var ub="AlertDialogAction",Vu=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qt(n);return i(pi,{...a,...r,ref:t})});Vu.displayName=ub;var Hu="AlertDialogCancel",Ku=W((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=lb(Hu,n),o=qt(n),s=ft(t,a);return i(pi,{...o,...r,ref:s})});Ku.displayName=Hu;var fb=_u,pb=Fu,hb=$u,mb=Uu,gb=Vu,yb=Ku,vb=zu,bb=ju;const Jn=fb,xb=pb;function wb({className:e,...t}){return i(hb,{className:se("fixed inset-0 z-50 bg-background-overlay",e),...t})}function Zn({className:e,...t}){return x(xb,{children:[i(wb,{}),i(mb,{className:se("fixed start-1/2 top-1/2 z-50 w-full max-w-lg -translate-y-1/2 ltr:-translate-x-1/2 rtl:translate-x-1/2 rounded-xl border border-border-default bg-background-elevated p-6 shadow-xl",e),...t})]})}function Qn({className:e,...t}){return i("div",{className:se("flex flex-col gap-2 text-start",e),...t})}function er({className:e,...t}){return i("div",{className:se("mt-6 flex justify-end gap-2",e),...t})}function tr({className:e,...t}){return i(vb,{className:se("text-base font-semibold text-text-primary",e),...t})}function nr({className:e,...t}){return i(bb,{className:se("text-sm text-text-secondary",e),...t})}function rr({className:e,...t}){return i(gb,{className:se(Tt(),e),...t})}function ar({className:e,...t}){return i(yb,{className:se(Tt({variant:"outline"}),e),...t})}var Cb=Object.defineProperty,Fe=(e,t)=>Cb(e,"name",{value:t,configurable:!0});function mi(e){const t=e+"CollectionProvider",[n,r]=qn(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=Fe(g=>{const{scope:y,children:w}=g,b=M(null),v=M(new Map).current;return i(a,{scope:y,itemMap:v,collectionRef:b,children:w})},"CollectionProvider");s.displayName=t;const l=e+"CollectionSlot",c=kr(l),d=W((g,y)=>{const{scope:w,children:b}=g,v=o(l,w),C=Ye(y,v.collectionRef);return i(c,{ref:C,children:b})});d.displayName=l;const f=e+"CollectionItemSlot",u="data-radix-collection-item",p=kr(f),m=W((g,y)=>{const{scope:w,children:b,...v}=g,C=M(null),N=Ye(y,C),T=o(f,w);return O(()=>(T.itemMap.set(C,{ref:C,...v}),()=>void T.itemMap.delete(C))),i(p,{[u]:"",ref:N,children:b})});m.displayName=f;function h(g){const y=o(e+"CollectionConsumer",g);return K(()=>{const b=y.collectionRef.current;if(!b)return[];const v=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((T,R)=>v.indexOf(T.ref.current)-v.indexOf(R.ref.current))},[y.collectionRef,y.itemMap])}return Fe(h,"useCollection"),[{Provider:s,Slot:d,ItemSlot:m},h,r]}Fe(mi,"createCollection");var ac=new WeakMap,De,at,Bo=(at=class extends Map{constructor(n){super(n);yl(this,De);So(this,De,[...super.keys()]),ac.set(this,!0)}set(n,r){return ac.get(this)&&(this.has(n)?We(this,De)[We(this,De).indexOf(n)]=n:We(this,De).push(n)),super.set(n,r),this}insert(n,r,a){const o=this.has(r),s=We(this,De).length,l=gi(n);let c=l>=0?l:s+l;const d=c<0||c>=s?-1:c;if(d===this.size||o&&d===this.size-1||d===-1)return this.set(r,a),this;const f=this.size+(o?0:1);l<0&&c++;const u=[...We(this,De)];let p,m=!1;for(let h=c;h<f;h++)if(c===h){let g=u[h];u[h]===r&&(g=u[h+1]),o&&this.delete(r),p=this.get(g),this.set(r,a)}else{!m&&u[h-1]===r&&(m=!0);const g=u[m?h:h-1],y=p;p=this.get(g),this.delete(g),this.set(g,y)}return this}with(n,r,a){const o=new at(this);return o.insert(n,r,a),o}before(n){const r=We(this,De).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,a){const o=We(this,De).indexOf(n);return o===-1?this:this.insert(o,r,a)}after(n){let r=We(this,De).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,a){const o=We(this,De).indexOf(n);return o===-1?this:this.insert(o+1,r,a)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return So(this,De,[]),super.clear()}delete(n){const r=super.delete(n);return r&&We(this,De).splice(We(this,De).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=ga(We(this,De),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=ga(We(this,De),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return We(this,De).indexOf(n)}keyAt(n){return ga(We(this,De),n)}from(n,r){const a=this.indexOf(n);if(a===-1)return;let o=a+r;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.at(o)}keyFrom(n,r){const a=this.indexOf(n);if(a===-1)return;let o=a+r;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.keyAt(o)}find(n,r){let a=0;for(const o of this){if(Reflect.apply(n,r,[o,a,this]))return o;a++}}findIndex(n,r){let a=0;for(const o of this){if(Reflect.apply(n,r,[o,a,this]))return a;a++}return-1}filter(n,r){const a=[];let o=0;for(const s of this)Reflect.apply(n,r,[s,o,this])&&a.push(s),o++;return new at(a)}map(n,r){const a=[];let o=0;for(const s of this)a.push([s[0],Reflect.apply(n,r,[s,o,this])]),o++;return new at(a)}reduce(...n){const[r,a]=n;let o=0,s=a??this.at(0);for(const l of this)o===0&&n.length===1?s=l:s=Reflect.apply(r,this,[s,l,o,this]),o++;return s}reduceRight(...n){const[r,a]=n;let o=a??this.at(-1);for(let s=this.size-1;s>=0;s--){const l=this.at(s);s===this.size-1&&n.length===1?o=l:o=Reflect.apply(r,this,[o,l,s,this])}return o}toSorted(n){const r=[...this.entries()].sort(n);return new at(r)}toReversed(){const n=new at;for(let r=this.size-1;r>=0;r--){const a=this.keyAt(r),o=this.get(a);n.set(a,o)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new at(r)}slice(n,r){const a=new at;let o=this.size-1;if(n===void 0)return a;n<0&&(n=n+this.size),r!==void 0&&r>0&&(o=r-1);for(let s=n;s<=o;s++){const l=this.keyAt(s),c=this.get(l);a.set(l,c)}return a}every(n,r){let a=0;for(const o of this){if(!Reflect.apply(n,r,[o,a,this]))return!1;a++}return!0}some(n,r){let a=0;for(const o of this){if(Reflect.apply(n,r,[o,a,this]))return!0;a++}return!1}},De=new WeakMap,Fe(at,"OrderedDict"),at);function ga(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Wu(e,t);return n===-1?void 0:e[n]}Fe(ga,"at");function Wu(e,t){const n=e.length,r=gi(t),a=r>=0?r:n+r;return a<0||a>=n?-1:a}Fe(Wu,"toSafeIndex");function gi(e){return e!==e||e===0?0:Math.trunc(e)}Fe(gi,"toSafeInteger");function Nb(e){const t=e+"CollectionProvider",[n,r]=qn(t),[a,o]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Bo,setItemMap:Fe(()=>{},"setItemMap")}),s=Fe(({state:v,...C})=>v?i(c,{...C,state:v}):i(l,{...C}),"CollectionProvider");s.displayName=t;const l=Fe(v=>{const C=y();return i(c,{...v,state:C})},"CollectionInit");l.displayName=t+"Init";const c=Fe(v=>{const{scope:C,children:N,state:T}=v,R=M(null),[L,I]=E(null),P=Ye(R,I),[k,S]=T;return O(()=>{if(!L)return;const A=Yu(()=>{});return A.observe(L,{childList:!0,subtree:!0}),()=>{A.disconnect()}},[L]),i(a,{scope:C,itemMap:k,setItemMap:S,collectionRef:P,collectionRefObject:R,collectionElement:L,children:N})},"CollectionProviderImpl");c.displayName=t+"Impl";const d=e+"CollectionSlot",f=kr(d),u=W((v,C)=>{const{scope:N,children:T}=v,R=o(d,N),L=Ye(C,R.collectionRef);return i(f,{ref:L,children:T})});u.displayName=d;const p=e+"CollectionItemSlot",m="data-radix-collection-item",h=kr(p),g=W((v,C)=>{const{scope:N,children:T,...R}=v,L=M(null),[I,P]=E(null),k=Ye(C,L,P),S=o(p,N),{setItemMap:A}=S,D=M(R);qu(D.current,R)||(D.current=R);const B=D.current;return O(()=>{const U=B;return A(z=>I?z.has(I)?z.set(I,{...U,element:I}).toSorted(vs):(z.set(I,{...U,element:I}),z.toSorted(vs)):z),()=>{A(z=>!I||!z.has(I)?z:(z.delete(I),new Bo(z)))}},[I,B,A]),i(h,{[m]:"",ref:k,children:T})});g.displayName=p;function y(){return E(new Bo)}Fe(y,"useInitCollection");function w(v){const{itemMap:C}=o(e+"CollectionConsumer",v);return C}return Fe(w,"useCollection"),[{Provider:s,Slot:u,ItemSlot:g},{createCollectionScope:r,useCollection:w,useInitCollection:y}]}Fe(Nb,"createCollection");function qu(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const a of n)if(!Object.prototype.hasOwnProperty.call(t,a)||e[a]!==t[a])return!1;return!0}Fe(qu,"shallowEqual");function Gu(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Fe(Gu,"isElementPreceding");function vs(e,t){return!e[1].element||!t[1].element?0:Gu(e[1].element,t[1].element)?-1:1}Fe(vs,"sortByDocumentPosition");function Yu(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}Fe(Yu,"getChildListObserver");var Sb=Object.defineProperty,Eb=(e,t)=>Sb(e,"name",{value:t,configurable:!0}),Tb=Te(void 0);function yi(e){const t=ne(Tb);return e||t||"ltr"}Eb(yi,"useDirection");var kb=Object.defineProperty,Rb=(e,t)=>kb(e,"name",{value:t,configurable:!0});function kt(e){const t=M(e);return O(()=>{t.current=e}),Q(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}Rb(kt,"useCallbackRef");var Pb=Object.defineProperty,_e=(e,t)=>Pb(e,"name",{value:t,configurable:!0}),bs="dismissableLayer.update",Db="dismissableLayer.pointerDownOutside",Ib="dismissableLayer.focusOutside",oc,Xu=Te({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Lb=W(_e(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:a=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:c,onDismiss:d,...f}=t,u=ne(Xu),[p,m]=E(null),h=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=E({}),y=Ye(n,m),w=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=b?w.indexOf(b):-1,C=p?w.indexOf(p):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,T=C>=v,R=M(!1),L=Ju(S=>{s==null||s(S),c==null||c(S),S.defaultPrevented||d==null||d()},{ownerDocument:h,deferPointerDownOutside:a,isDeferredPointerDownOutsideRef:R,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:K(S=>{if(!(S instanceof Node))return!1;const A=[...u.branches].some(D=>D.contains(S));return T&&!A},[u.branches,T])}),I=Zu(S=>{if(a&&R.current)return;const A=S.target;[...u.branches].some(B=>B.contains(A))||(l==null||l(S),c==null||c(S),S.defaultPrevented||d==null||d())},h),P=p?C===w.length-1:!1,k=kt(S=>{S.key==="Escape"&&(o==null||o(S),!S.defaultPrevented&&d&&(S.preventDefault(),d()))});return O(()=>{if(P)return h.addEventListener("keydown",k,{capture:!0}),()=>h.removeEventListener("keydown",k,{capture:!0})},[h,P,k]),O(()=>{if(p)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(oc=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),xs(),()=>{r&&(u.layersWithOutsidePointerEventsDisabled.delete(p),u.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=oc))}},[p,h,r,u]),O(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),xs())},[p,u]),O(()=>{const S=_e(()=>g({}),"handleUpdate");return document.addEventListener(bs,S),()=>document.removeEventListener(bs,S)},[]),i(ot.div,{...f,ref:y,style:{pointerEvents:N?T?"auto":"none":void 0,...t.style},onFocusCapture:xe(t.onFocusCapture,I.onFocusCapture),onBlurCapture:xe(t.onBlurCapture,I.onBlurCapture),onPointerDownCapture:xe(t.onPointerDownCapture,L.onPointerDownCapture)})},"DismissableLayer"));function Ab(){const e=ne(Xu),[t,n]=E(null);return O(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}_e(Ab,"useDismissableLayerSurface");var Mb=_e(()=>!0,"IS_TRUE");function Ju(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o,shouldHandlePointerDownOutside:s=Mb}=t,l=kt(e),c=M(!1),d=M(!1),f=M(new Map),u=M(()=>{});return O(()=>{function p(){d.current=!1,a.current=!1,f.current.clear()}_e(p,"resetOutsideInteraction");function m(){return Array.from(f.current.values()).some(Boolean)}_e(m,"isOutsideInteractionIntercepted");function h(v){if(!d.current)return;const C=v.target;C instanceof Node&&[...o].some(T=>T.contains(C))||f.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{d.current&&u.current()},0)}_e(h,"handleInteractionCapture");function g(v){d.current&&f.current.set(v.type,!1)}_e(g,"handleInteractionBubble");const y=_e(v=>{if(v.target&&!c.current){let C=function(){n.removeEventListener("click",u.current);const T=m();p(),T||vi(Db,l,N,{discrete:!0})};if(_e(C,"handleAndDispatchPointerDownOutsideEvent"),!s(v.target)){n.removeEventListener("click",u.current),p(),c.current=!1;return}const N={originalEvent:v};d.current=!0,a.current=r&&v.button===0,f.current.clear(),!r||v.button!==0?C():(n.removeEventListener("click",u.current),u.current=C,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),p();c.current=!1},"handlePointerDown"),w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of w)n.addEventListener(v,h,!0),n.addEventListener(v,g);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",y),n.removeEventListener("click",u.current);for(const v of w)n.removeEventListener(v,h,!0),n.removeEventListener(v,g)}},[n,l,r,a,o,s]),{onPointerDownCapture:_e(()=>c.current=!0,"onPointerDownCapture")}}_e(Ju,"usePointerDownOutside");function Zu(e,t=globalThis==null?void 0:globalThis.document){const n=kt(e),r=M(!1);return O(()=>{const a=_e(o=>{o.target&&!r.current&&vi(Ib,n,{originalEvent:o},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:_e(()=>r.current=!0,"onFocusCapture"),onBlurCapture:_e(()=>r.current=!1,"onBlurCapture")}}_e(Zu,"useFocusOutside");function xs(){const e=new CustomEvent(bs);document.dispatchEvent(e)}_e(xs,"dispatchUpdate");function vi(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?kd(a,o):a.dispatchEvent(o)}_e(vi,"handleAndDispatchCustomEvent");var Ob=Object.defineProperty,bi=(e,t)=>Ob(e,"name",{value:t,configurable:!0}),sa=0,Ct=null;function _b(e){return xi(),e.children}bi(_b,"FocusGuards");function xi(){O(()=>{Ct||(Ct={start:ws(),end:ws()});const{start:e,end:t}=Ct;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),sa++,()=>{sa===1&&(Ct==null||Ct.start.remove(),Ct==null||Ct.end.remove(),Ct=null),sa=Math.max(0,sa-1)}},[])}bi(xi,"useFocusGuards");function ws(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}bi(ws,"createFocusGuard");var Fb=Object.defineProperty,Ge=(e,t)=>Fb(e,"name",{value:t,configurable:!0}),Uo="focusScope.autoFocusOnMount",zo="focusScope.autoFocusOnUnmount",sc={bubbles:!1,cancelable:!0},$b=W(Ge(function(t,n){const{loop:r=!1,trapped:a=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...l}=t,[c,d]=E(null),f=kt(o),u=kt(s),p=M(null),m=Ye(n,d),h=M({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;O(()=>{if(a){let y=function(C){if(h.paused||!c)return;const N=C.target;c.contains(N)?p.current=N:Ft(p.current,{select:!0})},w=function(C){if(h.paused||!c)return;const N=C.relatedTarget;N!==null&&(c.contains(N)||Ft(p.current,{select:!0}))},b=function(C){if(document.activeElement===document.body)for(const T of C)T.removedNodes.length>0&&Ft(c)};Ge(y,"handleFocusIn"),Ge(w,"handleFocusOut"),Ge(b,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",w);const v=new MutationObserver(b);return c&&v.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",w),v.disconnect()}}},[a,c,h.paused]),O(()=>{if(c){ic.add(h);const y=document.activeElement;if(!c.contains(y)){const b=new CustomEvent(Uo,sc);c.addEventListener(Uo,f),c.dispatchEvent(b),b.defaultPrevented||(Qu(af(wi(c)),{select:!0}),document.activeElement===y&&Ft(c))}return()=>{c.removeEventListener(Uo,f),setTimeout(()=>{const b=new CustomEvent(zo,sc);c.addEventListener(zo,u),c.dispatchEvent(b),b.defaultPrevented||Ft(y??document.body,{select:!0}),c.removeEventListener(zo,u),ic.remove(h)},0)}}},[c,f,u,h]);const g=K(y=>{if(!r&&!a||h.paused)return;const w=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,b=document.activeElement;if(w&&b){const v=y.currentTarget,[C,N]=ef(v);C&&N?!y.shiftKey&&b===N?(y.preventDefault(),r&&Ft(C,{select:!0})):y.shiftKey&&b===C&&(y.preventDefault(),r&&Ft(N,{select:!0})):b===v&&y.preventDefault()}},[r,a,h.paused]);return i(ot.div,{tabIndex:-1,...l,ref:m,onKeyDown:g})},"FocusScope"));function Qu(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ft(r,{select:t}),document.activeElement!==n)return}Ge(Qu,"focusFirst");function ef(e){const t=wi(e),n=Cs(t,e),r=Cs(t.reverse(),e);return[n,r]}Ge(ef,"getTabbableEdges");function wi(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Ge(r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Ge(wi,"getTabbableCandidates");function Cs(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):tf(r,{upTo:t})))return r}Ge(Cs,"findVisible");function tf(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Ge(tf,"isHidden");function nf(e){return e instanceof HTMLInputElement&&"select"in e}Ge(nf,"isSelectableInput");function Ft(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&nf(e)&&t&&e.select()}}Ge(Ft,"focus");var ic=rf();function rf(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ns(e,t),e.unshift(t)},remove(t){var n;e=Ns(e,t),(n=e[0])==null||n.resume()}}}Ge(rf,"createFocusScopesStack");function Ns(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Ge(Ns,"arrayRemove");function af(e){return e.filter(t=>t.tagName!=="A")}Ge(af,"removeLinks");var Bb=Object.defineProperty,Ub=(e,t)=>Bb(e,"name",{value:t,configurable:!0}),zb=_r[" useId ".trim().toString()]||(()=>{}),jb=0;function Ta(e){const[t,n]=E(zb());return rn(()=>{e||n(r=>r??String(jb++))},[e]),e||(t?`radix-${t}`:"")}Ub(Ta,"useId");const Vb=["top","right","bottom","left"],dn=Math.min,zt=Math.max,ka=Math.round,ia=Math.floor,jt=e=>({x:e,y:e}),Hb={left:"right",right:"left",bottom:"top",top:"bottom"};function of(e,t,n){return zt(e,dn(t,n))}function Vt(e,t){return typeof e=="function"?e(t):e}function un(e){return e.split("-")[0]}function or(e){return e.split("-")[1]}function Ci(e){return e==="x"?"y":"x"}function Ni(e){return e==="y"?"height":"width"}function Et(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Si(e){return Ci(Et(e))}function Kb(e,t,n){n===void 0&&(n=!1);const r=or(e),a=Si(e),o=Ni(a);let s=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Ra(s)),[s,Ra(s)]}function Wb(e){const t=Ra(e);return[Ss(e),t,Ss(t)]}function Ss(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const lc=["left","right"],cc=["right","left"],qb=["top","bottom"],Gb=["bottom","top"];function Yb(e,t,n){switch(e){case"top":case"bottom":return n?t?cc:lc:t?lc:cc;case"left":case"right":return t?qb:Gb;default:return[]}}function Xb(e,t,n,r){const a=or(e);let o=Yb(un(e),n==="start",r);return a&&(o=o.map(s=>s+"-"+a),t&&(o=o.concat(o.map(Ss)))),o}function Ra(e){const t=un(e);return Hb[t]+e.slice(t.length)}function Jb(e){var t,n,r,a;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(a=e.left)!=null?a:0}}function sf(e){return typeof e!="number"?Jb(e):{top:e,right:e,bottom:e,left:e}}function Pa(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function dc(e,t,n){let{reference:r,floating:a}=e;const o=Et(t),s=Si(t),l=Ni(s),c=un(t),d=o==="y",f=r.x+r.width/2-a.width/2,u=r.y+r.height/2-a.height/2,p=r[l]/2-a[l]/2;let m;switch(c){case"top":m={x:f,y:r.y-a.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:u};break;case"left":m={x:r.x-a.width,y:u};break;default:m={x:r.x,y:r.y}}const h=or(t);return h&&(m[s]+=p*(h==="end"?1:-1)*(n&&d?-1:1)),m}async function Zb(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:o,rects:s,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:m=0}=Vt(t,e),h=sf(m),y=l[p?u==="floating"?"reference":"floating":u],w=Pa(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),b=u==="floating"?{x:r,y:a,width:s.floating.width,height:s.floating.height}:s.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),C=await(o.isElement==null?void 0:o.isElement(v))&&await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1},N=Pa(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:v,strategy:c}):b);return{top:(w.top-N.top+h.top)/C.y,bottom:(N.bottom-w.bottom+h.bottom)/C.y,left:(w.left-N.left+h.left)/C.x,right:(N.right-w.right+h.right)/C.x}}const Qb=50,ex=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:Zb},c=await(s.isRTL==null?void 0:s.isRTL(t));let d=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:f,y:u}=dc(d,r,c),p=r,m=0;const h={};for(let g=0;g<o.length;g++){const y=o[g];if(!y)continue;const{name:w,fn:b}=y,{x:v,y:C,data:N,reset:T}=await b({x:f,y:u,initialPlacement:r,placement:p,strategy:a,middlewareData:h,rects:d,platform:l,elements:{reference:e,floating:t}});f=v??f,u=C??u,h[w]={...h[w],...N},T&&m<Qb&&(m++,typeof T=="object"&&(T.placement&&(p=T.placement),T.rects&&(d=T.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:a}):T.rects),{x:f,y:u}=dc(d,p,c)),g=-1)}return{x:f,y:u,placement:p,strategy:a,middlewareData:h}},tx=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:o,platform:s,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=Vt(e,t)||{};if(d==null)return{};const u=sf(f),p={x:n,y:r},m=Si(a),h=Ni(m),g=await s.getDimensions(d),y=m==="y",w=y?"top":"left",b=y?"bottom":"right",v=y?"clientHeight":"clientWidth",C=o.reference[h]+o.reference[m]-p[m]-o.floating[h],N=p[m]-o.reference[m],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let R=T?T[v]:0;(!R||!await(s.isElement==null?void 0:s.isElement(T)))&&(R=l.floating[v]||o.floating[h]);const L=C/2-N/2,I=R/2-g[h]/2-1,P=dn(u[w],I),k=dn(u[b],I),S=R-g[h]-k,A=R/2-g[h]/2+L,D=of(P,A,S),B=!c.arrow&&or(a)!=null&&A!==D&&o.reference[h]/2-(A<P?P:k)-g[h]/2<0,U=B?A<P?A-P:A-S:0;return{[m]:p[m]+U,data:{[m]:D,centerOffset:A-D-U,...B&&{alignmentOffset:U}},reset:B}}}),nx=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:o,rects:s,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...y}=Vt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=un(a),b=Et(l),v=un(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=p||(v||!g?[Ra(l)]:Wb(l)),T=h!=="none";!p&&T&&N.push(...Xb(l,g,h,C));const R=[l,...N],L=await c.detectOverflow(t,y),I=[];let P=((r=o.flip)==null?void 0:r.overflows)||[];if(f&&I.push(L[w]),u){const D=Kb(a,s,C);I.push(L[D[0]],L[D[1]])}if(P=[...P,{placement:a,overflows:I}],!I.every(D=>D<=0)){var k,S;const D=(((k=o.flip)==null?void 0:k.index)||0)+1,B=R[D];if(B&&(!(u==="alignment"?b!==Et(B):!1)||P.every(_=>Et(_.placement)===b?_.overflows[0]>0:!0)))return{data:{index:D,overflows:P},reset:{placement:B}};let U=(S=P.filter(z=>z.overflows[0]<=0).sort((z,_)=>z.overflows[1]-_.overflows[1])[0])==null?void 0:S.placement;if(!U)switch(m){case"bestFit":{var A;const z=(A=P.filter(_=>{if(T){const G=Et(_.placement);return G===b||G==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(G=>G>0).reduce((G,V)=>G+V,0)]).sort((_,G)=>_[1]-G[1])[0])==null?void 0:A[0];z&&(U=z);break}case"initialPlacement":U=l;break}if(a!==U)return{reset:{placement:U}}}return{}}}};function uc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fc(e){return Vb.some(t=>e[t]>=0)}const rx=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...o}=Vt(e,t);switch(a){case"referenceHidden":{const s=await r.detectOverflow(t,{...o,elementContext:"reference"}),l=uc(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:fc(l)}}}case"escaped":{const s=await r.detectOverflow(t,{...o,altBoundary:!0}),l=uc(s,n.floating);return{data:{escapedOffsets:l,escaped:fc(l)}}}default:return{}}}}},lf=new Set(["left","top"]);async function ax(e,t){const{placement:n,platform:r,elements:a}=e,o=await(r.isRTL==null?void 0:r.isRTL(a.floating)),s=un(n),l=or(n),c=Et(n)==="y",d=lf.has(s)?-1:1,f=o&&c?-1:1,u=Vt(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof h=="number"&&(m=l==="end"?h*-1:h),c?{x:m*f,y:p*d}:{x:p*d,y:m*f}}const ox=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:o,placement:s,middlewareData:l}=t,c=await ax(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:s}}}}},sx=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a,platform:o}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:v,y:C}=b;return{x:v,y:C}}},...d}=Vt(e,t),f={x:n,y:r},u=await o.detectOverflow(t,d),p=Et(a),m=Ci(p);let h=f[m],g=f[p];const y=(b,v)=>of(v+u[b==="y"?"top":"left"],v,v-u[b==="y"?"bottom":"right"]);s&&(h=y(m,h)),l&&(g=y(p,g));const w=c.fn({...t,[m]:h,[p]:g});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[m]:s,[p]:l}}}}}},ix=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:a,y:o,placement:s,rects:l,middlewareData:c}=t,{offset:d=0,mainAxis:f=!0,crossAxis:u=!0}=Vt(e,t),p={x:a,y:o},m=Et(s),h=Ci(m);let g=p[h],y=p[m];const w=Vt(d,t),b=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:(n=w.mainAxis)!=null?n:0,crossAxis:(r=w.crossAxis)!=null?r:0};if(f){const N=h==="y"?"height":"width",T=l.reference[h]-l.floating[N]+b.mainAxis,R=l.reference[h]+l.reference[N]-b.mainAxis;g<T?g=T:g>R&&(g=R)}if(u){var v,C;const N=h==="y"?"width":"height",T=lf.has(un(s)),R=l.reference[m]-l.floating[N]+(T&&((v=c.offset)==null?void 0:v[m])||0)+(T?0:b.crossAxis),L=l.reference[m]+l.reference[N]+(T?0:((C=c.offset)==null?void 0:C[m])||0)-(T?b.crossAxis:0);y<R?y=R:y>L&&(y=L)}return{[h]:g,[m]:y}}}},lx=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:a,elements:o}=t,{apply:s=()=>{},...l}=Vt(e,t),c=await a.detectOverflow(t,l),d=un(n),f=or(n),u=Et(n)==="y",{width:p,height:m}=r.floating;let h,g;d==="top"||d==="bottom"?(h=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(g=d,h=f==="end"?"top":"bottom");const y=m-c.top-c.bottom,w=p-c.left-c.right,b=dn(m-c[h],y),v=dn(p-c[g],w),C=t.middlewareData.shift,N=!C;let T=b,R=v;C!=null&&C.enabled.x&&(R=w),C!=null&&C.enabled.y&&(T=y),N&&!f&&(u?R=p-2*zt(c.left,c.right):T=m-2*zt(c.top,c.bottom)),await s({...t,availableWidth:R,availableHeight:T});const L=await a.getDimensions(o.floating);return p!==L.width||m!==L.height?{reset:{rects:!0}}:{}}}};function oo(){return typeof window<"u"}function sr(e){return cf(e)?(e.nodeName||"").toLowerCase():"#document"}function Qe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Gt(e){var t;return(t=(cf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cf(e){return oo()?e instanceof Node||e instanceof Qe(e).Node:!1}function Rt(e){return oo()?e instanceof Element||e instanceof Qe(e).Element:!1}function pn(e){return oo()?e instanceof HTMLElement||e instanceof Qe(e).HTMLElement:!1}function pc(e){return!oo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qe(e).ShadowRoot}function so(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Pt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function cx(e){return/^(table|td|th)$/.test(sr(e))}function io(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const dx=/transform|translate|scale|rotate|perspective|filter/,ux=/paint|layout|strict|content/,gn=e=>!!e&&e!=="none";let jo;function Ei(e){const t=Rt(e)?Pt(e):e;return gn(t.transform)||gn(t.translate)||gn(t.scale)||gn(t.rotate)||gn(t.perspective)||!Ti()&&(gn(t.backdropFilter)||gn(t.filter))||dx.test(t.willChange||"")||ux.test(t.contain||"")}function fx(e){let t=bn(e);for(;pn(t)&&!Dr(t);){if(Ei(t))return t;if(io(t))return null;t=bn(t)}return null}function Ti(){return jo==null&&(jo=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),jo}function Dr(e){return/^(html|body|#document)$/.test(sr(e))}function Pt(e){return Qe(e).getComputedStyle(e)}function lo(e){return Rt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bn(e){if(sr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||pc(e)&&e.host||Gt(e);return pc(t)?t.host:t}function df(e){const t=bn(e);return Dr(t)?(e.ownerDocument||e).body:pn(t)&&so(t)?t:df(t)}function Ir(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=df(e),o=a===((r=e.ownerDocument)==null?void 0:r.body),s=Qe(a);if(o){const l=Es(s);return t.concat(s,s.visualViewport||[],so(a)?a:[],l&&n?Ir(l):[])}else return t.concat(a,Ir(a,[],n))}function Es(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uf(e){const t=Pt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=pn(e),o=a?e.offsetWidth:n,s=a?e.offsetHeight:r,l=ka(n)!==o||ka(r)!==s;return l&&(n=o,r=s),{width:n,height:r,$:l}}function ki(e){return Rt(e)?e:e.contextElement}function Fn(e){const t=ki(e);if(!pn(t))return jt(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:o}=uf(t);let s=(o?ka(n.width):n.width)/r,l=(o?ka(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const px=jt(0);function ff(e){const t=Qe(e);return!Ti()||!t.visualViewport?px:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hx(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Qe(e)}function xn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),o=ki(e);let s=jt(1);t&&(r?Rt(r)&&(s=Fn(r)):s=Fn(e));const l=hx(o,n,r)?ff(o):jt(0);let c=(a.left+l.x)/s.x,d=(a.top+l.y)/s.y,f=a.width/s.x,u=a.height/s.y;if(o&&r){const p=Qe(o),m=Rt(r)?Qe(r):r;let h=p,g=Es(h);for(;g&&m!==h;){const y=Fn(g),w=g.getBoundingClientRect(),b=Pt(g),v=w.left+(g.clientLeft+parseFloat(b.paddingLeft))*y.x,C=w.top+(g.clientTop+parseFloat(b.paddingTop))*y.y;c*=y.x,d*=y.y,f*=y.x,u*=y.y,c+=v,d+=C,h=Qe(g),g=Es(h)}}return Pa({width:f,height:u,x:c,y:d})}function co(e,t){const n=lo(e).scrollLeft;return t?t.left+n:xn(Gt(e)).left+n}function pf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-co(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function mx(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const o=a==="fixed",s=Gt(r),l=t?io(t.floating):!1;if(r===s||l&&o)return n;let c={scrollLeft:0,scrollTop:0},d=jt(1);const f=jt(0),u=pn(r);if((u||!o)&&((sr(r)!=="body"||so(s))&&(c=lo(r)),u)){const m=xn(r);d=Fn(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const p=s&&!u&&!o?pf(s,c):jt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+p.x,y:n.y*d.y-c.scrollTop*d.y+f.y+p.y}}function gx(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function yx(e){const t=lo(e),n=e.ownerDocument.body,r=zt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),a=zt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+co(e);const s=-t.scrollTop;return Pt(n).direction==="rtl"&&(o+=zt(e.clientWidth,n.clientWidth)-r),{width:r,height:a,x:o,y:s}}const vx=25;function bx(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",a=Qe(e),o=Gt(e),s=a.visualViewport;let l=o.clientWidth,c=o.clientHeight,d=0,f=0;if(s){const p=!Ti()||t==="fixed";r?p||(d=-s.offsetLeft,f=-s.offsetTop):(l=s.width,c=s.height,p&&(d=s.offsetLeft,f=s.offsetTop))}if(co(o)<=0){const p=o.ownerDocument,m=p.body,h=getComputedStyle(m),g=p.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(o.clientWidth-m.clientWidth-g),w=getComputedStyle(o).scrollbarGutter==="stable both-edges"?y/2:y;w<=vx&&(l-=w)}return{width:l,height:c,x:d,y:f}}function xx(e,t){const n=xn(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=Fn(e),s=e.clientWidth*o.x,l=e.clientHeight*o.y,c=a*o.x,d=r*o.y;return{width:s,height:l,x:c,y:d}}function hc(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=bx(e,n,t);else if(t==="document")r=yx(Gt(e));else if(Rt(t))r=xx(t,n);else{const a=ff(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Pa(r)}function wx(e,t){const n=t.get(e);if(n)return n;let r=Ir(e,[],!1).filter(l=>Rt(l)&&sr(l)!=="body"),a=null;const o=Pt(e).position==="fixed";let s=o?bn(e):e;for(;Rt(s)&&!Dr(s);){const l=Pt(s),c=Ei(s),d=a?a.position:o?"fixed":"";!c&&(d==="fixed"||d==="absolute"&&l.position==="static")?r=r.filter(u=>u!==s):a=l,s=bn(s)}return t.set(e,r),r}function Cx(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const s=[...n==="clippingAncestors"?io(t)?[]:wx(t,this._c):[].concat(n),r],l=hc(t,s[0],a);let c=l.top,d=l.right,f=l.bottom,u=l.left;for(let p=1;p<s.length;p++){const m=hc(t,s[p],a);c=zt(m.top,c),d=dn(m.right,d),f=dn(m.bottom,f),u=zt(m.left,u)}return{width:d-u,height:f-c,x:u,y:c}}function Nx(e){const{width:t,height:n}=uf(e);return{width:t,height:n}}function Sx(e,t,n){const r=pn(t),a=Gt(t),o=n==="fixed",s=xn(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=jt(0);if((r||!o)&&((sr(t)!=="body"||so(a))&&(l=lo(t)),r)){const p=xn(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}!r&&a&&(c.x=co(a));const d=a&&!r&&!o?pf(a,l):jt(0),f=s.left+l.scrollLeft-c.x-d.x,u=s.top+l.scrollTop-c.y-d.y;return{x:f,y:u,width:s.width,height:s.height}}function Vo(e){return Pt(e).position==="static"}function mc(e,t){if(!pn(e)||Pt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Gt(e)===n&&(n=n.ownerDocument.body),n}function hf(e,t){const n=Qe(e);if(io(e))return n;if(!pn(e)){let a=bn(e);for(;a&&!Dr(a);){if(Rt(a)&&!Vo(a))return a;a=bn(a)}return n}let r=mc(e,t);for(;r&&cx(r)&&Vo(r);)r=mc(r,t);return r&&Dr(r)&&Vo(r)&&!Ei(r)?n:r||fx(e)||n}const Ex=async function(e){const t=this.getOffsetParent||hf,n=this.getDimensions,r=await n(e.floating);return{reference:Sx(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tx(e){return Pt(e).direction==="rtl"}const kx={convertOffsetParentRelativeRectToViewportRelativeRect:mx,getDocumentElement:Gt,getClippingRect:Cx,getOffsetParent:hf,getElementRects:Ex,getClientRects:gx,getDimensions:Nx,getScale:Fn,isElement:Rt,isRTL:Tx};function mf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rx(e,t,n){let r=null,a;const o=Gt(e);function s(){var f;clearTimeout(a),(f=r)==null||f.disconnect(),r=null}function l(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),s();const p=e.getBoundingClientRect(),{left:m,top:h,width:g,height:y}=p;if(f||t(),!g||!y)return;const w=ia(h),b=ia(o.clientWidth-(m+g)),v=ia(o.clientHeight-(h+y)),C=ia(m),T={rootMargin:-w+"px "+-b+"px "+-v+"px "+-C+"px",threshold:zt(0,dn(1,u))||1};let R=!0;function L(I){const P=I[0].intersectionRatio;if(!mf(p,e.getBoundingClientRect()))return l();if(P!==u){if(!R)return l();P?l(!1,P):a=setTimeout(()=>{l(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(L,{...T,root:o.ownerDocument})}catch{r=new IntersectionObserver(L,T)}r.observe(e)}const c=Qe(e),d=()=>l(n);return c.addEventListener("resize",d),l(!0),()=>{c.removeEventListener("resize",d),s()}}function Px(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=ki(e),f=a||o?[...d?Ir(d):[],...t?Ir(t):[]]:[];f.forEach(w=>{a&&w.addEventListener("scroll",n),o&&w.addEventListener("resize",n)});const u=d&&l?Rx(d,n,o):null;let p=-1,m=null;s&&(m=new ResizeObserver(w=>{let[b]=w;b&&b.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),d&&!c&&m.observe(d),t&&m.observe(t));let h,g=c?xn(e):null;c&&y();function y(){const w=xn(e);g&&!mf(g,w)&&n(),g=w,h=requestAnimationFrame(y)}return n(),()=>{var w;f.forEach(b=>{a&&b.removeEventListener("scroll",n),o&&b.removeEventListener("resize",n)}),u==null||u(),(w=m)==null||w.disconnect(),m=null,c&&cancelAnimationFrame(h)}}const Dx=ox,Ix=sx,Lx=nx,Ax=lx,Mx=rx,gc=tx,Ox=ix,_x=(e,t,n)=>{const r=new Map,a=n??{},o={...kx,...a.platform,_c:r};return ex(e,t,{...a,platform:o})};var Fx=typeof document<"u",$x=function(){},ya=Fx?Wn:$x;function Da(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Da(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const o=a[r];if(!(o==="_owner"&&e.$$typeof)&&!Da(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function gf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yc(e,t){const n=gf(e);return Math.round(t*n)/n}function Ho(e){const t=M(e);return ya(()=>{t.current=e}),t}function Bx(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,u]=E({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=E(r);Da(p,r)||m(r);const[h,g]=E(null),[y,w]=E(null),b=K(_=>{_!==T.current&&(T.current=_,g(_))},[]),v=K(_=>{_!==R.current&&(R.current=_,w(_))},[]),C=o||h,N=s||y,T=M(null),R=M(null),L=M(f),I=c!=null,P=Ho(c),k=Ho(a),S=Ho(d),A=K(()=>{if(!T.current||!R.current)return;const _={placement:t,strategy:n,middleware:p};k.current&&(_.platform=k.current),_x(T.current,R.current,_).then(G=>{const V={...G,isPositioned:S.current!==!1};D.current&&!Da(L.current,V)&&(L.current=V,Sh(()=>{u(V)}))})},[p,t,n,k,S]);ya(()=>{d===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,u(_=>({..._,isPositioned:!1})))},[d]);const D=M(!1);ya(()=>(D.current=!0,()=>{D.current=!1}),[]),ya(()=>{if(C&&(T.current=C),N&&(R.current=N),C&&N){if(P.current)return P.current(C,N,A);A()}},[C,N,A,P,I]);const B=Q(()=>({reference:T,floating:R,setReference:b,setFloating:v}),[b,v]),U=Q(()=>({reference:C,floating:N}),[C,N]),z=Q(()=>{const _={position:n,left:0,top:0};if(!U.floating)return _;const G=yc(U.floating,f.x),V=yc(U.floating,f.y);return l?{..._,transform:"translate("+G+"px, "+V+"px)",...gf(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:V}},[n,l,U.floating,f.x,f.y]);return Q(()=>({...f,update:A,refs:B,elements:U,floatingStyles:z}),[f,A,B,U,z])}const Ux=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?gc({element:r.current,padding:a}).fn(n):{}:r?gc({element:r,padding:a}).fn(n):{}}}},zx=(e,t)=>{const n=Dx(e);return{name:n.name,fn:n.fn,options:[e,t]}},jx=(e,t)=>{const n=Ix(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vx=(e,t)=>({fn:Ox(e).fn,options:[e,t]}),Hx=(e,t)=>{const n=Lx(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kx=(e,t)=>{const n=Ax(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wx=(e,t)=>{const n=Mx(e);return{name:n.name,fn:n.fn,options:[e,t]}},qx=(e,t)=>{const n=Ux(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Gx=Object.defineProperty,an=(e,t)=>Gx(e,"name",{value:t,configurable:!0}),yf="Popper",[vf,bf]=qn(yf),[Yx,xf]=vf(yf),Xx=an(e=>{const{__scopePopper:t,children:n}=e,[r,a]=E(null),[o,s]=E(void 0);return i(Yx,{scope:t,anchor:r,onAnchorChange:a,placementState:o,setPlacementState:s,children:n})},"Popper"),Jx="PopperAnchor",Zx=W(an(function(t,n){const{__scopePopper:r,virtualRef:a,...o}=t,s=xf(Jx,r),l=M(null),c=s.onAnchorChange,d=K(g=>{l.current=g,g&&c(g)},[c]),f=Ye(n,d),u=M(null);O(()=>{if(!a)return;const g=u.current;u.current=a.current,g!==u.current&&c(u.current)});const p=s.placementState&&uo(s.placementState),m=p==null?void 0:p[0],h=p==null?void 0:p[1];return a?null:i(ot.div,{"data-radix-popper-side":m,"data-radix-popper-align":h,...o,ref:f})},"PopperAnchor")),wf="PopperContent",[Qx,yk]=vf(wf),e0=W(an(function(t,n){var F,q,be,Pe,He,Be,Ue;const{__scopePopper:r,side:a="bottom",sideOffset:o=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:u=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...y}=t,w=xf(wf,r),[b,v]=E(null),C=Ye(n,v),[N,T]=E(null),R=Th(N),L=(R==null?void 0:R.width)??0,I=(R==null?void 0:R.height)??0,P=a+(s!=="center"?"-"+s:""),k=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},S=Array.isArray(f)?f:[f],A=S.length>0,D={padding:k,boundary:S.filter(Cf),altBoundary:A},{refs:B,floatingStyles:U,placement:z,isPositioned:_,middlewareData:G}=Bx({strategy:"fixed",placement:P,whileElementsMounted:an((...st)=>Px(...st,{animationFrame:h==="always"}),"whileElementsMounted"),elements:{reference:w.anchor},middleware:[zx({mainAxis:o+I,alignmentAxis:l}),d&&jx({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Vx():void 0,...D}),d&&Hx({...D}),Kx({...D,apply:an(({elements:st,rects:hn,availableWidth:kn,availableHeight:mn})=>{const{width:it,height:Yt}=hn.reference,$=st.floating.style;$.setProperty("--radix-popper-available-width",`${kn}px`),$.setProperty("--radix-popper-available-height",`${mn}px`),$.setProperty("--radix-popper-anchor-width",`${it}px`),$.setProperty("--radix-popper-anchor-height",`${Yt}px`)},"apply")}),N&&qx({element:N,padding:c}),t0({arrowWidth:L,arrowHeight:I}),m&&Wx({strategy:"referenceHidden",...D,boundary:A?D.boundary:void 0})]}),V=w.setPlacementState;rn(()=>(V(z),()=>{V(void 0)}),[z,V]);const[ee,Z]=uo(z),j=kt(g);rn(()=>{_&&(j==null||j())},[_,j]);const le=(F=G.arrow)==null?void 0:F.x,Se=(q=G.arrow)==null?void 0:q.y,ge=((be=G.arrow)==null?void 0:be.centerOffset)!==0,[Le,ue]=E();return rn(()=>{b&&ue(window.getComputedStyle(b).zIndex)},[b]),i("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:_?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Le,"--radix-popper-transform-origin":[(Pe=G.transformOrigin)==null?void 0:Pe.x,(He=G.transformOrigin)==null?void 0:He.y].join(" "),...((Be=G.hide)==null?void 0:Be.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i(Qx,{scope:r,placedSide:ee,placedAlign:Z,onArrowChange:T,arrowX:le,arrowY:Se,shouldHideArrow:ge,children:i(ot.div,{"data-side":ee,"data-align":Z,...y,ref:C,style:{...y.style,animation:_?(Ue=y.style)==null?void 0:Ue.animation:"none"}})})})},"PopperContent"));function Cf(e){return e!==null}an(Cf,"isNotNull");var t0=an(e=>({name:"transformOrigin",options:e,fn(t){var y,w,b;const{placement:n,rects:r,middlewareData:a}=t,s=((y=a.arrow)==null?void 0:y.centerOffset)!==0,l=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[d,f]=uo(n),u={start:"0%",center:"50%",end:"100%"}[f],p=(((w=a.arrow)==null?void 0:w.x)??0)+l/2,m=(((b=a.arrow)==null?void 0:b.y)??0)+c/2;let h="",g="";return d==="bottom"?(h=s?u:`${p}px`,g=`${-c}px`):d==="top"?(h=s?u:`${p}px`,g=`${r.floating.height+c}px`):d==="right"?(h=`${-c}px`,g=s?u:`${m}px`):d==="left"&&(h=`${r.floating.width+c}px`,g=s?u:`${m}px`),{data:{x:h,y:g}}}}),"transformOrigin");function uo(e){const[t,n="center"]=e.split("-");return[t,n]}an(uo,"getSideAndAlignFromPlacement");var n0=Xx,r0=Zx,a0=e0,o0=Object.defineProperty,s0=(e,t)=>o0(e,"name",{value:t,configurable:!0}),i0=W(s0(function(t,n){var c;const{container:r,...a}=t,[o,s]=E(!1);rn(()=>s(!0),[]);const l=r||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?Ga(i(ot.div,{...a,ref:n}),l):null},"Portal")),l0=Object.defineProperty,Ht=(e,t)=>l0(e,"name",{value:t,configurable:!0});function Nf(e,t){return Cd((n,r)=>t[n][r]??n,e)}Ht(Nf,"useStateMachine");var Ri=Ht(e=>{const{present:t,children:n}=e,r=Sf(t),a=typeof n=="function"?n({present:r.isPresent}):Wa.only(n),o=Ef(r.ref,Tf(a));return typeof n=="function"||r.isPresent?wd(a,{ref:o}):null},"Presence");function Sf(e){const[t,n]=E(),r=M(null),a=M(e),o=M("none"),s=M(void 0),l=e?"mounted":"unmounted",[c,d]=Nf(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return O(()=>{c==="mounted"?(o.current=s.current??An(r.current),s.current=void 0):o.current="none"},[c]),rn(()=>{const f=r.current,u=a.current;if(u!==e){const m=o.current,h=An(f);e?(s.current=h,d("MOUNT")):h==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(u&&m!==h?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,d]),rn(()=>{if(t){let f;const u=t.ownerDocument.defaultView??window,p=Ht(h=>{const y=An(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&y&&(d("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},"handleAnimationEnd"),m=Ht(h=>{h.target===t&&(o.current=An(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(f),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:K(f=>{if(f){const u=getComputedStyle(f);r.current=u,s.current=An(u)}else r.current=null;n(f)},[])}}Ht(Sf,"usePresence");function Ts(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ht(Ts,"setRef");function Ef(...e){const t=M(e);return t.current=e,K(n=>{const r=t.current;let a=!1;const o=r.map(s=>{const l=Ts(s,n);return!a&&typeof l=="function"&&(a=!0),l});if(a)return()=>{for(let s=0;s<o.length;s++){const l=o[s];typeof l=="function"?l():Ts(r[s],null)}}},[])}Ht(Ef,"useStableComposedRefs");function An(e){return(e==null?void 0:e.animationName)||"none"}Ht(An,"getAnimationName");function Tf(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ht(Tf,"getElementRef");var c0=Object.defineProperty,Pi=(e,t)=>c0(e,"name",{value:t,configurable:!0}),Ko=!1;function kf(){const[e,t]=E(Ko);return O(()=>{Ko||(Ko=!0,t(!0))},[]),e}Pi(kf,"useIsHydrated");var Rf=_r[" useSyncExternalStore ".trim().toString()];function Pf(){return()=>{}}Pi(Pf,"subscribe");function Df(){return Rf(Pf,()=>!0,()=>!1)}Pi(Df,"useIsHydratedModern");var d0=typeof Rf=="function"?Df:kf,u0=Object.defineProperty,Sn=(e,t)=>u0(e,"name",{value:t,configurable:!0}),Wo="rovingFocusGroup.onEntryFocus",f0={bubbles:!1,cancelable:!0},fo="RovingFocusGroup",[ks,If,p0]=mi(fo),[h0,Lf]=qn(fo,[p0]),[m0,g0]=h0(fo),y0=W(Sn(function(t,n){return i(ks.Provider,{scope:t.__scopeRovingFocusGroup,children:i(ks.Slot,{scope:t.__scopeRovingFocusGroup,children:i(v0,{...t,ref:n})})})},"RovingFocusGroup")),v0=W(Sn(function(t,n){const{__scopeRovingFocusGroup:r,orientation:a,loop:o=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...p}=t,m=M(null),h=Ye(n,m),g=yi(s),[y,w]=Rd({prop:l,defaultProp:c??null,onChange:d,caller:fo}),[b,v]=E(!1),C=kt(f),N=If(r),T=M(!1),[R,L]=E(0);return O(()=>{const I=m.current;if(I)return I.addEventListener(Wo,C),()=>I.removeEventListener(Wo,C)},[C]),i(m0,{scope:r,orientation:a,dir:g,loop:o,currentTabStopId:y,onItemFocus:K(I=>w(I),[w]),onItemShiftTab:K(()=>v(!0),[]),onFocusableItemAdd:K(()=>L(I=>I+1),[]),onFocusableItemRemove:K(()=>L(I=>I-1),[]),children:i(ot.div,{tabIndex:b||R===0?-1:0,"data-orientation":a,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:xe(t.onMouseDown,()=>{T.current=!0}),onFocus:xe(t.onFocus,I=>{const P=!T.current;if(I.target===I.currentTarget&&P&&!b){const k=new CustomEvent(Wo,f0);if(I.currentTarget.dispatchEvent(k),!k.defaultPrevented){const S=N().filter(z=>z.focusable),A=S.find(z=>z.active),D=S.find(z=>z.id===y),U=[A,D,...S].filter(Boolean).map(z=>z.ref.current);Di(U,u)}}T.current=!1}),onBlur:xe(t.onBlur,()=>v(!1))})})},"RovingFocusGroupImpl")),b0="RovingFocusGroupItem",x0=W(Sn(function(t,n){const{__scopeRovingFocusGroup:r,focusable:a=!0,active:o=!1,tabStopId:s,children:l,...c}=t,d=Ta(),f=s||d,u=g0(b0,r),p=u.currentTabStopId===f,m=If(r),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:y}=u,w=d0();return rn(()=>{if(!(!w||!a))return h(),()=>g()},[w,a,h,g]),O(()=>{if(!(w||!a))return h(),()=>g()},[w,a,h,g]),i(ks.ItemSlot,{scope:r,id:f,focusable:a,active:o,children:i(ot.span,{tabIndex:p?0:-1,"data-orientation":u.orientation,...c,ref:n,onMouseDown:xe(t.onMouseDown,b=>{a?u.onItemFocus(f):b.preventDefault()}),onFocus:xe(t.onFocus,()=>u.onItemFocus(f)),onKeyDown:xe(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const v=Mf(b,u.orientation,u.dir);if(v!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let N=m().filter(T=>T.focusable).map(T=>T.ref.current);if(v==="last")N.reverse();else if(v==="prev"||v==="next"){v==="prev"&&N.reverse();const T=N.indexOf(b.currentTarget);N=u.loop?Of(N,T+1):N.slice(T+1)}setTimeout(()=>Di(N))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:y!=null}):l})})},"RovingFocusGroupItem")),w0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Af(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Sn(Af,"getDirectionAwareKey");function Mf(e,t,n){const r=Af(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return w0[r]}Sn(Mf,"getFocusIntent");function Di(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Sn(Di,"focusFirst");function Of(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Sn(Of,"wrapArray");var C0=y0,N0=x0,S0=Object.defineProperty,he=(e,t)=>S0(e,"name",{value:t,configurable:!0}),E0=["Enter"," "],T0=["ArrowDown","PageUp","Home"],_f=["ArrowUp","PageDown","End"],k0=[...T0,..._f],po="Menu",[Rs,R0,P0]=mi(po),[En,Ff]=qn(po,[P0,bf,Lf]),Ii=bf(),$f=Lf(),[D0,zr]=En(po),[I0,Li]=En(po),L0=he(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:o,modal:s=!0}=e,l=Ii(t),[c,d]=E(null),f=M(!1),u=kt(o),p=yi(a);return O(()=>{const m=he(()=>{f.current=!0,document.addEventListener("pointerdown",h,{capture:!0,once:!0}),document.addEventListener("pointermove",h,{capture:!0,once:!0})},"handleKeyDown"),h=he(()=>f.current=!1,"handlePointer");return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",h,{capture:!0}),document.removeEventListener("pointermove",h,{capture:!0})}},[]),O(()=>{if(!n)return;const m=he(()=>u(!1),"handleBlur");return window.addEventListener("blur",m),()=>window.removeEventListener("blur",m)},[n,u]),i(n0,{...l,children:i(D0,{scope:t,open:n,onOpenChange:u,content:c,onContentChange:d,children:i(I0,{scope:t,onClose:K(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:p,modal:s,children:r})})})},"Menu"),A0=W(he(function(t,n){const{__scopeMenu:r,...a}=t,o=Ii(r);return i(r0,{...o,...a,ref:n})},"MenuAnchor")),Bf="MenuPortal",[M0,O0]=En(Bf,{forceMount:void 0}),_0=he(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,o=zr(Bf,t);return i(M0,{scope:t,forceMount:n,children:i(Ri,{present:n||o.open,children:i(i0,{asChild:!0,container:a,children:r})})})},"MenuPortal"),on="MenuContent",[F0,Uf]=En(on),$0=W(he(function(t,n){const r=O0(on,t.__scopeMenu),{forceMount:a=r.forceMount,...o}=t,s=zr(on,t.__scopeMenu),l=Li(on,t.__scopeMenu);return i(Rs.Provider,{scope:t.__scopeMenu,children:i(Ri,{present:a||s.open,children:i(Rs.Slot,{scope:t.__scopeMenu,children:l.modal?i(B0,{...o,ref:n}):i(U0,{...o,ref:n})})})})},"MenuContent")),B0=W(he(function(t,n){const r=zr(on,t.__scopeMenu),a=M(null),o=Ye(n,a);return O(()=>{const s=a.current;if(s)return bu(s)},[]),i(zf,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:xe(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),U0=W(he(function(t,n){const r=zr(on,t.__scopeMenu);return i(zf,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),z0=kr("MenuContent.ScrollLock"),zf=W(he(function(t,n){const{__scopeMenu:r,loop:a=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,...y}=t,w=zr(on,r),b=Li(on,r),v=Ii(r),C=$f(r),N=R0(r),[T,R]=E(null),L=M(null),I=Ye(n,L,w.onContentChange),P=M(0),k=M(""),S=M(0),A=M(null),D=M("right"),B=M(0),U=g?ui:fn,z=g?{as:z0,allowPinchZoom:!0}:void 0,_=he(V=>{var ue,F;const ee=k.current+V,Z=N().filter(q=>!q.disabled),j=document.activeElement,le=(ue=Z.find(q=>q.ref.current===j))==null?void 0:ue.textValue,Se=Z.map(q=>q.textValue),ge=qf(Se,ee,le),Le=(F=Z.find(q=>q.textValue===ge))==null?void 0:F.ref.current;he((function q(be){k.current=be,window.clearTimeout(P.current),be!==""&&(P.current=window.setTimeout(()=>q(""),1e3))}),"updateSearch")(ee),Le&&setTimeout(()=>Le.focus())},"handleTypeaheadSearch");O(()=>()=>window.clearTimeout(P.current),[]),xi();const G=K(V=>{var Z,j;return D.current===((Z=A.current)==null?void 0:Z.side)&&Yf(V,(j=A.current)==null?void 0:j.area)},[]);return i(F0,{scope:r,searchRef:k,onItemEnter:K(V=>{G(V)&&V.preventDefault()},[G]),onItemLeave:K(V=>{var ee;G(V)||((ee=L.current)==null||ee.focus(),R(null))},[G]),onTriggerLeave:K(V=>{G(V)&&V.preventDefault()},[G]),pointerGraceTimerRef:S,onPointerGraceIntentChange:K(V=>{A.current=V},[]),children:i(U,{...z,children:i($b,{asChild:!0,trapped:o,onMountAutoFocus:xe(s,V=>{var ee;V.preventDefault(),(ee=L.current)==null||ee.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:i(Lb,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:i(C0,{asChild:!0,...C,dir:b.dir,orientation:"vertical",loop:a,currentTabStopId:T,onCurrentTabStopIdChange:R,onEntryFocus:xe(d,V=>{b.isUsingKeyboardRef.current||V.preventDefault()}),preventScrollOnEntryFocus:!0,children:i(a0,{role:"menu","aria-orientation":"vertical","data-state":Hf(w.open),"data-radix-menu-content":"",dir:b.dir,...v,...y,ref:I,style:{outline:"none",...y.style},onKeyDown:xe(y.onKeyDown,V=>{const Z=V.target.closest("[data-radix-menu-content]")===V.currentTarget,j=V.ctrlKey||V.altKey||V.metaKey,le=V.key.length===1;Z&&(V.key==="Tab"&&V.preventDefault(),!j&&le&&_(V.key));const Se=L.current;if(V.target!==Se||!k0.includes(V.key))return;V.preventDefault();const Le=N().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);_f.includes(V.key)&&Le.reverse(),Kf(Le)}),onBlur:xe(t.onBlur,V=>{V.currentTarget.contains(V.target)||(window.clearTimeout(P.current),k.current="")}),onPointerMove:xe(t.onPointerMove,Ia(V=>{const ee=V.target,Z=B.current!==V.clientX;if(V.currentTarget.contains(ee)&&Z){const j=V.clientX>B.current?"right":"left";D.current=j,B.current=V.clientX}}))})})})})})})},"MenuContentImpl")),j0=W(he(function(t,n){const{__scopeMenu:r,...a}=t;return i(ot.div,{role:"group",...a,ref:n})},"MenuGroup")),V0=W(he(function(t,n){const{__scopeMenu:r,...a}=t;return i(ot.div,{...a,ref:n})},"MenuLabel")),Ps="MenuItem",vc="menu.itemSelect",jf=W(he(function(t,n){const{disabled:r=!1,onSelect:a,...o}=t,s=M(null),l=Li(Ps,t.__scopeMenu),c=Uf(Ps,t.__scopeMenu),d=Ye(n,s),f=M(!1),u=he(()=>{const p=s.current;if(!r&&p){const m=new CustomEvent(vc,{bubbles:!0,cancelable:!0});p.addEventListener(vc,h=>a==null?void 0:a(h),{once:!0}),kd(p,m),m.defaultPrevented?f.current=!1:l.onClose()}},"handleSelect");return i(H0,{...o,ref:d,disabled:r,onClick:xe(t.onClick,u),onPointerDown:p=>{var m;(m=t.onPointerDown)==null||m.call(t,p),f.current=!0},onPointerUp:xe(t.onPointerUp,p=>{var m;f.current||(m=p.currentTarget)==null||m.click()}),onKeyDown:xe(t.onKeyDown,p=>{r||p.target!==p.currentTarget||c.searchRef.current!==""&&p.key===" "||E0.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})},"MenuItem")),H0=W(he(function(t,n){const{__scopeMenu:r,disabled:a=!1,textValue:o,...s}=t,l=Uf(Ps,r),c=$f(r),d=M(null),f=Ye(n,d),[u,p]=E(!1),[m,h]=E("");return O(()=>{const g=d.current;g&&h((g.textContent??"").trim())},[s.children]),i(Rs.ItemSlot,{scope:r,disabled:a,textValue:o??m,children:i(N0,{asChild:!0,...c,focusable:!a,children:i(ot.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...s,ref:f,onPointerMove:xe(t.onPointerMove,Ia(g=>{a?l.onItemLeave(g):(l.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:xe(t.onPointerLeave,Ia(g=>l.onItemLeave(g))),onFocus:xe(t.onFocus,()=>p(!0)),onBlur:xe(t.onBlur,()=>p(!1))})})})},"MenuItemImpl")),K0="MenuRadioGroup",[W0,q0]=En(K0,{value:void 0,onValueChange:he(()=>{},"onValueChange")}),G0=W(he(function(t,n){const{value:r,onValueChange:a,...o}=t,s=kt(a);return i(W0,{scope:t.__scopeMenu,value:r,onValueChange:s,children:i(j0,{...o,ref:n})})},"MenuRadioGroup")),Y0="MenuRadioItem",X0=W(he(function(t,n){const{value:r,...a}=t,o=q0(Y0,t.__scopeMenu),s=r===o.value;return i(J0,{scope:t.__scopeMenu,checked:s,children:i(jf,{role:"menuitemradio","aria-checked":s,...a,ref:n,"data-state":Mi(s),onSelect:xe(a.onSelect,()=>{var l;return(l=o.onValueChange)==null?void 0:l.call(o,r)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),Vf="MenuItemIndicator",[J0,Z0]=En(Vf,{checked:!1}),Q0=W(he(function(t,n){const{__scopeMenu:r,forceMount:a,...o}=t,s=Z0(Vf,r);return i(Ri,{present:a||Ai(s.checked)||s.checked===!0,children:i(ot.span,{...o,ref:n,"data-state":Mi(s.checked)})})},"MenuItemIndicator")),ew=W(he(function(t,n){const{__scopeMenu:r,...a}=t;return i(ot.div,{role:"separator","aria-orientation":"horizontal",...a,ref:n})},"MenuSeparator")),tw="MenuSub",[vk,bk]=En(tw);function Hf(e){return e?"open":"closed"}he(Hf,"getOpenState");function Ai(e){return e==="indeterminate"}he(Ai,"isIndeterminate");function Mi(e){return Ai(e)?"indeterminate":e?"checked":"unchecked"}he(Mi,"getCheckedState");function Kf(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}he(Kf,"focusFirst");function Wf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}he(Wf,"wrapArray");function qf(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=Wf(e,Math.max(o,0));a.length===1&&(s=s.filter(d=>d!==n));const c=s.find(d=>d.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}he(qf,"getNextMatch");function Gf(e,t){const{x:n,y:r}=e;let a=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const l=t[o],c=t[s],d=l.x,f=l.y,u=c.x,p=c.y;f>r!=p>r&&n<(u-d)*(r-f)/(p-f)+d&&(a=!a)}return a}he(Gf,"isPointInPolygon");function Yf(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Gf(n,t)}he(Yf,"isPointerInGraceArea");function Ia(e){return t=>t.pointerType==="mouse"?e(t):void 0}he(Ia,"whenMouse");var nw=L0,rw=A0,aw=_0,ow=$0,sw=V0,iw=jf,lw=G0,cw=X0,dw=Q0,uw=ew,fw=Object.defineProperty,It=(e,t)=>fw(e,"name",{value:t,configurable:!0}),Oi="DropdownMenu",[pw,xk]=qn(Oi,[Ff]),Lt=Ff(),[hw,Xf]=pw(Oi),mw=It(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:o,onOpenChange:s,modal:l=!0}=e,c=Lt(t),d=M(null),[f,u]=Rd({prop:a,defaultProp:o??!1,onChange:s,caller:Oi});return i(hw,{scope:t,triggerId:Ta(),triggerRef:d,contentId:Ta(),open:f,onOpenChange:u,onOpenToggle:K(()=>u(p=>!p),[u]),modal:l,children:i(nw,{...c,open:f,onOpenChange:u,dir:r,modal:l,children:n})})},"DropdownMenu"),gw="DropdownMenuTrigger",yw=W(It(function(t,n){const{__scopeDropdownMenu:r,disabled:a=!1,...o}=t,s=Xf(gw,r),l=Lt(r),c=Ye(n,s.triggerRef);return i(rw,{asChild:!0,...l,children:i(ot.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...o,ref:c,onPointerDown:xe(t.onPointerDown,d=>{!a&&d.button===0&&d.ctrlKey===!1&&(s.onOpenToggle(),s.open||d.preventDefault())}),onKeyDown:xe(t.onKeyDown,d=>{a||(["Enter"," "].includes(d.key)&&s.onOpenToggle(),d.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})},"DropdownMenuTrigger")),vw=It(e=>{const{__scopeDropdownMenu:t,...n}=e,r=Lt(t);return i(aw,{...r,...n})},"DropdownMenuPortal"),bw="DropdownMenuContent",xw=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Xf(bw,r),s=Lt(r),l=M(!1);return i(ow,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...a,ref:n,onCloseAutoFocus:xe(t.onCloseAutoFocus,c=>{var d;l.current||(d=o.triggerRef.current)==null||d.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:xe(t.onInteractOutside,c=>{const d=c.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,u=d.button===2||f;(!o.modal||u)&&(l.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),ww=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(sw,{...o,...a,ref:n})},"DropdownMenuLabel")),Cw=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(iw,{...o,...a,ref:n})},"DropdownMenuItem")),Nw=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(lw,{...o,...a,ref:n})},"DropdownMenuRadioGroup")),Sw=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(cw,{...o,...a,ref:n})},"DropdownMenuRadioItem")),Ew=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(dw,{...o,...a,ref:n})},"DropdownMenuItemIndicator")),Tw=W(It(function(t,n){const{__scopeDropdownMenu:r,...a}=t,o=Lt(r);return i(uw,{...o,...a,ref:n})},"DropdownMenuSeparator")),kw=mw,Rw=yw,Pw=vw,Dw=xw,Iw=ww,Lw=Cw,Aw=Nw,Mw=Sw,Ow=Ew,_w=Tw;function _i({modal:e=!1,...t}){return i(kw,{modal:e,...t})}const Fi=Rw,bc=Aw;function xc({className:e,children:t,...n}){return x(Mw,{className:se("relative flex cursor-pointer select-none items-center gap-2 rounded-sm py-2 pe-2 ps-8 text-sm text-text-primary outline-none transition-colors data-[highlighted]:bg-background-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i("span",{className:"absolute start-2 flex size-4 items-center justify-center",children:i(Ow,{children:i("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4 text-primary-600",children:i("path",{d:"M20 6 9 17l-5-5"})})})}),t]})}function $i({className:e,sideOffset:t=4,...n}){return i(Pw,{children:i(Dw,{sideOffset:t,className:se("z-50 min-w-[10rem] overflow-hidden rounded-lg border border-border-default bg-background-elevated p-1 text-text-primary shadow-lg",e),...n})})}function La({className:e,inset:t,variant:n="default",...r}){return i(Lw,{className:se("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n==="destructive"?"text-danger-600 data-[highlighted]:bg-danger-100 data-[highlighted]:text-danger-700":"text-text-primary data-[highlighted]:bg-background-hover",t&&"ps-8",e),...r})}function wc({className:e,inset:t,...n}){return i(Iw,{className:se("px-2 py-1.5 text-xs font-semibold text-text-secondary",t&&"ps-8",e),...n})}function qo({className:e,...t}){return i(_w,{className:se("-mx-1 my-1 h-px bg-border-default",e),...t})}function ke({icon:e,title:t,description:n,action:r,className:a,titleAs:o="p",titleProps:s,...l}){return x("div",{"data-slot":"empty-state",className:se("flex flex-col items-center justify-center gap-2 px-6 py-14 text-center",a),...l,children:[e&&i("div",{className:"text-text-tertiary [&>svg]:h-8 [&>svg]:w-8",children:e}),i(o,{...s,className:se("font-serif text-xl font-medium text-text-primary",s==null?void 0:s.className),children:t}),n&&i("p",{className:"max-w-sm text-sm text-text-secondary",children:n}),r&&i("div",{className:"mt-2",children:r})]})}function pe({className:e,...t}){return i("div",{"data-slot":"skeleton","aria-hidden":"true",className:se("animate-pulse rounded-md bg-background-hover",e),...t})}function Fw(e){const t=e+"CollectionProvider",[n,r]=Xa(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:y,children:w}=g,b=M(null),v=M(new Map).current;return i(a,{scope:y,itemMap:v,collectionRef:b,children:w})};s.displayName=t;const l=e+"CollectionSlot",c=ss(l),d=W((g,y)=>{const{scope:w,children:b}=g,v=o(l,w),C=ft(y,v.collectionRef);return i(c,{ref:C,children:b})});d.displayName=l;const f=e+"CollectionItemSlot",u="data-radix-collection-item",p=ss(f),m=W((g,y)=>{const{scope:w,children:b,...v}=g,C=M(null),N=ft(y,C),T=o(f,w);return O(()=>(T.itemMap.set(C,{ref:C,...v}),()=>void T.itemMap.delete(C))),i(p,{[u]:"",ref:N,children:b})});m.displayName=f;function h(g){const y=o(e+"CollectionConsumer",g);return K(()=>{const b=y.collectionRef.current;if(!b)return[];const v=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((T,R)=>v.indexOf(T.ref.current)-v.indexOf(R.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:d,ItemSlot:m},h,r]}var $w=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Bw="VisuallyHidden",Bi=W((e,t)=>i(qe.span,{...e,ref:t,style:{...$w,...e.style}}));Bi.displayName=Bw;var Ui="ToastProvider",[zi,Uw,zw]=Fw("Toast"),[Jf]=Xa("Toast",[zw]),[jw,ho]=Jf(Ui),Zf=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:o=50,announcerContainer:s,children:l}=e,[c,d]=E(null),[f,u]=E(0),p=M(!1),m=M(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Ui}\`. Expected non-empty \`string\`.`),i(zi.Provider,{scope:t,children:i(jw,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:o,toastCount:f,viewport:c,onViewportChange:d,onToastAdd:K(()=>u(h=>h+1),[]),onToastRemove:K(()=>u(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:m,announcerContainer:s,children:l})})};Zf.displayName=Ui;var Qf="ToastViewport",Vw=["F8"],Ds="toast.viewportPause",Is="toast.viewportResume",ep=W((e,t)=>{const{__scopeToast:n,hotkey:r=Vw,label:a="Notifications ({hotkey})",...o}=e,s=ho(Qf,n),l=Uw(n),c=M(null),d=M(null),f=M(null),u=M(null),p=ft(t,u,s.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),h=s.toastCount>0;O(()=>{const y=w=>{var v;r.length!==0&&r.every(C=>w[C]||w.code===C)&&((v=u.current)==null||v.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),O(()=>{const y=c.current,w=u.current;if(h&&y&&w){const b=()=>{if(!s.isClosePausedRef.current){const T=new CustomEvent(Ds);w.dispatchEvent(T),s.isClosePausedRef.current=!0}},v=()=>{if(s.isClosePausedRef.current){const T=new CustomEvent(Is);w.dispatchEvent(T),s.isClosePausedRef.current=!1}},C=T=>{!y.contains(T.relatedTarget)&&v()},N=()=>{y.contains(document.activeElement)||v()};return y.addEventListener("focusin",b),y.addEventListener("focusout",C),y.addEventListener("pointermove",b),y.addEventListener("pointerleave",N),window.addEventListener("blur",b),window.addEventListener("focus",v),()=>{y.removeEventListener("focusin",b),y.removeEventListener("focusout",C),y.removeEventListener("pointermove",b),y.removeEventListener("pointerleave",N),window.removeEventListener("blur",b),window.removeEventListener("focus",v)}}},[h,s.isClosePausedRef]);const g=K(({tabbingDirection:y})=>{const b=l().map(v=>{const C=v.ref.current,N=[C,...r1(C)];return y==="forwards"?N:N.reverse()});return(y==="forwards"?b.reverse():b).flat()},[l]);return O(()=>{const y=u.current;if(y){const w=b=>{var N,T,R;const v=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!v){const L=document.activeElement,I=b.shiftKey;if(b.target===y&&I){(N=d.current)==null||N.focus();return}const S=g({tabbingDirection:I?"backwards":"forwards"}),A=S.findIndex(D=>D===L);Go(S.slice(A+1))?b.preventDefault():I?(T=d.current)==null||T.focus():(R=f.current)==null||R.focus()}};return y.addEventListener("keydown",w),()=>y.removeEventListener("keydown",w)}},[l,g]),x(tv,{ref:c,role:"region","aria-label":a.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:h?void 0:"none"},children:[h&&i(Ls,{ref:d,onFocusFromOutsideViewport:()=>{const y=g({tabbingDirection:"forwards"});Go(y)}}),i(zi.Slot,{scope:n,children:i(qe.ol,{tabIndex:-1,...o,ref:p})}),h&&i(Ls,{ref:f,onFocusFromOutsideViewport:()=>{const y=g({tabbingDirection:"backwards"});Go(y)}})]})});ep.displayName=Qf;var tp="ToastFocusProxy",Ls=W((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,o=ho(tp,n);return i(Bi,{tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:s=>{var d;const l=s.relatedTarget;!((d=o.viewport)!=null&&d.contains(l))&&r()}})});Ls.displayName=tp;var jr="Toast",Hw="toast.swipeStart",Kw="toast.swipeMove",Ww="toast.swipeCancel",qw="toast.swipeEnd",np=W((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:o,...s}=e,[l,c]=Td({prop:r,defaultProp:a??!0,onChange:o,caller:jr});return i(Ja,{present:n||l,children:i(Xw,{open:l,...s,ref:t,onClose:()=>c(!1),onPause:cn(e.onPause),onResume:cn(e.onResume),onSwipeStart:Me(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Me(e.onSwipeMove,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`)}),onSwipeCancel:Me(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Me(e.onSwipeEnd,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),c(!1)})})})});np.displayName=jr;var[Gw,Yw]=Jf(jr,{onClose(){}}),Xw=W((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:a,open:o,onClose:s,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:f,onSwipeMove:u,onSwipeCancel:p,onSwipeEnd:m,...h}=e,g=ho(jr,n),[y,w]=E(null),b=ft(t,w),v=M(null),C=M(null),N=a||g.duration,T=M(0),R=M(N),L=M(0),{onToastAdd:I,onToastRemove:P}=g,k=cn(()=>{var B;(y==null?void 0:y.contains(document.activeElement))&&((B=g.viewport)==null||B.focus()),s()}),S=K(D=>{!D||D===1/0||(window.clearTimeout(L.current),T.current=new Date().getTime(),L.current=window.setTimeout(k,D))},[k]);O(()=>{const D=g.viewport;if(D){const B=()=>{S(R.current),d==null||d()},U=()=>{const z=new Date().getTime()-T.current;R.current=R.current-z,window.clearTimeout(L.current),c==null||c()};return D.addEventListener(Ds,U),D.addEventListener(Is,B),()=>{D.removeEventListener(Ds,U),D.removeEventListener(Is,B)}}},[g.viewport,N,c,d,S]),O(()=>{o&&!g.isClosePausedRef.current&&S(N)},[o,N,g.isClosePausedRef,S]),O(()=>()=>{window.clearTimeout(L.current)},[]),O(()=>(I(),()=>P()),[I,P]);const A=Q(()=>y?lp(y):null,[y]);return g.viewport?x(Ie,{children:[A&&i(Jw,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:A}),i(Gw,{scope:n,onClose:k,children:Ga(i(zi.ItemSlot,{scope:n,children:i(ev,{asChild:!0,onEscapeKeyDown:Me(l,()=>{g.isFocusedToastEscapeKeyDownRef.current||k(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:i(qe.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":g.swipeDirection,...h,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Me(e.onKeyDown,D=>{D.key==="Escape"&&(l==null||l(D.nativeEvent),D.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,k()))}),onPointerDown:Me(e.onPointerDown,D=>{D.button===0&&(v.current={x:D.clientX,y:D.clientY})}),onPointerMove:Me(e.onPointerMove,D=>{if(!v.current)return;const B=D.clientX-v.current.x,U=D.clientY-v.current.y,z=!!C.current,_=["left","right"].includes(g.swipeDirection),G=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,V=_?G(0,B):0,ee=_?0:G(0,U),Z=D.pointerType==="touch"?10:2,j={x:V,y:ee},le={originalEvent:D,delta:j};z?(C.current=j,la(Kw,u,le,{discrete:!1})):Cc(j,g.swipeDirection,Z)?(C.current=j,la(Hw,f,le,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(B)>Z||Math.abs(U)>Z)&&(v.current=null)}),onPointerUp:Me(e.onPointerUp,D=>{const B=C.current,U=D.target;if(U.hasPointerCapture(D.pointerId)&&U.releasePointerCapture(D.pointerId),C.current=null,v.current=null,B){const z=D.currentTarget,_={originalEvent:D,delta:B};Cc(B,g.swipeDirection,g.swipeThreshold)?la(qw,m,_,{discrete:!0}):la(Ww,p,_,{discrete:!0}),z.addEventListener("click",G=>G.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),Jw=e=>{const{__scopeToast:t,children:n,...r}=e,a=ho(jr,t),[o,s]=E(!1),[l,c]=E(!1);return t1(()=>s(!0)),O(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:i(di,{asChild:!0,container:a.announcerContainer||void 0,children:i(Bi,{...r,children:o&&x(Ie,{children:[a.label," ",n]})})})},Zw="ToastTitle",rp=W((e,t)=>{const{__scopeToast:n,...r}=e;return i(qe.div,{...r,ref:t})});rp.displayName=Zw;var Qw="ToastDescription",ap=W((e,t)=>{const{__scopeToast:n,...r}=e;return i(qe.div,{...r,ref:t})});ap.displayName=Qw;var op="ToastAction",e1=W((e,t)=>{const{altText:n,...r}=e;return n.trim()?i(ip,{altText:n,asChild:!0,children:i(ji,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${op}\`. Expected non-empty \`string\`.`),null)});e1.displayName=op;var sp="ToastClose",ji=W((e,t)=>{const{__scopeToast:n,...r}=e,a=Yw(sp,n);return i(ip,{asChild:!0,children:i(qe.button,{type:"button",...r,ref:t,onClick:Me(e.onClick,a.onClose)})})});ji.displayName=sp;var ip=W((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return i(qe.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function lp(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),n1(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",o=r.dataset.radixToastAnnounceExclude==="";if(!a)if(o){const s=r.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...lp(r))}}),t}function la(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Ed(a,o):a.dispatchEvent(o)}var Cc=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),o=r>a;return t==="left"||t==="right"?o&&r>n:!o&&a>n};function t1(e=()=>{}){const t=cn(e);Ya(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function n1(e){return e.nodeType===e.ELEMENT_NODE}function r1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Go(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var a1=Zf,o1=ep,s1=np,i1=rp,l1=ap,c1=ji;const d1=a1;function u1({className:e,...t}){return i(o1,{className:se("fixed bottom-0 end-0 z-50 flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm",e),...t})}const f1=kh("group pointer-events-auto relative flex w-full items-center justify-between gap-4 overflow-hidden rounded-lg border bg-text-primary p-4 pe-8 text-background-elevated shadow-lg transition-opacity data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[swipe=cancel]:translate-x-0 data-[swipe=end]:opacity-0 data-[state=closed]:opacity-0",{variants:{variant:{default:"border-text-primary",success:"border-primary-300",danger:"border-danger-300"}},defaultVariants:{variant:"default"}});function p1({className:e,variant:t,...n}){return i(s1,{className:se(f1({variant:t,className:e})),...n})}function h1({className:e,...t}){return i(i1,{className:se("text-sm font-semibold",e),...t})}function m1({className:e,...t}){return i(l1,{className:se("text-sm text-background-elevated opacity-80",e),...t})}function g1({className:e,...t}){return i(c1,{className:se("absolute end-2 top-2 rounded-md p-1 text-background-elevated opacity-70 transition-colors duration-fast hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600",e),...t,children:x("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4",children:[i("path",{d:"M18 6 6 18"}),i("path",{d:"m6 6 12 12"})]})})}const y1=3,v1=300;let Yo=0;function b1(){return Yo=(Yo+1)%Number.MAX_SAFE_INTEGER,Yo.toString()}const As=new Set;let wn={toasts:[]};const Xo=new Map;function Vi(e){wn=e,As.forEach(t=>t(wn))}function x1(e){Xo.has(e)||Xo.set(e,setTimeout(()=>{Xo.delete(e),Vi({toasts:wn.toasts.filter(t=>t.id!==e)})},v1))}function Ms(e){const t=e===void 0?wn.toasts.map(n=>n.id):[e];Vi({toasts:wn.toasts.map(n=>t.includes(n.id)?{...n,open:!1}:n)}),t.forEach(x1)}function J(e){const t=b1(),n={...e,id:t,open:!0,onOpenChange:r=>{r||Ms(t)}};return Vi({toasts:[n,...wn.toasts].slice(0,y1)}),{id:t,dismiss:()=>Ms(t)}}function w1(){const[e,t]=E(wn);return O(()=>(As.add(t),()=>{As.delete(t)}),[]),{...e,toast:J,dismiss:Ms}}function C1({closeLabel:e,label:t}){const{toasts:n}=w1(),r=typeof document<"u"&&document.documentElement.dir==="rtl"?"left":"right";return x(d1,{label:t,swipeDirection:r,children:[n.map(({id:a,title:o,description:s,...l})=>x(p1,{...l,children:[x("div",{className:"grid gap-1",children:[o&&i(h1,{children:o}),s&&i(m1,{children:s})]}),i(g1,{"aria-label":e})]},a)),i(u1,{})]})}function jn(e,t){return`${e}-tab-${t}`}function Vr(e,t){return`${e}-panel-${t}`}function mo({tabs:e,activeId:t,onChange:n,label:r,errorLabel:a,idPrefix:o,className:s}){function l(c){var m;const d=e.findIndex(h=>h.id===t);if(d===-1)return;const f=c.currentTarget.ownerDocument.documentElement.dir==="rtl";let u;switch(c.key){case"ArrowRight":u=f?d-1:d+1;break;case"ArrowLeft":u=f?d+1:d-1;break;case"Home":u=0;break;case"End":u=e.length-1;break;default:return}c.preventDefault();const p=e[(u+e.length)%e.length];p&&(n(p.id),(m=c.currentTarget.querySelector(`#${CSS.escape(jn(o,p.id))}`))==null||m.focus())}return i("div",{role:"tablist","aria-label":r,onKeyDown:l,className:se("flex items-end gap-1 overflow-x-auto border-b border-border-default",s),children:e.map(c=>{const d=c.id===t;return x("button",{type:"button",role:"tab",id:jn(o,c.id),"aria-selected":d,"aria-controls":Vr(o,c.id),"aria-label":c.hasError&&a?`${c.label} — ${a}`:void 0,tabIndex:d?0:-1,onClick:()=>n(c.id),className:se("-mb-px inline-flex items-center gap-1 whitespace-nowrap rounded-t-md border-b-2 px-3 py-2 text-sm transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600 focus-visible:ring-offset-2 focus-visible:ring-offset-background-base",d?"border-primary-300 font-medium text-text-primary":"border-transparent text-text-secondary hover:text-text-primary"),children:[c.label,c.hasError&&i("span",{"aria-hidden":"true",className:"size-1 shrink-0 rounded-full bg-danger-500"})]},c.id)})})}let cp=null;function N1(){return cp}function Aa(e){cp=e}let va=null;function Nc(e){va=e}let Os=!1;function S1(){Os||(Os=!0,va==null||va())}function E1(){Os=!1}class Hi extends Error{constructor(t,n){super(t),this.status=n}}async function Ki(e){const t=await e.json().catch(()=>null);if(!e.ok){const n=t&&typeof t=="object"&&typeof t.message=="string"?t.message:e.statusText;throw new Hi(n,e.status)}return t}async function T1(e){const t=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await Ki(t);return Aa(n.accessToken),E1(),n}async function Sc(){Aa(null),await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{})}let yr=null;async function dp(){if(yr)return yr;yr=(async()=>{const e=await fetch("/api/auth/refresh",{method:"POST"});if(!e.ok)return Aa(null),null;const t=await e.json();return Aa(t.accessToken),t})();try{return await yr}finally{yr=null}}async function k1(){return dp()}const R1=new Set(["/api/auth/login","/api/auth/refresh","/api/auth/logout"]);function P1(e){const t=e.split("?")[0];return R1.has(t)}async function X(e,t={}){const n=()=>({...t,headers:{...t.headers,Authorization:`Bearer ${N1()??""}`}});let r=await fetch(e,n());return r.status===401&&(await dp()?r=await fetch(e,n()):P1(e)||S1()),r}const D1=1800*1e3,I1=5e3,go="velora.session.idleDeadline",Ec=["click","keydown","mousemove","scroll","touchstart"];function up(){const e=localStorage.getItem(go);if(!e)return null;const t=Number(e);return Number.isFinite(t)?t:null}function vr(){localStorage.removeItem(go)}function Tc(){const e=Date.now()+D1;return localStorage.setItem(go,String(e)),e}function L1(e,t){const[n,r]=E(null),[a,o]=E(()=>Date.now()),s=M(t);return s.current=t,O(()=>{if(!e){r(null);return}r(up()??Tc());let l=0;function c(){const f=Date.now();f-l<I1||(l=f,r(Tc()))}function d(f){if(f.key!==go)return;if(f.newValue===null){s.current();return}const u=Number(f.newValue);Number.isFinite(u)&&r(u)}for(const f of Ec)window.addEventListener(f,c,{passive:!0});return window.addEventListener("storage",d),()=>{for(const f of Ec)window.removeEventListener(f,c);window.removeEventListener("storage",d)}},[e]),O(()=>{if(!e||n===null)return;const l=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(l)},[e,n]),O(()=>{e&&n!==null&&a>=n&&(vr(),s.current())},[e,n,a]),!e||n===null?null:Math.max(0,n-a)}const fp=Te(null);function A1({children:e}){const{t}=oe(),[n,r]=E("restoring"),[a,o]=E(null),[s,l]=E(null),c=K(async()=>{vr(),await Sc(),o(null),r("anonymous")},[]),d=K(m=>{o(null),r("anonymous"),Sc(),J({variant:"danger",title:m})},[]),f=L1(n==="authenticated",()=>{d(t("app.idleLoggedOut"))});O(()=>(Nc(()=>d(t("app.sessionExpired"))),()=>Nc(null)),[d,t]),O(()=>{const m=up();if(m!==null&&m<=Date.now()){vr(),r("anonymous");return}k1().then(h=>{h?(o(h.user),r("authenticated")):(vr(),r("anonymous"))}).catch(()=>{vr(),r("anonymous")})},[]);const u=K(async m=>{r("authenticating"),l(null);try{const h=await T1(m);o(h.user),r("authenticated")}catch(h){r("anonymous"),l(h instanceof Hi?h.message:t("login.genericError"))}},[t]),p=Q(()=>({status:n,user:a,error:s,idleMsRemaining:f,login:u,logout:c}),[n,a,s,f,u,c]);return i(fp.Provider,{value:p,children:e})}function Tn(){const e=ne(fp);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}function Re(e){const{t}=oe(),n=e.filter(a=>!!a),r=n.length>0?[...n,t("app.title")].join(" · "):void 0;O(()=>{const a=document.title;return()=>{document.title=a}},[]),O(()=>{r!==void 0&&(document.title=r)},[r])}function pp({className:e}){return x("span",{"aria-hidden":"true",className:se("relative grid size-7 shrink-0 place-items-center rounded-md bg-primary-600 font-serif text-lg font-semibold italic leading-none text-text-inverse",e),children:["V",i("span",{className:"absolute -bottom-px -end-px size-2 rounded-full bg-primary-300 ring-2 ring-background-elevated"})]})}function M1(){const{t:e}=oe(),{login:t,status:n,error:r}=Tn();Re([e("login.title")]);const[a,o]=E(""),[s,l]=E(""),c=n==="authenticating";function d(f){f.preventDefault(),t({email:a,password:s})}return x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-background-base p-8 font-sans text-text-primary",children:[x("div",{className:"w-full max-w-sm rounded-xl border border-border-default bg-background-elevated p-8 shadow-lg",children:[x("div",{className:"mb-5 flex items-center gap-2 text-base font-semibold tracking-tight",children:[i(pp,{}),e("app.title")]}),i("h1",{className:"mb-1 text-xl font-semibold tracking-tight",children:e("login.title")}),i("p",{className:"mb-6 text-sm text-text-secondary",children:e("login.subtitle")}),x("form",{className:"flex flex-col gap-4",onSubmit:d,children:[x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"email",className:"text-sm font-medium",children:e("login.emailLabel")}),i(ye,{id:"email",name:"email",type:"email",autoComplete:"username",required:!0,value:a,onChange:f=>o(f.target.value),disabled:c})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"password",className:"text-sm font-medium",children:e("login.passwordLabel")}),i(ye,{id:"password",name:"password",type:"password",autoComplete:"current-password",required:!0,value:s,onChange:f=>l(f.target.value),disabled:c})]}),r&&i("p",{role:"alert",className:"text-sm text-danger-600",children:r}),i(H,{type:"submit",disabled:c,children:e(c?"login.submitting":"login.submit")})]})]}),i("p",{className:"max-w-sm text-center font-serif text-base italic text-text-secondary",children:e("login.tagline")})]})}/**
187
187
  * @license lucide-react v1.38.0 - ISC
188
188
  *
189
189
  * This source code is licensed under the ISC license.
190
190
  * See the LICENSE file in the root directory of this source tree.
191
- */const pp=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
191
+ */const hp=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
192
192
  * @license lucide-react v1.38.0 - ISC
193
193
  *
194
194
  * This source code is licensed under the ISC license.
@@ -213,12 +213,12 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
213
213
  *
214
214
  * This source code is licensed under the ISC license.
215
215
  * See the LICENSE file in the root directory of this source tree.
216
- */const F1=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},$1=Te({}),B1=()=>ne($1),U1=W(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:a="",children:o,iconNode:s,...l},c)=>{const{size:d=24,strokeWidth:f=2,absoluteStrokeWidth:u=!1,color:p="currentColor",className:m=""}=B1()??{},h=r??u?Number(n??f)*24/Number(t??d):n??f;return ie("svg",{ref:c,...Jo,width:t??d??Jo.width,height:t??d??Jo.height,stroke:e??p,strokeWidth:h,className:pp("lucide",m,a),...!o&&!F1(l)&&{"aria-hidden":"true"},...l},[...s.map(([g,y])=>ie(g,y)),...Array.isArray(o)?o:[o]])});/**
216
+ */const F1=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},$1=Te({}),B1=()=>ne($1),U1=W(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:a="",children:o,iconNode:s,...l},c)=>{const{size:d=24,strokeWidth:f=2,absoluteStrokeWidth:u=!1,color:p="currentColor",className:m=""}=B1()??{},h=r??u?Number(n??f)*24/Number(t??d):n??f;return ie("svg",{ref:c,...Jo,width:t??d??Jo.width,height:t??d??Jo.height,stroke:e??p,strokeWidth:h,className:hp("lucide",m,a),...!o&&!F1(l)&&{"aria-hidden":"true"},...l},[...s.map(([g,y])=>ie(g,y)),...Array.isArray(o)?o:[o]])});/**
217
217
  * @license lucide-react v1.38.0 - ISC
218
218
  *
219
219
  * This source code is licensed under the ISC license.
220
220
  * See the LICENSE file in the root directory of this source tree.
221
- */const Y=(e,t)=>{const n=W(({className:r,...a},o)=>ie(U1,{ref:o,iconNode:t,className:pp(`lucide-${O1(kc(e))}`,`lucide-${e}`,r),...a}));return n.displayName=kc(e),n};/**
221
+ */const Y=(e,t)=>{const n=W(({className:r,...a},o)=>ie(U1,{ref:o,iconNode:t,className:hp(`lucide-${O1(kc(e))}`,`lucide-${e}`,r),...a}));return n.displayName=kc(e),n};/**
222
222
  * @license lucide-react v1.38.0 - ISC
223
223
  *
224
224
  * This source code is licensed under the ISC license.
@@ -228,7 +228,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
228
228
  *
229
229
  * This source code is licensed under the ISC license.
230
230
  * See the LICENSE file in the root directory of this source tree.
231
- */const j1=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],hp=Y("arrow-up-right",j1);/**
231
+ */const j1=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],mp=Y("arrow-up-right",j1);/**
232
232
  * @license lucide-react v1.38.0 - ISC
233
233
  *
234
234
  * This source code is licensed under the ISC license.
@@ -298,7 +298,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
298
298
  *
299
299
  * This source code is licensed under the ISC license.
300
300
  * See the LICENSE file in the root directory of this source tree.
301
- */const hC=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],mp=Y("ellipsis",hC);/**
301
+ */const hC=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],gp=Y("ellipsis",hC);/**
302
302
  * @license lucide-react v1.38.0 - ISC
303
303
  *
304
304
  * This source code is licensed under the ISC license.
@@ -318,7 +318,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
318
318
  *
319
319
  * This source code is licensed under the ISC license.
320
320
  * See the LICENSE file in the root directory of this source tree.
321
- */const xC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],gp=Y("file",xC);/**
321
+ */const xC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],yp=Y("file",xC);/**
322
322
  * @license lucide-react v1.38.0 - ISC
323
323
  *
324
324
  * This source code is licensed under the ISC license.
@@ -328,17 +328,17 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
328
328
  *
329
329
  * This source code is licensed under the ISC license.
330
330
  * See the LICENSE file in the root directory of this source tree.
331
- */const CC=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],yp=Y("folder",CC);/**
331
+ */const CC=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],vp=Y("folder",CC);/**
332
332
  * @license lucide-react v1.38.0 - ISC
333
333
  *
334
334
  * This source code is licensed under the ISC license.
335
335
  * See the LICENSE file in the root directory of this source tree.
336
- */const NC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],vp=Y("globe",NC);/**
336
+ */const NC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],bp=Y("globe",NC);/**
337
337
  * @license lucide-react v1.38.0 - ISC
338
338
  *
339
339
  * This source code is licensed under the ISC license.
340
340
  * See the LICENSE file in the root directory of this source tree.
341
- */const EC=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],SC=Y("graduation-cap",EC);/**
341
+ */const SC=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],EC=Y("graduation-cap",SC);/**
342
342
  * @license lucide-react v1.38.0 - ISC
343
343
  *
344
344
  * This source code is licensed under the ISC license.
@@ -423,7 +423,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
423
423
  *
424
424
  * This source code is licensed under the ISC license.
425
425
  * See the LICENSE file in the root directory of this source tree.
426
- */const tN=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],bp=Y("palette",tN);/**
426
+ */const tN=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],xp=Y("palette",tN);/**
427
427
  * @license lucide-react v1.38.0 - ISC
428
428
  *
429
429
  * This source code is licensed under the ISC license.
@@ -453,7 +453,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
453
453
  *
454
454
  * This source code is licensed under the ISC license.
455
455
  * See the LICENSE file in the root directory of this source tree.
456
- */const uN=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],xp=Y("rotate-ccw-clock",uN);/**
456
+ */const uN=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],wp=Y("rotate-ccw-clock",uN);/**
457
457
  * @license lucide-react v1.38.0 - ISC
458
458
  *
459
459
  * This source code is licensed under the ISC license.
@@ -463,7 +463,7 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
463
463
  *
464
464
  * This source code is licensed under the ISC license.
465
465
  * See the LICENSE file in the root directory of this source tree.
466
- */const hN=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],wp=Y("settings",hN);/**
466
+ */const hN=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Cp=Y("settings",hN);/**
467
467
  * @license lucide-react v1.38.0 - ISC
468
468
  *
469
469
  * This source code is licensed under the ISC license.
@@ -488,12 +488,12 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
488
488
  *
489
489
  * This source code is licensed under the ISC license.
490
490
  * See the LICENSE file in the root directory of this source tree.
491
- */const NN=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],EN=Y("star",NN);/**
491
+ */const NN=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],SN=Y("star",NN);/**
492
492
  * @license lucide-react v1.38.0 - ISC
493
493
  *
494
494
  * This source code is licensed under the ISC license.
495
495
  * See the LICENSE file in the root directory of this source tree.
496
- */const SN=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],TN=Y("store",SN);/**
496
+ */const EN=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],TN=Y("store",EN);/**
497
497
  * @license lucide-react v1.38.0 - ISC
498
498
  *
499
499
  * This source code is licensed under the ISC license.
@@ -533,10 +533,10 @@ var ml=e=>{throw TypeError(e)};var gl=(e,t,n)=>t.has(e)||ml("Cannot "+n);var We=
533
533
  *
534
534
  * This source code is licensed under the ISC license.
535
535
  * See the LICENSE file in the root directory of this source tree.
536
- */const BN=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],UN=Y("video",BN),Cp="flex w-full items-center gap-2 rounded-md border-s-2 px-2 text-start text-sm transition-colors duration-fast",Np="border-primary-300 bg-primary-50 font-medium text-primary-800",Xi="border-transparent text-text-primary hover:bg-background-hover";function Vn({children:e,label:t}){return i("aside",{"aria-label":t,className:"w-72 shrink-0 overflow-y-auto border-e border-border-default bg-background-subtle px-2 py-3",children:e})}function Bt({title:e,action:t,children:n}){return x("div",{className:"mt-5 first:mt-1",children:[x("div",{className:"flex h-7 items-center justify-between px-2 pb-1",children:[i("span",{className:"text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:e}),t]}),n]})}function dt({label:e,icon:t,selected:n,onClick:r}){return x("button",{type:"button","aria-current":n?"page":void 0,onClick:r,className:se(Cp,"h-8",n?Np:Xi),children:[t&&i("span",{className:se("shrink-0 [&>svg]:size-4",n?"text-primary-600":"text-text-disabled"),children:t}),i("span",{className:"min-w-0 flex-1 truncate",children:e})]})}function me({children:e,flush:t=!1}){return i("main",{id:"main",tabIndex:-1,className:se("min-w-0 flex-1 bg-background-elevated focus:outline-none",t?"overflow-hidden":"overflow-y-auto p-8"),children:e})}function zN({cursor:e,limit:t}){const n=new URLSearchParams;e&&n.set("cursor",e),t&&n.set("limit",String(t));const r=n.toString();return r?`?${r}`:""}class ve extends Error{constructor(t,n,r){super(t),this.status=n,this.blockedBy=r}}async function oe(e){const t=await e.json().catch(()=>null);if(!e.ok){const n=t&&typeof t=="object"&&typeof t.message=="string"?t.message:e.statusText;throw new ve(n,e.status)}return t}async function Ep(e={}){const t=await X(`/api/document-types${zN(e)}`);return oe(t)}async function jN(e){const t=await X("/api/document-types",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return oe(t)}async function VN(e,t){const n=await X(`/api/document-types/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return oe(n)}async function HN(e){const t=await X(`/api/document-types/${e}`,{method:"DELETE"});return oe(t)}let $n=!1;function KN(){const e=Xe(),t=M(e.pathname);O(()=>{if(t.current===e.pathname)return;t.current=e.pathname,$n=!0;const n=setTimeout(()=>{var o;const r=document.activeElement;if(r instanceof HTMLElement&&r.closest("aside")){$n=!1;return}const a=document.querySelector("[data-workspace-title]");if(a){a.focus(),$n=!1;return}(o=document.getElementById("main"))==null||o.focus()},0);return()=>clearTimeout(n)},[e.pathname])}function ir(){return H(e=>{if(!(!e||!$n)){if(document.activeElement instanceof HTMLElement&&document.activeElement.closest("aside")){$n=!1;return}e.focus({preventScroll:!1}),$n=!1}},[])}const Lr={file:gp,"file-text":Hr,folder:yp,image:Ma,calendar:eC,newspaper:ZC,"layout-grid":Oa,tag:RN,user:ON,users:Yi,"shopping-cart":xN,star:EN,globe:vp,mail:HC,"map-pin":WC,music:XC,video:UN,book:G1,list:UC,quote:dN,link:$C,home:DC,settings:wp,database:pC,code:uC,palette:bp,megaphone:GC,briefcase:X1,"graduation-cap":SC,heart:RC,utensils:$N,plane:iN,building:Z1,phone:oN,clock:iC,pencil:rN,shield:vN,package:eN},WN=Object.keys(Lr),_s=Hr;function Ji(e){return e&&Lr[e]||_s}function Zi(e){return e&&Lr[e]?e:"file-text"}function Qi({cursor:e,limit:t}){const n=new URLSearchParams;e&&n.set("cursor",e),t&&n.set("limit",String(t));const r=n.toString();return r?`?${r}`:""}async function Pc(e={}){const t=await X(`/api/content/roots${Qi(e)}`);if(!t.ok)throw new Error(`Failed to fetch root content nodes (${t.status})`);return t.json()}async function Dc(e,t={}){const n=await X(`/api/content/${e}/children${Qi(t)}`);if(!n.ok)throw new Error(`Failed to fetch children of ${e} (${n.status})`);return n.json()}async function qN(e){const t=await X(`/api/content/by-path?path=${encodeURIComponent(e)}`);if(t.status===404)return null;if(!t.ok)throw new Error(`Failed to resolve content path (${t.status})`);return(await t.json()).node}async function GN(e){const t=await X("/api/content/roots/reorder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderedIds:e})});if(!t.ok)throw new Error(`Failed to reorder root content nodes (${t.status})`)}async function YN(e,t){const n=await X(`/api/content/${e}/children/reorder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderedIds:t})});if(!n.ok)throw new Error(`Failed to reorder children of ${e} (${n.status})`)}async function XN(e){const t=await X(`/api/content/${e}`);return oe(t)}async function JN(e){const t=await X(`/api/content/${e}/versions/latest`);return oe(t)}async function ZN(e){const t=await X("/api/content",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return oe(t)}async function QN(e,t){const n=await X(`/api/content/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:t})});return oe(n)}async function eE(e,t){const n=await X(`/api/content/${e}/publish`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t?{version:t}:{})});return oe(n)}async function tE(e,t={}){const n=new URLSearchParams;t.cursor&&n.set("cursor",String(t.cursor)),t.limit&&n.set("limit",String(t.limit));const r=n.toString(),a=await X(`/api/content/${e}/versions${r?`?${r}`:""}`);return oe(a)}async function nE(e,t){const n=await X(`/api/content/${e}/versions/${t}`);return oe(n)}async function rE(e){const t=await X(`/api/content/${e}/preview-token`,{method:"POST"});return oe(t)}async function Ic(e,t={}){const n=await X(`/api/content/${e}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(n.ok){const r=await n.json().catch(()=>null);return{ok:!0,trashedCount:(r==null?void 0:r.trashedCount)??0}}if(n.status===409){const r=await n.json().catch(()=>null);if(r!=null&&r.requiresConfirmation)return{ok:!1,requiresConfirmation:!0,nodeName:r.nodeName??"",descendantCount:r.descendantCount??0,message:r.message??""};throw new ve((r==null?void 0:r.message)??n.statusText,n.status)}throw await oe(n),new ve(n.statusText,n.status)}async function Fs(e,t){const n=await X(`/api/content/trash${Qi({cursor:e,limit:t})}`);return oe(n)}class aE extends Error{constructor(t,n){super(n),this.blockingAncestorPath=t}status=409}async function oE(e){const t=await X(`/api/content/${e}/restore`,{method:"POST"});if(t.status===409){const n=await t.json().catch(()=>null);throw new aE((n==null?void 0:n.blockingAncestorPath)??"",(n==null?void 0:n.message)??t.statusText)}return oe(t)}function $t(e){return e.path.split("/").filter(Boolean).pop()??e.path}function sE(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function iE(e,t){const n=e.filter(a=>a.kind==="page");if(t===null)return n.filter(a=>a.treeRules.allowedAtRoot);const r=n.find(a=>a.id===t.documentTypeId);return n.filter(a=>{const o=!r||r.treeRules.allowedChildTypes.length===0||r.treeRules.allowedChildTypes.includes(a.id),s=a.treeRules.allowedParentTypes.length===0||r!==void 0&&a.treeRules.allowedParentTypes.includes(r.id);return o&&s})}function lE({types:e,value:t,onChange:n}){const{t:r}=ae(),a=kh();return x("select",{...a,value:t,onChange:o=>n(o.target.value),className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary",children:[i("option",{value:"",children:r("contentCreate.typePlaceholder")}),e.map(o=>i("option",{value:o.id,children:o.name},o.id))]})}function cE({documentTypes:e,parent:t,onCreated:n,onCancel:r}){const{t:a}=ae(),o=ir();Re([a("contentCreate.title"),a("nav.content")]);const s=iE(e,t),[l,c]=E(""),[d,f]=E(""),[u,p]=E(!1),[m,h]=E(null),g=sE(d),y=t?`${t.path}/${g}`:`/${g}`;async function w(b){if(b.preventDefault(),!(!l||!g)){p(!0),h(null);try{const{node:v}=await ZN({documentTypeId:l,parentId:(t==null?void 0:t.id)??null,path:y,depth:t?t.depth+1:0,sortOrder:0,locale:"en",isDefaultLocale:!0,data:{}});J({variant:"success",title:a("contentCreate.createdToast",{name:g})}),n(v)}catch(v){h(v instanceof Error&&v.message?v.message:a("contentCreate.genericError"))}finally{p(!1)}}}return x("form",{onSubmit:w,className:"flex max-w-xl flex-col gap-4",children:[x("div",{children:[i("p",{className:"text-xs text-text-secondary",children:t?a("contentCreate.underCrumb",{name:$t(t)}):a("contentCreate.atRootCrumb")}),x("div",{className:"mt-1 flex items-center justify-between",children:[i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:o,className:"text-xl font-bold text-text-primary focus:outline-none",children:a("contentCreate.title")}),i(K,{type:"button",variant:"ghost",size:"sm",onClick:r,children:a("contentCreate.cancel")})]})]}),s.length===0?i("p",{className:"text-sm text-text-secondary",children:t?a("contentCreate.noTypesUnder",{name:$t(t)}):a("contentCreate.noTypes")}):x(Ie,{children:[x(Ne,{label:a("contentCreate.typeLabel"),htmlFor:"content-create-type",helpText:a(t?"contentCreate.typeHelpChild":"contentCreate.typeHelp"),children:[i(lE,{types:s,value:l,onChange:c}),(()=>{const b=s.find(C=>C.id===l),v=Ji(b==null?void 0:b.icon);return x("span",{"data-icon":Zi(b==null?void 0:b.icon),className:"mt-2 flex items-center gap-2 text-xs text-text-secondary",children:[i(v,{"aria-hidden":!0,className:"size-4"}),b?b.name:a("contentCreate.typePlaceholder")]})})()]}),i(Ne,{label:a("contentCreate.nameLabel"),htmlFor:"content-create-name",helpText:g?a("contentCreate.nameHelp",{path:y}):void 0,children:i(ye,{id:"content-create-name",required:!0,value:d,onChange:b=>f(b.target.value)})}),m&&i("p",{role:"alert",className:"text-sm text-danger-600",children:m}),i(K,{type:"submit",disabled:u||!l||!g,className:"self-start",children:a(u?"contentCreate.creating":"contentCreate.submit")})]})]})}class dE extends bd{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){console.error("Plugin view crashed:",t)}render(){return this.state.error?this.props.fallback(this.state.error):this.props.children}}function Kr({pluginName:e,children:t}){const{t:n}=ae();return i(dE,{fallback:r=>x("div",{role:"alert",className:"rounded-md border border-danger-500 bg-background-elevated p-3",children:[i("p",{className:"text-sm font-medium text-danger-600",children:n("pluginBoundary.viewCrashed",{name:e})}),i("p",{className:"mt-1 text-xs text-text-secondary",children:r.message})]}),children:t})}function uE(e){if(!e)return null;const{minLength:t,maxLength:n,min:r,max:a}=e;return t!==void 0&&n!==void 0?{key:"documentTypeForm.help.lengthRange",params:{min:t,max:n}}:t!==void 0?{key:"documentTypeForm.help.minLength",params:{min:t}}:n!==void 0?{key:"documentTypeForm.help.maxLength",params:{max:n}}:r!==void 0&&a!==void 0?{key:"documentTypeForm.help.range",params:{min:r,max:a}}:r!==void 0?{key:"documentTypeForm.help.min",params:{min:r}}:a!==void 0?{key:"documentTypeForm.help.max",params:{max:a}}:null}let Mn=null,ca=null;const $s=new Set;async function fE(){const e=await Sp(!0);return $s.forEach(t=>t(e)),e}async function Sp(e=!1){return Mn&&!e?Mn:(e&&(ca=null),ca??=X("/api/data-types?limit=100").then(async t=>{if(!t.ok)throw new Error(`Failed to load data types (${t.status})`);return Mn=(await t.json()).items,Mn}).finally(()=>{ca=null}),ca)}function el(e){const t=(Mn??[]).find(r=>r.id===e)??null;if(t){const r=xa(t.editorId);return r?{config:t,editor:r,settings:Object.keys(t.settings).length>0?t.settings:r.defaultSettings}:null}const n=xa(e);return n?{config:null,editor:n,settings:n.defaultSettings}:null}function yo(){const[e,t]=E(Mn);return O(()=>{let n=!1;const r=a=>{n||t(a)};return $s.add(r),Sp().then(r).catch(()=>{n||t([])}),()=>{n=!0,$s.delete(r)}},[]),e}function Bs(e,t){if(!t)return null;if(t.required&&(e==null||e===""))return{key:"documentTypeForm.errors.required"};if(typeof e=="string"){if(t.minLength!==void 0&&e.length<t.minLength)return{key:"documentTypeForm.errors.minLength",params:{minLength:t.minLength}};if(t.maxLength!==void 0&&e.length>t.maxLength)return{key:"documentTypeForm.errors.maxLength",params:{maxLength:t.maxLength}};if(t.pattern!==void 0&&e!==""){let n=null;try{n=new RegExp(t.pattern)}catch{n=null}if(n&&!n.test(e))return{key:"documentTypeForm.errors.pattern"}}}if(typeof e=="number"){if(t.min!==void 0&&e<t.min)return{key:"documentTypeForm.errors.min",params:{min:t.min}};if(t.max!==void 0&&e>t.max)return{key:"documentTypeForm.errors.max",params:{max:t.max}}}return null}const wr="general";function pE(e){return e.tabs.length===0?!1:e.fields.some(t=>t.tabId==null||!e.tabs.some(n=>n.id===t.tabId))}function hE({documentType:e,value:t,onChange:n,showAllErrors:r,activeTabId:a,hideTabStrip:o}){const{t:s}=ae(),l=Tr(),c=yo(),[d,f]=E(new Set),[u,p]=E(null);function m(T){f(k=>new Set(k).add(T))}const h=e.tabs,g=T=>T.tabId!=null&&h.some(k=>k.id===T.tabId),y=e.fields.filter(T=>!g(T)),w=h.length===0?[]:[...y.length>0?[{id:wr,label:s("documentTypeForm.generalTab")}]:[],...h.map(T=>({id:T.id,label:T.name}))],b=w.length===0?null:w.some(T=>T.id===u)?u:w[0].id,v=a!==void 0?h.length===0?null:a:b,C=v===null?e.fields:v===wr?y:e.fields.filter(T=>T.tabId===v);function N(T,k){var S;const L=el(T.datatypeId),R=t[T.id],P=r||d.has(T.id)?Bs(R,T.validation):null,I=uE(T.validation);return i(Ne,{label:T.name,required:(S=T.validation)==null?void 0:S.required,requiredText:s("common.required"),error:P?s(P.key,P.params):void 0,helpText:I?s(I.key,I.params):void 0,onBlur:()=>m(T.id),className:k>0?"border-t border-border-subtle pt-6":void 0,children:L?i(Gs,{value:R,onChange:A=>n({...t,[T.id]:A}),children:i(qa,{settings:L.settings,children:i(Kr,{pluginName:L.editor.name,children:i(L.editor.views.input,{})})})}):i("p",{className:"text-sm text-danger-600",children:s("documentTypeForm.unknownDatatype",{datatypeId:T.datatypeId})})},T.id)}return c===null?null:i(Fr,{fetch:X,children:v===null||o?i("div",{className:"flex flex-col",children:C.map(N)}):x("div",{className:"flex flex-col gap-4",children:[i(mo,{tabs:w,activeId:v,onChange:p,label:s("documentTypeForm.tabListLabel"),idPrefix:l}),i("div",{role:"tabpanel",id:Vr(l,v),"aria-labelledby":jn(l,v),className:"flex flex-col",children:C.map(N)})]})})}function mE({documentType:e,data:t}){const{t:n}=ae();return yo()===null?null:i(Fr,{fetch:X,children:i("div",{inert:!0,className:"flex flex-col",children:e.fields.map((a,o)=>{const s=el(a.datatypeId),l=s?s.editor.views.preview??s.editor.views.readOnly:null;return i(Ne,{label:a.name,className:o>0?"border-t border-border-subtle pt-6":void 0,children:s&&l?i(Gs,{value:t[a.id],onChange:()=>{},children:i(qa,{settings:s.settings,children:i(Kr,{pluginName:s.editor.name,children:i(l,{})})})}):i("p",{className:"text-sm text-danger-600",children:n("documentTypeForm.unknownDatatype",{datatypeId:a.datatypeId})})},a.id)})})})}const gE=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function yE(e,t=new Date,n){const r=(new Date(e).getTime()-t.getTime())/1e3,a=Math.abs(r),o=new Intl.RelativeTimeFormat(n,{numeric:"auto"});for(const[s,l]of gE)if(a>=l)return o.format(Math.round(r/l),s);return o.format(Math.round(r),"second")}const vE=12;function bE({latest:e,currentVersion:t,isPublished:n,history:r,onOpenHistory:a}){const{t:o,i18n:s}=ae(),l=e.version,c=Math.max(1,l-vE+1),d=c-1,f=new Map(r.map(g=>[g.version,g])),u=[];for(let g=c;g<=l;g+=1)u.push(g);const p=n&&t===l,m=f.get(1),h=m?new Date(m.createdAt).toLocaleDateString(s.language,{day:"numeric",month:"short",year:"numeric"}):null;return x("div",{className:"shrink-0 px-8 pt-3",role:"group","aria-label":o("contentEditor.railLabel"),children:[x("div",{className:"flex items-center gap-4",children:[x("ol",{className:"relative flex min-w-0 flex-1 items-center gap-5 py-1 before:absolute before:end-0 before:start-0 before:top-1/2 before:h-px before:bg-primary-100",children:[d>0&&i("li",{className:"relative rounded-full bg-background-hover px-2 font-mono text-xs text-text-secondary",children:o("contentEditor.railHidden",{count:d})}),u.map(g=>{const y=g===t&&n,w=g===l,b=o(y?"contentEditor.railTickPublished":"contentEditor.railTickDraft",{version:g});return i("li",{className:"relative",title:b,children:i("span",{role:"img","aria-label":b,className:se("block rounded-full border-2",w?"animate-tick-in size-4 ring-4 ring-primary-50":"size-3",y?"border-primary-600 bg-primary-600":w?"border-primary-300 bg-background-elevated":"border-primary-300 bg-primary-300")})},g)})]}),x("p",{className:"shrink-0 font-mono text-xs text-text-secondary",children:[x("span",{className:"text-text-primary",children:["v",l]})," · ",o(p?"contentEditor.statusPublished":"contentEditor.statusDraft")," · ",o("contentEditor.railSaved",{when:yE(e.createdAt,new Date,s.language)})]})]}),x("p",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-text-tertiary",children:[i("span",{children:h?o("contentEditor.railCountSince",{count:l,since:h}):o("contentEditor.railCount",{count:l})}),i("button",{type:"button",onClick:a,className:"font-medium text-primary-600 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600",children:o("contentEditor.railOpenHistory")})]})]})}const xE=20,Zo="__info";function wE({nodeId:e,documentTypes:t}){const{t:n,i18n:r}=ae(),a=Tr(),o=ir(),[s,l]=E(null),[c,d]=E(null),[f,u]=E({}),[p,m]=E(!1),[h,g]=E(!1),[y,w]=E(!1),[b,v]=E(!1),[C,N]=E(null),[T,k]=E([]),[L,R]=E(null),[P,I]=E(null);O(()=>{let F=!1;return l(null),d(null),v(!1),N(null),k([]),I(null),Promise.all([XN(e),JN(e)]).then(([q,be])=>{F||(l(q.node),d(be.version),u(be.version.data),m(!1),g(!1))}).catch(()=>{F||v(!0)}),()=>{F=!0}},[e]);const S=s?t.find(F=>F.id===s.documentTypeId):void 0,A=(s==null?void 0:s.publishedAt)!=null,D=s!=null&&c!=null&&c.version>s.currentVersion,U=!A||D,z=S?S.tabs.length===0?[{id:wr,label:n("contentEditor.contentTab")}]:[...pE(S)?[{id:wr,label:n("documentTypeForm.generalTab")}]:[],...S.tabs.map(F=>({id:F.id,label:F.name}))]:[],B=Q(()=>{if(!S||!h)return new Set;const F=new Set;for(const q of S.fields)Bs(f[q.id],q.validation)!==null&&F.add(q.tabId??wr);return F},[S,f,h]),_=[...z,{id:Zo,label:n("contentEditor.infoTab")}].map(F=>({...F,hasError:B.has(F.id)})),G=_.some(F=>F.id===C)?C:_[0].id,V=G===Zo;async function ee(F){if(s)try{const q=F?void 0:L??void 0,{items:be,nextCursor:Pe}=await tE(s.id,{cursor:q,limit:xE});k(He=>F?be:[...He,...be]),R(Pe)}catch{J({variant:"danger",title:n("contentEditor.genericError")})}}O(()=>{s&&(I(null),ee(!0))},[s==null?void 0:s.id]);async function Z(){if(!s||!S)return null;if(S.fields.some(be=>Bs(f[be.id],be.validation)!==null))return g(!0),J({variant:"danger",title:n("contentEditor.validationToast")}),null;const{version:q}=await QN(s.id,f);return d(q),m(!1),q}async function j(){w(!0);try{const F=await Z();F&&(J({variant:"success",title:n("contentEditor.savedToast",{version:F.version}),description:n("contentEditor.savedToastDescription")}),ee(!0))}catch{J({variant:"danger",title:n("contentEditor.genericError")})}finally{w(!1)}}async function le(F){if(s){w(!0);try{if(F===void 0&&p&&!await Z())return;const{node:q}=await eE(s.id,F);l(q),J({variant:"success",title:n("contentEditor.publishedToast",{version:q.currentVersion})}),ee(!0)}catch{J({variant:"danger",title:n("contentEditor.genericError")})}finally{w(!1)}}}async function Ee(F){if(s)try{const{version:q}=await nE(s.id,F);I(q)}catch{J({variant:"danger",title:n("contentEditor.genericError")})}}async function ge(){if(s)try{const{previewUrl:F}=await rE(s.id);F?window.open(F,"_blank","noopener"):J({title:n("contentEditor.previewNotConfigured")})}catch{J({variant:"danger",title:n("contentEditor.previewError")})}}if(Re([s?$t(s):void 0,n("nav.content")]),b)return x("div",{className:"p-8",children:[i("h1",{tabIndex:-1,"data-workspace-title":!0,ref:o,className:"text-2xl font-semibold tracking-tight text-text-primary focus:outline-none",children:n("contentEditor.loadErrorTitle")}),i("p",{role:"alert",className:"mt-2 text-sm text-danger-600",children:n("contentEditor.loadError")})]});if(!s||!c)return x("div",{"aria-label":n("contentTree.loading"),className:"flex flex-col gap-3 p-8",children:[i("h1",{className:"sr-only",children:n("contentEditor.loadingTitle")}),i(pe,{className:"h-8 w-1/3"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]});const Le=s.path.split("/").filter(Boolean),ue=[{key:"infoDocumentType",value:S?S.name:s.documentTypeId,icon:Ji(S==null?void 0:S.icon),iconName:Zi(S==null?void 0:S.icon),ltr:S?void 0:!0,mono:!S},{key:"infoUrl",value:s.path,ltr:!0},{key:"infoLocale",value:s.isDefaultLocale?n("contentEditor.infoLocaleDefault",{locale:s.locale}):s.locale},{key:"infoLastSaved",value:new Date(c.createdAt).toLocaleString()},{key:"infoPublished",value:s.publishedAt?new Date(s.publishedAt).toLocaleString():n("contentEditor.infoNotPublished")}];return x("div",{className:"flex h-full min-h-0 flex-col",children:[x("div",{className:"shrink-0 px-8 pt-6",children:[x("p",{className:"flex items-center gap-1 text-xs text-text-tertiary",children:[i("span",{children:n("nav.content")}),Le.map((F,q)=>x("span",{className:"flex items-center gap-1",children:[i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 rtl:rotate-180"}),F]},q))]}),x("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:o,className:"font-serif text-3xl font-medium tracking-tight text-text-primary focus:outline-none",children:$t(s)}),A?i(de,{variant:"success",children:n("contentEditor.statusPublished")}):i(de,{variant:"neutral",children:n("contentEditor.statusDraft")}),A&&D&&i(de,{variant:"warning",children:n("contentEditor.statusUnpublishedChanges")}),U&&i("div",{className:"ms-auto flex items-center gap-2",children:i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>void ge(),children:n("contentEditor.previewButton")})})]}),x("p",{className:"mt-1 flex flex-wrap items-center gap-2 text-sm text-text-secondary",children:[i("span",{children:S?S.name:s.documentTypeId}),i("span",{"aria-hidden":"true",className:"size-1 rounded-full bg-text-disabled"}),i("span",{dir:"ltr",className:"font-mono text-xs",children:s.path}),s.publishedAt&&x(Ie,{children:[i("span",{"aria-hidden":"true",className:"size-1 rounded-full bg-text-disabled"}),i("span",{children:n("contentEditor.metaPublished",{when:new Date(s.publishedAt).toLocaleDateString(r.language,{day:"numeric",month:"short",year:"numeric"})})})]})]})]}),i(bE,{latest:c,currentVersion:s.currentVersion,isPublished:A,history:T,onOpenHistory:()=>N(Zo)}),i(mo,{tabs:_,activeId:G,onChange:N,label:n("contentEditor.appsLabel"),errorLabel:n("contentEditor.tabHasError"),idPrefix:a,className:"mt-4 shrink-0 px-8"}),i("div",{role:"tabpanel",id:Vr(a,G),"aria-labelledby":jn(a,G),className:"min-w-0 flex-1 overflow-y-auto px-8 pb-8 pt-6",children:V?x("div",{className:"flex flex-col gap-8",children:[i("dl",{className:"grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-2",children:ue.map(F=>x("div",{className:"flex flex-col gap-1",children:[i("dt",{className:"text-xs font-medium uppercase tracking-wider text-text-secondary",children:n(`contentEditor.${F.key}`)}),x("dd",{className:se("text-sm text-text-primary",F.icon&&"flex items-center gap-2",F.mono&&"font-mono text-xs"),children:[F.icon&&i("span",{"data-icon":F.iconName,className:"shrink-0 text-text-secondary",children:i(F.icon,{"aria-hidden":!0,className:"size-4"})}),F.ltr?i("span",{dir:"ltr",children:F.value}):F.value]})]},F.key))}),x("section",{className:"flex flex-col gap-2",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:n("contentEditor.historyTitle")}),i("ul",{className:"flex flex-col gap-1",children:T.map(F=>{const q=A&&F.version===s.currentVersion;return x("li",{className:"flex flex-wrap items-center gap-2 rounded-md border border-border-subtle px-3 py-2",children:[i("span",{className:"font-mono text-xs text-text-primary",children:n("contentEditor.versionRow",{version:F.version})}),i("span",{className:"font-mono text-xs text-text-secondary",children:new Date(F.createdAt).toLocaleString()}),q&&i(de,{variant:"success",children:n("contentEditor.statusPublished")}),F.version===c.version&&i(de,{variant:"neutral",children:n("contentEditor.latestBadge")}),x("span",{className:"ms-auto flex items-center gap-2",children:[i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>void Ee(F.version),children:n("contentEditor.view")}),!q&&i(K,{type:"button",variant:"ghost",size:"sm",disabled:y,onClick:()=>void le(F.version),children:n("contentEditor.publishThis")})]})]},F.id)})}),L&&i(K,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void ee(!1),children:n("contentEditor.loadMore")}),P&&S&&x("div",{className:"mt-2 flex flex-col gap-2 border-t border-border-subtle pt-4",children:[x("div",{className:"flex items-center justify-between",children:[i("h3",{className:"text-sm font-medium text-text-primary",children:n("contentEditor.viewingVersion",{version:P.version})}),i(K,{type:"button",variant:"ghost",size:"sm",onClick:()=>I(null),children:n("contentEditor.closeView")})]}),i(mE,{documentType:S,data:P.data})]})]})]}):S?i(hE,{documentType:S,value:f,onChange:F=>{u(F),m(!0)},showAllErrors:h,activeTabId:G,hideTabStrip:!0}):i("p",{role:"alert",className:"text-sm text-danger-600",children:n("contentEditor.unknownDocumentType")})}),x("footer",{className:"flex h-16 shrink-0 items-center gap-3 border-t border-border-default bg-background-elevated px-8 shadow-lg",children:[i("span",{"aria-hidden":"true",className:se("size-2 rounded-full",p||D?"bg-warning-600":"bg-success-600")}),i("span",{className:"text-sm text-text-secondary",children:p?n("contentEditor.unsavedChanges"):D?n("contentEditor.unpublishedSince",{version:s.currentVersion}):n("contentEditor.allSaved")}),i("span",{className:"flex-1"}),i(K,{type:"button",variant:"outline",disabled:y,onClick:()=>void j(),children:n(y?"contentEditor.saving":"contentEditor.save")}),i(K,{type:"button",disabled:y,onClick:()=>void le(),children:n(y?"contentEditor.publishing":"contentEditor.saveAndPublish")})]})]})}function CE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Q(()=>r=>{t.forEach(a=>a(r))},t)}const vo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function tl(e){return"nodeType"in e}function et(e){var t,n;return e?lr(e)?e:tl(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function nl(e){const{Document:t}=et(e);return e instanceof t}function Wr(e){return lr(e)?!1:e instanceof et(e).HTMLElement}function Tp(e){return e instanceof et(e).SVGElement}function cr(e){return e?lr(e)?e.document:tl(e)?nl(e)?e:Wr(e)||Tp(e)?e.ownerDocument:document:document:document}const Dt=vo?Wn:O;function rl(e){const t=M(e);return Dt(()=>{t.current=e}),H(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t.current==null?void 0:t.current(...r)},[])}function NE(){const e=M(null),t=H((r,a)=>{e.current=setInterval(r,a)},[]),n=H(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ar(e,t){t===void 0&&(t=[e]);const n=M(e);return Dt(()=>{n.current!==e&&(n.current=e)},t),n}function qr(e,t){const n=M();return Q(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Fa(e){const t=rl(e),n=M(null),r=H(a=>{a!==n.current&&(t==null||t(a,n.current)),n.current=a},[]);return[n,r]}function Us(e){const t=M();return O(()=>{t.current=e},[e]),t.current}let Qo={};function Gr(e,t){return Q(()=>{if(t)return t;const n=Qo[e]==null?0:Qo[e]+1;return Qo[e]=n,e+"-"+n},[e,t])}function kp(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((o,s)=>{const l=Object.entries(s);for(const[c,d]of l){const f=o[c];f!=null&&(o[c]=f+e*d)}return o},{...t})}}const Bn=kp(1),Mr=kp(-1);function EE(e){return"clientX"in e&&"clientY"in e}function al(e){if(!e)return!1;const{KeyboardEvent:t}=et(e.target);return t&&e instanceof t}function SE(e){if(!e)return!1;const{TouchEvent:t}=et(e.target);return t&&e instanceof t}function zs(e){if(SE(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return EE(e)?{x:e.clientX,y:e.clientY}:null}const Cn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Cn.Translate.toString(e),Cn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Lc="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function TE(e){return e.matches(Lc)?e:e.querySelector(Lc)}const kE={display:"none"};function RE(e){let{id:t,value:n}=e;return Ze.createElement("div",{id:t,style:kE},n)}function PE(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ze.createElement("div",{id:t,style:a,role:"status","aria-live":r,"aria-atomic":!0},n)}function DE(){const[e,t]=E("");return{announce:H(r=>{r!=null&&t(r)},[]),announcement:e}}const Rp=Te(null);function IE(e){const t=ne(Rp);O(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function LE(){const[e]=E(()=>new Set),t=H(r=>(e.add(r),()=>e.delete(r)),[e]);return[H(r=>{let{type:a,event:o}=r;e.forEach(s=>{var l;return(l=s[a])==null?void 0:l.call(s,o)})},[e]),t]}const AE={draggable:`
536
+ */const BN=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],UN=Y("video",BN),Np="flex w-full items-center gap-2 rounded-md border-s-2 px-2 text-start text-sm transition-colors duration-fast",Sp="border-primary-300 bg-primary-50 font-medium text-primary-800",Xi="border-transparent text-text-primary hover:bg-background-hover";function Vn({children:e,label:t}){return i("aside",{"aria-label":t,className:"w-72 shrink-0 overflow-y-auto border-e border-border-default bg-background-subtle px-2 py-3",children:e})}function Bt({title:e,action:t,children:n}){return x("div",{className:"mt-5 first:mt-1",children:[x("div",{className:"flex h-7 items-center justify-between px-2 pb-1",children:[i("span",{className:"text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:e}),t]}),n]})}function dt({label:e,icon:t,selected:n,onClick:r}){return x("button",{type:"button","aria-current":n?"page":void 0,onClick:r,className:se(Np,"h-8",n?Sp:Xi),children:[t&&i("span",{className:se("shrink-0 [&>svg]:size-4",n?"text-primary-600":"text-text-disabled"),children:t}),i("span",{className:"min-w-0 flex-1 truncate",children:e})]})}function me({children:e,flush:t=!1}){return i("main",{id:"main",tabIndex:-1,className:se("min-w-0 flex-1 bg-background-elevated focus:outline-none",t?"overflow-hidden":"overflow-y-auto p-8"),children:e})}function zN({cursor:e,limit:t}){const n=new URLSearchParams;e&&n.set("cursor",e),t&&n.set("limit",String(t));const r=n.toString();return r?`?${r}`:""}class ve extends Error{constructor(t,n,r){super(t),this.status=n,this.blockedBy=r}}async function re(e){const t=await e.json().catch(()=>null);if(!e.ok){const n=t&&typeof t=="object"&&typeof t.message=="string"?t.message:e.statusText;throw new ve(n,e.status)}return t}async function Ep(e={}){const t=await X(`/api/document-types${zN(e)}`);return re(t)}async function jN(e){const t=await X("/api/document-types",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return re(t)}async function VN(e,t){const n=await X(`/api/document-types/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return re(n)}async function HN(e){const t=await X(`/api/document-types/${e}`,{method:"DELETE"});return re(t)}let $n=!1;function KN(){const e=Xe(),t=M(e.pathname);O(()=>{if(t.current===e.pathname)return;t.current=e.pathname,$n=!0;const n=setTimeout(()=>{var o;const r=document.activeElement;if(r instanceof HTMLElement&&r.closest("aside")){$n=!1;return}const a=document.querySelector("[data-workspace-title]");if(a){a.focus(),$n=!1;return}(o=document.getElementById("main"))==null||o.focus()},0);return()=>clearTimeout(n)},[e.pathname])}function ir(){return K(e=>{if(!(!e||!$n)){if(document.activeElement instanceof HTMLElement&&document.activeElement.closest("aside")){$n=!1;return}e.focus({preventScroll:!1}),$n=!1}},[])}const Lr={file:yp,"file-text":Hr,folder:vp,image:Ma,calendar:eC,newspaper:ZC,"layout-grid":Oa,tag:RN,user:ON,users:Yi,"shopping-cart":xN,star:SN,globe:bp,mail:HC,"map-pin":WC,music:XC,video:UN,book:G1,list:UC,quote:dN,link:$C,home:DC,settings:Cp,database:pC,code:uC,palette:xp,megaphone:GC,briefcase:X1,"graduation-cap":EC,heart:RC,utensils:$N,plane:iN,building:Z1,phone:oN,clock:iC,pencil:rN,shield:vN,package:eN},WN=Object.keys(Lr),_s=Hr;function Ji(e){return e&&Lr[e]||_s}function Zi(e){return e&&Lr[e]?e:"file-text"}function Qi({cursor:e,limit:t}){const n=new URLSearchParams;e&&n.set("cursor",e),t&&n.set("limit",String(t));const r=n.toString();return r?`?${r}`:""}async function Pc(e={}){const t=await X(`/api/content/roots${Qi(e)}`);if(!t.ok)throw new Error(`Failed to fetch root content nodes (${t.status})`);return t.json()}async function Dc(e,t={}){const n=await X(`/api/content/${e}/children${Qi(t)}`);if(!n.ok)throw new Error(`Failed to fetch children of ${e} (${n.status})`);return n.json()}async function qN(e){const t=await X(`/api/content/by-path?path=${encodeURIComponent(e)}`);if(t.status===404)return null;if(!t.ok)throw new Error(`Failed to resolve content path (${t.status})`);return(await t.json()).node}async function GN(e){const t=await X("/api/content/roots/reorder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderedIds:e})});if(!t.ok)throw new Error(`Failed to reorder root content nodes (${t.status})`)}async function YN(e,t){const n=await X(`/api/content/${e}/children/reorder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderedIds:t})});if(!n.ok)throw new Error(`Failed to reorder children of ${e} (${n.status})`)}async function XN(e){const t=await X(`/api/content/${e}`);return re(t)}async function JN(e){const t=await X(`/api/content/${e}/versions/latest`);return re(t)}async function ZN(e){const t=await X("/api/content",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return re(t)}async function QN(e,t){const n=await X(`/api/content/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:t})});return re(n)}async function eS(e,t){const n=await X(`/api/content/${e}/publish`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t?{version:t}:{})});return re(n)}async function tS(e,t={}){const n=new URLSearchParams;t.cursor&&n.set("cursor",String(t.cursor)),t.limit&&n.set("limit",String(t.limit));const r=n.toString(),a=await X(`/api/content/${e}/versions${r?`?${r}`:""}`);return re(a)}async function nS(e,t){const n=await X(`/api/content/${e}/versions/${t}`);return re(n)}async function rS(e){const t=await X(`/api/content/${e}/preview-token`,{method:"POST"});return re(t)}async function Ic(e,t={}){const n=await X(`/api/content/${e}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(n.ok){const r=await n.json().catch(()=>null);return{ok:!0,trashedCount:(r==null?void 0:r.trashedCount)??0}}if(n.status===409){const r=await n.json().catch(()=>null);if(r!=null&&r.requiresConfirmation)return{ok:!1,requiresConfirmation:!0,nodeName:r.nodeName??"",descendantCount:r.descendantCount??0,message:r.message??""};throw new ve((r==null?void 0:r.message)??n.statusText,n.status)}throw await re(n),new ve(n.statusText,n.status)}async function Fs(e,t){const n=await X(`/api/content/trash${Qi({cursor:e,limit:t})}`);return re(n)}class aS extends Error{constructor(t,n){super(n),this.blockingAncestorPath=t}status=409}async function oS(e){const t=await X(`/api/content/${e}/restore`,{method:"POST"});if(t.status===409){const n=await t.json().catch(()=>null);throw new aS((n==null?void 0:n.blockingAncestorPath)??"",(n==null?void 0:n.message)??t.statusText)}return re(t)}function $t(e){return e.path.split("/").filter(Boolean).pop()??e.path}function sS(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function iS(e,t){const n=e.filter(a=>a.kind==="page");if(t===null)return n.filter(a=>a.treeRules.allowedAtRoot);const r=n.find(a=>a.id===t.documentTypeId);return n.filter(a=>{const o=!r||r.treeRules.allowedChildTypes.length===0||r.treeRules.allowedChildTypes.includes(a.id),s=a.treeRules.allowedParentTypes.length===0||r!==void 0&&a.treeRules.allowedParentTypes.includes(r.id);return o&&s})}function lS({types:e,value:t,onChange:n}){const{t:r}=oe(),a=Rh();return x("select",{...a,value:t,onChange:o=>n(o.target.value),className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary",children:[i("option",{value:"",children:r("contentCreate.typePlaceholder")}),e.map(o=>i("option",{value:o.id,children:o.name},o.id))]})}function cS({documentTypes:e,parent:t,onCreated:n,onCancel:r}){const{t:a}=oe(),o=ir();Re([a("contentCreate.title"),a("nav.content")]);const s=iS(e,t),[l,c]=E(""),[d,f]=E(""),[u,p]=E(!1),[m,h]=E(null),g=sS(d),y=t?`${t.path}/${g}`:`/${g}`;async function w(b){if(b.preventDefault(),!(!l||!g)){p(!0),h(null);try{const{node:v}=await ZN({documentTypeId:l,parentId:(t==null?void 0:t.id)??null,path:y,depth:t?t.depth+1:0,sortOrder:0,locale:"en",isDefaultLocale:!0,data:{}});J({variant:"success",title:a("contentCreate.createdToast",{name:g})}),n(v)}catch(v){h(v instanceof Error&&v.message?v.message:a("contentCreate.genericError"))}finally{p(!1)}}}return x("form",{onSubmit:w,className:"flex max-w-xl flex-col gap-4",children:[x("div",{children:[i("p",{className:"text-xs text-text-secondary",children:t?a("contentCreate.underCrumb",{name:$t(t)}):a("contentCreate.atRootCrumb")}),x("div",{className:"mt-1 flex items-center justify-between",children:[i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:o,className:"text-xl font-bold text-text-primary focus:outline-none",children:a("contentCreate.title")}),i(H,{type:"button",variant:"ghost",size:"sm",onClick:r,children:a("contentCreate.cancel")})]})]}),s.length===0?i("p",{className:"text-sm text-text-secondary",children:t?a("contentCreate.noTypesUnder",{name:$t(t)}):a("contentCreate.noTypes")}):x(Ie,{children:[x(Ne,{label:a("contentCreate.typeLabel"),htmlFor:"content-create-type",helpText:a(t?"contentCreate.typeHelpChild":"contentCreate.typeHelp"),children:[i(lS,{types:s,value:l,onChange:c}),(()=>{const b=s.find(C=>C.id===l),v=Ji(b==null?void 0:b.icon);return x("span",{"data-icon":Zi(b==null?void 0:b.icon),className:"mt-2 flex items-center gap-2 text-xs text-text-secondary",children:[i(v,{"aria-hidden":!0,className:"size-4"}),b?b.name:a("contentCreate.typePlaceholder")]})})()]}),i(Ne,{label:a("contentCreate.nameLabel"),htmlFor:"content-create-name",helpText:g?a("contentCreate.nameHelp",{path:y}):void 0,children:i(ye,{id:"content-create-name",required:!0,value:d,onChange:b=>f(b.target.value)})}),m&&i("p",{role:"alert",className:"text-sm text-danger-600",children:m}),i(H,{type:"submit",disabled:u||!l||!g,className:"self-start",children:a(u?"contentCreate.creating":"contentCreate.submit")})]})]})}class dS extends bd{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){console.error("Plugin view crashed:",t)}render(){return this.state.error?this.props.fallback(this.state.error):this.props.children}}function Kr({pluginName:e,children:t}){const{t:n}=oe();return i(dS,{fallback:r=>x("div",{role:"alert",className:"rounded-md border border-danger-500 bg-background-elevated p-3",children:[i("p",{className:"text-sm font-medium text-danger-600",children:n("pluginBoundary.viewCrashed",{name:e})}),i("p",{className:"mt-1 text-xs text-text-secondary",children:r.message})]}),children:t})}function uS(e){if(!e)return null;const{minLength:t,maxLength:n,min:r,max:a}=e;return t!==void 0&&n!==void 0?{key:"documentTypeForm.help.lengthRange",params:{min:t,max:n}}:t!==void 0?{key:"documentTypeForm.help.minLength",params:{min:t}}:n!==void 0?{key:"documentTypeForm.help.maxLength",params:{max:n}}:r!==void 0&&a!==void 0?{key:"documentTypeForm.help.range",params:{min:r,max:a}}:r!==void 0?{key:"documentTypeForm.help.min",params:{min:r}}:a!==void 0?{key:"documentTypeForm.help.max",params:{max:a}}:null}let Mn=null,ca=null;const $s=new Set;async function fS(){const e=await Tp(!0);return $s.forEach(t=>t(e)),e}async function Tp(e=!1){return Mn&&!e?Mn:(e&&(ca=null),ca??=X("/api/data-types?limit=100").then(async t=>{if(!t.ok)throw new Error(`Failed to load data types (${t.status})`);return Mn=(await t.json()).items,Mn}).finally(()=>{ca=null}),ca)}function el(e){const t=(Mn??[]).find(r=>r.id===e)??null;if(t){const r=xa(t.editorId);return r?{config:t,editor:r,settings:Object.keys(t.settings).length>0?t.settings:r.defaultSettings}:null}const n=xa(e);return n?{config:null,editor:n,settings:n.defaultSettings}:null}function yo(){const[e,t]=E(Mn);return O(()=>{let n=!1;const r=a=>{n||t(a)};return $s.add(r),Tp().then(r).catch(()=>{n||t([])}),()=>{n=!0,$s.delete(r)}},[]),e}function Bs(e,t){if(!t)return null;if(t.required&&(e==null||e===""))return{key:"documentTypeForm.errors.required"};if(typeof e=="string"){if(t.minLength!==void 0&&e.length<t.minLength)return{key:"documentTypeForm.errors.minLength",params:{minLength:t.minLength}};if(t.maxLength!==void 0&&e.length>t.maxLength)return{key:"documentTypeForm.errors.maxLength",params:{maxLength:t.maxLength}};if(t.pattern!==void 0&&e!==""){let n=null;try{n=new RegExp(t.pattern)}catch{n=null}if(n&&!n.test(e))return{key:"documentTypeForm.errors.pattern"}}}if(typeof e=="number"){if(t.min!==void 0&&e<t.min)return{key:"documentTypeForm.errors.min",params:{min:t.min}};if(t.max!==void 0&&e>t.max)return{key:"documentTypeForm.errors.max",params:{max:t.max}}}return null}const wr="general";function pS(e){return e.tabs.length===0?!1:e.fields.some(t=>t.tabId==null||!e.tabs.some(n=>n.id===t.tabId))}function hS({documentType:e,value:t,onChange:n,showAllErrors:r,activeTabId:a,hideTabStrip:o}){const{t:s}=oe(),l=Tr(),c=yo(),[d,f]=E(new Set),[u,p]=E(null);function m(T){f(R=>new Set(R).add(T))}const h=e.tabs,g=T=>T.tabId!=null&&h.some(R=>R.id===T.tabId),y=e.fields.filter(T=>!g(T)),w=h.length===0?[]:[...y.length>0?[{id:wr,label:s("documentTypeForm.generalTab")}]:[],...h.map(T=>({id:T.id,label:T.name}))],b=w.length===0?null:w.some(T=>T.id===u)?u:w[0].id,v=a!==void 0?h.length===0?null:a:b,C=v===null?e.fields:v===wr?y:e.fields.filter(T=>T.tabId===v);function N(T,R){var S;const L=el(T.datatypeId),I=t[T.id],P=r||d.has(T.id)?Bs(I,T.validation):null,k=uS(T.validation);return i(Ne,{label:T.name,required:(S=T.validation)==null?void 0:S.required,requiredText:s("common.required"),error:P?s(P.key,P.params):void 0,helpText:k?s(k.key,k.params):void 0,onBlur:()=>m(T.id),className:R>0?"border-t border-border-subtle pt-6":void 0,children:L?i(Gs,{value:I,onChange:A=>n({...t,[T.id]:A}),children:i(qa,{settings:L.settings,children:i(Kr,{pluginName:L.editor.name,children:i(L.editor.views.input,{})})})}):i("p",{className:"text-sm text-danger-600",children:s("documentTypeForm.unknownDatatype",{datatypeId:T.datatypeId})})},T.id)}return c===null?null:i(Fr,{fetch:X,children:v===null||o?i("div",{className:"flex flex-col",children:C.map(N)}):x("div",{className:"flex flex-col gap-4",children:[i(mo,{tabs:w,activeId:v,onChange:p,label:s("documentTypeForm.tabListLabel"),idPrefix:l}),i("div",{role:"tabpanel",id:Vr(l,v),"aria-labelledby":jn(l,v),className:"flex flex-col",children:C.map(N)})]})})}function mS({documentType:e,data:t}){const{t:n}=oe();return yo()===null?null:i(Fr,{fetch:X,children:i("div",{inert:!0,className:"flex flex-col",children:e.fields.map((a,o)=>{const s=el(a.datatypeId),l=s?s.editor.views.preview??s.editor.views.readOnly:null;return i(Ne,{label:a.name,className:o>0?"border-t border-border-subtle pt-6":void 0,children:s&&l?i(Gs,{value:t[a.id],onChange:()=>{},children:i(qa,{settings:s.settings,children:i(Kr,{pluginName:s.editor.name,children:i(l,{})})})}):i("p",{className:"text-sm text-danger-600",children:n("documentTypeForm.unknownDatatype",{datatypeId:a.datatypeId})})},a.id)})})})}const gS=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function yS(e,t=new Date,n){const r=(new Date(e).getTime()-t.getTime())/1e3,a=Math.abs(r),o=new Intl.RelativeTimeFormat(n,{numeric:"auto"});for(const[s,l]of gS)if(a>=l)return o.format(Math.round(r/l),s);return o.format(Math.round(r),"second")}const vS=12;function bS({latest:e,currentVersion:t,isPublished:n,history:r,onOpenHistory:a}){const{t:o,i18n:s}=oe(),l=e.version,c=Math.max(1,l-vS+1),d=c-1,f=new Map(r.map(g=>[g.version,g])),u=[];for(let g=c;g<=l;g+=1)u.push(g);const p=n&&t===l,m=f.get(1),h=m?new Date(m.createdAt).toLocaleDateString(s.language,{day:"numeric",month:"short",year:"numeric"}):null;return x("div",{className:"shrink-0 px-8 pt-3",role:"group","aria-label":o("contentEditor.railLabel"),children:[x("div",{className:"flex items-center gap-4",children:[x("ol",{className:"relative flex min-w-0 flex-1 items-center gap-5 py-1 before:absolute before:end-0 before:start-0 before:top-1/2 before:h-px before:bg-primary-100",children:[d>0&&i("li",{className:"relative rounded-full bg-background-hover px-2 font-mono text-xs text-text-secondary",children:o("contentEditor.railHidden",{count:d})}),u.map(g=>{const y=g===t&&n,w=g===l,b=o(y?"contentEditor.railTickPublished":"contentEditor.railTickDraft",{version:g});return i("li",{className:"relative",title:b,children:i("span",{role:"img","aria-label":b,className:se("block rounded-full border-2",w?"animate-tick-in size-4 ring-4 ring-primary-50":"size-3",y?"border-primary-600 bg-primary-600":w?"border-primary-300 bg-background-elevated":"border-primary-300 bg-primary-300")})},g)})]}),x("p",{className:"shrink-0 font-mono text-xs text-text-secondary",children:[x("span",{className:"text-text-primary",children:["v",l]})," · ",o(p?"contentEditor.statusPublished":"contentEditor.statusDraft")," · ",o("contentEditor.railSaved",{when:yS(e.createdAt,new Date,s.language)})]})]}),x("p",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-text-tertiary",children:[i("span",{children:h?o("contentEditor.railCountSince",{count:l,since:h}):o("contentEditor.railCount",{count:l})}),i("button",{type:"button",onClick:a,className:"font-medium text-primary-600 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600",children:o("contentEditor.railOpenHistory")})]})]})}const xS=20,Zo="__info";function wS({nodeId:e,documentTypes:t}){const{t:n,i18n:r}=oe(),a=Tr(),o=ir(),[s,l]=E(null),[c,d]=E(null),[f,u]=E({}),[p,m]=E(!1),[h,g]=E(!1),[y,w]=E(!1),[b,v]=E(!1),[C,N]=E(null),[T,R]=E([]),[L,I]=E(null),[P,k]=E(null);O(()=>{let F=!1;return l(null),d(null),v(!1),N(null),R([]),k(null),Promise.all([XN(e),JN(e)]).then(([q,be])=>{F||(l(q.node),d(be.version),u(be.version.data),m(!1),g(!1))}).catch(()=>{F||v(!0)}),()=>{F=!0}},[e]);const S=s?t.find(F=>F.id===s.documentTypeId):void 0,A=(s==null?void 0:s.publishedAt)!=null,D=s!=null&&c!=null&&c.version>s.currentVersion,B=!A||D,U=S?S.tabs.length===0?[{id:wr,label:n("contentEditor.contentTab")}]:[...pS(S)?[{id:wr,label:n("documentTypeForm.generalTab")}]:[],...S.tabs.map(F=>({id:F.id,label:F.name}))]:[],z=Q(()=>{if(!S||!h)return new Set;const F=new Set;for(const q of S.fields)Bs(f[q.id],q.validation)!==null&&F.add(q.tabId??wr);return F},[S,f,h]),_=[...U,{id:Zo,label:n("contentEditor.infoTab")}].map(F=>({...F,hasError:z.has(F.id)})),G=_.some(F=>F.id===C)?C:_[0].id,V=G===Zo;async function ee(F){if(s)try{const q=F?void 0:L??void 0,{items:be,nextCursor:Pe}=await tS(s.id,{cursor:q,limit:xS});R(He=>F?be:[...He,...be]),I(Pe)}catch{J({variant:"danger",title:n("contentEditor.genericError")})}}O(()=>{s&&(k(null),ee(!0))},[s==null?void 0:s.id]);async function Z(){if(!s||!S)return null;if(S.fields.some(be=>Bs(f[be.id],be.validation)!==null))return g(!0),J({variant:"danger",title:n("contentEditor.validationToast")}),null;const{version:q}=await QN(s.id,f);return d(q),m(!1),q}async function j(){w(!0);try{const F=await Z();F&&(J({variant:"success",title:n("contentEditor.savedToast",{version:F.version}),description:n("contentEditor.savedToastDescription")}),ee(!0))}catch{J({variant:"danger",title:n("contentEditor.genericError")})}finally{w(!1)}}async function le(F){if(s){w(!0);try{if(F===void 0&&p&&!await Z())return;const{node:q}=await eS(s.id,F);l(q),J({variant:"success",title:n("contentEditor.publishedToast",{version:q.currentVersion})}),ee(!0)}catch{J({variant:"danger",title:n("contentEditor.genericError")})}finally{w(!1)}}}async function Se(F){if(s)try{const{version:q}=await nS(s.id,F);k(q)}catch{J({variant:"danger",title:n("contentEditor.genericError")})}}async function ge(){if(s)try{const{previewUrl:F}=await rS(s.id);F?window.open(F,"_blank","noopener"):J({title:n("contentEditor.previewNotConfigured")})}catch{J({variant:"danger",title:n("contentEditor.previewError")})}}if(Re([s?$t(s):void 0,n("nav.content")]),b)return x("div",{className:"p-8",children:[i("h1",{tabIndex:-1,"data-workspace-title":!0,ref:o,className:"text-2xl font-semibold tracking-tight text-text-primary focus:outline-none",children:n("contentEditor.loadErrorTitle")}),i("p",{role:"alert",className:"mt-2 text-sm text-danger-600",children:n("contentEditor.loadError")})]});if(!s||!c)return x("div",{"aria-label":n("contentTree.loading"),className:"flex flex-col gap-3 p-8",children:[i("h1",{className:"sr-only",children:n("contentEditor.loadingTitle")}),i(pe,{className:"h-8 w-1/3"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]});const Le=s.path.split("/").filter(Boolean),ue=[{key:"infoDocumentType",value:S?S.name:s.documentTypeId,icon:Ji(S==null?void 0:S.icon),iconName:Zi(S==null?void 0:S.icon),ltr:S?void 0:!0,mono:!S},{key:"infoUrl",value:s.path,ltr:!0},{key:"infoLocale",value:s.isDefaultLocale?n("contentEditor.infoLocaleDefault",{locale:s.locale}):s.locale},{key:"infoLastSaved",value:new Date(c.createdAt).toLocaleString()},{key:"infoPublished",value:s.publishedAt?new Date(s.publishedAt).toLocaleString():n("contentEditor.infoNotPublished")}];return x("div",{className:"flex h-full min-h-0 flex-col",children:[x("div",{className:"shrink-0 px-8 pt-6",children:[x("p",{className:"flex items-center gap-1 text-xs text-text-tertiary",children:[i("span",{children:n("nav.content")}),Le.map((F,q)=>x("span",{className:"flex items-center gap-1",children:[i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 rtl:rotate-180"}),F]},q))]}),x("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:o,className:"font-serif text-3xl font-medium tracking-tight text-text-primary focus:outline-none",children:$t(s)}),A?i(de,{variant:"success",children:n("contentEditor.statusPublished")}):i(de,{variant:"neutral",children:n("contentEditor.statusDraft")}),A&&D&&i(de,{variant:"warning",children:n("contentEditor.statusUnpublishedChanges")}),B&&i("div",{className:"ms-auto flex items-center gap-2",children:i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>void ge(),children:n("contentEditor.previewButton")})})]}),x("p",{className:"mt-1 flex flex-wrap items-center gap-2 text-sm text-text-secondary",children:[i("span",{children:S?S.name:s.documentTypeId}),i("span",{"aria-hidden":"true",className:"size-1 rounded-full bg-text-disabled"}),i("span",{dir:"ltr",className:"font-mono text-xs",children:s.path}),s.publishedAt&&x(Ie,{children:[i("span",{"aria-hidden":"true",className:"size-1 rounded-full bg-text-disabled"}),i("span",{children:n("contentEditor.metaPublished",{when:new Date(s.publishedAt).toLocaleDateString(r.language,{day:"numeric",month:"short",year:"numeric"})})})]})]})]}),i(bS,{latest:c,currentVersion:s.currentVersion,isPublished:A,history:T,onOpenHistory:()=>N(Zo)}),i(mo,{tabs:_,activeId:G,onChange:N,label:n("contentEditor.appsLabel"),errorLabel:n("contentEditor.tabHasError"),idPrefix:a,className:"mt-4 shrink-0 px-8"}),i("div",{role:"tabpanel",id:Vr(a,G),"aria-labelledby":jn(a,G),className:"min-w-0 flex-1 overflow-y-auto px-8 pb-8 pt-6",children:V?x("div",{className:"flex flex-col gap-8",children:[i("dl",{className:"grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-2",children:ue.map(F=>x("div",{className:"flex flex-col gap-1",children:[i("dt",{className:"text-xs font-medium uppercase tracking-wider text-text-secondary",children:n(`contentEditor.${F.key}`)}),x("dd",{className:se("text-sm text-text-primary",F.icon&&"flex items-center gap-2",F.mono&&"font-mono text-xs"),children:[F.icon&&i("span",{"data-icon":F.iconName,className:"shrink-0 text-text-secondary",children:i(F.icon,{"aria-hidden":!0,className:"size-4"})}),F.ltr?i("span",{dir:"ltr",children:F.value}):F.value]})]},F.key))}),x("section",{className:"flex flex-col gap-2",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:n("contentEditor.historyTitle")}),i("ul",{className:"flex flex-col gap-1",children:T.map(F=>{const q=A&&F.version===s.currentVersion;return x("li",{className:"flex flex-wrap items-center gap-2 rounded-md border border-border-subtle px-3 py-2",children:[i("span",{className:"font-mono text-xs text-text-primary",children:n("contentEditor.versionRow",{version:F.version})}),i("span",{className:"font-mono text-xs text-text-secondary",children:new Date(F.createdAt).toLocaleString()}),q&&i(de,{variant:"success",children:n("contentEditor.statusPublished")}),F.version===c.version&&i(de,{variant:"neutral",children:n("contentEditor.latestBadge")}),x("span",{className:"ms-auto flex items-center gap-2",children:[i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>void Se(F.version),children:n("contentEditor.view")}),!q&&i(H,{type:"button",variant:"ghost",size:"sm",disabled:y,onClick:()=>void le(F.version),children:n("contentEditor.publishThis")})]})]},F.id)})}),L&&i(H,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void ee(!1),children:n("contentEditor.loadMore")}),P&&S&&x("div",{className:"mt-2 flex flex-col gap-2 border-t border-border-subtle pt-4",children:[x("div",{className:"flex items-center justify-between",children:[i("h3",{className:"text-sm font-medium text-text-primary",children:n("contentEditor.viewingVersion",{version:P.version})}),i(H,{type:"button",variant:"ghost",size:"sm",onClick:()=>k(null),children:n("contentEditor.closeView")})]}),i(mS,{documentType:S,data:P.data})]})]})]}):S?i(hS,{documentType:S,value:f,onChange:F=>{u(F),m(!0)},showAllErrors:h,activeTabId:G,hideTabStrip:!0}):i("p",{role:"alert",className:"text-sm text-danger-600",children:n("contentEditor.unknownDocumentType")})}),x("footer",{className:"flex h-16 shrink-0 items-center gap-3 border-t border-border-default bg-background-elevated px-8 shadow-lg",children:[i("span",{"aria-hidden":"true",className:se("size-2 rounded-full",p||D?"bg-warning-600":"bg-success-600")}),i("span",{className:"text-sm text-text-secondary",children:p?n("contentEditor.unsavedChanges"):D?n("contentEditor.unpublishedSince",{version:s.currentVersion}):n("contentEditor.allSaved")}),i("span",{className:"flex-1"}),i(H,{type:"button",variant:"outline",disabled:y,onClick:()=>void j(),children:n(y?"contentEditor.saving":"contentEditor.save")}),i(H,{type:"button",disabled:y,onClick:()=>void le(),children:n(y?"contentEditor.publishing":"contentEditor.saveAndPublish")})]})]})}function CS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Q(()=>r=>{t.forEach(a=>a(r))},t)}const vo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function tl(e){return"nodeType"in e}function et(e){var t,n;return e?lr(e)?e:tl(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function nl(e){const{Document:t}=et(e);return e instanceof t}function Wr(e){return lr(e)?!1:e instanceof et(e).HTMLElement}function kp(e){return e instanceof et(e).SVGElement}function cr(e){return e?lr(e)?e.document:tl(e)?nl(e)?e:Wr(e)||kp(e)?e.ownerDocument:document:document:document}const Dt=vo?Wn:O;function rl(e){const t=M(e);return Dt(()=>{t.current=e}),K(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t.current==null?void 0:t.current(...r)},[])}function NS(){const e=M(null),t=K((r,a)=>{e.current=setInterval(r,a)},[]),n=K(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ar(e,t){t===void 0&&(t=[e]);const n=M(e);return Dt(()=>{n.current!==e&&(n.current=e)},t),n}function qr(e,t){const n=M();return Q(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Fa(e){const t=rl(e),n=M(null),r=K(a=>{a!==n.current&&(t==null||t(a,n.current)),n.current=a},[]);return[n,r]}function Us(e){const t=M();return O(()=>{t.current=e},[e]),t.current}let Qo={};function Gr(e,t){return Q(()=>{if(t)return t;const n=Qo[e]==null?0:Qo[e]+1;return Qo[e]=n,e+"-"+n},[e,t])}function Rp(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((o,s)=>{const l=Object.entries(s);for(const[c,d]of l){const f=o[c];f!=null&&(o[c]=f+e*d)}return o},{...t})}}const Bn=Rp(1),Mr=Rp(-1);function SS(e){return"clientX"in e&&"clientY"in e}function al(e){if(!e)return!1;const{KeyboardEvent:t}=et(e.target);return t&&e instanceof t}function ES(e){if(!e)return!1;const{TouchEvent:t}=et(e.target);return t&&e instanceof t}function zs(e){if(ES(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return SS(e)?{x:e.clientX,y:e.clientY}:null}const Cn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Cn.Translate.toString(e),Cn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Lc="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function TS(e){return e.matches(Lc)?e:e.querySelector(Lc)}const kS={display:"none"};function RS(e){let{id:t,value:n}=e;return Ze.createElement("div",{id:t,style:kS},n)}function PS(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ze.createElement("div",{id:t,style:a,role:"status","aria-live":r,"aria-atomic":!0},n)}function DS(){const[e,t]=E("");return{announce:K(r=>{r!=null&&t(r)},[]),announcement:e}}const Pp=Te(null);function IS(e){const t=ne(Pp);O(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function LS(){const[e]=E(()=>new Set),t=K(r=>(e.add(r),()=>e.delete(r)),[e]);return[K(r=>{let{type:a,event:o}=r;e.forEach(s=>{var l;return(l=s[a])==null?void 0:l.call(s,o)})},[e]),t]}const AS={draggable:`
537
537
  To pick up a draggable item, press the space bar.
538
538
  While dragging, use the arrow keys to move the item.
539
539
  Press space again to drop the item in its new position, or press escape to cancel.
540
- `},ME={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function OE(e){let{announcements:t=ME,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=AE}=e;const{announce:o,announcement:s}=DE(),l=Gr("DndLiveRegion"),[c,d]=E(!1);if(O(()=>{d(!0)},[]),IE(Q(()=>({onDragStart(u){let{active:p}=u;o(t.onDragStart({active:p}))},onDragMove(u){let{active:p,over:m}=u;t.onDragMove&&o(t.onDragMove({active:p,over:m}))},onDragOver(u){let{active:p,over:m}=u;o(t.onDragOver({active:p,over:m}))},onDragEnd(u){let{active:p,over:m}=u;o(t.onDragEnd({active:p,over:m}))},onDragCancel(u){let{active:p,over:m}=u;o(t.onDragCancel({active:p,over:m}))}}),[o,t])),!c)return null;const f=Ze.createElement(Ze.Fragment,null,Ze.createElement(RE,{id:r,value:a.draggable}),Ze.createElement(PE,{id:l,announcement:s}));return n?Ga(f,n):f}var Ae;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ae||(Ae={}));function $a(){}function Hn(e,t){return Q(()=>({sensor:e,options:t??{}}),[e,t])}function ol(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Q(()=>[...t].filter(r=>r!=null),[...t])}const mt=Object.freeze({x:0,y:0});function _E(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function FE(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function $E(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Ac(e){let{left:t,top:n,height:r,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+r},{x:t+a,y:n+r}]}function Pp(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const BE=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=Ac(t),o=[];for(const s of r){const{id:l}=s,c=n.get(l);if(c){const d=Ac(c),f=a.reduce((p,m,h)=>p+_E(d[h],m),0),u=Number((f/4).toFixed(4));o.push({id:l,data:{droppableContainer:s,value:u}})}}return o.sort(FE)};function UE(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=a-r,l=o-n;if(r<a&&n<o){const c=t.width*t.height,d=e.width*e.height,f=s*l,u=f/(c+d-f);return Number(u.toFixed(4))}return 0}const zE=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const o of r){const{id:s}=o,l=n.get(s);if(l){const c=UE(l,t);c>0&&a.push({id:s,data:{droppableContainer:o,value:c}})}}return a.sort($E)};function jE(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Dp(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:mt}function VE(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return a.reduce((s,l)=>({...s,top:s.top+e*l.y,bottom:s.bottom+e*l.y,left:s.left+e*l.x,right:s.right+e*l.x}),{...n})}}const HE=VE(1);function KE(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function WE(e,t,n){const r=KE(t);if(!r)return e;const{scaleX:a,scaleY:o,x:s,y:l}=r,c=e.left-s-(1-a)*parseFloat(n),d=e.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),f=a?e.width/a:e.width,u=o?e.height/o:e.height;return{width:f,height:u,top:d,right:c+f,bottom:d+u,left:c}}const qE={ignoreTransform:!1};function dr(e,t){t===void 0&&(t=qE);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=et(e).getComputedStyle(e);d&&(n=WE(n,d,f))}const{top:r,left:a,width:o,height:s,bottom:l,right:c}=n;return{top:r,left:a,width:o,height:s,bottom:l,right:c}}function Mc(e){return dr(e,{ignoreTransform:!0})}function GE(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function YE(e,t){return t===void 0&&(t=et(e).getComputedStyle(e)),t.position==="fixed"}function XE(e,t){t===void 0&&(t=et(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const o=t[a];return typeof o=="string"?n.test(o):!1})}function bo(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(nl(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Wr(a)||Tp(a)||n.includes(a))return n;const o=et(e).getComputedStyle(a);return a!==e&&XE(a,o)&&n.push(a),YE(a,o)?n:r(a.parentNode)}return e?r(e):n}function Ip(e){const[t]=bo(e,1);return t??null}function es(e){return!vo||!e?null:lr(e)?e:tl(e)?nl(e)||e===cr(e).scrollingElement?window:Wr(e)?e:null:null}function Lp(e){return lr(e)?e.scrollX:e.scrollLeft}function Ap(e){return lr(e)?e.scrollY:e.scrollTop}function js(e){return{x:Lp(e),y:Ap(e)}}var Oe;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Oe||(Oe={}));function Mp(e){return!vo||!e?!1:e===document.scrollingElement}function Op(e){const t={x:0,y:0},n=Mp(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:a,isLeft:o,isBottom:s,isRight:l,maxScroll:r,minScroll:t}}const JE={x:.2,y:.2};function ZE(e,t,n,r,a){let{top:o,left:s,right:l,bottom:c}=n;r===void 0&&(r=10),a===void 0&&(a=JE);const{isTop:d,isBottom:f,isLeft:u,isRight:p}=Op(e),m={x:0,y:0},h={x:0,y:0},g={height:t.height*a.y,width:t.width*a.x};return!d&&o<=t.top+g.height?(m.y=Oe.Backward,h.y=r*Math.abs((t.top+g.height-o)/g.height)):!f&&c>=t.bottom-g.height&&(m.y=Oe.Forward,h.y=r*Math.abs((t.bottom-g.height-c)/g.height)),!p&&l>=t.right-g.width?(m.x=Oe.Forward,h.x=r*Math.abs((t.right-g.width-l)/g.width)):!u&&s<=t.left+g.width&&(m.x=Oe.Backward,h.x=r*Math.abs((t.left+g.width-s)/g.width)),{direction:m,speed:h}}function QE(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function _p(e){return e.reduce((t,n)=>Bn(t,js(n)),mt)}function eS(e){return e.reduce((t,n)=>t+Lp(n),0)}function tS(e){return e.reduce((t,n)=>t+Ap(n),0)}function nS(e,t){if(t===void 0&&(t=dr),!e)return;const{top:n,left:r,bottom:a,right:o}=t(e);Ip(e)&&(a<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const rS=[["x",["left","right"],eS],["y",["top","bottom"],tS]];class sl{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=bo(n),a=_p(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,l]of rS)for(const c of s)Object.defineProperty(this,c,{get:()=>{const d=l(r),f=a[o]-d;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Cr{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function aS(e){const{EventTarget:t}=et(e);return e instanceof t?e:cr(e)}function ts(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ut||(ut={}));function Oc(e){e.preventDefault()}function oS(e){e.stopPropagation()}var fe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(fe||(fe={}));const Fp={start:[fe.Space,fe.Enter],cancel:[fe.Esc],end:[fe.Space,fe.Enter,fe.Tab]},sS=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case fe.Right:return{...n,x:n.x+25};case fe.Left:return{...n,x:n.x-25};case fe.Down:return{...n,y:n.y+25};case fe.Up:return{...n,y:n.y-25}}};class Yr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Cr(cr(n)),this.windowListeners=new Cr(et(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&nS(r),n(mt)}handleKeyDown(t){if(al(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:o=Fp,coordinateGetter:s=sS,scrollBehavior:l="smooth"}=a,{code:c}=t;if(o.end.includes(c)){this.handleEnd(t);return}if(o.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:mt;this.referenceCoordinates||(this.referenceCoordinates=f);const u=s(t,{active:n,context:r.current,currentCoordinates:f});if(u){const p=Mr(u,f),m={x:0,y:0},{scrollableAncestors:h}=r.current;for(const g of h){const y=t.code,{isTop:w,isRight:b,isLeft:v,isBottom:C,maxScroll:N,minScroll:T}=Op(g),k=QE(g),L={x:Math.min(y===fe.Right?k.right-k.width/2:k.right,Math.max(y===fe.Right?k.left:k.left+k.width/2,u.x)),y:Math.min(y===fe.Down?k.bottom-k.height/2:k.bottom,Math.max(y===fe.Down?k.top:k.top+k.height/2,u.y))},R=y===fe.Right&&!b||y===fe.Left&&!v,P=y===fe.Down&&!C||y===fe.Up&&!w;if(R&&L.x!==u.x){const I=g.scrollLeft+p.x,S=y===fe.Right&&I<=N.x||y===fe.Left&&I>=T.x;if(S&&!p.y){g.scrollTo({left:I,behavior:l});return}S?m.x=g.scrollLeft-I:m.x=y===fe.Right?g.scrollLeft-N.x:g.scrollLeft-T.x,m.x&&g.scrollBy({left:-m.x,behavior:l});break}else if(P&&L.y!==u.y){const I=g.scrollTop+p.y,S=y===fe.Down&&I<=N.y||y===fe.Up&&I>=T.y;if(S&&!p.x){g.scrollTo({top:I,behavior:l});return}S?m.y=g.scrollTop-I:m.y=y===fe.Down?g.scrollTop-N.y:g.scrollTop-T.y,m.y&&g.scrollBy({top:-m.y,behavior:l});break}}this.handleMove(t,Bn(Mr(u,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Yr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Fp,onActivation:a}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const l=o.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function _c(e){return!!(e&&"distance"in e)}function Fc(e){return!!(e&&"delay"in e)}class il{constructor(t,n,r){var a;r===void 0&&(r=aS(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=cr(s),this.documentListeners=new Cr(this.document),this.listeners=new Cr(r),this.windowListeners=new Cr(et(s)),this.initialCoordinates=(a=zs(o))!=null?a:mt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.DragStart,Oc),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),this.windowListeners.add(ut.ContextMenu,Oc),this.documentListeners.add(ut.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Fc(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(_c(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ut.Click,oS,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ut.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:o}=this,{onMove:s,options:{activationConstraint:l}}=o;if(!a)return;const c=(n=zs(t))!=null?n:mt,d=Mr(a,c);if(!r&&l){if(_c(l)){if(l.tolerance!=null&&ts(d,l.tolerance))return this.handleCancel();if(ts(d,l.distance))return this.handleStart()}if(Fc(l)&&ts(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),s(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===fe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const iS={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Xr extends il{constructor(t){const{event:n}=t,r=cr(n.target);super(t,iS,r)}}Xr.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const lS={move:{name:"mousemove"},end:{name:"mouseup"}};var Vs;(function(e){e[e.RightClick=2]="RightClick"})(Vs||(Vs={}));class cS extends il{constructor(t){super(t,lS,cr(t.event.target))}}cS.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Vs.RightClick?!1:(r==null||r({event:n}),!0)}}];const ns={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dS extends il{constructor(t){super(t,ns)}static setup(){return window.addEventListener(ns.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ns.move.name,t)};function t(){}}}dS.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r==null||r({event:n}),!0)}}];var Nr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Nr||(Nr={}));var Ba;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ba||(Ba={}));function uS(e){let{acceleration:t,activator:n=Nr.Pointer,canScroll:r,draggingRect:a,enabled:o,interval:s=5,order:l=Ba.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:f,delta:u,threshold:p}=e;const m=pS({delta:u,disabled:!o}),[h,g]=NE(),y=M({x:0,y:0}),w=M({x:0,y:0}),b=Q(()=>{switch(n){case Nr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Nr.DraggableRect:return a}},[n,a,c]),v=M(null),C=H(()=>{const T=v.current;if(!T)return;const k=y.current.x*w.current.x,L=y.current.y*w.current.y;T.scrollBy(k,L)},[]),N=Q(()=>l===Ba.TreeOrder?[...d].reverse():d,[l,d]);O(()=>{if(!o||!d.length||!b){g();return}for(const T of N){if((r==null?void 0:r(T))===!1)continue;const k=d.indexOf(T),L=f[k];if(!L)continue;const{direction:R,speed:P}=ZE(T,L,b,t,p);for(const I of["x","y"])m[I][R[I]]||(P[I]=0,R[I]=0);if(P.x>0||P.y>0){g(),v.current=T,h(C,s),y.current=P,w.current=R;return}}y.current={x:0,y:0},w.current={x:0,y:0},g()},[t,C,r,g,o,s,JSON.stringify(b),JSON.stringify(m),h,d,N,f,JSON.stringify(p)])}const fS={x:{[Oe.Backward]:!1,[Oe.Forward]:!1},y:{[Oe.Backward]:!1,[Oe.Forward]:!1}};function pS(e){let{delta:t,disabled:n}=e;const r=Us(t);return qr(a=>{if(n||!r||!a)return fS;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Oe.Backward]:a.x[Oe.Backward]||o.x===-1,[Oe.Forward]:a.x[Oe.Forward]||o.x===1},y:{[Oe.Backward]:a.y[Oe.Backward]||o.y===-1,[Oe.Forward]:a.y[Oe.Forward]||o.y===1}}},[n,t,r])}function hS(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return qr(a=>{var o;return t==null?null:(o=r??a)!=null?o:null},[r,t])}function mS(e,t){return Q(()=>e.reduce((n,r)=>{const{sensor:a}=r,o=a.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var Or;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Or||(Or={}));var Hs;(function(e){e.Optimized="optimized"})(Hs||(Hs={}));const $c=new Map;function gS(e,t){let{dragging:n,dependencies:r,config:a}=t;const[o,s]=E(null),{frequency:l,measure:c,strategy:d}=a,f=M(e),u=y(),p=Ar(u),m=H(function(w){w===void 0&&(w=[]),!p.current&&s(b=>b===null?w:b.concat(w.filter(v=>!b.includes(v))))},[p]),h=M(null),g=qr(w=>{if(u&&!n)return $c;if(!w||w===$c||f.current!==e||o!=null){const b=new Map;for(let v of e){if(!v)continue;if(o&&o.length>0&&!o.includes(v.id)&&v.rect.current){b.set(v.id,v.rect.current);continue}const C=v.node.current,N=C?new sl(c(C),C):null;v.rect.current=N,N&&b.set(v.id,N)}return b}return w},[e,o,n,u,c]);return O(()=>{f.current=e},[e]),O(()=>{u||m()},[n,u]),O(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),O(()=>{u||typeof l!="number"||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},l))},[l,u,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:o!=null};function y(){switch(d){case Or.Always:return!1;case Or.BeforeDragging:return n;default:return!n}}}function $p(e,t){return qr(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function yS(e,t){return $p(e,t)}function vS(e){let{callback:t,disabled:n}=e;const r=rl(t),a=Q(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return O(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function xo(e){let{callback:t,disabled:n}=e;const r=rl(t),a=Q(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return O(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function bS(e){return new sl(dr(e),e)}function Bc(e,t,n){t===void 0&&(t=bS);const[r,a]=E(null);function o(){a(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const f=t(e);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const s=vS({callback(c){if(e)for(const d of c){const{type:f,target:u}=d;if(f==="childList"&&u instanceof HTMLElement&&u.contains(e)){o();break}}}}),l=xo({callback:o});return Dt(()=>{o(),e?(l==null||l.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),s==null||s.disconnect())},[e]),r}function xS(e){const t=$p(e);return Dp(e,t)}const Uc=[];function wS(e){const t=M(e),n=qr(r=>e?r&&r!==Uc&&e&&t.current&&e.parentNode===t.current.parentNode?r:bo(e):Uc,[e]);return O(()=>{t.current=e},[e]),n}function CS(e){const[t,n]=E(null),r=M(e),a=H(o=>{const s=es(o.target);s&&n(l=>l?(l.set(s,js(s)),new Map(l)):null)},[]);return O(()=>{const o=r.current;if(e!==o){s(o);const l=e.map(c=>{const d=es(c);return d?(d.addEventListener("scroll",a,{passive:!0}),[d,js(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{s(e),s(o)};function s(l){l.forEach(c=>{const d=es(c);d==null||d.removeEventListener("scroll",a)})}},[a,e]),Q(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>Bn(o,s),mt):_p(e):mt,[e,t])}function zc(e,t){t===void 0&&(t=[]);const n=M(null);return O(()=>{n.current=null},t),O(()=>{const r=e!==mt;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Mr(e,n.current):mt}function NS(e){O(()=>{if(!vo)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function ES(e,t){return Q(()=>e.reduce((n,r)=>{let{eventName:a,handler:o}=r;return n[a]=s=>{o(s,t)},n},{}),[e,t])}function Bp(e){return Q(()=>e?GE(e):null,[e])}const jc=[];function SS(e,t){t===void 0&&(t=dr);const[n]=e,r=Bp(n?et(n):null),[a,o]=E(jc);function s(){o(()=>e.length?e.map(c=>Mp(c)?r:new sl(t(c),c)):jc)}const l=xo({callback:s});return Dt(()=>{l==null||l.disconnect(),s(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),a}function TS(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Wr(t)?t:e}function kS(e){let{measure:t}=e;const[n,r]=E(null),a=H(d=>{for(const{target:f}of d)if(Wr(f)){r(u=>{const p=t(f);return u?{...u,width:p.width,height:p.height}:p});break}},[t]),o=xo({callback:a}),s=H(d=>{const f=TS(d);o==null||o.disconnect(),f&&(o==null||o.observe(f)),r(f?t(f):null)},[t,o]),[l,c]=Fa(s);return Q(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const RS=[{sensor:Xr,options:{}},{sensor:Yr,options:{}}],PS={current:{}},ba={draggable:{measure:Mc},droppable:{measure:Mc,strategy:Or.WhileDragging,frequency:Hs.Optimized},dragOverlay:{measure:dr}};class Er extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const DS={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Er,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:$a},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ba,measureDroppableContainers:$a,windowRect:null,measuringScheduled:!1},IS={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:$a,draggableNodes:new Map,over:null,measureDroppableContainers:$a},wo=Te(IS),Up=Te(DS);function LS(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Er}}}function AS(e,t){switch(t.type){case Ae.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ae.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ae.DragEnd:case Ae.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ae.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new Er(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case Ae.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Er(e.droppable.containers);return s.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:s}}}case Ae.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const o=new Er(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function MS(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=ne(wo),o=Us(r),s=Us(n==null?void 0:n.id);return O(()=>{if(!t&&!r&&o&&s!=null){if(!al(o)||document.activeElement===o.target)return;const l=a.get(s);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[c.current,d.current]){if(!f)continue;const u=TE(f);if(u){u.focus();break}}})}},[r,t,a,s,o]),null}function OS(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,o)=>o({transform:a,...r}),n):n}function _S(e){return Q(()=>({draggable:{...ba.draggable,...e==null?void 0:e.draggable},droppable:{...ba.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ba.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function FS(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const o=M(!1),{x:s,y:l}=typeof a=="boolean"?{x:a,y:a}:a;Dt(()=>{if(!s&&!l||!t){o.current=!1;return}if(o.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=n(d),u=Dp(f,r);if(s||(u.x=0),l||(u.y=0),o.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const p=Ip(d);p&&p.scrollBy({top:u.y,left:u.x})}},[t,s,l,r,n])}const zp=Te({...mt,scaleX:1,scaleY:1});var tn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(tn||(tn={}));const Ua=xd(function(t){var n,r,a,o;let{id:s,accessibility:l,autoScroll:c=!0,children:d,sensors:f=RS,collisionDetection:u=zE,measuring:p,modifiers:m,...h}=t;const g=Cd(AS,void 0,LS),[y,w]=g,[b,v]=LE(),[C,N]=E(tn.Uninitialized),T=C===tn.Initialized,{draggable:{active:k,nodes:L,translate:R},droppable:{containers:P}}=y,I=k!=null?L.get(k):null,S=M({initial:null,translated:null}),A=Q(()=>{var Ke;return k!=null?{id:k,data:(Ke=I==null?void 0:I.data)!=null?Ke:PS,rect:S}:null},[k,I]),D=M(null),[U,z]=E(null),[B,_]=E(null),G=Ar(h,Object.values(h)),V=Gr("DndDescribedBy",s),ee=Q(()=>P.getEnabled(),[P]),Z=_S(p),{droppableRects:j,measureDroppableContainers:le,measuringScheduled:Ee}=gS(ee,{dragging:T,dependencies:[R.x,R.y],config:Z.droppable}),ge=hS(L,k),Le=Q(()=>B?zs(B):null,[B]),ue=fh(),F=yS(ge,Z.draggable.measure);FS({activeNode:k!=null?L.get(k):null,config:ue.layoutShiftCompensation,initialRect:F,measure:Z.draggable.measure});const q=Bc(ge,Z.draggable.measure,F),be=Bc(ge?ge.parentElement:null),Pe=M({activatorEvent:null,active:null,activeNode:ge,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),He=P.getNodeFor((n=Pe.current.over)==null?void 0:n.id),Be=kS({measure:Z.dragOverlay.measure}),Ue=(r=Be.nodeRef.current)!=null?r:ge,st=T?(a=Be.rect)!=null?a:q:null,hn=!!(Be.nodeRef.current&&Be.rect),kn=xS(hn?null:q),mn=Bp(Ue?et(Ue):null),it=wS(T?He??ge:null),Yt=SS(it),$=OS(m,{transform:{x:R.x-kn.x,y:R.y-kn.y,scaleX:1,scaleY:1},activatorEvent:B,active:A,activeNodeRect:q,containerNodeRect:be,draggingNodeRect:st,over:Pe.current.over,overlayNodeRect:Be.rect,scrollableAncestors:it,scrollableAncestorRects:Yt,windowRect:mn}),te=Le?Bn(Le,R):null,ce=CS(it),we=zc(ce),vt=zc(ce,[q]),lt=Bn($,we),Je=st?HE(st,$):null,ur=A&&Je?u({active:A,collisionRect:Je,droppableRects:j,droppableContainers:ee,pointerCoordinates:te}):null,ul=Pp(ur,"id"),[Xt,fl]=E(null),ih=hn?$:Bn($,vt),lh=jE(ih,(o=Xt==null?void 0:Xt.rect)!=null?o:null,q),Co=M(null),pl=H((Ke,tt)=>{let{sensor:nt,options:Jt}=tt;if(D.current==null)return;const ct=L.get(D.current);if(!ct)return;const rt=Ke.nativeEvent,bt=new nt({active:D.current,activeNode:ct,event:rt,options:Jt,context:Pe,onAbort(ze){if(!L.get(ze))return;const{onDragAbort:xt}=G.current,Mt={id:ze};xt==null||xt(Mt),b({type:"onDragAbort",event:Mt})},onPending(ze,Zt,xt,Mt){if(!L.get(ze))return;const{onDragPending:pr}=G.current,Qt={id:ze,constraint:Zt,initialCoordinates:xt,offset:Mt};pr==null||pr(Qt),b({type:"onDragPending",event:Qt})},onStart(ze){const Zt=D.current;if(Zt==null)return;const xt=L.get(Zt);if(!xt)return;const{onDragStart:Mt}=G.current,fr={activatorEvent:rt,active:{id:Zt,data:xt.data,rect:S}};Zr(()=>{Mt==null||Mt(fr),N(tn.Initializing),w({type:Ae.DragStart,initialCoordinates:ze,active:Zt}),b({type:"onDragStart",event:fr}),z(Co.current),_(rt)})},onMove(ze){w({type:Ae.DragMove,coordinates:ze})},onEnd:Rn(Ae.DragEnd),onCancel:Rn(Ae.DragCancel)});Co.current=bt;function Rn(ze){return async function(){const{active:xt,collisions:Mt,over:fr,scrollAdjustedTranslate:pr}=Pe.current;let Qt=null;if(xt&&pr){const{cancelDrop:hr}=G.current;Qt={activatorEvent:rt,active:xt,collisions:Mt,delta:pr,over:fr},ze===Ae.DragEnd&&typeof hr=="function"&&await Promise.resolve(hr(Qt))&&(ze=Ae.DragCancel)}D.current=null,Zr(()=>{w({type:ze}),N(tn.Uninitialized),fl(null),z(null),_(null),Co.current=null;const hr=ze===Ae.DragEnd?"onDragEnd":"onDragCancel";if(Qt){const No=G.current[hr];No==null||No(Qt),b({type:hr,event:Qt})}})}}},[L]),ch=H((Ke,tt)=>(nt,Jt)=>{const ct=nt.nativeEvent,rt=L.get(Jt);if(D.current!==null||!rt||ct.dndKit||ct.defaultPrevented)return;const bt={active:rt};Ke(nt,tt.options,bt)===!0&&(ct.dndKit={capturedBy:tt.sensor},D.current=Jt,pl(nt,tt))},[L,pl]),hl=mS(f,ch);NS(f),Dt(()=>{q&&C===tn.Initializing&&N(tn.Initialized)},[q,C]),O(()=>{const{onDragMove:Ke}=G.current,{active:tt,activatorEvent:nt,collisions:Jt,over:ct}=Pe.current;if(!tt||!nt)return;const rt={active:tt,activatorEvent:nt,collisions:Jt,delta:{x:lt.x,y:lt.y},over:ct};Zr(()=>{Ke==null||Ke(rt),b({type:"onDragMove",event:rt})})},[lt.x,lt.y]),O(()=>{const{active:Ke,activatorEvent:tt,collisions:nt,droppableContainers:Jt,scrollAdjustedTranslate:ct}=Pe.current;if(!Ke||D.current==null||!tt||!ct)return;const{onDragOver:rt}=G.current,bt=Jt.get(ul),Rn=bt&&bt.rect.current?{id:bt.id,rect:bt.rect.current,data:bt.data,disabled:bt.disabled}:null,ze={active:Ke,activatorEvent:tt,collisions:nt,delta:{x:ct.x,y:ct.y},over:Rn};Zr(()=>{fl(Rn),rt==null||rt(ze),b({type:"onDragOver",event:ze})})},[ul]),Dt(()=>{Pe.current={activatorEvent:B,active:A,activeNode:ge,collisionRect:Je,collisions:ur,droppableRects:j,draggableNodes:L,draggingNode:Ue,draggingNodeRect:st,droppableContainers:P,over:Xt,scrollableAncestors:it,scrollAdjustedTranslate:lt},S.current={initial:st,translated:Je}},[A,ge,ur,Je,L,Ue,st,j,P,Xt,it,lt]),uS({...ue,delta:R,draggingRect:Je,pointerCoordinates:te,scrollableAncestors:it,scrollableAncestorRects:Yt});const dh=Q(()=>({active:A,activeNode:ge,activeNodeRect:q,activatorEvent:B,collisions:ur,containerNodeRect:be,dragOverlay:Be,draggableNodes:L,droppableContainers:P,droppableRects:j,over:Xt,measureDroppableContainers:le,scrollableAncestors:it,scrollableAncestorRects:Yt,measuringConfiguration:Z,measuringScheduled:Ee,windowRect:mn}),[A,ge,q,B,ur,be,Be,L,P,j,Xt,le,it,Yt,Z,Ee,mn]),uh=Q(()=>({activatorEvent:B,activators:hl,active:A,activeNodeRect:q,ariaDescribedById:{draggable:V},dispatch:w,draggableNodes:L,over:Xt,measureDroppableContainers:le}),[B,hl,A,q,w,V,L,Xt,le]);return Ze.createElement(Rp.Provider,{value:v},Ze.createElement(wo.Provider,{value:uh},Ze.createElement(Up.Provider,{value:dh},Ze.createElement(zp.Provider,{value:lh},d)),Ze.createElement(MS,{disabled:(l==null?void 0:l.restoreFocus)===!1})),Ze.createElement(OE,{...l,hiddenTextDescribedById:V}));function fh(){const Ke=(U==null?void 0:U.autoScrollEnabled)===!1,tt=typeof c=="object"?c.enabled===!1:c===!1,nt=T&&!Ke&&!tt;return typeof c=="object"?{...c,enabled:nt}:{enabled:nt}}}),$S=Te(null),Vc="button",BS="Draggable";function US(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const o=Gr(BS),{activators:s,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:f,draggableNodes:u,over:p}=ne(wo),{role:m=Vc,roleDescription:h="draggable",tabIndex:g=0}=a??{},y=(c==null?void 0:c.id)===t,w=ne(y?zp:$S),[b,v]=Fa(),[C,N]=Fa(),T=ES(s,t),k=Ar(n);Dt(()=>(u.set(t,{id:t,key:o,node:b,activatorNode:C,data:k}),()=>{const R=u.get(t);R&&R.key===o&&u.delete(t)}),[u,t]);const L=Q(()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":y&&m===Vc?!0:void 0,"aria-roledescription":h,"aria-describedby":f.draggable}),[r,m,g,y,h,f.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:L,isDragging:y,listeners:r?void 0:T,node:b,over:p,setNodeRef:v,setActivatorNodeRef:N,transform:w}}function zS(){return ne(Up)}const jS="Droppable",VS={timeout:25};function HS(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const o=Gr(jS),{active:s,dispatch:l,over:c,measureDroppableContainers:d}=ne(wo),f=M({disabled:n}),u=M(!1),p=M(null),m=M(null),{disabled:h,updateMeasurementsFor:g,timeout:y}={...VS,...a},w=Ar(g??r),b=H(()=>{if(!u.current){u.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),m.current=null},y)},[y]),v=xo({callback:b,disabled:h||!s}),C=H((L,R)=>{v&&(R&&(v.unobserve(R),u.current=!1),L&&v.observe(L))},[v]),[N,T]=Fa(C),k=Ar(t);return O(()=>{!v||!N.current||(v.disconnect(),u.current=!1,v.observe(N.current))},[N,v]),O(()=>(l({type:Ae.RegisterDroppable,element:{id:r,key:o,disabled:n,node:N,rect:p,data:k}}),()=>l({type:Ae.UnregisterDroppable,key:o,id:r})),[r]),O(()=>{n!==f.current.disabled&&(l({type:Ae.SetDroppableDisabled,id:r,key:o,disabled:n}),f.current.disabled=n)},[r,o,n,l]),{active:s,rect:p,isOver:(c==null?void 0:c.id)===r,node:N,over:c,setNodeRef:T}}function Kn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function KS(e,t){return e.reduce((n,r,a)=>{const o=t.get(r);return o&&(n[a]=o),n},Array(e.length))}function da(e){return e!==null&&e>=0}function WS(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function qS(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const jp=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e;const o=Kn(t,r,n),s=t[a],l=o[a];return!l||!s?null:{x:l.left-s.left,y:l.top-s.top,scaleX:l.width/s.width,scaleY:l.height/s.height}},ua={scaleX:1,scaleY:1},za=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:a,rects:o,overIndex:s}=e;const l=(t=o[n])!=null?t:r;if(!l)return null;if(a===n){const d=o[s];return d?{x:0,y:n<s?d.top+d.height-(l.top+l.height):d.top-l.top,...ua}:null}const c=GS(o,a,n);return a>n&&a<=s?{x:0,y:-l.height-c,...ua}:a<n&&a>=s?{x:0,y:l.height+c,...ua}:{x:0,y:0,...ua}};function GS(e,t,n){const r=e[t],a=e[t-1],o=e[t+1];return r?n<t?a?r.top-(a.top+a.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):a?r.top-(a.top+a.height):0:0}const Vp="Sortable",Hp=Ze.createContext({activeIndex:-1,containerId:Vp,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:jp,disabled:{draggable:!1,droppable:!1}});function ja(e){let{children:t,id:n,items:r,strategy:a=jp,disabled:o=!1}=e;const{active:s,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:f}=zS(),u=Gr(Vp,n),p=l.rect!==null,m=Q(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),h=s!=null,g=s?m.indexOf(s.id):-1,y=d?m.indexOf(d.id):-1,w=M(m),b=!WS(m,w.current),v=y!==-1&&g===-1||b,C=qS(o);Dt(()=>{b&&h&&f(m)},[b,m,h,f]),O(()=>{w.current=m},[m]);const N=Q(()=>({activeIndex:g,containerId:u,disabled:C,disableTransforms:v,items:m,overIndex:y,useDragOverlay:p,sortedRects:KS(m,c),strategy:a}),[g,u,C.draggable,C.droppable,v,m,y,c,p,a]);return Ze.createElement(Hp.Provider,{value:N},t)}const YS=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return Kn(n,r,a).indexOf(t)},XS=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:o,newIndex:s,previousItems:l,previousContainerId:c,transition:d}=e;return!d||!r||l!==o&&a===s?!1:n?!0:s!==a&&t===c},JS={duration:200,easing:"ease"},Kp="transform",ZS=Cn.Transition.toString({property:Kp,duration:0,easing:"linear"}),QS={roleDescription:"sortable"};function eT(e){let{disabled:t,index:n,node:r,rect:a}=e;const[o,s]=E(null),l=M(n);return Dt(()=>{if(!t&&n!==l.current&&r.current){const c=a.current;if(c){const d=dr(r.current,{ignoreTransform:!0}),f={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(f.x||f.y)&&s(f)}}n!==l.current&&(l.current=n)},[t,n,r,a]),O(()=>{o&&s(null)},[o]),o}function ll(e){let{animateLayoutChanges:t=XS,attributes:n,disabled:r,data:a,getNewIndex:o=YS,id:s,strategy:l,resizeObserverConfig:c,transition:d=JS}=e;const{items:f,containerId:u,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:y,useDragOverlay:w,strategy:b}=ne(Hp),v=tT(r,m),C=f.indexOf(s),N=Q(()=>({sortable:{containerId:u,index:C,items:f},...a}),[u,a,C,f]),T=Q(()=>f.slice(f.indexOf(s)),[f,s]),{rect:k,node:L,isOver:R,setNodeRef:P}=HS({id:s,data:N,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...c}}),{active:I,activatorEvent:S,activeNodeRect:A,attributes:D,setNodeRef:U,listeners:z,isDragging:B,over:_,setActivatorNodeRef:G,transform:V}=US({id:s,data:N,attributes:{...QS,...n},disabled:v.draggable}),ee=CE(P,U),Z=!!I,j=Z&&!h&&da(p)&&da(y),le=!w&&B,Ee=le&&j?V:null,Le=j?Ee??(l??b)({rects:g,activeNodeRect:A,activeIndex:p,overIndex:y,index:C}):null,ue=da(p)&&da(y)?o({id:s,items:f,activeIndex:p,overIndex:y}):C,F=I==null?void 0:I.id,q=M({activeId:F,items:f,newIndex:ue,containerId:u}),be=f!==q.current.items,Pe=t({active:I,containerId:u,isDragging:B,isSorting:Z,id:s,index:C,items:f,newIndex:q.current.newIndex,previousItems:q.current.items,previousContainerId:q.current.containerId,transition:d,wasDragging:q.current.activeId!=null}),He=eT({disabled:!Pe,index:C,node:L,rect:k});return O(()=>{Z&&q.current.newIndex!==ue&&(q.current.newIndex=ue),u!==q.current.containerId&&(q.current.containerId=u),f!==q.current.items&&(q.current.items=f)},[Z,ue,u,f]),O(()=>{if(F===q.current.activeId)return;if(F!=null&&q.current.activeId==null){q.current.activeId=F;return}const Ue=setTimeout(()=>{q.current.activeId=F},50);return()=>clearTimeout(Ue)},[F]),{active:I,activeIndex:p,attributes:D,data:N,rect:k,index:C,newIndex:ue,items:f,isOver:R,isSorting:Z,isDragging:B,listeners:z,node:L,overIndex:y,over:_,setNodeRef:ee,setActivatorNodeRef:G,setDroppableNodeRef:P,setDraggableNodeRef:U,transform:He??Le,transition:Be()};function Be(){if(He||be&&q.current.newIndex===C)return ZS;if(!(le&&!al(S)||!d)&&(Z||Pe))return Cn.Transition.toString({...d,property:Kp})}}function tT(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function Va(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const nT=[fe.Down,fe.Right,fe.Up,fe.Left],cl=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:a,droppableContainers:o,over:s,scrollableAncestors:l}}=t;if(nT.includes(e.code)){if(e.preventDefault(),!n||!r)return;const c=[];o.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const p=a.get(u.id);if(p)switch(e.code){case fe.Down:r.top<p.top&&c.push(u);break;case fe.Up:r.top>p.top&&c.push(u);break;case fe.Left:r.left>p.left&&c.push(u);break;case fe.Right:r.left<p.left&&c.push(u);break}});const d=BE({collisionRect:r,droppableRects:a,droppableContainers:c});let f=Pp(d,"id");if(f===(s==null?void 0:s.id)&&d.length>1&&(f=d[1].id),f!=null){const u=o.get(n.id),p=o.get(f),m=p?a.get(p.id):null,h=p==null?void 0:p.node.current;if(h&&m&&u&&p){const y=bo(h).some((T,k)=>l[k]!==T),w=Wp(u,p),b=rT(u,p),v=y||!w?{x:0,y:0}:{x:b?r.width-m.width:0,y:b?r.height-m.height:0},C={x:m.left,y:m.top};return v.x&&v.y?C:Mr(C,v)}}}};function Wp(e,t){return!Va(e)||!Va(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function rT(e,t){return!Va(e)||!Va(t)||!Wp(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const fa=50;function qp(e){const[t,n]=E([]),[r,a]=E(void 0),[o,s]=E(!0),[l,c]=E(!1),[d,f]=E(!1),[u,p]=E(null),m=M(!1),h=H(async()=>{if(!m.current){m.current=!0,c(!0),p(null);try{const y=e===null?await Pc({cursor:r,limit:fa}):await Dc(e,{cursor:r,limit:fa});n(w=>[...w,...y.items]),a(y.nextCursor??void 0),s(y.nextCursor!==null),f(!0)}catch(y){p(y instanceof Error?y.message:String(y))}finally{m.current=!1,c(!1)}}},[e,r]),g=H(async()=>{if(!m.current){m.current=!0,c(!0),p(null);try{const y=e===null?await Pc({cursor:void 0,limit:fa}):await Dc(e,{cursor:void 0,limit:fa});n(y.items),a(y.nextCursor??void 0),s(y.nextCursor!==null),f(!0)}catch(y){p(y instanceof Error?y.message:String(y))}finally{m.current=!1,c(!1)}}},[e]);return{items:t,setItems:n,hasMore:o,loading:l,loaded:d,error:u,loadMore:h,reload:g}}function Ha({node:e,onSelect:t,onCreateChild:n,onDeleted:r,refreshSignal:a,selectedId:o=null,sortable:s=!1,documentTypes:l=[]}){const{t:c,i18n:d}=ae(),[f,u]=E(!1),{items:p,setItems:m,hasMore:h,loading:g,loaded:y,error:w,loadMore:b,reload:v}=qp(e.id),{attributes:C,listeners:N,setNodeRef:T,transform:k,transition:L,isDragging:R}=ll({id:e.id}),P=ol(Hn(Xr),Hn(Yr,{coordinateGetter:cl})),[I,S]=E(null),[A,D]=E(null),[U,z]=E(!1),[B,_]=E(!1),G=M(null);function V(){z(!1),S(null),D(null),_(!1)}async function ee(){z(!0),S(null),D(null);try{const F=await Ic(e.id,{});if(F.ok){r(e,F.trashedCount),V();return}S({nodeName:F.nodeName,descendantCount:F.descendantCount})}catch(F){D(F instanceof ve?F.message:c("contentTree.deleteError",{name:e.path}))}}async function Z(){if(!(!I||B)){_(!0),D(null);try{const F=await Ic(e.id,{confirm:!0});if(!F.ok)return;r(e,F.trashedCount),V()}catch(F){D(F instanceof ve?F.message:c("contentTree.deleteError",{name:I.nodeName})),_(!1)}}}function j(){const F=!f;u(F),F&&!y&&!g&&b()}O(()=>{a&&a.parentId===e.id&&v()},[a==null?void 0:a.token]);function le(F){const{active:q,over:be}=F;if(!be||q.id===be.id)return;const Pe=p.findIndex(Ue=>Ue.id===q.id),He=p.findIndex(Ue=>Ue.id===be.id);if(Pe===-1||He===-1)return;const Be=Kn(p,Pe,He);m(Be),YN(e.id,Be.map(Ue=>Ue.id)).catch(()=>{J({variant:"danger",title:c("contentTree.reorderError")}),v()})}const Ee=!h&&p.length>1,ge=l.find(F=>F.id===e.documentTypeId),Le=Ji(ge==null?void 0:ge.icon),ue=s?{transform:Cn.Transform.toString(k),transition:L,opacity:R?.5:1}:void 0;return x("li",{ref:s?T:void 0,style:ue,children:[x("div",{className:se("group flex h-8 items-center gap-1 rounded-md border-s-2 pe-1 transition-colors duration-fast",e.id===o?Np:Xi),children:[s&&i("button",{type:"button","aria-label":c("contentTree.dragHandle",{name:$t(e)}),className:"cursor-grab touch-none rounded-md p-1 text-text-secondary hover:bg-background-hover",...C,...N,children:i(qi,{"aria-hidden":"true",className:"size-4"})}),i("button",{type:"button",onClick:j,"aria-expanded":f,"aria-label":c("contentTree.toggle",{name:$t(e)}),className:"rounded-md p-1 text-text-secondary transition-colors duration-fast hover:bg-background-hover hover:text-text-primary",children:i(sn,{"aria-hidden":"true",className:se("size-4 shrink-0 transition-transform duration-fast",f?"rotate-90":"rtl:rotate-180")})}),i("span",{"data-icon":Zi(ge==null?void 0:ge.icon),className:"text-text-secondary",children:i(Le,{"aria-hidden":!0,className:"size-4 shrink-0"})}),i("button",{type:"button",onClick:()=>t(e),"aria-current":e.id===o?"page":void 0,className:"min-w-0 flex-1 truncate rounded-md px-2 py-1 text-start text-sm",children:$t(e)}),i("button",{type:"button","aria-label":c("contentTree.createChild",{name:$t(e)}),onClick:()=>n(e),className:"grid size-6 shrink-0 place-items-center rounded-md text-text-secondary opacity-0 transition-opacity duration-fast hover:bg-background-hover hover:text-text-primary focus-visible:opacity-100 group-hover:opacity-100",children:i(_a,{"aria-hidden":"true",className:"size-4"})}),x(_i,{children:[i(Fi,{asChild:!0,children:i("button",{ref:G,type:"button","aria-label":c("contentTree.rowActionsAria",{name:$t(e)}),className:"grid size-6 shrink-0 place-items-center rounded-md text-text-secondary opacity-0 transition-opacity duration-fast hover:bg-background-hover hover:text-text-primary focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100",children:i(mp,{"aria-hidden":"true",className:"size-4"})})}),i($i,{align:d.dir()==="rtl"?"start":"end",children:i(La,{variant:"destructive",onSelect:()=>void ee(),children:c("contentTree.deleteAction")})})]})]}),i(Jn,{open:U,onOpenChange:F=>!F&&V(),children:x(Zn,{onEscapeKeyDown:F=>{B&&F.preventDefault()},onCloseAutoFocus:F=>{var q;F.preventDefault(),(q=G.current)==null||q.focus()},children:[x(Qn,{children:[i(tr,{children:c("contentTree.deleteTitle",{name:(I==null?void 0:I.nodeName)??e.path})}),I&&i(nr,{children:c("contentTree.deleteBody",{name:I.nodeName,count:I.descendantCount})})]}),A&&i("p",{role:"alert",className:"text-sm text-danger-600",children:A}),x(er,{children:[i(ar,{disabled:B,children:c("contentTree.deleteCancel")}),I&&i(rr,{disabled:B,className:Tt({variant:"destructive"}),onClick:F=>{F.preventDefault(),Z()},children:c("contentTree.deleteConfirm",{total:I.descendantCount+1})})]})]})}),f&&x("ul",{className:"ms-4 flex flex-col gap-1 border-s border-border-subtle ps-2",children:[Ee?i(Ua,{sensors:P,onDragEnd:le,children:i(ja,{items:p.map(F=>F.id),strategy:za,children:p.map(F=>i(Ha,{node:F,onSelect:t,onCreateChild:n,onDeleted:r,refreshSignal:a,selectedId:o,documentTypes:l,sortable:!0},F.id))})}):p.map(F=>i(Ha,{node:F,onSelect:t,onCreateChild:n,onDeleted:r,refreshSignal:a,selectedId:o,documentTypes:l},F.id)),y&&p.length===0&&!w&&i("li",{className:"px-2 py-1 text-xs text-text-secondary",children:c("contentTree.empty")}),w&&i("li",{className:"px-2 py-1 text-xs text-danger-600",children:w}),h&&i("li",{children:i(K,{variant:"ghost",size:"sm",disabled:g,onClick:()=>void b(),children:c(g?"contentTree.loading":"contentTree.loadMore")})})]})]})}const aT=10;function oT({onSelect:e,refreshSignal:t}){const{t:n}=ae(),{user:r}=Tn(),a=(r==null?void 0:r.role)==="admin",[o,s]=E(null),[l,c]=E(!1);return O(()=>{if(!a)return;let d=!1;return Fs(void 0,aT).then(({items:f,nextCursor:u})=>{d||(s(f.length),c(!!u))}).catch(()=>{d||(s(null),c(!1))}),()=>{d=!0}},[a,t==null?void 0:t.token]),i("div",{className:"mt-2 border-t border-border-subtle pt-2",children:x("button",{type:"button",onClick:e,className:se(Cp,"h-8",Xi,"text-text-secondary"),children:[i(DN,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("span",{className:"min-w-0 flex-1 truncate",children:n("trash.recycleBin")}),!!o&&i(de,{variant:"neutral",children:l?`${o}+`:o})]})})}function sT({onSelect:e,onCreateChild:t,onDeleted:n,onSelectTrash:r,refreshSignal:a,selectedId:o,documentTypes:s=[]}){const{t:l}=ae(),{items:c,setItems:d,hasMore:f,loading:u,loaded:p,error:m,loadMore:h,reload:g}=qp(null),y=ol(Hn(Xr),Hn(Yr,{coordinateGetter:cl}));O(()=>{!p&&!u&&h()},[]),O(()=>{a&&a.parentId===null&&g()},[a==null?void 0:a.token]);function w(C){const{active:N,over:T}=C;if(!T||N.id===T.id)return;const k=c.findIndex(P=>P.id===N.id),L=c.findIndex(P=>P.id===T.id);if(k===-1||L===-1)return;const R=Kn(c,k,L);d(R),GN(R.map(P=>P.id)).catch(()=>{J({variant:"danger",title:l("contentTree.reorderError")}),g()})}const b=!f&&c.length>1;let v;return u&&!p?v=x("div",{"aria-label":l("contentTree.loading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-6 w-3/4"}),i(pe,{className:"h-6 w-2/3"}),i(pe,{className:"h-6 w-1/2"})]}):p&&c.length===0&&!m?v=i(ke,{icon:i(Wi,{"aria-hidden":"true"}),title:l("contentTree.empty"),description:l("contentTree.emptyDescription")}):v=x("div",{className:"flex flex-col gap-2",children:[i("ul",{className:"flex flex-col gap-1",children:b?i(Ua,{sensors:y,onDragEnd:w,children:i(ja,{items:c.map(C=>C.id),strategy:za,children:c.map(C=>i(Ha,{node:C,onSelect:e,onCreateChild:t,onDeleted:n,refreshSignal:a,selectedId:o,documentTypes:s,sortable:!0},C.id))})}):c.map(C=>i(Ha,{node:C,onSelect:e,onCreateChild:t,onDeleted:n,refreshSignal:a,selectedId:o,documentTypes:s},C.id))}),m&&i("p",{className:"text-xs text-danger-600",children:m}),f&&i(K,{variant:"outline",size:"sm",disabled:u,onClick:()=>void h(),children:l(u?"contentTree.loading":"contentTree.loadMore")})]}),x("div",{className:"flex flex-col gap-2",children:[v,i(oT,{onSelect:r,refreshSignal:a})]})}function At({crumb:e,title:t,meta:n,actions:r}){const a=ir();return x("div",{className:"shrink-0 px-8 pb-4 pt-6",children:[i("p",{className:"flex items-center gap-1 text-xs text-text-tertiary",children:e.map((o,s)=>x("span",{className:"flex items-center gap-1",children:[s>0&&i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 rtl:rotate-180"}),o]},s))}),x("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:a,className:"text-2xl font-semibold tracking-tight text-text-primary focus:outline-none",children:t}),r&&i("span",{className:"ms-auto flex items-center gap-2",children:r})]}),n&&i("p",{className:"mt-1 text-sm text-text-secondary",children:n})]})}function iT(e){if(e&&typeof e=="object"&&"status"in e&&e.status===409&&"blockingAncestorPath"in e){const t=e.blockingAncestorPath;if(typeof t=="string")return t}return null}function lT(e,t,n,r=Date.now()){const a=new Date(e).getTime();if(!Number.isFinite(a))return n;const o=a-r,s=new Intl.RelativeTimeFormat(t,{numeric:"always"}),l=Math.abs(o),c=6e4,d=60*c,f=24*d;return l<c?s.format(Math.round(o/1e3),"second"):l<d?s.format(Math.round(o/c),"minute"):l<f?s.format(Math.round(o/d),"hour"):s.format(Math.round(o/f),"day")}function cT({item:e,onRestored:t}){const{t:n,i18n:r}=ae(),[a,o]=E(!1),[s,l]=E(!1),[c,d]=E(null);async function f(){if(!s){l(!0),d(null);try{await oE(e.id),t(e.id)}catch(u){const p=iT(u);d(p?n("trash.restoreBlocked",{ancestor:p}):n("trash.restoreFailed")),l(!1),o(!1)}}}return x("li",{className:"flex flex-col gap-2 rounded-md border border-border-subtle px-3 py-2",children:[x("div",{className:"flex items-center justify-between gap-4",children:[x("div",{className:"min-w-0",children:[i("p",{className:"truncate text-sm font-medium text-text-primary",children:e.path}),i("p",{className:"text-xs text-text-secondary",children:n("trash.nodeCount",{count:e.nodeCount})}),i("p",{className:"text-xs text-text-secondary",children:n("trash.deletedAt",{when:lT(e.deletedAt,r.language,n("trash.unknownTime"))})}),e.orphaned&&x("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[i(de,{variant:"warning",children:n("trash.orphanedBadge")}),i("span",{className:"text-xs text-text-secondary",children:n("trash.orphanedExplain")})]})]}),a?i(K,{type:"button",variant:"destructive",size:"sm",disabled:s,onClick:()=>void f(),children:n("trash.restoreConfirm")}):i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>o(!0),children:n("trash.restore")})]}),c&&i("p",{role:"alert",className:"text-xs text-danger-600",children:c})]})}function dT({onRestored:e}={}){const{t}=ae();Re([t("trash.title"),t("nav.content")]);const[n,r]=E([]),[a,o]=E(null),[s,l]=E(!1),[c,d]=E(!1),f=H(async()=>{try{const{items:m,nextCursor:h}=await Fs();r(m),o(h),d(!1)}catch{d(!0)}finally{l(!0)}},[]);O(()=>{f()},[f]);async function u(){if(a)try{const{items:m,nextCursor:h}=await Fs(a);r(g=>[...g,...m]),o(h)}catch{d(!0)}}function p(m){r(h=>{const g=h.find(y=>y.id===m);return g&&(e==null||e(g)),h.filter(y=>y.id!==m)})}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[t("nav.content"),t("trash.title")],title:t("trash.title")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[s&&!c&&n.length===0&&i(ke,{title:t("trash.empty")}),s&&c&&x("div",{role:"alert",className:"flex flex-col items-start gap-2 rounded-md border border-danger-500 bg-background-elevated p-4",children:[i("p",{className:"text-sm font-medium text-danger-600",children:t("trash.loadFailed")}),i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>void f(),children:t("trash.retry")})]}),s&&!c&&n.length>0&&i("ul",{className:"flex flex-col gap-2",children:n.map(m=>i(cT,{item:m,onRestored:p},m.id))}),s&&!c&&a&&i(K,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void u(),children:t("contentTree.loadMore")})]})]})}function Hc(){const{t:e}=ae(),{nodeId:t}=Xn(),n=Wt(),[r,a]=E({mode:"welcome"}),[o,s]=E([]),[l,c]=E(null);O(()=>{Ep({limit:100}).then(({items:u})=>s(u)).catch(()=>s([]))},[]),O(()=>{a({mode:"welcome"})},[t]);const d=H(u=>{a({mode:"welcome"}),n(`/content/${u.id}`)},[n]),f=!!t&&r.mode==="welcome";return Re(f||r.mode!=="welcome"?[void 0]:[e("nav.content")]),x(Ie,{children:[i(Vn,{label:e("nav.content"),children:i(Bt,{title:e("nav.content"),action:i("button",{type:"button","aria-label":e("contentTree.newContent"),onClick:()=>a({mode:"create",parent:null}),className:"grid size-6 place-items-center rounded-md text-text-secondary transition-colors duration-fast hover:bg-background-hover hover:text-text-primary",children:i(_a,{"aria-hidden":"true",className:"size-4"})}),children:i(sT,{refreshSignal:l,selectedId:t??null,documentTypes:o,onSelect:d,onCreateChild:u=>a({mode:"create",parent:u}),onSelectTrash:()=>a({mode:"trash"}),onDeleted:(u,p)=>{J({variant:"success",title:e("contentTree.deletedToast",{total:p})}),c(m=>({token:((m==null?void 0:m.token)??0)+1,parentId:u.parentId})),t===u.id&&n("/content")}})})}),f?i(me,{flush:!0,children:i(wE,{nodeId:t,documentTypes:o})}):r.mode==="trash"?i(me,{flush:!0,children:i(dT,{onRestored:()=>c(u=>({token:((u==null?void 0:u.token)??0)+1,parentId:null}))})}):i(me,{children:r.mode==="create"?i(cE,{documentTypes:o,parent:r.parent,onCancel:()=>a({mode:"welcome"}),onCreated:u=>{c(p=>{var m;return{token:((p==null?void 0:p.token)??0)+1,parentId:((m=r.parent)==null?void 0:m.id)??null}}),d(u)}}):i(ke,{icon:i(Wi,{"aria-hidden":"true"}),title:e("contentSection.welcomeTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:e("contentSection.welcomeDescription")})})]})}function uT(){const{t:e}=ae(),t=Xe(),n=Wt(),[r,a]=E({state:"loading"});if(Re([r.state==="match"?e("headlessBridge.contentTitle"):r.state==="none"?e("headlessBridge.notFoundTitle"):e("headlessBridge.resolving")]),O(()=>{let o=!1;return a({state:"loading"}),qN(t.pathname).then(s=>{o||a(s?{state:"match",node:s}:{state:"none"})}).catch(()=>{o||a({state:"none"})}),()=>{o=!0}},[t.pathname]),r.state==="loading")return i(me,{children:i(ke,{title:e("headlessBridge.resolving"),titleAs:"h1"})});if(r.state==="match"){const o=`${window.location.origin}/api/v1/content/by-path?path=${encodeURIComponent(t.pathname)}`;return i(me,{children:i(ke,{icon:i(vp,{"aria-hidden":"true"}),title:e("headlessBridge.contentTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:e("headlessBridge.contentBody"),action:x("div",{className:"flex flex-col items-center gap-3",children:[x("div",{className:"max-w-lg text-start",children:[i("p",{className:"text-xs font-medium text-text-secondary",children:e("headlessBridge.apiUrlLabel")}),i("code",{className:"mt-1 block overflow-x-auto rounded-md border border-border-default bg-background-hover px-3 py-2 text-sm",children:o})]}),i(K,{type:"button",onClick:()=>n(`/content/${r.node.id}`),children:e("headlessBridge.openInEditor")})]})})})}return i(me,{children:i(ke,{icon:i(gC,{"aria-hidden":"true"}),title:e("headlessBridge.notFoundTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:e("headlessBridge.notFoundBody"),action:i(Ut,{to:"/content",className:se(Tt({variant:"outline",size:"sm"})),children:e("headlessBridge.backToContent")})})})}async function Kc(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit)),e.search&&t.set("search",e.search);const n=t.toString(),r=await X(`/api/media${n?`?${n}`:""}`);return oe(r)}async function fT(e){const t=new FormData;t.append("file",e);const n=await X("/api/media",{method:"POST",body:t});return oe(n)}async function pT(e){const t=await X(`/api/media/${e}`,{method:"DELETE"});await oe(t)}function hT(e){if(e<1024)return`${e} B`;const t=["KB","MB","GB"];let n=e,r="B";for(const a of t){if(n<1024)break;n/=1024,r=a}return`${n.toFixed(n>=10?0:1)} ${r}`}const Wc=24,mT=300;function gT(){const{t:e}=ae(),[t,n]=E([]),[r,a]=E(null),[o,s]=E(!1),[l,c]=E(!1),[d,f]=E(""),[u,p]=E(""),[m,h]=E(!1),[g,y]=E(!1),[w,b]=E(null),v=M(null),C=H(async R=>{c(!0);try{const{items:P,nextCursor:I}=await Kc({limit:Wc,search:R||void 0});n(P),a(I),s(!0)}catch{J({variant:"danger",title:e("mediaLibrary.genericError")})}finally{c(!1)}},[e]);O(()=>{const R=setTimeout(()=>p(d),mT);return()=>clearTimeout(R)},[d]),O(()=>{C(u)},[u,C]);async function N(){if(r){c(!0);try{const{items:R,nextCursor:P}=await Kc({cursor:r,limit:Wc,search:u||void 0});n(I=>[...I,...R]),a(P)}catch{J({variant:"danger",title:e("mediaLibrary.genericError")})}finally{c(!1)}}}async function T(R){const P=Array.from(R);if(P.length!==0){h(!0);try{for(const I of P)try{await fT(I),J({variant:"success",title:e("mediaLibrary.uploadedToast",{name:I.name})})}catch{J({variant:"danger",title:e("mediaLibrary.uploadFailedToast",{name:I.name})})}await C(u)}finally{h(!1)}}}function k(R){R.preventDefault(),y(!1),T(R.dataTransfer.files)}async function L(R){try{await pT(R.id),n(P=>P.filter(I=>I.id!==R.id)),b(null),J({variant:"success",title:e("mediaLibrary.deletedToast",{name:R.filename})})}catch{J({variant:"danger",title:e("mediaLibrary.genericError")})}}return x("div",{onDragOver:R=>{R.preventDefault(),y(!0)},onDragLeave:()=>y(!1),onDrop:k,className:se("flex h-full min-h-0 flex-col transition-colors duration-fast",g&&"bg-background-hover"),children:[i(At,{crumb:[e("nav.media"),e("mediaTree.all")],title:e("mediaTree.all"),actions:x(K,{type:"button",size:"sm",disabled:m,onClick:()=>{var R;return(R=v.current)==null?void 0:R.click()},children:[i(cC,{"aria-hidden":"true",className:"size-4"}),e(m?"mediaLibrary.uploading":"mediaLibrary.upload")]})}),i("input",{ref:v,type:"file",multiple:!0,className:"hidden","aria-label":e("mediaLibrary.upload"),onChange:R=>{R.target.files&&T(R.target.files),R.target.value=""}}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[x("div",{className:"flex flex-wrap items-center gap-3",children:[i(ye,{id:"media-search",type:"search","aria-label":e("mediaLibrary.searchLabel"),placeholder:e("mediaLibrary.searchPlaceholder"),value:d,onChange:R=>f(R.target.value),className:"max-w-sm"}),i("p",{className:"text-xs text-text-secondary",children:e("mediaLibrary.dropHint")})]}),!o&&l&&x("div",{"aria-label":e("contentTree.loading"),className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:[i(pe,{className:"h-40"}),i(pe,{className:"h-40"}),i(pe,{className:"h-40"}),i(pe,{className:"h-40"})]}),o&&t.length===0&&(u?i(ke,{icon:i(Ma,{"aria-hidden":"true"}),title:e("mediaLibrary.noResults",{search:u})}):i(ke,{icon:i(Ma,{"aria-hidden":"true"}),title:e("mediaLibrary.empty"),description:e("mediaLibrary.emptyDescription")})),t.length>0&&i("ul",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:t.map(R=>x("li",{className:"flex flex-col overflow-hidden rounded-md border border-border-default bg-background-elevated",children:[i("div",{className:"flex h-28 items-center justify-center overflow-hidden bg-background-base",children:R.mimeType.startsWith("image/")?i("img",{src:R.downloadUrl,alt:R.filename,className:"h-full w-full object-cover"}):i(gp,{"aria-hidden":"true",className:"size-8 text-text-secondary"})}),w===R.id?x("div",{className:"flex flex-col gap-2 p-3",children:[i("p",{className:"text-xs text-danger-600",children:e("mediaLibrary.confirmBody")}),x("div",{className:"flex items-center gap-2",children:[i(K,{type:"button",variant:"destructive",size:"sm",onClick:()=>void L(R),children:e("mediaLibrary.confirmDelete")}),i(K,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(null),children:e("mediaLibrary.cancel")})]})]}):x("div",{className:"flex items-center gap-2 p-3",children:[x("div",{className:"min-w-0 flex-1",children:[i("p",{className:"truncate text-sm text-text-primary",title:R.filename,children:R.filename}),i("p",{className:"text-xs text-text-secondary",children:hT(R.size)})]}),i(K,{type:"button",variant:"ghost",size:"sm","aria-label":e("mediaLibrary.deleteLabel",{name:R.filename}),onClick:()=>b(R.id),children:e("mediaLibrary.delete")})]})]},R.id))}),r&&i(K,{type:"button",variant:"outline",size:"sm",className:"self-start",disabled:l,onClick:()=>void N(),children:e("mediaLibrary.loadMore")})]})]})}async function Gp(){const e=await X("/api/plugins?limit=100");return(await oe(e)).items}function yT(e){const t=e.replace(/[^a-zA-Z0-9]/g,"_");return/^[0-9]/.test(t)?`plugin_${t}`:t}function vT(e,t){return new URL(e,t).href}async function bT(){let e;try{e=await Gp()}catch(t){console.error("bootRemotePlugins: failed to list installed plugins",t);return}for(const t of e)if(t.remoteUrl)try{const n=await ag({name:yT(t.pluginId),url:vT(t.remoteUrl,window.location.origin)});og(n),sg(n)}catch(n){console.error(`bootRemotePlugins: failed to load "${t.pluginId}" from ${t.remoteUrl}`,n)}}function xT(){return null}const Jr="/api/plugin-management/plugins";async function qc(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=await X(`${Jr}${n?`?${n}`:""}`);return oe(r)}async function wT(e){const t=await X(`${Jr}/${encodeURIComponent(e)}/activate`,{method:"POST"});await oe(t)}async function CT(e){const t=await X(`${Jr}/${encodeURIComponent(e)}/deactivate`,{method:"POST"});await oe(t)}async function NT(e){const t=await X(`${Jr}/${encodeURIComponent(e)}/license/recheck`,{method:"POST"});return oe(t)}async function ET(e,t={}){const n=await X(`${Jr}/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(n.ok){const r=await n.json().catch(()=>null);return r&&"memberSnapshots"in r?{ok:!0,snapshotGroupId:null,memberSnapshots:r.memberSnapshots}:{ok:!0,snapshotGroupId:r&&"snapshotGroupId"in r?r.snapshotGroupId:null}}if(n.status===409){const r=await n.json().catch(()=>null);if(r!=null&&r.requiresConfirmation&&r.snapshotGroupId)return{ok:!1,requiresConfirmation:!0,snapshotGroupId:r.snapshotGroupId,message:r.message??""};if(r!=null&&r.requiresConfirmation&&r.memberSnapshots)return{ok:!1,requiresConfirmation:!0,snapshotGroupId:null,memberSnapshots:r.memberSnapshots,message:r.message??""};throw new ve((r==null?void 0:r.message)??n.statusText,n.status,r==null?void 0:r.blockedBy)}throw await oe(n),new ve(n.statusText,n.status)}function ST({plugin:e,onClose:t,onUninstalled:n,onCloseAutoFocus:r}){const{t:a}=ae(),[o,s]=E("confirm"),[l,c]=E(null),[d,f]=E(null),[u,p]=E(!1),[m,h]=E(null),[g,y]=E(null),[w,b]=E(!1),v=M(0),C=M(!1);function N(k){C.current=k,b(k)}O(()=>{v.current+=1,s("confirm"),c(null),f(null),p(!1),h(null),y(null),N(!1)},[e]);async function T(){if(!e||C.current)return;const k=v.current;N(!0),h(null),y(null);try{const L=await ET(e.pluginId,o==="structured"?{confirmStructuredDataCleanup:!0}:{});if(v.current!==k)return;if(L.ok){if(n(),L.memberSnapshots&&L.memberSnapshots.length>0){f(L.memberSnapshots),p(!0);return}if(L.snapshotGroupId){c(L.snapshotGroupId),p(!0);return}t();return}s("structured"),c(L.snapshotGroupId),f(L.memberSnapshots??null)}catch(L){if(v.current!==k)return;h(L instanceof ve?L.message:a("pluginsManage.toggleFailed")),y(L instanceof ve?L.blockedBy??null:null)}finally{v.current===k&&N(!1)}}return i(Jn,{open:e!==null,onOpenChange:k=>!k&&t(),children:x(Zn,{onEscapeKeyDown:k=>{C.current&&k.preventDefault()},onCloseAutoFocus:r,children:[x(Qn,{children:[i(tr,{children:u?a("pluginsManage.uninstallDoneTitle",{name:(e==null?void 0:e.name)??""}):a("pluginsManage.uninstallTitle",{name:(e==null?void 0:e.name)??""})}),i(nr,{children:o==="structured"?d?a(u?"pluginsManage.uninstallBundleStructuredRestoreHint":"pluginsManage.uninstallBundleStructuredBody"):u?a("pluginsManage.uninstallStructuredRestoreHint",{snapshotGroupId:l??""}):a("pluginsManage.uninstallStructuredBody",{snapshotGroupId:l??""}):a("pluginsManage.uninstallBody")})]}),d&&d.length>0&&i("ul",{className:"flex flex-col gap-1",children:d.map(k=>i("li",{className:"text-sm",children:u?x(Ut,{to:`/plugin-management/installed/${encodeURIComponent(k.pluginId)}/snapshots`,state:{name:k.pluginId},onClick:t,className:"font-medium text-primary-600 underline-offset-4 hover:underline",children:[k.pluginId," — ",a("pluginsManage.snapshotsAction")]}):i("span",{className:"text-text-secondary",children:a("pluginsManage.uninstallBundleMemberSnapshot",{pluginId:k.pluginId,snapshotGroupId:k.snapshotGroupId})})},k.pluginId))}),u&&!d&&e&&i(Ut,{to:`/plugin-management/installed/${encodeURIComponent(e.pluginId)}/snapshots`,state:{name:e.name},onClick:t,className:"text-sm font-medium text-primary-600 underline-offset-4 hover:underline",children:a("pluginsManage.snapshotsAction")}),g&&g.length>0?x("div",{role:"alert",className:"text-sm text-danger-600",children:[i("p",{children:a("pluginsManage.uninstallBlockedLeadIn")}),i("ul",{className:"flex flex-col gap-0.5 ps-5 list-disc",children:g.map(k=>i("li",{children:k.contentCount!==void 0?a("pluginsManage.uninstallBlockedItemWithCount",{documentType:k.documentType,count:k.contentCount}):a("pluginsManage.uninstallBlockedItemNoCount",{documentType:k.documentType})},k.documentType))})]}):m&&i("p",{role:"alert",className:"text-sm text-danger-600",children:m}),x(er,{children:[i(ar,{disabled:w,children:a(u?"pluginsManage.uninstallClose":"pluginsManage.uninstallCancel")}),!u&&i(rr,{disabled:w,className:Tt({variant:"destructive"}),onClick:k=>{k.preventDefault(),T()},children:a(w?"pluginsManage.uninstalling":o==="structured"?"pluginsManage.uninstallStructuredConfirm":"pluginsManage.uninstallConfirm")})]})]})})}const Gc=50,Yc="grid grid-cols-[minmax(0,1fr)_4rem_6rem_6rem_11rem_2.75rem_6rem] items-center gap-3",TT=7;function kT(e,t=Date.now()){return e.licenseStatus!=="valid"||!e.licenseLastAttemptError?!1:e.licenseLastValidatedAt?t-new Date(e.licenseLastValidatedAt).getTime()>TT*24*60*60*1e3:!0}function Xc(e,t,n=Date.now()){const r=new Date(e).getTime()-n,a=new Intl.RelativeTimeFormat(t,{numeric:"always"}),o=Math.abs(r),s=6e4,l=60*s,c=24*l;return o<s?a.format(Math.round(r/1e3),"second"):o<l?a.format(Math.round(r/s),"minute"):o<c?a.format(Math.round(r/l),"hour"):a.format(Math.round(r/c),"day")}function RT({plugin:e,recheckPending:t,recheckError:n,onRecheck:r}){var c;const{t:a,i18n:o}=ae();if(e.licenseStatus===null)return i("span",{className:"justify-self-start text-text-secondary","aria-label":a("pluginsManage.licenseNone"),children:"—"});const s=kT(e);let l;if(e.licenseStatus==="revoked"){const d=(c=e.licenseReason)==null?void 0:c.trim(),u=!d||d.toLowerCase()==="revoked"?a("pluginsManage.licenseRevokedBare"):a("pluginsManage.licenseRevoked",{reason:d});l=i(de,{className:"max-w-full truncate",variant:"danger",title:u,children:u})}else if(e.licenseStatus==="domain_mismatch"){const d=e.boundDomain?a("pluginsManage.licenseDomainMismatch",{domain:e.boundDomain}):a("pluginsManage.licenseDomainMismatchBare");l=i(de,{className:"max-w-full truncate",variant:"warning",title:d,children:d})}else if(e.licenseStatus==="valid"&&s){const d=a("pluginsManage.licenseUnreachable",{time:e.licenseLastValidatedAt?Xc(e.licenseLastValidatedAt,o.language):""});l=i(de,{className:"max-w-full truncate",variant:"warning",title:d,children:d})}else e.licenseStatus==="valid"?l=i(de,{className:"max-w-full truncate",variant:"success",children:a("pluginsManage.licenseValid")}):l=i(de,{className:"max-w-full truncate",variant:"neutral",children:e.licenseStatus});return x("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[l,e.licenseStatus==="valid"&&!s&&e.licenseLastValidatedAt&&i("span",{className:"max-w-full truncate text-xs text-text-secondary",children:a("pluginsManage.licenseCheckedAgo",{time:Xc(e.licenseLastValidatedAt,o.language)})}),e.licenseStatus==="valid"&&!s&&!e.enabled&&i("span",{className:"max-w-full text-xs text-warning-700",children:a("pluginsManage.licenseValidButDisabled")}),i(K,{type:"button",variant:"outline",size:"sm",onClick:r,disabled:t,children:a("pluginsManage.licenseRecheck")}),n&&i("span",{role:"alert",className:"max-w-full truncate text-xs text-danger-600",children:n})]})}function PT(){const{t:e,i18n:t}=ae();Re([e("pluginsManage.title"),e("nav.plugins")]);const[n,r]=E([]),[a,o]=E(null),[s,l]=E(!1),[c,d]=E(!1),[f,u]=E(null),[p,m]=E(null),h=M(new Map),g=M(null),[y,w]=E(null),[b,v]=E({}),C=H(async()=>{try{const{items:R,nextCursor:P}=await qc({limit:Gc});r(R),o(P),d(!1),l(!0)}catch{d(!0),l(!0)}},[]);O(()=>{C()},[C]);async function N(){if(a)try{const{items:R,nextCursor:P}=await qc({cursor:a,limit:Gc});r(I=>[...I,...R]),o(P)}catch{J({variant:"danger",title:e("pluginsManage.errorTitle")})}}async function T(R,P){u(R.pluginId);try{P?await wT(R.pluginId):await CT(R.pluginId),await C()}catch(I){J({variant:"danger",title:I instanceof ve?I.message:e("pluginsManage.toggleFailed")}),await C()}finally{u(null)}}function k(R){g.current=h.current.get(R.pluginId)??null,m(R)}async function L(R){w(R.pluginId),v(P=>{if(!(R.pluginId in P))return P;const I={...P};return delete I[R.pluginId],I});try{const P=await NT(R.pluginId);if(P.checked&&P.status==="revoked"){await C();return}r(I=>I.map(S=>S.pluginId!==R.pluginId?S:P.checked?{...S,licenseStatus:P.status,licenseReason:P.reason,licenseLastValidatedAt:P.lastValidatedAt,licenseLastAttemptError:null}:{...S,licenseLastAttemptError:P.reason,licenseLastValidatedAt:P.lastValidatedAt}))}catch(P){v(I=>({...I,[R.pluginId]:P instanceof ve?P.message:e("pluginsManage.licenseRecheckFailed")}))}finally{w(null)}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.plugins"),e("pluginsManage.installed")],title:e("pluginsManage.title")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[!s&&x("div",{"aria-label":e("contentTree.loading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]}),s&&c&&x("div",{role:"alert",className:"flex flex-col items-start gap-2 rounded-md border border-danger-500 bg-background-elevated p-4",children:[i("p",{className:"text-sm font-medium text-danger-600",children:e("pluginsManage.errorTitle")}),i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>void C(),children:e("pluginsManage.retry")})]}),s&&!c&&n.length===0&&i(ke,{title:e("pluginsManage.empty")}),s&&!c&&n.length>0&&x(Ie,{children:[x("div",{"data-testid":"installed-plugins-header",className:`${Yc} border border-transparent px-3 text-xs font-medium uppercase tracking-wide text-text-secondary`,children:[i("span",{className:"min-w-0",children:e("pluginsManage.columns.name")}),i("span",{className:"justify-self-start",children:e("pluginsManage.columns.version")}),i("span",{className:"justify-self-start",children:e("pluginsManage.columns.trust")}),i("span",{className:"justify-self-start",children:e("pluginsManage.columns.storage")}),i("span",{className:"justify-self-start",children:e("pluginsManage.columns.license")}),i("span",{className:"justify-self-start","aria-hidden":"true"}),i("span",{className:"justify-self-start",children:e("pluginsManage.columns.actions")})]}),i("ul",{className:"flex flex-col gap-1",children:n.map(R=>x("li",{"data-plugin-id":R.pluginId,className:`${Yc} rounded-md border border-border-subtle px-3 py-2`,children:[x("div",{className:"min-w-0",children:[i("p",{className:"truncate text-sm text-text-primary",children:R.name}),i("p",{className:"truncate text-xs text-text-secondary",children:R.pluginId})]}),i("span",{className:"justify-self-start text-xs text-text-secondary",children:R.version}),i(de,{className:"justify-self-start",variant:R.trustTier==="verified"?"success":"neutral",children:R.trustTier==="verified"?e("pluginsManage.verified"):e("pluginsManage.unverified")}),i(de,{className:"justify-self-start",variant:"neutral",children:R.storageType}),i(RT,{plugin:R,recheckPending:y===R.pluginId,recheckError:b[R.pluginId],onRecheck:()=>void L(R)}),i(Rh,{className:"justify-self-start",checked:R.enabled,onCheckedChange:P=>void T(R,P),disabled:f===R.pluginId,"aria-label":e("pluginsManage.toggleAria",{name:R.name})}),x(_i,{children:[i(Fi,{asChild:!0,children:i(K,{ref:P=>{P?h.current.set(R.pluginId,P):h.current.delete(R.pluginId)},className:"justify-self-start",type:"button",variant:"outline",size:"icon","aria-label":e("pluginsManage.rowActionsAria",{name:R.name}),children:i(mp,{"aria-hidden":"true",className:"size-4"})})}),x($i,{align:t.dir()==="rtl"?"start":"end",children:[i(La,{asChild:!0,children:i(Ut,{to:`/plugin-management/installed/${encodeURIComponent(R.pluginId)}/snapshots`,state:{name:R.name},children:e("pluginsManage.snapshotsAction")})}),i(La,{variant:"destructive",onSelect:()=>k(R),children:e("pluginsManage.uninstall")})]})]})]},R.pluginId))})]}),s&&!c&&a&&i(K,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void N(),children:e("pluginsManage.loadMore")})]}),i(ST,{plugin:p,onClose:()=>m(null),onCloseAutoFocus:R=>{const P=g.current;P!=null&&P.isConnected&&(R.preventDefault(),P.focus())},onUninstalled:()=>{J({variant:"success",title:e("pluginsManage.uninstalledToast",{name:(p==null?void 0:p.name)??""})}),C()}})]})}const Yp="/api/plugin-management/marketplace/listings";async function Jc(e={}){const t=new URLSearchParams;e.q&&t.set("q",e.q),e.type&&t.set("type",e.type),e.db&&t.set("db",e.db),e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=await X(`${Yp}${n?`?${n}`:""}`);return oe(r)}async function DT(e){const t=await X(`${Yp}/${encodeURIComponent(e)}`);return oe(t)}async function IT(){const e=await X("/api/plugin-management/marketplace-status");return oe(e)}async function Xp(e){const t=await X("/api/plugin-management/marketplace/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return oe(t)}function Jp(e){return e===0?null:`$${(e/100).toFixed(2)}`}const Zc=24,LT=["datatype","section","template","theme","integration","utility","bundle"],AT=["postgresql","mysql","sqlite"],MT={postgresql:"PostgreSQL",mysql:"MySQL",sqlite:"SQLite"};function Ks(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function Sr(e){return MT[e]??e}function OT(){const{t:e}=ae(),t=Wt();Re([e("pluginsManage.marketplaceTitle"),e("nav.plugins")]);const[n,r]=E([]),[a,o]=E(null),[s,l]=E(""),[c,d]=E(""),[f,u]=E(!1),[p,m]=E(!1),[h,g]=E(""),[y,w]=E(""),[b,v]=E(null),[C,N]=E(null),T=M(0),k=H(async(S={})=>{const A=S.q??y,D="type"in S?S.type:b,U="db"in S?S.db:C,z=++T.current;try{const B=await Jc({q:A||void 0,type:D??void 0,db:U??void 0,limit:Zc});if(T.current!==z)return;r(B.items),o(B.nextCursor),l(B.activeDialect),d(B.marketplaceBaseUrl),m(!1),u(!0)}catch{if(T.current!==z)return;m(!0),u(!0)}},[y,b,C]);O(()=>{k()},[]);function L(S){S.preventDefault(),w(h),k({q:h})}function R(S){v(S),k({type:S})}function P(S){const A=C===S?null:S;N(A),k({db:A})}async function I(){if(a)try{const S=await Jc({q:y||void 0,type:b??void 0,db:C??void 0,cursor:a,limit:Zc});r(A=>[...A,...S.items]),o(S.nextCursor)}catch{J({variant:"danger",title:e("pluginsManage.marketplaceErrorTitle")})}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.plugins"),e("pluginsManage.marketplace")],title:e("pluginsManage.marketplaceTitle")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[x("form",{onSubmit:L,className:"flex items-center gap-2",children:[i(ye,{"aria-label":e("pluginsManage.marketplaceSearchLabel"),placeholder:e("pluginsManage.marketplaceSearchPlaceholder"),value:h,onChange:S=>g(S.target.value),className:"max-w-sm"}),x(K,{type:"submit",variant:"outline",size:"icon",children:[i(pN,{"aria-hidden":"true",className:"size-4"}),i("span",{className:"sr-only",children:e("pluginsManage.marketplaceSearchLabel")})]})]}),x("div",{className:"flex flex-col gap-2",children:[i("span",{className:"text-xs font-medium uppercase tracking-wide text-text-secondary",children:e("pluginsManage.filterType")}),x("div",{className:"flex flex-wrap gap-2",children:[i(K,{type:"button",variant:b===null?"default":"outline",size:"sm","aria-pressed":b===null,onClick:()=>R(null),children:e("pluginsManage.filterAll")}),LT.map(S=>i(K,{type:"button",variant:b===S?"default":"outline",size:"sm","aria-pressed":b===S,onClick:()=>R(S),children:Ks(S)},S))]})]}),x("div",{className:"flex flex-col gap-2",children:[i("span",{className:"text-xs font-medium uppercase tracking-wide text-text-secondary",children:e("pluginsManage.filterDatabase")}),i("div",{className:"flex flex-wrap gap-2",children:AT.map(S=>i(K,{type:"button",variant:C===S?"default":"outline",size:"sm","aria-pressed":C===S,onClick:()=>P(S),children:Sr(S)},S))})]}),!f&&x("div",{"aria-label":e("contentTree.loading"),className:"grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4",children:[i(pe,{className:"h-40 w-full"}),i(pe,{className:"h-40 w-full"}),i(pe,{className:"h-40 w-full"})]}),f&&p&&x("div",{role:"alert",className:"flex flex-col items-start gap-2 rounded-md border border-danger-500 bg-background-elevated p-4",children:[i("p",{className:"text-sm font-medium text-danger-600",children:e("pluginsManage.marketplaceErrorTitle")}),i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>void k(),children:e("pluginsManage.retry")})]}),f&&!p&&n.length===0&&i(ke,{title:e("pluginsManage.marketplaceEmpty")}),f&&!p&&n.length>0&&i("ul",{className:"grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4",children:n.map(S=>{var D;const A=Jp(S.priceCents);return i("li",{children:x("button",{type:"button","data-testid":`marketplace-card-${S.pluginId}`,"data-plugin-id":S.pluginId,onClick:()=>t(`/plugin-management/marketplace/${encodeURIComponent(S.pluginId)}`),className:`flex w-full flex-col gap-2 rounded-md border border-border-subtle p-3 text-start ${S.compatible?"":"opacity-60"}`,children:[S.coverImagePath?i("img",{src:`${c}${S.coverImagePath}`,alt:"",className:"h-24 w-full rounded-md object-cover"}):i("div",{className:"h-24 w-full rounded-md bg-background-hover","aria-hidden":"true"}),i("p",{className:"truncate text-sm font-medium text-text-primary",children:S.name}),x("div",{className:"flex flex-wrap items-center gap-1.5",children:[i(de,{variant:"neutral",children:Ks(S.type)}),i(de,{variant:"primary",children:A??e("pluginsManage.free")}),((D=S.latestVersion)==null?void 0:D.verified)&&i(de,{variant:"success",children:e("pluginsManage.verified")})]}),i("p",{className:"line-clamp-2 text-xs text-text-secondary",children:S.description}),!S.compatible&&i("p",{className:"text-xs text-text-secondary",children:e("pluginsManage.marketplaceIncompatible",{dialect:Sr(s)})})]})},S.pluginId)})}),f&&!p&&a&&i(K,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void I(),children:e("pluginsManage.loadMore")})]})]})}function _T({target:e,onClose:t,onInstalled:n}){const{t:r}=ae(),[a,o]=E(""),[s,l]=E(null),[c,d]=E(!1),f=M(0),u=M(!1);function p(h){u.current=h,d(h)}O(()=>{f.current+=1,o(""),l(null),p(!1)},[e]);async function m(){if(!e||u.current)return;const h=f.current;p(!0),l(null);try{const g=await Xp({pluginId:e.pluginId,version:e.version,licenseKey:a});if(f.current!==h)return;n(g),t()}catch(g){if(f.current!==h)return;l(g instanceof ve?g.message:r("pluginsManage.installFailed"))}finally{f.current===h&&p(!1)}}return i(Jn,{open:e!==null,onOpenChange:h=>!h&&t(),children:x(Zn,{onEscapeKeyDown:h=>{u.current&&h.preventDefault()},children:[x(Qn,{children:[i(tr,{children:r("pluginsManage.installKeyTitle",{name:(e==null?void 0:e.name)??""})}),i(nr,{children:r("pluginsManage.installKeyDescription")})]}),i(Ne,{label:r("pluginsManage.installKeyLabel"),htmlFor:"install-key-dialog-license",helpText:r("pluginsManage.installKeyHelp"),error:s,children:i(ye,{id:"install-key-dialog-license",dir:"ltr",className:"font-mono",placeholder:r("pluginsManage.installKeyPlaceholder"),value:a,onChange:h=>o(h.target.value),disabled:c,autoComplete:"off"})}),x(er,{className:"justify-between",children:[x("a",{href:(e==null?void 0:e.buyHref)??"#",target:"_blank",rel:"noreferrer",className:se(Tt({variant:"link"}),"gap-1 px-0"),children:[r("pluginsManage.buyOnMarketplace"),i(hp,{"aria-hidden":"true",className:"size-3.5 rtl:-scale-x-100"})]}),x("div",{className:"flex items-center gap-2",children:[i(ar,{disabled:c,children:r("pluginsManage.cancel")}),i(rr,{disabled:c,onClick:h=>{h.preventDefault(),m()},children:r(c?"pluginsManage.installing":"pluginsManage.installKeySubmit")})]})]})]})})}const rs="marketplace-detail",FT={needsExternalNetwork:"External network",needsStructuredData:"Structured data",needsFileSystemAccess:"Filesystem access"};function $T(e){const t=FT[e];if(t)return t;const n=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase();return n.length===0?n:n[0].toUpperCase()+n.slice(1)}function BT(e){return new Date(e).toLocaleDateString()}function UT(){const{t:e}=ae(),{pluginId:t=""}=Xn(),[n,r]=E(null),a=ir();Re([n==null?void 0:n.name,e("nav.plugins")]);const[o,s]=E(!1),[l,c]=E(!1),[d,f]=E(!1),[u,p]=E(void 0),[m,h]=E("overview"),[g,y]=E(0),[w,b]=E("idle"),[v,C]=E(null),[N,T]=E(null),[k,L]=E(null),R=M(0);if(O(()=>{let j=!1;return s(!1),c(!1),f(!1),p(void 0),h("overview"),b("idle"),C(null),T(null),L(null),R.current+=1,DT(t).then(le=>{j||(r(le),s(!0))}).catch(le=>{j||(le instanceof ve&&le.status===404?c(!0):(f(!0),p(le instanceof ve?le.message:void 0)),s(!0))}),()=>{j=!0}},[t,g]),!o)return i("div",{className:"flex h-full min-h-0 flex-col px-8 py-8",children:i(ke,{title:e("contentTree.loading"),titleAs:"h1"})});if(d)return i("div",{className:"flex h-full min-h-0 flex-col px-8 py-8",children:x("div",{role:"alert",className:"flex flex-col items-start gap-2 rounded-md border border-danger-500 bg-background-elevated p-4",children:[i("p",{className:"text-sm font-medium text-danger-600",children:e("pluginsManage.marketplaceErrorTitle")}),u&&i("p",{className:"text-sm text-text-secondary",children:u}),i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>y(j=>j+1),children:e("pluginsManage.retry")})]})});if(l||!n)return i("div",{className:"flex h-full min-h-0 flex-col px-8 py-8",children:i(ke,{title:e("pluginsManage.detailNotFound"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},action:x(Ut,{to:"/plugin-management/marketplace",className:se(Tt({variant:"outline",size:"sm"}),"gap-1.5"),children:[i(Rc,{"aria-hidden":"true",className:"size-4 rtl:rotate-180"}),e("pluginsManage.detailBack")]})})});const P=n.latestVersion,I=Jp(n.priceCents),S=`${n.marketplaceBaseUrl}/marketplace/${n.pluginId}`,A=(P==null?void 0:P.starter)??null,D=(P==null?void 0:P.documentTypesSummary)??null,U=n.type==="template"&&!!(D!=null&&D.length),z=P?`${n.marketplaceBaseUrl}/api/v1/starters/${n.pluginId}/${P.version}`:void 0,B=n.type==="bundle"?(P==null?void 0:P.bundledMembers)??null:null,_=(P==null?void 0:P.hasArtifact)===!1,G=j=>{b("installed"),C(null),T(null),L(j.members??null)},V=async()=>{if(!P)return;const j=++R.current;b("installing"),C(null);try{const le=await Xp({pluginId:n.pluginId,version:P.version});if(R.current!==j)return;G(le)}catch(le){if(R.current!==j)return;b("idle"),L(null),C(le instanceof ve?le.message:e("pluginsManage.installFailed"))}},ee=()=>{!P||w!=="idle"||(I===null?V():(C(null),T({pluginId:n.pluginId,version:P.version,name:n.name,buyHref:S})))},Z=[{id:"overview",label:e("pluginsManage.detailOverview")},{id:"versions",label:e("pluginsManage.detailVersions")},{id:"permissions",label:e("pluginsManage.detailPermissionsTab")}];return x("div",{className:"flex h-full min-h-0 flex-col",children:[x("div",{className:"shrink-0 px-8 pb-3 pt-6",children:[x(Ut,{to:"/plugin-management/marketplace",className:"mb-2 inline-flex items-center gap-1.5 text-xs font-medium text-text-secondary hover:text-text-primary",children:[i(Rc,{"aria-hidden":"true",className:"size-3.5 rtl:rotate-180"}),e("pluginsManage.detailBack")]}),x("p",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[i("span",{children:e("nav.plugins")}),i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 text-text-disabled rtl:rotate-180"}),i("span",{children:e("pluginsManage.marketplace")}),i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 text-text-disabled rtl:rotate-180"}),i("span",{children:n.name})]}),n.coverImagePath?i("img",{src:`${n.marketplaceBaseUrl}${n.coverImagePath}`,alt:"",className:"mt-3 h-28 w-full max-w-3xl rounded-lg object-cover"}):i("div",{className:"mt-3 h-28 w-full max-w-3xl rounded-lg bg-background-hover","aria-hidden":"true"}),x("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:a,className:"text-xl font-bold tracking-tight text-text-primary focus:outline-none",children:n.name}),P&&x(de,{variant:"neutral",children:["v",P.version]}),(P==null?void 0:P.verified)&&i(de,{variant:"success",children:e("pluginsManage.verified")}),i(de,{variant:"primary",children:I??e("pluginsManage.free")})]})]}),i(mo,{tabs:Z,activeId:m,onChange:j=>h(j),label:e("pluginsManage.detailTabsLabel"),idPrefix:rs,className:"shrink-0 px-8"}),x("div",{role:"tabpanel",id:Vr(rs,m),"aria-labelledby":jn(rs,m),className:"min-w-0 flex-1 overflow-y-auto px-8 pb-8 pt-6",children:[m==="overview"&&x("div",{className:"flex max-w-2xl flex-col gap-6",children:[i("p",{className:"text-sm text-text-primary",children:n.description}),U&&x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.documentTypesTitle")}),i("ul",{className:"flex flex-col gap-2",children:D.map(j=>x("li",{className:"rounded-md border border-border-default px-4 py-3",children:[i("p",{className:"font-medium text-text-primary",children:j.name}),j.fields.length>0&&i("p",{className:"mt-0.5 text-xs text-text-secondary",children:j.fields.join(" · ")})]},j.name))})]}),B&&B.length>0&&x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.bundleMembersTitle")}),i("ul",{className:"flex flex-col gap-2",children:B.map(j=>i("li",{children:x(Ut,{to:`/plugin-management/marketplace/${encodeURIComponent(j.pluginId)}`,className:"flex items-center gap-3 rounded-md border border-border-default px-4 py-3 hover:bg-background-hover",children:[x("span",{className:"min-w-0 flex-1",children:[i("span",{className:"block font-medium text-text-primary",children:j.name}),j.description&&i("span",{className:"block text-xs text-text-secondary",children:j.description})]}),i(de,{variant:"neutral",children:Ks(j.type)}),i(de,{variant:"neutral",children:e("pluginsManage.bundleMemberFree")}),i(sn,{"aria-hidden":"true",className:"size-4 shrink-0 text-text-disabled rtl:rotate-180"})]})},j.pluginId))}),i("p",{className:"mt-2 text-xs text-text-secondary",children:e("pluginsManage.bundleMembersHelp",{count:B.length})})]}),A?x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.starterTitle")}),x("div",{className:"rounded-md border border-border-default bg-background-elevated p-4",children:[i("p",{className:"font-medium text-text-primary",children:A.name}),A.description&&i("p",{className:"mt-1 text-sm text-text-secondary",children:A.description}),x("p",{className:"mt-2 text-xs text-text-secondary",children:[e("pluginsManage.starterDeliveryPrefix"),i("code",{className:"rounded bg-background-hover px-1 py-0.5",children:"npm install"}),e("pluginsManage.starterDeliverySuffix")]}),x("div",{className:"mt-3 flex items-center gap-4",children:[A.hasArchive&&z&&i("a",{href:z,target:"_blank",rel:"noreferrer",className:se(Tt({variant:"outline",size:"sm"})),children:e("pluginsManage.getStarter")}),A.repository&&i("a",{href:A.repository,target:"_blank",rel:"noreferrer",className:"text-xs text-text-secondary hover:text-text-primary",children:e("pluginsManage.viewSource")})]})]})]}):n.type==="bundle"?x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.starterTitle")}),i("p",{className:"text-sm text-text-secondary",children:e("pluginsManage.bundleStarterNone")})]}):null]}),m==="versions"&&i("ul",{className:"flex max-w-2xl flex-col gap-2",children:n.versions.map(j=>x("li",{className:"flex items-center gap-3 rounded-md border border-border-default px-4 py-3",children:[x("div",{className:"flex-1",children:[i("p",{className:"font-medium text-text-primary",children:j.version}),i("p",{className:"text-xs text-text-secondary",children:e("pluginsManage.detailVersionReleased",{date:BT(j.createdAt)})})]}),(P==null?void 0:P.version)===j.version&&i(de,{variant:"neutral",children:e("pluginsManage.detailLatestVersion")})]},j.version))}),m==="permissions"&&P&&x("div",{className:"flex max-w-2xl flex-col gap-6",children:[x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.detailPermissions")}),Object.keys(P.permissions).length===0?i("p",{className:"text-sm text-text-secondary",children:e("pluginsManage.detailPermissionsEmpty")}):i("ul",{className:"flex flex-col gap-1 text-sm text-text-secondary",children:Object.entries(P.permissions).map(([j,le])=>i("li",{children:e("pluginsManage.permissionRow",{label:$T(j),value:e(le?"pluginsManage.permissionYes":"pluginsManage.permissionNo")})},j))})]}),x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.detailCompatibility")}),i("div",{className:"flex flex-wrap gap-2",children:P.supportedDialects.map(j=>i(de,{variant:"success",children:Sr(j)},j))}),!n.compatible&&i("p",{className:"mt-2 text-xs text-text-secondary",children:e("pluginsManage.marketplaceIncompatible",{dialect:Sr(n.activeDialect)})})]})]})]}),x("footer",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border-default bg-background-elevated px-8 py-3",children:[x("div",{className:"min-w-0 max-w-lg",children:[v&&i("p",{role:"alert",className:"text-sm text-danger-600",children:v}),w==="installed"&&k&&i("p",{className:"text-xs text-text-secondary",children:e("pluginsManage.bundleInstalledMembers",{count:k.filter(j=>j.outcome==="installed").length,skipped:k.filter(j=>j.outcome==="already-installed").length})})]}),x("div",{className:"flex shrink-0 items-center gap-3",children:[x("a",{href:S,target:"_blank",rel:"noreferrer",className:se(Tt({variant:"link"}),"gap-1"),children:[e("pluginsManage.buyOnMarketplace"),i(hp,{"aria-hidden":"true",className:"size-3.5 rtl:-scale-x-100"})]}),i(K,{type:"button",disabled:!P||w!=="idle"||!n.compatible||_,title:n.compatible?_?e("pluginsManage.installUnavailable"):void 0:e("pluginsManage.marketplaceIncompatible",{dialect:Sr(n.activeDialect)}),onClick:ee,children:e(w==="installing"?"pluginsManage.installing":w==="installed"?"pluginsManage.installDone":_?"pluginsManage.installUnavailable":"pluginsManage.install")})]})]}),i(_T,{target:N,onClose:()=>T(null),onInstalled:G})]})}const dl="/api/plugin-management/plugins";async function Qc(e,t={}){const n=new URLSearchParams;t.cursor&&n.set("cursor",t.cursor),t.limit&&n.set("limit",String(t.limit));const r=n.toString(),a=await X(`${dl}/${encodeURIComponent(e)}/snapshot-groups${r?`?${r}`:""}`);return oe(a)}async function zT(e){const t=await X(`${dl}/${encodeURIComponent(e)}/snapshot-groups/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(t.status===409){const n=await t.json().catch(()=>null);if(n!=null&&n.requiresConfirmation&&n.plan&&n.planHash)return{plan:n.plan,planHash:n.planHash,message:n.message??""};throw new ve((n==null?void 0:n.message)??t.statusText,t.status)}throw await oe(t),new ve(t.statusText,t.status)}class Zp extends Error{constructor(t,n,r){super(r),this.plan=t,this.planHash=n}status=409}async function jT(e,t){const n=await X(`${dl}/${encodeURIComponent(e)}/snapshot-groups/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmRestore:!0,planHash:t})});if(n.status===409){const r=await n.json().catch(()=>null);throw r!=null&&r.requiresConfirmation&&r.plan&&r.planHash?new Zp(r.plan,r.planHash,r.message??""):new ve((r==null?void 0:r.message)??n.statusText,n.status)}return oe(n)}const ed=50,td="grid grid-cols-[7rem_9rem_7rem_6rem_6rem_1.5rem] items-center gap-3";function nd(e,t,n=Date.now()){const r=new Date(e).getTime()-n,a=new Intl.RelativeTimeFormat(t,{numeric:"always"}),o=Math.abs(r),s=6e4,l=60*s,c=24*l;return o<s?a.format(Math.round(r/1e3),"second"):o<l?a.format(Math.round(r/s),"minute"):o<c?a.format(Math.round(r/l),"hour"):a.format(Math.round(r/c),"day")}function rd(e){return e.length<=9?e:`${e.slice(0,4)}…${e.slice(-3)}`}function VT(e,t){return e==="uninstall"?t("pluginsManage.snapshotsTriggerUninstall"):e==="restore"?t("pluginsManage.snapshotsTriggerRestore"):"—"}function HT(e){const t=new Map;for(const n of e){const r=t.get(n.snapshotGroupId);r?r.tableNames.push(n.tableName):t.set(n.snapshotGroupId,{snapshotGroupId:n.snapshotGroupId,groupTakenAt:n.groupTakenAt,tableNames:[n.tableName]})}return Array.from(t.values())}function KT(){var B;const{t:e,i18n:t}=ae(),{pluginId:n=""}=Xn(),a=((B=Xe().state)==null?void 0:B.name)||n;Re([e("pluginsManage.snapshotsTitle",{name:a}),e("nav.plugins")]);const[o,s]=E([]),[l,c]=E(null),[d,f]=E(!1),[u,p]=E(!1),[m,h]=E(!1),[g,y]=E(null),[w,b]=E(null),[v,C]=E(""),[N,T]=E(!1),[k,L]=E(null),R=H(async()=>{try{const{items:_,nextCursor:G}=await Qc(n,{limit:ed});s(_),c(G),p(!1),f(!0)}catch{p(!0),f(!0)}},[n]);O(()=>{R()},[R]);async function P(){if(l)try{const{items:_,nextCursor:G}=await Qc(n,{cursor:l,limit:ed});s(V=>[...V,..._]),c(G)}catch{J({variant:"danger",title:e("pluginsManage.snapshotsError")})}}async function I(){h(!0);try{const{plan:_,planHash:G}=await zT(n);C(""),L(null),y(_),b(G)}catch(_){J({variant:"danger",title:_ instanceof ve?_.message:e("pluginsManage.snapshotsError")})}finally{h(!1)}}function S(){y(null),b(null),C(""),L(null)}async function A(){if(!(!g||!w||v!=="restore"||N)){T(!0),L(null);try{const _=await jT(n,w);J({variant:"success",title:e("pluginsManage.snapshotsRestoredToast",{count:_.restoredTables.length})}),S(),await R()}catch(_){_ instanceof Zp?(y(_.plan),b(_.planHash),C(""),L(_.message)):L(_ instanceof ve?_.message:e("pluginsManage.snapshotsError"))}finally{T(!1)}}}const D=o.find(_=>_.trigger!=="restore"),U=D!==void 0&&D.status!=="complete",z=g?HT(g):[];return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.plugins"),e("pluginsManage.installed"),a,e("pluginsManage.snapshotsAction")],title:e("pluginsManage.snapshotsTitle",{name:a}),actions:d&&!u&&o.length>0&&i(K,{type:"button",size:"sm",onClick:()=>void I(),disabled:m,children:e("pluginsManage.snapshotsRestoreAction")})}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[i("p",{className:"max-w-[65ch] text-sm text-text-secondary",children:e("pluginsManage.snapshotsScope",{name:a})}),!d&&x("div",{"aria-label":e("pluginsManage.snapshotsLoading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]}),d&&u&&x("div",{role:"alert",className:"flex flex-col items-start gap-2 rounded-md border border-danger-500 bg-background-elevated p-4",children:[i("p",{className:"text-sm font-medium text-danger-600",children:e("pluginsManage.snapshotsError")}),i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>void R(),children:e("pluginsManage.retry")})]}),d&&!u&&o.length===0&&i(ke,{title:e("pluginsManage.snapshotsEmpty")}),d&&!u&&o.length>0&&x(Ie,{children:[U&&x("div",{role:"note",className:"flex items-start gap-2 rounded-md border border-warning-300 bg-warning-100 px-4 py-3 text-sm text-warning-800",children:[i(LN,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0"}),i("span",{children:e("pluginsManage.snapshotsUnionCallout")})]}),x("div",{"data-testid":"snapshot-groups-header",className:`${td} border border-transparent px-3 text-xs font-medium uppercase tracking-wide text-text-secondary`,children:[i("span",{children:e("pluginsManage.snapshotsColGroup")}),i("span",{children:e("pluginsManage.snapshotsColTaken")}),i("span",{children:e("pluginsManage.snapshotsColTrigger")}),i("span",{children:e("pluginsManage.snapshotsColTables")}),i("span",{children:e("pluginsManage.snapshotsColStatus")}),i("span",{"aria-hidden":"true"})]}),i("ul",{className:"flex flex-col gap-1",children:o.map(_=>x("li",{"data-snapshot-group-id":_.snapshotGroupId,className:`${td} rounded-md border border-border-subtle px-3 py-2`,children:[i("span",{className:"truncate font-mono text-xs text-text-secondary",title:_.snapshotGroupId,children:rd(_.snapshotGroupId)}),x("div",{className:"min-w-0",children:[i("p",{className:"truncate text-xs text-text-primary",children:nd(_.takenAt,t.language)}),i("p",{className:"truncate text-xs text-text-secondary",children:new Date(_.takenAt).toLocaleString()})]}),i("span",{className:"truncate text-xs text-text-secondary",children:VT(_.trigger,e)}),i("span",{className:"text-xs text-text-secondary",children:e("pluginsManage.snapshotsTablesOf",{count:_.tableNames.length,total:_.totalTableCount})}),i(de,{variant:_.status==="complete"?"success":"warning",children:_.status==="complete"?e("pluginsManage.snapshotsStatusComplete"):e("pluginsManage.snapshotsStatusPartial")}),i("span",{"aria-hidden":"true"})]},_.snapshotGroupId))})]}),d&&!u&&l&&i(K,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void P(),children:e("pluginsManage.loadMore")})]}),i(Jn,{open:g!==null,onOpenChange:_=>!_&&!N&&S(),children:x(Zn,{onEscapeKeyDown:_=>{N&&_.preventDefault()},children:[x(Qn,{children:[i(tr,{children:e("pluginsManage.snapshotsRestoreTitle",{name:a})}),i(nr,{children:e("pluginsManage.snapshotsRestoreIntro",{count:(g==null?void 0:g.length)??0})})]}),k&&i("p",{role:"alert",className:"text-sm text-danger-600",children:k}),i("ul",{className:"flex flex-col gap-1 text-sm text-text-primary",children:z.map(_=>i("li",{className:"font-mono text-xs",children:e("pluginsManage.snapshotsRestoreProvenance",{tables:_.tableNames.join(", "),group:rd(_.snapshotGroupId),when:nd(_.groupTakenAt,t.language)})},_.snapshotGroupId))}),i("p",{className:"text-sm text-text-secondary",children:e("pluginsManage.snapshotsRestoreSafety",{name:a})}),i(Ne,{label:e("pluginsManage.snapshotsRestoreTypeLabel"),htmlFor:"snapshots-restore-confirm",children:i(ye,{id:"snapshots-restore-confirm",dir:"ltr",className:"font-mono",placeholder:"restore",value:v,onChange:_=>C(_.target.value),disabled:N,autoComplete:"off"})}),x(er,{children:[i(ar,{disabled:N,children:e("pluginsManage.cancel")}),i(rr,{disabled:N||v!=="restore",className:Tt({variant:"destructive"}),onClick:_=>{_.preventDefault(),A()},children:N?e("pluginsManage.snapshotsRestoring"):e("pluginsManage.snapshotsRestoreConfirm",{count:(g==null?void 0:g.length)??0})})]})]})})]})}function ad(){const{t:e}=ae();return i(ke,{icon:i(TN,{"aria-hidden":"true"}),title:e("pluginsManage.marketplaceOffTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:e("pluginsManage.marketplaceOffDescription")})}function WT(){const{t:e}=ae(),t=Wt(),n=_t("/plugin-management/installed/*"),r=_t("/plugin-management/marketplace/*"),[a,o]=E(null);return O(()=>{let s=!1;return IT().then(l=>{s||o(l.configured)}).catch(()=>{s||o(!0)}),()=>{s=!0}},[]),x(Ie,{children:[i(Vn,{label:e("nav.plugins"),children:x(Bt,{title:e("pluginsManage.treeTitle"),children:[i(dt,{label:e("pluginsManage.installed"),selected:!!n,onClick:()=>t("/plugin-management/installed")}),i(dt,{label:e("pluginsManage.marketplace"),selected:!!r,onClick:()=>t("/plugin-management/marketplace")})]})}),x(ai,{children:[i(Ce,{index:!0,element:i(nn,{to:"/plugin-management/installed",replace:!0})}),i(Ce,{path:"installed",element:i(me,{flush:!0,children:i(PT,{})})}),i(Ce,{path:"marketplace",element:a===!1?i(me,{children:i(ad,{})}):i(me,{flush:!0,children:i(OT,{})})}),i(Ce,{path:"marketplace/:pluginId",element:a===!1?i(me,{children:i(ad,{})}):i(me,{flush:!0,children:i(UT,{})})}),i(Ce,{path:"installed/:pluginId/snapshots",element:i(me,{flush:!0,children:i(KT,{})})}),i(Ce,{path:"*",element:i(nn,{to:"/plugin-management/installed",replace:!0})})]})]})}async function od(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=await X(`/api/users${n?`?${n}`:""}`);return oe(r)}async function qT(e){const t=await X("/api/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return oe(t)}async function GT(e,t){const n=await X(`/api/users/${e}/role`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:t})});return oe(n)}const sd=50;function YT(e){var r;const t=((r=e.name)==null?void 0:r.trim())||e.email,n=t.split(/\s+/).filter(Boolean);return n.length>=2?`${n[0][0]}${n[1][0]}`.toUpperCase():t.slice(0,2).toUpperCase()}function XT(){const{t:e}=ae(),{user:t}=Tn(),[n,r]=E([]),[a,o]=E(null),[s,l]=E(!1),[c,d]=E(!1),[f,u]=E(""),[p,m]=E(""),[h,g]=E(""),[y,w]=E("editor"),[b,v]=E(!1),[C,N]=E(null),T=H(async()=>{try{const{items:P,nextCursor:I}=await od({limit:sd});r(P),o(I),l(!0)}catch{J({variant:"danger",title:e("users.genericError")})}},[e]);O(()=>{T()},[T]);async function k(){if(a)try{const{items:P,nextCursor:I}=await od({cursor:a,limit:sd});r(S=>[...S,...P]),o(I)}catch{J({variant:"danger",title:e("users.genericError")})}}async function L(P){P.preventDefault(),v(!0),N(null);try{const{user:I}=await qT({email:f,...p.trim()?{name:p.trim()}:{},password:h,role:y});J({variant:"success",title:e("users.createdToast",{email:I.email})}),u(""),m(""),g(""),w("editor"),d(!1),await T()}catch(I){N(I instanceof ve?I.message:e("users.genericError"))}finally{v(!1)}}async function R(P,I){if(I!==P.role)try{const{user:S}=await GT(P.id,I);r(A=>A.map(D=>D.id===S.id?S:D)),J({variant:"success",title:e("users.roleChangedToast",{email:S.email,role:e(`users.role.${S.role}`)})})}catch(S){J({variant:"danger",title:S instanceof ve?S.message:e("users.genericError")})}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.users")],title:e("usersTree.all"),actions:!c&&i(K,{type:"button",size:"sm",onClick:()=>d(!0),children:e("users.newButton")})}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[!s&&x("div",{"aria-label":e("contentTree.loading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]}),s&&c&&x("form",{onSubmit:L,className:"flex max-w-xl flex-col gap-4 rounded-md border border-border-default p-4",children:[x("div",{className:"flex items-center justify-between",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:e("users.createTitle")}),i(K,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(!1),children:e("users.cancel")})]}),i(Ne,{label:e("users.emailLabel"),htmlFor:"user-email",required:!0,requiredText:e("common.required"),children:i(ye,{id:"user-email",type:"email",required:!0,value:f,onChange:P=>u(P.target.value)})}),i(Ne,{label:e("users.nameLabel"),htmlFor:"user-name",children:i(ye,{id:"user-name",value:p,onChange:P=>m(P.target.value)})}),i(Ne,{label:e("users.passwordLabel"),htmlFor:"user-password",required:!0,requiredText:e("common.required"),helpText:e("users.passwordHelp"),children:i(ye,{id:"user-password",type:"password",required:!0,minLength:8,value:h,onChange:P=>g(P.target.value)})}),i(Ne,{label:e("users.roleLabel"),htmlFor:"user-role",children:x("select",{id:"user-role",value:y,onChange:P=>w(P.target.value),className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary",children:[i("option",{value:"editor",children:e("users.role.editor")}),i("option",{value:"admin",children:e("users.role.admin")})]})}),C&&i("p",{role:"alert",className:"text-sm text-danger-600",children:C}),i(K,{type:"submit",disabled:b,className:"self-start",children:e(b?"users.creating":"users.createButton")})]}),s&&i("ul",{className:"flex flex-col gap-1",children:n.map(P=>{const I=P.id===(t==null?void 0:t.id);return x("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border-subtle px-3 py-2",children:[i("span",{"aria-hidden":"true",className:"grid size-8 shrink-0 place-items-center rounded-full bg-primary-100 text-xs font-semibold text-primary-800",children:YT(P)}),x("div",{className:"min-w-0 flex-1",children:[i("p",{className:"truncate text-sm text-text-primary",children:P.name??P.email}),P.name&&i("p",{className:"truncate text-xs text-text-secondary",children:P.email})]}),i(de,{variant:P.role==="admin"?"primary":"neutral",children:e(`users.role.${P.role}`)}),I?i("span",{className:"text-xs text-text-secondary",children:e("users.youHint")}):x("select",{"aria-label":e("users.roleSelectLabel",{email:P.email}),value:P.role,onChange:S=>void R(P,S.target.value),className:"h-9 rounded-md border border-border-default bg-background-elevated px-2 text-sm text-text-primary",children:[i("option",{value:"editor",children:e("users.role.editor")}),i("option",{value:"admin",children:e("users.role.admin")})]})]},P.id)})}),a&&i(K,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void k(),children:e("users.loadMore")})]})]})}let Qp=[];function JT(){return Qp}function ZT(){return Nd(Fd,JT)}async function eh(){let e;try{const a=await fetch("/api/themes");if(!a.ok)throw new Error(`GET /api/themes responded with ${a.status}`);const o=await a.json(),s=Ph.safeParse(o);if(!s.success)throw new Error(`GET /api/themes returned a malformed response: ${s.error.message}`);e=s.data.items}catch(a){return console.warn("reconcileRuntimeThemes: failed to refresh installed themes, keeping cached state",a),null}const t=e.filter(a=>a.pluginId.includes("."));Qp=t;const n=t.map(a=>qm(a.pluginId,a.tokens)).filter(Boolean).join(`
540
+ `},MS={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function OS(e){let{announcements:t=MS,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=AS}=e;const{announce:o,announcement:s}=DS(),l=Gr("DndLiveRegion"),[c,d]=E(!1);if(O(()=>{d(!0)},[]),IS(Q(()=>({onDragStart(u){let{active:p}=u;o(t.onDragStart({active:p}))},onDragMove(u){let{active:p,over:m}=u;t.onDragMove&&o(t.onDragMove({active:p,over:m}))},onDragOver(u){let{active:p,over:m}=u;o(t.onDragOver({active:p,over:m}))},onDragEnd(u){let{active:p,over:m}=u;o(t.onDragEnd({active:p,over:m}))},onDragCancel(u){let{active:p,over:m}=u;o(t.onDragCancel({active:p,over:m}))}}),[o,t])),!c)return null;const f=Ze.createElement(Ze.Fragment,null,Ze.createElement(RS,{id:r,value:a.draggable}),Ze.createElement(PS,{id:l,announcement:s}));return n?Ga(f,n):f}var Ae;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ae||(Ae={}));function $a(){}function Hn(e,t){return Q(()=>({sensor:e,options:t??{}}),[e,t])}function ol(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Q(()=>[...t].filter(r=>r!=null),[...t])}const mt=Object.freeze({x:0,y:0});function _S(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function FS(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function $S(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Ac(e){let{left:t,top:n,height:r,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+r},{x:t+a,y:n+r}]}function Dp(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const BS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=Ac(t),o=[];for(const s of r){const{id:l}=s,c=n.get(l);if(c){const d=Ac(c),f=a.reduce((p,m,h)=>p+_S(d[h],m),0),u=Number((f/4).toFixed(4));o.push({id:l,data:{droppableContainer:s,value:u}})}}return o.sort(FS)};function US(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=a-r,l=o-n;if(r<a&&n<o){const c=t.width*t.height,d=e.width*e.height,f=s*l,u=f/(c+d-f);return Number(u.toFixed(4))}return 0}const zS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const o of r){const{id:s}=o,l=n.get(s);if(l){const c=US(l,t);c>0&&a.push({id:s,data:{droppableContainer:o,value:c}})}}return a.sort($S)};function jS(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Ip(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:mt}function VS(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return a.reduce((s,l)=>({...s,top:s.top+e*l.y,bottom:s.bottom+e*l.y,left:s.left+e*l.x,right:s.right+e*l.x}),{...n})}}const HS=VS(1);function KS(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function WS(e,t,n){const r=KS(t);if(!r)return e;const{scaleX:a,scaleY:o,x:s,y:l}=r,c=e.left-s-(1-a)*parseFloat(n),d=e.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),f=a?e.width/a:e.width,u=o?e.height/o:e.height;return{width:f,height:u,top:d,right:c+f,bottom:d+u,left:c}}const qS={ignoreTransform:!1};function dr(e,t){t===void 0&&(t=qS);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=et(e).getComputedStyle(e);d&&(n=WS(n,d,f))}const{top:r,left:a,width:o,height:s,bottom:l,right:c}=n;return{top:r,left:a,width:o,height:s,bottom:l,right:c}}function Mc(e){return dr(e,{ignoreTransform:!0})}function GS(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function YS(e,t){return t===void 0&&(t=et(e).getComputedStyle(e)),t.position==="fixed"}function XS(e,t){t===void 0&&(t=et(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const o=t[a];return typeof o=="string"?n.test(o):!1})}function bo(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(nl(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Wr(a)||kp(a)||n.includes(a))return n;const o=et(e).getComputedStyle(a);return a!==e&&XS(a,o)&&n.push(a),YS(a,o)?n:r(a.parentNode)}return e?r(e):n}function Lp(e){const[t]=bo(e,1);return t??null}function es(e){return!vo||!e?null:lr(e)?e:tl(e)?nl(e)||e===cr(e).scrollingElement?window:Wr(e)?e:null:null}function Ap(e){return lr(e)?e.scrollX:e.scrollLeft}function Mp(e){return lr(e)?e.scrollY:e.scrollTop}function js(e){return{x:Ap(e),y:Mp(e)}}var Oe;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Oe||(Oe={}));function Op(e){return!vo||!e?!1:e===document.scrollingElement}function _p(e){const t={x:0,y:0},n=Op(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:a,isLeft:o,isBottom:s,isRight:l,maxScroll:r,minScroll:t}}const JS={x:.2,y:.2};function ZS(e,t,n,r,a){let{top:o,left:s,right:l,bottom:c}=n;r===void 0&&(r=10),a===void 0&&(a=JS);const{isTop:d,isBottom:f,isLeft:u,isRight:p}=_p(e),m={x:0,y:0},h={x:0,y:0},g={height:t.height*a.y,width:t.width*a.x};return!d&&o<=t.top+g.height?(m.y=Oe.Backward,h.y=r*Math.abs((t.top+g.height-o)/g.height)):!f&&c>=t.bottom-g.height&&(m.y=Oe.Forward,h.y=r*Math.abs((t.bottom-g.height-c)/g.height)),!p&&l>=t.right-g.width?(m.x=Oe.Forward,h.x=r*Math.abs((t.right-g.width-l)/g.width)):!u&&s<=t.left+g.width&&(m.x=Oe.Backward,h.x=r*Math.abs((t.left+g.width-s)/g.width)),{direction:m,speed:h}}function QS(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Fp(e){return e.reduce((t,n)=>Bn(t,js(n)),mt)}function eE(e){return e.reduce((t,n)=>t+Ap(n),0)}function tE(e){return e.reduce((t,n)=>t+Mp(n),0)}function nE(e,t){if(t===void 0&&(t=dr),!e)return;const{top:n,left:r,bottom:a,right:o}=t(e);Lp(e)&&(a<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const rE=[["x",["left","right"],eE],["y",["top","bottom"],tE]];class sl{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=bo(n),a=Fp(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,l]of rE)for(const c of s)Object.defineProperty(this,c,{get:()=>{const d=l(r),f=a[o]-d;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Cr{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function aE(e){const{EventTarget:t}=et(e);return e instanceof t?e:cr(e)}function ts(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ut||(ut={}));function Oc(e){e.preventDefault()}function oE(e){e.stopPropagation()}var fe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(fe||(fe={}));const $p={start:[fe.Space,fe.Enter],cancel:[fe.Esc],end:[fe.Space,fe.Enter,fe.Tab]},sE=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case fe.Right:return{...n,x:n.x+25};case fe.Left:return{...n,x:n.x-25};case fe.Down:return{...n,y:n.y+25};case fe.Up:return{...n,y:n.y-25}}};class Yr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Cr(cr(n)),this.windowListeners=new Cr(et(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&nE(r),n(mt)}handleKeyDown(t){if(al(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:o=$p,coordinateGetter:s=sE,scrollBehavior:l="smooth"}=a,{code:c}=t;if(o.end.includes(c)){this.handleEnd(t);return}if(o.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:mt;this.referenceCoordinates||(this.referenceCoordinates=f);const u=s(t,{active:n,context:r.current,currentCoordinates:f});if(u){const p=Mr(u,f),m={x:0,y:0},{scrollableAncestors:h}=r.current;for(const g of h){const y=t.code,{isTop:w,isRight:b,isLeft:v,isBottom:C,maxScroll:N,minScroll:T}=_p(g),R=QS(g),L={x:Math.min(y===fe.Right?R.right-R.width/2:R.right,Math.max(y===fe.Right?R.left:R.left+R.width/2,u.x)),y:Math.min(y===fe.Down?R.bottom-R.height/2:R.bottom,Math.max(y===fe.Down?R.top:R.top+R.height/2,u.y))},I=y===fe.Right&&!b||y===fe.Left&&!v,P=y===fe.Down&&!C||y===fe.Up&&!w;if(I&&L.x!==u.x){const k=g.scrollLeft+p.x,S=y===fe.Right&&k<=N.x||y===fe.Left&&k>=T.x;if(S&&!p.y){g.scrollTo({left:k,behavior:l});return}S?m.x=g.scrollLeft-k:m.x=y===fe.Right?g.scrollLeft-N.x:g.scrollLeft-T.x,m.x&&g.scrollBy({left:-m.x,behavior:l});break}else if(P&&L.y!==u.y){const k=g.scrollTop+p.y,S=y===fe.Down&&k<=N.y||y===fe.Up&&k>=T.y;if(S&&!p.x){g.scrollTo({top:k,behavior:l});return}S?m.y=g.scrollTop-k:m.y=y===fe.Down?g.scrollTop-N.y:g.scrollTop-T.y,m.y&&g.scrollBy({top:-m.y,behavior:l});break}}this.handleMove(t,Bn(Mr(u,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Yr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=$p,onActivation:a}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const l=o.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function _c(e){return!!(e&&"distance"in e)}function Fc(e){return!!(e&&"delay"in e)}class il{constructor(t,n,r){var a;r===void 0&&(r=aE(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=cr(s),this.documentListeners=new Cr(this.document),this.listeners=new Cr(r),this.windowListeners=new Cr(et(s)),this.initialCoordinates=(a=zs(o))!=null?a:mt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.DragStart,Oc),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),this.windowListeners.add(ut.ContextMenu,Oc),this.documentListeners.add(ut.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Fc(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(_c(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ut.Click,oE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ut.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:o}=this,{onMove:s,options:{activationConstraint:l}}=o;if(!a)return;const c=(n=zs(t))!=null?n:mt,d=Mr(a,c);if(!r&&l){if(_c(l)){if(l.tolerance!=null&&ts(d,l.tolerance))return this.handleCancel();if(ts(d,l.distance))return this.handleStart()}if(Fc(l)&&ts(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),s(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===fe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const iE={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Xr extends il{constructor(t){const{event:n}=t,r=cr(n.target);super(t,iE,r)}}Xr.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const lE={move:{name:"mousemove"},end:{name:"mouseup"}};var Vs;(function(e){e[e.RightClick=2]="RightClick"})(Vs||(Vs={}));class cE extends il{constructor(t){super(t,lE,cr(t.event.target))}}cE.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Vs.RightClick?!1:(r==null||r({event:n}),!0)}}];const ns={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dE extends il{constructor(t){super(t,ns)}static setup(){return window.addEventListener(ns.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ns.move.name,t)};function t(){}}}dE.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r==null||r({event:n}),!0)}}];var Nr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Nr||(Nr={}));var Ba;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ba||(Ba={}));function uE(e){let{acceleration:t,activator:n=Nr.Pointer,canScroll:r,draggingRect:a,enabled:o,interval:s=5,order:l=Ba.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:f,delta:u,threshold:p}=e;const m=pE({delta:u,disabled:!o}),[h,g]=NS(),y=M({x:0,y:0}),w=M({x:0,y:0}),b=Q(()=>{switch(n){case Nr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Nr.DraggableRect:return a}},[n,a,c]),v=M(null),C=K(()=>{const T=v.current;if(!T)return;const R=y.current.x*w.current.x,L=y.current.y*w.current.y;T.scrollBy(R,L)},[]),N=Q(()=>l===Ba.TreeOrder?[...d].reverse():d,[l,d]);O(()=>{if(!o||!d.length||!b){g();return}for(const T of N){if((r==null?void 0:r(T))===!1)continue;const R=d.indexOf(T),L=f[R];if(!L)continue;const{direction:I,speed:P}=ZS(T,L,b,t,p);for(const k of["x","y"])m[k][I[k]]||(P[k]=0,I[k]=0);if(P.x>0||P.y>0){g(),v.current=T,h(C,s),y.current=P,w.current=I;return}}y.current={x:0,y:0},w.current={x:0,y:0},g()},[t,C,r,g,o,s,JSON.stringify(b),JSON.stringify(m),h,d,N,f,JSON.stringify(p)])}const fE={x:{[Oe.Backward]:!1,[Oe.Forward]:!1},y:{[Oe.Backward]:!1,[Oe.Forward]:!1}};function pE(e){let{delta:t,disabled:n}=e;const r=Us(t);return qr(a=>{if(n||!r||!a)return fE;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Oe.Backward]:a.x[Oe.Backward]||o.x===-1,[Oe.Forward]:a.x[Oe.Forward]||o.x===1},y:{[Oe.Backward]:a.y[Oe.Backward]||o.y===-1,[Oe.Forward]:a.y[Oe.Forward]||o.y===1}}},[n,t,r])}function hE(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return qr(a=>{var o;return t==null?null:(o=r??a)!=null?o:null},[r,t])}function mE(e,t){return Q(()=>e.reduce((n,r)=>{const{sensor:a}=r,o=a.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var Or;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Or||(Or={}));var Hs;(function(e){e.Optimized="optimized"})(Hs||(Hs={}));const $c=new Map;function gE(e,t){let{dragging:n,dependencies:r,config:a}=t;const[o,s]=E(null),{frequency:l,measure:c,strategy:d}=a,f=M(e),u=y(),p=Ar(u),m=K(function(w){w===void 0&&(w=[]),!p.current&&s(b=>b===null?w:b.concat(w.filter(v=>!b.includes(v))))},[p]),h=M(null),g=qr(w=>{if(u&&!n)return $c;if(!w||w===$c||f.current!==e||o!=null){const b=new Map;for(let v of e){if(!v)continue;if(o&&o.length>0&&!o.includes(v.id)&&v.rect.current){b.set(v.id,v.rect.current);continue}const C=v.node.current,N=C?new sl(c(C),C):null;v.rect.current=N,N&&b.set(v.id,N)}return b}return w},[e,o,n,u,c]);return O(()=>{f.current=e},[e]),O(()=>{u||m()},[n,u]),O(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),O(()=>{u||typeof l!="number"||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},l))},[l,u,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:o!=null};function y(){switch(d){case Or.Always:return!1;case Or.BeforeDragging:return n;default:return!n}}}function Bp(e,t){return qr(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function yE(e,t){return Bp(e,t)}function vE(e){let{callback:t,disabled:n}=e;const r=rl(t),a=Q(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return O(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function xo(e){let{callback:t,disabled:n}=e;const r=rl(t),a=Q(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return O(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function bE(e){return new sl(dr(e),e)}function Bc(e,t,n){t===void 0&&(t=bE);const[r,a]=E(null);function o(){a(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const f=t(e);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const s=vE({callback(c){if(e)for(const d of c){const{type:f,target:u}=d;if(f==="childList"&&u instanceof HTMLElement&&u.contains(e)){o();break}}}}),l=xo({callback:o});return Dt(()=>{o(),e?(l==null||l.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),s==null||s.disconnect())},[e]),r}function xE(e){const t=Bp(e);return Ip(e,t)}const Uc=[];function wE(e){const t=M(e),n=qr(r=>e?r&&r!==Uc&&e&&t.current&&e.parentNode===t.current.parentNode?r:bo(e):Uc,[e]);return O(()=>{t.current=e},[e]),n}function CE(e){const[t,n]=E(null),r=M(e),a=K(o=>{const s=es(o.target);s&&n(l=>l?(l.set(s,js(s)),new Map(l)):null)},[]);return O(()=>{const o=r.current;if(e!==o){s(o);const l=e.map(c=>{const d=es(c);return d?(d.addEventListener("scroll",a,{passive:!0}),[d,js(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{s(e),s(o)};function s(l){l.forEach(c=>{const d=es(c);d==null||d.removeEventListener("scroll",a)})}},[a,e]),Q(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>Bn(o,s),mt):Fp(e):mt,[e,t])}function zc(e,t){t===void 0&&(t=[]);const n=M(null);return O(()=>{n.current=null},t),O(()=>{const r=e!==mt;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Mr(e,n.current):mt}function NE(e){O(()=>{if(!vo)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function SE(e,t){return Q(()=>e.reduce((n,r)=>{let{eventName:a,handler:o}=r;return n[a]=s=>{o(s,t)},n},{}),[e,t])}function Up(e){return Q(()=>e?GS(e):null,[e])}const jc=[];function EE(e,t){t===void 0&&(t=dr);const[n]=e,r=Up(n?et(n):null),[a,o]=E(jc);function s(){o(()=>e.length?e.map(c=>Op(c)?r:new sl(t(c),c)):jc)}const l=xo({callback:s});return Dt(()=>{l==null||l.disconnect(),s(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),a}function TE(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Wr(t)?t:e}function kE(e){let{measure:t}=e;const[n,r]=E(null),a=K(d=>{for(const{target:f}of d)if(Wr(f)){r(u=>{const p=t(f);return u?{...u,width:p.width,height:p.height}:p});break}},[t]),o=xo({callback:a}),s=K(d=>{const f=TE(d);o==null||o.disconnect(),f&&(o==null||o.observe(f)),r(f?t(f):null)},[t,o]),[l,c]=Fa(s);return Q(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const RE=[{sensor:Xr,options:{}},{sensor:Yr,options:{}}],PE={current:{}},ba={draggable:{measure:Mc},droppable:{measure:Mc,strategy:Or.WhileDragging,frequency:Hs.Optimized},dragOverlay:{measure:dr}};class Sr extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const DE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Sr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:$a},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ba,measureDroppableContainers:$a,windowRect:null,measuringScheduled:!1},IE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:$a,draggableNodes:new Map,over:null,measureDroppableContainers:$a},wo=Te(IE),zp=Te(DE);function LE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Sr}}}function AE(e,t){switch(t.type){case Ae.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ae.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ae.DragEnd:case Ae.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ae.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new Sr(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case Ae.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Sr(e.droppable.containers);return s.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:s}}}case Ae.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const o=new Sr(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function ME(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=ne(wo),o=Us(r),s=Us(n==null?void 0:n.id);return O(()=>{if(!t&&!r&&o&&s!=null){if(!al(o)||document.activeElement===o.target)return;const l=a.get(s);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[c.current,d.current]){if(!f)continue;const u=TS(f);if(u){u.focus();break}}})}},[r,t,a,s,o]),null}function OE(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,o)=>o({transform:a,...r}),n):n}function _E(e){return Q(()=>({draggable:{...ba.draggable,...e==null?void 0:e.draggable},droppable:{...ba.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ba.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function FE(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const o=M(!1),{x:s,y:l}=typeof a=="boolean"?{x:a,y:a}:a;Dt(()=>{if(!s&&!l||!t){o.current=!1;return}if(o.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=n(d),u=Ip(f,r);if(s||(u.x=0),l||(u.y=0),o.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const p=Lp(d);p&&p.scrollBy({top:u.y,left:u.x})}},[t,s,l,r,n])}const jp=Te({...mt,scaleX:1,scaleY:1});var tn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(tn||(tn={}));const Ua=xd(function(t){var n,r,a,o;let{id:s,accessibility:l,autoScroll:c=!0,children:d,sensors:f=RE,collisionDetection:u=zS,measuring:p,modifiers:m,...h}=t;const g=Cd(AE,void 0,LE),[y,w]=g,[b,v]=LS(),[C,N]=E(tn.Uninitialized),T=C===tn.Initialized,{draggable:{active:R,nodes:L,translate:I},droppable:{containers:P}}=y,k=R!=null?L.get(R):null,S=M({initial:null,translated:null}),A=Q(()=>{var Ke;return R!=null?{id:R,data:(Ke=k==null?void 0:k.data)!=null?Ke:PE,rect:S}:null},[R,k]),D=M(null),[B,U]=E(null),[z,_]=E(null),G=Ar(h,Object.values(h)),V=Gr("DndDescribedBy",s),ee=Q(()=>P.getEnabled(),[P]),Z=_E(p),{droppableRects:j,measureDroppableContainers:le,measuringScheduled:Se}=gE(ee,{dragging:T,dependencies:[I.x,I.y],config:Z.droppable}),ge=hE(L,R),Le=Q(()=>z?zs(z):null,[z]),ue=ph(),F=yE(ge,Z.draggable.measure);FE({activeNode:R!=null?L.get(R):null,config:ue.layoutShiftCompensation,initialRect:F,measure:Z.draggable.measure});const q=Bc(ge,Z.draggable.measure,F),be=Bc(ge?ge.parentElement:null),Pe=M({activatorEvent:null,active:null,activeNode:ge,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),He=P.getNodeFor((n=Pe.current.over)==null?void 0:n.id),Be=kE({measure:Z.dragOverlay.measure}),Ue=(r=Be.nodeRef.current)!=null?r:ge,st=T?(a=Be.rect)!=null?a:q:null,hn=!!(Be.nodeRef.current&&Be.rect),kn=xE(hn?null:q),mn=Up(Ue?et(Ue):null),it=wE(T?He??ge:null),Yt=EE(it),$=OE(m,{transform:{x:I.x-kn.x,y:I.y-kn.y,scaleX:1,scaleY:1},activatorEvent:z,active:A,activeNodeRect:q,containerNodeRect:be,draggingNodeRect:st,over:Pe.current.over,overlayNodeRect:Be.rect,scrollableAncestors:it,scrollableAncestorRects:Yt,windowRect:mn}),te=Le?Bn(Le,I):null,ce=CE(it),we=zc(ce),vt=zc(ce,[q]),lt=Bn($,we),Je=st?HS(st,$):null,ur=A&&Je?u({active:A,collisionRect:Je,droppableRects:j,droppableContainers:ee,pointerCoordinates:te}):null,ul=Dp(ur,"id"),[Xt,fl]=E(null),lh=hn?$:Bn($,vt),ch=jS(lh,(o=Xt==null?void 0:Xt.rect)!=null?o:null,q),Co=M(null),pl=K((Ke,tt)=>{let{sensor:nt,options:Jt}=tt;if(D.current==null)return;const ct=L.get(D.current);if(!ct)return;const rt=Ke.nativeEvent,bt=new nt({active:D.current,activeNode:ct,event:rt,options:Jt,context:Pe,onAbort(ze){if(!L.get(ze))return;const{onDragAbort:xt}=G.current,Mt={id:ze};xt==null||xt(Mt),b({type:"onDragAbort",event:Mt})},onPending(ze,Zt,xt,Mt){if(!L.get(ze))return;const{onDragPending:pr}=G.current,Qt={id:ze,constraint:Zt,initialCoordinates:xt,offset:Mt};pr==null||pr(Qt),b({type:"onDragPending",event:Qt})},onStart(ze){const Zt=D.current;if(Zt==null)return;const xt=L.get(Zt);if(!xt)return;const{onDragStart:Mt}=G.current,fr={activatorEvent:rt,active:{id:Zt,data:xt.data,rect:S}};Zr(()=>{Mt==null||Mt(fr),N(tn.Initializing),w({type:Ae.DragStart,initialCoordinates:ze,active:Zt}),b({type:"onDragStart",event:fr}),U(Co.current),_(rt)})},onMove(ze){w({type:Ae.DragMove,coordinates:ze})},onEnd:Rn(Ae.DragEnd),onCancel:Rn(Ae.DragCancel)});Co.current=bt;function Rn(ze){return async function(){const{active:xt,collisions:Mt,over:fr,scrollAdjustedTranslate:pr}=Pe.current;let Qt=null;if(xt&&pr){const{cancelDrop:hr}=G.current;Qt={activatorEvent:rt,active:xt,collisions:Mt,delta:pr,over:fr},ze===Ae.DragEnd&&typeof hr=="function"&&await Promise.resolve(hr(Qt))&&(ze=Ae.DragCancel)}D.current=null,Zr(()=>{w({type:ze}),N(tn.Uninitialized),fl(null),U(null),_(null),Co.current=null;const hr=ze===Ae.DragEnd?"onDragEnd":"onDragCancel";if(Qt){const No=G.current[hr];No==null||No(Qt),b({type:hr,event:Qt})}})}}},[L]),dh=K((Ke,tt)=>(nt,Jt)=>{const ct=nt.nativeEvent,rt=L.get(Jt);if(D.current!==null||!rt||ct.dndKit||ct.defaultPrevented)return;const bt={active:rt};Ke(nt,tt.options,bt)===!0&&(ct.dndKit={capturedBy:tt.sensor},D.current=Jt,pl(nt,tt))},[L,pl]),hl=mE(f,dh);NE(f),Dt(()=>{q&&C===tn.Initializing&&N(tn.Initialized)},[q,C]),O(()=>{const{onDragMove:Ke}=G.current,{active:tt,activatorEvent:nt,collisions:Jt,over:ct}=Pe.current;if(!tt||!nt)return;const rt={active:tt,activatorEvent:nt,collisions:Jt,delta:{x:lt.x,y:lt.y},over:ct};Zr(()=>{Ke==null||Ke(rt),b({type:"onDragMove",event:rt})})},[lt.x,lt.y]),O(()=>{const{active:Ke,activatorEvent:tt,collisions:nt,droppableContainers:Jt,scrollAdjustedTranslate:ct}=Pe.current;if(!Ke||D.current==null||!tt||!ct)return;const{onDragOver:rt}=G.current,bt=Jt.get(ul),Rn=bt&&bt.rect.current?{id:bt.id,rect:bt.rect.current,data:bt.data,disabled:bt.disabled}:null,ze={active:Ke,activatorEvent:tt,collisions:nt,delta:{x:ct.x,y:ct.y},over:Rn};Zr(()=>{fl(Rn),rt==null||rt(ze),b({type:"onDragOver",event:ze})})},[ul]),Dt(()=>{Pe.current={activatorEvent:z,active:A,activeNode:ge,collisionRect:Je,collisions:ur,droppableRects:j,draggableNodes:L,draggingNode:Ue,draggingNodeRect:st,droppableContainers:P,over:Xt,scrollableAncestors:it,scrollAdjustedTranslate:lt},S.current={initial:st,translated:Je}},[A,ge,ur,Je,L,Ue,st,j,P,Xt,it,lt]),uE({...ue,delta:I,draggingRect:Je,pointerCoordinates:te,scrollableAncestors:it,scrollableAncestorRects:Yt});const uh=Q(()=>({active:A,activeNode:ge,activeNodeRect:q,activatorEvent:z,collisions:ur,containerNodeRect:be,dragOverlay:Be,draggableNodes:L,droppableContainers:P,droppableRects:j,over:Xt,measureDroppableContainers:le,scrollableAncestors:it,scrollableAncestorRects:Yt,measuringConfiguration:Z,measuringScheduled:Se,windowRect:mn}),[A,ge,q,z,ur,be,Be,L,P,j,Xt,le,it,Yt,Z,Se,mn]),fh=Q(()=>({activatorEvent:z,activators:hl,active:A,activeNodeRect:q,ariaDescribedById:{draggable:V},dispatch:w,draggableNodes:L,over:Xt,measureDroppableContainers:le}),[z,hl,A,q,w,V,L,Xt,le]);return Ze.createElement(Pp.Provider,{value:v},Ze.createElement(wo.Provider,{value:fh},Ze.createElement(zp.Provider,{value:uh},Ze.createElement(jp.Provider,{value:ch},d)),Ze.createElement(ME,{disabled:(l==null?void 0:l.restoreFocus)===!1})),Ze.createElement(OS,{...l,hiddenTextDescribedById:V}));function ph(){const Ke=(B==null?void 0:B.autoScrollEnabled)===!1,tt=typeof c=="object"?c.enabled===!1:c===!1,nt=T&&!Ke&&!tt;return typeof c=="object"?{...c,enabled:nt}:{enabled:nt}}}),$E=Te(null),Vc="button",BE="Draggable";function UE(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const o=Gr(BE),{activators:s,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:f,draggableNodes:u,over:p}=ne(wo),{role:m=Vc,roleDescription:h="draggable",tabIndex:g=0}=a??{},y=(c==null?void 0:c.id)===t,w=ne(y?jp:$E),[b,v]=Fa(),[C,N]=Fa(),T=SE(s,t),R=Ar(n);Dt(()=>(u.set(t,{id:t,key:o,node:b,activatorNode:C,data:R}),()=>{const I=u.get(t);I&&I.key===o&&u.delete(t)}),[u,t]);const L=Q(()=>({role:m,tabIndex:g,"aria-disabled":r,"aria-pressed":y&&m===Vc?!0:void 0,"aria-roledescription":h,"aria-describedby":f.draggable}),[r,m,g,y,h,f.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:L,isDragging:y,listeners:r?void 0:T,node:b,over:p,setNodeRef:v,setActivatorNodeRef:N,transform:w}}function zE(){return ne(zp)}const jE="Droppable",VE={timeout:25};function HE(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const o=Gr(jE),{active:s,dispatch:l,over:c,measureDroppableContainers:d}=ne(wo),f=M({disabled:n}),u=M(!1),p=M(null),m=M(null),{disabled:h,updateMeasurementsFor:g,timeout:y}={...VE,...a},w=Ar(g??r),b=K(()=>{if(!u.current){u.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),m.current=null},y)},[y]),v=xo({callback:b,disabled:h||!s}),C=K((L,I)=>{v&&(I&&(v.unobserve(I),u.current=!1),L&&v.observe(L))},[v]),[N,T]=Fa(C),R=Ar(t);return O(()=>{!v||!N.current||(v.disconnect(),u.current=!1,v.observe(N.current))},[N,v]),O(()=>(l({type:Ae.RegisterDroppable,element:{id:r,key:o,disabled:n,node:N,rect:p,data:R}}),()=>l({type:Ae.UnregisterDroppable,key:o,id:r})),[r]),O(()=>{n!==f.current.disabled&&(l({type:Ae.SetDroppableDisabled,id:r,key:o,disabled:n}),f.current.disabled=n)},[r,o,n,l]),{active:s,rect:p,isOver:(c==null?void 0:c.id)===r,node:N,over:c,setNodeRef:T}}function Kn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function KE(e,t){return e.reduce((n,r,a)=>{const o=t.get(r);return o&&(n[a]=o),n},Array(e.length))}function da(e){return e!==null&&e>=0}function WE(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function qE(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Vp=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e;const o=Kn(t,r,n),s=t[a],l=o[a];return!l||!s?null:{x:l.left-s.left,y:l.top-s.top,scaleX:l.width/s.width,scaleY:l.height/s.height}},ua={scaleX:1,scaleY:1},za=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:a,rects:o,overIndex:s}=e;const l=(t=o[n])!=null?t:r;if(!l)return null;if(a===n){const d=o[s];return d?{x:0,y:n<s?d.top+d.height-(l.top+l.height):d.top-l.top,...ua}:null}const c=GE(o,a,n);return a>n&&a<=s?{x:0,y:-l.height-c,...ua}:a<n&&a>=s?{x:0,y:l.height+c,...ua}:{x:0,y:0,...ua}};function GE(e,t,n){const r=e[t],a=e[t-1],o=e[t+1];return r?n<t?a?r.top-(a.top+a.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):a?r.top-(a.top+a.height):0:0}const Hp="Sortable",Kp=Ze.createContext({activeIndex:-1,containerId:Hp,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Vp,disabled:{draggable:!1,droppable:!1}});function ja(e){let{children:t,id:n,items:r,strategy:a=Vp,disabled:o=!1}=e;const{active:s,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:f}=zE(),u=Gr(Hp,n),p=l.rect!==null,m=Q(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),h=s!=null,g=s?m.indexOf(s.id):-1,y=d?m.indexOf(d.id):-1,w=M(m),b=!WE(m,w.current),v=y!==-1&&g===-1||b,C=qE(o);Dt(()=>{b&&h&&f(m)},[b,m,h,f]),O(()=>{w.current=m},[m]);const N=Q(()=>({activeIndex:g,containerId:u,disabled:C,disableTransforms:v,items:m,overIndex:y,useDragOverlay:p,sortedRects:KE(m,c),strategy:a}),[g,u,C.draggable,C.droppable,v,m,y,c,p,a]);return Ze.createElement(Kp.Provider,{value:N},t)}const YE=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return Kn(n,r,a).indexOf(t)},XE=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:o,newIndex:s,previousItems:l,previousContainerId:c,transition:d}=e;return!d||!r||l!==o&&a===s?!1:n?!0:s!==a&&t===c},JE={duration:200,easing:"ease"},Wp="transform",ZE=Cn.Transition.toString({property:Wp,duration:0,easing:"linear"}),QE={roleDescription:"sortable"};function eT(e){let{disabled:t,index:n,node:r,rect:a}=e;const[o,s]=E(null),l=M(n);return Dt(()=>{if(!t&&n!==l.current&&r.current){const c=a.current;if(c){const d=dr(r.current,{ignoreTransform:!0}),f={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(f.x||f.y)&&s(f)}}n!==l.current&&(l.current=n)},[t,n,r,a]),O(()=>{o&&s(null)},[o]),o}function ll(e){let{animateLayoutChanges:t=XE,attributes:n,disabled:r,data:a,getNewIndex:o=YE,id:s,strategy:l,resizeObserverConfig:c,transition:d=JE}=e;const{items:f,containerId:u,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:y,useDragOverlay:w,strategy:b}=ne(Kp),v=tT(r,m),C=f.indexOf(s),N=Q(()=>({sortable:{containerId:u,index:C,items:f},...a}),[u,a,C,f]),T=Q(()=>f.slice(f.indexOf(s)),[f,s]),{rect:R,node:L,isOver:I,setNodeRef:P}=HE({id:s,data:N,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...c}}),{active:k,activatorEvent:S,activeNodeRect:A,attributes:D,setNodeRef:B,listeners:U,isDragging:z,over:_,setActivatorNodeRef:G,transform:V}=UE({id:s,data:N,attributes:{...QE,...n},disabled:v.draggable}),ee=CS(P,B),Z=!!k,j=Z&&!h&&da(p)&&da(y),le=!w&&z,Se=le&&j?V:null,Le=j?Se??(l??b)({rects:g,activeNodeRect:A,activeIndex:p,overIndex:y,index:C}):null,ue=da(p)&&da(y)?o({id:s,items:f,activeIndex:p,overIndex:y}):C,F=k==null?void 0:k.id,q=M({activeId:F,items:f,newIndex:ue,containerId:u}),be=f!==q.current.items,Pe=t({active:k,containerId:u,isDragging:z,isSorting:Z,id:s,index:C,items:f,newIndex:q.current.newIndex,previousItems:q.current.items,previousContainerId:q.current.containerId,transition:d,wasDragging:q.current.activeId!=null}),He=eT({disabled:!Pe,index:C,node:L,rect:R});return O(()=>{Z&&q.current.newIndex!==ue&&(q.current.newIndex=ue),u!==q.current.containerId&&(q.current.containerId=u),f!==q.current.items&&(q.current.items=f)},[Z,ue,u,f]),O(()=>{if(F===q.current.activeId)return;if(F!=null&&q.current.activeId==null){q.current.activeId=F;return}const Ue=setTimeout(()=>{q.current.activeId=F},50);return()=>clearTimeout(Ue)},[F]),{active:k,activeIndex:p,attributes:D,data:N,rect:R,index:C,newIndex:ue,items:f,isOver:I,isSorting:Z,isDragging:z,listeners:U,node:L,overIndex:y,over:_,setNodeRef:ee,setActivatorNodeRef:G,setDroppableNodeRef:P,setDraggableNodeRef:B,transform:He??Le,transition:Be()};function Be(){if(He||be&&q.current.newIndex===C)return ZE;if(!(le&&!al(S)||!d)&&(Z||Pe))return Cn.Transition.toString({...d,property:Wp})}}function tT(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function Va(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const nT=[fe.Down,fe.Right,fe.Up,fe.Left],cl=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:a,droppableContainers:o,over:s,scrollableAncestors:l}}=t;if(nT.includes(e.code)){if(e.preventDefault(),!n||!r)return;const c=[];o.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const p=a.get(u.id);if(p)switch(e.code){case fe.Down:r.top<p.top&&c.push(u);break;case fe.Up:r.top>p.top&&c.push(u);break;case fe.Left:r.left>p.left&&c.push(u);break;case fe.Right:r.left<p.left&&c.push(u);break}});const d=BS({collisionRect:r,droppableRects:a,droppableContainers:c});let f=Dp(d,"id");if(f===(s==null?void 0:s.id)&&d.length>1&&(f=d[1].id),f!=null){const u=o.get(n.id),p=o.get(f),m=p?a.get(p.id):null,h=p==null?void 0:p.node.current;if(h&&m&&u&&p){const y=bo(h).some((T,R)=>l[R]!==T),w=qp(u,p),b=rT(u,p),v=y||!w?{x:0,y:0}:{x:b?r.width-m.width:0,y:b?r.height-m.height:0},C={x:m.left,y:m.top};return v.x&&v.y?C:Mr(C,v)}}}};function qp(e,t){return!Va(e)||!Va(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function rT(e,t){return!Va(e)||!Va(t)||!qp(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const fa=50;function Gp(e){const[t,n]=E([]),[r,a]=E(void 0),[o,s]=E(!0),[l,c]=E(!1),[d,f]=E(!1),[u,p]=E(null),m=M(!1),h=K(async()=>{if(!m.current){m.current=!0,c(!0),p(null);try{const y=e===null?await Pc({cursor:r,limit:fa}):await Dc(e,{cursor:r,limit:fa});n(w=>[...w,...y.items]),a(y.nextCursor??void 0),s(y.nextCursor!==null),f(!0)}catch(y){p(y instanceof Error?y.message:String(y))}finally{m.current=!1,c(!1)}}},[e,r]),g=K(async()=>{if(!m.current){m.current=!0,c(!0),p(null);try{const y=e===null?await Pc({cursor:void 0,limit:fa}):await Dc(e,{cursor:void 0,limit:fa});n(y.items),a(y.nextCursor??void 0),s(y.nextCursor!==null),f(!0)}catch(y){p(y instanceof Error?y.message:String(y))}finally{m.current=!1,c(!1)}}},[e]);return{items:t,setItems:n,hasMore:o,loading:l,loaded:d,error:u,loadMore:h,reload:g}}function Ha({node:e,onSelect:t,onCreateChild:n,onDeleted:r,refreshSignal:a,selectedId:o=null,sortable:s=!1,documentTypes:l=[]}){const{t:c,i18n:d}=oe(),[f,u]=E(!1),{items:p,setItems:m,hasMore:h,loading:g,loaded:y,error:w,loadMore:b,reload:v}=Gp(e.id),{attributes:C,listeners:N,setNodeRef:T,transform:R,transition:L,isDragging:I}=ll({id:e.id}),P=ol(Hn(Xr),Hn(Yr,{coordinateGetter:cl})),[k,S]=E(null),[A,D]=E(null),[B,U]=E(!1),[z,_]=E(!1),G=M(null);function V(){U(!1),S(null),D(null),_(!1)}async function ee(){U(!0),S(null),D(null);try{const F=await Ic(e.id,{});if(F.ok){r(e,F.trashedCount),V();return}S({nodeName:F.nodeName,descendantCount:F.descendantCount})}catch(F){D(F instanceof ve?F.message:c("contentTree.deleteError",{name:e.path}))}}async function Z(){if(!(!k||z)){_(!0),D(null);try{const F=await Ic(e.id,{confirm:!0});if(!F.ok)return;r(e,F.trashedCount),V()}catch(F){D(F instanceof ve?F.message:c("contentTree.deleteError",{name:k.nodeName})),_(!1)}}}function j(){const F=!f;u(F),F&&!y&&!g&&b()}O(()=>{a&&a.parentId===e.id&&v()},[a==null?void 0:a.token]);function le(F){const{active:q,over:be}=F;if(!be||q.id===be.id)return;const Pe=p.findIndex(Ue=>Ue.id===q.id),He=p.findIndex(Ue=>Ue.id===be.id);if(Pe===-1||He===-1)return;const Be=Kn(p,Pe,He);m(Be),YN(e.id,Be.map(Ue=>Ue.id)).catch(()=>{J({variant:"danger",title:c("contentTree.reorderError")}),v()})}const Se=!h&&p.length>1,ge=l.find(F=>F.id===e.documentTypeId),Le=Ji(ge==null?void 0:ge.icon),ue=s?{transform:Cn.Transform.toString(R),transition:L,opacity:I?.5:1}:void 0;return x("li",{ref:s?T:void 0,style:ue,children:[x("div",{className:se("group flex h-8 items-center gap-1 rounded-md border-s-2 pe-1 transition-colors duration-fast",e.id===o?Sp:Xi),children:[s&&i("button",{type:"button","aria-label":c("contentTree.dragHandle",{name:$t(e)}),className:"cursor-grab touch-none rounded-md p-1 text-text-secondary hover:bg-background-hover",...C,...N,children:i(qi,{"aria-hidden":"true",className:"size-4"})}),i("button",{type:"button",onClick:j,"aria-expanded":f,"aria-label":c("contentTree.toggle",{name:$t(e)}),className:"rounded-md p-1 text-text-secondary transition-colors duration-fast hover:bg-background-hover hover:text-text-primary",children:i(sn,{"aria-hidden":"true",className:se("size-4 shrink-0 transition-transform duration-fast",f?"rotate-90":"rtl:rotate-180")})}),i("span",{"data-icon":Zi(ge==null?void 0:ge.icon),className:"text-text-secondary",children:i(Le,{"aria-hidden":!0,className:"size-4 shrink-0"})}),i("button",{type:"button",onClick:()=>t(e),"aria-current":e.id===o?"page":void 0,className:"min-w-0 flex-1 truncate rounded-md px-2 py-1 text-start text-sm",children:$t(e)}),i("button",{type:"button","aria-label":c("contentTree.createChild",{name:$t(e)}),onClick:()=>n(e),className:"grid size-6 shrink-0 place-items-center rounded-md text-text-secondary opacity-0 transition-opacity duration-fast hover:bg-background-hover hover:text-text-primary focus-visible:opacity-100 group-hover:opacity-100",children:i(_a,{"aria-hidden":"true",className:"size-4"})}),x(_i,{children:[i(Fi,{asChild:!0,children:i("button",{ref:G,type:"button","aria-label":c("contentTree.rowActionsAria",{name:$t(e)}),className:"grid size-6 shrink-0 place-items-center rounded-md text-text-secondary opacity-0 transition-opacity duration-fast hover:bg-background-hover hover:text-text-primary focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100",children:i(gp,{"aria-hidden":"true",className:"size-4"})})}),i($i,{align:d.dir()==="rtl"?"start":"end",children:i(La,{variant:"destructive",onSelect:()=>void ee(),children:c("contentTree.deleteAction")})})]})]}),i(Jn,{open:B,onOpenChange:F=>!F&&V(),children:x(Zn,{onEscapeKeyDown:F=>{z&&F.preventDefault()},onCloseAutoFocus:F=>{var q;F.preventDefault(),(q=G.current)==null||q.focus()},children:[x(Qn,{children:[i(tr,{children:c("contentTree.deleteTitle",{name:(k==null?void 0:k.nodeName)??e.path})}),k&&i(nr,{children:c("contentTree.deleteBody",{name:k.nodeName,count:k.descendantCount})})]}),A&&i("p",{role:"alert",className:"text-sm text-danger-600",children:A}),x(er,{children:[i(ar,{disabled:z,children:c("contentTree.deleteCancel")}),k&&i(rr,{disabled:z,className:Tt({variant:"destructive"}),onClick:F=>{F.preventDefault(),Z()},children:c("contentTree.deleteConfirm",{total:k.descendantCount+1})})]})]})}),f&&x("ul",{className:"ms-4 flex flex-col gap-1 border-s border-border-subtle ps-2",children:[Se?i(Ua,{sensors:P,onDragEnd:le,children:i(ja,{items:p.map(F=>F.id),strategy:za,children:p.map(F=>i(Ha,{node:F,onSelect:t,onCreateChild:n,onDeleted:r,refreshSignal:a,selectedId:o,documentTypes:l,sortable:!0},F.id))})}):p.map(F=>i(Ha,{node:F,onSelect:t,onCreateChild:n,onDeleted:r,refreshSignal:a,selectedId:o,documentTypes:l},F.id)),y&&p.length===0&&!w&&i("li",{className:"px-2 py-1 text-xs text-text-secondary",children:c("contentTree.empty")}),w&&i("li",{className:"px-2 py-1 text-xs text-danger-600",children:w}),h&&i("li",{children:i(H,{variant:"ghost",size:"sm",disabled:g,onClick:()=>void b(),children:c(g?"contentTree.loading":"contentTree.loadMore")})})]})]})}const aT=10;function oT({onSelect:e,refreshSignal:t}){const{t:n}=oe(),{user:r}=Tn(),a=(r==null?void 0:r.role)==="admin",[o,s]=E(null),[l,c]=E(!1);return O(()=>{if(!a)return;let d=!1;return Fs(void 0,aT).then(({items:f,nextCursor:u})=>{d||(s(f.length),c(!!u))}).catch(()=>{d||(s(null),c(!1))}),()=>{d=!0}},[a,t==null?void 0:t.token]),i("div",{className:"mt-2 border-t border-border-subtle pt-2",children:x("button",{type:"button",onClick:e,className:se(Np,"h-8",Xi,"text-text-secondary"),children:[i(DN,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("span",{className:"min-w-0 flex-1 truncate",children:n("trash.recycleBin")}),!!o&&i(de,{variant:"neutral",children:l?`${o}+`:o})]})})}function sT({onSelect:e,onCreateChild:t,onDeleted:n,onSelectTrash:r,refreshSignal:a,selectedId:o,documentTypes:s=[]}){const{t:l}=oe(),{items:c,setItems:d,hasMore:f,loading:u,loaded:p,error:m,loadMore:h,reload:g}=Gp(null),y=ol(Hn(Xr),Hn(Yr,{coordinateGetter:cl}));O(()=>{!p&&!u&&h()},[]),O(()=>{a&&a.parentId===null&&g()},[a==null?void 0:a.token]);function w(C){const{active:N,over:T}=C;if(!T||N.id===T.id)return;const R=c.findIndex(P=>P.id===N.id),L=c.findIndex(P=>P.id===T.id);if(R===-1||L===-1)return;const I=Kn(c,R,L);d(I),GN(I.map(P=>P.id)).catch(()=>{J({variant:"danger",title:l("contentTree.reorderError")}),g()})}const b=!f&&c.length>1;let v;return u&&!p?v=x("div",{"aria-label":l("contentTree.loading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-6 w-3/4"}),i(pe,{className:"h-6 w-2/3"}),i(pe,{className:"h-6 w-1/2"})]}):p&&c.length===0&&!m?v=i(ke,{icon:i(Wi,{"aria-hidden":"true"}),title:l("contentTree.empty"),description:l("contentTree.emptyDescription")}):v=x("div",{className:"flex flex-col gap-2",children:[i("ul",{className:"flex flex-col gap-1",children:b?i(Ua,{sensors:y,onDragEnd:w,children:i(ja,{items:c.map(C=>C.id),strategy:za,children:c.map(C=>i(Ha,{node:C,onSelect:e,onCreateChild:t,onDeleted:n,refreshSignal:a,selectedId:o,documentTypes:s,sortable:!0},C.id))})}):c.map(C=>i(Ha,{node:C,onSelect:e,onCreateChild:t,onDeleted:n,refreshSignal:a,selectedId:o,documentTypes:s},C.id))}),m&&i("p",{className:"text-xs text-danger-600",children:m}),f&&i(H,{variant:"outline",size:"sm",disabled:u,onClick:()=>void h(),children:l(u?"contentTree.loading":"contentTree.loadMore")})]}),x("div",{className:"flex flex-col gap-2",children:[v,i(oT,{onSelect:r,refreshSignal:a})]})}function At({crumb:e,title:t,meta:n,actions:r}){const a=ir();return x("div",{className:"shrink-0 px-8 pb-4 pt-6",children:[i("p",{className:"flex items-center gap-1 text-xs text-text-tertiary",children:e.map((o,s)=>x("span",{className:"flex items-center gap-1",children:[s>0&&i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 rtl:rotate-180"}),o]},s))}),x("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:a,className:"text-2xl font-semibold tracking-tight text-text-primary focus:outline-none",children:t}),r&&i("span",{className:"ms-auto flex items-center gap-2",children:r})]}),n&&i("p",{className:"mt-1 text-sm text-text-secondary",children:n})]})}function iT(e){if(e&&typeof e=="object"&&"status"in e&&e.status===409&&"blockingAncestorPath"in e){const t=e.blockingAncestorPath;if(typeof t=="string")return t}return null}function lT(e,t,n,r=Date.now()){const a=new Date(e).getTime();if(!Number.isFinite(a))return n;const o=a-r,s=new Intl.RelativeTimeFormat(t,{numeric:"always"}),l=Math.abs(o),c=6e4,d=60*c,f=24*d;return l<c?s.format(Math.round(o/1e3),"second"):l<d?s.format(Math.round(o/c),"minute"):l<f?s.format(Math.round(o/d),"hour"):s.format(Math.round(o/f),"day")}function cT({item:e,onRestored:t}){const{t:n,i18n:r}=oe(),[a,o]=E(!1),[s,l]=E(!1),[c,d]=E(null);async function f(){if(!s){l(!0),d(null);try{await oS(e.id),t(e.id)}catch(u){const p=iT(u);d(p?n("trash.restoreBlocked",{ancestor:p}):n("trash.restoreFailed")),l(!1),o(!1)}}}return x("li",{className:"flex flex-col gap-2 rounded-md border border-border-subtle px-3 py-2",children:[x("div",{className:"flex items-center justify-between gap-4",children:[x("div",{className:"min-w-0",children:[i("p",{className:"truncate text-sm font-medium text-text-primary",children:e.path}),i("p",{className:"text-xs text-text-secondary",children:n("trash.nodeCount",{count:e.nodeCount})}),i("p",{className:"text-xs text-text-secondary",children:n("trash.deletedAt",{when:lT(e.deletedAt,r.language,n("trash.unknownTime"))})}),e.orphaned&&x("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[i(de,{variant:"warning",children:n("trash.orphanedBadge")}),i("span",{className:"text-xs text-text-secondary",children:n("trash.orphanedExplain")})]})]}),a?i(H,{type:"button",variant:"destructive",size:"sm",disabled:s,onClick:()=>void f(),children:n("trash.restoreConfirm")}):i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>o(!0),children:n("trash.restore")})]}),c&&i("p",{role:"alert",className:"text-xs text-danger-600",children:c})]})}function dT({onRestored:e}={}){const{t}=oe();Re([t("trash.title"),t("nav.content")]);const[n,r]=E([]),[a,o]=E(null),[s,l]=E(!1),[c,d]=E(!1),f=K(async()=>{try{const{items:m,nextCursor:h}=await Fs();r(m),o(h),d(!1)}catch{d(!0)}finally{l(!0)}},[]);O(()=>{f()},[f]);async function u(){if(a)try{const{items:m,nextCursor:h}=await Fs(a);r(g=>[...g,...m]),o(h)}catch{d(!0)}}function p(m){r(h=>{const g=h.find(y=>y.id===m);return g&&(e==null||e(g)),h.filter(y=>y.id!==m)})}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[t("nav.content"),t("trash.title")],title:t("trash.title")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[s&&!c&&n.length===0&&i(ke,{title:t("trash.empty")}),s&&c&&x("div",{role:"alert",className:"flex flex-col items-start gap-2 rounded-md border border-danger-500 bg-background-elevated p-4",children:[i("p",{className:"text-sm font-medium text-danger-600",children:t("trash.loadFailed")}),i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>void f(),children:t("trash.retry")})]}),s&&!c&&n.length>0&&i("ul",{className:"flex flex-col gap-2",children:n.map(m=>i(cT,{item:m,onRestored:p},m.id))}),s&&!c&&a&&i(H,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void u(),children:t("contentTree.loadMore")})]})]})}function Hc(){const{t:e}=oe(),{nodeId:t}=Xn(),n=Wt(),[r,a]=E({mode:"welcome"}),[o,s]=E([]),[l,c]=E(null);O(()=>{Ep({limit:100}).then(({items:u})=>s(u)).catch(()=>s([]))},[]),O(()=>{a({mode:"welcome"})},[t]);const d=K(u=>{a({mode:"welcome"}),n(`/content/${u.id}`)},[n]),f=!!t&&r.mode==="welcome";return Re(f||r.mode!=="welcome"?[void 0]:[e("nav.content")]),x(Ie,{children:[i(Vn,{label:e("nav.content"),children:i(Bt,{title:e("nav.content"),action:i("button",{type:"button","aria-label":e("contentTree.newContent"),onClick:()=>a({mode:"create",parent:null}),className:"grid size-6 place-items-center rounded-md text-text-secondary transition-colors duration-fast hover:bg-background-hover hover:text-text-primary",children:i(_a,{"aria-hidden":"true",className:"size-4"})}),children:i(sT,{refreshSignal:l,selectedId:t??null,documentTypes:o,onSelect:d,onCreateChild:u=>a({mode:"create",parent:u}),onSelectTrash:()=>a({mode:"trash"}),onDeleted:(u,p)=>{J({variant:"success",title:e("contentTree.deletedToast",{total:p})}),c(m=>({token:((m==null?void 0:m.token)??0)+1,parentId:u.parentId})),t===u.id&&n("/content")}})})}),f?i(me,{flush:!0,children:i(wS,{nodeId:t,documentTypes:o})}):r.mode==="trash"?i(me,{flush:!0,children:i(dT,{onRestored:()=>c(u=>({token:((u==null?void 0:u.token)??0)+1,parentId:null}))})}):i(me,{children:r.mode==="create"?i(cS,{documentTypes:o,parent:r.parent,onCancel:()=>a({mode:"welcome"}),onCreated:u=>{c(p=>{var m;return{token:((p==null?void 0:p.token)??0)+1,parentId:((m=r.parent)==null?void 0:m.id)??null}}),d(u)}}):i(ke,{icon:i(Wi,{"aria-hidden":"true"}),title:e("contentSection.welcomeTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:e("contentSection.welcomeDescription")})})]})}function uT(){const{t:e}=oe(),t=Xe(),n=Wt(),[r,a]=E({state:"loading"});if(Re([r.state==="match"?e("headlessBridge.contentTitle"):r.state==="none"?e("headlessBridge.notFoundTitle"):e("headlessBridge.resolving")]),O(()=>{let o=!1;return a({state:"loading"}),qN(t.pathname).then(s=>{o||a(s?{state:"match",node:s}:{state:"none"})}).catch(()=>{o||a({state:"none"})}),()=>{o=!0}},[t.pathname]),r.state==="loading")return i(me,{children:i(ke,{title:e("headlessBridge.resolving"),titleAs:"h1"})});if(r.state==="match"){const o=`${window.location.origin}/api/v1/content/by-path?path=${encodeURIComponent(t.pathname)}`;return i(me,{children:i(ke,{icon:i(bp,{"aria-hidden":"true"}),title:e("headlessBridge.contentTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:e("headlessBridge.contentBody"),action:x("div",{className:"flex flex-col items-center gap-3",children:[x("div",{className:"max-w-lg text-start",children:[i("p",{className:"text-xs font-medium text-text-secondary",children:e("headlessBridge.apiUrlLabel")}),i("code",{className:"mt-1 block overflow-x-auto rounded-md border border-border-default bg-background-hover px-3 py-2 text-sm",children:o})]}),i(H,{type:"button",onClick:()=>n(`/content/${r.node.id}`),children:e("headlessBridge.openInEditor")})]})})})}return i(me,{children:i(ke,{icon:i(gC,{"aria-hidden":"true"}),title:e("headlessBridge.notFoundTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:e("headlessBridge.notFoundBody"),action:i(Ut,{to:"/content",className:se(Tt({variant:"outline",size:"sm"})),children:e("headlessBridge.backToContent")})})})}async function Kc(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit)),e.search&&t.set("search",e.search);const n=t.toString(),r=await X(`/api/media${n?`?${n}`:""}`);return re(r)}async function fT(e){const t=new FormData;t.append("file",e);const n=await X("/api/media",{method:"POST",body:t});return re(n)}async function pT(e){const t=await X(`/api/media/${e}/link`,{method:"POST"});return re(t)}async function hT(e){const t=await X(`/api/media/${e}`,{method:"DELETE"});await re(t)}async function mT(e,t){const n=await X(`/api/media/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({visibility:t})});return re(n)}function gT(e){if(e<1024)return`${e} B`;const t=["KB","MB","GB"];let n=e,r="B";for(const a of t){if(n<1024)break;n/=1024,r=a}return`${n.toFixed(n>=10?0:1)} ${r}`}const Wc=24,yT=300;function vT(){const{t:e}=oe(),[t,n]=E([]),[r,a]=E(null),[o,s]=E(!1),[l,c]=E(!1),[d,f]=E(""),[u,p]=E(""),[m,h]=E(!1),[g,y]=E(!1),[w,b]=E(null),v=M(null),C=K(async k=>{c(!0);try{const{items:S,nextCursor:A}=await Kc({limit:Wc,search:k||void 0});n(S),a(A),s(!0)}catch{J({variant:"danger",title:e("mediaLibrary.genericError")})}finally{c(!1)}},[e]);O(()=>{const k=setTimeout(()=>p(d),yT);return()=>clearTimeout(k)},[d]),O(()=>{C(u)},[u,C]);async function N(){if(r){c(!0);try{const{items:k,nextCursor:S}=await Kc({cursor:r,limit:Wc,search:u||void 0});n(A=>[...A,...k]),a(S)}catch{J({variant:"danger",title:e("mediaLibrary.genericError")})}finally{c(!1)}}}async function T(k){const S=Array.from(k);if(S.length!==0){h(!0);try{for(const A of S)try{await fT(A),J({variant:"success",title:e("mediaLibrary.uploadedToast",{name:A.name})})}catch{J({variant:"danger",title:e("mediaLibrary.uploadFailedToast",{name:A.name})})}await C(u)}finally{h(!1)}}}function R(k){k.preventDefault(),y(!1),T(k.dataTransfer.files)}async function L(k){try{await hT(k.id),n(S=>S.filter(A=>A.id!==k.id)),b(null),J({variant:"success",title:e("mediaLibrary.deletedToast",{name:k.filename})})}catch{J({variant:"danger",title:e("mediaLibrary.genericError")})}}async function I(k){try{const{url:S}=await pT(k.id);await navigator.clipboard.writeText(new URL(S,window.location.origin).toString()),J({variant:"success",title:e("mediaLibrary.linkCopiedToast")})}catch{J({variant:"danger",title:e("mediaLibrary.copyLinkFailedToast")})}}async function P(k,S){const A=S?"private":"public",D=k.visibility;n(B=>B.map(U=>U.id===k.id?{...U,visibility:A}:U));try{await mT(k.id,A)}catch{n(B=>B.map(U=>U.id===k.id?{...U,visibility:D}:U)),J({variant:"danger",title:e("mediaLibrary.genericError")})}}return x("div",{onDragOver:k=>{k.preventDefault(),y(!0)},onDragLeave:()=>y(!1),onDrop:R,className:se("flex h-full min-h-0 flex-col transition-colors duration-fast",g&&"bg-background-hover"),children:[i(At,{crumb:[e("nav.media"),e("mediaTree.all")],title:e("mediaTree.all"),actions:x(H,{type:"button",size:"sm",disabled:m,onClick:()=>{var k;return(k=v.current)==null?void 0:k.click()},children:[i(cC,{"aria-hidden":"true",className:"size-4"}),e(m?"mediaLibrary.uploading":"mediaLibrary.upload")]})}),i("input",{ref:v,type:"file",multiple:!0,className:"hidden","aria-label":e("mediaLibrary.upload"),onChange:k=>{k.target.files&&T(k.target.files),k.target.value=""}}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[x("div",{className:"flex flex-wrap items-center gap-3",children:[i(ye,{id:"media-search",type:"search","aria-label":e("mediaLibrary.searchLabel"),placeholder:e("mediaLibrary.searchPlaceholder"),value:d,onChange:k=>f(k.target.value),className:"max-w-sm"}),i("p",{className:"text-xs text-text-secondary",children:e("mediaLibrary.dropHint")})]}),!o&&l&&x("div",{"aria-label":e("contentTree.loading"),className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:[i(pe,{className:"h-40"}),i(pe,{className:"h-40"}),i(pe,{className:"h-40"}),i(pe,{className:"h-40"})]}),o&&t.length===0&&(u?i(ke,{icon:i(Ma,{"aria-hidden":"true"}),title:e("mediaLibrary.noResults",{search:u})}):i(ke,{icon:i(Ma,{"aria-hidden":"true"}),title:e("mediaLibrary.empty"),description:e("mediaLibrary.emptyDescription")})),t.length>0&&i("ul",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:t.map(k=>x("li",{className:"flex flex-col overflow-hidden rounded-md border border-border-default bg-background-elevated",children:[x("div",{className:"relative flex h-28 items-center justify-center overflow-hidden bg-background-base",children:[k.mimeType.startsWith("image/")?i("img",{src:k.downloadUrl,alt:k.filename,className:"h-full w-full object-cover"}):i(yp,{"aria-hidden":"true",className:"size-8 text-text-secondary"}),k.visibility==="private"&&i(de,{variant:"neutral",className:"absolute start-2 top-2",children:e("mediaLibrary.privateBadge")})]}),w===k.id?x("div",{className:"flex flex-col gap-2 p-3",children:[i("p",{className:"text-xs text-danger-600",children:e("mediaLibrary.confirmBody")}),x("div",{className:"flex items-center gap-2",children:[i(H,{type:"button",variant:"destructive",size:"sm",onClick:()=>void L(k),children:e("mediaLibrary.confirmDelete")}),i(H,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(null),children:e("mediaLibrary.cancel")})]})]}):x("div",{className:"flex flex-col gap-2 p-3",children:[x("div",{className:"flex items-center gap-2",children:[x("div",{className:"min-w-0 flex-1",children:[i("p",{className:"truncate text-sm text-text-primary",title:k.filename,children:k.filename}),i("p",{className:"text-xs text-text-secondary",children:gT(k.size)})]}),i(H,{type:"button",variant:"ghost",size:"sm","aria-label":e("mediaLibrary.deleteLabel",{name:k.filename}),onClick:()=>b(k.id),children:e("mediaLibrary.delete")})]}),x("div",{className:"flex flex-col gap-1",children:[x("label",{htmlFor:`media-private-${k.id}`,className:"flex items-center gap-2 text-xs text-text-secondary",children:[i(Pd,{id:`media-private-${k.id}`,checked:k.visibility==="private",onCheckedChange:S=>void P(k,S===!0)}),e("mediaLibrary.privateLabel")]}),i("p",{className:"text-xs text-text-tertiary",children:e("mediaLibrary.privateHelp")})]}),k.visibility==="private"&&i(H,{type:"button",variant:"outline",size:"sm",className:"self-start","aria-label":e("mediaLibrary.copyLinkLabel",{name:k.filename}),onClick:()=>void I(k),children:e("mediaLibrary.copyLink")})]})]},k.id))}),r&&i(H,{type:"button",variant:"outline",size:"sm",className:"self-start",disabled:l,onClick:()=>void N(),children:e("mediaLibrary.loadMore")})]})]})}async function Yp(){const e=await X("/api/plugins?limit=100");return(await re(e)).items}function bT(e){const t=e.replace(/[^a-zA-Z0-9]/g,"_");return/^[0-9]/.test(t)?`plugin_${t}`:t}function xT(e,t){return new URL(e,t).href}async function wT(){let e;try{e=await Yp()}catch(t){console.error("bootRemotePlugins: failed to list installed plugins",t);return}for(const t of e)if(t.remoteUrl)try{const n=await ag({name:bT(t.pluginId),url:xT(t.remoteUrl,window.location.origin)});og(n),sg(n)}catch(n){console.error(`bootRemotePlugins: failed to load "${t.pluginId}" from ${t.remoteUrl}`,n)}}function CT(){return null}const Jr="/api/plugin-management/plugins";async function qc(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=await X(`${Jr}${n?`?${n}`:""}`);return re(r)}async function NT(e){const t=await X(`${Jr}/${encodeURIComponent(e)}/activate`,{method:"POST"});await re(t)}async function ST(e){const t=await X(`${Jr}/${encodeURIComponent(e)}/deactivate`,{method:"POST"});await re(t)}async function ET(e){const t=await X(`${Jr}/${encodeURIComponent(e)}/license/recheck`,{method:"POST"});return re(t)}async function TT(e,t={}){const n=await X(`${Jr}/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(n.ok){const r=await n.json().catch(()=>null);return r&&"memberSnapshots"in r?{ok:!0,snapshotGroupId:null,memberSnapshots:r.memberSnapshots}:{ok:!0,snapshotGroupId:r&&"snapshotGroupId"in r?r.snapshotGroupId:null}}if(n.status===409){const r=await n.json().catch(()=>null);if(r!=null&&r.requiresConfirmation&&r.snapshotGroupId)return{ok:!1,requiresConfirmation:!0,snapshotGroupId:r.snapshotGroupId,message:r.message??""};if(r!=null&&r.requiresConfirmation&&r.memberSnapshots)return{ok:!1,requiresConfirmation:!0,snapshotGroupId:null,memberSnapshots:r.memberSnapshots,message:r.message??""};throw new ve((r==null?void 0:r.message)??n.statusText,n.status,r==null?void 0:r.blockedBy)}throw await re(n),new ve(n.statusText,n.status)}function kT({plugin:e,onClose:t,onUninstalled:n,onCloseAutoFocus:r}){const{t:a}=oe(),[o,s]=E("confirm"),[l,c]=E(null),[d,f]=E(null),[u,p]=E(!1),[m,h]=E(null),[g,y]=E(null),[w,b]=E(!1),v=M(0),C=M(!1);function N(R){C.current=R,b(R)}O(()=>{v.current+=1,s("confirm"),c(null),f(null),p(!1),h(null),y(null),N(!1)},[e]);async function T(){if(!e||C.current)return;const R=v.current;N(!0),h(null),y(null);try{const L=await TT(e.pluginId,o==="structured"?{confirmStructuredDataCleanup:!0}:{});if(v.current!==R)return;if(L.ok){if(n(),L.memberSnapshots&&L.memberSnapshots.length>0){f(L.memberSnapshots),p(!0);return}if(L.snapshotGroupId){c(L.snapshotGroupId),p(!0);return}t();return}s("structured"),c(L.snapshotGroupId),f(L.memberSnapshots??null)}catch(L){if(v.current!==R)return;h(L instanceof ve?L.message:a("pluginsManage.toggleFailed")),y(L instanceof ve?L.blockedBy??null:null)}finally{v.current===R&&N(!1)}}return i(Jn,{open:e!==null,onOpenChange:R=>!R&&t(),children:x(Zn,{onEscapeKeyDown:R=>{C.current&&R.preventDefault()},onCloseAutoFocus:r,children:[x(Qn,{children:[i(tr,{children:u?a("pluginsManage.uninstallDoneTitle",{name:(e==null?void 0:e.name)??""}):a("pluginsManage.uninstallTitle",{name:(e==null?void 0:e.name)??""})}),i(nr,{children:o==="structured"?d?a(u?"pluginsManage.uninstallBundleStructuredRestoreHint":"pluginsManage.uninstallBundleStructuredBody"):u?a("pluginsManage.uninstallStructuredRestoreHint",{snapshotGroupId:l??""}):a("pluginsManage.uninstallStructuredBody",{snapshotGroupId:l??""}):a("pluginsManage.uninstallBody")})]}),d&&d.length>0&&i("ul",{className:"flex flex-col gap-1",children:d.map(R=>i("li",{className:"text-sm",children:u?x(Ut,{to:`/plugin-management/installed/${encodeURIComponent(R.pluginId)}/snapshots`,state:{name:R.pluginId},onClick:t,className:"font-medium text-primary-600 underline-offset-4 hover:underline",children:[R.pluginId," — ",a("pluginsManage.snapshotsAction")]}):i("span",{className:"text-text-secondary",children:a("pluginsManage.uninstallBundleMemberSnapshot",{pluginId:R.pluginId,snapshotGroupId:R.snapshotGroupId})})},R.pluginId))}),u&&!d&&e&&i(Ut,{to:`/plugin-management/installed/${encodeURIComponent(e.pluginId)}/snapshots`,state:{name:e.name},onClick:t,className:"text-sm font-medium text-primary-600 underline-offset-4 hover:underline",children:a("pluginsManage.snapshotsAction")}),g&&g.length>0?x("div",{role:"alert",className:"text-sm text-danger-600",children:[i("p",{children:a("pluginsManage.uninstallBlockedLeadIn")}),i("ul",{className:"flex flex-col gap-0.5 ps-5 list-disc",children:g.map(R=>i("li",{children:R.contentCount!==void 0?a("pluginsManage.uninstallBlockedItemWithCount",{documentType:R.documentType,count:R.contentCount}):a("pluginsManage.uninstallBlockedItemNoCount",{documentType:R.documentType})},R.documentType))})]}):m&&i("p",{role:"alert",className:"text-sm text-danger-600",children:m}),x(er,{children:[i(ar,{disabled:w,children:a(u?"pluginsManage.uninstallClose":"pluginsManage.uninstallCancel")}),!u&&i(rr,{disabled:w,className:Tt({variant:"destructive"}),onClick:R=>{R.preventDefault(),T()},children:a(w?"pluginsManage.uninstalling":o==="structured"?"pluginsManage.uninstallStructuredConfirm":"pluginsManage.uninstallConfirm")})]})]})})}const Gc=50,Yc="grid grid-cols-[minmax(0,1fr)_4rem_6rem_6rem_11rem_2.75rem_6rem] items-center gap-3",RT=7;function PT(e,t=Date.now()){return e.licenseStatus!=="valid"||!e.licenseLastAttemptError?!1:e.licenseLastValidatedAt?t-new Date(e.licenseLastValidatedAt).getTime()>RT*24*60*60*1e3:!0}function Xc(e,t,n=Date.now()){const r=new Date(e).getTime()-n,a=new Intl.RelativeTimeFormat(t,{numeric:"always"}),o=Math.abs(r),s=6e4,l=60*s,c=24*l;return o<s?a.format(Math.round(r/1e3),"second"):o<l?a.format(Math.round(r/s),"minute"):o<c?a.format(Math.round(r/l),"hour"):a.format(Math.round(r/c),"day")}function DT({plugin:e,recheckPending:t,recheckError:n,onRecheck:r}){var c;const{t:a,i18n:o}=oe();if(e.licenseStatus===null)return i("span",{className:"justify-self-start text-text-secondary","aria-label":a("pluginsManage.licenseNone"),children:"—"});const s=PT(e);let l;if(e.licenseStatus==="revoked"){const d=(c=e.licenseReason)==null?void 0:c.trim(),u=!d||d.toLowerCase()==="revoked"?a("pluginsManage.licenseRevokedBare"):a("pluginsManage.licenseRevoked",{reason:d});l=i(de,{className:"max-w-full truncate",variant:"danger",title:u,children:u})}else if(e.licenseStatus==="domain_mismatch"){const d=e.boundDomain?a("pluginsManage.licenseDomainMismatch",{domain:e.boundDomain}):a("pluginsManage.licenseDomainMismatchBare");l=i(de,{className:"max-w-full truncate",variant:"warning",title:d,children:d})}else if(e.licenseStatus==="valid"&&s){const d=a("pluginsManage.licenseUnreachable",{time:e.licenseLastValidatedAt?Xc(e.licenseLastValidatedAt,o.language):""});l=i(de,{className:"max-w-full truncate",variant:"warning",title:d,children:d})}else e.licenseStatus==="valid"?l=i(de,{className:"max-w-full truncate",variant:"success",children:a("pluginsManage.licenseValid")}):l=i(de,{className:"max-w-full truncate",variant:"neutral",children:e.licenseStatus});return x("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[l,e.licenseStatus==="valid"&&!s&&e.licenseLastValidatedAt&&i("span",{className:"max-w-full truncate text-xs text-text-secondary",children:a("pluginsManage.licenseCheckedAgo",{time:Xc(e.licenseLastValidatedAt,o.language)})}),e.licenseStatus==="valid"&&!s&&!e.enabled&&i("span",{className:"max-w-full text-xs text-warning-700",children:a("pluginsManage.licenseValidButDisabled")}),i(H,{type:"button",variant:"outline",size:"sm",onClick:r,disabled:t,children:a("pluginsManage.licenseRecheck")}),n&&i("span",{role:"alert",className:"max-w-full truncate text-xs text-danger-600",children:n})]})}function IT(){const{t:e,i18n:t}=oe();Re([e("pluginsManage.title"),e("nav.plugins")]);const[n,r]=E([]),[a,o]=E(null),[s,l]=E(!1),[c,d]=E(!1),[f,u]=E(null),[p,m]=E(null),h=M(new Map),g=M(null),[y,w]=E(null),[b,v]=E({}),C=K(async()=>{try{const{items:I,nextCursor:P}=await qc({limit:Gc});r(I),o(P),d(!1),l(!0)}catch{d(!0),l(!0)}},[]);O(()=>{C()},[C]);async function N(){if(a)try{const{items:I,nextCursor:P}=await qc({cursor:a,limit:Gc});r(k=>[...k,...I]),o(P)}catch{J({variant:"danger",title:e("pluginsManage.errorTitle")})}}async function T(I,P){u(I.pluginId);try{P?await NT(I.pluginId):await ST(I.pluginId),await C()}catch(k){J({variant:"danger",title:k instanceof ve?k.message:e("pluginsManage.toggleFailed")}),await C()}finally{u(null)}}function R(I){g.current=h.current.get(I.pluginId)??null,m(I)}async function L(I){w(I.pluginId),v(P=>{if(!(I.pluginId in P))return P;const k={...P};return delete k[I.pluginId],k});try{const P=await ET(I.pluginId);if(P.checked&&P.status==="revoked"){await C();return}r(k=>k.map(S=>S.pluginId!==I.pluginId?S:P.checked?{...S,licenseStatus:P.status,licenseReason:P.reason,licenseLastValidatedAt:P.lastValidatedAt,licenseLastAttemptError:null}:{...S,licenseLastAttemptError:P.reason,licenseLastValidatedAt:P.lastValidatedAt}))}catch(P){v(k=>({...k,[I.pluginId]:P instanceof ve?P.message:e("pluginsManage.licenseRecheckFailed")}))}finally{w(null)}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.plugins"),e("pluginsManage.installed")],title:e("pluginsManage.title")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[!s&&x("div",{"aria-label":e("contentTree.loading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]}),s&&c&&x("div",{role:"alert",className:"flex flex-col items-start gap-2 rounded-md border border-danger-500 bg-background-elevated p-4",children:[i("p",{className:"text-sm font-medium text-danger-600",children:e("pluginsManage.errorTitle")}),i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>void C(),children:e("pluginsManage.retry")})]}),s&&!c&&n.length===0&&i(ke,{title:e("pluginsManage.empty")}),s&&!c&&n.length>0&&x(Ie,{children:[x("div",{"data-testid":"installed-plugins-header",className:`${Yc} border border-transparent px-3 text-xs font-medium uppercase tracking-wide text-text-secondary`,children:[i("span",{className:"min-w-0",children:e("pluginsManage.columns.name")}),i("span",{className:"justify-self-start",children:e("pluginsManage.columns.version")}),i("span",{className:"justify-self-start",children:e("pluginsManage.columns.trust")}),i("span",{className:"justify-self-start",children:e("pluginsManage.columns.storage")}),i("span",{className:"justify-self-start",children:e("pluginsManage.columns.license")}),i("span",{className:"justify-self-start","aria-hidden":"true"}),i("span",{className:"justify-self-start",children:e("pluginsManage.columns.actions")})]}),i("ul",{className:"flex flex-col gap-1",children:n.map(I=>x("li",{"data-plugin-id":I.pluginId,className:`${Yc} rounded-md border border-border-subtle px-3 py-2`,children:[x("div",{className:"min-w-0",children:[i("p",{className:"truncate text-sm text-text-primary",children:I.name}),i("p",{className:"truncate text-xs text-text-secondary",children:I.pluginId})]}),i("span",{className:"justify-self-start text-xs text-text-secondary",children:I.version}),i(de,{className:"justify-self-start",variant:I.trustTier==="verified"?"success":"neutral",children:I.trustTier==="verified"?e("pluginsManage.verified"):e("pluginsManage.unverified")}),i(de,{className:"justify-self-start",variant:"neutral",children:I.storageType}),i(DT,{plugin:I,recheckPending:y===I.pluginId,recheckError:b[I.pluginId],onRecheck:()=>void L(I)}),i(Ph,{className:"justify-self-start",checked:I.enabled,onCheckedChange:P=>void T(I,P),disabled:f===I.pluginId,"aria-label":e("pluginsManage.toggleAria",{name:I.name})}),x(_i,{children:[i(Fi,{asChild:!0,children:i(H,{ref:P=>{P?h.current.set(I.pluginId,P):h.current.delete(I.pluginId)},className:"justify-self-start",type:"button",variant:"outline",size:"icon","aria-label":e("pluginsManage.rowActionsAria",{name:I.name}),children:i(gp,{"aria-hidden":"true",className:"size-4"})})}),x($i,{align:t.dir()==="rtl"?"start":"end",children:[i(La,{asChild:!0,children:i(Ut,{to:`/plugin-management/installed/${encodeURIComponent(I.pluginId)}/snapshots`,state:{name:I.name},children:e("pluginsManage.snapshotsAction")})}),i(La,{variant:"destructive",onSelect:()=>R(I),children:e("pluginsManage.uninstall")})]})]})]},I.pluginId))})]}),s&&!c&&a&&i(H,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void N(),children:e("pluginsManage.loadMore")})]}),i(kT,{plugin:p,onClose:()=>m(null),onCloseAutoFocus:I=>{const P=g.current;P!=null&&P.isConnected&&(I.preventDefault(),P.focus())},onUninstalled:()=>{J({variant:"success",title:e("pluginsManage.uninstalledToast",{name:(p==null?void 0:p.name)??""})}),C()}})]})}const Xp="/api/plugin-management/marketplace/listings";async function Jc(e={}){const t=new URLSearchParams;e.q&&t.set("q",e.q),e.type&&t.set("type",e.type),e.db&&t.set("db",e.db),e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=await X(`${Xp}${n?`?${n}`:""}`);return re(r)}async function LT(e){const t=await X(`${Xp}/${encodeURIComponent(e)}`);return re(t)}async function AT(){const e=await X("/api/plugin-management/marketplace-status");return re(e)}async function Jp(e){const t=await X("/api/plugin-management/marketplace/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return re(t)}function Zp(e){return e===0?null:`$${(e/100).toFixed(2)}`}const Zc=24,MT=["datatype","section","template","theme","integration","utility","bundle"],OT=["postgresql","mysql","sqlite"],_T={postgresql:"PostgreSQL",mysql:"MySQL",sqlite:"SQLite"};function Ks(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function Er(e){return _T[e]??e}function FT(){const{t:e}=oe(),t=Wt();Re([e("pluginsManage.marketplaceTitle"),e("nav.plugins")]);const[n,r]=E([]),[a,o]=E(null),[s,l]=E(""),[c,d]=E(""),[f,u]=E(!1),[p,m]=E(!1),[h,g]=E(""),[y,w]=E(""),[b,v]=E(null),[C,N]=E(null),T=M(0),R=K(async(S={})=>{const A=S.q??y,D="type"in S?S.type:b,B="db"in S?S.db:C,U=++T.current;try{const z=await Jc({q:A||void 0,type:D??void 0,db:B??void 0,limit:Zc});if(T.current!==U)return;r(z.items),o(z.nextCursor),l(z.activeDialect),d(z.marketplaceBaseUrl),m(!1),u(!0)}catch{if(T.current!==U)return;m(!0),u(!0)}},[y,b,C]);O(()=>{R()},[]);function L(S){S.preventDefault(),w(h),R({q:h})}function I(S){v(S),R({type:S})}function P(S){const A=C===S?null:S;N(A),R({db:A})}async function k(){if(a)try{const S=await Jc({q:y||void 0,type:b??void 0,db:C??void 0,cursor:a,limit:Zc});r(A=>[...A,...S.items]),o(S.nextCursor)}catch{J({variant:"danger",title:e("pluginsManage.marketplaceErrorTitle")})}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.plugins"),e("pluginsManage.marketplace")],title:e("pluginsManage.marketplaceTitle")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[x("form",{onSubmit:L,className:"flex items-center gap-2",children:[i(ye,{"aria-label":e("pluginsManage.marketplaceSearchLabel"),placeholder:e("pluginsManage.marketplaceSearchPlaceholder"),value:h,onChange:S=>g(S.target.value),className:"max-w-sm"}),x(H,{type:"submit",variant:"outline",size:"icon",children:[i(pN,{"aria-hidden":"true",className:"size-4"}),i("span",{className:"sr-only",children:e("pluginsManage.marketplaceSearchLabel")})]})]}),x("div",{className:"flex flex-col gap-2",children:[i("span",{className:"text-xs font-medium uppercase tracking-wide text-text-secondary",children:e("pluginsManage.filterType")}),x("div",{className:"flex flex-wrap gap-2",children:[i(H,{type:"button",variant:b===null?"default":"outline",size:"sm","aria-pressed":b===null,onClick:()=>I(null),children:e("pluginsManage.filterAll")}),MT.map(S=>i(H,{type:"button",variant:b===S?"default":"outline",size:"sm","aria-pressed":b===S,onClick:()=>I(S),children:Ks(S)},S))]})]}),x("div",{className:"flex flex-col gap-2",children:[i("span",{className:"text-xs font-medium uppercase tracking-wide text-text-secondary",children:e("pluginsManage.filterDatabase")}),i("div",{className:"flex flex-wrap gap-2",children:OT.map(S=>i(H,{type:"button",variant:C===S?"default":"outline",size:"sm","aria-pressed":C===S,onClick:()=>P(S),children:Er(S)},S))})]}),!f&&x("div",{"aria-label":e("contentTree.loading"),className:"grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4",children:[i(pe,{className:"h-40 w-full"}),i(pe,{className:"h-40 w-full"}),i(pe,{className:"h-40 w-full"})]}),f&&p&&x("div",{role:"alert",className:"flex flex-col items-start gap-2 rounded-md border border-danger-500 bg-background-elevated p-4",children:[i("p",{className:"text-sm font-medium text-danger-600",children:e("pluginsManage.marketplaceErrorTitle")}),i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>void R(),children:e("pluginsManage.retry")})]}),f&&!p&&n.length===0&&i(ke,{title:e("pluginsManage.marketplaceEmpty")}),f&&!p&&n.length>0&&i("ul",{className:"grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4",children:n.map(S=>{var D;const A=Zp(S.priceCents);return i("li",{children:x("button",{type:"button","data-testid":`marketplace-card-${S.pluginId}`,"data-plugin-id":S.pluginId,onClick:()=>t(`/plugin-management/marketplace/${encodeURIComponent(S.pluginId)}`),className:`flex w-full flex-col gap-2 rounded-md border border-border-subtle p-3 text-start ${S.compatible?"":"opacity-60"}`,children:[S.coverImagePath?i("img",{src:`${c}${S.coverImagePath}`,alt:"",className:"h-24 w-full rounded-md object-cover"}):i("div",{className:"h-24 w-full rounded-md bg-background-hover","aria-hidden":"true"}),i("p",{className:"truncate text-sm font-medium text-text-primary",children:S.name}),x("div",{className:"flex flex-wrap items-center gap-1.5",children:[i(de,{variant:"neutral",children:Ks(S.type)}),i(de,{variant:"primary",children:A??e("pluginsManage.free")}),((D=S.latestVersion)==null?void 0:D.verified)&&i(de,{variant:"success",children:e("pluginsManage.verified")})]}),i("p",{className:"line-clamp-2 text-xs text-text-secondary",children:S.description}),!S.compatible&&i("p",{className:"text-xs text-text-secondary",children:e("pluginsManage.marketplaceIncompatible",{dialect:Er(s)})})]})},S.pluginId)})}),f&&!p&&a&&i(H,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void k(),children:e("pluginsManage.loadMore")})]})]})}function $T({target:e,onClose:t,onInstalled:n}){const{t:r}=oe(),[a,o]=E(""),[s,l]=E(null),[c,d]=E(!1),f=M(0),u=M(!1);function p(h){u.current=h,d(h)}O(()=>{f.current+=1,o(""),l(null),p(!1)},[e]);async function m(){if(!e||u.current)return;const h=f.current;p(!0),l(null);try{const g=await Jp({pluginId:e.pluginId,version:e.version,licenseKey:a});if(f.current!==h)return;n(g),t()}catch(g){if(f.current!==h)return;l(g instanceof ve?g.message:r("pluginsManage.installFailed"))}finally{f.current===h&&p(!1)}}return i(Jn,{open:e!==null,onOpenChange:h=>!h&&t(),children:x(Zn,{onEscapeKeyDown:h=>{u.current&&h.preventDefault()},children:[x(Qn,{children:[i(tr,{children:r("pluginsManage.installKeyTitle",{name:(e==null?void 0:e.name)??""})}),i(nr,{children:r("pluginsManage.installKeyDescription")})]}),i(Ne,{label:r("pluginsManage.installKeyLabel"),htmlFor:"install-key-dialog-license",helpText:r("pluginsManage.installKeyHelp"),error:s,children:i(ye,{id:"install-key-dialog-license",dir:"ltr",className:"font-mono",placeholder:r("pluginsManage.installKeyPlaceholder"),value:a,onChange:h=>o(h.target.value),disabled:c,autoComplete:"off"})}),x(er,{className:"justify-between",children:[x("a",{href:(e==null?void 0:e.buyHref)??"#",target:"_blank",rel:"noreferrer",className:se(Tt({variant:"link"}),"gap-1 px-0"),children:[r("pluginsManage.buyOnMarketplace"),i(mp,{"aria-hidden":"true",className:"size-3.5 rtl:-scale-x-100"})]}),x("div",{className:"flex items-center gap-2",children:[i(ar,{disabled:c,children:r("pluginsManage.cancel")}),i(rr,{disabled:c,onClick:h=>{h.preventDefault(),m()},children:r(c?"pluginsManage.installing":"pluginsManage.installKeySubmit")})]})]})]})})}const rs="marketplace-detail",BT={needsExternalNetwork:"External network",needsStructuredData:"Structured data",needsFileSystemAccess:"Filesystem access"};function UT(e){const t=BT[e];if(t)return t;const n=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase();return n.length===0?n:n[0].toUpperCase()+n.slice(1)}function zT(e){return new Date(e).toLocaleDateString()}function jT(){const{t:e}=oe(),{pluginId:t=""}=Xn(),[n,r]=E(null),a=ir();Re([n==null?void 0:n.name,e("nav.plugins")]);const[o,s]=E(!1),[l,c]=E(!1),[d,f]=E(!1),[u,p]=E(void 0),[m,h]=E("overview"),[g,y]=E(0),[w,b]=E("idle"),[v,C]=E(null),[N,T]=E(null),[R,L]=E(null),I=M(0);if(O(()=>{let j=!1;return s(!1),c(!1),f(!1),p(void 0),h("overview"),b("idle"),C(null),T(null),L(null),I.current+=1,LT(t).then(le=>{j||(r(le),s(!0))}).catch(le=>{j||(le instanceof ve&&le.status===404?c(!0):(f(!0),p(le instanceof ve?le.message:void 0)),s(!0))}),()=>{j=!0}},[t,g]),!o)return i("div",{className:"flex h-full min-h-0 flex-col px-8 py-8",children:i(ke,{title:e("contentTree.loading"),titleAs:"h1"})});if(d)return i("div",{className:"flex h-full min-h-0 flex-col px-8 py-8",children:x("div",{role:"alert",className:"flex flex-col items-start gap-2 rounded-md border border-danger-500 bg-background-elevated p-4",children:[i("p",{className:"text-sm font-medium text-danger-600",children:e("pluginsManage.marketplaceErrorTitle")}),u&&i("p",{className:"text-sm text-text-secondary",children:u}),i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>y(j=>j+1),children:e("pluginsManage.retry")})]})});if(l||!n)return i("div",{className:"flex h-full min-h-0 flex-col px-8 py-8",children:i(ke,{title:e("pluginsManage.detailNotFound"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},action:x(Ut,{to:"/plugin-management/marketplace",className:se(Tt({variant:"outline",size:"sm"}),"gap-1.5"),children:[i(Rc,{"aria-hidden":"true",className:"size-4 rtl:rotate-180"}),e("pluginsManage.detailBack")]})})});const P=n.latestVersion,k=Zp(n.priceCents),S=`${n.marketplaceBaseUrl}/marketplace/${n.pluginId}`,A=(P==null?void 0:P.starter)??null,D=(P==null?void 0:P.documentTypesSummary)??null,B=n.type==="template"&&!!(D!=null&&D.length),U=P?`${n.marketplaceBaseUrl}/api/v1/starters/${n.pluginId}/${P.version}`:void 0,z=n.type==="bundle"?(P==null?void 0:P.bundledMembers)??null:null,_=(P==null?void 0:P.hasArtifact)===!1,G=j=>{b("installed"),C(null),T(null),L(j.members??null)},V=async()=>{if(!P)return;const j=++I.current;b("installing"),C(null);try{const le=await Jp({pluginId:n.pluginId,version:P.version});if(I.current!==j)return;G(le)}catch(le){if(I.current!==j)return;b("idle"),L(null),C(le instanceof ve?le.message:e("pluginsManage.installFailed"))}},ee=()=>{!P||w!=="idle"||(k===null?V():(C(null),T({pluginId:n.pluginId,version:P.version,name:n.name,buyHref:S})))},Z=[{id:"overview",label:e("pluginsManage.detailOverview")},{id:"versions",label:e("pluginsManage.detailVersions")},{id:"permissions",label:e("pluginsManage.detailPermissionsTab")}];return x("div",{className:"flex h-full min-h-0 flex-col",children:[x("div",{className:"shrink-0 px-8 pb-3 pt-6",children:[x(Ut,{to:"/plugin-management/marketplace",className:"mb-2 inline-flex items-center gap-1.5 text-xs font-medium text-text-secondary hover:text-text-primary",children:[i(Rc,{"aria-hidden":"true",className:"size-3.5 rtl:rotate-180"}),e("pluginsManage.detailBack")]}),x("p",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[i("span",{children:e("nav.plugins")}),i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 text-text-disabled rtl:rotate-180"}),i("span",{children:e("pluginsManage.marketplace")}),i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 text-text-disabled rtl:rotate-180"}),i("span",{children:n.name})]}),n.coverImagePath?i("img",{src:`${n.marketplaceBaseUrl}${n.coverImagePath}`,alt:"",className:"mt-3 h-28 w-full max-w-3xl rounded-lg object-cover"}):i("div",{className:"mt-3 h-28 w-full max-w-3xl rounded-lg bg-background-hover","aria-hidden":"true"}),x("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:a,className:"text-xl font-bold tracking-tight text-text-primary focus:outline-none",children:n.name}),P&&x(de,{variant:"neutral",children:["v",P.version]}),(P==null?void 0:P.verified)&&i(de,{variant:"success",children:e("pluginsManage.verified")}),i(de,{variant:"primary",children:k??e("pluginsManage.free")})]})]}),i(mo,{tabs:Z,activeId:m,onChange:j=>h(j),label:e("pluginsManage.detailTabsLabel"),idPrefix:rs,className:"shrink-0 px-8"}),x("div",{role:"tabpanel",id:Vr(rs,m),"aria-labelledby":jn(rs,m),className:"min-w-0 flex-1 overflow-y-auto px-8 pb-8 pt-6",children:[m==="overview"&&x("div",{className:"flex max-w-2xl flex-col gap-6",children:[i("p",{className:"text-sm text-text-primary",children:n.description}),B&&x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.documentTypesTitle")}),i("ul",{className:"flex flex-col gap-2",children:D.map(j=>x("li",{className:"rounded-md border border-border-default px-4 py-3",children:[i("p",{className:"font-medium text-text-primary",children:j.name}),j.fields.length>0&&i("p",{className:"mt-0.5 text-xs text-text-secondary",children:j.fields.join(" · ")})]},j.name))})]}),z&&z.length>0&&x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.bundleMembersTitle")}),i("ul",{className:"flex flex-col gap-2",children:z.map(j=>i("li",{children:x(Ut,{to:`/plugin-management/marketplace/${encodeURIComponent(j.pluginId)}`,className:"flex items-center gap-3 rounded-md border border-border-default px-4 py-3 hover:bg-background-hover",children:[x("span",{className:"min-w-0 flex-1",children:[i("span",{className:"block font-medium text-text-primary",children:j.name}),j.description&&i("span",{className:"block text-xs text-text-secondary",children:j.description})]}),i(de,{variant:"neutral",children:Ks(j.type)}),i(de,{variant:"neutral",children:e("pluginsManage.bundleMemberFree")}),i(sn,{"aria-hidden":"true",className:"size-4 shrink-0 text-text-disabled rtl:rotate-180"})]})},j.pluginId))}),i("p",{className:"mt-2 text-xs text-text-secondary",children:e("pluginsManage.bundleMembersHelp",{count:z.length})})]}),A?x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.starterTitle")}),x("div",{className:"rounded-md border border-border-default bg-background-elevated p-4",children:[i("p",{className:"font-medium text-text-primary",children:A.name}),A.description&&i("p",{className:"mt-1 text-sm text-text-secondary",children:A.description}),x("p",{className:"mt-2 text-xs text-text-secondary",children:[e("pluginsManage.starterDeliveryPrefix"),i("code",{className:"rounded bg-background-hover px-1 py-0.5",children:"npm install"}),e("pluginsManage.starterDeliverySuffix")]}),x("div",{className:"mt-3 flex items-center gap-4",children:[A.hasArchive&&U&&i("a",{href:U,target:"_blank",rel:"noreferrer",className:se(Tt({variant:"outline",size:"sm"})),children:e("pluginsManage.getStarter")}),A.repository&&i("a",{href:A.repository,target:"_blank",rel:"noreferrer",className:"text-xs text-text-secondary hover:text-text-primary",children:e("pluginsManage.viewSource")})]})]})]}):n.type==="bundle"?x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.starterTitle")}),i("p",{className:"text-sm text-text-secondary",children:e("pluginsManage.bundleStarterNone")})]}):null]}),m==="versions"&&i("ul",{className:"flex max-w-2xl flex-col gap-2",children:n.versions.map(j=>x("li",{className:"flex items-center gap-3 rounded-md border border-border-default px-4 py-3",children:[x("div",{className:"flex-1",children:[i("p",{className:"font-medium text-text-primary",children:j.version}),i("p",{className:"text-xs text-text-secondary",children:e("pluginsManage.detailVersionReleased",{date:zT(j.createdAt)})})]}),(P==null?void 0:P.version)===j.version&&i(de,{variant:"neutral",children:e("pluginsManage.detailLatestVersion")})]},j.version))}),m==="permissions"&&P&&x("div",{className:"flex max-w-2xl flex-col gap-6",children:[x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.detailPermissions")}),Object.keys(P.permissions).length===0?i("p",{className:"text-sm text-text-secondary",children:e("pluginsManage.detailPermissionsEmpty")}):i("ul",{className:"flex flex-col gap-1 text-sm text-text-secondary",children:Object.entries(P.permissions).map(([j,le])=>i("li",{children:e("pluginsManage.permissionRow",{label:UT(j),value:e(le?"pluginsManage.permissionYes":"pluginsManage.permissionNo")})},j))})]}),x("div",{children:[i("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:e("pluginsManage.detailCompatibility")}),i("div",{className:"flex flex-wrap gap-2",children:P.supportedDialects.map(j=>i(de,{variant:"success",children:Er(j)},j))}),!n.compatible&&i("p",{className:"mt-2 text-xs text-text-secondary",children:e("pluginsManage.marketplaceIncompatible",{dialect:Er(n.activeDialect)})})]})]})]}),x("footer",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border-default bg-background-elevated px-8 py-3",children:[x("div",{className:"min-w-0 max-w-lg",children:[v&&i("p",{role:"alert",className:"text-sm text-danger-600",children:v}),w==="installed"&&R&&i("p",{className:"text-xs text-text-secondary",children:e("pluginsManage.bundleInstalledMembers",{count:R.filter(j=>j.outcome==="installed").length,skipped:R.filter(j=>j.outcome==="already-installed").length})})]}),x("div",{className:"flex shrink-0 items-center gap-3",children:[x("a",{href:S,target:"_blank",rel:"noreferrer",className:se(Tt({variant:"link"}),"gap-1"),children:[e("pluginsManage.buyOnMarketplace"),i(mp,{"aria-hidden":"true",className:"size-3.5 rtl:-scale-x-100"})]}),i(H,{type:"button",disabled:!P||w!=="idle"||!n.compatible||_,title:n.compatible?_?e("pluginsManage.installUnavailable"):void 0:e("pluginsManage.marketplaceIncompatible",{dialect:Er(n.activeDialect)}),onClick:ee,children:e(w==="installing"?"pluginsManage.installing":w==="installed"?"pluginsManage.installDone":_?"pluginsManage.installUnavailable":"pluginsManage.install")})]})]}),i($T,{target:N,onClose:()=>T(null),onInstalled:G})]})}const dl="/api/plugin-management/plugins";async function Qc(e,t={}){const n=new URLSearchParams;t.cursor&&n.set("cursor",t.cursor),t.limit&&n.set("limit",String(t.limit));const r=n.toString(),a=await X(`${dl}/${encodeURIComponent(e)}/snapshot-groups${r?`?${r}`:""}`);return re(a)}async function VT(e){const t=await X(`${dl}/${encodeURIComponent(e)}/snapshot-groups/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(t.status===409){const n=await t.json().catch(()=>null);if(n!=null&&n.requiresConfirmation&&n.plan&&n.planHash)return{plan:n.plan,planHash:n.planHash,message:n.message??""};throw new ve((n==null?void 0:n.message)??t.statusText,t.status)}throw await re(t),new ve(t.statusText,t.status)}class Qp extends Error{constructor(t,n,r){super(r),this.plan=t,this.planHash=n}status=409}async function HT(e,t){const n=await X(`${dl}/${encodeURIComponent(e)}/snapshot-groups/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmRestore:!0,planHash:t})});if(n.status===409){const r=await n.json().catch(()=>null);throw r!=null&&r.requiresConfirmation&&r.plan&&r.planHash?new Qp(r.plan,r.planHash,r.message??""):new ve((r==null?void 0:r.message)??n.statusText,n.status)}return re(n)}const ed=50,td="grid grid-cols-[7rem_9rem_7rem_6rem_6rem_1.5rem] items-center gap-3";function nd(e,t,n=Date.now()){const r=new Date(e).getTime()-n,a=new Intl.RelativeTimeFormat(t,{numeric:"always"}),o=Math.abs(r),s=6e4,l=60*s,c=24*l;return o<s?a.format(Math.round(r/1e3),"second"):o<l?a.format(Math.round(r/s),"minute"):o<c?a.format(Math.round(r/l),"hour"):a.format(Math.round(r/c),"day")}function rd(e){return e.length<=9?e:`${e.slice(0,4)}…${e.slice(-3)}`}function KT(e,t){return e==="uninstall"?t("pluginsManage.snapshotsTriggerUninstall"):e==="restore"?t("pluginsManage.snapshotsTriggerRestore"):"—"}function WT(e){const t=new Map;for(const n of e){const r=t.get(n.snapshotGroupId);r?r.tableNames.push(n.tableName):t.set(n.snapshotGroupId,{snapshotGroupId:n.snapshotGroupId,groupTakenAt:n.groupTakenAt,tableNames:[n.tableName]})}return Array.from(t.values())}function qT(){var z;const{t:e,i18n:t}=oe(),{pluginId:n=""}=Xn(),a=((z=Xe().state)==null?void 0:z.name)||n;Re([e("pluginsManage.snapshotsTitle",{name:a}),e("nav.plugins")]);const[o,s]=E([]),[l,c]=E(null),[d,f]=E(!1),[u,p]=E(!1),[m,h]=E(!1),[g,y]=E(null),[w,b]=E(null),[v,C]=E(""),[N,T]=E(!1),[R,L]=E(null),I=K(async()=>{try{const{items:_,nextCursor:G}=await Qc(n,{limit:ed});s(_),c(G),p(!1),f(!0)}catch{p(!0),f(!0)}},[n]);O(()=>{I()},[I]);async function P(){if(l)try{const{items:_,nextCursor:G}=await Qc(n,{cursor:l,limit:ed});s(V=>[...V,..._]),c(G)}catch{J({variant:"danger",title:e("pluginsManage.snapshotsError")})}}async function k(){h(!0);try{const{plan:_,planHash:G}=await VT(n);C(""),L(null),y(_),b(G)}catch(_){J({variant:"danger",title:_ instanceof ve?_.message:e("pluginsManage.snapshotsError")})}finally{h(!1)}}function S(){y(null),b(null),C(""),L(null)}async function A(){if(!(!g||!w||v!=="restore"||N)){T(!0),L(null);try{const _=await HT(n,w);J({variant:"success",title:e("pluginsManage.snapshotsRestoredToast",{count:_.restoredTables.length})}),S(),await I()}catch(_){_ instanceof Qp?(y(_.plan),b(_.planHash),C(""),L(_.message)):L(_ instanceof ve?_.message:e("pluginsManage.snapshotsError"))}finally{T(!1)}}}const D=o.find(_=>_.trigger!=="restore"),B=D!==void 0&&D.status!=="complete",U=g?WT(g):[];return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.plugins"),e("pluginsManage.installed"),a,e("pluginsManage.snapshotsAction")],title:e("pluginsManage.snapshotsTitle",{name:a}),actions:d&&!u&&o.length>0&&i(H,{type:"button",size:"sm",onClick:()=>void k(),disabled:m,children:e("pluginsManage.snapshotsRestoreAction")})}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[i("p",{className:"max-w-[65ch] text-sm text-text-secondary",children:e("pluginsManage.snapshotsScope",{name:a})}),!d&&x("div",{"aria-label":e("pluginsManage.snapshotsLoading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]}),d&&u&&x("div",{role:"alert",className:"flex flex-col items-start gap-2 rounded-md border border-danger-500 bg-background-elevated p-4",children:[i("p",{className:"text-sm font-medium text-danger-600",children:e("pluginsManage.snapshotsError")}),i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>void I(),children:e("pluginsManage.retry")})]}),d&&!u&&o.length===0&&i(ke,{title:e("pluginsManage.snapshotsEmpty")}),d&&!u&&o.length>0&&x(Ie,{children:[B&&x("div",{role:"note",className:"flex items-start gap-2 rounded-md border border-warning-300 bg-warning-100 px-4 py-3 text-sm text-warning-800",children:[i(LN,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0"}),i("span",{children:e("pluginsManage.snapshotsUnionCallout")})]}),x("div",{"data-testid":"snapshot-groups-header",className:`${td} border border-transparent px-3 text-xs font-medium uppercase tracking-wide text-text-secondary`,children:[i("span",{children:e("pluginsManage.snapshotsColGroup")}),i("span",{children:e("pluginsManage.snapshotsColTaken")}),i("span",{children:e("pluginsManage.snapshotsColTrigger")}),i("span",{children:e("pluginsManage.snapshotsColTables")}),i("span",{children:e("pluginsManage.snapshotsColStatus")}),i("span",{"aria-hidden":"true"})]}),i("ul",{className:"flex flex-col gap-1",children:o.map(_=>x("li",{"data-snapshot-group-id":_.snapshotGroupId,className:`${td} rounded-md border border-border-subtle px-3 py-2`,children:[i("span",{className:"truncate font-mono text-xs text-text-secondary",title:_.snapshotGroupId,children:rd(_.snapshotGroupId)}),x("div",{className:"min-w-0",children:[i("p",{className:"truncate text-xs text-text-primary",children:nd(_.takenAt,t.language)}),i("p",{className:"truncate text-xs text-text-secondary",children:new Date(_.takenAt).toLocaleString()})]}),i("span",{className:"truncate text-xs text-text-secondary",children:KT(_.trigger,e)}),i("span",{className:"text-xs text-text-secondary",children:e("pluginsManage.snapshotsTablesOf",{count:_.tableNames.length,total:_.totalTableCount})}),i(de,{variant:_.status==="complete"?"success":"warning",children:_.status==="complete"?e("pluginsManage.snapshotsStatusComplete"):e("pluginsManage.snapshotsStatusPartial")}),i("span",{"aria-hidden":"true"})]},_.snapshotGroupId))})]}),d&&!u&&l&&i(H,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void P(),children:e("pluginsManage.loadMore")})]}),i(Jn,{open:g!==null,onOpenChange:_=>!_&&!N&&S(),children:x(Zn,{onEscapeKeyDown:_=>{N&&_.preventDefault()},children:[x(Qn,{children:[i(tr,{children:e("pluginsManage.snapshotsRestoreTitle",{name:a})}),i(nr,{children:e("pluginsManage.snapshotsRestoreIntro",{count:(g==null?void 0:g.length)??0})})]}),R&&i("p",{role:"alert",className:"text-sm text-danger-600",children:R}),i("ul",{className:"flex flex-col gap-1 text-sm text-text-primary",children:U.map(_=>i("li",{className:"font-mono text-xs",children:e("pluginsManage.snapshotsRestoreProvenance",{tables:_.tableNames.join(", "),group:rd(_.snapshotGroupId),when:nd(_.groupTakenAt,t.language)})},_.snapshotGroupId))}),i("p",{className:"text-sm text-text-secondary",children:e("pluginsManage.snapshotsRestoreSafety",{name:a})}),i(Ne,{label:e("pluginsManage.snapshotsRestoreTypeLabel"),htmlFor:"snapshots-restore-confirm",children:i(ye,{id:"snapshots-restore-confirm",dir:"ltr",className:"font-mono",placeholder:"restore",value:v,onChange:_=>C(_.target.value),disabled:N,autoComplete:"off"})}),x(er,{children:[i(ar,{disabled:N,children:e("pluginsManage.cancel")}),i(rr,{disabled:N||v!=="restore",className:Tt({variant:"destructive"}),onClick:_=>{_.preventDefault(),A()},children:N?e("pluginsManage.snapshotsRestoring"):e("pluginsManage.snapshotsRestoreConfirm",{count:(g==null?void 0:g.length)??0})})]})]})})]})}function ad(){const{t:e}=oe();return i(ke,{icon:i(TN,{"aria-hidden":"true"}),title:e("pluginsManage.marketplaceOffTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:e("pluginsManage.marketplaceOffDescription")})}function GT(){const{t:e}=oe(),t=Wt(),n=_t("/plugin-management/installed/*"),r=_t("/plugin-management/marketplace/*"),[a,o]=E(null);return O(()=>{let s=!1;return AT().then(l=>{s||o(l.configured)}).catch(()=>{s||o(!0)}),()=>{s=!0}},[]),x(Ie,{children:[i(Vn,{label:e("nav.plugins"),children:x(Bt,{title:e("pluginsManage.treeTitle"),children:[i(dt,{label:e("pluginsManage.installed"),selected:!!n,onClick:()=>t("/plugin-management/installed")}),i(dt,{label:e("pluginsManage.marketplace"),selected:!!r,onClick:()=>t("/plugin-management/marketplace")})]})}),x(ai,{children:[i(Ce,{index:!0,element:i(nn,{to:"/plugin-management/installed",replace:!0})}),i(Ce,{path:"installed",element:i(me,{flush:!0,children:i(IT,{})})}),i(Ce,{path:"marketplace",element:a===!1?i(me,{children:i(ad,{})}):i(me,{flush:!0,children:i(FT,{})})}),i(Ce,{path:"marketplace/:pluginId",element:a===!1?i(me,{children:i(ad,{})}):i(me,{flush:!0,children:i(jT,{})})}),i(Ce,{path:"installed/:pluginId/snapshots",element:i(me,{flush:!0,children:i(qT,{})})}),i(Ce,{path:"*",element:i(nn,{to:"/plugin-management/installed",replace:!0})})]})]})}async function od(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=await X(`/api/users${n?`?${n}`:""}`);return re(r)}async function YT(e){const t=await X("/api/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return re(t)}async function XT(e,t){const n=await X(`/api/users/${e}/role`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:t})});return re(n)}const sd=50;function JT(e){var r;const t=((r=e.name)==null?void 0:r.trim())||e.email,n=t.split(/\s+/).filter(Boolean);return n.length>=2?`${n[0][0]}${n[1][0]}`.toUpperCase():t.slice(0,2).toUpperCase()}function ZT(){const{t:e}=oe(),{user:t}=Tn(),[n,r]=E([]),[a,o]=E(null),[s,l]=E(!1),[c,d]=E(!1),[f,u]=E(""),[p,m]=E(""),[h,g]=E(""),[y,w]=E("editor"),[b,v]=E(!1),[C,N]=E(null),T=K(async()=>{try{const{items:P,nextCursor:k}=await od({limit:sd});r(P),o(k),l(!0)}catch{J({variant:"danger",title:e("users.genericError")})}},[e]);O(()=>{T()},[T]);async function R(){if(a)try{const{items:P,nextCursor:k}=await od({cursor:a,limit:sd});r(S=>[...S,...P]),o(k)}catch{J({variant:"danger",title:e("users.genericError")})}}async function L(P){P.preventDefault(),v(!0),N(null);try{const{user:k}=await YT({email:f,...p.trim()?{name:p.trim()}:{},password:h,role:y});J({variant:"success",title:e("users.createdToast",{email:k.email})}),u(""),m(""),g(""),w("editor"),d(!1),await T()}catch(k){N(k instanceof ve?k.message:e("users.genericError"))}finally{v(!1)}}async function I(P,k){if(k!==P.role)try{const{user:S}=await XT(P.id,k);r(A=>A.map(D=>D.id===S.id?S:D)),J({variant:"success",title:e("users.roleChangedToast",{email:S.email,role:e(`users.role.${S.role}`)})})}catch(S){J({variant:"danger",title:S instanceof ve?S.message:e("users.genericError")})}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.users")],title:e("usersTree.all"),actions:!c&&i(H,{type:"button",size:"sm",onClick:()=>d(!0),children:e("users.newButton")})}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[!s&&x("div",{"aria-label":e("contentTree.loading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]}),s&&c&&x("form",{onSubmit:L,className:"flex max-w-xl flex-col gap-4 rounded-md border border-border-default p-4",children:[x("div",{className:"flex items-center justify-between",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:e("users.createTitle")}),i(H,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(!1),children:e("users.cancel")})]}),i(Ne,{label:e("users.emailLabel"),htmlFor:"user-email",required:!0,requiredText:e("common.required"),children:i(ye,{id:"user-email",type:"email",required:!0,value:f,onChange:P=>u(P.target.value)})}),i(Ne,{label:e("users.nameLabel"),htmlFor:"user-name",children:i(ye,{id:"user-name",value:p,onChange:P=>m(P.target.value)})}),i(Ne,{label:e("users.passwordLabel"),htmlFor:"user-password",required:!0,requiredText:e("common.required"),helpText:e("users.passwordHelp"),children:i(ye,{id:"user-password",type:"password",required:!0,minLength:8,value:h,onChange:P=>g(P.target.value)})}),i(Ne,{label:e("users.roleLabel"),htmlFor:"user-role",children:x("select",{id:"user-role",value:y,onChange:P=>w(P.target.value),className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary",children:[i("option",{value:"editor",children:e("users.role.editor")}),i("option",{value:"admin",children:e("users.role.admin")})]})}),C&&i("p",{role:"alert",className:"text-sm text-danger-600",children:C}),i(H,{type:"submit",disabled:b,className:"self-start",children:e(b?"users.creating":"users.createButton")})]}),s&&i("ul",{className:"flex flex-col gap-1",children:n.map(P=>{const k=P.id===(t==null?void 0:t.id);return x("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border-subtle px-3 py-2",children:[i("span",{"aria-hidden":"true",className:"grid size-8 shrink-0 place-items-center rounded-full bg-primary-100 text-xs font-semibold text-primary-800",children:JT(P)}),x("div",{className:"min-w-0 flex-1",children:[i("p",{className:"truncate text-sm text-text-primary",children:P.name??P.email}),P.name&&i("p",{className:"truncate text-xs text-text-secondary",children:P.email})]}),i(de,{variant:P.role==="admin"?"primary":"neutral",children:e(`users.role.${P.role}`)}),k?i("span",{className:"text-xs text-text-secondary",children:e("users.youHint")}):x("select",{"aria-label":e("users.roleSelectLabel",{email:P.email}),value:P.role,onChange:S=>void I(P,S.target.value),className:"h-9 rounded-md border border-border-default bg-background-elevated px-2 text-sm text-text-primary",children:[i("option",{value:"editor",children:e("users.role.editor")}),i("option",{value:"admin",children:e("users.role.admin")})]})]},P.id)})}),a&&i(H,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void R(),children:e("users.loadMore")})]})]})}let eh=[];function QT(){return eh}function e2(){return Nd($d,QT)}async function th(){let e;try{const a=await fetch("/api/themes");if(!a.ok)throw new Error(`GET /api/themes responded with ${a.status}`);const o=await a.json(),s=Dh.safeParse(o);if(!s.success)throw new Error(`GET /api/themes returned a malformed response: ${s.error.message}`);e=s.data.items}catch(a){return console.warn("reconcileRuntimeThemes: failed to refresh installed themes, keeping cached state",a),null}const t=e.filter(a=>a.pluginId.includes("."));eh=t;const n=t.map(a=>qm(a.pluginId,a.tokens)).filter(Boolean).join(`
541
541
 
542
- `);eg(n);const{themeId:r}=us();return r!==null&&!t.some(a=>a.pluginId===r)&&zd(null),t}const th=[{id:"content",labelKey:"nav.content",icon:Wi},{id:"media",labelKey:"nav.media",icon:Ma},{id:"settings",labelKey:"nav.settings",icon:wp,adminOnly:!0},{id:"users",labelKey:"nav.users",icon:Yi,adminOnly:!0},{id:"plugin-management",labelKey:"nav.plugins",icon:H1,adminOnly:!0}],Ws={light:"theme.light",dark:"theme.dark",system:"theme.system"};function nh(){const e=Nd(Fd,us);O(()=>{if(e.themeId!==null||(ps(Bd(e.mode)),e.mode!=="system"))return;const r=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{us().themeId===null&&ps($d())};return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e.mode,e.themeId]);const t=H(r=>{Qm(r)},[]),n=H(r=>{zd(r)},[]);return{mode:e.mode,themeId:e.themeId,setMode:t,setActiveTheme:n}}function QT(e,t){return((e==null?void 0:e.trim())||t.split("@")[0]||t).split(/[\s._-]+/).filter(Boolean).slice(0,2).map(o=>o.charAt(0).toUpperCase()).join("")||"?"}function e2(){const{t:e,i18n:t}=ae(),{user:n,logout:r}=Tn(),{mode:a,themeId:o,setMode:s}=nh(),l=Tr(),c=Tr();if(!n)return null;const d=Object.keys(t.options.resources??{}),f=d.length>1,u=n.name??n.email,p=QT(n.name,n.email),m=o!==null;return x(_i,{children:[i(Fi,{asChild:!0,children:x("button",{type:"button","aria-label":e("userMenu.open",{name:u}),className:"flex items-center gap-2 rounded-full p-px pe-2 transition-colors duration-fast hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600",children:[i("span",{"aria-hidden":"true",className:"grid size-8 place-items-center rounded-full bg-primary-100 text-xs font-semibold text-primary-800 ring-2 ring-primary-600 ring-offset-2 ring-offset-background-elevated",children:p}),i(aC,{"aria-hidden":"true",className:"size-4 text-text-disabled"})]})}),x($i,{align:t.dir()==="rtl"?"start":"end",className:"w-72 p-2",children:[x("div",{className:"flex items-center gap-3 px-2 py-2",children:[i("span",{"aria-hidden":"true",className:"grid size-11 shrink-0 place-items-center rounded-full bg-primary-100 text-sm font-semibold text-primary-800",children:p}),x("div",{className:"min-w-0",children:[x("p",{className:"flex items-center gap-2 text-sm font-semibold text-text-primary",children:[i("span",{className:"truncate",children:u}),i(de,{variant:"primary",children:e(`users.role.${n.role}`)})]}),i("p",{className:"truncate text-xs text-text-secondary",children:n.email})]})]}),i(qo,{}),i(wc,{id:l,children:e("userMenu.theme")}),i(bc,{"aria-labelledby":l,value:a,onValueChange:h=>s(h),children:Object.keys(Ws).map(h=>i(xc,{value:h,disabled:m,children:e(Ws[h])},h))}),m&&i("p",{className:"px-2 pb-1 text-xs text-text-secondary",children:e("userMenu.themeInert")}),f&&x(Ie,{children:[i(qo,{}),i(wc,{id:c,children:e("userMenu.language")}),i(bc,{"aria-labelledby":c,value:t.resolvedLanguage??t.language,onValueChange:h=>void t.changeLanguage(h),children:d.map(h=>i(xc,{value:h,children:e(`userMenu.languageName.${h}`,{defaultValue:h})},h))})]}),i(qo,{}),x(La,{variant:"destructive",onSelect:()=>void r(),children:[i(jC,{"aria-hidden":"true",className:"size-4"}),e("app.logout")]})]})]})}function t2(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,"0")}`}const id="flex items-center gap-2 border-b-2 px-3 text-sm font-medium transition-colors duration-fast",ld="border-primary-300 text-text-primary",cd="border-transparent text-text-secondary hover:text-text-primary";function n2({activeId:e,onSelect:t}){const{t:n}=ae(),{user:r,idleMsRemaining:a}=Tn(),o=th.filter(s=>!s.adminOnly||(r==null?void 0:r.role)==="admin");return x("header",{className:"flex h-14 shrink-0 items-center gap-7 border-b border-border-default bg-background-elevated px-5",children:[x("div",{className:"flex items-center gap-2 text-base font-semibold tracking-tight text-text-primary",children:[i(fp,{}),n("app.title")]}),x("nav",{"aria-label":n("nav.sectionsLabel"),className:"flex h-full min-w-0 gap-1 overflow-x-auto",children:[o.map(s=>{const l=s.id===e;return x("button",{type:"button","aria-current":l?"page":void 0,onClick:()=>t(s.id),className:se(id,l?ld:cd),children:[i(s.icon,{"aria-hidden":"true",className:"size-4 shrink-0"}),n(s.labelKey)]},s.id)}),wh().filter(s=>!s.adminOnly||(r==null?void 0:r.role)==="admin").map(s=>{const l=s.id===e;return x("button",{type:"button","aria-current":l?"page":void 0,onClick:()=>t(s.id),className:se(id,l?ld:cd),children:[i(Oa,{"aria-hidden":"true",className:"size-4 shrink-0"}),s.name]},s.id)})]}),x("div",{className:"ms-auto flex items-center gap-2",children:[a!=null&&x(Ie,{children:[i("span",{"aria-live":"off",className:se("me-2 font-mono text-xs tabular-nums",a<6e4?"text-danger-600":"text-text-secondary"),children:n("app.sessionExpiresIn",{time:t2(a)})}),i("span",{role:"status",className:"sr-only",children:a<6e4?n("app.sessionExpiringSoon"):""})]}),i("a",{href:"/docs/",target:"_blank",rel:"noreferrer","aria-label":n("nav.docs"),title:n("nav.docs"),className:"grid size-9 place-items-center rounded-md text-text-secondary transition-colors duration-fast hover:bg-background-hover hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600",children:i(W1,{"aria-hidden":"true",className:"size-5"})}),i(e2,{})]})]})}async function dd(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=await X(`/api/api-keys${n?`?${n}`:""}`);return oe(r)}async function r2(e,t="read"){const n=await X("/api/api-keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,scope:t})});return oe(n)}async function a2(e){const t=await X(`/api/api-keys/${e}/revoke`,{method:"POST"});return oe(t)}const ud=50;function o2(){const{t:e}=ae();Re([e("apiKeys.title"),e("nav.settings")]);const[t,n]=E([]),[r,a]=E(null),[o,s]=E(!1),[l,c]=E(!1),[d,f]=E(""),[u,p]=E("read"),[m,h]=E(!1),[g,y]=E(null),[w,b]=E(null),[v,C]=E(null),N=H(async()=>{try{const{items:I,nextCursor:S}=await dd({limit:ud});n(I),a(S),s(!0)}catch{J({variant:"danger",title:e("apiKeys.genericError")})}},[e]);O(()=>{N()},[N]);async function T(){if(r)try{const{items:I,nextCursor:S}=await dd({cursor:r,limit:ud});n(A=>[...A,...I]),a(S)}catch{J({variant:"danger",title:e("apiKeys.genericError")})}}async function k(I){I.preventDefault(),h(!0),y(null);try{const{apiKey:S,secret:A}=await r2(d.trim(),u);J({variant:"success",title:e("apiKeys.createdToast",{name:S.name})}),f(""),p("read"),c(!1),b({name:S.name,secret:A}),n(D=>[...D,S])}catch(S){y(S instanceof ve?S.message:e("apiKeys.genericError"))}finally{h(!1)}}async function L(I){try{await navigator.clipboard.writeText(I),J({variant:"success",title:e("apiKeys.copiedToast")})}catch{J({variant:"danger",title:e("apiKeys.copyFailedToast")})}}async function R(I){try{const{apiKey:S}=await a2(I.id);n(A=>A.map(D=>D.id===S.id?S:D)),C(null),J({variant:"success",title:e("apiKeys.revokedToast",{name:S.name})})}catch(S){J({variant:"danger",title:S instanceof ve?S.message:e("apiKeys.genericError")})}}function P(I){return new Date(I).toLocaleString()}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.settings"),e("apiKeys.title")],title:e("apiKeys.title"),actions:!l&&i(K,{type:"button",size:"sm",onClick:()=>c(!0),children:e("apiKeys.newButton")})}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[!o&&x("div",{"aria-label":e("apiKeys.loading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]}),w&&x("div",{role:"alert",className:"flex max-w-2xl flex-col gap-3 rounded-md border border-warning-500 p-4",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:e("apiKeys.secretTitle")}),i("p",{className:"text-sm text-text-secondary",children:e("apiKeys.secretWarning")}),i("code",{className:"select-all break-all rounded-md bg-background-hover p-2 font-mono text-xs text-text-primary",children:w.secret}),x("div",{className:"flex gap-2",children:[i(K,{type:"button",size:"sm",onClick:()=>void L(w.secret),children:e("apiKeys.copyButton")}),i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>b(null),children:e("apiKeys.dismissButton")})]})]}),o&&l&&x("form",{onSubmit:k,className:"flex max-w-xl flex-col gap-4 rounded-md border border-border-default p-4",children:[x("div",{className:"flex items-center justify-between",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:e("apiKeys.createTitle")}),i(K,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(!1),children:e("apiKeys.cancel")})]}),i(Ne,{label:e("apiKeys.nameLabel"),htmlFor:"api-key-name",required:!0,requiredText:e("common.required"),children:i(ye,{id:"api-key-name",required:!0,maxLength:100,value:d,onChange:I=>f(I.target.value)})}),x("fieldset",{className:"flex flex-col gap-2",children:[i("legend",{className:"text-sm font-medium text-text-primary",children:e("apiKeys.scopeLabel")}),x("label",{className:"flex items-start gap-2 text-sm",children:[i("input",{type:"radio",name:"api-key-scope",value:"read",checked:u==="read",onChange:()=>p("read")}),x("span",{children:[i("span",{className:"font-medium",children:e("apiKeys.scopeRead")}),i("span",{className:"block text-text-secondary",children:e("apiKeys.scopeReadHelp")})]})]}),x("label",{className:"flex items-start gap-2 text-sm",children:[i("input",{type:"radio",name:"api-key-scope",value:"write",checked:u==="write",onChange:()=>p("write")}),x("span",{children:[i("span",{className:"font-medium",children:e("apiKeys.scopeWrite")}),i("span",{className:"block text-text-secondary",children:e("apiKeys.scopeWriteHelp")})]})]})]}),g&&i("p",{role:"alert",className:"text-sm text-danger-600",children:g}),i(K,{type:"submit",disabled:m,className:"self-start",children:e(m?"apiKeys.creating":"apiKeys.createButton")})]}),o&&t.length===0&&i("p",{className:"text-sm text-text-secondary",children:e("apiKeys.empty")}),o&&t.length>0&&i("ul",{className:"flex flex-col gap-1",children:t.map(I=>{const S=I.revokedAt!==null;return x("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border-subtle px-3 py-2",children:[x("div",{className:"min-w-0 flex-1",children:[i("p",{className:`truncate text-sm ${S?"text-text-secondary line-through":"text-text-primary"}`,children:I.name}),x("p",{className:"truncate text-xs text-text-secondary",children:[e("apiKeys.createdAt",{date:P(I.createdAt)})," · ",I.lastUsedAt?e("apiKeys.lastUsedAt",{date:P(I.lastUsedAt)}):e("apiKeys.neverUsed")]})]}),i(de,{variant:S?"neutral":"primary",children:e(S?"apiKeys.statusRevoked":"apiKeys.statusActive")}),i(de,{variant:I.scope==="write"?"warning":"neutral",children:e(I.scope==="write"?"apiKeys.scopeWrite":"apiKeys.scopeRead")}),!S&&(v===I.id?x("div",{className:"flex items-center gap-2",children:[i("p",{className:"text-xs text-danger-600",children:e("apiKeys.revokeConfirmBody")}),i(K,{type:"button",variant:"destructive",size:"sm",onClick:()=>void R(I),children:e("apiKeys.revokeConfirmButton")}),i(K,{type:"button",variant:"ghost",size:"sm",onClick:()=>C(null),children:e("apiKeys.revokeCancelButton")})]}):i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>C(I.id),children:e("apiKeys.revokeButton")}))]},I.id)})}),r&&i(K,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void T(),children:e("users.loadMore")})]})]})}async function s2(){const e=await X("/api/api-playground/openapi");return oe(e)}async function i2(){const e=await X("/api/api-keys?limit=100");return oe(e)}async function l2(e,t,n){const r=await fetch(t,{method:e,headers:n?{authorization:`Bearer ${n}`}:{}}),a=await r.text();let o=a;try{o=JSON.stringify(JSON.parse(a),null,2)}catch{}return{status:r.status,ok:r.ok,body:o}}function c2(e){const t=e.paths??{},n=[];for(const[r,a]of Object.entries(t))for(const o of Object.keys(a))o.toLowerCase()==="get"&&!r.includes("{")&&n.push({method:o.toUpperCase(),path:r});return n.sort((r,a)=>r.path.localeCompare(a.path))}function d2(){const{t:e}=ae();Re([e("apiPlayground.title"),e("nav.settings")]);const[t,n]=E([]),[r,a]=E([]),[o,s]=E(""),[l,c]=E(""),[d,f]=E(!1),[u,p]=E(null);O(()=>{s2().then(h=>n(c2(h))).catch(()=>J({variant:"danger",title:e("apiPlayground.genericError")})),i2().then(({items:h})=>a(h.filter(g=>g.revokedAt===null).map(g=>g.name))).catch(()=>{})},[e]);async function m(){const h=t.find(g=>`${g.method} ${g.path}`===o);if(h){f(!0),p(null);try{p(await l2(h.method,h.path,l.trim()))}catch{J({variant:"danger",title:e("apiPlayground.genericError")})}finally{f(!1)}}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.settings"),e("apiPlayground.title")],title:e("apiPlayground.title")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[i("p",{className:"max-w-2xl text-sm text-text-secondary",children:e("apiPlayground.description")}),t.length===0?i("p",{className:"text-sm text-text-secondary",children:e("apiPlayground.noEndpoints")}):x("div",{className:"flex max-w-2xl flex-col gap-4",children:[i(Ne,{label:e("apiPlayground.endpointLabel"),htmlFor:"pg-endpoint",children:x("select",{id:"pg-endpoint",value:o,onChange:h=>s(h.target.value),className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary",children:[i("option",{value:"",children:"—"}),t.map(h=>x("option",{value:`${h.method} ${h.path}`,children:[h.method," ",h.path]},`${h.method} ${h.path}`))]})}),i(Ne,{label:e("apiPlayground.keyLabel"),htmlFor:"pg-key",helpText:r.length>0?e("apiPlayground.keyNamesHint",{names:r.join(", ")}):void 0,children:i(ye,{id:"pg-key",type:"password",value:l,placeholder:e("apiPlayground.keyPlaceholder"),onChange:h=>c(h.target.value)})}),i(K,{type:"button",disabled:!o||d,className:"self-start",onClick:()=>void m(),children:e(d?"apiPlayground.sending":"apiPlayground.sendButton")}),u&&x("div",{className:"flex flex-col gap-2 rounded-md border border-border-default p-4",children:[x("p",{className:`text-sm font-semibold ${u.ok?"text-text-primary":"text-danger-600"}`,children:[e("apiPlayground.statusLabel"),": ",u.status]}),i("pre",{className:"max-h-96 overflow-auto rounded-md bg-background-hover p-3 font-mono text-xs text-text-primary",children:u.body})]})]})]})]})}async function u2(e){const t=await X("/api/data-types",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return oe(t)}async function f2(e,t){const n=await X(`/api/data-types/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return oe(n)}function rh({config:e,documentTypes:t,onSaved:n}){const{t:r}=ae(),a=e===null,o=ir(),s=Ch(),[l,c]=E((e==null?void 0:e.name)??""),[d,f]=E((e==null?void 0:e.editorId)??"");Re([a?l||r("dataTypeEditor.createTitle"):l,r("nav.settings")]);const[u,p]=E((e==null?void 0:e.settings)??{}),[m,h]=E(!1),[g,y]=E(!1),[w,b]=E(null),v=d?xa(d):void 0,C=v!=null&&Object.keys(v.settingsSchema.properties??{}).length>0,N=e?t.flatMap(k=>{const L=k.fields.filter(R=>R.datatypeId===e.id).map(R=>R.name);return L.length>0?[`${k.name} (${L.join(", ")})`]:[]}):[];async function T(){if(d){y(!0),b(null);try{const k=a?(await u2({name:l,editorId:d,settings:u})).dataType:(await f2(e.id,{name:l,settings:u})).dataType;J({variant:"success",title:r(a?"dataTypeEditor.createdToast":"dataTypeEditor.savedToast",{name:l})}),h(!1),await fE(),n(k)}catch(k){b(k instanceof ve?k.message:r("dataTypeEditor.genericError"))}finally{y(!1)}}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[x("div",{className:"shrink-0 px-8 pb-4 pt-6",children:[x("p",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[i("span",{children:r("nav.settings")}),i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 text-text-disabled rtl:rotate-180"}),i("span",{children:r("settingsTree.dataTypes")})]}),x("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[i("span",{className:"text-text-secondary",children:i(Gi,{"aria-hidden":"true",className:"size-5"})}),i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:o,className:"text-xl font-bold tracking-tight text-text-primary focus:outline-none",children:a?l||r("dataTypeEditor.createTitle"):l}),v&&i(de,{variant:"neutral",children:v.name})]})]}),i("div",{className:"min-w-0 flex-1 overflow-y-auto px-8 pb-8 pt-2",children:x("div",{className:"flex max-w-xl flex-col gap-6",children:[i(Ne,{label:r("dataTypeEditor.nameLabel"),htmlFor:"data-type-name",required:!0,requiredText:r("common.required"),helpText:r("dataTypeEditor.nameHelp"),children:i(ye,{id:"data-type-name",required:!0,value:l,onChange:k=>{c(k.target.value),h(!0)}})}),i(Ne,{label:r("dataTypeEditor.editorLabel"),htmlFor:"data-type-editor",helpText:r(a?"dataTypeEditor.editorHelp":"dataTypeEditor.editorImmutableHelp"),children:x("select",{id:"data-type-editor",required:!0,disabled:!a,value:d,onChange:k=>{f(k.target.value),h(!0)},className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary disabled:opacity-50",children:[i("option",{value:"",disabled:!0,children:r("dataTypeEditor.editorPlaceholder")}),s.map(k=>i("option",{value:k.id,children:k.name},k.id))]})}),v&&x("section",{className:"flex flex-col gap-2 rounded-md border border-border-default p-4",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:r("dataTypeEditor.settingsTitle")}),C?x(Ie,{children:[i("p",{className:"text-xs text-text-secondary",children:r("dataTypeEditor.settingsHelp",{editor:v.name})}),i(Fr,{fetch:X,children:i(qa,{settings:u,onSettingsChange:k=>{p(k),h(!0)},children:i(Kr,{pluginName:v.name,children:i(v.views.settings,{})})})})]}):i("p",{className:"text-sm text-text-secondary",children:r("dataTypeEditor.noSettings",{editor:v.name})})]}),N.length>0&&i("p",{className:"rounded-md bg-background-elevated px-3 py-2 text-xs text-text-secondary",children:r("dataTypeEditor.usedBy",{count:N.length,list:N.join(", ")})})]})}),x("footer",{className:"flex shrink-0 items-center gap-3 border-t border-border-default bg-background-elevated px-8 py-3",children:[i("span",{className:"text-xs text-text-secondary",children:r(m?"contentEditor.unsavedChanges":"contentEditor.allSaved")}),w&&i("span",{role:"alert",className:"text-xs text-danger-600",children:w}),i("span",{className:"flex-1"}),i(K,{type:"button",disabled:g||!l||!d,onClick:()=>void T(),children:r(g?"dataTypeEditor.saving":"dataTypeEditor.save")})]})]})}const p2="com.velora.text",h2="com.velora.number";function m2(){}function g2({resolved:e}){const t=e.editor.views.preview??e.editor.views.readOnly;return i(Fr,{fetch:X,children:i(Gs,{value:void 0,onChange:m2,children:i(qa,{settings:e.settings,children:i(Kr,{pluginName:e.editor.name,children:i(t,{})})})})})}function y2(e,t){const n=[];return e.required&&n.push(t("documentTypeBuilder.validation.required")),e.minLength!==void 0&&n.push(t("documentTypeBuilder.chip.minLength",{value:e.minLength})),e.maxLength!==void 0&&n.push(t("documentTypeBuilder.chip.maxLength",{value:e.maxLength})),e.min!==void 0&&n.push(t("documentTypeBuilder.chip.min",{value:e.min})),e.max!==void 0&&n.push(t("documentTypeBuilder.chip.max",{value:e.max})),e.pattern&&n.push(t("documentTypeBuilder.chip.pattern")),n}function v2({field:e,dataTypes:t,tabs:n,expanded:r,onToggleExpanded:a,onChange:o,onChangeValidation:s,onRemove:l}){var C;const{t:c}=ae(),{attributes:d,listeners:f,setNodeRef:u,transform:p,transition:m,isDragging:h}=ll({id:e.rowKey}),g={transform:Cn.Transform.toString(p),transition:m,opacity:h?.5:1},y=e.datatypeId?el(e.datatypeId):null,w=(C=t.find(N=>N.id===e.datatypeId))==null?void 0:C.name;function b(N,T){return i("input",{type:"number",value:N??"",onChange:k=>T(k.target.value===""?void 0:Number(k.target.value)),className:"h-8 w-16 rounded-md border border-border-default bg-background-elevated px-2 text-xs text-text-primary"})}const v=i("button",{type:"button","aria-label":c("documentTypeBuilder.dragHandle"),className:"cursor-grab touch-none text-text-secondary",...d,...f,children:i(qi,{"aria-hidden":"true",className:"size-4"})});return r?x("div",{ref:u,style:g,className:"flex flex-col gap-3 rounded-md border border-border-default bg-background-elevated p-3",children:[x("div",{className:"flex items-end gap-2",children:[i("span",{className:"mb-2.5",children:v}),i(Ne,{label:c("documentTypeBuilder.fieldKeyLabel"),htmlFor:`field-key-${e.rowKey}`,required:!0,requiredText:c("common.required"),className:"flex-1",children:i(ye,{id:`field-key-${e.rowKey}`,required:!0,value:e.id,onChange:N=>o({id:N.target.value})})}),i(Ne,{label:c("documentTypeBuilder.fieldNameLabel"),htmlFor:`field-name-${e.rowKey}`,required:!0,requiredText:c("common.required"),className:"flex-1",children:i(ye,{id:`field-name-${e.rowKey}`,required:!0,value:e.name,onChange:N=>o({name:N.target.value})})}),i(Ne,{label:c("documentTypeBuilder.fieldDatatypeLabel"),htmlFor:`field-datatype-${e.rowKey}`,required:!0,requiredText:c("common.required"),className:"flex-1",children:x("select",{id:`field-datatype-${e.rowKey}`,required:!0,value:e.datatypeId,onChange:N=>o({datatypeId:N.target.value}),className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary",children:[i("option",{value:"",disabled:!0,children:c("documentTypeBuilder.fieldDatatypeLabel")}),t.map(N=>i("option",{value:N.id,children:N.name},N.id))]})}),n.length>0&&i(Ne,{label:c("documentTypeBuilder.fieldTabLabel"),htmlFor:`field-tab-${e.rowKey}`,className:"flex-1",children:x("select",{id:`field-tab-${e.rowKey}`,value:e.tabId??"",onChange:N=>o({tabId:N.target.value===""?void 0:N.target.value}),className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary",children:[i("option",{value:"",children:c("documentTypeBuilder.fieldTabNone")}),n.map(N=>i("option",{value:N.id,children:N.name},N.id))]})}),i(K,{type:"button",variant:"ghost",size:"sm",className:"mb-1",onClick:l,children:c("documentTypeBuilder.removeField")}),i(K,{type:"button",variant:"outline",size:"sm",className:"mb-1",onClick:a,children:c("documentTypeBuilder.doneField")})]}),y&&x("div",{className:"flex flex-col gap-2 border-t border-border-subtle pt-3",children:[i("span",{className:"text-xs font-medium text-text-secondary",children:c("documentTypeBuilder.previewLabel")}),i("div",{className:"ms-6 min-h-9 rounded-md border border-dashed border-border-default bg-background-base px-3 py-2",inert:!0,children:i(g2,{resolved:y})})]}),x("div",{className:"flex flex-col gap-2 border-t border-border-subtle pt-3",children:[i("span",{className:"text-xs font-medium text-text-secondary",children:c("documentTypeBuilder.validationLabel")}),x("div",{className:"flex flex-wrap items-center gap-3 ps-6",children:[x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[i("input",{type:"checkbox",checked:e.validation.required??!1,onChange:N=>s({required:N.target.checked||void 0})}),c("documentTypeBuilder.validation.required")]}),(y==null?void 0:y.editor.id)===p2&&x(Ie,{children:[x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[c("documentTypeBuilder.validation.minLength"),b(e.validation.minLength,N=>s({minLength:N}))]}),x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[c("documentTypeBuilder.validation.maxLength"),b(e.validation.maxLength,N=>s({maxLength:N}))]}),x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[c("documentTypeBuilder.validation.pattern"),i("input",{type:"text",value:e.validation.pattern??"",onChange:N=>s({pattern:N.target.value===""?void 0:N.target.value}),placeholder:c("documentTypeBuilder.validation.patternPlaceholder"),dir:"ltr",className:"h-8 w-40 rounded-md border border-border-default bg-background-elevated px-2 font-mono text-xs text-text-primary"})]})]}),(y==null?void 0:y.editor.id)===h2&&x(Ie,{children:[x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[c("documentTypeBuilder.validation.min"),b(e.validation.min,N=>s({min:N}))]}),x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[c("documentTypeBuilder.validation.max"),b(e.validation.max,N=>s({max:N}))]})]})]})]})]}):x("div",{ref:u,style:g,className:"flex items-center gap-3 rounded-md border border-border-default bg-background-elevated px-3 py-2",children:[v,x("span",{className:"min-w-0 flex-1",children:[i("span",{className:"block truncate text-sm font-medium text-text-primary",children:e.name||c("documentTypeBuilder.unnamedField")}),i("span",{className:"block truncate text-xs text-text-secondary",children:e.id})]}),w&&i(de,{variant:"primary",children:w}),y2(e.validation,c).map(N=>i(de,{variant:"neutral",children:N},N)),i(K,{type:"button",variant:"ghost",size:"sm",onClick:a,children:c("documentTypeBuilder.editField")})]})}function b2({tab:e,onChange:t,onRemove:n}){const{t:r}=ae(),{attributes:a,listeners:o,setNodeRef:s,transform:l,transition:c,isDragging:d}=ll({id:e.id}),f={transform:Cn.Transform.toString(l),transition:c,opacity:d?.5:1};return x("div",{ref:s,style:f,className:"flex items-end gap-2 rounded-md border border-border-default bg-background-elevated p-3",children:[i("button",{type:"button","aria-label":r("documentTypeBuilder.dragHandle"),className:"mb-2.5 cursor-grab touch-none text-text-secondary",...a,...o,children:i(qi,{"aria-hidden":"true",className:"size-4"})}),i(Ne,{label:r("documentTypeBuilder.tabNameLabel"),htmlFor:`tab-name-${e.id}`,required:!0,requiredText:r("common.required"),className:"flex-1",children:i(ye,{id:`tab-name-${e.id}`,required:!0,value:e.name,onChange:u=>t({name:u.target.value})})}),i(K,{type:"button",variant:"ghost",size:"sm",className:"mb-1",onClick:n,children:r("documentTypeBuilder.removeTab")})]})}async function Ka(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit)),e.documentTypeId&&t.set("documentTypeId",e.documentTypeId);const n=t.toString(),r=await X(`/api/templates${n?`?${n}`:""}`);return oe(r)}async function x2(e){const t=await X("/api/templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return oe(t)}async function w2(e,t){const n=await X(`/api/document-types/${e}/default-template`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:t})});return oe(n)}const fd=100;function C2({documentType:e,onDocumentTypeUpdated:t}){const{t:n}=ae(),[r,a]=E([]),[o,s]=E(null),[l,c]=E(""),[d,f]=E(!1),[u,p]=E(null),m=e.kind==="page"?e.defaultTemplateId??null:null,h=H(async()=>{const{items:v,nextCursor:C}=await Ka({documentTypeId:e.id,limit:fd});a(v),s(C)},[e.id]);O(()=>{h().catch(()=>p(n("templatePicker.genericError")))},[h,n]);async function g(v){f(!0),p(null);try{await v()}catch(C){p(C instanceof ve?C.message:n("templatePicker.genericError"))}finally{f(!1)}}async function y(){o&&await g(async()=>{const{items:v,nextCursor:C}=await Ka({documentTypeId:e.id,cursor:o,limit:fd});a(N=>[...N,...v]),s(C)})}async function w(v){if(v.preventDefault(),!l.trim())return;const C=l.trim();await g(async()=>{await x2({name:C,documentTypeId:e.id}),c(""),await h(),J({variant:"success",title:n("templatePicker.addedToast",{name:C})})})}async function b(v){await g(async()=>{var N;const{documentType:C}=await w2(e.id,v);if(t(C),v){const T=((N=r.find(k=>k.id===v))==null?void 0:N.name)??"";J({variant:"success",title:n("templatePicker.defaultSetToast",{name:T})})}else J({title:n("templatePicker.defaultClearedToast")})})}return x("div",{className:"flex max-w-xl flex-col gap-4",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:n("documentTypeEditor.templatesTitle",{name:e.name})}),r.length===0?i("p",{className:"text-sm text-text-secondary",children:n("templatePicker.noTemplates")}):i("ul",{className:"flex flex-col gap-1",children:r.map(v=>{const C=v.id===m;return x("li",{className:"flex items-center justify-between gap-2 rounded-md border border-border-subtle px-3 py-2",children:[x("span",{className:"flex flex-col text-sm text-text-primary",children:[v.name,C&&i("span",{className:"text-xs font-medium text-primary-600",children:n("templatePicker.defaultBadge")})]}),C?i(K,{type:"button",variant:"ghost",size:"sm",disabled:d,onClick:()=>b(null),children:n("templatePicker.clearDefault")}):i(K,{type:"button",variant:"outline",size:"sm",disabled:d,onClick:()=>b(v.id),children:n("templatePicker.setDefault")})]},v.id)})}),o&&i(K,{type:"button",variant:"outline",size:"sm",disabled:d,onClick:y,children:n("templatePicker.loadMore")}),x("form",{onSubmit:w,className:"flex items-end gap-2",children:[i("div",{className:"flex-1",children:i(Ne,{label:n("templatePicker.nameLabel"),htmlFor:"template-pane-name",children:i(ye,{id:"template-pane-name",value:l,onChange:v=>c(v.target.value),required:!0})})}),i(K,{type:"submit",size:"sm",disabled:d||!l.trim(),children:n(d?"templatePicker.adding":"templatePicker.addButton")})]}),i("p",{className:"text-xs text-text-secondary",children:n("documentTypeEditor.templatesInertNote")}),u&&i("p",{role:"alert",className:"text-sm text-danger-600",children:u})]})}function pd(e){return Array.from(e.target.selectedOptions).map(t=>t.value)}const as=e=>se("flex size-8 items-center justify-center rounded-md border",e?"border-primary-600 bg-primary-100 text-primary-800":"border-border-subtle text-text-secondary hover:bg-background-elevated");function N2(e){return{rowKey:crypto.randomUUID(),id:"",name:"",datatypeId:"",validation:{},tabId:e}}function E2(e){const t=Object.values(e.validation).some(n=>n!==void 0);return{id:e.id,name:e.name,datatypeId:e.datatypeId,...t?{validation:e.validation}:{},...e.tabId?{tabId:e.tabId}:{}}}function S2(e){return{rowKey:crypto.randomUUID(),id:e.id,name:e.name,datatypeId:e.datatypeId,validation:e.validation??{},tabId:e.tabId}}function ah({documentType:e,documentTypes:t,onSaved:n,onDeleted:r}){const{t:a}=ae(),o=Tr(),s=yo()??[],l=ir(),c=e===null,[d,f]=E((e==null?void 0:e.name)??"");Re([c?d||a("documentTypeEditor.createTitle"):d,a("nav.settings")]);const[u,p]=E((e==null?void 0:e.icon)??""),m=u!==""&&!(u in Lr),[h,g]=E((e==null?void 0:e.kind)??"page"),[y,w]=E(e?e.fields.map(S2):[]),[b,v]=E(e?e.tabs.map(({id:$,name:te})=>({id:$,name:te})):[]),[C,N]=E((e==null?void 0:e.kind)==="page"?e.treeRules.allowedAtRoot:!1),[T,k]=E((e==null?void 0:e.kind)==="page"?e.treeRules.allowedParentTypes:[]),[L,R]=E((e==null?void 0:e.kind)==="page"?e.treeRules.allowedChildTypes:[]),[P,I]=E(new Set),[S,A]=E(!1),[D,U]=E(!1),[z,B]=E(null),[_,G]=E("design"),[V,ee]=E(!1),[Z,j]=E(!1),le=[{id:"design",label:a("documentTypeEditor.designTab")},...h==="page"&&!c?[{id:"templates",label:a("documentTypeEditor.templatesTab")}]:[],...h==="page"?[{id:"structure",label:a("documentTypeEditor.structureTab")}]:[]],Ee=le.some($=>$.id===_)?_:"design",ge=t.filter($=>$.kind==="page"&&$.id!==(e==null?void 0:e.id)),Le=ol(Hn(Xr),Hn(Yr,{coordinateGetter:cl}));function ue(){A(!0)}function F($){I(te=>{const ce=new Set(te);return ce.has($)?ce.delete($):ce.add($),ce})}function q($){const te=N2($);w(ce=>[...ce,te]),I(ce=>new Set(ce).add(te.rowKey)),ue()}function be($){w(te=>te.filter(ce=>ce.rowKey!==$)),ue()}function Pe($,te){w(ce=>ce.map(we=>we.rowKey===$?{...we,...te}:we)),ue()}function He($,te){w(ce=>ce.map(we=>we.rowKey===$?{...we,validation:{...we.validation,...te}}:we)),ue()}function Be($){const{active:te,over:ce}=$;!ce||te.id===ce.id||(w(we=>{const vt=we.findIndex(Je=>Je.rowKey===te.id),lt=we.findIndex(Je=>Je.rowKey===ce.id);return Kn(we,vt,lt)}),ue())}function Ue(){v($=>[...$,{id:crypto.randomUUID(),name:""}]),ue()}function st($){v(te=>te.filter(ce=>ce.id!==$)),w(te=>te.map(ce=>ce.tabId===$?{...ce,tabId:void 0}:ce)),ue()}function hn($,te){v(ce=>ce.map(we=>we.id===$?{...we,...te}:we)),ue()}function kn($){const{active:te,over:ce}=$;!ce||te.id===ce.id||(v(we=>{const vt=we.findIndex(Je=>Je.id===te.id),lt=we.findIndex(Je=>Je.id===ce.id);return Kn(we,vt,lt)}),ue())}async function mn(){U(!0),B(null);try{const $=y.map(E2),te=b.map(({id:vt,name:lt})=>({id:vt,name:lt})),ce={allowedAtRoot:C,allowedParentTypes:T,allowedChildTypes:L};let we;if(c)we=(await jN(h==="page"?{name:d,icon:u,kind:"page",fields:$,treeRules:ce,tabs:te}:{name:d,icon:u,kind:"element",fields:$,tabs:te})).documentType,J({variant:"success",title:a("documentTypeEditor.createdToast",{name:d})});else{const vt={name:d,icon:u,fields:$,tabs:te,...h==="page"?{treeRules:ce}:{}};we=(await VN(e.id,vt)).documentType,J({variant:"success",title:a("documentTypeEditor.savedToast",{name:d})})}A(!1),n(we)}catch($){B($ instanceof ve?$.message:a("documentTypeEditor.genericError"))}finally{U(!1)}}async function it(){if(!c){j(!0);try{await HN(e.id),ee(!1),J({variant:"success",title:a("documentTypeEditor.deletedToast",{name:d})}),r(e.id)}catch($){J({variant:"danger",title:$ instanceof ve?$.message:a("documentTypeEditor.genericError")})}finally{j(!1)}}}const Yt=[...b.map($=>({key:$.id,title:a("documentTypeEditor.tabGroupTitle",{name:$.name||a("documentTypeBuilder.unnamedTab")}),tabId:$.id,rows:y.filter(te=>te.tabId===$.id)})),{key:"general",title:b.length>0?a("documentTypeEditor.generalGroupTitle"):a("documentTypeEditor.fieldsTitle"),tabId:void 0,rows:y.filter($=>$.tabId==null||!b.some(te=>te.id===$.tabId))}];return x("div",{className:"flex h-full min-h-0 flex-col",children:[x("div",{className:"shrink-0 px-8 pb-3 pt-6",children:[x("p",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[i("span",{children:a("nav.settings")}),i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 text-text-disabled rtl:rotate-180"}),i("span",{children:a("settingsTree.documentTypes")})]}),x("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[i("span",{className:"text-text-secondary",children:i(Hr,{"aria-hidden":"true",className:"size-5"})}),i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:l,className:"text-xl font-bold tracking-tight text-text-primary focus:outline-none",children:c?d||a("documentTypeEditor.createTitle"):d}),i(de,{variant:"neutral",children:a(`documentTypeBuilder.kind.${h}`)}),h==="page"&&C&&i(de,{variant:"neutral",children:a("documentTypeEditor.allowedAtRootBadge")})]})]}),i(mo,{tabs:le,activeId:Ee,onChange:$=>G($),label:a("documentTypeEditor.panesLabel"),idPrefix:o,className:"shrink-0 px-8"}),x("div",{role:"tabpanel",id:Vr(o,Ee),"aria-labelledby":jn(o,Ee),className:"min-w-0 flex-1 overflow-y-auto px-8 pb-8 pt-6",children:[Ee==="design"&&x("div",{className:"flex max-w-3xl flex-col gap-8",children:[x("div",{className:"flex items-end gap-4",children:[i(Ne,{label:a("documentTypeBuilder.nameLabel"),htmlFor:"dt-name",required:!0,requiredText:a("common.required"),className:"flex-1",children:i(ye,{id:"dt-name",required:!0,value:d,onChange:$=>{f($.target.value),ue()}})}),c&&i(Ne,{label:a("documentTypeBuilder.kindLabel"),className:"flex-1",children:i("div",{role:"group",className:"flex items-center gap-2",children:["page","element"].map($=>i(K,{type:"button",variant:h===$?"default":"outline",size:"sm","aria-pressed":h===$,onClick:()=>{g($),ue()},children:a(`documentTypeBuilder.kind.${$}`)},$))})})]}),x("fieldset",{className:"flex flex-col gap-2",children:[i("legend",{className:"text-sm font-medium text-text-primary",children:a("documentTypeBuilder.iconLabel")}),i("p",{className:"text-xs text-text-secondary",children:a("documentTypeBuilder.iconHelp")}),x("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":a("documentTypeBuilder.iconLabel"),children:[i("button",{type:"button","aria-pressed":u==="",title:a("documentTypeBuilder.iconDefault"),"aria-label":a("documentTypeBuilder.iconDefault"),onClick:()=>{p(""),ue()},className:as(u===""),children:i(_s,{"aria-hidden":!0,className:"size-4"})}),m&&i("button",{type:"button","aria-pressed":!0,title:u,"aria-label":u,className:as(!0),children:i(_s,{"aria-hidden":!0,className:"size-4"})}),WN.map($=>{const te=Lr[$];return i("button",{type:"button","aria-pressed":u===$,title:$,"aria-label":$,onClick:()=>{p($),ue()},className:as(u===$),children:i(te,{"aria-hidden":!0,className:"size-4"})},$)})]})]}),x("section",{className:"flex flex-col gap-2",children:[x("div",{className:"flex items-center justify-between",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:a("documentTypeBuilder.tabsLabel")}),i(K,{type:"button",variant:"outline",size:"sm",onClick:Ue,children:a("documentTypeBuilder.addTab")})]}),b.length===0&&i("p",{className:"text-sm text-text-secondary",children:a("documentTypeBuilder.noTabs")}),i(Ua,{sensors:Le,onDragEnd:kn,children:i(ja,{items:b.map($=>$.id),strategy:za,children:i("div",{className:"flex flex-col gap-2",children:b.map($=>i(b2,{tab:$,onChange:te=>hn($.id,te),onRemove:()=>st($.id)},$.id))})})})]}),i(Ua,{sensors:Le,onDragEnd:Be,children:Yt.map($=>x("section",{className:"flex flex-col gap-2",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:$.title}),$.rows.length===0&&i("p",{className:"text-sm text-text-secondary",children:a("documentTypeEditor.noFieldsInGroup")}),i(ja,{items:$.rows.map(te=>te.rowKey),strategy:za,children:i("div",{className:"flex flex-col gap-2",children:$.rows.map(te=>i(v2,{field:te,dataTypes:s,tabs:b,expanded:P.has(te.rowKey),onToggleExpanded:()=>F(te.rowKey),onChange:ce=>Pe(te.rowKey,ce),onChangeValidation:ce=>He(te.rowKey,ce),onRemove:()=>be(te.rowKey)},te.rowKey))})}),i(K,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>q($.tabId),children:a("documentTypeBuilder.addField")})]},$.key))})]}),Ee==="templates"&&e&&e.kind==="page"&&i(C2,{documentType:e,onDocumentTypeUpdated:n}),Ee==="structure"&&h==="page"&&x("div",{className:"flex max-w-xl flex-col gap-4",children:[x("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[i("input",{type:"checkbox",checked:C,onChange:$=>{N($.target.checked),ue()}}),a("documentTypeBuilder.allowedAtRoot")]}),i(Ne,{label:a("documentTypeBuilder.allowedParentTypes"),htmlFor:"dt-parent-types",helpText:a("documentTypeEditor.emptyMeansAny"),children:i("select",{id:"dt-parent-types",multiple:!0,value:T,onChange:$=>{k(pd($)),ue()},className:"w-full rounded-md border border-border-default bg-background-elevated px-3 py-2 text-sm text-text-primary",children:ge.map($=>i("option",{value:$.id,children:$.name},$.id))})}),i(Ne,{label:a("documentTypeBuilder.allowedChildTypes"),htmlFor:"dt-child-types",helpText:a("documentTypeEditor.emptyMeansAny"),children:i("select",{id:"dt-child-types",multiple:!0,value:L,onChange:$=>{R(pd($)),ue()},className:"w-full rounded-md border border-border-default bg-background-elevated px-3 py-2 text-sm text-text-primary",children:ge.map($=>i("option",{value:$.id,children:$.name},$.id))})})]})]}),x("footer",{className:"flex shrink-0 items-center gap-3 border-t border-border-default bg-background-elevated px-8 py-3",children:[!c&&i(K,{type:"button",variant:"ghost",className:"text-danger-600 hover:text-danger-600",onClick:()=>ee(!0),children:a("documentTypeEditor.delete")}),i("span",{className:"text-xs text-text-secondary",children:a(S?"contentEditor.unsavedChanges":"contentEditor.allSaved")}),z&&i("span",{role:"alert",className:"text-xs text-danger-600",children:z}),i("span",{className:"flex-1"}),i(K,{type:"button",disabled:D||!d,onClick:()=>void mn(),children:a(D?"documentTypeEditor.saving":"documentTypeEditor.save")})]}),i(Jn,{open:V,onOpenChange:$=>!$&&ee(!1),children:x(Zn,{children:[x(Qn,{children:[i(tr,{children:a("documentTypeEditor.deleteConfirmTitle",{name:d})}),i(nr,{children:a("documentTypeEditor.deleteConfirmBody")})]}),x(er,{children:[i(ar,{disabled:Z,children:a("documentTypeEditor.deleteCancel")}),i(rr,{disabled:Z,onClick:$=>{$.preventDefault(),it()},children:a(Z?"documentTypeEditor.deleting":"documentTypeEditor.deleteConfirm")})]})]})})]})}async function hd(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=await X(`/api/snapshots${n?`?${n}`:""}`);return oe(r)}async function T2(e){const t=await X("/api/snapshots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return oe(t)}async function k2(e){const t=await X(`/api/snapshots/${e}/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});return oe(t)}const md=20;function R2(){const{t:e}=ae();Re([e("nav.snapshots"),e("nav.settings")]);const[t,n]=E([]),[r,a]=E(null),[o,s]=E(!1),[l,c]=E(""),[d,f]=E(!1),[u,p]=E(null),[m,h]=E(!1),g=H(async()=>{try{const{items:v,nextCursor:C}=await hd({limit:md});n(v),a(C),s(!0)}catch{J({variant:"danger",title:e("snapshots.genericError")})}},[e]);O(()=>{g()},[g]);async function y(){if(r)try{const{items:v,nextCursor:C}=await hd({cursor:r,limit:md});n(N=>[...N,...v]),a(C)}catch{J({variant:"danger",title:e("snapshots.genericError")})}}async function w(v){if(v.preventDefault(),!!l.trim()){f(!0);try{const{snapshot:C}=await T2({label:l.trim()});J({variant:"success",title:e("snapshots.createdToast",{label:C.label})}),c(""),await g()}catch{J({variant:"danger",title:e("snapshots.genericError")})}finally{f(!1)}}}async function b(){if(u){h(!0);try{const{snapshot:v,restoredItems:C}=await k2(u.id);J({variant:"success",title:e("snapshots.restoredToast",{label:v.label,count:C})}),p(null)}catch{J({variant:"danger",title:e("snapshots.genericError")})}finally{h(!1)}}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.settings"),e("settingsTree.system")],title:e("nav.snapshots")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-6 overflow-y-auto px-8 pb-8 pt-2",children:[!o&&x("div",{"aria-label":e("contentTree.loading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]}),o&&x(Ie,{children:[x("form",{onSubmit:w,className:"flex max-w-xl items-end gap-2",children:[i("div",{className:"flex-1",children:i(Ne,{label:e("snapshots.labelLabel"),htmlFor:"snapshot-label",helpText:e("snapshots.labelHelp"),children:i(ye,{id:"snapshot-label",required:!0,value:l,onChange:v=>c(v.target.value)})})}),x(K,{type:"submit",disabled:d||!l.trim(),children:[i(nC,{"aria-hidden":"true",className:"size-4"}),e(d?"snapshots.creating":"snapshots.createButton")]})]}),t.length===0?i(ke,{icon:i(xp,{"aria-hidden":"true"}),title:e("snapshots.empty"),description:e("snapshots.emptyDescription")}):i("ol",{className:"ms-2 flex flex-col gap-4 border-s-2 border-border-default ps-6",children:t.map(v=>x("li",{className:"relative",children:[i("span",{"aria-hidden":"true",className:"absolute -start-8 top-1.5 size-3 rounded-full border-2 border-primary-600 bg-background-elevated"}),x("div",{className:"flex flex-wrap items-center gap-3",children:[x("div",{className:"min-w-0 flex-1",children:[i("p",{className:"text-sm font-medium text-text-primary",children:v.label}),x("p",{className:"text-xs text-text-secondary",children:[new Date(v.createdAt).toLocaleString(),v.description?` — ${v.description}`:""]})]}),i(K,{type:"button",variant:"outline",size:"sm",onClick:()=>p(v),children:e("snapshots.restore")})]})]},v.id))}),r&&i(K,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void y(),children:e("snapshots.loadMore")})]})]}),i(Jn,{open:u!==null,onOpenChange:v=>!v&&p(null),children:x(Zn,{children:[x(Qn,{children:[i(tr,{children:e("snapshots.confirmTitle",{label:(u==null?void 0:u.label)??""})}),i(nr,{children:e("snapshots.confirmBody")})]}),x(er,{children:[i(ar,{disabled:m,children:e("snapshots.cancel")}),i(rr,{disabled:m,onClick:v=>{v.preventDefault(),b()},children:e(m?"snapshots.restoring":"snapshots.confirmRestore")})]})]})})]})}const P2=["primary","background","text"],D2=5;function os(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function I2(e){const t=[];if(!os(e))return t;const n=e.color;if(!os(n))return t;for(const r of P2){const a=n[r];if(os(a))for(const o of Object.values(a)){if(t.length>=D2)return t;typeof o=="string"&&o.length>0&&t.push(o)}}return t}const L2=["light","dark","system"],A2="/plugin-management/marketplace";function gd(e){return se("flex flex-col items-start gap-2 rounded-md border p-3 text-start transition-colors duration-fast",e?"border-primary-600 ring-1 ring-primary-600":"border-border-subtle hover:bg-background-hover")}function M2(){const{t:e}=ae(),t=Wt();Re([e("appearance.navLabel"),e("nav.settings")]);const{mode:n,themeId:r,setMode:a,setActiveTheme:o}=nh(),s=ZT(),[l,c]=E([]),[d,f]=E(!1),[u,p]=E(!1);O(()=>{let y=!1;return eh().then(w=>{y||p(w===null)}).finally(()=>{y||f(!0)}),Gp().then(w=>{y||c(w)}).catch(()=>{}),()=>{y=!0}},[]);const m=s.find(y=>y.pluginId===r),h=r!==null,g=!d&&s.length===0;return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.settings"),e("appearance.navLabel")],title:e("appearance.navLabel")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-6 overflow-y-auto px-8 pb-8 pt-2",children:[i("p",{className:"max-w-prose text-sm text-text-secondary",children:e("appearance.intro")}),x("section",{children:[i("h2",{className:"mb-3 text-sm font-semibold text-text-primary",children:e("appearance.themeSectionTitle")}),g&&x("div",{role:"status","aria-label":e("appearance.loadingLabel"),className:"grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4",children:[i(pe,{className:"h-36 w-full"}),i(pe,{className:"h-36 w-full"}),i(pe,{className:"h-36 w-full"})]}),!g&&x("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4",children:[x("button",{type:"button","data-testid":"theme-card-default",onClick:()=>o(null),className:gd(!h),children:[i("div",{"aria-hidden":"true",className:"h-16 w-full rounded-md bg-gradient-to-br from-primary-600 to-secondary-500"}),x("div",{className:"flex w-full items-center justify-between gap-2",children:[x("span",{className:"text-sm font-medium text-text-primary",children:[e("appearance.defaultName")," ",i("span",{className:"text-xs font-normal text-text-secondary",children:e("appearance.defaultBadge")})]}),!h&&i(de,{variant:"success",children:e("appearance.activeBadge")})]}),i("p",{className:"text-xs text-text-secondary",children:e("appearance.defaultDescription")})]}),s.map(y=>{const w=l.find(C=>C.pluginId===y.pluginId),b=I2(y.tokens),v=r===y.pluginId;return x("button",{type:"button","data-testid":`theme-card-${y.pluginId}`,onClick:()=>o(y.pluginId),className:gd(v),children:[i("div",{"aria-hidden":"true",className:"h-16 w-full rounded-md bg-background-hover",style:b[0]?{backgroundColor:b[0]}:void 0}),x("div",{className:"flex w-full items-center justify-between gap-2",children:[i("span",{className:"truncate text-sm font-medium text-text-primary",children:y.name}),v&&i(de,{variant:"success",children:e("appearance.activeBadge")})]}),i("p",{className:"text-xs text-text-secondary",children:e("appearance.byAuthor",{author:y.author})}),(w==null?void 0:w.trustTier)==="verified"&&x(de,{variant:"success",className:"inline-flex items-center gap-1",children:[i(gN,{"aria-hidden":"true",className:"size-3"}),e("pluginsManage.verified")]}),b.length>0&&i("div",{className:"flex gap-1",children:b.map((C,N)=>i("span",{"data-testid":"theme-swatch","aria-hidden":"true",className:"size-4 rounded-full border border-border-subtle",style:{backgroundColor:C}},N))})]},y.pluginId)}),i("button",{type:"button",onClick:()=>t(A2),className:"flex flex-col items-center justify-center gap-1 rounded-md border border-dashed border-border-strong p-3 text-center text-sm text-text-secondary transition-colors duration-fast hover:bg-background-hover",children:i("span",{className:"font-medium text-text-primary",children:e("appearance.browseMarketplace")})})]}),!g&&d&&u&&i("p",{role:"alert",className:"mt-3 text-xs text-danger-600",children:e("appearance.loadErrorNote")}),!g&&d&&!u&&s.length===0&&i("p",{className:"mt-3 text-xs text-text-secondary",children:e("appearance.noInstalledThemes")})]}),x("section",{className:"max-w-2xl",children:[i("h2",{className:"mb-3 text-sm font-semibold text-text-primary",children:e("appearance.modeSectionTitle")}),x("div",{className:"flex flex-col gap-2",children:[i("div",{role:"group","aria-label":e("appearance.modeGroupLabel"),"aria-disabled":h||void 0,className:"inline-flex rounded-md border border-border-default bg-background-base p-px",children:L2.map(y=>i(K,{type:"button",variant:"ghost",size:"sm",disabled:h,"aria-pressed":n===y,onClick:()=>a(y),className:se("rounded-sm",n===y&&"bg-background-elevated text-text-primary shadow-sm"),children:e(Ws[y])},y))}),i("p",{className:"text-xs text-text-secondary",children:h?e("appearance.modeCaptionCustom",{themeName:(m==null?void 0:m.name)??r}):e("appearance.modeCaptionDefault")})]})]})]})]})}function O2({documentTypes:e,onSaved:t,onDeleted:n}){const{t:r}=ae(),{id:a}=Xn();if(e===null)return i(me,{children:i(ke,{title:r("settingsTree.itemLoading"),titleAs:"h1"})});const o=e.find(s=>s.id===a);return o?i(me,{flush:!0,children:i(ah,{documentType:o,documentTypes:e,onSaved:t,onDeleted:n},a)}):i(me,{children:i(ke,{icon:i(Hr,{"aria-hidden":"true"}),title:r("settingsTree.itemNotFoundTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:r("settingsTree.itemNotFoundDescription")})})}function _2({dataTypes:e,documentTypes:t,onSaved:n}){const{t:r}=ae(),{id:a}=Xn();if(e===null)return i(me,{children:i(ke,{title:r("settingsTree.itemLoading"),titleAs:"h1"})});const o=e.find(s=>s.id===a);return o?i(me,{flush:!0,children:i(rh,{config:o,documentTypes:t,onSaved:n},a)}):i(me,{children:i(ke,{icon:i(Gi,{"aria-hidden":"true"}),title:r("settingsTree.itemNotFoundTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:r("settingsTree.itemNotFoundDescription")})})}function F2(){const{t:e}=ae(),t=Wt(),[n,r]=E(null),[a,o]=E([]),s=yo(),l=_t("/settings/document-types/:id"),c=_t("/settings/data-types/:id"),d=!!_t("/settings/appearance"),f=!!_t("/settings/snapshots"),u=!!_t("/settings/api-keys"),p=!!_t("/settings/api-playground"),m=!!_t("/settings");Re(m?[e("nav.settings")]:[void 0]),O(()=>{Ep({limit:100}).then(({items:y})=>r(y)).catch(()=>r([])),Ka({limit:100}).then(({items:y})=>o(y)).catch(()=>o([]))},[]);function h(y){r(w=>w===null?[y]:w.some(v=>v.id===y.id)?w.map(v=>v.id===y.id?y:v):[...w,y]),t(`/settings/document-types/${y.id}`),Ka({limit:100}).then(({items:w})=>o(w)).catch(()=>{})}function g(y){r(w=>w===null?w:w.filter(b=>b.id!==y)),t("/settings")}return x(Ie,{children:[x(Vn,{label:e("nav.settings"),children:[x(Bt,{title:e("settingsTree.documentTypes"),action:i("button",{type:"button","aria-label":e("documentTypeEditor.newDocumentType"),onClick:()=>t("/settings/document-types/new"),className:"grid size-6 place-items-center rounded-md text-text-secondary transition-colors duration-fast hover:bg-background-hover hover:text-text-primary",children:i(_a,{"aria-hidden":"true",className:"size-4"})}),children:[(n??[]).map(y=>i(dt,{icon:i(Hr,{"aria-hidden":"true"}),label:y.kind==="element"?x("span",{className:"flex items-center gap-2",children:[y.name,i(de,{variant:"neutral",children:e("documentTypeBuilder.kind.element")})]}):y.name,selected:(l==null?void 0:l.params.id)===y.id,onClick:()=>t(`/settings/document-types/${y.id}`)},y.id)),n!==null&&n.length===0&&i("p",{className:"px-2 py-1 text-xs text-text-secondary",children:e("settingsTree.noDocumentTypes")})]}),i(Bt,{title:e("settingsTree.dataTypes"),action:i("button",{type:"button","aria-label":e("dataTypeEditor.newDataType"),onClick:()=>t("/settings/data-types/new"),className:"grid size-6 place-items-center rounded-md text-text-secondary transition-colors duration-fast hover:bg-background-hover hover:text-text-primary",children:i(_a,{"aria-hidden":"true",className:"size-4"})}),children:(s??[]).map(y=>i(dt,{icon:i(Gi,{"aria-hidden":"true"}),label:y.name,selected:(c==null?void 0:c.params.id)===y.id,onClick:()=>t(`/settings/data-types/${y.id}`)},y.id))}),x(Bt,{title:e("settingsTree.templates"),children:[a.map(y=>i(dt,{icon:i(_C,{"aria-hidden":"true"}),label:y.name,selected:!1,onClick:()=>t(`/settings/document-types/${y.documentTypeId}`)},y.id)),a.length===0&&i("p",{className:"px-2 py-1 text-xs text-text-secondary",children:e("settingsTree.noTemplates")})]}),x(Bt,{title:e("settingsTree.system"),children:[i(dt,{icon:i(bp,{"aria-hidden":"true"}),label:e("appearance.navLabel"),selected:d,onClick:()=>t("/settings/appearance")}),i(dt,{icon:i(xp,{"aria-hidden":"true"}),label:e("nav.snapshots"),selected:f,onClick:()=>t("/settings/snapshots")}),i(dt,{icon:i(AC,{"aria-hidden":"true"}),label:e("settingsTree.apiKeys"),selected:u,onClick:()=>t("/settings/api-keys")}),i(dt,{icon:i(CN,{"aria-hidden":"true"}),label:e("settingsTree.apiPlayground"),selected:p,onClick:()=>t("/settings/api-playground")})]})]}),x(ai,{children:[i(Ce,{index:!0,element:i(me,{children:i(ke,{icon:i(vC,{"aria-hidden":"true"}),title:e("settingsTree.welcomeTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:e("settingsTree.welcomeDescription")})})}),i(Ce,{path:"document-types/new",element:i(me,{flush:!0,children:i(ah,{documentType:null,documentTypes:n??[],onSaved:h,onDeleted:g},"create")})}),i(Ce,{path:"document-types/:id",element:i(O2,{documentTypes:n,onSaved:h,onDeleted:g})}),i(Ce,{path:"data-types/new",element:i(me,{flush:!0,children:i(rh,{config:null,documentTypes:n??[],onSaved:y=>t(`/settings/data-types/${y.id}`)},"create")})}),i(Ce,{path:"data-types/:id",element:i(_2,{dataTypes:s,documentTypes:n??[],onSaved:y=>t(`/settings/data-types/${y.id}`)})}),i(Ce,{path:"appearance",element:i(me,{flush:!0,children:i(M2,{})})}),i(Ce,{path:"snapshots",element:i(me,{flush:!0,children:i(R2,{})})}),i(Ce,{path:"api-keys",element:i(me,{flush:!0,children:i(o2,{})})}),i(Ce,{path:"api-playground",element:i(me,{flush:!0,children:i(d2,{})})}),i(Ce,{path:"*",element:i(nn,{to:"/settings",replace:!0})})]})]})}function $2(){const{t:e}=ae();return i("a",{href:"#main",onClick:()=>{var t;(t=document.getElementById("main"))==null||t.focus()},className:"sr-only focus:not-sr-only focus:fixed focus:start-4 focus:top-4 focus:z-50 focus:rounded-md focus:bg-background-elevated focus:px-4 focus:py-2 focus:text-text-primary focus:ring-2 focus:ring-primary-600",children:e("a11y.skipToContent")})}function B2({pluginsBooted:e,isAdmin:t}){const{t:n}=ae(),{sectionId:r}=Xn(),a=r?Ed(r):void 0;return Re([a==null?void 0:a.name,n("nav.plugins")]),e?a?a.adminOnly&&!t?i(nn,{to:"/content",replace:!0}):x(Ie,{children:[i(Vn,{label:a.name,children:i(Bt,{title:a.name,children:i(dt,{icon:i(Oa,{"aria-hidden":"true"}),label:a.name,selected:!0,onClick:()=>{}})})}),i(me,{flush:!0,children:i(Fr,{fetch:X,children:i(Kr,{pluginName:a.name,children:i(a.view,{})})})})]}):i(me,{children:i(ke,{icon:i(Oa,{"aria-hidden":"true"}),title:n("pluginSection.notFoundTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:n("pluginSection.notFoundDescription")})}):i(me,{children:i(ke,{title:n("pluginSection.loading"),titleAs:"h1"})})}function U2(){const{t:e}=ae(),t=Xe(),n=Wt(),{user:r}=Tn(),a=(r==null?void 0:r.role)==="admin",[o,s]=E(!1);KN(),Re(t.pathname==="/media"?[e("nav.media")]:[void 0]),Re(t.pathname==="/users"?[e("nav.users")]:[void 0]),O(()=>{bT().finally(()=>s(!0)),eh()},[]);const l=t.pathname.split("/").filter(Boolean),c=(l[0]==="plugins"?l[1]:l[0])??"content",d=H(f=>{const u=th.some(p=>p.id===f);n(u?`/${f}`:`/plugins/${f}`)},[n]);return x("div",{className:"flex h-screen flex-col bg-background-base font-sans text-text-primary",children:[i($2,{}),i(n2,{activeId:c,onSelect:d}),i("div",{className:"flex min-h-0 flex-1",children:x(ai,{children:[i(Ce,{path:"/",element:i(nn,{to:"/content",replace:!0})}),i(Ce,{path:"/content",element:i(Hc,{})}),i(Ce,{path:"/content/:nodeId",element:i(Hc,{})}),i(Ce,{path:"/media",element:x(Ie,{children:[i(Vn,{label:e("nav.media"),children:i(Bt,{title:e("nav.media"),children:i(dt,{icon:i(yp,{"aria-hidden":"true"}),label:e("mediaTree.all"),selected:!0,onClick:()=>{}})})}),i(me,{flush:!0,children:i(gT,{})})]})}),i(Ce,{path:"/settings/*",element:a?i(F2,{}):i(nn,{to:"/content",replace:!0})}),i(Ce,{path:"/users",element:a?x(Ie,{children:[i(Vn,{label:e("nav.users"),children:i(Bt,{title:e("nav.users"),children:i(dt,{icon:i(Yi,{"aria-hidden":"true"}),label:e("usersTree.all"),selected:!0,onClick:()=>{}})})}),i(me,{flush:!0,children:i(XT,{})})]}):i(nn,{to:"/content",replace:!0})}),i(Ce,{path:"/plugins/:sectionId",element:i(B2,{pluginsBooted:o,isAdmin:a})}),i(Ce,{path:"/plugin-management/*",element:a?i(WT,{}):i(nn,{to:"/content",replace:!0})}),i(Ce,{path:"*",element:i(uT,{})})]})}),i(xT,{})]})}const z2=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,j2=8;function oh(e){const t={};return z2.test(e.email)||(t.email="invalid"),e.password.length<j2&&(t.password="tooShort"),e.password!==e.confirmPassword&&(t.confirmPassword="mismatch"),t}function V2(e){return Object.keys(oh(e)).length===0}function sh(e){const t={};if(e.dialect==="sqlite")return e.filePath.trim().length===0&&(t.filePath="required"),t;e.host.trim().length===0&&(t.host="required");const n=Number(e.port);return(!Number.isInteger(n)||n<=0)&&(t.port="invalid"),e.database.trim().length===0&&(t.database="required"),e.username.trim().length===0&&(t.username="required"),t}function H2(e){return Object.keys(sh(e)).length===0}const Un="blank",K2={selected:Un,includeSampleContent:!0};function W2(e,t){if(e.selected===Un)return;const n=t.find(r=>r.pluginId===e.selected);return{pluginId:e.selected,includeSampleContent:e.includeSampleContent&&((n==null?void 0:n.sampleContent)??!1)}}function q2(e,t){if(e.selected===Un)return{kind:"finish"};const n=t.find(r=>r.pluginId===e.selected);return n?{kind:"install",templateName:n.name}:{kind:"finish"}}function G2(e,t,n,r,a=!1){const o={email:e.email,name:e.name,password:e.password},s=W2(n,r);if(a)return s===void 0?{admin:o}:{admin:o,starter:s};const l=t.dialect==="sqlite"?{dialect:"sqlite",filePath:t.filePath}:{dialect:t.dialect,host:t.host,port:Number(t.port),database:t.database,username:t.username,password:t.password};return s===void 0?{admin:o,database:l}:{admin:o,database:l,starter:s}}async function Y2(){const e=await fetch("/api/setup/status");return Ki(e)}async function X2(e){const t=await fetch("/api/setup/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return Ki(t)}const J2={email:"",name:"",password:"",confirmPassword:""},Z2={dialect:"postgresql",filePath:"file:./velora.db",host:"localhost",port:"5432",database:"",username:"",password:""};function yd(e){return e?"rounded-md border border-primary-600 ring-1 ring-primary-600 bg-background-base":"rounded-md border border-border-default bg-background-base"}const vd="flex w-full flex-col gap-1 rounded-md p-3 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600 focus-visible:ring-offset-2 focus-visible:ring-offset-background-elevated";function Q2({bundledTemplates:e=[],databaseConfigured:t=!1}){var S,A;const{t:n}=ae(),[r,a]=E("credentials"),[o,s]=E(J2),[l,c]=E(!1),[d,f]=E(Z2),[u,p]=E(!1),[m,h]=E(K2),[g,y]=E(!1),[w,b]=E(null),[v,C]=E(null);Re([n(r==="complete"?"setup.completeTitle":r==="starter"?"setup.starterTitle":r==="database"?"setup.databaseStepTitle":"setup.title")]);const T=oh(o),k=sh(d);function L(D){D.preventDefault(),c(!0),V2(o)&&a(t?"starter":"database")}function R(D){f(U=>({...U,dialect:D,port:D==="mysql"?"3306":"5432"}))}function P(D){D.preventDefault(),p(!0),H2(d)&&a("starter")}async function I(D){D.preventDefault(),b(null),y(!0);try{const U=await X2(G2(o,d,m,e,t));C(U),a("complete")}catch(U){b(U instanceof Hi?U.message:n("setup.submitError"))}finally{y(!1)}}if(r==="complete"){const D=((S=v==null?void 0:v.starter)==null?void 0:S.outcome)==="failed"?v.starter:null,U=D?((A=e.find(z=>z.pluginId===D.pluginId))==null?void 0:A.name)??D.pluginId:null;return i("div",{className:"flex min-h-screen items-center justify-center bg-background-base p-8 font-sans text-text-primary",children:x("div",{className:"w-full max-w-sm rounded-lg border border-border-default bg-background-elevated p-8 shadow-lg",children:[i("h1",{className:"mb-1 text-xl font-bold",children:n("setup.completeTitle")}),i("p",{className:"text-sm text-text-secondary",children:n("setup.completeInstructions")}),U&&i("p",{role:"alert",className:"mt-4 text-sm text-warning-700",children:n("setup.starterFailedWarning",{name:U})})]})})}if(r==="starter"){const D=q2(m,e),U=D.kind==="install"?n("setup.installAndFinish",{name:D.templateName}):n("setup.finish");return i("div",{className:"flex min-h-screen items-center justify-center bg-background-base p-8 font-sans text-text-primary",children:x("div",{className:"w-full max-w-sm rounded-lg border border-border-default bg-background-elevated p-8 shadow-lg",children:[i("p",{className:"mb-1 text-xs text-text-secondary",children:n("setup.starterSteps")}),i("h1",{className:"mb-6 text-xl font-bold",children:n("setup.starterTitle")}),x("form",{className:"flex flex-col gap-4",onSubmit:I,children:[x("div",{className:"flex flex-col gap-3",children:[i("div",{className:yd(m.selected===Un),children:x("button",{type:"button","aria-pressed":m.selected===Un,onClick:()=>h(z=>({...z,selected:Un})),className:vd,children:[i("span",{className:"text-sm font-semibold",children:n("setup.blankName")}),i("span",{className:"text-sm text-text-secondary",children:n("setup.blankDescription")})]})}),e.map(z=>{const B=m.selected===z.pluginId;return x("div",{className:yd(B),children:[x("button",{type:"button","aria-pressed":B,onClick:()=>h(_=>({..._,selected:z.pluginId})),className:vd,children:[x("span",{className:"flex items-center gap-2",children:[i("span",{className:"text-sm font-semibold",children:z.name}),i(de,{variant:"primary",children:n("setup.officialBadge")})]}),z.description&&i("span",{className:"text-sm text-text-secondary",children:z.description})]}),z.sampleContent&&x("label",{className:"flex cursor-pointer items-start gap-2 px-3 pb-3 text-sm text-text-secondary",onClick:_=>_.stopPropagation(),children:[i(Dh,{checked:m.includeSampleContent,onCheckedChange:_=>h(G=>({...G,includeSampleContent:_===!0})),className:"mt-0.5"}),i("span",{children:n("setup.includeSampleContent")})]})]},z.pluginId)})]}),w&&i("p",{role:"alert",className:"text-sm text-danger-600",children:w}),x("div",{className:"flex gap-2",children:[i(K,{type:"button",variant:"outline",onClick:()=>a(t?"credentials":"database"),disabled:g,children:n("setup.back")}),i(K,{type:"submit",disabled:g,children:g?n("setup.finishing"):U})]})]})]})})}return r==="database"?i("div",{className:"flex min-h-screen items-center justify-center bg-background-base p-8 font-sans text-text-primary",children:x("div",{className:"w-full max-w-sm rounded-lg border border-border-default bg-background-elevated p-8 shadow-lg",children:[i("h1",{className:"mb-1 text-xl font-bold",children:n("setup.databaseStepTitle")}),i("p",{className:"mb-6 text-sm text-text-secondary",children:n("setup.databaseStepSubtitle")}),x("form",{className:"flex flex-col gap-4",onSubmit:P,children:[x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-dialect",className:"text-sm font-medium",children:n("setup.dialectLabel")}),x("select",{id:"setup-dialect",name:"dialect",className:"rounded-md border border-border-default bg-background-base p-2 text-sm",value:d.dialect,onChange:D=>R(D.target.value),children:[i("option",{value:"postgresql",children:"PostgreSQL"}),i("option",{value:"mysql",children:"MySQL"}),i("option",{value:"sqlite",children:"SQLite"})]})]}),d.dialect==="sqlite"?x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-file-path",className:"text-sm font-medium",children:n("setup.filePathLabel")}),i(ye,{id:"setup-file-path",name:"filePath",type:"text",value:d.filePath,onChange:D=>f({...d,filePath:D.target.value})}),u&&k.filePath&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.filePathRequired")})]}):x(Ie,{children:[x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-host",className:"text-sm font-medium",children:n("setup.hostLabel")}),i(ye,{id:"setup-host",name:"host",type:"text",value:d.host,onChange:D=>f({...d,host:D.target.value})}),u&&k.host&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.hostRequired")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-port",className:"text-sm font-medium",children:n("setup.portLabel")}),i(ye,{id:"setup-port",name:"port",type:"text",inputMode:"numeric",value:d.port,onChange:D=>f({...d,port:D.target.value})}),u&&k.port&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.portInvalid")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-database-name",className:"text-sm font-medium",children:n("setup.databaseNameLabel")}),i(ye,{id:"setup-database-name",name:"database",type:"text",value:d.database,onChange:D=>f({...d,database:D.target.value})}),u&&k.database&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.databaseNameRequired")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-username",className:"text-sm font-medium",children:n("setup.usernameLabel")}),i(ye,{id:"setup-username",name:"username",type:"text",value:d.username,onChange:D=>f({...d,username:D.target.value})}),u&&k.username&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.usernameRequired")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-database-password",className:"text-sm font-medium",children:n("setup.databasePasswordLabel")}),i(ye,{id:"setup-database-password",name:"databasePassword",type:"password",value:d.password,onChange:D=>f({...d,password:D.target.value})})]})]}),x("div",{className:"flex gap-2",children:[i(K,{type:"button",variant:"outline",onClick:()=>a("credentials"),children:n("setup.back")}),i(K,{type:"submit",children:n("setup.continue")})]})]})]})}):i("div",{className:"flex min-h-screen items-center justify-center bg-background-base p-8 font-sans text-text-primary",children:x("div",{className:"w-full max-w-sm rounded-lg border border-border-default bg-background-elevated p-8 shadow-lg",children:[i("h1",{className:"mb-1 text-xl font-bold",children:n("setup.title")}),i("p",{className:"mb-6 text-sm text-text-secondary",children:n("setup.subtitle")}),x("form",{className:"flex flex-col gap-4",onSubmit:L,children:[x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-email",className:"text-sm font-medium",children:n("setup.emailLabel")}),i(ye,{id:"setup-email",name:"email",type:"email",autoComplete:"email",required:!0,value:o.email,onChange:D=>s({...o,email:D.target.value})}),l&&T.email&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.invalidEmail")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-name",className:"text-sm font-medium",children:n("setup.nameLabel")}),i(ye,{id:"setup-name",name:"name",type:"text",autoComplete:"name",value:o.name,onChange:D=>s({...o,name:D.target.value})})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-password",className:"text-sm font-medium",children:n("setup.passwordLabel")}),i(ye,{id:"setup-password",name:"password",type:"password",autoComplete:"new-password",required:!0,value:o.password,onChange:D=>s({...o,password:D.target.value})}),l&&T.password&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.passwordTooShort")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-confirm-password",className:"text-sm font-medium",children:n("setup.confirmPasswordLabel")}),i(ye,{id:"setup-confirm-password",name:"confirmPassword",type:"password",autoComplete:"new-password",required:!0,value:o.confirmPassword,onChange:D=>s({...o,confirmPassword:D.target.value})}),l&&T.confirmPassword&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.passwordMismatch")})]}),i(K,{type:"submit",children:n("setup.continue")})]})]})})}function ek(){const[e,t]=E({status:"checking",bundledTemplates:[],databaseConfigured:!1});return O(()=>{Y2().then(n=>t({status:n.setupRequired?"required":"not-required",bundledTemplates:n.bundledTemplates??[],databaseConfigured:n.databaseConfigured??!1})).catch(()=>t({status:"not-required",bundledTemplates:[],databaseConfigured:!1}))},[]),e}function tk(){const{status:e}=Tn(),{status:t,bundledTemplates:n,databaseConfigured:r}=ek();return e==="restoring"||t==="checking"?null:t==="required"?i(Q2,{bundledTemplates:n,databaseConfigured:r}):e==="authenticated"?i(U2,{}):i(M1,{})}function nk(){const{t:e}=ae();return i(My,{basename:"/velora/".replace(/\/$/,""),children:x(A1,{children:[i(tk,{}),i(C1,{closeLabel:e("toast.dismiss"),label:e("toast.notification")})]})})}tg();await ig();mh(document.getElementById("root")).render(i(hh,{children:i(nk,{})}));
542
+ `);eg(n);const{themeId:r}=us();return r!==null&&!t.some(a=>a.pluginId===r)&&jd(null),t}const nh=[{id:"content",labelKey:"nav.content",icon:Wi},{id:"media",labelKey:"nav.media",icon:Ma},{id:"settings",labelKey:"nav.settings",icon:Cp,adminOnly:!0},{id:"users",labelKey:"nav.users",icon:Yi,adminOnly:!0},{id:"plugin-management",labelKey:"nav.plugins",icon:H1,adminOnly:!0}],Ws={light:"theme.light",dark:"theme.dark",system:"theme.system"};function rh(){const e=Nd($d,us);O(()=>{if(e.themeId!==null||(ps(Ud(e.mode)),e.mode!=="system"))return;const r=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{us().themeId===null&&ps(Bd())};return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e.mode,e.themeId]);const t=K(r=>{Qm(r)},[]),n=K(r=>{jd(r)},[]);return{mode:e.mode,themeId:e.themeId,setMode:t,setActiveTheme:n}}function t2(e,t){return((e==null?void 0:e.trim())||t.split("@")[0]||t).split(/[\s._-]+/).filter(Boolean).slice(0,2).map(o=>o.charAt(0).toUpperCase()).join("")||"?"}function n2(){const{t:e,i18n:t}=oe(),{user:n,logout:r}=Tn(),{mode:a,themeId:o,setMode:s}=rh(),l=Tr(),c=Tr();if(!n)return null;const d=Object.keys(t.options.resources??{}),f=d.length>1,u=n.name??n.email,p=t2(n.name,n.email),m=o!==null;return x(_i,{children:[i(Fi,{asChild:!0,children:x("button",{type:"button","aria-label":e("userMenu.open",{name:u}),className:"flex items-center gap-2 rounded-full p-px pe-2 transition-colors duration-fast hover:bg-background-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600",children:[i("span",{"aria-hidden":"true",className:"grid size-8 place-items-center rounded-full bg-primary-100 text-xs font-semibold text-primary-800 ring-2 ring-primary-600 ring-offset-2 ring-offset-background-elevated",children:p}),i(aC,{"aria-hidden":"true",className:"size-4 text-text-disabled"})]})}),x($i,{align:t.dir()==="rtl"?"start":"end",className:"w-72 p-2",children:[x("div",{className:"flex items-center gap-3 px-2 py-2",children:[i("span",{"aria-hidden":"true",className:"grid size-11 shrink-0 place-items-center rounded-full bg-primary-100 text-sm font-semibold text-primary-800",children:p}),x("div",{className:"min-w-0",children:[x("p",{className:"flex items-center gap-2 text-sm font-semibold text-text-primary",children:[i("span",{className:"truncate",children:u}),i(de,{variant:"primary",children:e(`users.role.${n.role}`)})]}),i("p",{className:"truncate text-xs text-text-secondary",children:n.email})]})]}),i(qo,{}),i(wc,{id:l,children:e("userMenu.theme")}),i(bc,{"aria-labelledby":l,value:a,onValueChange:h=>s(h),children:Object.keys(Ws).map(h=>i(xc,{value:h,disabled:m,children:e(Ws[h])},h))}),m&&i("p",{className:"px-2 pb-1 text-xs text-text-secondary",children:e("userMenu.themeInert")}),f&&x(Ie,{children:[i(qo,{}),i(wc,{id:c,children:e("userMenu.language")}),i(bc,{"aria-labelledby":c,value:t.resolvedLanguage??t.language,onValueChange:h=>void t.changeLanguage(h),children:d.map(h=>i(xc,{value:h,children:e(`userMenu.languageName.${h}`,{defaultValue:h})},h))})]}),i(qo,{}),x(La,{variant:"destructive",onSelect:()=>void r(),children:[i(jC,{"aria-hidden":"true",className:"size-4"}),e("app.logout")]})]})]})}function r2(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,"0")}`}const id="flex items-center gap-2 border-b-2 px-3 text-sm font-medium transition-colors duration-fast",ld="border-primary-300 text-text-primary",cd="border-transparent text-text-secondary hover:text-text-primary";function a2({activeId:e,onSelect:t}){const{t:n}=oe(),{user:r,idleMsRemaining:a}=Tn(),o=nh.filter(s=>!s.adminOnly||(r==null?void 0:r.role)==="admin");return x("header",{className:"flex h-14 shrink-0 items-center gap-7 border-b border-border-default bg-background-elevated px-5",children:[x("div",{className:"flex items-center gap-2 text-base font-semibold tracking-tight text-text-primary",children:[i(pp,{}),n("app.title")]}),x("nav",{"aria-label":n("nav.sectionsLabel"),className:"flex h-full min-w-0 gap-1 overflow-x-auto",children:[o.map(s=>{const l=s.id===e;return x("button",{type:"button","aria-current":l?"page":void 0,onClick:()=>t(s.id),className:se(id,l?ld:cd),children:[i(s.icon,{"aria-hidden":"true",className:"size-4 shrink-0"}),n(s.labelKey)]},s.id)}),Ch().filter(s=>!s.adminOnly||(r==null?void 0:r.role)==="admin").map(s=>{const l=s.id===e;return x("button",{type:"button","aria-current":l?"page":void 0,onClick:()=>t(s.id),className:se(id,l?ld:cd),children:[i(Oa,{"aria-hidden":"true",className:"size-4 shrink-0"}),s.name]},s.id)})]}),x("div",{className:"ms-auto flex items-center gap-2",children:[a!=null&&x(Ie,{children:[i("span",{"aria-live":"off",className:se("me-2 font-mono text-xs tabular-nums",a<6e4?"text-danger-600":"text-text-secondary"),children:n("app.sessionExpiresIn",{time:r2(a)})}),i("span",{role:"status",className:"sr-only",children:a<6e4?n("app.sessionExpiringSoon"):""})]}),i("a",{href:"/docs/",target:"_blank",rel:"noreferrer","aria-label":n("nav.docs"),title:n("nav.docs"),className:"grid size-9 place-items-center rounded-md text-text-secondary transition-colors duration-fast hover:bg-background-hover hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600",children:i(W1,{"aria-hidden":"true",className:"size-5"})}),i(n2,{})]})]})}async function dd(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=await X(`/api/api-keys${n?`?${n}`:""}`);return re(r)}async function o2(e,t="read"){const n=await X("/api/api-keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,scope:t})});return re(n)}async function s2(e){const t=await X(`/api/api-keys/${e}/revoke`,{method:"POST"});return re(t)}const ud=50;function i2(){const{t:e}=oe();Re([e("apiKeys.title"),e("nav.settings")]);const[t,n]=E([]),[r,a]=E(null),[o,s]=E(!1),[l,c]=E(!1),[d,f]=E(""),[u,p]=E("read"),[m,h]=E(!1),[g,y]=E(null),[w,b]=E(null),[v,C]=E(null),N=K(async()=>{try{const{items:k,nextCursor:S}=await dd({limit:ud});n(k),a(S),s(!0)}catch{J({variant:"danger",title:e("apiKeys.genericError")})}},[e]);O(()=>{N()},[N]);async function T(){if(r)try{const{items:k,nextCursor:S}=await dd({cursor:r,limit:ud});n(A=>[...A,...k]),a(S)}catch{J({variant:"danger",title:e("apiKeys.genericError")})}}async function R(k){k.preventDefault(),h(!0),y(null);try{const{apiKey:S,secret:A}=await o2(d.trim(),u);J({variant:"success",title:e("apiKeys.createdToast",{name:S.name})}),f(""),p("read"),c(!1),b({name:S.name,secret:A}),n(D=>[...D,S])}catch(S){y(S instanceof ve?S.message:e("apiKeys.genericError"))}finally{h(!1)}}async function L(k){try{await navigator.clipboard.writeText(k),J({variant:"success",title:e("apiKeys.copiedToast")})}catch{J({variant:"danger",title:e("apiKeys.copyFailedToast")})}}async function I(k){try{const{apiKey:S}=await s2(k.id);n(A=>A.map(D=>D.id===S.id?S:D)),C(null),J({variant:"success",title:e("apiKeys.revokedToast",{name:S.name})})}catch(S){J({variant:"danger",title:S instanceof ve?S.message:e("apiKeys.genericError")})}}function P(k){return new Date(k).toLocaleString()}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.settings"),e("apiKeys.title")],title:e("apiKeys.title"),actions:!l&&i(H,{type:"button",size:"sm",onClick:()=>c(!0),children:e("apiKeys.newButton")})}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[!o&&x("div",{"aria-label":e("apiKeys.loading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]}),w&&x("div",{role:"alert",className:"flex max-w-2xl flex-col gap-3 rounded-md border border-warning-500 p-4",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:e("apiKeys.secretTitle")}),i("p",{className:"text-sm text-text-secondary",children:e("apiKeys.secretWarning")}),i("code",{className:"select-all break-all rounded-md bg-background-hover p-2 font-mono text-xs text-text-primary",children:w.secret}),x("div",{className:"flex gap-2",children:[i(H,{type:"button",size:"sm",onClick:()=>void L(w.secret),children:e("apiKeys.copyButton")}),i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>b(null),children:e("apiKeys.dismissButton")})]})]}),o&&l&&x("form",{onSubmit:R,className:"flex max-w-xl flex-col gap-4 rounded-md border border-border-default p-4",children:[x("div",{className:"flex items-center justify-between",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:e("apiKeys.createTitle")}),i(H,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(!1),children:e("apiKeys.cancel")})]}),i(Ne,{label:e("apiKeys.nameLabel"),htmlFor:"api-key-name",required:!0,requiredText:e("common.required"),children:i(ye,{id:"api-key-name",required:!0,maxLength:100,value:d,onChange:k=>f(k.target.value)})}),x("fieldset",{className:"flex flex-col gap-2",children:[i("legend",{className:"text-sm font-medium text-text-primary",children:e("apiKeys.scopeLabel")}),x("label",{className:"flex items-start gap-2 text-sm",children:[i("input",{type:"radio",name:"api-key-scope",value:"read",checked:u==="read",onChange:()=>p("read")}),x("span",{children:[i("span",{className:"font-medium",children:e("apiKeys.scopeRead")}),i("span",{className:"block text-text-secondary",children:e("apiKeys.scopeReadHelp")})]})]}),x("label",{className:"flex items-start gap-2 text-sm",children:[i("input",{type:"radio",name:"api-key-scope",value:"write",checked:u==="write",onChange:()=>p("write")}),x("span",{children:[i("span",{className:"font-medium",children:e("apiKeys.scopeWrite")}),i("span",{className:"block text-text-secondary",children:e("apiKeys.scopeWriteHelp")})]})]})]}),g&&i("p",{role:"alert",className:"text-sm text-danger-600",children:g}),i(H,{type:"submit",disabled:m,className:"self-start",children:e(m?"apiKeys.creating":"apiKeys.createButton")})]}),o&&t.length===0&&i("p",{className:"text-sm text-text-secondary",children:e("apiKeys.empty")}),o&&t.length>0&&i("ul",{className:"flex flex-col gap-1",children:t.map(k=>{const S=k.revokedAt!==null;return x("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border-subtle px-3 py-2",children:[x("div",{className:"min-w-0 flex-1",children:[i("p",{className:`truncate text-sm ${S?"text-text-secondary line-through":"text-text-primary"}`,children:k.name}),x("p",{className:"truncate text-xs text-text-secondary",children:[e("apiKeys.createdAt",{date:P(k.createdAt)})," · ",k.lastUsedAt?e("apiKeys.lastUsedAt",{date:P(k.lastUsedAt)}):e("apiKeys.neverUsed")]})]}),i(de,{variant:S?"neutral":"primary",children:e(S?"apiKeys.statusRevoked":"apiKeys.statusActive")}),i(de,{variant:k.scope==="write"?"warning":"neutral",children:e(k.scope==="write"?"apiKeys.scopeWrite":"apiKeys.scopeRead")}),!S&&(v===k.id?x("div",{className:"flex items-center gap-2",children:[i("p",{className:"text-xs text-danger-600",children:e("apiKeys.revokeConfirmBody")}),i(H,{type:"button",variant:"destructive",size:"sm",onClick:()=>void I(k),children:e("apiKeys.revokeConfirmButton")}),i(H,{type:"button",variant:"ghost",size:"sm",onClick:()=>C(null),children:e("apiKeys.revokeCancelButton")})]}):i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>C(k.id),children:e("apiKeys.revokeButton")}))]},k.id)})}),r&&i(H,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void T(),children:e("users.loadMore")})]})]})}async function l2(){const e=await X("/api/api-playground/openapi");return re(e)}async function c2(){const e=await X("/api/api-keys?limit=100");return re(e)}async function d2(e,t,n){const r=await fetch(t,{method:e,headers:n?{authorization:`Bearer ${n}`}:{}}),a=await r.text();let o=a;try{o=JSON.stringify(JSON.parse(a),null,2)}catch{}return{status:r.status,ok:r.ok,body:o}}function u2(e){const t=e.paths??{},n=[];for(const[r,a]of Object.entries(t))for(const o of Object.keys(a))o.toLowerCase()==="get"&&!r.includes("{")&&n.push({method:o.toUpperCase(),path:r});return n.sort((r,a)=>r.path.localeCompare(a.path))}function f2(){const{t:e}=oe();Re([e("apiPlayground.title"),e("nav.settings")]);const[t,n]=E([]),[r,a]=E([]),[o,s]=E(""),[l,c]=E(""),[d,f]=E(!1),[u,p]=E(null);O(()=>{l2().then(h=>n(u2(h))).catch(()=>J({variant:"danger",title:e("apiPlayground.genericError")})),c2().then(({items:h})=>a(h.filter(g=>g.revokedAt===null).map(g=>g.name))).catch(()=>{})},[e]);async function m(){const h=t.find(g=>`${g.method} ${g.path}`===o);if(h){f(!0),p(null);try{p(await d2(h.method,h.path,l.trim()))}catch{J({variant:"danger",title:e("apiPlayground.genericError")})}finally{f(!1)}}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.settings"),e("apiPlayground.title")],title:e("apiPlayground.title")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto px-8 pb-8 pt-2",children:[i("p",{className:"max-w-2xl text-sm text-text-secondary",children:e("apiPlayground.description")}),t.length===0?i("p",{className:"text-sm text-text-secondary",children:e("apiPlayground.noEndpoints")}):x("div",{className:"flex max-w-2xl flex-col gap-4",children:[i(Ne,{label:e("apiPlayground.endpointLabel"),htmlFor:"pg-endpoint",children:x("select",{id:"pg-endpoint",value:o,onChange:h=>s(h.target.value),className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary",children:[i("option",{value:"",children:"—"}),t.map(h=>x("option",{value:`${h.method} ${h.path}`,children:[h.method," ",h.path]},`${h.method} ${h.path}`))]})}),i(Ne,{label:e("apiPlayground.keyLabel"),htmlFor:"pg-key",helpText:r.length>0?e("apiPlayground.keyNamesHint",{names:r.join(", ")}):void 0,children:i(ye,{id:"pg-key",type:"password",value:l,placeholder:e("apiPlayground.keyPlaceholder"),onChange:h=>c(h.target.value)})}),i(H,{type:"button",disabled:!o||d,className:"self-start",onClick:()=>void m(),children:e(d?"apiPlayground.sending":"apiPlayground.sendButton")}),u&&x("div",{className:"flex flex-col gap-2 rounded-md border border-border-default p-4",children:[x("p",{className:`text-sm font-semibold ${u.ok?"text-text-primary":"text-danger-600"}`,children:[e("apiPlayground.statusLabel"),": ",u.status]}),i("pre",{className:"max-h-96 overflow-auto rounded-md bg-background-hover p-3 font-mono text-xs text-text-primary",children:u.body})]})]})]})]})}async function p2(e){const t=await X("/api/data-types",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return re(t)}async function h2(e,t){const n=await X(`/api/data-types/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return re(n)}function ah({config:e,documentTypes:t,onSaved:n}){const{t:r}=oe(),a=e===null,o=ir(),s=Nh(),[l,c]=E((e==null?void 0:e.name)??""),[d,f]=E((e==null?void 0:e.editorId)??"");Re([a?l||r("dataTypeEditor.createTitle"):l,r("nav.settings")]);const[u,p]=E((e==null?void 0:e.settings)??{}),[m,h]=E(!1),[g,y]=E(!1),[w,b]=E(null),v=d?xa(d):void 0,C=v!=null&&Object.keys(v.settingsSchema.properties??{}).length>0,N=e?t.flatMap(R=>{const L=R.fields.filter(I=>I.datatypeId===e.id).map(I=>I.name);return L.length>0?[`${R.name} (${L.join(", ")})`]:[]}):[];async function T(){if(d){y(!0),b(null);try{const R=a?(await p2({name:l,editorId:d,settings:u})).dataType:(await h2(e.id,{name:l,settings:u})).dataType;J({variant:"success",title:r(a?"dataTypeEditor.createdToast":"dataTypeEditor.savedToast",{name:l})}),h(!1),await fS(),n(R)}catch(R){b(R instanceof ve?R.message:r("dataTypeEditor.genericError"))}finally{y(!1)}}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[x("div",{className:"shrink-0 px-8 pb-4 pt-6",children:[x("p",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[i("span",{children:r("nav.settings")}),i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 text-text-disabled rtl:rotate-180"}),i("span",{children:r("settingsTree.dataTypes")})]}),x("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[i("span",{className:"text-text-secondary",children:i(Gi,{"aria-hidden":"true",className:"size-5"})}),i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:o,className:"text-xl font-bold tracking-tight text-text-primary focus:outline-none",children:a?l||r("dataTypeEditor.createTitle"):l}),v&&i(de,{variant:"neutral",children:v.name})]})]}),i("div",{className:"min-w-0 flex-1 overflow-y-auto px-8 pb-8 pt-2",children:x("div",{className:"flex max-w-xl flex-col gap-6",children:[i(Ne,{label:r("dataTypeEditor.nameLabel"),htmlFor:"data-type-name",required:!0,requiredText:r("common.required"),helpText:r("dataTypeEditor.nameHelp"),children:i(ye,{id:"data-type-name",required:!0,value:l,onChange:R=>{c(R.target.value),h(!0)}})}),i(Ne,{label:r("dataTypeEditor.editorLabel"),htmlFor:"data-type-editor",helpText:r(a?"dataTypeEditor.editorHelp":"dataTypeEditor.editorImmutableHelp"),children:x("select",{id:"data-type-editor",required:!0,disabled:!a,value:d,onChange:R=>{f(R.target.value),h(!0)},className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary disabled:opacity-50",children:[i("option",{value:"",disabled:!0,children:r("dataTypeEditor.editorPlaceholder")}),s.map(R=>i("option",{value:R.id,children:R.name},R.id))]})}),v&&x("section",{className:"flex flex-col gap-2 rounded-md border border-border-default p-4",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:r("dataTypeEditor.settingsTitle")}),C?x(Ie,{children:[i("p",{className:"text-xs text-text-secondary",children:r("dataTypeEditor.settingsHelp",{editor:v.name})}),i(Fr,{fetch:X,children:i(qa,{settings:u,onSettingsChange:R=>{p(R),h(!0)},children:i(Kr,{pluginName:v.name,children:i(v.views.settings,{})})})})]}):i("p",{className:"text-sm text-text-secondary",children:r("dataTypeEditor.noSettings",{editor:v.name})})]}),N.length>0&&i("p",{className:"rounded-md bg-background-elevated px-3 py-2 text-xs text-text-secondary",children:r("dataTypeEditor.usedBy",{count:N.length,list:N.join(", ")})})]})}),x("footer",{className:"flex shrink-0 items-center gap-3 border-t border-border-default bg-background-elevated px-8 py-3",children:[i("span",{className:"text-xs text-text-secondary",children:r(m?"contentEditor.unsavedChanges":"contentEditor.allSaved")}),w&&i("span",{role:"alert",className:"text-xs text-danger-600",children:w}),i("span",{className:"flex-1"}),i(H,{type:"button",disabled:g||!l||!d,onClick:()=>void T(),children:r(g?"dataTypeEditor.saving":"dataTypeEditor.save")})]})]})}const m2="com.velora.text",g2="com.velora.number";function y2(){}function v2({resolved:e}){const t=e.editor.views.preview??e.editor.views.readOnly;return i(Fr,{fetch:X,children:i(Gs,{value:void 0,onChange:y2,children:i(qa,{settings:e.settings,children:i(Kr,{pluginName:e.editor.name,children:i(t,{})})})})})}function b2(e,t){const n=[];return e.required&&n.push(t("documentTypeBuilder.validation.required")),e.minLength!==void 0&&n.push(t("documentTypeBuilder.chip.minLength",{value:e.minLength})),e.maxLength!==void 0&&n.push(t("documentTypeBuilder.chip.maxLength",{value:e.maxLength})),e.min!==void 0&&n.push(t("documentTypeBuilder.chip.min",{value:e.min})),e.max!==void 0&&n.push(t("documentTypeBuilder.chip.max",{value:e.max})),e.pattern&&n.push(t("documentTypeBuilder.chip.pattern")),n}function x2({field:e,dataTypes:t,tabs:n,expanded:r,onToggleExpanded:a,onChange:o,onChangeValidation:s,onRemove:l}){var C;const{t:c}=oe(),{attributes:d,listeners:f,setNodeRef:u,transform:p,transition:m,isDragging:h}=ll({id:e.rowKey}),g={transform:Cn.Transform.toString(p),transition:m,opacity:h?.5:1},y=e.datatypeId?el(e.datatypeId):null,w=(C=t.find(N=>N.id===e.datatypeId))==null?void 0:C.name;function b(N,T){return i("input",{type:"number",value:N??"",onChange:R=>T(R.target.value===""?void 0:Number(R.target.value)),className:"h-8 w-16 rounded-md border border-border-default bg-background-elevated px-2 text-xs text-text-primary"})}const v=i("button",{type:"button","aria-label":c("documentTypeBuilder.dragHandle"),className:"cursor-grab touch-none text-text-secondary",...d,...f,children:i(qi,{"aria-hidden":"true",className:"size-4"})});return r?x("div",{ref:u,style:g,className:"flex flex-col gap-3 rounded-md border border-border-default bg-background-elevated p-3",children:[x("div",{className:"flex items-end gap-2",children:[i("span",{className:"mb-2.5",children:v}),i(Ne,{label:c("documentTypeBuilder.fieldKeyLabel"),htmlFor:`field-key-${e.rowKey}`,required:!0,requiredText:c("common.required"),className:"flex-1",children:i(ye,{id:`field-key-${e.rowKey}`,required:!0,value:e.id,onChange:N=>o({id:N.target.value})})}),i(Ne,{label:c("documentTypeBuilder.fieldNameLabel"),htmlFor:`field-name-${e.rowKey}`,required:!0,requiredText:c("common.required"),className:"flex-1",children:i(ye,{id:`field-name-${e.rowKey}`,required:!0,value:e.name,onChange:N=>o({name:N.target.value})})}),i(Ne,{label:c("documentTypeBuilder.fieldDatatypeLabel"),htmlFor:`field-datatype-${e.rowKey}`,required:!0,requiredText:c("common.required"),className:"flex-1",children:x("select",{id:`field-datatype-${e.rowKey}`,required:!0,value:e.datatypeId,onChange:N=>o({datatypeId:N.target.value}),className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary",children:[i("option",{value:"",disabled:!0,children:c("documentTypeBuilder.fieldDatatypeLabel")}),t.map(N=>i("option",{value:N.id,children:N.name},N.id))]})}),n.length>0&&i(Ne,{label:c("documentTypeBuilder.fieldTabLabel"),htmlFor:`field-tab-${e.rowKey}`,className:"flex-1",children:x("select",{id:`field-tab-${e.rowKey}`,value:e.tabId??"",onChange:N=>o({tabId:N.target.value===""?void 0:N.target.value}),className:"h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 text-sm text-text-primary",children:[i("option",{value:"",children:c("documentTypeBuilder.fieldTabNone")}),n.map(N=>i("option",{value:N.id,children:N.name},N.id))]})}),i(H,{type:"button",variant:"ghost",size:"sm",className:"mb-1",onClick:l,children:c("documentTypeBuilder.removeField")}),i(H,{type:"button",variant:"outline",size:"sm",className:"mb-1",onClick:a,children:c("documentTypeBuilder.doneField")})]}),y&&x("div",{className:"flex flex-col gap-2 border-t border-border-subtle pt-3",children:[i("span",{className:"text-xs font-medium text-text-secondary",children:c("documentTypeBuilder.previewLabel")}),i("div",{className:"ms-6 min-h-9 rounded-md border border-dashed border-border-default bg-background-base px-3 py-2",inert:!0,children:i(v2,{resolved:y})})]}),x("div",{className:"flex flex-col gap-2 border-t border-border-subtle pt-3",children:[i("span",{className:"text-xs font-medium text-text-secondary",children:c("documentTypeBuilder.validationLabel")}),x("div",{className:"flex flex-wrap items-center gap-3 ps-6",children:[x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[i("input",{type:"checkbox",checked:e.validation.required??!1,onChange:N=>s({required:N.target.checked||void 0})}),c("documentTypeBuilder.validation.required")]}),(y==null?void 0:y.editor.id)===m2&&x(Ie,{children:[x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[c("documentTypeBuilder.validation.minLength"),b(e.validation.minLength,N=>s({minLength:N}))]}),x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[c("documentTypeBuilder.validation.maxLength"),b(e.validation.maxLength,N=>s({maxLength:N}))]}),x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[c("documentTypeBuilder.validation.pattern"),i("input",{type:"text",value:e.validation.pattern??"",onChange:N=>s({pattern:N.target.value===""?void 0:N.target.value}),placeholder:c("documentTypeBuilder.validation.patternPlaceholder"),dir:"ltr",className:"h-8 w-40 rounded-md border border-border-default bg-background-elevated px-2 font-mono text-xs text-text-primary"})]})]}),(y==null?void 0:y.editor.id)===g2&&x(Ie,{children:[x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[c("documentTypeBuilder.validation.min"),b(e.validation.min,N=>s({min:N}))]}),x("label",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[c("documentTypeBuilder.validation.max"),b(e.validation.max,N=>s({max:N}))]})]})]})]})]}):x("div",{ref:u,style:g,className:"flex items-center gap-3 rounded-md border border-border-default bg-background-elevated px-3 py-2",children:[v,x("span",{className:"min-w-0 flex-1",children:[i("span",{className:"block truncate text-sm font-medium text-text-primary",children:e.name||c("documentTypeBuilder.unnamedField")}),i("span",{className:"block truncate text-xs text-text-secondary",children:e.id})]}),w&&i(de,{variant:"primary",children:w}),b2(e.validation,c).map(N=>i(de,{variant:"neutral",children:N},N)),i(H,{type:"button",variant:"ghost",size:"sm",onClick:a,children:c("documentTypeBuilder.editField")})]})}function w2({tab:e,onChange:t,onRemove:n}){const{t:r}=oe(),{attributes:a,listeners:o,setNodeRef:s,transform:l,transition:c,isDragging:d}=ll({id:e.id}),f={transform:Cn.Transform.toString(l),transition:c,opacity:d?.5:1};return x("div",{ref:s,style:f,className:"flex items-end gap-2 rounded-md border border-border-default bg-background-elevated p-3",children:[i("button",{type:"button","aria-label":r("documentTypeBuilder.dragHandle"),className:"mb-2.5 cursor-grab touch-none text-text-secondary",...a,...o,children:i(qi,{"aria-hidden":"true",className:"size-4"})}),i(Ne,{label:r("documentTypeBuilder.tabNameLabel"),htmlFor:`tab-name-${e.id}`,required:!0,requiredText:r("common.required"),className:"flex-1",children:i(ye,{id:`tab-name-${e.id}`,required:!0,value:e.name,onChange:u=>t({name:u.target.value})})}),i(H,{type:"button",variant:"ghost",size:"sm",className:"mb-1",onClick:n,children:r("documentTypeBuilder.removeTab")})]})}async function Ka(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit)),e.documentTypeId&&t.set("documentTypeId",e.documentTypeId);const n=t.toString(),r=await X(`/api/templates${n?`?${n}`:""}`);return re(r)}async function C2(e){const t=await X("/api/templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return re(t)}async function N2(e,t){const n=await X(`/api/document-types/${e}/default-template`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:t})});return re(n)}const fd=100;function S2({documentType:e,onDocumentTypeUpdated:t}){const{t:n}=oe(),[r,a]=E([]),[o,s]=E(null),[l,c]=E(""),[d,f]=E(!1),[u,p]=E(null),m=e.kind==="page"?e.defaultTemplateId??null:null,h=K(async()=>{const{items:v,nextCursor:C}=await Ka({documentTypeId:e.id,limit:fd});a(v),s(C)},[e.id]);O(()=>{h().catch(()=>p(n("templatePicker.genericError")))},[h,n]);async function g(v){f(!0),p(null);try{await v()}catch(C){p(C instanceof ve?C.message:n("templatePicker.genericError"))}finally{f(!1)}}async function y(){o&&await g(async()=>{const{items:v,nextCursor:C}=await Ka({documentTypeId:e.id,cursor:o,limit:fd});a(N=>[...N,...v]),s(C)})}async function w(v){if(v.preventDefault(),!l.trim())return;const C=l.trim();await g(async()=>{await C2({name:C,documentTypeId:e.id}),c(""),await h(),J({variant:"success",title:n("templatePicker.addedToast",{name:C})})})}async function b(v){await g(async()=>{var N;const{documentType:C}=await N2(e.id,v);if(t(C),v){const T=((N=r.find(R=>R.id===v))==null?void 0:N.name)??"";J({variant:"success",title:n("templatePicker.defaultSetToast",{name:T})})}else J({title:n("templatePicker.defaultClearedToast")})})}return x("div",{className:"flex max-w-xl flex-col gap-4",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:n("documentTypeEditor.templatesTitle",{name:e.name})}),r.length===0?i("p",{className:"text-sm text-text-secondary",children:n("templatePicker.noTemplates")}):i("ul",{className:"flex flex-col gap-1",children:r.map(v=>{const C=v.id===m;return x("li",{className:"flex items-center justify-between gap-2 rounded-md border border-border-subtle px-3 py-2",children:[x("span",{className:"flex flex-col text-sm text-text-primary",children:[v.name,C&&i("span",{className:"text-xs font-medium text-primary-600",children:n("templatePicker.defaultBadge")})]}),C?i(H,{type:"button",variant:"ghost",size:"sm",disabled:d,onClick:()=>b(null),children:n("templatePicker.clearDefault")}):i(H,{type:"button",variant:"outline",size:"sm",disabled:d,onClick:()=>b(v.id),children:n("templatePicker.setDefault")})]},v.id)})}),o&&i(H,{type:"button",variant:"outline",size:"sm",disabled:d,onClick:y,children:n("templatePicker.loadMore")}),x("form",{onSubmit:w,className:"flex items-end gap-2",children:[i("div",{className:"flex-1",children:i(Ne,{label:n("templatePicker.nameLabel"),htmlFor:"template-pane-name",children:i(ye,{id:"template-pane-name",value:l,onChange:v=>c(v.target.value),required:!0})})}),i(H,{type:"submit",size:"sm",disabled:d||!l.trim(),children:n(d?"templatePicker.adding":"templatePicker.addButton")})]}),i("p",{className:"text-xs text-text-secondary",children:n("documentTypeEditor.templatesInertNote")}),u&&i("p",{role:"alert",className:"text-sm text-danger-600",children:u})]})}function pd(e){return Array.from(e.target.selectedOptions).map(t=>t.value)}const as=e=>se("flex size-8 items-center justify-center rounded-md border",e?"border-primary-600 bg-primary-100 text-primary-800":"border-border-subtle text-text-secondary hover:bg-background-elevated");function E2(e){return{rowKey:crypto.randomUUID(),id:"",name:"",datatypeId:"",validation:{},tabId:e}}function T2(e){const t=Object.values(e.validation).some(n=>n!==void 0);return{id:e.id,name:e.name,datatypeId:e.datatypeId,...t?{validation:e.validation}:{},...e.tabId?{tabId:e.tabId}:{}}}function k2(e){return{rowKey:crypto.randomUUID(),id:e.id,name:e.name,datatypeId:e.datatypeId,validation:e.validation??{},tabId:e.tabId}}function oh({documentType:e,documentTypes:t,onSaved:n,onDeleted:r}){const{t:a}=oe(),o=Tr(),s=yo()??[],l=ir(),c=e===null,[d,f]=E((e==null?void 0:e.name)??"");Re([c?d||a("documentTypeEditor.createTitle"):d,a("nav.settings")]);const[u,p]=E((e==null?void 0:e.icon)??""),m=u!==""&&!(u in Lr),[h,g]=E((e==null?void 0:e.kind)??"page"),[y,w]=E(e?e.fields.map(k2):[]),[b,v]=E(e?e.tabs.map(({id:$,name:te})=>({id:$,name:te})):[]),[C,N]=E((e==null?void 0:e.kind)==="page"?e.treeRules.allowedAtRoot:!1),[T,R]=E((e==null?void 0:e.kind)==="page"?e.treeRules.allowedParentTypes:[]),[L,I]=E((e==null?void 0:e.kind)==="page"?e.treeRules.allowedChildTypes:[]),[P,k]=E(new Set),[S,A]=E(!1),[D,B]=E(!1),[U,z]=E(null),[_,G]=E("design"),[V,ee]=E(!1),[Z,j]=E(!1),le=[{id:"design",label:a("documentTypeEditor.designTab")},...h==="page"&&!c?[{id:"templates",label:a("documentTypeEditor.templatesTab")}]:[],...h==="page"?[{id:"structure",label:a("documentTypeEditor.structureTab")}]:[]],Se=le.some($=>$.id===_)?_:"design",ge=t.filter($=>$.kind==="page"&&$.id!==(e==null?void 0:e.id)),Le=ol(Hn(Xr),Hn(Yr,{coordinateGetter:cl}));function ue(){A(!0)}function F($){k(te=>{const ce=new Set(te);return ce.has($)?ce.delete($):ce.add($),ce})}function q($){const te=E2($);w(ce=>[...ce,te]),k(ce=>new Set(ce).add(te.rowKey)),ue()}function be($){w(te=>te.filter(ce=>ce.rowKey!==$)),ue()}function Pe($,te){w(ce=>ce.map(we=>we.rowKey===$?{...we,...te}:we)),ue()}function He($,te){w(ce=>ce.map(we=>we.rowKey===$?{...we,validation:{...we.validation,...te}}:we)),ue()}function Be($){const{active:te,over:ce}=$;!ce||te.id===ce.id||(w(we=>{const vt=we.findIndex(Je=>Je.rowKey===te.id),lt=we.findIndex(Je=>Je.rowKey===ce.id);return Kn(we,vt,lt)}),ue())}function Ue(){v($=>[...$,{id:crypto.randomUUID(),name:""}]),ue()}function st($){v(te=>te.filter(ce=>ce.id!==$)),w(te=>te.map(ce=>ce.tabId===$?{...ce,tabId:void 0}:ce)),ue()}function hn($,te){v(ce=>ce.map(we=>we.id===$?{...we,...te}:we)),ue()}function kn($){const{active:te,over:ce}=$;!ce||te.id===ce.id||(v(we=>{const vt=we.findIndex(Je=>Je.id===te.id),lt=we.findIndex(Je=>Je.id===ce.id);return Kn(we,vt,lt)}),ue())}async function mn(){B(!0),z(null);try{const $=y.map(T2),te=b.map(({id:vt,name:lt})=>({id:vt,name:lt})),ce={allowedAtRoot:C,allowedParentTypes:T,allowedChildTypes:L};let we;if(c)we=(await jN(h==="page"?{name:d,icon:u,kind:"page",fields:$,treeRules:ce,tabs:te}:{name:d,icon:u,kind:"element",fields:$,tabs:te})).documentType,J({variant:"success",title:a("documentTypeEditor.createdToast",{name:d})});else{const vt={name:d,icon:u,fields:$,tabs:te,...h==="page"?{treeRules:ce}:{}};we=(await VN(e.id,vt)).documentType,J({variant:"success",title:a("documentTypeEditor.savedToast",{name:d})})}A(!1),n(we)}catch($){z($ instanceof ve?$.message:a("documentTypeEditor.genericError"))}finally{B(!1)}}async function it(){if(!c){j(!0);try{await HN(e.id),ee(!1),J({variant:"success",title:a("documentTypeEditor.deletedToast",{name:d})}),r(e.id)}catch($){J({variant:"danger",title:$ instanceof ve?$.message:a("documentTypeEditor.genericError")})}finally{j(!1)}}}const Yt=[...b.map($=>({key:$.id,title:a("documentTypeEditor.tabGroupTitle",{name:$.name||a("documentTypeBuilder.unnamedTab")}),tabId:$.id,rows:y.filter(te=>te.tabId===$.id)})),{key:"general",title:b.length>0?a("documentTypeEditor.generalGroupTitle"):a("documentTypeEditor.fieldsTitle"),tabId:void 0,rows:y.filter($=>$.tabId==null||!b.some(te=>te.id===$.tabId))}];return x("div",{className:"flex h-full min-h-0 flex-col",children:[x("div",{className:"shrink-0 px-8 pb-3 pt-6",children:[x("p",{className:"flex items-center gap-1 text-xs text-text-secondary",children:[i("span",{children:a("nav.settings")}),i(sn,{"aria-hidden":"true",className:"size-3 shrink-0 text-text-disabled rtl:rotate-180"}),i("span",{children:a("settingsTree.documentTypes")})]}),x("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[i("span",{className:"text-text-secondary",children:i(Hr,{"aria-hidden":"true",className:"size-5"})}),i("h1",{"data-workspace-title":!0,tabIndex:-1,ref:l,className:"text-xl font-bold tracking-tight text-text-primary focus:outline-none",children:c?d||a("documentTypeEditor.createTitle"):d}),i(de,{variant:"neutral",children:a(`documentTypeBuilder.kind.${h}`)}),h==="page"&&C&&i(de,{variant:"neutral",children:a("documentTypeEditor.allowedAtRootBadge")})]})]}),i(mo,{tabs:le,activeId:Se,onChange:$=>G($),label:a("documentTypeEditor.panesLabel"),idPrefix:o,className:"shrink-0 px-8"}),x("div",{role:"tabpanel",id:Vr(o,Se),"aria-labelledby":jn(o,Se),className:"min-w-0 flex-1 overflow-y-auto px-8 pb-8 pt-6",children:[Se==="design"&&x("div",{className:"flex max-w-3xl flex-col gap-8",children:[x("div",{className:"flex items-end gap-4",children:[i(Ne,{label:a("documentTypeBuilder.nameLabel"),htmlFor:"dt-name",required:!0,requiredText:a("common.required"),className:"flex-1",children:i(ye,{id:"dt-name",required:!0,value:d,onChange:$=>{f($.target.value),ue()}})}),c&&i(Ne,{label:a("documentTypeBuilder.kindLabel"),className:"flex-1",children:i("div",{role:"group",className:"flex items-center gap-2",children:["page","element"].map($=>i(H,{type:"button",variant:h===$?"default":"outline",size:"sm","aria-pressed":h===$,onClick:()=>{g($),ue()},children:a(`documentTypeBuilder.kind.${$}`)},$))})})]}),x("fieldset",{className:"flex flex-col gap-2",children:[i("legend",{className:"text-sm font-medium text-text-primary",children:a("documentTypeBuilder.iconLabel")}),i("p",{className:"text-xs text-text-secondary",children:a("documentTypeBuilder.iconHelp")}),x("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":a("documentTypeBuilder.iconLabel"),children:[i("button",{type:"button","aria-pressed":u==="",title:a("documentTypeBuilder.iconDefault"),"aria-label":a("documentTypeBuilder.iconDefault"),onClick:()=>{p(""),ue()},className:as(u===""),children:i(_s,{"aria-hidden":!0,className:"size-4"})}),m&&i("button",{type:"button","aria-pressed":!0,title:u,"aria-label":u,className:as(!0),children:i(_s,{"aria-hidden":!0,className:"size-4"})}),WN.map($=>{const te=Lr[$];return i("button",{type:"button","aria-pressed":u===$,title:$,"aria-label":$,onClick:()=>{p($),ue()},className:as(u===$),children:i(te,{"aria-hidden":!0,className:"size-4"})},$)})]})]}),x("section",{className:"flex flex-col gap-2",children:[x("div",{className:"flex items-center justify-between",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:a("documentTypeBuilder.tabsLabel")}),i(H,{type:"button",variant:"outline",size:"sm",onClick:Ue,children:a("documentTypeBuilder.addTab")})]}),b.length===0&&i("p",{className:"text-sm text-text-secondary",children:a("documentTypeBuilder.noTabs")}),i(Ua,{sensors:Le,onDragEnd:kn,children:i(ja,{items:b.map($=>$.id),strategy:za,children:i("div",{className:"flex flex-col gap-2",children:b.map($=>i(w2,{tab:$,onChange:te=>hn($.id,te),onRemove:()=>st($.id)},$.id))})})})]}),i(Ua,{sensors:Le,onDragEnd:Be,children:Yt.map($=>x("section",{className:"flex flex-col gap-2",children:[i("h2",{className:"text-sm font-semibold text-text-primary",children:$.title}),$.rows.length===0&&i("p",{className:"text-sm text-text-secondary",children:a("documentTypeEditor.noFieldsInGroup")}),i(ja,{items:$.rows.map(te=>te.rowKey),strategy:za,children:i("div",{className:"flex flex-col gap-2",children:$.rows.map(te=>i(x2,{field:te,dataTypes:s,tabs:b,expanded:P.has(te.rowKey),onToggleExpanded:()=>F(te.rowKey),onChange:ce=>Pe(te.rowKey,ce),onChangeValidation:ce=>He(te.rowKey,ce),onRemove:()=>be(te.rowKey)},te.rowKey))})}),i(H,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>q($.tabId),children:a("documentTypeBuilder.addField")})]},$.key))})]}),Se==="templates"&&e&&e.kind==="page"&&i(S2,{documentType:e,onDocumentTypeUpdated:n}),Se==="structure"&&h==="page"&&x("div",{className:"flex max-w-xl flex-col gap-4",children:[x("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[i("input",{type:"checkbox",checked:C,onChange:$=>{N($.target.checked),ue()}}),a("documentTypeBuilder.allowedAtRoot")]}),i(Ne,{label:a("documentTypeBuilder.allowedParentTypes"),htmlFor:"dt-parent-types",helpText:a("documentTypeEditor.emptyMeansAny"),children:i("select",{id:"dt-parent-types",multiple:!0,value:T,onChange:$=>{R(pd($)),ue()},className:"w-full rounded-md border border-border-default bg-background-elevated px-3 py-2 text-sm text-text-primary",children:ge.map($=>i("option",{value:$.id,children:$.name},$.id))})}),i(Ne,{label:a("documentTypeBuilder.allowedChildTypes"),htmlFor:"dt-child-types",helpText:a("documentTypeEditor.emptyMeansAny"),children:i("select",{id:"dt-child-types",multiple:!0,value:L,onChange:$=>{I(pd($)),ue()},className:"w-full rounded-md border border-border-default bg-background-elevated px-3 py-2 text-sm text-text-primary",children:ge.map($=>i("option",{value:$.id,children:$.name},$.id))})})]})]}),x("footer",{className:"flex shrink-0 items-center gap-3 border-t border-border-default bg-background-elevated px-8 py-3",children:[!c&&i(H,{type:"button",variant:"ghost",className:"text-danger-600 hover:text-danger-600",onClick:()=>ee(!0),children:a("documentTypeEditor.delete")}),i("span",{className:"text-xs text-text-secondary",children:a(S?"contentEditor.unsavedChanges":"contentEditor.allSaved")}),U&&i("span",{role:"alert",className:"text-xs text-danger-600",children:U}),i("span",{className:"flex-1"}),i(H,{type:"button",disabled:D||!d,onClick:()=>void mn(),children:a(D?"documentTypeEditor.saving":"documentTypeEditor.save")})]}),i(Jn,{open:V,onOpenChange:$=>!$&&ee(!1),children:x(Zn,{children:[x(Qn,{children:[i(tr,{children:a("documentTypeEditor.deleteConfirmTitle",{name:d})}),i(nr,{children:a("documentTypeEditor.deleteConfirmBody")})]}),x(er,{children:[i(ar,{disabled:Z,children:a("documentTypeEditor.deleteCancel")}),i(rr,{disabled:Z,onClick:$=>{$.preventDefault(),it()},children:a(Z?"documentTypeEditor.deleting":"documentTypeEditor.deleteConfirm")})]})]})})]})}async function hd(e={}){const t=new URLSearchParams;e.cursor&&t.set("cursor",e.cursor),e.limit&&t.set("limit",String(e.limit));const n=t.toString(),r=await X(`/api/snapshots${n?`?${n}`:""}`);return re(r)}async function R2(e){const t=await X("/api/snapshots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return re(t)}async function P2(e){const t=await X(`/api/snapshots/${e}/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});return re(t)}const md=20;function D2(){const{t:e}=oe();Re([e("nav.snapshots"),e("nav.settings")]);const[t,n]=E([]),[r,a]=E(null),[o,s]=E(!1),[l,c]=E(""),[d,f]=E(!1),[u,p]=E(null),[m,h]=E(!1),g=K(async()=>{try{const{items:v,nextCursor:C}=await hd({limit:md});n(v),a(C),s(!0)}catch{J({variant:"danger",title:e("snapshots.genericError")})}},[e]);O(()=>{g()},[g]);async function y(){if(r)try{const{items:v,nextCursor:C}=await hd({cursor:r,limit:md});n(N=>[...N,...v]),a(C)}catch{J({variant:"danger",title:e("snapshots.genericError")})}}async function w(v){if(v.preventDefault(),!!l.trim()){f(!0);try{const{snapshot:C}=await R2({label:l.trim()});J({variant:"success",title:e("snapshots.createdToast",{label:C.label})}),c(""),await g()}catch{J({variant:"danger",title:e("snapshots.genericError")})}finally{f(!1)}}}async function b(){if(u){h(!0);try{const{snapshot:v,restoredItems:C}=await P2(u.id);J({variant:"success",title:e("snapshots.restoredToast",{label:v.label,count:C})}),p(null)}catch{J({variant:"danger",title:e("snapshots.genericError")})}finally{h(!1)}}}return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.settings"),e("settingsTree.system")],title:e("nav.snapshots")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-6 overflow-y-auto px-8 pb-8 pt-2",children:[!o&&x("div",{"aria-label":e("contentTree.loading"),className:"flex flex-col gap-2",children:[i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-full"}),i(pe,{className:"h-10 w-2/3"})]}),o&&x(Ie,{children:[x("form",{onSubmit:w,className:"flex max-w-xl items-end gap-2",children:[i("div",{className:"flex-1",children:i(Ne,{label:e("snapshots.labelLabel"),htmlFor:"snapshot-label",helpText:e("snapshots.labelHelp"),children:i(ye,{id:"snapshot-label",required:!0,value:l,onChange:v=>c(v.target.value)})})}),x(H,{type:"submit",disabled:d||!l.trim(),children:[i(nC,{"aria-hidden":"true",className:"size-4"}),e(d?"snapshots.creating":"snapshots.createButton")]})]}),t.length===0?i(ke,{icon:i(wp,{"aria-hidden":"true"}),title:e("snapshots.empty"),description:e("snapshots.emptyDescription")}):i("ol",{className:"ms-2 flex flex-col gap-4 border-s-2 border-border-default ps-6",children:t.map(v=>x("li",{className:"relative",children:[i("span",{"aria-hidden":"true",className:"absolute -start-8 top-1.5 size-3 rounded-full border-2 border-primary-600 bg-background-elevated"}),x("div",{className:"flex flex-wrap items-center gap-3",children:[x("div",{className:"min-w-0 flex-1",children:[i("p",{className:"text-sm font-medium text-text-primary",children:v.label}),x("p",{className:"text-xs text-text-secondary",children:[new Date(v.createdAt).toLocaleString(),v.description?` — ${v.description}`:""]})]}),i(H,{type:"button",variant:"outline",size:"sm",onClick:()=>p(v),children:e("snapshots.restore")})]})]},v.id))}),r&&i(H,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>void y(),children:e("snapshots.loadMore")})]})]}),i(Jn,{open:u!==null,onOpenChange:v=>!v&&p(null),children:x(Zn,{children:[x(Qn,{children:[i(tr,{children:e("snapshots.confirmTitle",{label:(u==null?void 0:u.label)??""})}),i(nr,{children:e("snapshots.confirmBody")})]}),x(er,{children:[i(ar,{disabled:m,children:e("snapshots.cancel")}),i(rr,{disabled:m,onClick:v=>{v.preventDefault(),b()},children:e(m?"snapshots.restoring":"snapshots.confirmRestore")})]})]})})]})}const I2=["primary","background","text"],L2=5;function os(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function A2(e){const t=[];if(!os(e))return t;const n=e.color;if(!os(n))return t;for(const r of I2){const a=n[r];if(os(a))for(const o of Object.values(a)){if(t.length>=L2)return t;typeof o=="string"&&o.length>0&&t.push(o)}}return t}const M2=["light","dark","system"],O2="/plugin-management/marketplace";function gd(e){return se("flex flex-col items-start gap-2 rounded-md border p-3 text-start transition-colors duration-fast",e?"border-primary-600 ring-1 ring-primary-600":"border-border-subtle hover:bg-background-hover")}function _2(){const{t:e}=oe(),t=Wt();Re([e("appearance.navLabel"),e("nav.settings")]);const{mode:n,themeId:r,setMode:a,setActiveTheme:o}=rh(),s=e2(),[l,c]=E([]),[d,f]=E(!1),[u,p]=E(!1);O(()=>{let y=!1;return th().then(w=>{y||p(w===null)}).finally(()=>{y||f(!0)}),Yp().then(w=>{y||c(w)}).catch(()=>{}),()=>{y=!0}},[]);const m=s.find(y=>y.pluginId===r),h=r!==null,g=!d&&s.length===0;return x("div",{className:"flex h-full min-h-0 flex-col",children:[i(At,{crumb:[e("nav.settings"),e("appearance.navLabel")],title:e("appearance.navLabel")}),x("div",{className:"flex min-w-0 flex-1 flex-col gap-6 overflow-y-auto px-8 pb-8 pt-2",children:[i("p",{className:"max-w-prose text-sm text-text-secondary",children:e("appearance.intro")}),x("section",{children:[i("h2",{className:"mb-3 text-sm font-semibold text-text-primary",children:e("appearance.themeSectionTitle")}),g&&x("div",{role:"status","aria-label":e("appearance.loadingLabel"),className:"grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4",children:[i(pe,{className:"h-36 w-full"}),i(pe,{className:"h-36 w-full"}),i(pe,{className:"h-36 w-full"})]}),!g&&x("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4",children:[x("button",{type:"button","data-testid":"theme-card-default",onClick:()=>o(null),className:gd(!h),children:[i("div",{"aria-hidden":"true",className:"h-16 w-full rounded-md bg-gradient-to-br from-primary-600 to-secondary-500"}),x("div",{className:"flex w-full items-center justify-between gap-2",children:[x("span",{className:"text-sm font-medium text-text-primary",children:[e("appearance.defaultName")," ",i("span",{className:"text-xs font-normal text-text-secondary",children:e("appearance.defaultBadge")})]}),!h&&i(de,{variant:"success",children:e("appearance.activeBadge")})]}),i("p",{className:"text-xs text-text-secondary",children:e("appearance.defaultDescription")})]}),s.map(y=>{const w=l.find(C=>C.pluginId===y.pluginId),b=A2(y.tokens),v=r===y.pluginId;return x("button",{type:"button","data-testid":`theme-card-${y.pluginId}`,onClick:()=>o(y.pluginId),className:gd(v),children:[i("div",{"aria-hidden":"true",className:"h-16 w-full rounded-md bg-background-hover",style:b[0]?{backgroundColor:b[0]}:void 0}),x("div",{className:"flex w-full items-center justify-between gap-2",children:[i("span",{className:"truncate text-sm font-medium text-text-primary",children:y.name}),v&&i(de,{variant:"success",children:e("appearance.activeBadge")})]}),i("p",{className:"text-xs text-text-secondary",children:e("appearance.byAuthor",{author:y.author})}),(w==null?void 0:w.trustTier)==="verified"&&x(de,{variant:"success",className:"inline-flex items-center gap-1",children:[i(gN,{"aria-hidden":"true",className:"size-3"}),e("pluginsManage.verified")]}),b.length>0&&i("div",{className:"flex gap-1",children:b.map((C,N)=>i("span",{"data-testid":"theme-swatch","aria-hidden":"true",className:"size-4 rounded-full border border-border-subtle",style:{backgroundColor:C}},N))})]},y.pluginId)}),i("button",{type:"button",onClick:()=>t(O2),className:"flex flex-col items-center justify-center gap-1 rounded-md border border-dashed border-border-strong p-3 text-center text-sm text-text-secondary transition-colors duration-fast hover:bg-background-hover",children:i("span",{className:"font-medium text-text-primary",children:e("appearance.browseMarketplace")})})]}),!g&&d&&u&&i("p",{role:"alert",className:"mt-3 text-xs text-danger-600",children:e("appearance.loadErrorNote")}),!g&&d&&!u&&s.length===0&&i("p",{className:"mt-3 text-xs text-text-secondary",children:e("appearance.noInstalledThemes")})]}),x("section",{className:"max-w-2xl",children:[i("h2",{className:"mb-3 text-sm font-semibold text-text-primary",children:e("appearance.modeSectionTitle")}),x("div",{className:"flex flex-col gap-2",children:[i("div",{role:"group","aria-label":e("appearance.modeGroupLabel"),"aria-disabled":h||void 0,className:"inline-flex rounded-md border border-border-default bg-background-base p-px",children:M2.map(y=>i(H,{type:"button",variant:"ghost",size:"sm",disabled:h,"aria-pressed":n===y,onClick:()=>a(y),className:se("rounded-sm",n===y&&"bg-background-elevated text-text-primary shadow-sm"),children:e(Ws[y])},y))}),i("p",{className:"text-xs text-text-secondary",children:h?e("appearance.modeCaptionCustom",{themeName:(m==null?void 0:m.name)??r}):e("appearance.modeCaptionDefault")})]})]})]})]})}function F2({documentTypes:e,onSaved:t,onDeleted:n}){const{t:r}=oe(),{id:a}=Xn();if(e===null)return i(me,{children:i(ke,{title:r("settingsTree.itemLoading"),titleAs:"h1"})});const o=e.find(s=>s.id===a);return o?i(me,{flush:!0,children:i(oh,{documentType:o,documentTypes:e,onSaved:t,onDeleted:n},a)}):i(me,{children:i(ke,{icon:i(Hr,{"aria-hidden":"true"}),title:r("settingsTree.itemNotFoundTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:r("settingsTree.itemNotFoundDescription")})})}function $2({dataTypes:e,documentTypes:t,onSaved:n}){const{t:r}=oe(),{id:a}=Xn();if(e===null)return i(me,{children:i(ke,{title:r("settingsTree.itemLoading"),titleAs:"h1"})});const o=e.find(s=>s.id===a);return o?i(me,{flush:!0,children:i(ah,{config:o,documentTypes:t,onSaved:n},a)}):i(me,{children:i(ke,{icon:i(Gi,{"aria-hidden":"true"}),title:r("settingsTree.itemNotFoundTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:r("settingsTree.itemNotFoundDescription")})})}function B2(){const{t:e}=oe(),t=Wt(),[n,r]=E(null),[a,o]=E([]),s=yo(),l=_t("/settings/document-types/:id"),c=_t("/settings/data-types/:id"),d=!!_t("/settings/appearance"),f=!!_t("/settings/snapshots"),u=!!_t("/settings/api-keys"),p=!!_t("/settings/api-playground"),m=!!_t("/settings");Re(m?[e("nav.settings")]:[void 0]),O(()=>{Ep({limit:100}).then(({items:y})=>r(y)).catch(()=>r([])),Ka({limit:100}).then(({items:y})=>o(y)).catch(()=>o([]))},[]);function h(y){r(w=>w===null?[y]:w.some(v=>v.id===y.id)?w.map(v=>v.id===y.id?y:v):[...w,y]),t(`/settings/document-types/${y.id}`),Ka({limit:100}).then(({items:w})=>o(w)).catch(()=>{})}function g(y){r(w=>w===null?w:w.filter(b=>b.id!==y)),t("/settings")}return x(Ie,{children:[x(Vn,{label:e("nav.settings"),children:[x(Bt,{title:e("settingsTree.documentTypes"),action:i("button",{type:"button","aria-label":e("documentTypeEditor.newDocumentType"),onClick:()=>t("/settings/document-types/new"),className:"grid size-6 place-items-center rounded-md text-text-secondary transition-colors duration-fast hover:bg-background-hover hover:text-text-primary",children:i(_a,{"aria-hidden":"true",className:"size-4"})}),children:[(n??[]).map(y=>i(dt,{icon:i(Hr,{"aria-hidden":"true"}),label:y.kind==="element"?x("span",{className:"flex items-center gap-2",children:[y.name,i(de,{variant:"neutral",children:e("documentTypeBuilder.kind.element")})]}):y.name,selected:(l==null?void 0:l.params.id)===y.id,onClick:()=>t(`/settings/document-types/${y.id}`)},y.id)),n!==null&&n.length===0&&i("p",{className:"px-2 py-1 text-xs text-text-secondary",children:e("settingsTree.noDocumentTypes")})]}),i(Bt,{title:e("settingsTree.dataTypes"),action:i("button",{type:"button","aria-label":e("dataTypeEditor.newDataType"),onClick:()=>t("/settings/data-types/new"),className:"grid size-6 place-items-center rounded-md text-text-secondary transition-colors duration-fast hover:bg-background-hover hover:text-text-primary",children:i(_a,{"aria-hidden":"true",className:"size-4"})}),children:(s??[]).map(y=>i(dt,{icon:i(Gi,{"aria-hidden":"true"}),label:y.name,selected:(c==null?void 0:c.params.id)===y.id,onClick:()=>t(`/settings/data-types/${y.id}`)},y.id))}),x(Bt,{title:e("settingsTree.templates"),children:[a.map(y=>i(dt,{icon:i(_C,{"aria-hidden":"true"}),label:y.name,selected:!1,onClick:()=>t(`/settings/document-types/${y.documentTypeId}`)},y.id)),a.length===0&&i("p",{className:"px-2 py-1 text-xs text-text-secondary",children:e("settingsTree.noTemplates")})]}),x(Bt,{title:e("settingsTree.system"),children:[i(dt,{icon:i(xp,{"aria-hidden":"true"}),label:e("appearance.navLabel"),selected:d,onClick:()=>t("/settings/appearance")}),i(dt,{icon:i(wp,{"aria-hidden":"true"}),label:e("nav.snapshots"),selected:f,onClick:()=>t("/settings/snapshots")}),i(dt,{icon:i(AC,{"aria-hidden":"true"}),label:e("settingsTree.apiKeys"),selected:u,onClick:()=>t("/settings/api-keys")}),i(dt,{icon:i(CN,{"aria-hidden":"true"}),label:e("settingsTree.apiPlayground"),selected:p,onClick:()=>t("/settings/api-playground")})]})]}),x(ai,{children:[i(Ce,{index:!0,element:i(me,{children:i(ke,{icon:i(vC,{"aria-hidden":"true"}),title:e("settingsTree.welcomeTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:e("settingsTree.welcomeDescription")})})}),i(Ce,{path:"document-types/new",element:i(me,{flush:!0,children:i(oh,{documentType:null,documentTypes:n??[],onSaved:h,onDeleted:g},"create")})}),i(Ce,{path:"document-types/:id",element:i(F2,{documentTypes:n,onSaved:h,onDeleted:g})}),i(Ce,{path:"data-types/new",element:i(me,{flush:!0,children:i(ah,{config:null,documentTypes:n??[],onSaved:y=>t(`/settings/data-types/${y.id}`)},"create")})}),i(Ce,{path:"data-types/:id",element:i($2,{dataTypes:s,documentTypes:n??[],onSaved:y=>t(`/settings/data-types/${y.id}`)})}),i(Ce,{path:"appearance",element:i(me,{flush:!0,children:i(_2,{})})}),i(Ce,{path:"snapshots",element:i(me,{flush:!0,children:i(D2,{})})}),i(Ce,{path:"api-keys",element:i(me,{flush:!0,children:i(i2,{})})}),i(Ce,{path:"api-playground",element:i(me,{flush:!0,children:i(f2,{})})}),i(Ce,{path:"*",element:i(nn,{to:"/settings",replace:!0})})]})]})}function U2(){const{t:e}=oe();return i("a",{href:"#main",onClick:()=>{var t;(t=document.getElementById("main"))==null||t.focus()},className:"sr-only focus:not-sr-only focus:fixed focus:start-4 focus:top-4 focus:z-50 focus:rounded-md focus:bg-background-elevated focus:px-4 focus:py-2 focus:text-text-primary focus:ring-2 focus:ring-primary-600",children:e("a11y.skipToContent")})}function z2({pluginsBooted:e,isAdmin:t}){const{t:n}=oe(),{sectionId:r}=Xn(),a=r?Sd(r):void 0;return Re([a==null?void 0:a.name,n("nav.plugins")]),e?a?a.adminOnly&&!t?i(nn,{to:"/content",replace:!0}):x(Ie,{children:[i(Vn,{label:a.name,children:i(Bt,{title:a.name,children:i(dt,{icon:i(Oa,{"aria-hidden":"true"}),label:a.name,selected:!0,onClick:()=>{}})})}),i(me,{flush:!0,children:i(Fr,{fetch:X,children:i(Kr,{pluginName:a.name,children:i(a.view,{})})})})]}):i(me,{children:i(ke,{icon:i(Oa,{"aria-hidden":"true"}),title:n("pluginSection.notFoundTitle"),titleAs:"h1",titleProps:{tabIndex:-1,"data-workspace-title":!0},description:n("pluginSection.notFoundDescription")})}):i(me,{children:i(ke,{title:n("pluginSection.loading"),titleAs:"h1"})})}function j2(){const{t:e}=oe(),t=Xe(),n=Wt(),{user:r}=Tn(),a=(r==null?void 0:r.role)==="admin",[o,s]=E(!1);KN(),Re(t.pathname==="/media"?[e("nav.media")]:[void 0]),Re(t.pathname==="/users"?[e("nav.users")]:[void 0]),O(()=>{wT().finally(()=>s(!0)),th()},[]);const l=t.pathname.split("/").filter(Boolean),c=(l[0]==="plugins"?l[1]:l[0])??"content",d=K(f=>{const u=nh.some(p=>p.id===f);n(u?`/${f}`:`/plugins/${f}`)},[n]);return x("div",{className:"flex h-screen flex-col bg-background-base font-sans text-text-primary",children:[i(U2,{}),i(a2,{activeId:c,onSelect:d}),i("div",{className:"flex min-h-0 flex-1",children:x(ai,{children:[i(Ce,{path:"/",element:i(nn,{to:"/content",replace:!0})}),i(Ce,{path:"/content",element:i(Hc,{})}),i(Ce,{path:"/content/:nodeId",element:i(Hc,{})}),i(Ce,{path:"/media",element:x(Ie,{children:[i(Vn,{label:e("nav.media"),children:i(Bt,{title:e("nav.media"),children:i(dt,{icon:i(vp,{"aria-hidden":"true"}),label:e("mediaTree.all"),selected:!0,onClick:()=>{}})})}),i(me,{flush:!0,children:i(vT,{})})]})}),i(Ce,{path:"/settings/*",element:a?i(B2,{}):i(nn,{to:"/content",replace:!0})}),i(Ce,{path:"/users",element:a?x(Ie,{children:[i(Vn,{label:e("nav.users"),children:i(Bt,{title:e("nav.users"),children:i(dt,{icon:i(Yi,{"aria-hidden":"true"}),label:e("usersTree.all"),selected:!0,onClick:()=>{}})})}),i(me,{flush:!0,children:i(ZT,{})})]}):i(nn,{to:"/content",replace:!0})}),i(Ce,{path:"/plugins/:sectionId",element:i(z2,{pluginsBooted:o,isAdmin:a})}),i(Ce,{path:"/plugin-management/*",element:a?i(GT,{}):i(nn,{to:"/content",replace:!0})}),i(Ce,{path:"*",element:i(uT,{})})]})}),i(CT,{})]})}const V2=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,H2=8;function sh(e){const t={};return V2.test(e.email)||(t.email="invalid"),e.password.length<H2&&(t.password="tooShort"),e.password!==e.confirmPassword&&(t.confirmPassword="mismatch"),t}function K2(e){return Object.keys(sh(e)).length===0}function ih(e){const t={};if(e.dialect==="sqlite")return e.filePath.trim().length===0&&(t.filePath="required"),t;e.host.trim().length===0&&(t.host="required");const n=Number(e.port);return(!Number.isInteger(n)||n<=0)&&(t.port="invalid"),e.database.trim().length===0&&(t.database="required"),e.username.trim().length===0&&(t.username="required"),t}function W2(e){return Object.keys(ih(e)).length===0}const Un="blank",q2={selected:Un,includeSampleContent:!0};function G2(e,t){if(e.selected===Un)return;const n=t.find(r=>r.pluginId===e.selected);return{pluginId:e.selected,includeSampleContent:e.includeSampleContent&&((n==null?void 0:n.sampleContent)??!1)}}function Y2(e,t){if(e.selected===Un)return{kind:"finish"};const n=t.find(r=>r.pluginId===e.selected);return n?{kind:"install",templateName:n.name}:{kind:"finish"}}function X2(e,t,n,r,a=!1){const o={email:e.email,name:e.name,password:e.password},s=G2(n,r);if(a)return s===void 0?{admin:o}:{admin:o,starter:s};const l=t.dialect==="sqlite"?{dialect:"sqlite",filePath:t.filePath}:{dialect:t.dialect,host:t.host,port:Number(t.port),database:t.database,username:t.username,password:t.password};return s===void 0?{admin:o,database:l}:{admin:o,database:l,starter:s}}async function J2(){const e=await fetch("/api/setup/status");return Ki(e)}async function Z2(e){const t=await fetch("/api/setup/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return Ki(t)}const Q2={email:"",name:"",password:"",confirmPassword:""},ek={dialect:"postgresql",filePath:"file:./velora.db",host:"localhost",port:"5432",database:"",username:"",password:""};function yd(e){return e?"rounded-md border border-primary-600 ring-1 ring-primary-600 bg-background-base":"rounded-md border border-border-default bg-background-base"}const vd="flex w-full flex-col gap-1 rounded-md p-3 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600 focus-visible:ring-offset-2 focus-visible:ring-offset-background-elevated";function tk({bundledTemplates:e=[],databaseConfigured:t=!1}){var S,A;const{t:n}=oe(),[r,a]=E("credentials"),[o,s]=E(Q2),[l,c]=E(!1),[d,f]=E(ek),[u,p]=E(!1),[m,h]=E(q2),[g,y]=E(!1),[w,b]=E(null),[v,C]=E(null);Re([n(r==="complete"?"setup.completeTitle":r==="starter"?"setup.starterTitle":r==="database"?"setup.databaseStepTitle":"setup.title")]);const T=sh(o),R=ih(d);function L(D){D.preventDefault(),c(!0),K2(o)&&a(t?"starter":"database")}function I(D){f(B=>({...B,dialect:D,port:D==="mysql"?"3306":"5432"}))}function P(D){D.preventDefault(),p(!0),W2(d)&&a("starter")}async function k(D){D.preventDefault(),b(null),y(!0);try{const B=await Z2(X2(o,d,m,e,t));C(B),a("complete")}catch(B){b(B instanceof Hi?B.message:n("setup.submitError"))}finally{y(!1)}}if(r==="complete"){const D=((S=v==null?void 0:v.starter)==null?void 0:S.outcome)==="failed"?v.starter:null,B=D?((A=e.find(U=>U.pluginId===D.pluginId))==null?void 0:A.name)??D.pluginId:null;return i("div",{className:"flex min-h-screen items-center justify-center bg-background-base p-8 font-sans text-text-primary",children:x("div",{className:"w-full max-w-sm rounded-lg border border-border-default bg-background-elevated p-8 shadow-lg",children:[i("h1",{className:"mb-1 text-xl font-bold",children:n("setup.completeTitle")}),i("p",{className:"text-sm text-text-secondary",children:n("setup.completeInstructions")}),B&&i("p",{role:"alert",className:"mt-4 text-sm text-warning-700",children:n("setup.starterFailedWarning",{name:B})})]})})}if(r==="starter"){const D=Y2(m,e),B=D.kind==="install"?n("setup.installAndFinish",{name:D.templateName}):n("setup.finish");return i("div",{className:"flex min-h-screen items-center justify-center bg-background-base p-8 font-sans text-text-primary",children:x("div",{className:"w-full max-w-sm rounded-lg border border-border-default bg-background-elevated p-8 shadow-lg",children:[i("p",{className:"mb-1 text-xs text-text-secondary",children:n("setup.starterSteps")}),i("h1",{className:"mb-6 text-xl font-bold",children:n("setup.starterTitle")}),x("form",{className:"flex flex-col gap-4",onSubmit:k,children:[x("div",{className:"flex flex-col gap-3",children:[i("div",{className:yd(m.selected===Un),children:x("button",{type:"button","aria-pressed":m.selected===Un,onClick:()=>h(U=>({...U,selected:Un})),className:vd,children:[i("span",{className:"text-sm font-semibold",children:n("setup.blankName")}),i("span",{className:"text-sm text-text-secondary",children:n("setup.blankDescription")})]})}),e.map(U=>{const z=m.selected===U.pluginId;return x("div",{className:yd(z),children:[x("button",{type:"button","aria-pressed":z,onClick:()=>h(_=>({..._,selected:U.pluginId})),className:vd,children:[x("span",{className:"flex items-center gap-2",children:[i("span",{className:"text-sm font-semibold",children:U.name}),i(de,{variant:"primary",children:n("setup.officialBadge")})]}),U.description&&i("span",{className:"text-sm text-text-secondary",children:U.description})]}),U.sampleContent&&x("label",{className:"flex cursor-pointer items-start gap-2 px-3 pb-3 text-sm text-text-secondary",onClick:_=>_.stopPropagation(),children:[i(Pd,{checked:m.includeSampleContent,onCheckedChange:_=>h(G=>({...G,includeSampleContent:_===!0})),className:"mt-0.5"}),i("span",{children:n("setup.includeSampleContent")})]})]},U.pluginId)})]}),w&&i("p",{role:"alert",className:"text-sm text-danger-600",children:w}),x("div",{className:"flex gap-2",children:[i(H,{type:"button",variant:"outline",onClick:()=>a(t?"credentials":"database"),disabled:g,children:n("setup.back")}),i(H,{type:"submit",disabled:g,children:g?n("setup.finishing"):B})]})]})]})})}return r==="database"?i("div",{className:"flex min-h-screen items-center justify-center bg-background-base p-8 font-sans text-text-primary",children:x("div",{className:"w-full max-w-sm rounded-lg border border-border-default bg-background-elevated p-8 shadow-lg",children:[i("h1",{className:"mb-1 text-xl font-bold",children:n("setup.databaseStepTitle")}),i("p",{className:"mb-6 text-sm text-text-secondary",children:n("setup.databaseStepSubtitle")}),x("form",{className:"flex flex-col gap-4",onSubmit:P,children:[x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-dialect",className:"text-sm font-medium",children:n("setup.dialectLabel")}),x("select",{id:"setup-dialect",name:"dialect",className:"rounded-md border border-border-default bg-background-base p-2 text-sm",value:d.dialect,onChange:D=>I(D.target.value),children:[i("option",{value:"postgresql",children:"PostgreSQL"}),i("option",{value:"mysql",children:"MySQL"}),i("option",{value:"sqlite",children:"SQLite"})]})]}),d.dialect==="sqlite"?x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-file-path",className:"text-sm font-medium",children:n("setup.filePathLabel")}),i(ye,{id:"setup-file-path",name:"filePath",type:"text",value:d.filePath,onChange:D=>f({...d,filePath:D.target.value})}),u&&R.filePath&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.filePathRequired")})]}):x(Ie,{children:[x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-host",className:"text-sm font-medium",children:n("setup.hostLabel")}),i(ye,{id:"setup-host",name:"host",type:"text",value:d.host,onChange:D=>f({...d,host:D.target.value})}),u&&R.host&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.hostRequired")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-port",className:"text-sm font-medium",children:n("setup.portLabel")}),i(ye,{id:"setup-port",name:"port",type:"text",inputMode:"numeric",value:d.port,onChange:D=>f({...d,port:D.target.value})}),u&&R.port&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.portInvalid")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-database-name",className:"text-sm font-medium",children:n("setup.databaseNameLabel")}),i(ye,{id:"setup-database-name",name:"database",type:"text",value:d.database,onChange:D=>f({...d,database:D.target.value})}),u&&R.database&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.databaseNameRequired")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-username",className:"text-sm font-medium",children:n("setup.usernameLabel")}),i(ye,{id:"setup-username",name:"username",type:"text",value:d.username,onChange:D=>f({...d,username:D.target.value})}),u&&R.username&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.usernameRequired")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-database-password",className:"text-sm font-medium",children:n("setup.databasePasswordLabel")}),i(ye,{id:"setup-database-password",name:"databasePassword",type:"password",value:d.password,onChange:D=>f({...d,password:D.target.value})})]})]}),x("div",{className:"flex gap-2",children:[i(H,{type:"button",variant:"outline",onClick:()=>a("credentials"),children:n("setup.back")}),i(H,{type:"submit",children:n("setup.continue")})]})]})]})}):i("div",{className:"flex min-h-screen items-center justify-center bg-background-base p-8 font-sans text-text-primary",children:x("div",{className:"w-full max-w-sm rounded-lg border border-border-default bg-background-elevated p-8 shadow-lg",children:[i("h1",{className:"mb-1 text-xl font-bold",children:n("setup.title")}),i("p",{className:"mb-6 text-sm text-text-secondary",children:n("setup.subtitle")}),x("form",{className:"flex flex-col gap-4",onSubmit:L,children:[x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-email",className:"text-sm font-medium",children:n("setup.emailLabel")}),i(ye,{id:"setup-email",name:"email",type:"email",autoComplete:"email",required:!0,value:o.email,onChange:D=>s({...o,email:D.target.value})}),l&&T.email&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.invalidEmail")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-name",className:"text-sm font-medium",children:n("setup.nameLabel")}),i(ye,{id:"setup-name",name:"name",type:"text",autoComplete:"name",value:o.name,onChange:D=>s({...o,name:D.target.value})})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-password",className:"text-sm font-medium",children:n("setup.passwordLabel")}),i(ye,{id:"setup-password",name:"password",type:"password",autoComplete:"new-password",required:!0,value:o.password,onChange:D=>s({...o,password:D.target.value})}),l&&T.password&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.passwordTooShort")})]}),x("div",{className:"flex flex-col gap-2",children:[i("label",{htmlFor:"setup-confirm-password",className:"text-sm font-medium",children:n("setup.confirmPasswordLabel")}),i(ye,{id:"setup-confirm-password",name:"confirmPassword",type:"password",autoComplete:"new-password",required:!0,value:o.confirmPassword,onChange:D=>s({...o,confirmPassword:D.target.value})}),l&&T.confirmPassword&&i("p",{role:"alert",className:"text-sm text-danger-600",children:n("setup.errors.passwordMismatch")})]}),i(H,{type:"submit",children:n("setup.continue")})]})]})})}function nk(){const[e,t]=E({status:"checking",bundledTemplates:[],databaseConfigured:!1});return O(()=>{J2().then(n=>t({status:n.setupRequired?"required":"not-required",bundledTemplates:n.bundledTemplates??[],databaseConfigured:n.databaseConfigured??!1})).catch(()=>t({status:"not-required",bundledTemplates:[],databaseConfigured:!1}))},[]),e}function rk(){const{status:e}=Tn(),{status:t,bundledTemplates:n,databaseConfigured:r}=nk();return e==="restoring"||t==="checking"?null:t==="required"?i(tk,{bundledTemplates:n,databaseConfigured:r}):e==="authenticated"?i(j2,{}):i(M1,{})}function ak(){const{t:e}=oe();return i(My,{basename:"/velora/".replace(/\/$/,""),children:x(A1,{children:[i(rk,{}),i(C1,{closeLabel:e("toast.dismiss"),label:e("toast.notification")})]})})}tg();await ig();gh(document.getElementById("root")).render(i(mh,{children:i(ak,{})}));