@valbuild/ui 0.84.2 → 0.84.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/valbuild-ui.cjs.js +1 -1
- package/dist/valbuild-ui.esm.js +1 -1
- package/package.json +3 -3
- package/server/.tmp/assets/{index-zxen_c3n.js → index-ClmF8Ug0.js} +1 -1
- package/server/.tmp/index.html +1 -1
- package/server/dist/valbuild-ui-server.cjs.js +2 -2
- package/server/dist/valbuild-ui-server.esm.js +2 -2
package/dist/valbuild-ui.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _="/spa/index.css",A="/app",V="val-app",P="val-overlay",s=!1,t="0.84.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _="/spa/index.css",A="/app",V="val-app",P="val-overlay",s=!1,t="0.84.3";exports.IS_DEV=s;exports.VAL_APP_ID=V;exports.VAL_APP_PATH=A;exports.VAL_CSS_PATH=_;exports.VAL_OVERLAY_ID=P;exports.VERSION=t;
|
package/dist/valbuild-ui.esm.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/ui",
|
|
3
|
-
"version": "0.84.
|
|
3
|
+
"version": "0.84.3",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"typecheck": "tsc --noEmit",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@types/express": "^4.17.17",
|
|
61
61
|
"@types/react": "^18.2.38",
|
|
62
62
|
"@types/react-resizable": "^3.0.5",
|
|
63
|
-
"@valbuild/core": "~0.84.
|
|
64
|
-
"@valbuild/shared": "~0.84.
|
|
63
|
+
"@valbuild/core": "~0.84.3",
|
|
64
|
+
"@valbuild/shared": "~0.84.3",
|
|
65
65
|
"autoprefixer": "^10.4.13",
|
|
66
66
|
"class-variance-authority": "^0.7.0",
|
|
67
67
|
"classnames": "^2.3.2",
|
|
@@ -457,7 +457,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
457
457
|
`)},FN=function(){var e=parseInt(document.body.getAttribute(Jc)||"0",10);return isFinite(e)?e:0},wG=function(){g.useEffect(function(){return document.body.setAttribute(Jc,(FN()+1).toString()),function(){var e=FN()-1;e<=0?document.body.removeAttribute(Jc):document.body.setAttribute(Jc,e.toString())}},[])},SG=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;wG();var i=g.useMemo(function(){return yG(o)},[o]);return g.createElement(xG,{styles:bG(i,!t,o,n?"":"!important")})},Gb=!1;if(typeof window<"u")try{var nm=Object.defineProperty({},"passive",{get:function(){return Gb=!0,!0}});window.addEventListener("test",nm,nm),window.removeEventListener("test",nm,nm)}catch{Gb=!1}var fc=Gb?{passive:!1}:!1,kG=function(e){return e.tagName==="TEXTAREA"},T2=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!kG(e)&&n[t]==="visible")},EG=function(e){return T2(e,"overflowY")},CG=function(e){return T2(e,"overflowX")},zN=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=O2(e,r);if(o){var i=M2(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},NG=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},PG=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},O2=function(e,t){return e==="v"?EG(t):CG(t)},M2=function(e,t){return e==="v"?NG(t):PG(t)},_G=function(e,t){return e==="h"&&t==="rtl"?-1:1},jG=function(e,t,n,r,o){var i=_G(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),c=!1,u=s>0,f=0,h=0;do{var p=M2(e,a),m=p[0],v=p[1],x=p[2],b=v-x-i*m;(m||b)&&O2(e,a)&&(f+=b,h+=m),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(Math.abs(f)<1||!o)||!u&&(Math.abs(h)<1||!o))&&(c=!0),c},rm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$N=function(e){return[e.deltaX,e.deltaY]},BN=function(e){return e&&"current"in e?e.current:e},TG=function(e,t){return e[0]===t[0]&&e[1]===t[1]},OG=function(e){return`
|
|
458
458
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
459
459
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
460
|
-
`)},MG=0,hc=[];function RG(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(MG++)[0],i=g.useState(j2)[0],s=g.useRef(e);g.useEffect(function(){s.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=eG([e.lockRef.current],(e.shards||[]).map(BN),!0).filter(Boolean);return v.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,x){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var b=rm(v),w=n.current,S="deltaX"in v?v.deltaX:w[0]-b[0],C="deltaY"in v?v.deltaY:w[1]-b[1],N,P=v.target,_=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in v&&_==="h"&&P.type==="range")return!1;var O=zN(_,P);if(!O)return!0;if(O?N=_:(N=_==="v"?"h":"v",O=zN(_,P)),!O)return!1;if(!r.current&&"changedTouches"in v&&(S||C)&&(r.current=N),!N)return!0;var M=r.current||N;return jG(M,x,v,M==="h"?S:C,!0)},[]),l=g.useCallback(function(v){var x=v;if(!(!hc.length||hc[hc.length-1]!==i)){var b="deltaY"in x?$N(x):rm(x),w=t.current.filter(function(N){return N.name===x.type&&(N.target===x.target||x.target===N.shadowParent)&&TG(N.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var S=(s.current.shards||[]).map(BN).filter(Boolean).filter(function(N){return N.contains(x.target)}),C=S.length>0?a(x,S[0]):!s.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),c=g.useCallback(function(v,x,b,w){var S={name:v,delta:x,target:b,should:w,shadowParent:AG(b)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),u=g.useCallback(function(v){n.current=rm(v),r.current=void 0},[]),f=g.useCallback(function(v){c(v.type,$N(v),v.target,a(v,e.lockRef.current))},[]),h=g.useCallback(function(v){c(v.type,rm(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return hc.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,fc),document.addEventListener("touchmove",l,fc),document.addEventListener("touchstart",u,fc),function(){hc=hc.filter(function(v){return v!==i}),document.removeEventListener("wheel",l,fc),document.removeEventListener("touchmove",l,fc),document.removeEventListener("touchstart",u,fc)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(i,{styles:OG(o)}):null,p?g.createElement(SG,{gapMode:e.gapMode}):null)}function AG(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const IG=cG(_2,RG);var cp=g.forwardRef(function(e,t){return g.createElement(hy,hi({},e,{ref:t,sideCar:IG}))});cp.classNames=hy.classNames;var YS="Popover",[R2,gge]=So(YS,[ji]),up=ji(),[DG,Va]=R2(YS),A2=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=up(t),l=g.useRef(null),[c,u]=g.useState(!1),[f=!1,h]=Kr({prop:r,defaultProp:o,onChange:i});return d.jsx(tp,{...a,children:d.jsx(DG,{scope:t,contentId:Vr(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:s,children:n})})};A2.displayName=YS;var I2="PopoverAnchor",LG=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Va(I2,n),i=up(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=o;return g.useEffect(()=>(s(),()=>a()),[s,a]),d.jsx(Wu,{...i,...r,ref:t})});LG.displayName=I2;var D2="PopoverTrigger",zg=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Va(D2,n),i=up(n),s=Be(t,o.triggerRef),a=d.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":B2(o.open),...r,ref:s,onClick:ne(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:d.jsx(Wu,{asChild:!0,...i,children:a})});zg.displayName=D2;var JS="PopoverPortal",[FG,zG]=R2(JS,{forceMount:void 0}),L2=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=Va(JS,t);return d.jsx(FG,{scope:t,forceMount:n,children:d.jsx(ln,{present:n||i.open,children:d.jsx(Hu,{asChild:!0,container:o,children:r})})})};L2.displayName=JS;var Nu="PopoverContent",F2=g.forwardRef((e,t)=>{const n=zG(Nu,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=Va(Nu,e.__scopePopover);return d.jsx(ln,{present:r||i.open,children:i.modal?d.jsx($G,{...o,ref:t}):d.jsx(BG,{...o,ref:t})})});F2.displayName=Nu;var $G=g.forwardRef((e,t)=>{const n=Va(Nu,e.__scopePopover),r=g.useRef(null),o=Be(t,r),i=g.useRef(!1);return g.useEffect(()=>{const s=r.current;if(s)return fy(s)},[]),d.jsx(cp,{as:ls,allowPinchZoom:!0,children:d.jsx(z2,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ne(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),BG=g.forwardRef((e,t)=>{const n=Va(Nu,e.__scopePopover),r=g.useRef(!1),o=g.useRef(!1);return d.jsx(z2,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),z2=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,h=Va(Nu,n),p=up(n);return dy(),d.jsx(lp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:d.jsx(Xl,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:d.jsx(np,{"data-state":B2(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),$2="PopoverClose",Al=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Va($2,n);return d.jsx(Oe.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>o.onOpenChange(!1))})});Al.displayName=$2;var VG="PopoverArrow",UG=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=up(n);return d.jsx(rp,{...o,...r,ref:t})});UG.displayName=VG;function B2(e){return e?"open":"closed"}var WG=A2,HG=zg,KG=L2,V2=F2;const br=WG,xo=HG,tr=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>d.jsx(KG,{container:r.container,children:d.jsx(V2,{ref:o,align:t,sideOffset:n,className:fe("z-50 w-72 rounded-md border bg-bg-secondary p-4 text-fg-secondary shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));tr.displayName=V2.displayName;function VN({profile:e,size:t="md"}){var c,u,f;const[n,r]=g.useState(((c=e==null?void 0:e.avatar)==null?void 0:c.url)||null);g.useEffect(()=>{var h,p;(h=e==null?void 0:e.avatar)!=null&&h.url?r((p=e==null?void 0:e.avatar)==null?void 0:p.url):r(null)},[(u=e==null?void 0:e.avatar)==null?void 0:u.url]);const[o,...i]=((f=e.fullName)==null?void 0:f.split(" "))||[""],s=i[i.length-1]||"",a=`${o[0].toUpperCase()}${s[0].toUpperCase()}`,l=Ce("rounded-full text-center inline-block bg-bg-brand-primary text-fg-brand-primary",{"h-8 w-8 leading-8 text-xs":t==="sm","h-10 w-10 leading-10 text-base":t==="md","h-12 w-12 leading-[3rem] text-lg":t==="lg"});return n?d.jsx("img",{src:n,alt:a,className:l,onError:()=>{r(null)}}):d.jsx("span",{className:l,children:a})}function GG(e,t,n,r){if(t[n]===void 0)return console.error(`Get keysOf source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const s=n,a=[],l=(c,u,f)=>{var h;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===s&&(r?typeof f=="string"&&f===r&&(a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c)):a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c));else if(u.type==="object"||u.type==="record"){if(WN(f)||U2(f))for(const p in f){const m=f==null?void 0:f[p],v=u.type==="object"?(h=u.items)==null?void 0:h[p]:u.item;m&&l(UN(c,p),v,m)}}else if(u.type==="array"){if(qG(f)){let p=0;for(const m of f)l(UN(c,p),u.item,m),p++}}else if(u.type==="union"){const p=u.key;if(typeof p=="string"&&WN(f)){const m=f[p];if(typeof m=="string"){const v=u.items.filter(x=>x.type==="object").find(x=>{const b=x.items[p];if((b==null?void 0:b.type)==="literal")return b.value===m});v&&l(c,v,f)}}}else u.type==="string"||u.type==="number"||u.type==="boolean"||u.type==="literal"||u.type==="date"||u.type==="image"||u.type==="file"||u.type==="richtext"||console.error("Could not get keyOf references. Unhandled schema type",u)};for(const c in e){const u=c;l(c,e[u],t[u])}return a}function UN(e,t){return e.includes(ba)?`${e}.${JSON.stringify(t)}`:`${e}${ba}${JSON.stringify(t)}`}function WN(e){return U2(e)}function U2(e){return typeof e=="object"&&!!e&&!Qs(e)}function qG(e){return typeof e=="object"&&!!e&&Qs(e)}function W2(e,t){const n=Ba(),r=ly(),o=FS();return g.useMemo(()=>e!==void 0&&"data"in n&&n.data!==void 0&&n.data[e]!==void 0?GG(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}const HN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,KN=DR,YG=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return KN(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],f=i==null?void 0:i[c];if(u===null)return null;const h=HN(u)||HN(f);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...p}=u;return Object.entries(p).every(m=>{let[v,x]=m;return Array.isArray(x)?x.includes({...i,...a}[v]):{...i,...a}[v]===x})?[...c,f,h]:c},[]);return KN(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},qb=YG("inline-flex items-center justify-center whitespace-nowrap rounded-md text-fg-primary text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:text-fg-disabled disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:fe("cursor-pointer","border border-border-brand-primary","bg-bg-brand-primary text-fg-brand-primary","hover:bg-bg-brand-primary-hover hover:text-fg-brand-primary-hover","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),destructive:fe("cursor-pointer","border border-bg-error-primary","bg-bg-error-primary text-fg-error-primary hover:bg-bg-error-primary-hover disabled:text-fg-error-primary"),outline:fe("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),secondary:fe("cursor-pointer","border border-border-secondary","bg-bg-secondary text-fg-secondary hover:bg-bg-secondary-hover"),ghost:fe("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary","hover:bg-bg-secondary-hover hover:text-fg-secondary"),link:fe("cursor-pointer","border border-transparent","text-fg-primary underline-offset-4 hover:underline")},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),qe=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?ls:"button";return d.jsx(s,{className:fe(qb({variant:t,size:n,className:e})),ref:i,...o})});qe.displayName="Button";function JG({path:e,disabled:t}){const[n,r]=Y.splitModuleFilePathAndModulePath(e),o=Y.splitModuleFilePath(n),i=Y.splitModulePath(r),{navigate:s}=xn();return d.jsxs("div",{className:"w-full",children:[d.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>d.jsxs(g.Fragment,{children:[l===0&&d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Ce({"text-muted":!(i.length===0&&l===o.length-1)}),children:Eu(a)}),l>0&&l<o.length-1&&d.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),d.jsx("button",{type:"button",disabled:t,title:Y.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(Y.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>d.jsxs(g.Fragment,{children:[d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Ce({"text-muted":l===i.length-2}),children:Eu(a)})]},`${a}-${l}`))})]})}function H2({path:e,parentPath:t,variant:n,refs:r,children:o,size:i,onComplete:s,confirmationMessage:a,className:l}){const c=In();return d.jsxs(br,{children:[d.jsx(xo,{asChild:!0,children:d.jsx(qe,{size:i,variant:n,className:l,children:o})}),d.jsxs(tr,{container:c,className:"flex flex-col gap-2 p-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:a}),d.jsx(Al,{asChild:!0,children:d.jsx(XG,{path:e,parentPath:t,refs:r,variant:"destructive",onComplete:s,children:d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(US,{size:12}),d.jsx("span",{children:"Delete"})]})})})]})]})}function XG({path:e,parentPath:t,variant:n,refs:r,children:o,size:i,onComplete:s}){const{navigate:a}=xn(),{addPatch:l,patchPath:c}=bn(e),u=lt(t,"record");return!("data"in u)||u.data===void 0||u.data===null?(console.error("Parent source not found",u,{path:e}),null):d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{size:i,variant:n,disabled:r.length>0,onClick:()=>{l([{op:"remove",path:c}],"record"),a(t),s&&s()},children:o})}),d.jsx(fr,{side:"top",children:r.length>0?d.jsxs("div",{children:[d.jsx("p",{children:"Cannot delete record."}),d.jsxs("p",{children:["You must change the following references"," ",d.jsx(l2,{size:10,className:"inline"})," to be able to delete:"]}),d.jsx("ul",{children:r.map(f=>d.jsx("li",{children:d.jsx(JG,{path:f})},f))})]}):d.jsx("p",{children:"Delete record"})})]})}function Il(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,Il(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?Il(e.items[0]):e.key.value;if(e.type==="date")return ps(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}const Zu=g.forwardRef(({className:e,type:t,...n},r)=>d.jsx("input",{type:t,className:fe("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Zu.displayName="Input";function ZG(e,t){const n={},r=t==null?void 0:t.split("/");(r==null?void 0:r[0])===""&&r.shift();const o=(r==null?void 0:r.filter(s=>s!==""))||[];let i=0;for(let s=0;s<e.length;s++){const a=e[s];if(a.type==="literal"){const l=o[i];if(!l)return{status:"error",message:`Missing required literal part: ${a.name}`};if(a.name!==l)return{status:"error",message:`Invalid path part: expected "${a.name}", got "${l}"`};i++}else if(a.type==="string-param"){const l=o[i];if(!l){if(a.optional)continue;return{status:"error",message:`Missing required parameter: ${a.paramName}`}}n[a.paramName]=l,i++}else if(a.type==="array-param"){const l=o.slice(i);if(l.length===0){if(a.optional)continue;return{status:"error",message:`Missing required catch-all parameter: ${a.paramName}`}}n[a.paramName]=l,i+=l.length}}return i<o.length?{status:"error",message:`Extra path parts found: ${o.slice(i).join("/")}`}:{status:"success",params:n}}function K2({routePattern:e,existingKeys:t,onSubmit:n,submitText:r,defaultParams:o,onCancel:i,defaultValue:s}){const[a,l]=g.useState({});g.useEffect(()=>{o&&l(o)},[o]);const[c,u]=g.useState({});g.useEffect(()=>{if(s){const m=ZG(e,s);m.status==="success"&&l(m.params)}},[s,e]);const f=g.useMemo(()=>"/"+e.map(m=>{if(m.type==="string-param"||m.type==="array-param"){const v=a[m.paramName];return Array.isArray(v)?v.join("/"):v}return m.name}).join("/"),[e,a]),p=!g.useMemo(()=>e.every(m=>m.type==="string-param"||m.type==="array-param"?!!a[m.paramName]&&!c[m.paramName]:!0),[e,a,c])||f in t;return d.jsxs("form",{className:"p-4 space-y-3",onSubmit:m=>{m.preventDefault(),n(f)},children:[d.jsx("div",{className:"flex items-center",children:e.map((m,v)=>d.jsx("span",{className:"truncate",children:m.type==="string-param"||m.type==="array-param"?d.jsxs("span",{className:"flex items-center",children:[d.jsx("span",{children:"/"}),d.jsxs("span",{className:"flex flex-col",children:[d.jsx("input",{className:fe("p-1 bg-transparent border-0 max-w-[10ch]",{"border-border-secondary border-1":c[m.paramName]}),placeholder:m.paramName,value:QG(a,m.paramName),onChange:x=>{l({...a,[m.paramName]:x.target.value});const b=m.type==="string-param"?x.target.value:x.target.value.replace(/\//g,"");encodeURIComponent(b)!==b?u({...c,[m.paramName]:"Invalid characters"}):u({...c,[m.paramName]:void 0})}}),c[m.paramName]&&d.jsx("span",{className:"text-xs text-fg-error-secondary",children:c[m.paramName]})]})]}):d.jsxs("span",{className:"text-fg-secondary",children:["/",m.name]})},v))}),d.jsxs("div",{className:"flex gap-4",children:[d.jsx(qe,{disabled:p,children:r}),d.jsx(qe,{variant:"ghost",type:"reset",onClick:i,children:"Cancel"})]})]})}function QG(e,t){const n=e[t];return Array.isArray(n)?n.join("/"):n||""}function G2({path:e,size:t,variant:n,children:r,open:o,setOpen:i,defaultOpen:s,routePattern:a}){const l=lt(e,"record"),c=Ft(e),u=In(),{addPatch:f}=bn(e),{navigate:h}=xn(),[p,m]=g.useState(s??!1);g.useEffect(()=>{o!==void 0&&m(o)},[o]),g.useEffect(()=>{i!==void 0&&i(p)},[p,i]),g.useEffect(()=>{s!==void 0&&m(s)},[s]);const v=g.useCallback(S=>{const C="data"in c?c.data:null;if(C===null||C.type!=="record")return;const N=Y.createPatchPath(w).concat(S);f([{op:"add",path:N,value:Il(C.item)}],"record"),h(Y.joinModuleFilePathAndModulePath(b,Y.patchPathToModulePath(N))),m(!1)},[f,h,c,e]);if(!("data"in l)||l.data===void 0||l.data===null)return console.error("Source not found",l,{path:e}),null;if(!("data"in c)||c.data===void 0)return console.error("Schema not found",l,{path:e}),null;if(c.data.type!=="record")return console.error("Schema is not a record",c,{path:e}),null;const[b,w]=Y.splitModuleFilePathAndModulePath(e);return d.jsxs(br,{open:p,onOpenChange:m,children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(xo,{onClick:()=>{m(!0)},asChild:!0,children:d.jsx(qe,{size:t,variant:n,children:r})})}),d.jsx(fr,{children:d.jsx("p",{children:"Add"})})]}),d.jsx(tr,{container:u,children:a?d.jsx(K2,{routePattern:a,existingKeys:Object.keys(l.data),onSubmit:v,onCancel:()=>{m(!1)},submitText:"Create"}):d.jsx(eq,{existingKeys:Object.keys(l.data),onSubmit:v})})]})}function eq({existingKeys:e,onSubmit:t}){const[n,r]=g.useState(""),o=n===""||n in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:i=>{i.preventDefault(),t(n)},children:[d.jsx(Zu,{autoFocus:!0,value:n,onChange:i=>{r(i.target.value)}}),d.jsx("div",{children:d.jsx(qe,{type:"submit",disabled:o,variant:"outline",children:"Add"})})]})}function tq({existingKeys:e,defaultValue:t,onCancel:n,onSubmit:r}){const[o,i]=g.useState(t),s=o===t||o===""||o in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:a=>{a.preventDefault(),r(o)},children:[d.jsx(Zu,{type:"text",value:o,onChange:a=>{i(a.target.value)}}),d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(qe,{disabled:s,variant:"outline",type:"submit",children:"Update"}),d.jsx(qe,{variant:"ghost",type:"reset",onClick:()=>{n(),i(t)},children:"Cancel"})]})]})}function q2({defaultValue:e,path:t,parentPath:n,variant:r,existingKeys:o,routePattern:i,size:s,children:a,onComplete:l}){const{navigate:c}=xn(),[u,f]=g.useState(!1),h=In();g.useEffect(()=>{const S=C=>{C.key==="Escape"&&f(!1)};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}},[]);const{addPatch:p,addModuleFilePatch:m}=bn(t),[v,x]=Y.splitModuleFilePathAndModulePath(n),b=Y.createPatchPath(x),w=g.useCallback(S=>{const C=[{op:"move",from:b.concat(e),path:b.concat(S)}];p(C,"record");for(const P of o){const[_,O]=Y.splitModuleFilePathAndModulePath(P),M=Y.createPatchPath(O);m(_,[{op:"replace",path:M,value:S}],"record")}const N=Y.joinModuleFilePathAndModulePath(v,Y.patchPathToModulePath(b.concat(S)));c(N,{replace:!0}),l&&l()},[p,m,v,b,c,l]);return d.jsxs(br,{open:u,children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{asChild:!0,size:s,variant:r,children:d.jsx(xo,{onClick:()=>{f(!0)},children:a})})}),d.jsx(fr,{side:"top",children:"Rename record"})]}),d.jsx(tr,{container:h,className:"text-fg-primary",children:i?d.jsx(K2,{routePattern:i,existingKeys:o,defaultValue:e,onSubmit:S=>{w(S),f(!1)},onCancel:()=>{f(!1)},submitText:"Update"}):d.jsx(tq,{parentPath:n,defaultValue:e,existingKeys:o,onSubmit:S=>{w(S),f(!1)},onCancel:()=>{f(!1)}})})]})}function nq({moduleFilePaths:e}){const t=JR(e,"record"),n=XR(),r=g.useMemo(()=>{const o=[];if(n.status!=="success")return n;if(n.data===null)return{status:"error",error:"No src folder found"};if(t.status!=="success")return t.status==="not-found"?{status:"error",error:"No data found"}:t.status==="error"?{status:"error",error:`Failed to load ${Object.keys(t.errors).length} modules: ${Object.entries(t.errors).map(([a,l])=>`"${a}": ${l.message}`).join(", ")}`}:t;for(const s of t.data||[])for(const a in s){const[l]=Y.splitModuleFilePathAndModulePath(s[a]);o.push({urlPath:a,moduleFilePath:l})}const i=R8(n.data,o);return{status:t.status,data:i}},[t,n]);return r.status==="loading"||r.status==="not-asked"?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(Gr,{size:16,className:"animate-spin"})}):r.status==="error"?(console.error("Sitemap errors",r.error),null):d.jsx(Y2,{node:r.data})}function Y2({node:e}){var m;const t=In(),{currentSourcePath:n}=xn(),[r,o]=g.useState(!0),{navigate:i}=xn(),[s,a]=g.useState(!1),[l,c]=g.useState(!1),u=g.useMemo(()=>{var v;return!!((v=e.sourcePath)!=null&&v.startsWith(n))},[n,e.sourcePath]),f=g.useMemo(()=>{if(!e.pattern)return;const v=DM(e.pattern);if(v.some(x=>x.type==="string-param"||x.type==="array-param"))return v},[e.pattern]),h=g.useCallback(()=>{var v;e.sourcePath?i(e.sourcePath):e.type==="node"&&((v=e.children)==null?void 0:v.length)>0&&o(x=>!x)},[i,e]),p=e.moduleFilePath;return d.jsxs("div",{children:[d.jsxs("div",{className:"relative flex items-center justify-between w-full h-10 group",children:[d.jsxs("div",{className:"flex items-center my-1",children:[d.jsx("button",{onClick:()=>o(!r),className:fe("hidden h-4 w-4 mr-2",{block:((m=e.children)==null?void 0:m.length)>0}),children:d.jsx(Xu,{size:16,className:fe("transform",{"rotate-90":r})})}),d.jsx("span",{children:e.sourcePath?d.jsxs("button",{onClick:h,className:fe("flex items-center gap-1",{}),children:[e.name==="/"?d.jsx(Z7,{size:14}):e.type==="leaf"||e.type==="node"&&e.page?d.jsx(r2,{size:14}):null,d.jsxs("span",{children:[e.name==="/"&&d.jsx("span",{className:"ml-2 text-fg-primary-alt",children:"Main page"}),e.name!=="/"&&d.jsx("span",{className:fe({underline:u}),children:e.name})]})]}):d.jsxs("button",{onClick:h,className:fe("flex items-center gap-1",{}),children:[d.jsx(oK,{size:14}),d.jsx("span",{children:d.jsx("span",{children:e.name})})]})})]}),d.jsxs("div",{className:fe("absolute right-0 top-0 items-center group-hover:flex h-10 bg-bg-primary",{hidden:!s&&!l,flex:s||l}),children:[e.sourcePath&&d.jsx(qe,{size:"sm",variant:"ghost",onClick:h,className:"flex items-center gap-2",children:d.jsx(BS,{size:12})}),(e.sourcePath||e.type==="leaf"||e.page)&&d.jsxs(br,{onOpenChange:a,open:s,children:[d.jsx(xo,{asChild:!0,children:d.jsx(qe,{size:"sm",variant:"ghost",children:d.jsx($S,{size:12})})}),d.jsx(tr,{container:t,children:d.jsx(rq,{node:e,routePatternWithParams:f,onClose:()=>a(!1)})})]}),f&&p&&d.jsx(G2,{path:p,size:"sm",variant:"ghost",open:l,setOpen:c,routePattern:f,children:d.jsx(VS,{size:12})})]})]}),d.jsx(ku,{isOpen:r,className:"pl-3",children:e.children.map((v,x)=>d.jsx(Y2,{node:v},x))})]})}function rq({node:e,onClose:t,routePatternWithParams:n}){const r=g.useMemo(()=>{var s;return e.type==="leaf"?e.fullPath:(s=e.page)==null?void 0:s.fullPath},[e]),o=g.useMemo(()=>e.sourcePath?Y.splitModuleFilePathAndModulePath(e.sourcePath)[0]:void 0,[e==null?void 0:e.sourcePath]),i=W2(o,r);return d.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[o&&e.sourcePath&&d.jsx(H2,{path:e.sourcePath,parentPath:o,refs:i,size:"sm",variant:"ghost",onComplete:t,confirmationMessage:`This will delete the ${r} page.`,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(US,{size:14}),d.jsx("span",{children:"Delete"})]})}),r!==void 0&&e.sourcePath&&o&&d.jsx(q2,{variant:"ghost",size:"sm",existingKeys:i,path:e.sourcePath,defaultValue:r,routePattern:n,parentPath:o,onComplete:t,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(vK,{size:12}),d.jsx("span",{children:"Rename"})]})})]})}function oq(e){const t={"/":{name:"/",fullPath:"/",isDirectory:!0,children:[]}};for(const n of e){const r=n.split("/");if(r[0]!=="")throw new Error("Expected path to start with '/'");for(let o=1;o<r.length;o++){const i=r.slice(0,o).join("/"),s=[i,r[o]].join("/"),a=r[o];if(!a)throw new Error("Expected name to be non-empty");if(!t[s]){const l={name:a,fullPath:s,children:[]};o<r.length-1&&(l.isDirectory=!0),t[s]=l,t[i||"/"].children.push(t[s])}}}return t["/"]}function iq(){const e=Ba();return g.useMemo(()=>{if(e.status==="success"){const t=[],n={};for(const r in e.data){const o=r,i=e.data[o];i.type==="record"&&i.router?(n[i.router]=n[i.router]||[],n[i.router].push(o)):t.push(o)}return{status:e.status,data:{root:oq(t),sitemap:n}}}return e},[e])}const J2=1280;function sq(){const e=Gu(),[t,n]=g.useState(""),[r,o]=g.useState("");g.useEffect(()=>{async function w(){let S=!1;const C=async N=>{if(!S)try{(await fetch(N)).ok&&(S=!0,n(N))}catch{}};await C("/favicon.ico"),await C("/favicon.svg"),await C("/favicon.png"),await C("/apple-touch-icon.png"),await C("https://valbuild.com/favicon.ico")}if(w(),e!=null&&e.project)o(e.project);else try{let S=new URL(location.origin).hostname;if(S!=="localhost"){const C=S.split(".");C.length>=2&&(S=C.slice(1,-1).join(".")),o(wf(S))}else o("Dev mode")}catch{o("Studio")}},[JSON.stringify(e)]);const i=Ba(),s=In(),{theme:a,setTheme:l}=ay(),{navMenu:c}=Jy(),u=iq(),f=(e==null?void 0:e.appHost)||Nb,[h,p]=r.split("/"),m=F7(),v=`${f}/orgs/${h}`,x=`${f}/orgs/${h}/members`,b=`${v}/projects/${p}`;return d.jsxs("nav",{className:"relative min-h-[100svh] bg-bg-primary",children:[d.jsxs("div",{className:"flex gap-4 justify-between items-center p-4 pr-6 h-16 border-b border-border-primary",children:[d.jsxs("div",{className:"flex gap-4 items-center",children:[t?d.jsx("img",{src:t,alt:"",className:"w-4 h-4"}):d.jsx("div",{className:"w-4 h-4"}),h&&p?d.jsx("a",{className:"truncate hover:underline",href:b,children:r}):d.jsx("span",{className:"truncate",children:r})]}),d.jsx("button",{className:"lg:hidden",onClick:()=>{c.setOpen(!c.isOpen)},children:d.jsx(Ag,{size:16,className:Ce("transform",{"rotate-180":!c.isOpen})})})]}),"data"in i&&d.jsx("div",{className:Ce("py-4 pl-2",{}),children:d.jsxs(hr,{children:[d.jsx("div",{className:"max-h-[calc(100svh-32px-64px-32px-16px)] max-w-[320px] px-2",children:"data"in u?d.jsxs(d.Fragment,{children:[d.jsx(lq,{title:"Site map",defaultOpen:!0,sitemap:u.data.sitemap}),d.jsx(aq,{title:"Explorer",defaultOpen:!0,node:u.data.root})]}):u.status==="loading"?d.jsx(cq,{}):null}),d.jsx(qS,{orientation:"horizontal"})]})}),d.jsx("div",{className:"p-4 h-6"}),d.jsx("div",{className:"absolute bottom-0 left-0 w-full",children:d.jsxs(br,{children:[d.jsxs(xo,{className:"flex items-center justify-between w-full p-4 border-t border-border-primary hover:bg-bg-secondary data-[state=open]:bg-bg-secondary",children:[d.jsx("span",{children:m&&d.jsx(VN,{size:"sm",profile:m})}),d.jsx($S,{size:16})]}),d.jsx(tr,{className:"p-0 py-2",container:s,side:"top",children:d.jsxs("div",{className:"flex flex-col gap-2 justify-between items-center",children:[m&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex gap-2 items-center px-4 py-2 w-full",children:[d.jsx(VN,{size:"sm",profile:m}),d.jsxs("div",{className:"text-sm",children:[d.jsx("div",{className:"truncate",children:m.fullName}),m.email&&d.jsx("div",{className:"font-light truncate",children:m.email})]})]}),d.jsx("hr",{className:"mb-1 w-full h-1 border-t border-border-primary"})]}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[a==="dark"?d.jsx(pK,{size:"1rem"}):d.jsx(kK,{size:"1rem"}),d.jsx("button",{className:"",onClick:()=>{l(a==="dark"?"light":"dark")},children:a==="dark"?d.jsx("span",{className:"text-sm",children:"Dark mode"}):d.jsx("span",{className:"text-sm",children:"Light mode"})})]}),m&&d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(jK,{size:"1rem"}),d.jsx("a",{href:x,children:d.jsx("span",{className:"text-sm truncate",children:"Manage members"})})]}),m&&d.jsxs(d.Fragment,{children:[d.jsx("hr",{className:"mt-1 mb-1 w-full h-1 border-t border-border-primary"}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(fK,{size:"1rem"}),d.jsx("a",{href:gu("/api/val/logout",{redirect_to:`${window.location.origin}`}),children:d.jsx("span",{className:"text-sm",children:"Log out"})})]})]})]})})]})})]})}function aq({title:e,defaultOpen:t,node:n}){return!n||(n==null?void 0:n.children.length)===0?null:d.jsx(X2,{icon:d.jsx(Ig,{size:16}),title:e,defaultOpen:t,children:n.children.sort(Z2).map((r,o)=>g.createElement(Q2,{...r,name:r.name,key:o,root:!0}))})}function X2({title:e,children:t,defaultOpen:n,icon:r}){const[o,i]=g.useState(n??!0);return d.jsxs("div",{className:"py-2",children:[d.jsxs("button",{className:"flex justify-between items-center py-2 w-full text-sm tracking-tighter uppercase text-fg-secondary",onClick:()=>{i(!o)},children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[r,e]}),d.jsx(Xu,{size:16,className:Ce("transform",{"rotate-90":o})})]}),d.jsx(ku,{isOpen:o,className:"pr-1",children:t})]})}function lq({title:e,defaultOpen:t,sitemap:n}){const r=n["next-app-router"];return r?d.jsx(X2,{title:e,defaultOpen:t,icon:d.jsx(Rg,{size:16}),children:d.jsx(nq,{moduleFilePaths:r})}):null}function cq(){return d.jsx("div",{className:"flex justify-start items-center w-full h-full",children:d.jsx(Gr,{size:16,className:"animate-spin"})})}function Z2(e,t){return e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name)}function Q2({name:e,fullPath:t,isDirectory:n,children:r,root:o}){const{navigate:i,currentSourcePath:s}=xn(),{navMenu:a}=Jy(),[l,c]=g.useState(!0),u=Ql()||{},f=g.useMemo(()=>{let x=!1;for(const b in u)if(b.startsWith(t)){x=!0;break}return x},[u,t]),h=g.useMemo(()=>{if(n){if(!l)return f}else if(!n)return f;return!1},[f,l,n]),p=t,m=Ft(p),v="data"in m?m.data.type:"loading";return d.jsxs("div",{className:"w-full text-sm",children:[d.jsxs("button",{className:Ce("relative flex items-center justify-between w-full ",{"py-2":o,"p-2":!o,underline:s.startsWith(p)&&!n,"font-bold":s.startsWith(p)&&n}),onClick:()=>{n?c(!l):(window.innerWidth<J2&&a.setOpen(!1),i(p))},children:[d.jsxs("div",{className:"flex items-center pr-2",children:[n?d.jsx(Xu,{size:16,className:Ce("transform mr-2",{"rotate-90":l,hidden:!r.length})}):d.jsx(uq,{type:v,size:14}),d.jsx("span",{children:Eu(e)})]}),h&&d.jsx("div",{className:"ml-2 w-2 h-2 rounded-full bg-bg-error-secondary"})]}),d.jsx("div",{className:"pl-2",children:d.jsx(ku,{isOpen:l,children:r.sort(Z2).map((x,b)=>g.createElement(Q2,{...x,key:b}))})})]})}function uq({size:e,type:t}){if(t==="loading")return d.jsx(Gr,{size:e,className:"mr-2 animate-spin"});switch(t){case"string":return d.jsx(PK,{size:e,className:"mr-2"});case"number":return d.jsx(sK,{size:e,className:"mr-2"});case"boolean":return d.jsx(CK,{size:e,className:"mr-2"});case"object":return d.jsx(cK,{size:e,className:"mr-2"});case"literal":return d.jsx(X7,{size:e,className:"mr-2"});case"array":return d.jsx(s2,{size:e,className:"mr-2"});case"union":return d.jsx(yK,{size:e,className:"mr-2"});case"richtext":return d.jsx(r2,{size:e,className:"mr-2"});case"record":return d.jsx(EK,{size:e,className:"mr-2"});case"keyOf":return d.jsx(lK,{size:e,className:"mr-2"});case"file":return d.jsx(o2,{size:e,className:"mr-2"});case"date":return d.jsx(n2,{size:e,className:"mr-2"});case"image":return d.jsx(i2,{size:e,className:"mr-2"});default:return d.jsx(Y7,{size:e,className:"mr-2"})}}function XS(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ZS="Checkbox",[dq,vge]=So(ZS),[fq,hq]=dq(ZS),eA=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...f}=e,[h,p]=g.useState(null),m=Be(t,C=>p(C)),v=g.useRef(!1),x=h?u||!!h.closest("form"):!0,[b=!1,w]=Kr({prop:o,defaultProp:i,onChange:c}),S=g.useRef(b);return g.useEffect(()=>{const C=h==null?void 0:h.form;if(C){const N=()=>w(S.current);return C.addEventListener("reset",N),()=>C.removeEventListener("reset",N)}},[h,w]),d.jsxs(fq,{scope:n,state:b,disabled:a,children:[d.jsx(Oe.button,{type:"button",role:"checkbox","aria-checked":da(b)?"mixed":b,"aria-required":s,"data-state":rA(b),"data-disabled":a?"":void 0,disabled:a,value:l,...f,ref:m,onKeyDown:ne(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:ne(e.onClick,C=>{w(N=>da(N)?!0:!N),x&&(v.current=C.isPropagationStopped(),v.current||C.stopPropagation())})}),x&&d.jsx(pq,{control:h,bubbles:!v.current,name:r,value:l,checked:b,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"},defaultChecked:da(i)?!1:i})]})});eA.displayName=ZS;var tA="CheckboxIndicator",nA=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=hq(tA,n);return d.jsx(ln,{present:r||da(i.state)||i.state===!0,children:d.jsx(Oe.span,{"data-state":rA(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});nA.displayName=tA;var pq=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=g.useRef(null),a=XS(n),l=CS(t);g.useEffect(()=>{const u=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&p){const m=new Event("click",{bubbles:r});u.indeterminate=da(n),p.call(u,da(n)?!1:n),u.dispatchEvent(m)}},[a,n,r]);const c=g.useRef(da(n)?!1:n);return d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??c.current,...i,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function da(e){return e==="indeterminate"}function rA(e){return da(e)?"indeterminate":e?"checked":"unchecked"}var oA=eA,mq=nA;const Qu=g.forwardRef(({className:e,...t},n)=>{const[r,o]=g.useState();return g.useEffect(()=>{o(t.checked)},[t.checked]),d.jsx(oA,{ref:n,checked:r,onCheckedChange:i=>{o(i),t.onCheckedChange&&t.onCheckedChange(i)},className:fe("peer h-4 w-4 shrink-0 rounded-sm bg-bg-primary border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-bg-primary data-[state=checked]:text-fg-primary",e),...t,children:d.jsxs(mq,{className:fe("flex items-center justify-center text-current"),children:[r===!0&&d.jsx(Yu,{size:12}),r==="indeterminate"&&d.jsx(hK,{size:12})]})})});Qu.displayName=oA.displayName;function jm(e,t){const n=new Date(t).getTime(),r=e.getTime(),o=Math.floor((r-n)/1e3),i=Math.floor(o/60),s=Math.floor(o/3600),a=Math.floor(o/86400),l=Math.floor(a/30);return o<60?"just now":i<60?`${i}m ago`:s<24?`${s}h ago`:a===1?"yesterday":a<30?`${a}d ago`:`${l}mo ago`}function iA({onPublish:e,onClose:t}){const[n,r]=g.useState(null),o=ip(),{summary:i,canGenerate:s,setSummary:a,publishDisabled:l,generateSummary:c}=sp(),[u,f]=g.useState(!1),h=()=>{f(!1),i.type!=="not-asked"&&a({...i})};g.useEffect(()=>{i.type!=="not-asked"&&!i.isGenerating&&!xu(i.patchIds,o)&&f(!0)},[i,o]);const p=g.useCallback(()=>{h(),c().then(x=>{x.type==="ai"?a({type:"ai",text:x.text.trim()}):r(x.message)})},[h,c,a,r]),m="w-full p-2 border rounded bg-bg-secondary",v="text"in i?i.text:"";return d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[d.jsx("span",{className:"font-semibold",children:"Summary"}),s&&d.jsx(GN,{onClick:p,isGenerating:i.isGenerating})]}),n&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:n}),d.jsxs("div",{className:"grid text-xs font-light",children:[d.jsx("div",{"aria-hidden":!0,className:fe(m,"invisible whitespace-pre-wrap"),style:{gridArea:"1 / 1 / 2 / 2"},children:v+" "}),d.jsx("textarea",{disabled:!!i.isGenerating,className:fe(m,"resize-none overflow-clip disabled:opacity-50"),value:v,style:{gridArea:"1 / 1 / 2 / 2"},placeholder:"Write a summary of your changes"+(s?" or generate one using AI":""),onChange:x=>{h(),a({type:"manual",text:x.currentTarget.value})}})]}),d.jsxs("div",{className:fe("p-2 text-xs flex-grow font-light bg-bg-warning-primary text-[black] rounded flex items-center","flex justify-between w-full gap-2 py-2",{hidden:!u}),"aria-hidden":u,children:[d.jsx("span",{children:"Summary might be outdated. "}),d.jsx("button",{className:"underline",onClick:h,children:"Dismiss"})]}),d.jsx("div",{className:"flex items-center justify-end gap-2",children:e?d.jsxs(d.Fragment,{children:[d.jsx(qe,{variant:"outline",onClick:()=>{t()},children:"Close"}),u&&s&&d.jsx(GN,{isGenerating:i.isGenerating,onClick:p}),!u&&d.jsxs(qe,{disabled:l||v.trim()==="",onClick:()=>{i.type!=="not-asked"&&e()},variant:"default",className:"flex items-center gap-2",children:[d.jsxs("span",{children:[" ",l?"Pushing...":"Publish"]}),d.jsx(Dg,{size:16})]})]}):d.jsx(d.Fragment,{children:d.jsx(qe,{variant:"outline",onClick:()=>{t()},children:"Close"})})})]})}function GN({isGenerating:e,onClick:t}){return d.jsx(qe,{className:"truncate",disabled:!!e,onClick:()=>{t()},variant:"outline",children:d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx("span",{children:e?"Generating...":"Generate"}),d.jsx(a2,{size:16})]})})}function gq(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:p,...m}=f,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return d.jsx(v.Provider,{value:x,children:p})}function u(f,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,vq(o,...t)]}function vq(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function py(e){const t=e+"CollectionProvider",[n,r]=gq(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:m,children:v}=p,x=Ee.useRef(null),b=Ee.useRef(new Map).current;return d.jsx(o,{scope:m,itemMap:b,collectionRef:x,children:v})};s.displayName=t;const a=e+"CollectionSlot",l=Ee.forwardRef((p,m)=>{const{scope:v,children:x}=p,b=i(a,v),w=Be(m,b.collectionRef);return d.jsx(ls,{ref:w,children:x})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",f=Ee.forwardRef((p,m)=>{const{scope:v,children:x,...b}=p,w=Ee.useRef(null),S=Be(m,w),C=i(c,v);return Ee.useEffect(()=>(C.itemMap.set(w,{ref:w,...b}),()=>void C.itemMap.delete(w))),d.jsx(ls,{[u]:"",ref:S,children:x})});f.displayName=c;function h(p){const m=i(e+"CollectionConsumer",p);return Ee.useCallback(()=>{const x=m.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((C,N)=>b.indexOf(C.ref.current)-b.indexOf(N.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}var QS="Collapsible",[yq,sA]=So(QS),[xq,ek]=yq(QS),aA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,c]=Kr({prop:r,defaultProp:o,onChange:s});return d.jsx(xq,{scope:n,disabled:i,contentId:Vr(),open:l,onOpenToggle:g.useCallback(()=>c(u=>!u),[c]),children:d.jsx(Oe.div,{"data-state":nk(l),"data-disabled":i?"":void 0,...a,ref:t})})});aA.displayName=QS;var lA="CollapsibleTrigger",cA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ek(lA,n);return d.jsx(Oe.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":nk(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ne(e.onClick,o.onOpenToggle)})});cA.displayName=lA;var tk="CollapsibleContent",uA=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ek(tk,e.__scopeCollapsible);return d.jsx(ln,{present:n||o.open,children:({present:i})=>d.jsx(bq,{...r,ref:t,present:i})})});uA.displayName=tk;var bq=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=ek(tk,n),[a,l]=g.useState(r),c=g.useRef(null),u=Be(t,c),f=g.useRef(0),h=f.current,p=g.useRef(0),m=p.current,v=s.open||a,x=g.useRef(v),b=g.useRef();return g.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),On(()=>{const w=c.current;if(w){b.current=b.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const S=w.getBoundingClientRect();f.current=S.height,p.current=S.width,x.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),l(r)}},[s.open,r]),d.jsx(Oe.div,{"data-state":nk(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...i,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:v&&o})});function nk(e){return e?"open":"closed"}var wq=aA,Sq=cA,kq=uA,ms="Accordion",Eq=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[rk,Cq,Nq]=py(ms),[my,yge]=So(ms,[Nq,sA]),ok=sA(),dA=Ee.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return d.jsx(rk.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?d.jsx(Tq,{...i,ref:t}):d.jsx(jq,{...o,ref:t})})});dA.displayName=ms;var[fA,Pq]=my(ms),[hA,_q]=my(ms,{collapsible:!1}),jq=Ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...s}=e,[a,l]=Kr({prop:n,defaultProp:r,onChange:o});return d.jsx(fA,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:Ee.useCallback(()=>i&&l(""),[i,l]),children:d.jsx(hA,{scope:e.__scopeAccordion,collapsible:i,children:d.jsx(pA,{...s,ref:t})})})}),Tq=Ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[s=[],a]=Kr({prop:n,defaultProp:r,onChange:o}),l=Ee.useCallback(u=>a((f=[])=>[...f,u]),[a]),c=Ee.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return d.jsx(fA,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:c,children:d.jsx(hA,{scope:e.__scopeAccordion,collapsible:!0,children:d.jsx(pA,{...i,ref:t})})})}),[Oq,gy]=my(ms),pA=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...s}=e,a=Ee.useRef(null),l=Be(a,t),c=Cq(n),f=ap(o)==="ltr",h=ne(e.onKeyDown,p=>{var O;if(!Eq.includes(p.key))return;const m=p.target,v=c().filter(M=>{var D;return!((D=M.ref.current)!=null&&D.disabled)}),x=v.findIndex(M=>M.ref.current===m),b=v.length;if(x===-1)return;p.preventDefault();let w=x;const S=0,C=b-1,N=()=>{w=x+1,w>C&&(w=S)},P=()=>{w=x-1,w<S&&(w=C)};switch(p.key){case"Home":w=S;break;case"End":w=C;break;case"ArrowRight":i==="horizontal"&&(f?N():P());break;case"ArrowDown":i==="vertical"&&N();break;case"ArrowLeft":i==="horizontal"&&(f?P():N());break;case"ArrowUp":i==="vertical"&&P();break}const _=w%b;(O=v[_].ref.current)==null||O.focus()});return d.jsx(Oq,{scope:n,disabled:r,direction:o,orientation:i,children:d.jsx(rk.Slot,{scope:n,children:d.jsx(Oe.div,{...s,"data-orientation":i,ref:l,onKeyDown:r?void 0:h})})})}),$g="AccordionItem",[Mq,ik]=my($g),sk=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=gy($g,n),s=Pq($g,n),a=ok(n),l=Vr(),c=r&&s.value.includes(r)||!1,u=i.disabled||e.disabled;return d.jsx(Mq,{scope:n,open:c,disabled:u,triggerId:l,children:d.jsx(wq,{"data-orientation":i.orientation,"data-state":yA(c),...a,...o,ref:t,disabled:u,open:c,onOpenChange:f=>{f?s.onItemOpen(r):s.onItemClose(r)}})})});sk.displayName=$g;var mA="AccordionHeader",gA=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=gy(ms,n),i=ik(mA,n);return d.jsx(Oe.h3,{"data-orientation":o.orientation,"data-state":yA(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});gA.displayName=mA;var Yb="AccordionTrigger",ak=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=gy(ms,n),i=ik(Yb,n),s=_q(Yb,n),a=ok(n);return d.jsx(rk.ItemSlot,{scope:n,children:d.jsx(Sq,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...a,...r,ref:t})})});ak.displayName=Yb;var vA="AccordionContent",lk=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=gy(ms,n),i=ik(vA,n),s=ok(n);return d.jsx(kq,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...s,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});lk.displayName=vA;function yA(e){return e?"open":"closed"}var xA=dA,Rq=sk,Aq=gA,bA=ak,wA=lk;const Dl=xA,_a=g.forwardRef(({className:e,...t},n)=>d.jsx(Rq,{ref:n,className:fe("border-b",e),...t}));_a.displayName="AccordionItem";const Ll=g.forwardRef(({className:e,children:t,...n},r)=>d.jsx(Aq,{className:"flex",children:d.jsxs(bA,{ref:r,className:fe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,d.jsx(Ju,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));Ll.displayName=bA.displayName;const ja=g.forwardRef(({className:e,children:t,...n},r)=>d.jsx(wA,{ref:r,className:fe("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:d.jsx("div",{className:"pt-0 pb-4",children:t})}));ja.displayName=wA.displayName;function SA(e,t,n){if(e.length===0)return{success:!1,error:"Empty path"};let r=-1,o="";const i=c=>{o===""?o=c:o+="."+c};if(t===void 0)return{success:!1,error:`Undefined schema in: '${e.join("/")}'.`};if(n===void 0)return{success:!1,error:`Undefined source in: '${e.join("/")}'.`};let s=t,a=n;const l=[{modulePath:o,schema:s,source:a}];for(const c of e){if(r++,c==="")return{success:!1,error:`Empty path part in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(s.type==="array"){s=s.item;const u=Number(c);if(!Number.isSafeInteger(u))return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an integer but got '${c}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(typeof a!="object")return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===null)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'null' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===void 0)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'undefined' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!Array.isArray(a))return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an array but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!a[u])return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an index less than ${a.length} but got '${u}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};a=a[u],i(c)}else if(s.type==="record"){s=s.item;const u=om(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="object"){s=s.items[c];const u=om(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="union"){const u=typeof s.key=="object"&&s.key.type==="literal"?s:void 0,f=typeof s.key=="string"?s:void 0;if(u)return{success:!1,error:"Invalid lookup in string union"};if(f){const h=om(e,c,r,a,"union object");if(!h.success)return{success:!1,error:h.error};const p=h.source;let m;for(const v of f.items){const x=v.items[f.key];if(x.type==="literal"){if(p[f.key]===x.value){m=v;break}}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}if(!m)return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};s=m.items[c],a=p[c],i(JSON.stringify(c))}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}else if(s.type==="image"||s.type==="file"){const u=om(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else return{success:!1,error:`Cannot construct sub-path in schema of '${s.type}' in: '${e.join("/")}'. Path was: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")}`};l.push({modulePath:o,schema:s,source:a})}return{success:!0,modulePath:o,schema:s,source:a,allResolved:l}}function om(e,t,n,r,o){return typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===null?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'null' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===void 0?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'undefined' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:Array.isArray(r)?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'array' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:t in r?{success:!0,source:r}:{success:!1,error:`Could not find key of source: '${e.join("/")}'. Expected a key in ${Object.keys(r).join(", ")} but got '${t}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}}function Iq(e,t){return(t==null?void 0:t.type)==="array"?e.type!=="string":(t==null?void 0:t.type)==="record"}function kA(e,t,n){if(!n)return null;const[r,o]=Y.splitModuleFilePathAndModulePath(e);if(!o)return r;const i=t[r],s=n[r];if(i===void 0||!s)return null;const a=SA(Y.splitModulePath(o),s,i);if(a.success){for(let l=a.allResolved.length-1;l>=0;l--){const c=a.allResolved[l],u=a.allResolved[l-1];if(Iq(c.schema,(u==null?void 0:u.schema)||null))return c.modulePath===""?r:Y.joinModuleFilePathAndModulePath(r,c.modulePath)}return r}else console.error(`Error resolving path: ${a.error} for path: ${e}`);return null}function dp({moduleFilePath:e,patchPath:t,className:n,toolTip:r=!0,link:o=!0}){const i=Gu(),s=g.useRef(null),a=g.useRef(new Map),[l,c]=g.useState([]),[u,f]=g.useState(),h=FS(),p=Ba(),{navigate:m}=xn();g.useEffect(()=>{const x=e?Y.splitModuleFilePath(e):[],b=t,w=()=>{if(!s.current)return;const C=s.current,N=getComputedStyle(C),P=`${N.fontSize} ${N.fontFamily}`,_=C.offsetWidth,O=x.map(Dq).concat(b).map(K=>`/${K}`);f(O.join(""));const M=K=>{const V=`${K}:${P}`,I=a.current.get(V)??Lq(K,P);return a.current.set(V,I),I},D="/…",U=M(D),z=[];let H=0;for(let K=O.length-1;K>=0;K--){const V=M(O[K]),A=!(K===0);if(H+V+(A?U:0)<=_){const j=K>x.length?"module-path":"module-file-path";z.unshift({text:O[K],type:j,moduleFilePath:e,modulePathSegments:b.slice(0,K)}),H+=V}else{z.unshift({type:"ellipsis",text:D});break}}c(z)},S=new ResizeObserver(w);return s.current&&(S.observe(s.current),w()),()=>{s.current&&S.unobserve(s.current)}},[e,t]);const v=g.useMemo(()=>{if(!o)return null;const x="data"in p?p.data:{};if(t.length===0){const w=e;return{navPath:w,sourcePath:w}}const b=SA(t,x[e],h[e]);if(b.success){const w=Y.joinModuleFilePathAndModulePath(e,b.modulePath),S=kA(w,h,x);if(S)return{navPath:S,scrollToId:w};console.debug(`Failed to resolve nav path for ${e} and ${t.join(".")}: ${S}`)}else console.debug(`Failed to resolve source path for ${e} and ${t.join(".")}: ${b.error}`);return null},[e,t,h,p]);return d.jsxs(zr,{open:r===!1?!1:void 0,children:[d.jsx(TS,{asChild:!0,children:d.jsx("a",{href:v&&i?`${i.studioPrefix}${v.navPath}#${v.scrollToId}`:void 0,ref:s,className:Ce("inline-block whitespace-nowrap overflow-hidden w-full align-baseline",{"cursor-pointer hover:underline":o},n),onClick:x=>{o&&v&&x.metaKey===!1&&x.ctrlKey===!1&&x.shiftKey===!1&&(x.preventDefault(),m(v.navPath,{scrollToId:v.scrollToId}))},children:l.map((x,b)=>d.jsx("span",{children:x.text},b))})}),d.jsx(fr,{side:"top",children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[calc(100vw-3rem)] whitespace-nowrap",children:u})})]})}function Dq(e){const t=Eu(e);return t.slice(0,1).toUpperCase()+t.slice(1)}function Lq(e,t){const r=document.createElement("canvas").getContext("2d");return r?(r.font=t,r.measureText(e).width):0}function EA({className:e,loadingStatus:t}){const n=ip(),r=qu(),o=R7(),i=M7(),s=In(),[a,l]=g.useState(!1),{canGenerate:c}=sp(),u=Ql(),{autoPublish:f}=IS(),h=g.useMemo(()=>{var D;let M=0;for(const U in u)M+=((D=u[U])==null?void 0:D.length)||0;return M},[u]),p=n.length-o.size,{deployments:m,dismissDeployment:v,observedCommitShas:x}=O7(),{globalTransientErrors:b,removeGlobalTransientErrors:w}=z7(),{patchErrors:S}=YR(),[C,N]=g.useState(new Date);g.useEffect(()=>{const M=setInterval(()=>{N(new Date)},6e4);return()=>{clearInterval(M)}},[]);const{deletePatches:P}=WR(),_=P7(),O=async(M,D,U)=>{const z=await _("/patches","GET",{query:{patch_id:[D],exclude_patch_ops:!1}});if(z.status===200){const H=z.json,K=`val-patch-error-report-${M.replace("/","__").replace(/\.val\./,"-")}-${D}.json`,V=new Blob([JSON.stringify({moduleFilePath:M,patchId:D,error:U,patch:H},null,2)],{type:"application/json"}),I=document.createElement("a");I.href=URL.createObjectURL(V),I.download=K,I.click()}else alert("Failed to download report")};return d.jsxs("div",{className:Ce("text-sm",e),children:[S&&Object.values(S).some(M=>M!==null)&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[d.jsxs("div",{className:"px-4 text-pretty",children:[d.jsx("div",{children:"Unfortunately, one or more changes have errors."}),d.jsx("div",{children:"No changes can currently be applied."})]}),Object.entries(S).map(([M,D],U)=>d.jsx("div",{className:"pb-4",children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:D&&Object.entries(D).map(([z,H],K)=>d.jsx(xA,{className:"grid grid-cols-2 gap-2",type:"single",collapsible:!0,children:d.jsxs(sk,{value:z,children:[d.jsx("div",{children:d.jsx(qe,{variant:"destructive",onClick:()=>{P([z])},children:d.jsx("span",{className:"flex gap-2 justify-between items-center text-left",children:d.jsx("span",{children:"Remove change and fix issue"})})})}),d.jsx(ak,{asChild:!0,className:"group",children:d.jsxs(qe,{variant:"destructive",children:[d.jsx("span",{className:"text-left truncate group-data-[state=open]:hidden",children:"Report"}),d.jsx("span",{className:"text-left truncate group-data-[state=open]:block hidden",children:"Hide"})]})}),d.jsxs(lk,{children:[d.jsx(qe,{variant:"destructive",onClick:()=>{O(M,z,H.message)},children:d.jsxs("span",{className:"flex gap-2 justify-between items-center text-left",children:[d.jsx("span",{children:"Download debug report"}),d.jsx(eK,{size:14})]})}),d.jsxs("div",{className:"p-4",children:[d.jsx("div",{className:"font-bold",children:"Details"}),d.jsx("div",{children:"Module file path"}),d.jsx("div",{children:d.jsx(qN,{sourcePath:M})}),d.jsx("div",{children:"Error message"}),d.jsx("pre",{children:H.message})]})]})]})},K))})},M+"#"+U))]})}),u&&h>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(hr,{orientation:"horizontal",children:d.jsx(Dl,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(_a,{value:"error",className:"border-b-0",children:[d.jsx(Ll,{className:" data-[state=open]:mb-4 text-fg-error-primary border-fg-error-primary ",children:d.jsxs("div",{className:"flex justify-between items-center w-full",children:[d.jsxs("div",{children:[h," validation issue",h>1?"s":""]}),d.jsx(Su,{size:16})]})}),d.jsx(ja,{className:"",children:d.jsx("div",{className:"flex flex-col gap-4",children:Object.entries(u).map(([M,D],U)=>d.jsxs("div",{className:"pb-4",children:[d.jsx("div",{className:"items-start text-left",children:d.jsx(qN,{sourcePath:M})}),d.jsx("div",{children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:D==null?void 0:D.map((z,H)=>d.jsx("div",{className:"",children:d.jsx("div",{children:z.message})},H))})})]},M+"#"+U))})})]})})})}),b&&b.length>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(hr,{orientation:"horizontal",children:d.jsx(Dl,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(_a,{value:"error",className:"border-b-0 data-[state=open]:mb-4",children:[d.jsxs(Ll,{children:[b.length," transient error",b.length>1?"s":""]}),d.jsx(ja,{className:"w-full",children:d.jsx("div",{className:"flex flex-col gap-2",children:b.map(M=>d.jsxs("div",{className:"flex gap-2 justify-between items-start",children:[d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("div",{className:"font-bold",children:M.message}),M.details&&d.jsx("div",{children:M.details}),d.jsx("div",{className:"text-[10px] font-thin",children:jm(C,new Date(M.timestamp).toISOString())})]}),d.jsx("button",{onClick:()=>w([M.id]),children:d.jsx(Rl,{size:14})})]},M.id))})})]})})})}),m.length>0&&d.jsx("div",{className:"p-4 border-b border-border-primary",children:d.jsx(Fq,{deployments:m,observedCommitShas:x,onDismiss:v})}),r==="http"&&d.jsx("div",{className:"flex justify-end items-center p-4 border-b z-5 border-border-primary",children:d.jsxs(br,{open:a,onOpenChange:M=>{l(M)},children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Summary"}),c&&d.jsx(a2,{size:14})]})}),d.jsxs(tr,{container:s,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Al,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Rl,{size:12})}),d.jsx(iA,{onClose:()=>{l(!1)}})]})]})}),d.jsx("div",{className:"p-4 z-5",children:d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsxs("div",{className:"font-bold",children:[p<=0?"No ":`${p} `,"pending change",p===1?"":"s"]}),(t==="loading"||t==="not-asked")&&d.jsx("div",{className:"",children:d.jsx(Gr,{size:16,className:"animate-spin"})})]}),d.jsxs(br,{children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{disabled:n.length===0,variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Undo all"}),d.jsx(Hb,{size:14})]})}),d.jsx(tr,{container:s,className:"z-[9001]",children:d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:"This will undo all changes to the current state."}),d.jsx("div",{children:d.jsx(Al,{asChild:!0,children:d.jsxs(qe,{variant:"destructive",className:"flex gap-2 items-center text-sm",onClick:()=>{P(n)},children:[d.jsx("span",{children:"Undo all changes"}),d.jsx(Hb,{size:14})]})})})]})})]})]})}),(!f||h>0)&&d.jsx("div",{className:"flex flex-col gap-[2px]",children:"data"in i&&n.length>0&&i.data.map(M=>d.jsx(Vq,{committedPatchIds:o,patchSet:M,patchErrors:S[M.moduleFilePath]},M.moduleFilePath+":"+M.patchPath.join("/")))})]})}function qN({sourcePath:e}){const[t,n]=Y.splitModuleFilePathAndModulePath(e),r=Y.splitModulePath(n);return d.jsx(dp,{moduleFilePath:t,patchPath:r})}function Fq({deployments:e,observedCommitShas:t,onDismiss:n}){return g.useEffect(()=>{for(const r of e)t.has(r.commitSha)&&setTimeout(()=>{n(r.commitSha)},5e3)},[e,t]),d.jsxs("div",{children:[d.jsxs("div",{className:"flex justify-between items-center p-2 font-bold",children:[d.jsx("span",{children:"Deployments"}),d.jsx(Gr,{size:16,className:"inline animate-spin"})]}),d.jsx("div",{children:e.reverse().map(r=>d.jsx(zq,{deployment:r,isFinished:t.has(r.commitSha),onDismiss:()=>{n(r.commitSha)}},r.commitSha))})]})}function zq({deployment:e,isFinished:t,onDismiss:n}){var s;const r=LS(),o=In(),i=e.creator&&r[e.creator];return d.jsxs("div",{className:"flex justify-between items-start p-2",children:[d.jsxs("div",{className:"flex gap-2 items-start",children:[i&&d.jsx("img",{src:(s=i.avatar)==null?void 0:s.url,alt:i.fullName,className:"w-8 h-8 rounded-full"}),d.jsxs(zr,{children:[d.jsx(TR,{container:o}),d.jsx(ho,{children:d.jsx("div",{className:"max-w-[180px] overflow-clip font-light truncate",children:e.commitMessage})}),d.jsx(fr,{className:"max-w-[320px]",children:d.jsx("pre",{className:"font-sans font-light whitespace-break-spaces",children:e.commitMessage})})]})]}),t&&d.jsxs("div",{className:"flex gap-2 items-start",children:[d.jsx("span",{className:"text-xs font-light text-fg-quaternary",children:"Deployed"}),d.jsx("button",{onClick:()=>{n()},children:d.jsx(Yu,{size:14})})]}),!t&&d.jsx($q,{since:new Date(e.createdAt)})]})}function $q({since:e}){const[t,n]=g.useState("00"),[r,o]=g.useState("00");return g.useEffect(()=>{let i;const s=()=>{const a=Date.now(),l=Math.floor((a-e.getTime())/1e3),c=Math.floor(l/60),u=l%60;let f;c>4?(f=(60-u)*1e3,n(c.toString()),o(null)):(f=1e3,n(c.toString().padStart(2,"0")),o(u.toString().padStart(2,"0"))),i=setTimeout(s,f)};return s(),()=>{clearTimeout(i)}},[e]),d.jsxs("div",{className:"text-xs font-light text-fg-quaternary",children:[t,r!==null?`:${r}`:" mins"]})}function Bq({moduleFilePath:e,patchMetadata:t,committedPatchIds:n}){var u;const r=CA([t.opType],t.createdAt,n.has(t.patchId)),o=LS(),{skippedPatches:i}=DS(),s=void 0,[a]=g.useMemo(()=>[!!i[t.patchId]],[t.patchId,i[t.patchId]]),l=qu();let c=[];if(t.author){const f=o[t.author];if(f){const h=((u=f==null?void 0:f.avatar)==null?void 0:u.url)??null;c=[{fullName:f.fullName,url:h}]}else console.warn("Did not find profile for author: ",t.author,{profilesById:o})}return c.length===0&&l==="http"&&console.warn("No authors",{patchMetadata:t}),d.jsx(Jb,{moduleFilePath:e,patchPath:t.patchPath,changeDescription:a?"Skipped":r,authors:c,errors:s,skipped:a,isApplied:n.has(t.patchId)})}function CA(e,t,n){const[r,o]=g.useState(new Date);if(g.useEffect(()=>{const a=setInterval(()=>{o(new Date)},6e4);return()=>{clearInterval(a)}},[]),n)return"Pushed "+jm(r,t);if(e.length>1)return"Updated "+jm(r,t);const i=e[0];let s=i;return i==="add"?s="Added":i==="remove"?s="Removed":i==="replace"?s="Replaced":i==="move"?s="Moved":i==="copy"?s="Copied":i==="test"?s="Tested":i==="file"?s="Updated":console.warn("Unexpected op type: ",i),s+" "+jm(r,t)}function Vq({patchSet:e,committedPatchIds:t,patchErrors:n}){const[r,o]=g.useState(!1),i=g.useRef(null),[s,a]=g.useState(!1);g.useEffect(()=>{const v=new IntersectionObserver(x=>{x[0].isIntersecting&&a(!0)},{threshold:0});return i.current&&v.observe(i.current),()=>{v.disconnect()}},[]);const{skippedPatches:l}=DS(),{deletePatches:c}=WR(),u=g.useMemo(()=>e.patches.map(v=>v.patchId),[e.patches.map(v=>v.patchId).join(",")]),f=g.useMemo(()=>{const v=[];for(const x of u){const b=n==null?void 0:n[x];!l[x]&&b&&v.unshift(b.message)}return v},[u,n,l]),h=CA(e.opTypes,e.lastUpdated,!1),p=LS(),m=e.patches.every(v=>t.has(v.patchId));return s?d.jsxs(d.Fragment,{children:[d.jsx(Jb,{moduleFilePath:e.moduleFilePath,patchPath:e.patchPath,isApplied:m,authors:e.authors.reduce((v,x)=>v.includes(x)?v:v.concat(x),[]).flatMap(v=>{var b;const x=p[v];if(x){const w=((b=x==null?void 0:x.avatar)==null?void 0:b.url)??null;return[{fullName:x.fullName,url:w}]}return[]}),changeDescription:h,isOpen:r,setOpen:o,errors:f,onDelete:()=>{c(u.filter(v=>!t.has(v)))},amount:new Set(u).size}),d.jsx(ku,{isOpen:r,children:e.patches.map((v,x)=>d.jsx(Bq,{committedPatchIds:t,moduleFilePath:e.moduleFilePath,patchMetadata:v},e.moduleFilePath+":"+e.patchPath.join("/")+v.patchId+x))})]}):d.jsx(Jb,{ref:i,isApplied:m})}const Jb=g.forwardRef(({moduleFilePath:e,patchPath:t,changeDescription:n,authors:r,isOpen:o,setOpen:i,isSelected:s,setSelected:a,errors:l,skipped:c,onDelete:u,amount:f,isApplied:h},p)=>{const m=In();return d.jsxs("div",{ref:p,className:Ce("p-6",{"bg-bg-secondary":!o,"bg-bg-tertiary":o,"opacity-50":h}),children:[d.jsxs("div",{className:"relative",children:[d.jsx("span",{className:"inline-block w-[calc(320px-24px-8px-16px-24px-48px)] truncate mr-2 ",children:e&&t&&d.jsx(dp,{moduleFilePath:e,patchPath:t,link:!0,toolTip:!0})}),s===void 0&&d.jsx("span",{className:Ce("inline-block w-6 h-6 rounded",{"bg-bg-disabled animate-pulse":t===void 0})}),s!==void 0&&!h&&d.jsx(Qu,{checked:s,onCheckedChange:v=>{a&&a(v)}}),d.jsxs("div",{className:"inline relative ml-5",children:[f&&d.jsxs(zr,{children:[d.jsx(ho,{children:d.jsx("span",{className:"absolute -right-5 -top-6 w-6 h-6 text-xs leading-6 text-center rounded-full bg-bg-primary text-fg-primary",children:f>9?"9+":f})}),d.jsx(fr,{side:"left",children:d.jsxs("p",{children:[f," change",f>1?"s":""," in this patch set"]})})]}),u&&!h&&f&&f>0&&d.jsxs(br,{children:[d.jsx(xo,{children:d.jsx(Hb,{size:16,className:"inline"})}),d.jsxs(tr,{container:m,className:"flex flex-col gap-2 z-[9001]",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsxs("div",{children:["This will undo ",f," change",f>1?"s":"","."]}),d.jsx("div",{children:d.jsx(Al,{asChild:!0,children:d.jsxs(qe,{variant:"destructive",onClick:u,children:["Undo change",f>1?"s":""]})})})]})]})]})]}),l&&l.length>0&&!c&&d.jsxs("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary rounded-lg",children:[l.slice(0,1).map((v,x)=>d.jsx("div",{title:v,className:"truncate",children:"Invalid change"},x)),l.length>1&&d.jsxs("div",{className:"truncate",children:["+",l.length-1," more"]})]}),(!l||l.length===0)&&c&&d.jsx("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary",children:d.jsx("div",{className:"truncate",children:"Skipped"})}),d.jsxs("div",{className:"flex justify-between items-center pt-2",children:[d.jsxs("span",{className:"flex flex-shrink-0 gap-2",children:[r!==void 0&&r.length>0&&d.jsxs("span",{className:"flex gap-1 mr-2",children:[r.slice(0,2).map((v,x)=>{if(v.url)return d.jsxs(zr,{children:[d.jsx(ho,{className:"flex-shrink-0 w-6 h-6",children:d.jsx("img",{src:v.url,alt:v.fullName,className:Ce("rounded-full",{"-ml-3":r.length>2&&x>0})})}),d.jsx(fr,{children:d.jsx("div",{children:v.fullName})})]},v.url);const b=Uq(v.fullName);return d.jsxs(zr,{children:[d.jsx(ho,{className:Ce({"-ml-3":r.length>2&&x>0}),children:d.jsx("span",{className:Ce("flex items-center justify-center w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary"),"aria-label":"Initials for: "+v.fullName,children:b})}),d.jsx(fr,{children:d.jsx("div",{children:v.fullName})})]},v.fullName+v.url)}),r.length>2&&d.jsxs(zr,{children:[d.jsx(ho,{className:Ce({"-ml-3":r.length>2}),children:d.jsxs("span",{className:"flex justify-center items-center -ml-3 w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary",children:["+",r.length-2]})}),d.jsx(fr,{className:"grid grid-cols-[auto,1fr] gap-2",children:r.slice(2).map(v=>d.jsxs(g.Fragment,{children:[v.url?d.jsx("img",{src:v.url,alt:v.fullName,title:v.fullName,className:Ce("w-6 h-6 rounded-full")},v.url):d.jsx("div",{}),d.jsx("div",{children:v.fullName})]},v.fullName+v.url))})]})]}),r===void 0&&d.jsx("span",{className:Ce("inline-block w-6 h-6 mr-2",{"bg-bg-disabled animate-pulse rounded-3xl":r===void 0})}),n&&d.jsx("span",{className:Ce({"text-fg-disabled":c}),children:n})]}),o!==void 0&&d.jsx("button",{className:"inline-block flex-shrink-0",onClick:()=>{i&&i(!o)},children:d.jsx(Ju,{size:16,className:Ce("transform",{"rotate-180":o})})})]})]})});function Uq(e){return!e||typeof e!="string"?"":e.trim().normalize("NFC").split(/\s+/).filter(r=>r.length>0).map(r=>/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(r)?r[0]:r[0].toLocaleUpperCase()).join("")}function Xb(){const[e,t]=g.useState(!1),{publish:n,publishDisabled:r,isPublishing:o,summary:i}=sp(),s=Ql(),a=s!==void 0&&Object.keys(s).length>0,l=HR(),c=KR(),u=qu(),f=In(),{autoPublish:h}=IS();return a?d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{className:"flex gap-2 items-center",disabled:!0,children:u==="fs"?"Save":d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Dg,{size:16})]})})}),d.jsx(fr,{children:d.jsx("div",{className:"flex flex-col gap-2",children:d.jsx("p",{children:"Fix validation errors to continue"})})})]}):u==="fs"?d.jsxs(qe,{className:"flex gap-2 items-center",disabled:r||a||h||l.length===0||c.length>0,title:a?"Please fix validation errors":"",onClick:()=>{n("No summary provided")},children:[a?d.jsx("span",{children:"Save"}):d.jsx("span",{children:o?"Saving":"Save"}),o&&d.jsx(Gr,{className:"animate-spin",size:16})]}):d.jsx("span",{children:d.jsxs(br,{open:e,onOpenChange:p=>{t(p)},children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{className:"flex gap-2 items-center",disabled:r||a||l.length===0||c.length>0,onClick:()=>{t(!0)},children:[!o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Dg,{size:16})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Pushing"}),d.jsx(Gr,{className:"animate-spin",size:16})]})]})}),d.jsxs(tr,{container:f,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Al,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Rl,{size:12})}),d.jsx(iA,{onClose:()=>{t(!1)},onPublish:()=>{if(t(!1),i.type==="not-asked")return;const p=i.text.trim();n(p)}})]})]})})}function Wq(){const e=ly(),{isPublishing:t}=sp(),n=Ql()||{},{globalErrors:r}=DS(),o=qu(),[i,s]=g.useMemo(()=>{const a=new Set;let l=0;for(const c in n){const[u]=Y.splitModuleFilePathAndModulePath(c);a.add(u),l+=1}return[Array.from(a).sort(),l]},[n]);return d.jsxs("div",{className:"min-h-[100svh] bg-bg-primary",style:{"--menu-width":"320px"},children:[d.jsx("div",{className:"h-16 border-b border-border-primary",children:d.jsx(Gq,{})}),t&&d.jsxs("div",{className:"flex gap-2 justify-end items-center p-4 text-right border-t bg-bg-tertiary text-fg-primary border-border-primary",children:[d.jsx("span",{children:"Publishing changes "}),d.jsx(Gr,{size:16,className:"animate-spin"})]}),d.jsx(hr,{children:d.jsxs("div",{className:"max-h-[calc(100svh-64px)]",children:[r&&r.length>0&&r.length!==s&&d.jsx(Dl,{type:"single",collapsible:!0,children:d.jsxs(_a,{value:"global-errors",children:[d.jsxs(Ll,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:["Cannot ",o==="fs"?"save":"publish"," now. Found"," ",r==null?void 0:r.length," errors in all."," ",r.length-s," were non-validation errors. A developer might need to fix these issues."]}),d.jsx(ja,{children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-128px)] max-w-[var(--menu-width)]",children:r==null?void 0:r.map((a,l)=>d.jsx(Kq,{error:a},l))})})})]})}),(r==null?void 0:r.length)===s&&i.length>0&&d.jsx(Dl,{type:"single",collapsible:!0,children:d.jsxs(_a,{value:"global-errors",children:[d.jsx(Ll,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:d.jsxs("div",{children:[d.jsxs("div",{children:["Cannot ",o==="fs"?"save":"publish"," now."]}),d.jsx("div",{children:"Found errors in modules"})]})}),d.jsx(ja,{children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[var(--menu-width)]",children:i==null?void 0:i.map((a,l)=>d.jsx(Hq,{moduleFilePath:a},l))})})})]})}),e!=="not-asked"&&d.jsx("div",{className:Ce("",{}),children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] border-b border-border-primary",children:d.jsx(EA,{loadingStatus:e})})})})]})})]})}function Hq({moduleFilePath:e}){const t=Y.splitModuleFilePath(e),n=xn();return d.jsx("div",{className:"px-4 py-2 border-b bg-bg-error-primary text-fg-error-primary border-border-error-primary",children:d.jsx("button",{className:"underline cursor-pointer",onClick:()=>{n.navigate(e)},children:t.map((r,o)=>d.jsxs(g.Fragment,{children:[d.jsx("span",{className:fe("text-fg-brand-secondary",{"ml-1":o>0}),children:"/"}),d.jsx("span",{children:Eu(r)})]},o))})})}function Kq({error:e}){const[t,n]=g.useState(!1);return d.jsx("div",{className:fe("px-1 py-2 bg-bg-error-primary text-fg-error-primary border-b border-border-error-primary",{truncate:!t,"whitespace-normal":t}),onClick:()=>n(!t),children:e})}function Gq(){const{currentSourcePath:e}=xn(),t=Ba(),[n,r]=Y.splitModuleFilePathAndModulePath(e),o=lt(n,"record"),i=g.useMemo(()=>{if(t.status!=="success")return t;if(o.status!=="success")return o;const f=t.data[n];if(f.type==="record"&&f.router){if(o.data===null)return{status:"success",data:null};const h=Object.keys(o.data),p=Y.splitModulePath(r)[0];for(const m of h)if(p&&p.startsWith(m))return{status:"success",data:{previewRoute:m}}}return{status:"success",data:null}},["data"in t&&t.data,n,r,o]),{navMenu:s,toolsMenu:a}=Jy(),l=qu(),{setAutoPublish:c,autoPublish:u}=IS();return d.jsx("div",{className:"flex flex-col",children:d.jsxs("div",{className:"flex gap-2 justify-between items-center p-4 w-full",children:[d.jsx("button",{className:"lg:hidden",onClick:()=>{a.setOpen(!a.isOpen)},children:d.jsx(Ag,{size:16,className:Ce("transform",{"rotate-180":!s.isOpen})})}),d.jsxs("div",{className:"flex gap-2 justify-end items-center w-full",children:[l==="fs"&&d.jsxs("div",{className:"overflow-hidden flex items-center gap-2 text-[10px] lg:text-xs",children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx("span",{className:"truncate text-fg-secondary",children:"Auto-save"})}),d.jsxs(fr,{children:[d.jsx("p",{children:"When auto-save is enabled Val will save to changes to disk automatically"}),d.jsx("p",{children:"This is a development mode feature"})]})]}),d.jsx(Qu,{checked:u,onCheckedChange:c})]}),d.jsx(qq,{maybePreviewRoute:i}),d.jsx(Xb,{})]})]})})}function qq({maybePreviewRoute:e}){var n,r;const t=g.useMemo(()=>{var o;return e.status==="success"&&((o=e.data)!=null&&o.previewRoute)?gu("/api/val/enable",{redirect_to:window.origin+e.data.previewRoute}):gu("/api/val/enable",{redirect_to:window.origin})},[e]);return d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{className:"flex gap-2 items-center",variant:"secondary",asChild:!0,children:d.jsxs("a",{href:t,children:[d.jsx("span",{children:"Preview"}),e.status==="success"&&((n=e.data)!=null&&n.previewRoute)?d.jsx(Rg,{size:16}):d.jsx(Ig,{size:16})]})})}),d.jsx(fr,{children:e.status==="success"&&((r=e.data)!=null&&r.previewRoute)?d.jsxs("p",{children:["Preview your changes in ",e.data.previewRoute]}):d.jsx("p",{children:"Preview your changes on the main page"})})]})}function Xt({error:e,path:t}){return d.jsx("div",{id:t,children:d.jsx("div",{className:"p-4 bg-bg-error-primary text-fg-error-primary",children:e})})}function yt({path:e,type:t}){return d.jsx("div",{id:e,className:Ce("pt-6",{"w-full flex items-center justify-center":t==="module","text-left":t!=="module"}),children:d.jsx(Gr,{size:t==="module"?24:16,className:"animate-spin"})})}function Mn({path:e,type:t}){const[n,r]=g.useState(!1);return g.useEffect(()=>{const o=setTimeout(()=>{r(!0)},2e3);return()=>{clearTimeout(o)}},[]),e.length===0?null:n?d.jsx("div",{className:"pt-6",id:e,children:d.jsx("div",{children:"Could not get data"})}):d.jsx(yt,{path:e,type:t})}function kr({actualType:e,expectedType:t,path:n}){return d.jsx("div",{id:n,children:d.jsxs("div",{children:["Schema mismatch: actual: ",e," vs expected: ",t," "]})})}function it({error:e,path:t,schema:n}){const{addPatch:r,patchPath:o}=bn(t);return d.jsxs("div",{id:t,className:"flex justify-between items-center px-2 py-3 rounded-lg bg-bg-error-primary text-fg-primary",children:[d.jsxs("div",{children:["Source error: ",e]}),d.jsxs("div",{className:"flex gap-2 items-center",children:[n&&n.status==="success"&&!(n.data.type==="file"||n.data.type==="image")&&d.jsx(qe,{variant:"outline",className:"hover:bg-bg-error-secondary-hover",onClick:()=>{r([{op:"replace",path:o,value:Il(n.data)}],n.data.type)},children:"Fix"}),d.jsx(Su,{size:16})]})]})}function Yq(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const vy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ed(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ck(e){return"nodeType"in e}function Er(e){var t,n;return e?ed(e)?e:ck(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function uk(e){const{Document:t}=Er(e);return e instanceof t}function fp(e){return ed(e)?!1:e instanceof Er(e).HTMLElement}function NA(e){return e instanceof Er(e).SVGElement}function td(e){return e?ed(e)?e.document:ck(e)?uk(e)?e:fp(e)||NA(e)?e.ownerDocument:document:document:document}const ki=vy?g.useLayoutEffect:g.useEffect;function dk(e){const t=g.useRef(e);return ki(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Jq(){const e=g.useRef(null),t=g.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function gh(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return ki(()=>{n.current!==e&&(n.current=e)},t),n}function hp(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Bg(e){const t=dk(e),n=g.useRef(null),r=g.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function Zb(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let n0={};function pp(e,t){return g.useMemo(()=>{if(t)return t;const n=n0[e]==null?0:n0[e]+1;return n0[e]=n,e+"-"+n},[e,t])}function PA(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+e*c)}return i},{...t})}}const Xc=PA(1),vh=PA(-1);function Xq(e){return"clientX"in e&&"clientY"in e}function fk(e){if(!e)return!1;const{KeyboardEvent:t}=Er(e.target);return t&&e instanceof t}function Zq(e){if(!e)return!1;const{TouchEvent:t}=Er(e.target);return t&&e instanceof t}function Qb(e){if(Zq(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 Xq(e)?{x:e.clientX,y:e.clientY}:null}const yh=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[yh.Translate.toString(e),yh.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),YN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qq(e){return e.matches(YN)?e:e.querySelector(YN)}const eY={display:"none"};function tY(e){let{id:t,value:n}=e;return Ee.createElement("div",{id:t,style:eY},n)}function nY(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={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 Ee.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function rY(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const _A=g.createContext(null);function oY(e){const t=g.useContext(_A);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function iY(){const[e]=g.useState(()=>new Set),t=g.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[g.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const sY={draggable:`
|
|
460
|
+
`)},MG=0,hc=[];function RG(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(MG++)[0],i=g.useState(j2)[0],s=g.useRef(e);g.useEffect(function(){s.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=eG([e.lockRef.current],(e.shards||[]).map(BN),!0).filter(Boolean);return v.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,x){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var b=rm(v),w=n.current,S="deltaX"in v?v.deltaX:w[0]-b[0],C="deltaY"in v?v.deltaY:w[1]-b[1],N,P=v.target,_=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in v&&_==="h"&&P.type==="range")return!1;var O=zN(_,P);if(!O)return!0;if(O?N=_:(N=_==="v"?"h":"v",O=zN(_,P)),!O)return!1;if(!r.current&&"changedTouches"in v&&(S||C)&&(r.current=N),!N)return!0;var M=r.current||N;return jG(M,x,v,M==="h"?S:C,!0)},[]),l=g.useCallback(function(v){var x=v;if(!(!hc.length||hc[hc.length-1]!==i)){var b="deltaY"in x?$N(x):rm(x),w=t.current.filter(function(N){return N.name===x.type&&(N.target===x.target||x.target===N.shadowParent)&&TG(N.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var S=(s.current.shards||[]).map(BN).filter(Boolean).filter(function(N){return N.contains(x.target)}),C=S.length>0?a(x,S[0]):!s.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),c=g.useCallback(function(v,x,b,w){var S={name:v,delta:x,target:b,should:w,shadowParent:AG(b)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),u=g.useCallback(function(v){n.current=rm(v),r.current=void 0},[]),f=g.useCallback(function(v){c(v.type,$N(v),v.target,a(v,e.lockRef.current))},[]),h=g.useCallback(function(v){c(v.type,rm(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return hc.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,fc),document.addEventListener("touchmove",l,fc),document.addEventListener("touchstart",u,fc),function(){hc=hc.filter(function(v){return v!==i}),document.removeEventListener("wheel",l,fc),document.removeEventListener("touchmove",l,fc),document.removeEventListener("touchstart",u,fc)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(i,{styles:OG(o)}):null,p?g.createElement(SG,{gapMode:e.gapMode}):null)}function AG(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const IG=cG(_2,RG);var cp=g.forwardRef(function(e,t){return g.createElement(hy,hi({},e,{ref:t,sideCar:IG}))});cp.classNames=hy.classNames;var YS="Popover",[R2,gge]=So(YS,[ji]),up=ji(),[DG,Va]=R2(YS),A2=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=up(t),l=g.useRef(null),[c,u]=g.useState(!1),[f=!1,h]=Kr({prop:r,defaultProp:o,onChange:i});return d.jsx(tp,{...a,children:d.jsx(DG,{scope:t,contentId:Vr(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:s,children:n})})};A2.displayName=YS;var I2="PopoverAnchor",LG=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Va(I2,n),i=up(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=o;return g.useEffect(()=>(s(),()=>a()),[s,a]),d.jsx(Wu,{...i,...r,ref:t})});LG.displayName=I2;var D2="PopoverTrigger",zg=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Va(D2,n),i=up(n),s=Be(t,o.triggerRef),a=d.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":B2(o.open),...r,ref:s,onClick:ne(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:d.jsx(Wu,{asChild:!0,...i,children:a})});zg.displayName=D2;var JS="PopoverPortal",[FG,zG]=R2(JS,{forceMount:void 0}),L2=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=Va(JS,t);return d.jsx(FG,{scope:t,forceMount:n,children:d.jsx(ln,{present:n||i.open,children:d.jsx(Hu,{asChild:!0,container:o,children:r})})})};L2.displayName=JS;var Nu="PopoverContent",F2=g.forwardRef((e,t)=>{const n=zG(Nu,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=Va(Nu,e.__scopePopover);return d.jsx(ln,{present:r||i.open,children:i.modal?d.jsx($G,{...o,ref:t}):d.jsx(BG,{...o,ref:t})})});F2.displayName=Nu;var $G=g.forwardRef((e,t)=>{const n=Va(Nu,e.__scopePopover),r=g.useRef(null),o=Be(t,r),i=g.useRef(!1);return g.useEffect(()=>{const s=r.current;if(s)return fy(s)},[]),d.jsx(cp,{as:ls,allowPinchZoom:!0,children:d.jsx(z2,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ne(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),BG=g.forwardRef((e,t)=>{const n=Va(Nu,e.__scopePopover),r=g.useRef(!1),o=g.useRef(!1);return d.jsx(z2,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),z2=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,h=Va(Nu,n),p=up(n);return dy(),d.jsx(lp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:d.jsx(Xl,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:d.jsx(np,{"data-state":B2(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),$2="PopoverClose",Al=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Va($2,n);return d.jsx(Oe.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>o.onOpenChange(!1))})});Al.displayName=$2;var VG="PopoverArrow",UG=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=up(n);return d.jsx(rp,{...o,...r,ref:t})});UG.displayName=VG;function B2(e){return e?"open":"closed"}var WG=A2,HG=zg,KG=L2,V2=F2;const br=WG,xo=HG,tr=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>d.jsx(KG,{container:r.container,children:d.jsx(V2,{ref:o,align:t,sideOffset:n,className:fe("z-50 w-72 rounded-md border bg-bg-secondary p-4 text-fg-secondary shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));tr.displayName=V2.displayName;function VN({profile:e,size:t="md"}){var c,u,f;const[n,r]=g.useState(((c=e==null?void 0:e.avatar)==null?void 0:c.url)||null);g.useEffect(()=>{var h,p;(h=e==null?void 0:e.avatar)!=null&&h.url?r((p=e==null?void 0:e.avatar)==null?void 0:p.url):r(null)},[(u=e==null?void 0:e.avatar)==null?void 0:u.url]);const[o,...i]=((f=e.fullName)==null?void 0:f.split(" "))||[""],s=i[i.length-1]||"",a=`${o[0].toUpperCase()}${s[0].toUpperCase()}`,l=Ce("rounded-full text-center inline-block bg-bg-brand-primary text-fg-brand-primary",{"h-8 w-8 leading-8 text-xs":t==="sm","h-10 w-10 leading-10 text-base":t==="md","h-12 w-12 leading-[3rem] text-lg":t==="lg"});return n?d.jsx("img",{src:n,alt:a,className:l,onError:()=>{r(null)}}):d.jsx("span",{className:l,children:a})}function GG(e,t,n,r){if(t[n]===void 0)return console.error(`Get keysOf source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const s=n,a=[],l=(c,u,f)=>{var h;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===s&&(r?typeof f=="string"&&f===r&&(a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c)):a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c));else if(u.type==="object"||u.type==="record"){if(WN(f)||U2(f))for(const p in f){const m=f==null?void 0:f[p],v=u.type==="object"?(h=u.items)==null?void 0:h[p]:u.item;m&&l(UN(c,p),v,m)}}else if(u.type==="array"){if(qG(f)){let p=0;for(const m of f)l(UN(c,p),u.item,m),p++}}else if(u.type==="union"){const p=u.key;if(typeof p=="string"&&WN(f)){const m=f[p];if(typeof m=="string"){const v=u.items.filter(x=>x.type==="object").find(x=>{const b=x.items[p];if((b==null?void 0:b.type)==="literal")return b.value===m});v&&l(c,v,f)}}}else u.type==="string"||u.type==="number"||u.type==="boolean"||u.type==="literal"||u.type==="date"||u.type==="image"||u.type==="file"||u.type==="richtext"||console.error("Could not get keyOf references. Unhandled schema type",u)};for(const c in e){const u=c;l(c,e[u],t[u])}return a}function UN(e,t){return e.includes(ba)?`${e}.${JSON.stringify(t)}`:`${e}${ba}${JSON.stringify(t)}`}function WN(e){return U2(e)}function U2(e){return typeof e=="object"&&!!e&&!Qs(e)}function qG(e){return typeof e=="object"&&!!e&&Qs(e)}function W2(e,t){const n=Ba(),r=ly(),o=FS();return g.useMemo(()=>e!==void 0&&"data"in n&&n.data!==void 0&&n.data[e]!==void 0?GG(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}const HN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,KN=DR,YG=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return KN(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],f=i==null?void 0:i[c];if(u===null)return null;const h=HN(u)||HN(f);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...p}=u;return Object.entries(p).every(m=>{let[v,x]=m;return Array.isArray(x)?x.includes({...i,...a}[v]):{...i,...a}[v]===x})?[...c,f,h]:c},[]);return KN(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},qb=YG("inline-flex items-center justify-center whitespace-nowrap rounded-md text-fg-primary text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:text-fg-disabled disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:fe("cursor-pointer","border border-border-brand-primary","bg-bg-brand-primary text-fg-brand-primary","hover:bg-bg-brand-primary-hover hover:text-fg-brand-primary-hover","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),destructive:fe("cursor-pointer","border border-bg-error-primary","bg-bg-error-primary text-fg-error-primary hover:bg-bg-error-primary-hover disabled:text-fg-error-primary"),outline:fe("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),secondary:fe("cursor-pointer","border border-border-secondary","bg-bg-secondary text-fg-secondary hover:bg-bg-secondary-hover"),ghost:fe("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary","hover:bg-bg-secondary-hover hover:text-fg-secondary"),link:fe("cursor-pointer","border border-transparent","text-fg-primary underline-offset-4 hover:underline")},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),qe=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?ls:"button";return d.jsx(s,{className:fe(qb({variant:t,size:n,className:e})),ref:i,...o})});qe.displayName="Button";function JG({path:e,disabled:t}){const[n,r]=Y.splitModuleFilePathAndModulePath(e),o=Y.splitModuleFilePath(n),i=Y.splitModulePath(r),{navigate:s}=xn();return d.jsxs("div",{className:"w-full",children:[d.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>d.jsxs(g.Fragment,{children:[l===0&&d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Ce({"text-muted":!(i.length===0&&l===o.length-1)}),children:Eu(a)}),l>0&&l<o.length-1&&d.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),d.jsx("button",{type:"button",disabled:t,title:Y.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(Y.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>d.jsxs(g.Fragment,{children:[d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Ce({"text-muted":l===i.length-2}),children:Eu(a)})]},`${a}-${l}`))})]})}function H2({path:e,parentPath:t,variant:n,refs:r,children:o,size:i,onComplete:s,confirmationMessage:a,className:l}){const c=In();return d.jsxs(br,{children:[d.jsx(xo,{asChild:!0,children:d.jsx(qe,{size:i,variant:n,className:l,children:o})}),d.jsxs(tr,{container:c,className:"flex flex-col gap-2 p-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:a}),d.jsx(Al,{asChild:!0,children:d.jsx(XG,{path:e,parentPath:t,refs:r,variant:"destructive",onComplete:s,children:d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(US,{size:12}),d.jsx("span",{children:"Delete"})]})})})]})]})}function XG({path:e,parentPath:t,variant:n,refs:r,children:o,size:i,onComplete:s}){const{navigate:a}=xn(),{addPatch:l,patchPath:c}=bn(e),u=lt(t,"record");return!("data"in u)||u.data===void 0||u.data===null?(console.error("Parent source not found",u,{path:e}),null):d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{size:i,variant:n,disabled:r.length>0,onClick:()=>{l([{op:"remove",path:c}],"record"),a(t),s&&s()},children:o})}),d.jsx(fr,{side:"top",children:r.length>0?d.jsxs("div",{children:[d.jsx("p",{children:"Cannot delete record."}),d.jsxs("p",{children:["You must change the following references"," ",d.jsx(l2,{size:10,className:"inline"})," to be able to delete:"]}),d.jsx("ul",{children:r.map(f=>d.jsx("li",{children:d.jsx(JG,{path:f})},f))})]}):d.jsx("p",{children:"Delete record"})})]})}function Il(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,Il(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?Il(e.items[0]):e.key.value;if(e.type==="date")return ps(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}const Zu=g.forwardRef(({className:e,type:t,...n},r)=>d.jsx("input",{type:t,className:fe("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Zu.displayName="Input";function ZG(e,t){const n={},r=t==null?void 0:t.split("/");(r==null?void 0:r[0])===""&&r.shift();const o=(r==null?void 0:r.filter(s=>s!==""))||[];let i=0;for(let s=0;s<e.length;s++){const a=e[s];if(a.type==="literal"){const l=o[i];if(!l)return{status:"error",message:`Missing required literal part: ${a.name}`};if(a.name!==l)return{status:"error",message:`Invalid path part: expected "${a.name}", got "${l}"`};i++}else if(a.type==="string-param"){const l=o[i];if(!l){if(a.optional)continue;return{status:"error",message:`Missing required parameter: ${a.paramName}`}}n[a.paramName]=l,i++}else if(a.type==="array-param"){const l=o.slice(i);if(l.length===0){if(a.optional)continue;return{status:"error",message:`Missing required catch-all parameter: ${a.paramName}`}}n[a.paramName]=l,i+=l.length}}return i<o.length?{status:"error",message:`Extra path parts found: ${o.slice(i).join("/")}`}:{status:"success",params:n}}function K2({routePattern:e,existingKeys:t,onSubmit:n,submitText:r,defaultParams:o,onCancel:i,defaultValue:s}){const[a,l]=g.useState({});g.useEffect(()=>{o&&l(o)},[o]);const[c,u]=g.useState({});g.useEffect(()=>{if(s){const m=ZG(e,s);m.status==="success"&&l(m.params)}},[s,e]);const f=g.useMemo(()=>"/"+e.map(m=>{if(m.type==="string-param"||m.type==="array-param"){const v=a[m.paramName];return Array.isArray(v)?v.join("/"):v}return m.name}).join("/"),[e,a]),p=!g.useMemo(()=>e.every(m=>m.type==="string-param"||m.type==="array-param"?!!a[m.paramName]&&!c[m.paramName]:!0),[e,a,c])||f in t;return d.jsxs("form",{className:"p-4 space-y-3",onSubmit:m=>{m.preventDefault(),n(f)},children:[d.jsx("div",{className:"flex items-center",children:e.map((m,v)=>d.jsx("span",{className:"truncate",children:m.type==="string-param"||m.type==="array-param"?d.jsxs("span",{className:"flex items-center",children:[d.jsx("span",{children:"/"}),d.jsxs("span",{className:"flex flex-col",children:[d.jsx("input",{className:fe("p-1 bg-transparent border-0 max-w-[10ch]",{"border-border-secondary border-1":c[m.paramName]}),placeholder:m.paramName,value:QG(a,m.paramName),onChange:x=>{l({...a,[m.paramName]:x.target.value});const b=m.type==="string-param"?x.target.value:x.target.value.replace(/\//g,"");encodeURIComponent(b)!==b?u({...c,[m.paramName]:"Invalid characters"}):u({...c,[m.paramName]:void 0})}}),c[m.paramName]&&d.jsx("span",{className:"text-xs text-fg-error-secondary",children:c[m.paramName]})]})]}):d.jsxs("span",{className:"text-fg-secondary",children:["/",m.name]})},v))}),d.jsxs("div",{className:"flex gap-4",children:[d.jsx(qe,{disabled:p,children:r}),d.jsx(qe,{variant:"ghost",type:"reset",onClick:i,children:"Cancel"})]})]})}function QG(e,t){const n=e[t];return Array.isArray(n)?n.join("/"):n||""}function G2({path:e,size:t,variant:n,children:r,open:o,setOpen:i,defaultOpen:s,routePattern:a}){const l=lt(e,"record"),c=Ft(e),u=In(),{addPatch:f}=bn(e),{navigate:h}=xn(),[p,m]=g.useState(s??!1);g.useEffect(()=>{o!==void 0&&m(o)},[o]),g.useEffect(()=>{i!==void 0&&i(p)},[p,i]),g.useEffect(()=>{s!==void 0&&m(s)},[s]);const v=g.useCallback(S=>{const C="data"in c?c.data:null;if(C===null||C.type!=="record")return;const N=Y.createPatchPath(w).concat(S);f([{op:"add",path:N,value:Il(C.item)}],"record"),h(Y.joinModuleFilePathAndModulePath(b,Y.patchPathToModulePath(N))),m(!1)},[f,h,c,e]);if(!("data"in l)||l.data===void 0||l.data===null)return console.error("Source not found",l,{path:e}),null;if(!("data"in c)||c.data===void 0)return console.error("Schema not found",l,{path:e}),null;if(c.data.type!=="record")return console.error("Schema is not a record",c,{path:e}),null;const[b,w]=Y.splitModuleFilePathAndModulePath(e);return d.jsxs(br,{open:p,onOpenChange:m,children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(xo,{onClick:()=>{m(!0)},asChild:!0,children:d.jsx(qe,{size:t,variant:n,children:r})})}),d.jsx(fr,{children:d.jsx("p",{children:"Add"})})]}),d.jsx(tr,{container:u,children:a?d.jsx(K2,{routePattern:a,existingKeys:Object.keys(l.data),onSubmit:v,onCancel:()=>{m(!1)},submitText:"Create"}):d.jsx(eq,{existingKeys:Object.keys(l.data),onSubmit:v})})]})}function eq({existingKeys:e,onSubmit:t}){const[n,r]=g.useState(""),o=n===""||n in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:i=>{i.preventDefault(),t(n)},children:[d.jsx(Zu,{autoFocus:!0,value:n,onChange:i=>{r(i.target.value)}}),d.jsx("div",{children:d.jsx(qe,{type:"submit",disabled:o,variant:"outline",children:"Add"})})]})}function tq({existingKeys:e,defaultValue:t,onCancel:n,onSubmit:r}){const[o,i]=g.useState(t),s=o===t||o===""||o in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:a=>{a.preventDefault(),r(o)},children:[d.jsx(Zu,{type:"text",value:o,onChange:a=>{i(a.target.value)}}),d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(qe,{disabled:s,variant:"outline",type:"submit",children:"Update"}),d.jsx(qe,{variant:"ghost",type:"reset",onClick:()=>{n(),i(t)},children:"Cancel"})]})]})}function q2({defaultValue:e,path:t,parentPath:n,variant:r,existingKeys:o,routePattern:i,size:s,children:a,onComplete:l}){const{navigate:c}=xn(),[u,f]=g.useState(!1),h=In();g.useEffect(()=>{const S=C=>{C.key==="Escape"&&f(!1)};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}},[]);const{addPatch:p,addModuleFilePatch:m}=bn(t),[v,x]=Y.splitModuleFilePathAndModulePath(n),b=Y.createPatchPath(x),w=g.useCallback(S=>{const C=[{op:"move",from:b.concat(e),path:b.concat(S)}];p(C,"record");for(const P of o){const[_,O]=Y.splitModuleFilePathAndModulePath(P),M=Y.createPatchPath(O);m(_,[{op:"replace",path:M,value:S}],"record")}const N=Y.joinModuleFilePathAndModulePath(v,Y.patchPathToModulePath(b.concat(S)));c(N,{replace:!0}),l&&l()},[p,m,v,b,c,l]);return d.jsxs(br,{open:u,children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{asChild:!0,size:s,variant:r,children:d.jsx(xo,{onClick:()=>{f(!0)},children:a})})}),d.jsx(fr,{side:"top",children:"Rename record"})]}),d.jsx(tr,{container:h,className:"text-fg-primary",children:i?d.jsx(K2,{routePattern:i,existingKeys:o,defaultValue:e,onSubmit:S=>{w(S),f(!1)},onCancel:()=>{f(!1)},submitText:"Update"}):d.jsx(tq,{parentPath:n,defaultValue:e,existingKeys:o,onSubmit:S=>{w(S),f(!1)},onCancel:()=>{f(!1)}})})]})}function nq({moduleFilePaths:e}){const t=JR(e,"record"),n=XR(),r=g.useMemo(()=>{const o=[];if(n.status!=="success")return n;if(n.data===null)return{status:"error",error:"No src folder found"};if(t.status!=="success")return t.status==="not-found"?{status:"error",error:"No data found"}:t.status==="error"?{status:"error",error:`Failed to load ${Object.keys(t.errors).length} modules: ${Object.entries(t.errors).map(([a,l])=>`"${a}": ${l.message}`).join(", ")}`}:t;for(const s of t.data||[])for(const a in s){const[l]=Y.splitModuleFilePathAndModulePath(s[a]);o.push({urlPath:a,moduleFilePath:l})}const i=R8(n.data,o);return{status:t.status,data:i}},[t,n]);return r.status==="loading"||r.status==="not-asked"?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(Gr,{size:16,className:"animate-spin"})}):r.status==="error"?(console.error("Sitemap errors",r.error),null):d.jsx(Y2,{node:r.data})}function Y2({node:e}){var m;const t=In(),{currentSourcePath:n}=xn(),[r,o]=g.useState(!0),{navigate:i}=xn(),[s,a]=g.useState(!1),[l,c]=g.useState(!1),u=g.useMemo(()=>{var v;return!!((v=e.sourcePath)!=null&&v.startsWith(n))},[n,e.sourcePath]),f=g.useMemo(()=>{if(!e.pattern)return;const v=DM(e.pattern);if(v.some(x=>x.type==="string-param"||x.type==="array-param"))return v},[e.pattern]),h=g.useCallback(()=>{var v;e.sourcePath?i(e.sourcePath):e.type==="node"&&((v=e.children)==null?void 0:v.length)>0&&o(x=>!x)},[i,e]),p=e.moduleFilePath;return d.jsxs("div",{children:[d.jsxs("div",{className:"relative flex items-center justify-between w-full h-10 group",children:[d.jsxs("div",{className:"flex items-center my-1",children:[d.jsx("button",{onClick:()=>o(!r),className:fe("hidden h-4 w-4 mr-2",{block:((m=e.children)==null?void 0:m.length)>0}),children:d.jsx(Xu,{size:16,className:fe("transform",{"rotate-90":r})})}),d.jsx("span",{children:e.sourcePath?d.jsxs("button",{onClick:h,className:fe("flex items-center gap-1",{}),children:[e.name==="/"?d.jsx(Z7,{size:14}):e.type==="leaf"||e.type==="node"&&e.page?d.jsx(r2,{size:14}):null,d.jsxs("span",{children:[e.name==="/"&&d.jsx("span",{className:"ml-2 text-fg-primary-alt",children:"Main page"}),e.name!=="/"&&d.jsx("span",{className:fe({underline:u}),children:e.name})]})]}):d.jsxs("button",{onClick:h,className:fe("flex items-center gap-1",{}),children:[d.jsx(oK,{size:14}),d.jsx("span",{children:d.jsx("span",{children:e.name})})]})})]}),d.jsxs("div",{className:fe("absolute right-0 top-0 items-center group-hover:flex h-10 bg-bg-primary",{hidden:!s&&!l,flex:s||l}),children:[e.sourcePath&&d.jsx(qe,{size:"sm",variant:"ghost",onClick:h,className:"flex items-center gap-2",children:d.jsx(BS,{size:12})}),(e.sourcePath||e.type==="leaf"||e.page)&&d.jsxs(br,{onOpenChange:a,open:s,children:[d.jsx(xo,{asChild:!0,children:d.jsx(qe,{size:"sm",variant:"ghost",children:d.jsx($S,{size:12})})}),d.jsx(tr,{container:t,children:d.jsx(rq,{node:e,routePatternWithParams:f,onClose:()=>a(!1)})})]}),f&&p&&d.jsx(G2,{path:p,size:"sm",variant:"ghost",open:l,setOpen:c,routePattern:f,children:d.jsx(VS,{size:12})})]})]}),d.jsx(ku,{isOpen:r,className:"pl-3",children:e.children.map((v,x)=>d.jsx(Y2,{node:v},x))})]})}function rq({node:e,onClose:t,routePatternWithParams:n}){const r=g.useMemo(()=>{var s;return e.type==="leaf"?e.fullPath:(s=e.page)==null?void 0:s.fullPath},[e]),o=g.useMemo(()=>e.sourcePath?Y.splitModuleFilePathAndModulePath(e.sourcePath)[0]:void 0,[e==null?void 0:e.sourcePath]),i=W2(o,r);return d.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[o&&e.sourcePath&&d.jsx(H2,{path:e.sourcePath,parentPath:o,refs:i,size:"sm",variant:"ghost",onComplete:t,confirmationMessage:`This will delete the ${r} page.`,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(US,{size:14}),d.jsx("span",{children:"Delete"})]})}),r!==void 0&&e.sourcePath&&o&&d.jsx(q2,{variant:"ghost",size:"sm",existingKeys:i,path:e.sourcePath,defaultValue:r,routePattern:n,parentPath:o,onComplete:t,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(vK,{size:12}),d.jsx("span",{children:"Rename"})]})})]})}function oq(e){const t={"/":{name:"/",fullPath:"/",isDirectory:!0,children:[]}};for(const n of e){const r=n.split("/");if(r[0]!=="")throw new Error("Expected path to start with '/'");for(let o=1;o<r.length;o++){const i=r.slice(0,o).join("/"),s=[i,r[o]].join("/"),a=r[o];if(!a)throw new Error("Expected name to be non-empty");if(!t[s]){const l={name:a,fullPath:s,children:[]};o<r.length-1&&(l.isDirectory=!0),t[s]=l,t[i||"/"].children.push(t[s])}}}return t["/"]}function iq(){const e=Ba();return g.useMemo(()=>{if(e.status==="success"){const t=[],n={};for(const r in e.data){const o=r,i=e.data[o];i.type==="record"&&i.router?(n[i.router]=n[i.router]||[],n[i.router].push(o)):t.push(o)}return{status:e.status,data:{root:oq(t),sitemap:n}}}return e},[e])}const J2=1280;function sq(){const e=Gu(),[t,n]=g.useState(""),[r,o]=g.useState("");g.useEffect(()=>{async function w(){let S=!1;const C=async N=>{if(!S)try{(await fetch(N)).ok&&(S=!0,n(N))}catch{}};await C("/favicon.ico"),await C("/favicon.svg"),await C("/favicon.png"),await C("/apple-touch-icon.png"),await C("https://valbuild.com/favicon.ico")}if(w(),e!=null&&e.project)o(e.project);else try{let S=new URL(location.origin).hostname;if(S!=="localhost"){const C=S.split(".");C.length>=2&&(S=C.slice(1,-1).join(".")),o(wf(S))}else o("Dev mode")}catch{o("Studio")}},[JSON.stringify(e)]);const i=Ba(),s=In(),{theme:a,setTheme:l}=ay(),{navMenu:c}=Jy(),u=iq(),f=(e==null?void 0:e.appHost)||Nb,[h,p]=r.split("/"),m=F7(),v=`${f}/orgs/${h}`,x=`${f}/orgs/${h}/members`,b=`${v}/projects/${p}`;return d.jsxs("nav",{className:"relative min-h-[100svh] bg-bg-primary",children:[d.jsxs("div",{className:"flex gap-4 justify-between items-center p-4 pr-6 h-16 border-b border-border-primary",children:[d.jsxs("div",{className:"flex gap-4 items-center",children:[t?d.jsx("img",{src:t,alt:"",className:"w-4 h-4"}):d.jsx("div",{className:"w-4 h-4"}),h&&p?d.jsx("a",{className:"truncate hover:underline",href:b,children:r}):d.jsx("span",{className:"truncate",children:r})]}),d.jsx("button",{className:"lg:hidden",onClick:()=>{c.setOpen(!c.isOpen)},children:d.jsx(Ag,{size:16,className:Ce("transform",{"rotate-180":!c.isOpen})})})]}),"data"in i&&d.jsx("div",{className:Ce("py-4 pl-2",{}),children:d.jsxs(hr,{children:[d.jsx("div",{className:"max-h-[calc(100svh-32px-64px-32px-16px)] max-w-[320px] px-2",children:"data"in u?d.jsxs(d.Fragment,{children:[d.jsx(lq,{title:"Site map",defaultOpen:!0,sitemap:u.data.sitemap}),d.jsx(aq,{title:"Explorer",defaultOpen:!0,node:u.data.root})]}):u.status==="loading"?d.jsx(cq,{}):null}),d.jsx(qS,{orientation:"horizontal"})]})}),d.jsx("div",{className:"p-4 h-6"}),d.jsx("div",{className:"absolute bottom-0 left-0 w-full",children:d.jsxs(br,{children:[d.jsxs(xo,{className:"flex items-center justify-between w-full p-4 border-t border-border-primary hover:bg-bg-secondary data-[state=open]:bg-bg-secondary",children:[d.jsx("span",{children:m&&d.jsx(VN,{size:"sm",profile:m})}),d.jsx($S,{size:16})]}),d.jsx(tr,{className:"p-0 py-2",container:s,side:"top",children:d.jsxs("div",{className:"flex flex-col gap-2 justify-between items-center",children:[m&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex gap-2 items-center px-4 py-2 w-full",children:[d.jsx(VN,{size:"sm",profile:m}),d.jsxs("div",{className:"text-sm",children:[d.jsx("div",{className:"truncate",children:m.fullName}),m.email&&d.jsx("div",{className:"font-light truncate",children:m.email})]})]}),d.jsx("hr",{className:"mb-1 w-full h-1 border-t border-border-primary"})]}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[a==="dark"?d.jsx(pK,{size:"1rem"}):d.jsx(kK,{size:"1rem"}),d.jsx("button",{className:"",onClick:()=>{l(a==="dark"?"light":"dark")},children:a==="dark"?d.jsx("span",{className:"text-sm",children:"Dark mode"}):d.jsx("span",{className:"text-sm",children:"Light mode"})})]}),m&&d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(jK,{size:"1rem"}),d.jsx("a",{href:x,children:d.jsx("span",{className:"text-sm truncate",children:"Manage members"})})]}),m&&d.jsxs(d.Fragment,{children:[d.jsx("hr",{className:"mt-1 mb-1 w-full h-1 border-t border-border-primary"}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(fK,{size:"1rem"}),d.jsx("a",{href:gu("/api/val/logout",{redirect_to:`${window.location.origin}`}),children:d.jsx("span",{className:"text-sm",children:"Log out"})})]})]})]})})]})})]})}function aq({title:e,defaultOpen:t,node:n}){return!n||(n==null?void 0:n.children.length)===0?null:d.jsx(X2,{icon:d.jsx(Ig,{size:16}),title:e,defaultOpen:t,children:n.children.sort(Z2).map((r,o)=>g.createElement(Q2,{...r,name:r.name,key:o,root:!0}))})}function X2({title:e,children:t,defaultOpen:n,icon:r}){const[o,i]=g.useState(n??!0);return d.jsxs("div",{className:"py-2",children:[d.jsxs("button",{className:"flex justify-between items-center py-2 w-full text-sm tracking-tighter uppercase text-fg-secondary",onClick:()=>{i(!o)},children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[r,e]}),d.jsx(Xu,{size:16,className:Ce("transform",{"rotate-90":o})})]}),d.jsx(ku,{isOpen:o,className:"pr-1",children:t})]})}function lq({title:e,defaultOpen:t,sitemap:n}){const r=n["next-app-router"];return r?d.jsx(X2,{title:e,defaultOpen:t,icon:d.jsx(Rg,{size:16}),children:d.jsx(nq,{moduleFilePaths:r})}):null}function cq(){return d.jsx("div",{className:"flex justify-start items-center w-full h-full",children:d.jsx(Gr,{size:16,className:"animate-spin"})})}function Z2(e,t){return e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name)}function Q2({name:e,fullPath:t,isDirectory:n,children:r,root:o}){const{navigate:i,currentSourcePath:s}=xn(),{navMenu:a}=Jy(),[l,c]=g.useState(!0),u=Ql()||{},f=g.useMemo(()=>{let x=!1;for(const b in u)if(b.startsWith(t)){x=!0;break}return x},[u,t]),h=g.useMemo(()=>{if(n){if(!l)return f}else if(!n)return f;return!1},[f,l,n]),p=t,m=Ft(p),v="data"in m?m.data.type:"loading";return d.jsxs("div",{className:"w-full text-sm",children:[d.jsxs("button",{className:Ce("relative flex items-center justify-between w-full ",{"py-2":o,"p-2":!o,underline:s.startsWith(p)&&!n,"font-bold":s.startsWith(p)&&n}),onClick:()=>{n?c(!l):(window.innerWidth<J2&&a.setOpen(!1),i(p))},children:[d.jsxs("div",{className:"flex items-center pr-2",children:[n?d.jsx(Xu,{size:16,className:Ce("transform mr-2",{"rotate-90":l,hidden:!r.length})}):d.jsx(uq,{type:v,size:14}),d.jsx("span",{children:Eu(e)})]}),h&&d.jsx("div",{className:"ml-2 w-2 h-2 rounded-full bg-bg-error-secondary"})]}),d.jsx("div",{className:"pl-2",children:d.jsx(ku,{isOpen:l,children:r.sort(Z2).map((x,b)=>g.createElement(Q2,{...x,key:b}))})})]})}function uq({size:e,type:t}){if(t==="loading")return d.jsx(Gr,{size:e,className:"mr-2 animate-spin"});switch(t){case"string":return d.jsx(PK,{size:e,className:"mr-2"});case"number":return d.jsx(sK,{size:e,className:"mr-2"});case"boolean":return d.jsx(CK,{size:e,className:"mr-2"});case"object":return d.jsx(cK,{size:e,className:"mr-2"});case"literal":return d.jsx(X7,{size:e,className:"mr-2"});case"array":return d.jsx(s2,{size:e,className:"mr-2"});case"union":return d.jsx(yK,{size:e,className:"mr-2"});case"richtext":return d.jsx(r2,{size:e,className:"mr-2"});case"record":return d.jsx(EK,{size:e,className:"mr-2"});case"keyOf":return d.jsx(lK,{size:e,className:"mr-2"});case"file":return d.jsx(o2,{size:e,className:"mr-2"});case"date":return d.jsx(n2,{size:e,className:"mr-2"});case"image":return d.jsx(i2,{size:e,className:"mr-2"});default:return d.jsx(Y7,{size:e,className:"mr-2"})}}function XS(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ZS="Checkbox",[dq,vge]=So(ZS),[fq,hq]=dq(ZS),eA=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...f}=e,[h,p]=g.useState(null),m=Be(t,C=>p(C)),v=g.useRef(!1),x=h?u||!!h.closest("form"):!0,[b=!1,w]=Kr({prop:o,defaultProp:i,onChange:c}),S=g.useRef(b);return g.useEffect(()=>{const C=h==null?void 0:h.form;if(C){const N=()=>w(S.current);return C.addEventListener("reset",N),()=>C.removeEventListener("reset",N)}},[h,w]),d.jsxs(fq,{scope:n,state:b,disabled:a,children:[d.jsx(Oe.button,{type:"button",role:"checkbox","aria-checked":da(b)?"mixed":b,"aria-required":s,"data-state":rA(b),"data-disabled":a?"":void 0,disabled:a,value:l,...f,ref:m,onKeyDown:ne(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:ne(e.onClick,C=>{w(N=>da(N)?!0:!N),x&&(v.current=C.isPropagationStopped(),v.current||C.stopPropagation())})}),x&&d.jsx(pq,{control:h,bubbles:!v.current,name:r,value:l,checked:b,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"},defaultChecked:da(i)?!1:i})]})});eA.displayName=ZS;var tA="CheckboxIndicator",nA=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=hq(tA,n);return d.jsx(ln,{present:r||da(i.state)||i.state===!0,children:d.jsx(Oe.span,{"data-state":rA(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});nA.displayName=tA;var pq=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=g.useRef(null),a=XS(n),l=CS(t);g.useEffect(()=>{const u=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&p){const m=new Event("click",{bubbles:r});u.indeterminate=da(n),p.call(u,da(n)?!1:n),u.dispatchEvent(m)}},[a,n,r]);const c=g.useRef(da(n)?!1:n);return d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??c.current,...i,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function da(e){return e==="indeterminate"}function rA(e){return da(e)?"indeterminate":e?"checked":"unchecked"}var oA=eA,mq=nA;const Qu=g.forwardRef(({className:e,...t},n)=>{const[r,o]=g.useState();return g.useEffect(()=>{o(t.checked)},[t.checked]),d.jsx(oA,{ref:n,checked:r,onCheckedChange:i=>{o(i),t.onCheckedChange&&t.onCheckedChange(i)},className:fe("peer h-4 w-4 shrink-0 rounded-sm bg-bg-primary border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-bg-primary data-[state=checked]:text-fg-primary",e),...t,children:d.jsxs(mq,{className:fe("flex items-center justify-center text-current"),children:[r===!0&&d.jsx(Yu,{size:12}),r==="indeterminate"&&d.jsx(hK,{size:12})]})})});Qu.displayName=oA.displayName;function jm(e,t){const n=new Date(t).getTime(),r=e.getTime(),o=Math.floor((r-n)/1e3),i=Math.floor(o/60),s=Math.floor(o/3600),a=Math.floor(o/86400),l=Math.floor(a/30);return o<60?"just now":i<60?`${i}m ago`:s<24?`${s}h ago`:a===1?"yesterday":a<30?`${a}d ago`:`${l}mo ago`}function iA({onPublish:e,onClose:t}){const[n,r]=g.useState(null),o=ip(),{summary:i,canGenerate:s,setSummary:a,publishDisabled:l,generateSummary:c}=sp(),[u,f]=g.useState(!1),h=()=>{f(!1),i.type!=="not-asked"&&a({...i})};g.useEffect(()=>{i.type!=="not-asked"&&!i.isGenerating&&!xu(i.patchIds,o)&&f(!0)},[i,o]);const p=g.useCallback(()=>{h(),c().then(x=>{x.type==="ai"?a({type:"ai",text:x.text.trim()}):r(x.message)})},[h,c,a,r]),m="w-full p-2 border rounded bg-bg-secondary",v="text"in i?i.text:"";return d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[d.jsx("span",{className:"font-semibold",children:"Summary"}),s&&d.jsx(GN,{onClick:p,isGenerating:i.isGenerating})]}),n&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:n}),d.jsxs("div",{className:"grid text-xs font-light",children:[d.jsx("div",{"aria-hidden":!0,className:fe(m,"invisible whitespace-pre-wrap"),style:{gridArea:"1 / 1 / 2 / 2"},children:v+" "}),d.jsx("textarea",{disabled:!!i.isGenerating,className:fe(m,"resize-none overflow-clip disabled:opacity-50"),value:v,style:{gridArea:"1 / 1 / 2 / 2"},placeholder:"Write a summary of your changes"+(s?" or generate one using AI":""),onChange:x=>{h(),a({type:"manual",text:x.currentTarget.value})}})]}),d.jsxs("div",{className:fe("p-2 text-xs flex-grow font-light bg-bg-warning-primary text-[black] rounded flex items-center","flex justify-between w-full gap-2 py-2",{hidden:!u}),"aria-hidden":u,children:[d.jsx("span",{children:"Summary might be outdated. "}),d.jsx("button",{className:"underline",onClick:h,children:"Dismiss"})]}),d.jsx("div",{className:"flex items-center justify-end gap-2",children:e?d.jsxs(d.Fragment,{children:[d.jsx(qe,{variant:"outline",onClick:()=>{t()},children:"Close"}),u&&s&&d.jsx(GN,{isGenerating:i.isGenerating,onClick:p}),!u&&d.jsxs(qe,{disabled:l||v.trim()==="",onClick:()=>{i.type!=="not-asked"&&e()},variant:"default",className:"flex items-center gap-2",children:[d.jsxs("span",{children:[" ",l?"Pushing...":"Publish"]}),d.jsx(Dg,{size:16})]})]}):d.jsx(d.Fragment,{children:d.jsx(qe,{variant:"outline",onClick:()=>{t()},children:"Close"})})})]})}function GN({isGenerating:e,onClick:t}){return d.jsx(qe,{className:"truncate",disabled:!!e,onClick:()=>{t()},variant:"outline",children:d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx("span",{children:e?"Generating...":"Generate"}),d.jsx(a2,{size:16})]})})}function gq(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:p,...m}=f,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return d.jsx(v.Provider,{value:x,children:p})}function u(f,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,vq(o,...t)]}function vq(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function py(e){const t=e+"CollectionProvider",[n,r]=gq(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:m,children:v}=p,x=Ee.useRef(null),b=Ee.useRef(new Map).current;return d.jsx(o,{scope:m,itemMap:b,collectionRef:x,children:v})};s.displayName=t;const a=e+"CollectionSlot",l=Ee.forwardRef((p,m)=>{const{scope:v,children:x}=p,b=i(a,v),w=Be(m,b.collectionRef);return d.jsx(ls,{ref:w,children:x})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",f=Ee.forwardRef((p,m)=>{const{scope:v,children:x,...b}=p,w=Ee.useRef(null),S=Be(m,w),C=i(c,v);return Ee.useEffect(()=>(C.itemMap.set(w,{ref:w,...b}),()=>void C.itemMap.delete(w))),d.jsx(ls,{[u]:"",ref:S,children:x})});f.displayName=c;function h(p){const m=i(e+"CollectionConsumer",p);return Ee.useCallback(()=>{const x=m.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((C,N)=>b.indexOf(C.ref.current)-b.indexOf(N.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}var QS="Collapsible",[yq,sA]=So(QS),[xq,ek]=yq(QS),aA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,c]=Kr({prop:r,defaultProp:o,onChange:s});return d.jsx(xq,{scope:n,disabled:i,contentId:Vr(),open:l,onOpenToggle:g.useCallback(()=>c(u=>!u),[c]),children:d.jsx(Oe.div,{"data-state":nk(l),"data-disabled":i?"":void 0,...a,ref:t})})});aA.displayName=QS;var lA="CollapsibleTrigger",cA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ek(lA,n);return d.jsx(Oe.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":nk(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ne(e.onClick,o.onOpenToggle)})});cA.displayName=lA;var tk="CollapsibleContent",uA=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ek(tk,e.__scopeCollapsible);return d.jsx(ln,{present:n||o.open,children:({present:i})=>d.jsx(bq,{...r,ref:t,present:i})})});uA.displayName=tk;var bq=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=ek(tk,n),[a,l]=g.useState(r),c=g.useRef(null),u=Be(t,c),f=g.useRef(0),h=f.current,p=g.useRef(0),m=p.current,v=s.open||a,x=g.useRef(v),b=g.useRef();return g.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),On(()=>{const w=c.current;if(w){b.current=b.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const S=w.getBoundingClientRect();f.current=S.height,p.current=S.width,x.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),l(r)}},[s.open,r]),d.jsx(Oe.div,{"data-state":nk(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...i,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:v&&o})});function nk(e){return e?"open":"closed"}var wq=aA,Sq=cA,kq=uA,ms="Accordion",Eq=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[rk,Cq,Nq]=py(ms),[my,yge]=So(ms,[Nq,sA]),ok=sA(),dA=Ee.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return d.jsx(rk.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?d.jsx(Tq,{...i,ref:t}):d.jsx(jq,{...o,ref:t})})});dA.displayName=ms;var[fA,Pq]=my(ms),[hA,_q]=my(ms,{collapsible:!1}),jq=Ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...s}=e,[a,l]=Kr({prop:n,defaultProp:r,onChange:o});return d.jsx(fA,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:Ee.useCallback(()=>i&&l(""),[i,l]),children:d.jsx(hA,{scope:e.__scopeAccordion,collapsible:i,children:d.jsx(pA,{...s,ref:t})})})}),Tq=Ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[s=[],a]=Kr({prop:n,defaultProp:r,onChange:o}),l=Ee.useCallback(u=>a((f=[])=>[...f,u]),[a]),c=Ee.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return d.jsx(fA,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:c,children:d.jsx(hA,{scope:e.__scopeAccordion,collapsible:!0,children:d.jsx(pA,{...i,ref:t})})})}),[Oq,gy]=my(ms),pA=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...s}=e,a=Ee.useRef(null),l=Be(a,t),c=Cq(n),f=ap(o)==="ltr",h=ne(e.onKeyDown,p=>{var O;if(!Eq.includes(p.key))return;const m=p.target,v=c().filter(M=>{var D;return!((D=M.ref.current)!=null&&D.disabled)}),x=v.findIndex(M=>M.ref.current===m),b=v.length;if(x===-1)return;p.preventDefault();let w=x;const S=0,C=b-1,N=()=>{w=x+1,w>C&&(w=S)},P=()=>{w=x-1,w<S&&(w=C)};switch(p.key){case"Home":w=S;break;case"End":w=C;break;case"ArrowRight":i==="horizontal"&&(f?N():P());break;case"ArrowDown":i==="vertical"&&N();break;case"ArrowLeft":i==="horizontal"&&(f?P():N());break;case"ArrowUp":i==="vertical"&&P();break}const _=w%b;(O=v[_].ref.current)==null||O.focus()});return d.jsx(Oq,{scope:n,disabled:r,direction:o,orientation:i,children:d.jsx(rk.Slot,{scope:n,children:d.jsx(Oe.div,{...s,"data-orientation":i,ref:l,onKeyDown:r?void 0:h})})})}),$g="AccordionItem",[Mq,ik]=my($g),sk=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=gy($g,n),s=Pq($g,n),a=ok(n),l=Vr(),c=r&&s.value.includes(r)||!1,u=i.disabled||e.disabled;return d.jsx(Mq,{scope:n,open:c,disabled:u,triggerId:l,children:d.jsx(wq,{"data-orientation":i.orientation,"data-state":yA(c),...a,...o,ref:t,disabled:u,open:c,onOpenChange:f=>{f?s.onItemOpen(r):s.onItemClose(r)}})})});sk.displayName=$g;var mA="AccordionHeader",gA=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=gy(ms,n),i=ik(mA,n);return d.jsx(Oe.h3,{"data-orientation":o.orientation,"data-state":yA(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});gA.displayName=mA;var Yb="AccordionTrigger",ak=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=gy(ms,n),i=ik(Yb,n),s=_q(Yb,n),a=ok(n);return d.jsx(rk.ItemSlot,{scope:n,children:d.jsx(Sq,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...a,...r,ref:t})})});ak.displayName=Yb;var vA="AccordionContent",lk=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=gy(ms,n),i=ik(vA,n),s=ok(n);return d.jsx(kq,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...s,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});lk.displayName=vA;function yA(e){return e?"open":"closed"}var xA=dA,Rq=sk,Aq=gA,bA=ak,wA=lk;const Dl=xA,_a=g.forwardRef(({className:e,...t},n)=>d.jsx(Rq,{ref:n,className:fe("border-b",e),...t}));_a.displayName="AccordionItem";const Ll=g.forwardRef(({className:e,children:t,...n},r)=>d.jsx(Aq,{className:"flex",children:d.jsxs(bA,{ref:r,className:fe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,d.jsx(Ju,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));Ll.displayName=bA.displayName;const ja=g.forwardRef(({className:e,children:t,...n},r)=>d.jsx(wA,{ref:r,className:fe("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:d.jsx("div",{className:"pt-0 pb-4",children:t})}));ja.displayName=wA.displayName;function SA(e,t,n){if(e.length===0)return{success:!1,error:"Empty path"};let r=-1,o="";const i=c=>{o===""?o=c:o+="."+c};if(t===void 0)return{success:!1,error:`Undefined schema in: '${e.join("/")}'.`};if(n===void 0)return{success:!1,error:`Undefined source in: '${e.join("/")}'.`};let s=t,a=n;const l=[{modulePath:o,schema:s,source:a}];for(const c of e){if(r++,c==="")return{success:!1,error:`Empty path part in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(s.type==="array"){s=s.item;const u=Number(c);if(!Number.isSafeInteger(u))return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an integer but got '${c}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(typeof a!="object")return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===null)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'null' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===void 0)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'undefined' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!Array.isArray(a))return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an array but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!a[u])return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an index less than ${a.length} but got '${u}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};a=a[u],i(c)}else if(s.type==="record"){s=s.item;const u=om(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="object"){s=s.items[c];const u=om(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="union"){const u=typeof s.key=="object"&&s.key.type==="literal"?s:void 0,f=typeof s.key=="string"?s:void 0;if(u)return{success:!1,error:"Invalid lookup in string union"};if(f){const h=om(e,c,r,a,"union object");if(!h.success)return{success:!1,error:h.error};const p=h.source;let m;for(const v of f.items){const x=v.items[f.key];if(x.type==="literal"){if(p[f.key]===x.value){m=v;break}}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}if(!m)return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};s=m.items[c],a=p[c],i(JSON.stringify(c))}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}else if(s.type==="image"||s.type==="file"){const u=om(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else return{success:!1,error:`Cannot construct sub-path in schema of '${s.type}' in: '${e.join("/")}'. Path was: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")}`};l.push({modulePath:o,schema:s,source:a})}return{success:!0,modulePath:o,schema:s,source:a,allResolved:l}}function om(e,t,n,r,o){return typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===null?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'null' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===void 0?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'undefined' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:Array.isArray(r)?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'array' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:t in r?{success:!0,source:r}:{success:!1,error:`Could not find key of source: '${e.join("/")}'. Expected a key in ${Object.keys(r).join(", ")} but got '${t}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}}function Iq(e,t){return(t==null?void 0:t.type)==="array"?e.type!=="string":(t==null?void 0:t.type)==="record"}function kA(e,t,n){if(!n)return null;const[r,o]=Y.splitModuleFilePathAndModulePath(e);if(!o)return r;const i=t[r],s=n[r];if(i===void 0||!s)return null;const a=SA(Y.splitModulePath(o),s,i);if(a.success){for(let l=a.allResolved.length-1;l>=0;l--){const c=a.allResolved[l],u=a.allResolved[l-1];if(Iq(c.schema,(u==null?void 0:u.schema)||null))return c.modulePath===""?r:Y.joinModuleFilePathAndModulePath(r,c.modulePath)}return r}else console.error(`Error resolving path: ${a.error} for path: ${e}`);return null}function dp({moduleFilePath:e,patchPath:t,className:n,toolTip:r=!0,link:o=!0}){const i=Gu(),s=g.useRef(null),a=g.useRef(new Map),[l,c]=g.useState([]),[u,f]=g.useState(),h=FS(),p=Ba(),{navigate:m}=xn();g.useEffect(()=>{const x=e?Y.splitModuleFilePath(e):[],b=t,w=()=>{if(!s.current)return;const C=s.current,N=getComputedStyle(C),P=`${N.fontSize} ${N.fontFamily}`,_=C.offsetWidth,O=x.map(Dq).concat(b).map(K=>`/${K}`);f(O.join(""));const M=K=>{const V=`${K}:${P}`,I=a.current.get(V)??Lq(K,P);return a.current.set(V,I),I},D="/…",U=M(D),z=[];let H=0;for(let K=O.length-1;K>=0;K--){const V=M(O[K]),A=!(K===0);if(H+V+(A?U:0)<=_){const j=K>x.length?"module-path":"module-file-path";z.unshift({text:O[K],type:j,moduleFilePath:e,modulePathSegments:b.slice(0,K)}),H+=V}else{z.unshift({type:"ellipsis",text:D});break}}c(z)},S=new ResizeObserver(w);return s.current&&(S.observe(s.current),w()),()=>{s.current&&S.unobserve(s.current)}},[e,t]);const v=g.useMemo(()=>{if(!o)return null;const x="data"in p?p.data:{};if(t.length===0){const w=e;return{navPath:w,sourcePath:w}}const b=SA(t,x[e],h[e]);if(b.success){const w=Y.joinModuleFilePathAndModulePath(e,b.modulePath),S=kA(w,h,x);if(S)return{navPath:S,scrollToId:w};console.debug(`Failed to resolve nav path for ${e} and ${t.join(".")}: ${S}`)}else console.debug(`Failed to resolve source path for ${e} and ${t.join(".")}: ${b.error}`);return null},[e,t,h,p]);return d.jsxs(zr,{open:r===!1?!1:void 0,children:[d.jsx(TS,{asChild:!0,children:d.jsx("a",{href:v&&i?`${i.studioPrefix}${v.navPath}#${v.scrollToId}`:void 0,ref:s,className:Ce("inline-block whitespace-nowrap overflow-hidden w-full align-baseline",{"cursor-pointer hover:underline":o},n),onClick:x=>{o&&v&&x.metaKey===!1&&x.ctrlKey===!1&&x.shiftKey===!1&&(x.preventDefault(),m(v.navPath,{scrollToId:v.scrollToId}))},children:l.map((x,b)=>d.jsx("span",{children:x.text},b))})}),d.jsx(fr,{side:"top",children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[calc(100vw-3rem)] whitespace-nowrap",children:u})})]})}function Dq(e){const t=Eu(e);return t.slice(0,1).toUpperCase()+t.slice(1)}function Lq(e,t){const r=document.createElement("canvas").getContext("2d");return r?(r.font=t,r.measureText(e).width):0}function EA({className:e,loadingStatus:t}){const n=ip(),r=qu(),o=R7(),i=M7(),s=In(),[a,l]=g.useState(!1),{canGenerate:c}=sp(),u=Ql(),{autoPublish:f}=IS(),h=g.useMemo(()=>{var D;let M=0;for(const U in u)M+=((D=u[U])==null?void 0:D.length)||0;return M},[u]),p=n.length-o.size,{deployments:m,dismissDeployment:v,observedCommitShas:x}=O7(),{globalTransientErrors:b,removeGlobalTransientErrors:w}=z7(),{patchErrors:S}=YR(),[C,N]=g.useState(new Date);g.useEffect(()=>{const M=setInterval(()=>{N(new Date)},6e4);return()=>{clearInterval(M)}},[]);const{deletePatches:P}=WR(),_=P7(),O=async(M,D,U)=>{const z=await _("/patches","GET",{query:{patch_id:[D],exclude_patch_ops:!1}});if(z.status===200){const H=z.json,K=`val-patch-error-report-${M.replace("/","__").replace(/\.val\./,"-")}-${D}.json`,V=new Blob([JSON.stringify({moduleFilePath:M,patchId:D,error:U,patch:H},null,2)],{type:"application/json"}),I=document.createElement("a");I.href=URL.createObjectURL(V),I.download=K,I.click()}else alert("Failed to download report")};return d.jsxs("div",{className:Ce("text-sm",e),children:[S&&Object.values(S).some(M=>M!==null)&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[d.jsxs("div",{className:"px-4 text-pretty",children:[d.jsx("div",{children:"Unfortunately, one or more changes have errors."}),d.jsx("div",{children:"No changes can currently be applied."})]}),Object.entries(S).map(([M,D],U)=>d.jsx("div",{className:"pb-4",children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:D&&Object.entries(D).map(([z,H],K)=>d.jsx(xA,{className:"grid grid-cols-2 gap-2",type:"single",collapsible:!0,children:d.jsxs(sk,{value:z,children:[d.jsx("div",{children:d.jsx(qe,{variant:"destructive",onClick:()=>{P([z])},children:d.jsx("span",{className:"flex gap-2 justify-between items-center text-left",children:d.jsx("span",{children:"Remove change and fix issue"})})})}),d.jsx(ak,{asChild:!0,className:"group",children:d.jsxs(qe,{variant:"destructive",children:[d.jsx("span",{className:"text-left truncate group-data-[state=open]:hidden",children:"Report"}),d.jsx("span",{className:"text-left truncate group-data-[state=open]:block hidden",children:"Hide"})]})}),d.jsxs(lk,{children:[d.jsx(qe,{variant:"destructive",onClick:()=>{O(M,z,H.message)},children:d.jsxs("span",{className:"flex gap-2 justify-between items-center text-left",children:[d.jsx("span",{children:"Download debug report"}),d.jsx(eK,{size:14})]})}),d.jsxs("div",{className:"p-4",children:[d.jsx("div",{className:"font-bold",children:"Details"}),d.jsx("div",{children:"Module file path"}),d.jsx("div",{children:d.jsx(qN,{sourcePath:M})}),d.jsx("div",{children:"Error message"}),d.jsx("pre",{children:H.message})]})]})]})},K))})},M+"#"+U))]})}),u&&h>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(hr,{orientation:"horizontal",children:d.jsx(Dl,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(_a,{value:"error",className:"border-b-0",children:[d.jsx(Ll,{className:" data-[state=open]:mb-4 text-fg-error-primary border-fg-error-primary ",children:d.jsxs("div",{className:"flex justify-between items-center w-full",children:[d.jsxs("div",{children:[h," validation issue",h>1?"s":""]}),d.jsx(Su,{size:16})]})}),d.jsx(ja,{className:"",children:d.jsx("div",{className:"flex flex-col gap-4",children:Object.entries(u).map(([M,D],U)=>d.jsxs("div",{className:"pb-4",children:[d.jsx("div",{className:"items-start text-left",children:d.jsx(qN,{sourcePath:M})}),d.jsx("div",{children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:D==null?void 0:D.map((z,H)=>d.jsx("div",{className:"",children:d.jsx("div",{children:z.message})},H))})})]},M+"#"+U))})})]})})})}),b&&b.length>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(hr,{orientation:"horizontal",children:d.jsx(Dl,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(_a,{value:"error",className:"border-b-0 data-[state=open]:mb-4",children:[d.jsxs(Ll,{children:[b.length," transient error",b.length>1?"s":""]}),d.jsx(ja,{className:"w-full",children:d.jsx("div",{className:"flex flex-col gap-2",children:b.map(M=>d.jsxs("div",{className:"flex gap-2 justify-between items-start",children:[d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("div",{className:"font-bold",children:M.message}),M.details&&d.jsx("div",{children:M.details}),d.jsx("div",{className:"text-[10px] font-thin",children:jm(C,new Date(M.timestamp).toISOString())})]}),d.jsx("button",{onClick:()=>w([M.id]),children:d.jsx(Rl,{size:14})})]},M.id))})})]})})})}),m.length>0&&d.jsx("div",{className:"p-4 border-b border-border-primary",children:d.jsx(Fq,{deployments:m,observedCommitShas:x,onDismiss:v})}),r==="http"&&d.jsx("div",{className:"flex justify-end items-center p-4 border-b z-5 border-border-primary",children:d.jsxs(br,{open:a,onOpenChange:M=>{l(M)},children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Summary"}),c&&d.jsx(a2,{size:14})]})}),d.jsxs(tr,{container:s,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Al,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Rl,{size:12})}),d.jsx(iA,{onClose:()=>{l(!1)}})]})]})}),d.jsx("div",{className:"p-4 z-5",children:d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsxs("div",{className:"font-bold",children:[p<=0?"No ":`${p} `,"pending change",p===1?"":"s"]}),(t==="loading"||t==="not-asked")&&d.jsx("div",{className:"",children:d.jsx(Gr,{size:16,className:"animate-spin"})})]}),d.jsxs(br,{children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{disabled:n.length===0,variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Undo all"}),d.jsx(Hb,{size:14})]})}),d.jsx(tr,{container:s,className:"z-[9001]",children:d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:"This will undo all changes to the current state."}),d.jsx("div",{children:d.jsx(Al,{asChild:!0,children:d.jsxs(qe,{variant:"destructive",className:"flex gap-2 items-center text-sm",onClick:()=>{P(n)},children:[d.jsx("span",{children:"Undo all changes"}),d.jsx(Hb,{size:14})]})})})]})})]})]})}),(!f||h>0)&&d.jsx("div",{className:"flex flex-col gap-[2px]",children:"data"in i&&n.length>0&&i.data.map(M=>d.jsx(Vq,{committedPatchIds:o,patchSet:M,patchErrors:(S==null?void 0:S[M.moduleFilePath])??{}},M.moduleFilePath+":"+M.patchPath.join("/")))})]})}function qN({sourcePath:e}){const[t,n]=Y.splitModuleFilePathAndModulePath(e),r=Y.splitModulePath(n);return d.jsx(dp,{moduleFilePath:t,patchPath:r})}function Fq({deployments:e,observedCommitShas:t,onDismiss:n}){return g.useEffect(()=>{for(const r of e)t.has(r.commitSha)&&setTimeout(()=>{n(r.commitSha)},5e3)},[e,t]),d.jsxs("div",{children:[d.jsxs("div",{className:"flex justify-between items-center p-2 font-bold",children:[d.jsx("span",{children:"Deployments"}),d.jsx(Gr,{size:16,className:"inline animate-spin"})]}),d.jsx("div",{children:e.reverse().map(r=>d.jsx(zq,{deployment:r,isFinished:t.has(r.commitSha),onDismiss:()=>{n(r.commitSha)}},r.commitSha))})]})}function zq({deployment:e,isFinished:t,onDismiss:n}){var s;const r=LS(),o=In(),i=e.creator&&r[e.creator];return d.jsxs("div",{className:"flex justify-between items-start p-2",children:[d.jsxs("div",{className:"flex gap-2 items-start",children:[i&&d.jsx("img",{src:(s=i.avatar)==null?void 0:s.url,alt:i.fullName,className:"w-8 h-8 rounded-full"}),d.jsxs(zr,{children:[d.jsx(TR,{container:o}),d.jsx(ho,{children:d.jsx("div",{className:"max-w-[180px] overflow-clip font-light truncate",children:e.commitMessage})}),d.jsx(fr,{className:"max-w-[320px]",children:d.jsx("pre",{className:"font-sans font-light whitespace-break-spaces",children:e.commitMessage})})]})]}),t&&d.jsxs("div",{className:"flex gap-2 items-start",children:[d.jsx("span",{className:"text-xs font-light text-fg-quaternary",children:"Deployed"}),d.jsx("button",{onClick:()=>{n()},children:d.jsx(Yu,{size:14})})]}),!t&&d.jsx($q,{since:new Date(e.createdAt)})]})}function $q({since:e}){const[t,n]=g.useState("00"),[r,o]=g.useState("00");return g.useEffect(()=>{let i;const s=()=>{const a=Date.now(),l=Math.floor((a-e.getTime())/1e3),c=Math.floor(l/60),u=l%60;let f;c>4?(f=(60-u)*1e3,n(c.toString()),o(null)):(f=1e3,n(c.toString().padStart(2,"0")),o(u.toString().padStart(2,"0"))),i=setTimeout(s,f)};return s(),()=>{clearTimeout(i)}},[e]),d.jsxs("div",{className:"text-xs font-light text-fg-quaternary",children:[t,r!==null?`:${r}`:" mins"]})}function Bq({moduleFilePath:e,patchMetadata:t,committedPatchIds:n}){var u;const r=CA([t.opType],t.createdAt,n.has(t.patchId)),o=LS(),{skippedPatches:i}=DS(),s=void 0,[a]=g.useMemo(()=>[!!i[t.patchId]],[t.patchId,i[t.patchId]]),l=qu();let c=[];if(t.author){const f=o[t.author];if(f){const h=((u=f==null?void 0:f.avatar)==null?void 0:u.url)??null;c=[{fullName:f.fullName,url:h}]}else console.warn("Did not find profile for author: ",t.author,{profilesById:o})}return c.length===0&&l==="http"&&console.warn("No authors",{patchMetadata:t}),d.jsx(Jb,{moduleFilePath:e,patchPath:t.patchPath,changeDescription:a?"Skipped":r,authors:c,errors:s,skipped:a,isApplied:n.has(t.patchId)})}function CA(e,t,n){const[r,o]=g.useState(new Date);if(g.useEffect(()=>{const a=setInterval(()=>{o(new Date)},6e4);return()=>{clearInterval(a)}},[]),n)return"Pushed "+jm(r,t);if(e.length>1)return"Updated "+jm(r,t);const i=e[0];let s=i;return i==="add"?s="Added":i==="remove"?s="Removed":i==="replace"?s="Replaced":i==="move"?s="Moved":i==="copy"?s="Copied":i==="test"?s="Tested":i==="file"?s="Updated":console.warn("Unexpected op type: ",i),s+" "+jm(r,t)}function Vq({patchSet:e,committedPatchIds:t,patchErrors:n}){const[r,o]=g.useState(!1),i=g.useRef(null),[s,a]=g.useState(!1);g.useEffect(()=>{const v=new IntersectionObserver(x=>{x[0].isIntersecting&&a(!0)},{threshold:0});return i.current&&v.observe(i.current),()=>{v.disconnect()}},[]);const{skippedPatches:l}=DS(),{deletePatches:c}=WR(),u=g.useMemo(()=>e.patches.map(v=>v.patchId),[e.patches.map(v=>v.patchId).join(",")]),f=g.useMemo(()=>{const v=[];for(const x of u){const b=n==null?void 0:n[x];!l[x]&&b&&v.unshift(b.message)}return v},[u,n,l]),h=CA(e.opTypes,e.lastUpdated,!1),p=LS(),m=e.patches.every(v=>t.has(v.patchId));return s?d.jsxs(d.Fragment,{children:[d.jsx(Jb,{moduleFilePath:e.moduleFilePath,patchPath:e.patchPath,isApplied:m,authors:e.authors.reduce((v,x)=>v.includes(x)?v:v.concat(x),[]).flatMap(v=>{var b;const x=p[v];if(x){const w=((b=x==null?void 0:x.avatar)==null?void 0:b.url)??null;return[{fullName:x.fullName,url:w}]}return[]}),changeDescription:h,isOpen:r,setOpen:o,errors:f,onDelete:()=>{c(u.filter(v=>!t.has(v)))},amount:new Set(u).size}),d.jsx(ku,{isOpen:r,children:e.patches.map((v,x)=>d.jsx(Bq,{committedPatchIds:t,moduleFilePath:e.moduleFilePath,patchMetadata:v},e.moduleFilePath+":"+e.patchPath.join("/")+v.patchId+x))})]}):d.jsx(Jb,{ref:i,isApplied:m})}const Jb=g.forwardRef(({moduleFilePath:e,patchPath:t,changeDescription:n,authors:r,isOpen:o,setOpen:i,isSelected:s,setSelected:a,errors:l,skipped:c,onDelete:u,amount:f,isApplied:h},p)=>{const m=In();return d.jsxs("div",{ref:p,className:Ce("p-6",{"bg-bg-secondary":!o,"bg-bg-tertiary":o,"opacity-50":h}),children:[d.jsxs("div",{className:"relative",children:[d.jsx("span",{className:"inline-block w-[calc(320px-24px-8px-16px-24px-48px)] truncate mr-2 ",children:e&&t&&d.jsx(dp,{moduleFilePath:e,patchPath:t,link:!0,toolTip:!0})}),s===void 0&&d.jsx("span",{className:Ce("inline-block w-6 h-6 rounded",{"bg-bg-disabled animate-pulse":t===void 0})}),s!==void 0&&!h&&d.jsx(Qu,{checked:s,onCheckedChange:v=>{a&&a(v)}}),d.jsxs("div",{className:"inline relative ml-5",children:[f&&d.jsxs(zr,{children:[d.jsx(ho,{children:d.jsx("span",{className:"absolute -right-5 -top-6 w-6 h-6 text-xs leading-6 text-center rounded-full bg-bg-primary text-fg-primary",children:f>9?"9+":f})}),d.jsx(fr,{side:"left",children:d.jsxs("p",{children:[f," change",f>1?"s":""," in this patch set"]})})]}),u&&!h&&f&&f>0&&d.jsxs(br,{children:[d.jsx(xo,{children:d.jsx(Hb,{size:16,className:"inline"})}),d.jsxs(tr,{container:m,className:"flex flex-col gap-2 z-[9001]",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsxs("div",{children:["This will undo ",f," change",f>1?"s":"","."]}),d.jsx("div",{children:d.jsx(Al,{asChild:!0,children:d.jsxs(qe,{variant:"destructive",onClick:u,children:["Undo change",f>1?"s":""]})})})]})]})]})]}),l&&l.length>0&&!c&&d.jsxs("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary rounded-lg",children:[l.slice(0,1).map((v,x)=>d.jsx("div",{title:v,className:"truncate",children:"Invalid change"},x)),l.length>1&&d.jsxs("div",{className:"truncate",children:["+",l.length-1," more"]})]}),(!l||l.length===0)&&c&&d.jsx("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary",children:d.jsx("div",{className:"truncate",children:"Skipped"})}),d.jsxs("div",{className:"flex justify-between items-center pt-2",children:[d.jsxs("span",{className:"flex flex-shrink-0 gap-2",children:[r!==void 0&&r.length>0&&d.jsxs("span",{className:"flex gap-1 mr-2",children:[r.slice(0,2).map((v,x)=>{if(v.url)return d.jsxs(zr,{children:[d.jsx(ho,{className:"flex-shrink-0 w-6 h-6",children:d.jsx("img",{src:v.url,alt:v.fullName,className:Ce("rounded-full",{"-ml-3":r.length>2&&x>0})})}),d.jsx(fr,{children:d.jsx("div",{children:v.fullName})})]},v.url);const b=Uq(v.fullName);return d.jsxs(zr,{children:[d.jsx(ho,{className:Ce({"-ml-3":r.length>2&&x>0}),children:d.jsx("span",{className:Ce("flex items-center justify-center w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary"),"aria-label":"Initials for: "+v.fullName,children:b})}),d.jsx(fr,{children:d.jsx("div",{children:v.fullName})})]},v.fullName+v.url)}),r.length>2&&d.jsxs(zr,{children:[d.jsx(ho,{className:Ce({"-ml-3":r.length>2}),children:d.jsxs("span",{className:"flex justify-center items-center -ml-3 w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary",children:["+",r.length-2]})}),d.jsx(fr,{className:"grid grid-cols-[auto,1fr] gap-2",children:r.slice(2).map(v=>d.jsxs(g.Fragment,{children:[v.url?d.jsx("img",{src:v.url,alt:v.fullName,title:v.fullName,className:Ce("w-6 h-6 rounded-full")},v.url):d.jsx("div",{}),d.jsx("div",{children:v.fullName})]},v.fullName+v.url))})]})]}),r===void 0&&d.jsx("span",{className:Ce("inline-block w-6 h-6 mr-2",{"bg-bg-disabled animate-pulse rounded-3xl":r===void 0})}),n&&d.jsx("span",{className:Ce({"text-fg-disabled":c}),children:n})]}),o!==void 0&&d.jsx("button",{className:"inline-block flex-shrink-0",onClick:()=>{i&&i(!o)},children:d.jsx(Ju,{size:16,className:Ce("transform",{"rotate-180":o})})})]})]})});function Uq(e){return!e||typeof e!="string"?"":e.trim().normalize("NFC").split(/\s+/).filter(r=>r.length>0).map(r=>/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(r)?r[0]:r[0].toLocaleUpperCase()).join("")}function Xb(){const[e,t]=g.useState(!1),{publish:n,publishDisabled:r,isPublishing:o,summary:i}=sp(),s=Ql(),a=s!==void 0&&Object.keys(s).length>0,l=HR(),c=KR(),u=qu(),f=In(),{autoPublish:h}=IS();return a?d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{className:"flex gap-2 items-center",disabled:!0,children:u==="fs"?"Save":d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Dg,{size:16})]})})}),d.jsx(fr,{children:d.jsx("div",{className:"flex flex-col gap-2",children:d.jsx("p",{children:"Fix validation errors to continue"})})})]}):u==="fs"?d.jsxs(qe,{className:"flex gap-2 items-center",disabled:r||a||h||l.length===0||c.length>0,title:a?"Please fix validation errors":"",onClick:()=>{n("No summary provided")},children:[a?d.jsx("span",{children:"Save"}):d.jsx("span",{children:o?"Saving":"Save"}),o&&d.jsx(Gr,{className:"animate-spin",size:16})]}):d.jsx("span",{children:d.jsxs(br,{open:e,onOpenChange:p=>{t(p)},children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{className:"flex gap-2 items-center",disabled:r||a||l.length===0||c.length>0,onClick:()=>{t(!0)},children:[!o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Dg,{size:16})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Pushing"}),d.jsx(Gr,{className:"animate-spin",size:16})]})]})}),d.jsxs(tr,{container:f,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Al,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Rl,{size:12})}),d.jsx(iA,{onClose:()=>{t(!1)},onPublish:()=>{if(t(!1),i.type==="not-asked")return;const p=i.text.trim();n(p)}})]})]})})}function Wq(){const e=ly(),{isPublishing:t}=sp(),n=Ql()||{},{globalErrors:r}=DS(),o=qu(),[i,s]=g.useMemo(()=>{const a=new Set;let l=0;for(const c in n){const[u]=Y.splitModuleFilePathAndModulePath(c);a.add(u),l+=1}return[Array.from(a).sort(),l]},[n]);return d.jsxs("div",{className:"min-h-[100svh] bg-bg-primary",style:{"--menu-width":"320px"},children:[d.jsx("div",{className:"h-16 border-b border-border-primary",children:d.jsx(Gq,{})}),t&&d.jsxs("div",{className:"flex gap-2 justify-end items-center p-4 text-right border-t bg-bg-tertiary text-fg-primary border-border-primary",children:[d.jsx("span",{children:"Publishing changes "}),d.jsx(Gr,{size:16,className:"animate-spin"})]}),d.jsx(hr,{children:d.jsxs("div",{className:"max-h-[calc(100svh-64px)]",children:[r&&r.length>0&&r.length!==s&&d.jsx(Dl,{type:"single",collapsible:!0,children:d.jsxs(_a,{value:"global-errors",children:[d.jsxs(Ll,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:["Cannot ",o==="fs"?"save":"publish"," now. Found"," ",r==null?void 0:r.length," errors in all."," ",r.length-s," were non-validation errors. A developer might need to fix these issues."]}),d.jsx(ja,{children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-128px)] max-w-[var(--menu-width)]",children:r==null?void 0:r.map((a,l)=>d.jsx(Kq,{error:a},l))})})})]})}),(r==null?void 0:r.length)===s&&i.length>0&&d.jsx(Dl,{type:"single",collapsible:!0,children:d.jsxs(_a,{value:"global-errors",children:[d.jsx(Ll,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:d.jsxs("div",{children:[d.jsxs("div",{children:["Cannot ",o==="fs"?"save":"publish"," now."]}),d.jsx("div",{children:"Found errors in modules"})]})}),d.jsx(ja,{children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[var(--menu-width)]",children:i==null?void 0:i.map((a,l)=>d.jsx(Hq,{moduleFilePath:a},l))})})})]})}),e!=="not-asked"&&d.jsx("div",{className:Ce("",{}),children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] border-b border-border-primary",children:d.jsx(EA,{loadingStatus:e})})})})]})})]})}function Hq({moduleFilePath:e}){const t=Y.splitModuleFilePath(e),n=xn();return d.jsx("div",{className:"px-4 py-2 border-b bg-bg-error-primary text-fg-error-primary border-border-error-primary",children:d.jsx("button",{className:"underline cursor-pointer",onClick:()=>{n.navigate(e)},children:t.map((r,o)=>d.jsxs(g.Fragment,{children:[d.jsx("span",{className:fe("text-fg-brand-secondary",{"ml-1":o>0}),children:"/"}),d.jsx("span",{children:Eu(r)})]},o))})})}function Kq({error:e}){const[t,n]=g.useState(!1);return d.jsx("div",{className:fe("px-1 py-2 bg-bg-error-primary text-fg-error-primary border-b border-border-error-primary",{truncate:!t,"whitespace-normal":t}),onClick:()=>n(!t),children:e})}function Gq(){const{currentSourcePath:e}=xn(),t=Ba(),[n,r]=Y.splitModuleFilePathAndModulePath(e),o=lt(n,"record"),i=g.useMemo(()=>{if(t.status!=="success")return t;if(o.status!=="success")return o;const f=t.data[n];if(f.type==="record"&&f.router){if(o.data===null)return{status:"success",data:null};const h=Object.keys(o.data),p=Y.splitModulePath(r)[0];for(const m of h)if(p&&p.startsWith(m))return{status:"success",data:{previewRoute:m}}}return{status:"success",data:null}},["data"in t&&t.data,n,r,o]),{navMenu:s,toolsMenu:a}=Jy(),l=qu(),{setAutoPublish:c,autoPublish:u}=IS();return d.jsx("div",{className:"flex flex-col",children:d.jsxs("div",{className:"flex gap-2 justify-between items-center p-4 w-full",children:[d.jsx("button",{className:"lg:hidden",onClick:()=>{a.setOpen(!a.isOpen)},children:d.jsx(Ag,{size:16,className:Ce("transform",{"rotate-180":!s.isOpen})})}),d.jsxs("div",{className:"flex gap-2 justify-end items-center w-full",children:[l==="fs"&&d.jsxs("div",{className:"overflow-hidden flex items-center gap-2 text-[10px] lg:text-xs",children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx("span",{className:"truncate text-fg-secondary",children:"Auto-save"})}),d.jsxs(fr,{children:[d.jsx("p",{children:"When auto-save is enabled Val will save to changes to disk automatically"}),d.jsx("p",{children:"This is a development mode feature"})]})]}),d.jsx(Qu,{checked:u,onCheckedChange:c})]}),d.jsx(qq,{maybePreviewRoute:i}),d.jsx(Xb,{})]})]})})}function qq({maybePreviewRoute:e}){var n,r;const t=g.useMemo(()=>{var o;return e.status==="success"&&((o=e.data)!=null&&o.previewRoute)?gu("/api/val/enable",{redirect_to:window.origin+e.data.previewRoute}):gu("/api/val/enable",{redirect_to:window.origin})},[e]);return d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{className:"flex gap-2 items-center",variant:"secondary",asChild:!0,children:d.jsxs("a",{href:t,children:[d.jsx("span",{children:"Preview"}),e.status==="success"&&((n=e.data)!=null&&n.previewRoute)?d.jsx(Rg,{size:16}):d.jsx(Ig,{size:16})]})})}),d.jsx(fr,{children:e.status==="success"&&((r=e.data)!=null&&r.previewRoute)?d.jsxs("p",{children:["Preview your changes in ",e.data.previewRoute]}):d.jsx("p",{children:"Preview your changes on the main page"})})]})}function Xt({error:e,path:t}){return d.jsx("div",{id:t,children:d.jsx("div",{className:"p-4 bg-bg-error-primary text-fg-error-primary",children:e})})}function yt({path:e,type:t}){return d.jsx("div",{id:e,className:Ce("pt-6",{"w-full flex items-center justify-center":t==="module","text-left":t!=="module"}),children:d.jsx(Gr,{size:t==="module"?24:16,className:"animate-spin"})})}function Mn({path:e,type:t}){const[n,r]=g.useState(!1);return g.useEffect(()=>{const o=setTimeout(()=>{r(!0)},2e3);return()=>{clearTimeout(o)}},[]),e.length===0?null:n?d.jsx("div",{className:"pt-6",id:e,children:d.jsx("div",{children:"Could not get data"})}):d.jsx(yt,{path:e,type:t})}function kr({actualType:e,expectedType:t,path:n}){return d.jsx("div",{id:n,children:d.jsxs("div",{children:["Schema mismatch: actual: ",e," vs expected: ",t," "]})})}function it({error:e,path:t,schema:n}){const{addPatch:r,patchPath:o}=bn(t);return d.jsxs("div",{id:t,className:"flex justify-between items-center px-2 py-3 rounded-lg bg-bg-error-primary text-fg-primary",children:[d.jsxs("div",{children:["Source error: ",e]}),d.jsxs("div",{className:"flex gap-2 items-center",children:[n&&n.status==="success"&&!(n.data.type==="file"||n.data.type==="image")&&d.jsx(qe,{variant:"outline",className:"hover:bg-bg-error-secondary-hover",onClick:()=>{r([{op:"replace",path:o,value:Il(n.data)}],n.data.type)},children:"Fix"}),d.jsx(Su,{size:16})]})]})}function Yq(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const vy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ed(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ck(e){return"nodeType"in e}function Er(e){var t,n;return e?ed(e)?e:ck(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function uk(e){const{Document:t}=Er(e);return e instanceof t}function fp(e){return ed(e)?!1:e instanceof Er(e).HTMLElement}function NA(e){return e instanceof Er(e).SVGElement}function td(e){return e?ed(e)?e.document:ck(e)?uk(e)?e:fp(e)||NA(e)?e.ownerDocument:document:document:document}const ki=vy?g.useLayoutEffect:g.useEffect;function dk(e){const t=g.useRef(e);return ki(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Jq(){const e=g.useRef(null),t=g.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function gh(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return ki(()=>{n.current!==e&&(n.current=e)},t),n}function hp(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Bg(e){const t=dk(e),n=g.useRef(null),r=g.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function Zb(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let n0={};function pp(e,t){return g.useMemo(()=>{if(t)return t;const n=n0[e]==null?0:n0[e]+1;return n0[e]=n,e+"-"+n},[e,t])}function PA(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+e*c)}return i},{...t})}}const Xc=PA(1),vh=PA(-1);function Xq(e){return"clientX"in e&&"clientY"in e}function fk(e){if(!e)return!1;const{KeyboardEvent:t}=Er(e.target);return t&&e instanceof t}function Zq(e){if(!e)return!1;const{TouchEvent:t}=Er(e.target);return t&&e instanceof t}function Qb(e){if(Zq(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 Xq(e)?{x:e.clientX,y:e.clientY}:null}const yh=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[yh.Translate.toString(e),yh.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),YN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qq(e){return e.matches(YN)?e:e.querySelector(YN)}const eY={display:"none"};function tY(e){let{id:t,value:n}=e;return Ee.createElement("div",{id:t,style:eY},n)}function nY(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={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 Ee.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function rY(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const _A=g.createContext(null);function oY(e){const t=g.useContext(_A);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function iY(){const[e]=g.useState(()=>new Set),t=g.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[g.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const sY={draggable:`
|
|
461
461
|
To pick up a draggable item, press the space bar.
|
|
462
462
|
While dragging, use the arrow keys to move the item.
|
|
463
463
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/server/.tmp/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Val</title>
|
|
7
|
-
<script type="module" crossorigin src="/api/val/static/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/api/val/static/assets/index-ClmF8Ug0.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/api/val/static/assets/index-1ofWrCU9.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|