@gentbajko/slopify 3.14.1 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/edge/http/studio.js +1 -0
- package/dist/extension/slopify-studio-chrome.zip +0 -0
- package/dist/extension/slopify-studio-firefox.zip +0 -0
- package/dist/main.js +16 -1
- package/dist/patch-notes/3.14.2.md +5 -0
- package/dist/patch-notes/3.15.0.md +5 -0
- package/dist/patch-notes/index.json +12 -0
- package/dist/slices/storage/arrange.js +4 -1
- package/dist/slices/studio/unpacked.js +45 -0
- package/dist/web/assets/{index-wNwk0cqO.js → index-_soH0ZuO.js} +3 -3
- package/dist/web/assets/{pdf-Bw4akucO.js → pdf-BYQLQv5-.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
|
@@ -47,7 +47,7 @@ Error generating stack: `+e.message+`
|
|
|
47
47
|
`},bm=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},xm=function(){m.useEffect(function(){return document.body.setAttribute(vm,(bm()+1).toString()),function(){var e=bm()-1;e<=0?document.body.removeAttribute(vm):document.body.setAttribute(vm,e.toString())}},[])},tee=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;xm();var a=m.useMemo(function(){return gm(i)},[i]);return m.createElement(_m,{styles:ym(a,!t,i,n?``:`!important`)})},Sm=!1;if(typeof window<`u`)try{var Cm=Object.defineProperty({},"passive",{get:function(){return Sm=!0,!0}});window.addEventListener(`test`,Cm,Cm),window.removeEventListener(`test`,Cm,Cm)}catch{Sm=!1}var wm=Sm?{passive:!1}:!1,nee=function(e){return e.tagName===`TEXTAREA`},Tm=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!nee(e)&&n[t]===`visible`)},ree=function(e){return Tm(e,`overflowY`)},iee=function(e){return Tm(e,`overflowX`)},Em=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Dm(e,r)){var i=Om(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},aee=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},oee=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Dm=function(e,t){return e===`v`?ree(t):iee(t)},Om=function(e,t){return e===`v`?aee(t):oee(t)},see=function(e,t){return e===`h`&&t===`rtl`?-1:1},cee=function(e,t,n,r,i){var a=see(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Om(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Dm(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},km=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Am=function(e){return[e.deltaX,e.deltaY]},jm=function(e){return e&&`current`in e?e.current:e},lee=function(e,t){return e[0]===t[0]&&e[1]===t[1]},uee=function(e){return`
|
|
48
48
|
.block-interactivity-${e} {pointer-events: none;}
|
|
49
49
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
50
|
-
`},dee=0,Mm=[];function fee(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(dee++)[0],a=m.useState(fm)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Up([e.lockRef.current],(e.shards||[]).map(jm),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=km(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Em(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Em(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return cee(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(Mm.length&&Mm[Mm.length-1]===a){var r=`deltaY`in n?Am(n):km(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&lee(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(jm).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=m.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:pee(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=m.useCallback(function(e){n.current=km(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,Am(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,km(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return Mm.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,wm),document.addEventListener(`touchmove`,c,wm),document.addEventListener(`touchstart`,u,wm),function(){Mm=Mm.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,wm),document.removeEventListener(`touchmove`,c,wm),document.removeEventListener(`touchstart`,u,wm)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:uee(i)}):null,p?m.createElement(tee,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function pee(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var mee=nm(rm,fee),Nm=m.forwardRef(function(e,t){return m.createElement(am,Vp({},e,{ref:t,sideCar:mee}))});Nm.classNames=am.classNames;var hee=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Pm=new WeakMap,Fm=new WeakMap,Im={},Lm=0,Rm=function(e){return e&&(e.host||Rm(e.parentNode))},gee=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Rm(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},zm=function(e,t,n,r){var i=gee(t,Array.isArray(e)?e:[e]);Im[n]||(Im[n]=new WeakMap);var a=Im[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Pm.get(e)||0)+1,l=(a.get(e)||0)+1;Pm.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Fm.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Lm++,function(){o.forEach(function(e){var t=Pm.get(e)-1,i=a.get(e)-1;Pm.set(e,t),a.set(e,i),t||(Fm.has(e)||e.removeAttribute(r),Fm.delete(e)),i||e.removeAttribute(n)}),Lm--,Lm||(Pm=new WeakMap,Pm=new WeakMap,Fm=new WeakMap,Im={})}},Bm=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||hee(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),zm(r,i,n,`aria-hidden`)):function(){return null}},Vm=Object.defineProperty,Hm=(e,t)=>Vm(e,`name`,{value:t,configurable:!0}),Um=`Dialog`,[Wm,_ee]=Xd(Um),[vee,Gm]=Wm(Um),Km=Hm(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=m.useRef(null),c=m.useRef(null),[l,u]=kf({prop:r,defaultProp:i??!1,onChange:a,caller:Um}),[d,f]=m.useState(0),[p,g]=m.useState(0);return(0,h.jsx)(vee,{scope:t,triggerRef:s,contentRef:c,contentId:qf(),titleId:qf(),descriptionId:qf(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:g,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),qm=`DialogPortal`,[Jm,Ym]=Wm(qm,{forceMount:void 0}),Xm=Hm(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Gm(qm,t);return(0,h.jsx)(Jm,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,h.jsx)(Lf,{present:n||a.open,children:(0,h.jsx)(Np,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Zm=`DialogOverlay`,Qm=m.forwardRef(Hm(function(e,t){let n=Ym(Zm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Gm(Zm,e.__scopeDialog);return a.modal?(0,h.jsx)(Lf,{present:r||a.open,children:(0,h.jsx)(eh,{...i,ref:t})}):null},`DialogOverlay`)),$m=Od(`DialogOverlay.RemoveScroll`),eh=m.forwardRef(Hm(function(e,t){let{__scopeDialog:n,...r}=e,i=Gm(Zm,n),a=Td(t,lp());return(0,h.jsx)(Nm,{as:$m,allowPinchZoom:!0,shards:[i.contentRef],children:(0,h.jsx)(Gd.div,{"data-state":ch(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),th=`DialogContent`,nh=m.forwardRef(Hm(function(e,t){let n=Ym(th,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Gm(th,e.__scopeDialog);return(0,h.jsx)(Lf,{present:r||a.open,children:a.modal?(0,h.jsx)(rh,{...i,ref:t}):(0,h.jsx)(ih,{...i,ref:t})})},`DialogContent`)),rh=m.forwardRef(Hm(function(e,t){let n=Gm(th,e.__scopeDialog),r=m.useRef(null),i=Td(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return Bm(e)},[]),(0,h.jsx)(ah,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:hf(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:hf(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:hf(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),ih=m.forwardRef(Hm(function(e,t){let n=Gm(th,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(ah,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),ah=m.forwardRef(Hm(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Gm(th,n);return zp(),(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(bp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(cp,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":ch(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),oh=`DialogTitle`,sh=m.forwardRef(Hm(function(e,t){let{__scopeDialog:n,...r}=e,i=Gm(oh,n),{setTitleCount:a}=i;return bf(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(Gd.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),yee=`DialogDescription`,bee=m.forwardRef(Hm(function(e,t){let{__scopeDialog:n,...r}=e,i=Gm(yee,n),{setDescriptionCount:a}=i;return bf(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(Gd.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),xee=`DialogClose`,See=m.forwardRef(Hm(function(e,t){let{__scopeDialog:n,...r}=e,i=Gm(xee,n);return(0,h.jsx)(Gd.button,{type:`button`,...r,ref:t,onClick:hf(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function ch(e){return e?`open`:`closed`}Hm(ch,`getState`);var Cee=Object.defineProperty,wee=(e,t)=>Cee(e,`name`,{value:t,configurable:!0});function lh(e){let[t,n]=m.useState(void 0);return bf(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}wee(lh,`useSize`);var Tee=[`top`,`right`,`bottom`,`left`],uh=Math.min,dh=Math.max,fh=Math.round,ph=Math.floor,mh=e=>({x:e,y:e}),Eee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function hh(e,t,n){return dh(e,uh(t,n))}function gh(e,t){return typeof e==`function`?e(t):e}function _h(e){return e.split(`-`)[0]}function vh(e){return e.split(`-`)[1]}function yh(e){return e===`x`?`y`:`x`}function bh(e){return e===`y`?`height`:`width`}function xh(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Sh(e){return yh(xh(e))}function Dee(e,t,n){n===void 0&&(n=!1);let r=vh(e),i=Sh(e),a=bh(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Eh(o)),[o,Eh(o)]}function Oee(e){let t=Eh(e);return[Ch(e),t,Ch(t)]}function Ch(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var wh=[`left`,`right`],Th=[`right`,`left`],kee=[`top`,`bottom`],Aee=[`bottom`,`top`];function jee(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Th:wh:t?wh:Th;case`left`:case`right`:return t?kee:Aee;default:return[]}}function Mee(e,t,n,r){let i=vh(e),a=jee(_h(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ch)))),a}function Eh(e){let t=_h(e);return Eee[t]+e.slice(t.length)}function Nee(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Dh(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Nee(e)}function Oh(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function kh(e,t,n){let{reference:r,floating:i}=e,a=xh(t),o=Sh(t),s=bh(o),c=_h(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=vh(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Ah(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=gh(t,e),p=Dh(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Oh(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Oh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var jh=50,Mh=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ah},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=kh(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<jh&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=kh(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Nh=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=gh(e,t)||{};if(l==null)return{};let d=Dh(u),f={x:n,y:r},p=Sh(i),m=bh(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=uh(d[_],T),D=uh(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=hh(E,k,O),j=!c.arrow&&vh(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Ph=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=gh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=_h(r),_=xh(o),v=_h(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Eh(o)]:Oee(o)),x=p!==`none`;!d&&x&&b.push(...Mee(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Dee(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===xh(t)||T.every(e=>xh(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=xh(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Fh(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ih(e){return Tee.some(t=>e[t]>=0)}var Lh=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=gh(e,t);switch(i){case`referenceHidden`:{let e=Fh(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ih(e)}}}case`escaped`:{let e=Fh(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ih(e)}}}default:return{}}}}},Rh=new Set([`left`,`top`]);async function zh(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=_h(n),s=vh(n),c=xh(n)===`y`,l=Rh.has(o)?-1:1,u=a&&c?-1:1,d=gh(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Bh=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await zh(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Vh=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=gh(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=xh(i),p=yh(f),m=u[p],h=u[f],g=(e,t)=>hh(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Hh=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=gh(e,t),u={x:n,y:r},d=xh(i),f=yh(d),p=u[f],m=u[d],h=gh(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Rh.has(_h(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Uh=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=gh(e,t),c=await i.detectOverflow(t,s),l=_h(n),u=vh(n),d=xh(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=uh(p-c[m],g),y=uh(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*dh(c.left,c.right):S=p-2*dh(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Wh(){return typeof window<`u`}function Gh(e){return Jh(e)?(e.nodeName||``).toLowerCase():`#document`}function Kh(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function qh(e){return((Jh(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Jh(e){return Wh()?e instanceof Node||e instanceof Kh(e).Node:!1}function Yh(e){return Wh()?e instanceof Element||e instanceof Kh(e).Element:!1}function Xh(e){return Wh()?e instanceof HTMLElement||e instanceof Kh(e).HTMLElement:!1}function Zh(e){return!Wh()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Kh(e).ShadowRoot}function Qh(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=lg(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function $h(e){return/^(table|td|th)$/.test(Gh(e))}function eg(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var tg=/transform|translate|scale|rotate|perspective|filter/,ng=/paint|layout|strict|content/,rg=e=>!!e&&e!==`none`,ig;function ag(e){let t=Yh(e)?lg(e):e;return rg(t.transform)||rg(t.translate)||rg(t.scale)||rg(t.rotate)||rg(t.perspective)||!sg()&&(rg(t.backdropFilter)||rg(t.filter))||tg.test(t.willChange||``)||ng.test(t.contain||``)}function og(e){let t=dg(e);for(;Xh(t)&&!cg(t);){if(ag(t))return t;if(eg(t))return null;t=dg(t)}return null}function sg(){return ig??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ig}function cg(e){return/^(html|body|#document)$/.test(Gh(e))}function lg(e){return Kh(e).getComputedStyle(e)}function ug(e){return Yh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dg(e){if(Gh(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Zh(e)&&e.host||qh(e);return Zh(t)?t.host:t}function fg(e){let t=dg(e);return cg(t)?(e.ownerDocument||e).body:Xh(t)&&Qh(t)?t:fg(t)}function pg(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=fg(e),i=r===e.ownerDocument?.body,a=Kh(r);if(i){let e=mg(a);return t.concat(a,a.visualViewport||[],Qh(r)?r:[],e&&n?pg(e):[])}return t.concat(r,pg(r,[],n))}function mg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hg(e){let t=lg(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Xh(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=fh(n)!==a||fh(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function gg(e){return Yh(e)?e:e.contextElement}function _g(e){let t=gg(e);if(!Xh(t))return mh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=hg(t),o=(a?fh(n.width):n.width)/r,s=(a?fh(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var vg=mh(0);function yg(e){let t=Kh(e);return!sg()||!t.visualViewport?vg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Kh(e)}function xg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=gg(e),o=mh(1);t&&(r?Yh(r)&&(o=_g(r)):o=_g(e));let s=bg(a,n,r)?yg(a):mh(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Kh(a),t=Yh(r)?Kh(r):r,n=e,i=mg(n);for(;i&&t!==n;){let e=_g(i),t=i.getBoundingClientRect(),r=lg(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Kh(i),i=mg(n)}}return Oh({width:u,height:d,x:c,y:l})}function Sg(e,t){let n=ug(e).scrollLeft;return t?t.left+n:xg(qh(e)).left+n}function Cg(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Sg(e,n),y:n.top+t.scrollTop}}function wg(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=qh(r),s=t?eg(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=mh(1),u=mh(0),d=Xh(r);if((d||!a)&&((Gh(r)!==`body`||Qh(o))&&(c=ug(r)),d)){let e=xg(r);l=_g(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Cg(o,c):mh(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Tg(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Eg(e){let t=ug(e),n=e.ownerDocument.body,r=dh(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=dh(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Sg(e),o=-t.scrollTop;return lg(n).direction===`rtl`&&(a+=dh(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Dg=25;function Og(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Kh(e),a=qh(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!sg()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Sg(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Dg&&(s-=o)}return{width:s,height:c,x:l,y:u}}function kg(e,t){let n=xg(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=_g(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ag(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Og(e,n,t);else if(t===`document`)r=Eg(qh(e));else if(Yh(t))r=kg(t,n);else{let n=yg(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Oh(r)}function Pee(e,t){let n=t.get(e);if(n)return n;let r=pg(e,[],!1).filter(e=>Yh(e)&&Gh(e)!==`body`),i=null,a=lg(e).position===`fixed`,o=a?dg(e):e;for(;Yh(o)&&!cg(o);){let e=lg(o),t=ag(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=dg(o)}return t.set(e,r),r}function Fee(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?eg(t)?[]:Pee(t,this._c):[].concat(n),r],o=Ag(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ag(t,a[e],i);s=dh(n.top,s),c=uh(n.right,c),l=uh(n.bottom,l),u=dh(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Iee(e){let{width:t,height:n}=hg(e);return{width:t,height:n}}function Lee(e,t,n){let r=Xh(t),i=qh(t),a=n===`fixed`,o=xg(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=mh(0);if((r||!a)&&((Gh(t)!==`body`||Qh(i))&&(s=ug(t)),r)){let e=xg(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Sg(i));let l=i&&!r&&!a?Cg(i,s):mh(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function jg(e){return lg(e).position===`static`}function Mg(e,t){if(!Xh(e)||lg(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return qh(e)===n&&(n=n.ownerDocument.body),n}function Ng(e,t){let n=Kh(e);if(eg(e))return n;if(!Xh(e)){let t=dg(e);for(;t&&!cg(t);){if(Yh(t)&&!jg(t))return t;t=dg(t)}return n}let r=Mg(e,t);for(;r&&$h(r)&&jg(r);)r=Mg(r,t);return r&&cg(r)&&jg(r)&&!ag(r)?n:r||og(e)||n}var Ree=async function(e){let t=this.getOffsetParent||Ng,n=this.getDimensions,r=await n(e.floating);return{reference:Lee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zee(e){return lg(e).direction===`rtl`}var Bee={convertOffsetParentRelativeRectToViewportRelativeRect:wg,getDocumentElement:qh,getClippingRect:Fee,getOffsetParent:Ng,getElementRects:Ree,getClientRects:Tg,getDimensions:Iee,getScale:_g,isElement:Yh,isRTL:zee};function Pg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vee(e,t,n){let r=null,i,a=qh(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ph(d),h=ph(a.clientWidth-(u+f)),g=ph(a.clientHeight-(d+p)),_=ph(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:dh(0,uh(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Pg(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Kh(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Hee(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=gg(e),u=i||a?[...l?pg(l):[],...t?pg(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Vee(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?xg(e):null;c&&g();function g(){let t=xg(e);h&&!Pg(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Uee=Bh,Wee=Vh,Gee=Ph,Kee=Uh,qee=Lh,Fg=Nh,Jee=Hh,Yee=(e,t,n)=>{let r=new Map,i=n??{},a={...Bee,...i.platform,_c:r};return Mh(e,t,{...i,platform:a})},Ig=typeof document<`u`?m.useLayoutEffect:function(){};function Lg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Lg(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Lg(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Rg(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zg(e,t){let n=Rg(e);return Math.round(t*n)/n}function Bg(e){let t=m.useRef(e);return Ig(()=>{t.current=e}),t}function Xee(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);Lg(f,r)||p(r);let[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=m.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=m.useRef(null),w=m.useRef(null),T=m.useRef(u),E=c!=null,D=Bg(c),O=Bg(i),k=Bg(l),A=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Yee(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Lg(T.current,t)&&(T.current=t,Hd.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Ig(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=m.useRef(!1);Ig(()=>(j.current=!0,()=>{j.current=!1}),[]),Ig(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),ee=m.useMemo(()=>({reference:x,floating:S}),[x,S]),N=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!ee.floating)return e;let t=zg(ee.floating,u.x),r=zg(ee.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Rg(ee.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ee.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:A,refs:M,elements:ee,floatingStyles:N}),[u,A,M,ee,N])}var Zee=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Fg({element:r.current,padding:i}).fn(n):r?Fg({element:r,padding:i}).fn(n):{}}}},Qee=(e,t)=>{let n=Uee(e);return{name:n.name,fn:n.fn,options:[e,t]}},$ee=(e,t)=>{let n=Wee(e);return{name:n.name,fn:n.fn,options:[e,t]}},ete=(e,t)=>({fn:Jee(e).fn,options:[e,t]}),tte=(e,t)=>{let n=Gee(e);return{name:n.name,fn:n.fn,options:[e,t]}},nte=(e,t)=>{let n=Kee(e);return{name:n.name,fn:n.fn,options:[e,t]}},rte=(e,t)=>{let n=qee(e);return{name:n.name,fn:n.fn,options:[e,t]}},ite=(e,t)=>{let n=Zee(e);return{name:n.name,fn:n.fn,options:[e,t]}},ate=Object.defineProperty,Vg=(e,t)=>ate(e,`name`,{value:t,configurable:!0}),Hg=`Popper`,[Ug,Wg]=Xd(Hg),[ote,Gg]=Ug(Hg),ste=Vg(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,h.jsx)(ote,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),cte=`PopperAnchor`,lte=m.forwardRef(Vg(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Gg(cte,n),o=m.useRef(null),s=a.onAnchorChange,c=Td(t,m.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=m.useRef(null);m.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Jg(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,h.jsx)(Gd.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Kg=`PopperContent`,[ute,dte]=Ug(Kg),fte=m.forwardRef(Vg(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:g,..._}=e,v=Gg(Kg,n),[y,b]=m.useState(null),x=Td(t,b),[S,C]=m.useState(null),w=lh(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(qg),altBoundary:A},{refs:M,floatingStyles:ee,placement:N,isPositioned:te,middlewareData:P}=Xee({strategy:`fixed`,placement:D,whileElementsMounted:Vg((...e)=>Hee(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:v.anchor},middleware:[Qee({mainAxis:i+E,alignmentAxis:o}),c&&$ee({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?ete():void 0,...j}),c&&tte({...j}),nte({...j,apply:Vg(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&ite({element:S,padding:s}),pte({arrowWidth:T,arrowHeight:E}),f&&rte({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),ne=v.setPlacementState;bf(()=>(ne(N),()=>{ne(void 0)}),[N,ne]);let[re,ie]=Jg(N),ae=ep(g);bf(()=>{te&&ae?.()},[te,ae]);let oe=P.arrow?.x,se=P.arrow?.y,ce=P.arrow?.centerOffset!==0,[le,ue]=m.useState();return bf(()=>{y&&ue(window.getComputedStyle(y).zIndex)},[y]),(0,h.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:te?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:le,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,h.jsx)(ute,{scope:n,placedSide:re,placedAlign:ie,onArrowChange:C,arrowX:oe,arrowY:se,shouldHideArrow:ce,children:(0,h.jsx)(Gd.div,{"data-side":re,"data-align":ie,..._,ref:x,style:{..._.style,animation:te?_.style?.animation:`none`}})})})},`PopperContent`));function qg(e){return e!==null}Vg(qg,`isNotNull`);var pte=Vg(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Jg(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Jg(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Vg(Jg,`getSideAndAlignFromPlacement`);var Yg=ste,Xg=lte,Zg=fte,mte=Object.defineProperty,Qg=(e,t)=>mte(e,`name`,{value:t,configurable:!0}),$g=!1;function e_(){let[e,t]=m.useState($g);return m.useEffect(()=>{$g||($g=!0,t(!0))},[]),e}Qg(e_,`useIsHydrated`);var t_=m.useSyncExternalStore;function n_(){return()=>{}}Qg(n_,`subscribe`);function r_(){return t_(n_,()=>!0,()=>!1)}Qg(r_,`useIsHydratedModern`);var hte=typeof t_==`function`?r_:e_,gte=Object.defineProperty,i_=(e,t)=>gte(e,`name`,{value:t,configurable:!0}),a_=`rovingFocusGroup.onEntryFocus`,_te={bubbles:!1,cancelable:!0},o_=`RovingFocusGroup`,[s_,c_,vte]=ef(o_),[yte,l_]=Xd(o_,[vte]),[bte,xte]=yte(o_),Ste=m.forwardRef(i_(function(e,t){return(0,h.jsx)(s_.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(s_.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Cte,{...e,ref:t})})})},`RovingFocusGroup`)),Cte=m.forwardRef(i_(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=m.useRef(null),p=Td(t,f),g=Zf(a),[_,v]=kf({prop:o,defaultProp:s??null,onChange:c,caller:o_}),[y,b]=m.useState(!1),x=ep(l),S=c_(n),C=m.useRef(!1),[w,T]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(a_,x),()=>e.removeEventListener(a_,x)},[x]),(0,h.jsx)(bte,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:_,onItemFocus:m.useCallback(e=>v(e),[v]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:m.useCallback(()=>T(e=>e-1),[]),children:(0,h.jsx)(Gd.div,{tabIndex:y||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:hf(e.onMouseDown,()=>{C.current=!0}),onFocus:hf(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(a_,_te);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);f_([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}C.current=!1}),onBlur:hf(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),wte=`RovingFocusGroupItem`,Tte=m.forwardRef(i_(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=qf(),l=a||c,u=xte(wte,n),d=u.currentTabStopId===l,f=c_(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:_}=u,v=hte();return bf(()=>{if(v&&r)return p(),()=>g()},[v,r,p,g]),m.useEffect(()=>{if(!v&&r)return p(),()=>g()},[v,r,p,g]),(0,h.jsx)(s_.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,h.jsx)(Gd.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:hf(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:hf(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:hf(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=d_(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?p_(n,r+1):n.slice(r+1)}setTimeout(()=>f_(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})},`RovingFocusGroupItem`)),Ete={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function u_(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}i_(u_,`getDirectionAwareKey`);function d_(e,t,n){let r=u_(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Ete[r]}i_(d_,`getFocusIntent`);function f_(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}i_(f_,`focusFirst`);function p_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}i_(p_,`wrapArray`);var m_=Ste,h_=Tte,Dte=Object.defineProperty,g_=(e,t)=>Dte(e,`name`,{value:t,configurable:!0}),__=[`Enter`,` `],Ote=[`ArrowDown`,`PageUp`,`Home`],v_=[`ArrowUp`,`PageDown`,`End`],kte=[...Ote,...v_];[...__],[...__];var y_=`Menu`,[b_,Ate,jte]=ef(y_),[x_,S_]=Xd(y_,[jte,Wg,l_]),C_=Wg(),w_=l_(),[Mte,T_]=x_(y_),[Nte,E_]=x_(y_),Pte=g_(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=C_(t),[c,l]=m.useState(null),u=m.useRef(!1),d=ep(a),f=Zf(i);return m.useEffect(()=>{let e=g_(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=g_(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),m.useEffect(()=>{if(!n)return;let e=g_(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,h.jsx)(Yg,{...s,children:(0,h.jsx)(Mte,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,h.jsx)(Nte,{scope:t,onClose:m.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Fte=m.forwardRef(g_(function(e,t){let{__scopeMenu:n,...r}=e,i=C_(n);return(0,h.jsx)(Xg,{...i,...r,ref:t})},`MenuAnchor`)),D_=`MenuPortal`,[Ite,Lte]=x_(D_,{forceMount:void 0}),Rte=g_(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=T_(D_,t);return(0,h.jsx)(Ite,{scope:t,forceMount:n,children:(0,h.jsx)(Lf,{present:n||a.open,children:(0,h.jsx)(Np,{asChild:!0,container:i,children:r})})})},`MenuPortal`),O_=`MenuContent`,[zte,k_]=x_(O_),Bte=m.forwardRef(g_(function(e,t){let n=Lte(O_,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=T_(O_,e.__scopeMenu),o=E_(O_,e.__scopeMenu);return(0,h.jsx)(b_.Provider,{scope:e.__scopeMenu,children:(0,h.jsx)(Lf,{present:r||a.open,children:(0,h.jsx)(b_.Slot,{scope:e.__scopeMenu,children:o.modal?(0,h.jsx)(Vte,{...i,ref:t}):(0,h.jsx)(Hte,{...i,ref:t})})})})},`MenuContent`)),Vte=m.forwardRef(g_(function(e,t){let n=T_(O_,e.__scopeMenu),r=m.useRef(null),i=Td(t,r);return m.useEffect(()=>{let e=r.current;if(e)return Bm(e)},[]),(0,h.jsx)(A_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:hf(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Hte=m.forwardRef(g_(function(e,t){let n=T_(O_,e.__scopeMenu);return(0,h.jsx)(A_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Ute=Od(`MenuContent.ScrollLock`),A_=m.forwardRef(g_(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,..._}=e,v=T_(O_,n),y=E_(O_,n),b=C_(n),x=w_(n),S=Ate(n),[C,w]=m.useState(null),T=m.useRef(null),E=Td(t,T,v.onContentChange),D=m.useRef(0),O=m.useRef(``),k=m.useRef(0),A=m.useRef(null),j=m.useRef(`right`),M=m.useRef(0),ee=g?Nm:m.Fragment,N=g?{as:Ute,allowPinchZoom:!0}:void 0,te=g_(e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=L_(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;g_((function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);m.useEffect(()=>()=>window.clearTimeout(D.current),[]),zp();let P=m.useCallback(e=>j.current===A.current?.side&&z_(e,A.current?.area),[]);return(0,h.jsx)(zte,{scope:n,searchRef:O,onItemEnter:m.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:m.useCallback(e=>{P(e)||(T.current?.focus(),w(null))},[P]),onTriggerLeave:m.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:k,onPointerGraceIntentChange:m.useCallback(e=>{A.current=e},[]),children:(0,h.jsx)(ee,{...N,children:(0,h.jsx)(bp,{asChild:!0,trapped:i,onMountAutoFocus:hf(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,h.jsx)(cp,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,h.jsx)(m_,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:hf(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,h.jsx)(Zg,{role:`menu`,"aria-orientation":`vertical`,"data-state":N_(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:hf(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&te(e.key));let i=T.current;if(e.target!==i||!kte.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);v_.includes(e.key)&&a.reverse(),F_(a)}),onBlur:hf(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:hf(e.onPointerMove,B_(e=>{let t=e.target,n=M.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>M.current?`right`:`left`;j.current=t,M.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),j_=`MenuItem`,M_=`menu.itemSelect`,Wte=m.forwardRef(g_(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=m.useRef(null),o=E_(j_,e.__scopeMenu),s=k_(j_,e.__scopeMenu),c=Td(t,a),l=m.useRef(!1),u=g_(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(M_,{bubbles:!0,cancelable:!0});e.addEventListener(M_,e=>r?.(e),{once:!0}),Kd(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,h.jsx)(Gte,{...i,ref:c,disabled:n,onClick:hf(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:hf(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:hf(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&__.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Gte=m.forwardRef(g_(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=k_(j_,n),s=w_(n),c=m.useRef(null),l=Td(t,c),[u,d]=m.useState(!1),[f,p]=m.useState(``);return m.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,h.jsx)(b_.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,h.jsx)(h_,{asChild:!0,...s,focusable:!r,children:(0,h.jsx)(Gd.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:hf(e.onPointerMove,B_(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:hf(e.onPointerLeave,B_(e=>o.onItemLeave(e))),onFocus:hf(e.onFocus,()=>d(!0)),onBlur:hf(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[Kte,qte]=x_(`MenuRadioGroup`,{value:void 0,onValueChange:g_(()=>{},`onValueChange`)}),[Jte,Yte]=x_(`MenuItemIndicator`,{checked:!1}),Xte=m.forwardRef(g_(function(e,t){let{__scopeMenu:n,...r}=e;return(0,h.jsx)(Gd.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Zte,Qte]=x_(`MenuSub`);function N_(e){return e?`open`:`closed`}g_(N_,`getOpenState`);function P_(e){return e===`indeterminate`}g_(P_,`isIndeterminate`);function $te(e){return P_(e)?`indeterminate`:e?`checked`:`unchecked`}g_($te,`getCheckedState`);function F_(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}g_(F_,`focusFirst`);function I_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}g_(I_,`wrapArray`);function L_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=I_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}g_(L_,`getNextMatch`);function R_(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}g_(R_,`isPointInPolygon`);function z_(e,t){return t?R_({x:e.clientX,y:e.clientY},t):!1}g_(z_,`isPointerInGraceArea`);function B_(e){return t=>t.pointerType===`mouse`?e(t):void 0}g_(B_,`whenMouse`);var ene=Pte,tne=Fte,nne=Rte,rne=Bte,V_=Wte,ine=Xte,ane=Object.defineProperty,H_=(e,t)=>ane(e,`name`,{value:t,configurable:!0}),U_=`DropdownMenu`,[one,sne]=Xd(U_,[S_]),W_=S_(),[cne,G_]=one(U_),K_=H_(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=W_(t),l=m.useRef(null),[u,d]=kf({prop:i,defaultProp:a??!1,onChange:o,caller:U_});return(0,h.jsx)(cne,{scope:t,triggerId:qf(),triggerRef:l,contentId:qf(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,h.jsx)(ene,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),q_=`DropdownMenuTrigger`,J_=m.forwardRef(H_(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=G_(q_,n),o=W_(n),s=Td(t,a.triggerRef);return(0,h.jsx)(tne,{asChild:!0,...o,children:(0,h.jsx)(Gd.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:hf(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:hf(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),Y_=H_(e=>{let{__scopeDropdownMenu:t,...n}=e,r=W_(t);return(0,h.jsx)(nne,{...r,...n})},`DropdownMenuPortal`),X_=`DropdownMenuContent`,Z_=m.forwardRef(H_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=G_(X_,n),a=W_(n),o=m.useRef(!1);return(0,h.jsx)(rne,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:hf(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:hf(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),lne=m.forwardRef(H_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=W_(n);return(0,h.jsx)(V_,{...i,...r,ref:t})},`DropdownMenuItem`)),une=m.forwardRef(H_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=W_(n);return(0,h.jsx)(ine,{...i,...r,ref:t})},`DropdownMenuSeparator`)),dne=K_,fne=J_,pne=Y_,mne=Z_,hne=lne,gne=une,_ne=Object.defineProperty,vne=m.forwardRef(((e,t)=>_ne(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,h.jsx)(Gd.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),yne=Object.defineProperty,Q_=(e,t)=>yne(e,`name`,{value:t,configurable:!0}),$_=`Popover`,[ev,bne]=Xd($_,[Wg]),tv=Wg(),[xne,nv]=ev($_),rv=Q_(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=tv(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=kf({prop:r,defaultProp:i??!1,onChange:a,caller:$_});return(0,h.jsx)(Yg,{...s,children:(0,h.jsx)(xne,{scope:t,contentId:qf(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),iv=`PopoverAnchor`,av=m.forwardRef(Q_(function(e,t){let{__scopePopover:n,...r}=e,i=nv(iv,n),a=tv(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return m.useEffect(()=>(o(),()=>s()),[o,s]),(0,h.jsx)(Xg,{...a,...r,ref:t})},`PopoverAnchor`)),ov=`PopoverTrigger`,sv=m.forwardRef(Q_(function(e,t){let{__scopePopover:n,...r}=e,i=nv(ov,n),a=tv(n),o=Td(t,i.triggerRef),s=(0,h.jsx)(Gd.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":bv(i.open),...r,ref:o,onClick:hf(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,h.jsx)(Xg,{asChild:!0,...a,children:s})},`PopoverTrigger`)),cv=`PopoverPortal`,[lv,uv]=ev(cv,{forceMount:void 0}),dv=Q_(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=nv(cv,t);return(0,h.jsx)(lv,{scope:t,forceMount:n,children:(0,h.jsx)(Lf,{present:n||a.open,children:(0,h.jsx)(Np,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),fv=`PopoverContent`,pv=m.forwardRef(Q_(function(e,t){let n=uv(fv,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=nv(fv,e.__scopePopover);return(0,h.jsx)(Lf,{present:r||a.open,children:a.modal?(0,h.jsx)(hv,{...i,ref:t}):(0,h.jsx)(gv,{...i,ref:t})})},`PopoverContent`)),mv=Od(`PopoverContent.RemoveScroll`),hv=m.forwardRef(Q_(function(e,t){let n=nv(fv,e.__scopePopover),r=m.useRef(null),i=Td(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return Bm(e)},[]),(0,h.jsx)(Nm,{as:mv,allowPinchZoom:!0,children:(0,h.jsx)(_v,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:hf(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:hf(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:hf(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),gv=m.forwardRef(Q_(function(e,t){let n=nv(fv,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(_v,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),_v=m.forwardRef(Q_(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=nv(fv,n),p=tv(n);return zp(),(0,h.jsx)(bp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(cp,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,h.jsx)(Zg,{"data-state":bv(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.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)`}})})})},`PopoverContentImpl`)),vv=`PopoverClose`,yv=m.forwardRef(Q_(function(e,t){let{__scopePopover:n,...r}=e,i=nv(vv,n);return(0,h.jsx)(Gd.button,{type:`button`,...r,ref:t,onClick:hf(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function bv(e){return e?`open`:`closed`}Q_(bv,`getState`);var xv=rv,Sv=av,Sne=sv,Cne=dv,wne=pv,Tne=yv,Ene=Object.defineProperty,Dne=(e,t)=>Ene(e,`name`,{value:t,configurable:!0}),One=`Toggle`,kne=m.forwardRef(Dne(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=kf({prop:n,onChange:i,defaultProp:r??!1,caller:One});return(0,h.jsx)(Gd.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:hf(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Ane=Object.defineProperty,Cv=(e,t)=>Ane(e,`name`,{value:t,configurable:!0}),wv=`ToggleGroup`,[Tv,jne]=Xd(wv,[l_]),Ev=l_(),Mne=m.forwardRef(Cv(function(e,t){let{type:n,...r}=e;if(n===`single`)return(0,h.jsx)(Nne,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,h.jsx)(Pne,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${wv}\``)},`ToggleGroup`)),[Dv,Ov]=Tv(wv),Nne=m.forwardRef(Cv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Cv(()=>{},`onValueChange`),...a}=e,[o,s]=kf({prop:n,defaultProp:r??``,onChange:i,caller:wv});return(0,h.jsx)(Dv,{scope:e.__scopeToggleGroup,type:`single`,value:m.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:m.useCallback(()=>s(``),[s]),children:(0,h.jsx)(kv,{...a,ref:t})})},`ToggleGroupImplSingle`)),Pne=m.forwardRef(Cv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Cv(()=>{},`onValueChange`),...a}=e,[o,s]=kf({prop:n,defaultProp:r??[],onChange:i,caller:wv}),c=m.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=m.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,h.jsx)(Dv,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,h.jsx)(kv,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[Fne,Ine]=Tv(wv),kv=m.forwardRef(Cv(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=Ev(n),u=Zf(o),d={dir:u,...c};return(0,h.jsx)(Fne,{scope:n,rovingFocus:i,disabled:r,children:i?(0,h.jsx)(m_,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,h.jsx)(Gd.div,{...d,ref:t})}):(0,h.jsx)(Gd.div,{...d,ref:t})})},`ToggleGroupImpl`)),Av=`ToggleGroupItem`,Lne=m.forwardRef(Cv(function(e,t){let n=Ov(Av,e.__scopeToggleGroup),r=Ine(Av,e.__scopeToggleGroup),i=Ev(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=m.useRef(null);return r.rovingFocus?(0,h.jsx)(h_,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,h.jsx)(jv,{...s,ref:t})}):(0,h.jsx)(jv,{...s,ref:t})},`ToggleGroupItem`)),jv=m.forwardRef(Cv(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=Ov(Av,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===`single`?o:void 0;return(0,h.jsx)(kne,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`));function Mv({variant:e=`secondary`,size:t=`default`}={}){return R(`sl-btn`,`sl-btn--${e}`,t===`small`&&`sl-btn--small`)}function z({variant:e=`secondary`,size:t=`default`,disabledReason:n,focusableWhenDisabled:r=!1,className:i,type:a,title:o,disabled:s,onClick:c,children:l,...u}){let d=(0,m.useId)(),f=R(Mv({variant:e,size:t}),i),p=s===!0&&n!==``?n:void 0;if(p===void 0||!r)return(0,h.jsx)(`button`,{"data-slot":`button`,"data-variant":e,type:a??`button`,title:p??o,disabled:s,onClick:c,className:f,...u,children:l});let g=[u[`aria-describedby`],d].filter(Boolean).join(` `);return(0,h.jsxs)(`button`,{"data-slot":`button`,"data-variant":e,type:a??`button`,className:f,...u,"aria-disabled":`true`,"aria-describedby":g,"data-tip":p,"data-reason":``,onClick:e=>e.preventDefault(),onPointerDown:e=>e.preventDefault(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.preventDefault()},children:[l,(0,h.jsx)(`span`,{id:d,hidden:!0,children:p})]})}function Nv({label:e,tip:t,title:n,children:r,...i}){let a=t===!1?void 0:typeof t==`string`?t:e;return(0,h.jsx)(z,{variant:`icon`,"aria-label":e,...a===void 0?{title:n??e}:{"data-tip":a},...i,children:r})}function Pv({className:e,asChild:t=!1,type:n,...r}){let i=t?kd:`button`;return(0,h.jsx)(i,{"data-slot":`play-key`,...t?{}:{type:n??`button`},className:R(`sl-key`,e),...r})}function Fv({className:e,...t}){return(0,h.jsx)(`div`,{className:R(`sl-btn-row`,e),...t})}var Rne=5e3,zne=15e3;function Bne(e,t){if(e!==`error`)return t===void 0?Rne:zne}var Iv=(0,m.createContext)(void 0);function Vne({children:e}){let[t,n]=(0,m.useState)([]),r=(0,m.useRef)(0),i=(0,m.useRef)(new Map),a=(0,m.useRef)({hover:!1,focus:!1}),o=(0,m.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e));let t=i.current.get(e);t?.handle!==void 0&&clearTimeout(t.handle),i.current.delete(e)},[]),s=(0,m.useCallback)((e,t)=>{t.startedAt=Date.now(),t.handle=setTimeout(()=>o(e),t.remaining)},[o]),c=(0,m.useCallback)((e,t)=>{let n=a.current.hover||a.current.focus;a.current={...a.current,[e]:t};let r=a.current.hover||a.current.focus;if(n!==r)for(let[e,t]of i.current)r?(t.handle!==void 0&&clearTimeout(t.handle),t.handle=void 0,t.remaining=Math.max(0,t.remaining-(Date.now()-t.startedAt))):(t.remaining=Math.max(t.remaining,2e3),s(e,t))},[s]),l=(0,m.useCallback)((e,t=`info`,o)=>{r.current+=1;let c=r.current;n(n=>{let r=n.filter(t=>t.message!==e);for(let e of r.slice(0,Math.max(0,r.length-2))){let t=i.current.get(e.id);t?.handle!==void 0&&clearTimeout(t.handle),i.current.delete(e.id)}return[...r.slice(-2),{id:c,message:e,tone:t,action:o}]});let l=Bne(t,o);if(l===void 0)return;let u={remaining:l,startedAt:Date.now(),handle:void 0};i.current.set(c,u),a.current.hover||a.current.focus||s(c,u)},[s]);(0,m.useEffect)(()=>{t.length===0&&(a.current={hover:!1,focus:!1})},[t.length]),(0,m.useEffect)(()=>{let e=i.current;return()=>{for(let t of e.values())t.handle!==void 0&&clearTimeout(t.handle)}},[]);let u=(0,m.useMemo)(()=>l,[l]),d=t.filter(e=>e.tone!==`error`),f=t.filter(e=>e.tone===`error`),p=e=>(0,h.jsx)(Hne,{toast:e,dismiss:()=>o(e.id)},e.id);return(0,h.jsxs)(Iv.Provider,{value:u,children:[e,(0,h.jsxs)(`section`,{"aria-label":`Notifications`,className:`sl-toasts`,onPointerEnter:()=>c(`hover`,!0),onPointerLeave:()=>c(`hover`,!1),onFocus:()=>c(`focus`,!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||c(`focus`,!1)},children:[(0,h.jsx)(`div`,{"aria-live":`assertive`,"aria-relevant":`additions text`,className:`sl-toasts__list`,children:f.map(p)}),(0,h.jsx)(`div`,{"aria-live":`polite`,"aria-relevant":`additions text`,className:`sl-toasts__list`,children:d.map(p)})]})]})}function Hne({toast:e,dismiss:t}){return(0,h.jsxs)(`div`,{"data-tone":e.tone,className:R(`sl-toast sl-enter`,e.tone===`error`&&`sl-toast--failed`,e.tone===`success`&&`sl-toast--done`),children:[e.tone===`error`?(0,h.jsx)(Sl,{"aria-hidden":`true`,strokeWidth:1.75}):e.tone===`success`?(0,h.jsx)(Ac,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(el,{"aria-hidden":`true`,strokeWidth:1.75,className:`text-ink-2`}),(0,h.jsx)(`p`,{className:`sl-toast__text m-0 min-w-0 break-words`,children:e.message}),e.action===void 0?null:(0,h.jsx)(z,{variant:`quiet`,size:`small`,onClick:()=>{t(),e.action?.run()},children:e.action.label}),(0,h.jsx)(`button`,{type:`button`,"aria-label":`Dismiss notification`,onClick:t,className:`sl-btn sl-btn--icon sl-btn--small -mr-1 w-[30px]`,children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})}function Lv(){return(0,m.useContext)(Iv)??Une}function Une(){}var Rv=(0,m.createContext)(void 0);function Wne({deps:e,children:t}){return(0,h.jsx)(Rv.Provider,{value:e,children:(0,h.jsx)(Vne,{children:t})})}function B(){let e=(0,m.useContext)(Rv);if(e===void 0)throw Error(`useApp was called outside AppProvider`);return e}var zv=`Slopify`,Bv,Vv=[];function Hv(){if(typeof document>`u`)return;let e=Vv.at(-1)?.title??Bv;document.title=e===void 0||e===``?zv:`${e} · ${zv}`}function Uv(e){Bv=e,Hv()}function Wv(e){(0,m.useEffect)(()=>{if(e===void 0||e===``)return;let t={title:e};return Vv.push(t),Hv(),()=>{Vv.splice(Vv.indexOf(t),1),Hv()}},[e])}function Gv(e){return[[/^\/$/,`Home`],[/^\/projects\/?$/,`Projects`],[/^\/projects\/[^/]+/,`Project`],[/^\/play/,`Create`],[/^\/calendar/,`Calendar`],[/^\/schedules/,`Calendar`],[/^\/channels\/?$/,`Channels`],[/^\/channels\/[^/]+/,`Channel`],[/^\/prompts/,`Library · Prompts`],[/^\/entries/,`Library · Intros and outros`],[/^\/templates/,`Library · Templates`],[/^\/document-themes/,`Library · Documents`],[/^\/narration-aliases/,`Library · Narration aliases`],[/^\/ab-results/,`Library · A/B results`],[/^\/settings/,`Settings`],[/^\/help/,`Tutorials`],[/^\/welcome/,`Welcome`]].find(([t])=>t.test(e))?.[1]}var Kv=Km,qv=Xm;function Jv({className:e,...t}){return(0,h.jsx)(Qm,{"data-slot":`dialog-overlay`,className:R(`fixed inset-0 z-40 bg-scrim`,e),...t})}function Yv({className:e,children:t,...n}){return(0,h.jsxs)(qv,{children:[(0,h.jsx)(Jv,{}),(0,h.jsx)(nh,{"data-slot":`dialog-content`,className:R(`sl-dialog fixed top-1/2 left-1/2 z-50 max-h-[calc(100vh-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`data-[state=open]:animate-dialog-in motion-reduce:animate-none`,e),...n,children:t})]})}function Xv({className:e,...t}){return(0,h.jsx)(sh,{"data-slot":`dialog-title`,className:R(`sl-dialog__title text-ink`,e),...t})}function Zv({className:e,...t}){return(0,h.jsx)(bee,{"data-slot":`dialog-description`,className:R(`m-0 text-body text-ink-2`,e),...t})}function Qv({open:e,onOpenChange:t,title:n,description:r,footer:i,children:a,className:o,dismissible:s=!0}){return(0,h.jsx)(Kv,{open:e,...t===void 0?{}:{onOpenChange:t},children:(0,h.jsxs)(Yv,{className:o,...s?{}:{onEscapeKeyDown:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()},...r===void 0?{"aria-describedby":void 0}:{},children:[(0,h.jsx)(Xv,{children:n}),r===void 0?null:(0,h.jsx)(Zv,{children:r}),a,i===void 0?null:(0,h.jsx)(`div`,{className:`sl-dialog__foot`,children:i})]})})}function $v({open:e,title:t,consequence:n,confirmLabel:r,cancelLabel:i,tone:a=`destructive`,pending:o=!1,onConfirm:s,onCancel:c}){return(0,h.jsx)(Qv,{open:e,onOpenChange:e=>{e||c()},title:t,description:n,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{variant:`secondary`,autoFocus:!0,onClick:c,children:i??(a===`destructive`?`Keep it`:`Cancel`)}),(0,h.jsx)(z,{variant:a,disabled:o,disabledReason:`Working on it`,onClick:s,children:r})]})})}var ey=[`onboarding`],ty=[`onboarding`,`sample`],ny=(e,t)=>[`narration-peaks`,e,t],ry=(e,t,n)=>e.fetch(`${e.origin}/api/onboarding${t}`,{method:`POST`,...n===void 0?{}:{headers:{"content-type":`application/json`},body:JSON.stringify(n)}});async function iy(e){return L(await e.fetch(`${e.origin}/api/onboarding`))}async function ay(e){await L(await ry(e,`/dismiss`))}async function oy(e,t){return L(await ry(e,`/packs/${encodeURIComponent(t)}`))}async function sy(e,t){return L(await ry(e,`/short`,t))}async function cy(e,t){return L(await ry(e,`/full-video`,t))}async function ly(e){return L(await e.fetch(`${e.origin}/api/onboarding/sample`))}function uy(e,t){return e!==void 0&&Object.values(e.samples).includes(t)}async function dy(e){return L(await ry(e,`/sample/restore`))}async function fy(e,t=py()){return L(await ry(e,`/sample/copy`,t===void 0?void 0:{projectId:t}))}function py(){if(typeof window>`u`)return;let e=/\/projects\/([^/?#]+)/.exec(window.location.pathname);return e?.[1]===void 0?void 0:decodeURIComponent(e[1])}async function my(e,t){return L(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/narration/peaks`))}var V={projects:[`projects`],revisions:e=>[`project`,e,`revisions`],revision:(e,t)=>[`project`,e,`revision`,t],revisionFile:(e,t,n)=>[`revision-file`,e,t,n],project:e=>[`project`,e],runCost:e=>[`project`,e,`run-cost`],article:(e,t=null)=>[`project`,e,`article`,t],audioPreview:(e,t)=>[`audio-preview`,e,t],file:(e,t)=>[`file`,e,t],staging:[`staging`],notice:[`notice`],usage:[`usage`],providers:[`providers`],voices:[`voices`],prompts:[`prompts`],entries:[`entries`],documentThemes:[`document-themes`],narrationAliases:[`narration-aliases`],settings:[`settings`],youtubeEdits:e=>[`project`,e,`youtube-edits`],channelLinks:[`channel-links`],projectChannelLinks:e=>[`channel-links`,`project`,e]},hy=15e3,gy=new Set([`running`,`pending`]);function _y(e){return ot({queryKey:V.projects,queryFn:()=>jo(e),refetchInterval:e=>e.state.data?.projects.some(e=>gy.has(e.status))===!0&&hy,refetchIntervalInBackground:!1})}function vy(e,t){return ot({queryKey:V.project(t),queryFn:()=>Mo(e,t),refetchInterval:e=>e.state.data!==void 0&&gy.has(e.state.data.project.status)?hy:!1})}function yy(e,t){return ot({queryKey:V.runCost(t),queryFn:()=>No(e,t)})}function by(e){return ot({queryKey:V.notice,queryFn:()=>Ko(e)})}function Gne(e){return ot({queryKey:V.usage,queryFn:()=>Go(e)})}function xy(e){return ot({queryKey:V.providers,queryFn:()=>Yo(e)})}function Sy(e){return ot({queryKey:V.voices,queryFn:()=>As(e)})}function Cy(e){return ot({queryKey:V.prompts,queryFn:()=>Ls(e)})}function wy(e){return ot({queryKey:V.entries,queryFn:()=>Ys(e)})}function Ty(e){return ot({queryKey:V.documentThemes,queryFn:()=>Zs(e)})}function Ey(e){return ot({queryKey:V.narrationAliases,queryFn:()=>nc(e)})}function Dy(e){return ot({queryKey:V.settings,queryFn:()=>$o(e)})}var Kne={"library.prompt.kind":{title:`Prompt kind`,body:`What the prompt is for, which decides where Play offers it. Article writes the video's text, Image and Thumbnail describe pictures, Narration Preparation adds delivery cues, YouTube Description writes the description, Shorts picks the short clips, Review checks a finished stage, Script writes speaker turns for several voices.`,tutorial:{page:`Prompts`,anchor:`prompt-kinds`}},"library.prompt.name":{title:`Prompt name`,body:`What Play and Edit project list this prompt by. Up to 200 characters, and unique within its kind. Templates remember a prompt by name, so after a rename they use the copy saved with them until you pick it again.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.article":{title:`Article prompt`,body:`The instruction the text model gets to write the video's article, which becomes the narration. Each {{keyword}} becomes a field on Play. One call on the project's LLM, plus up to 3 more when the answer runs out of room; research notes go first when research ran. The answer's sources and pronunciation sections are never narrated.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.image":{title:`Image prompt`,body:`Sent as written to the image model, with the keywords filled in; no text model rewrites it. Play sets how many pictures each prompt makes (1 to 20, at most 60 a run), and each picture is one image call. Pictures show for 15 s each by default and repeat until the video ends.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.thumbnail":{title:`Thumbnail prompt`,body:`Sent to the image model to draw the thumbnail. With Thumbnail set to Prompt by LLM, the text model first turns it into a picture prompt using the title and article, one extra call. 1 thumbnail by default, or 3: the second a close-up, the third a wider shot, each one image call.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.narration":{title:`Narration Preparation prompt`,body:`Tells the text model how the narration should be delivered. It only adds cues, such as a short speaking direction or a laugh or sigh, and never rewrites the words. One call each for the body, the intro and the outro. Works only with the Inworld TTS-2 voice model. With several speakers, each speaker on TTS-2 gets cues suited to their role.`,tutorial:{page:`Play-Narration`,anchor:`narration-preparation`}},"library.prompt.body.description":{title:`YouTube Description prompt`,body:`Tells the text model how to write the video's YouTube description, chapters, hashtags and tags from the timestamped transcript. One call per video. Each {{keyword}} becomes a field on Play. A project that picks none uses the Built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.shorts":{title:`Shorts prompt`,body:`Tells the text model which moments of the video to cut into vertical shorts (3 of 60 to 120 s by default). One call picks them, then one call per short writes its picture prompts, and each picture is one image call. A project that picks none uses the Built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.review":{title:`Review prompt`,body:`Tells the reviewer what to check in a finished article, set of images, narration, thumbnail or shorts, and when to flag or redo it. One reviewer call per item checked; pictures can only be judged by the Claude Code and Codex reviewers. A stage with none picked uses its own built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.script":{title:`Script prompt`,body:`Used in place of an Article prompt when a run has several voices and writes a script. The text model answers with # section headings and Name: words turns, one speaker per paragraph; text in [square brackets] is not spoken. One call on the project's LLM.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.starter":{title:`Starter text`,body:`Fills the body with ready-made text to start from: the documentary delivery cues for Narration Preparation, or the Built-in wording YouTube Description and Shorts use when no prompt is picked. When the body already has text you confirm first. Nothing is saved until you choose Save.`,tutorial:{page:`Prompts`,anchor:`start-from-ready-made-text`}},"library.prompt.photorealistic":{title:`Draws photorealistic pictures`,body:`Turn on when this prompt's style looks like real photos or film. Prepare upload then answers Yes to YouTube's AI use question (a realistic-looking scene that didn't happen) for videos and shorts drawn with it. Leave off for painterly or illustrated styles. Applies at once, apart from Save; a channel's Always Yes or Always No wins. Default: off.`,tutorial:{page:`Prompts`,anchor:`mark-an-image-prompt-as-photorealistic`}},"library.slots":{title:`Detected slots`,body:`Every {{keyword}} in the body, listed as you type. Each becomes one field on Play, typed once and filled into every prompt that names it. Names are case-sensitive, so {{Topic}} and {{topic}} are two fields. A keyword the project title also names is typed per video and saved empty in templates.`,tutorial:{page:`Prompts`,anchor:`keywords-slots`}},"library.used-by":{title:`Used by`,body:`The templates, schedules and projects that name this item, matched by name within its kind. For a project it says how many of its revisions used it and whether the current one does. Projects keep their own text, so editing here changes only runs started later.`,tutorial:{page:`Prompts`,anchor:`used-by`}},"library.history":{title:`History`,body:`Every save that changes the name or text adds a version, and every version is kept. Here you see the latest change with the changed words marked. Compare versions opens them all side by side, with Restore for an older one.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.history.compare":{title:`Compare versions`,body:`Pick any two saved versions to see them side by side, with the words that changed marked. Older and Newer can be any versions; a rename between them is said above the text.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.history.versions":{title:`Versions`,body:`Every saved version, newest first. Restore saves an older version again as a new version, so nothing after it is lost and History notes where it came from. Projects already made keep their text.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.entry.category":{title:`Intro or outro`,body:`An intro is narrated before the body of the video, an outro after it, in the same voice. Play offers each in its own picker. A name only needs to be unique within its category.`,tutorial:{page:`Intros-and-Outros`,anchor:`text-or-llm`}},"library.inline-rename":{title:`Rename in the list`,body:`Changes only the name, right in the list; the text stays as it is. Enter saves, Escape keeps the old name, and Undo on the notice renames it back. A prompt or intro/outro keeps the rename in History; templates that picked the old name use the copy saved with them until you pick it again. A template saves a new version; schedules keep the version they were made from.`,tutorial:{page:`Library-Overview`,anchor:`rename-in-the-row`}},"library.entry.name":{title:`Entry name`,body:`What Play and Edit project list this intro or outro by. Up to 200 characters, and unique within its category.`,tutorial:{page:`Intros-and-Outros`,anchor:`write-an-intro-or-outro`}},"library.entry.mode":{title:`Mode`,body:`Text is narrated as written, with the keywords filled in and no extra call. LLM sends the body as an instruction to the project's text model, with the title, keyword values and article, and narrates the answer: one call per entry, and the run then needs an LLM. Default: Text.`,tutorial:{page:`Intros-and-Outros`,anchor:`text-or-llm`}},"library.entry.body":{title:`Entry body`,body:`In Text mode, the words the narrator says; in LLM mode, the instruction whose answer is said. Each {{keyword}} becomes a field on Play. It is narrated as its own audio file with the run's voice, one voice request each.`,tutorial:{page:`Intros-and-Outros`,anchor:`write-an-intro-or-outro`}},"library.aliases":{title:`Narration aliases`,body:`Words the narrator says differently from how they are written, such as Dr. as Doctor. Only what the voice and Narration Preparation receive changes; the article and captions keep the written words. A project copies this list when it starts and uses it while Use narration aliases is on. Up to 1000 aliases, saved as a whole.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`narration-aliases`}},"library.aliases.written":{title:`Written`,body:`The word or phrase as it appears in the article, up to 200 characters. Spaces inside it match any spacing. Two aliases can't share a written form; where two overlap, the one starting first wins, then the longer.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.spoken":{title:`Say it as`,body:`What the narrator says instead, spelled the way it sounds, up to 500 characters. Only the audio changes. An alias wins over a Pronunciation Glossary entry for the same words.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.whole-word":{title:`Whole word`,body:`On: matches only where the written form stands as a word of its own, so it never fires inside a longer word. Off: matches inside other words too. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.match-case":{title:`Match case`,body:`On: matches only with the same capital letters, so US is not us. Off: capitals are ignored. Default: off.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"templates.show-channel":{title:`Show templates of`,body:`Shows only the templates of one channel, or of all. A template's channel is the one a draft made from it runs in. Choosing here changes nothing about the templates.`,tutorial:{page:`Templates`,anchor:`filter-by-channel`}},"templates.apply":{title:`Use in Play`,body:`Makes a new Play draft from the template and opens it in Play for you to review; nothing starts. Keywords the project title names start empty for this video's topic, and uploaded files keep their names but must be attached again. The template itself is unchanged.`,tutorial:{page:`Templates`,anchor:`use-a-template`}},"templates.save":{title:`Save a setup`,body:`Keeps a saved Play draft as a reusable template: every setting and checkpoint choice, plus a copy of each picked prompt and intro or outro. Keywords the project title names, like {{Topic}}, are saved empty; other keywords keep their values. Queued extra videos and uploaded fonts are left out.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.save.draft":{title:`Saved Play draft`,body:`The Play draft whose setup the template keeps. Only drafts saved in Play are listed; open Play to prepare one first. The draft itself stays as it is.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.save.name":{title:`Template name`,body:`What the template is called in this list and wherever you pick a template, such as a schedule. Up to 120 characters.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.edit":{title:`Edit a template`,body:`Shows the keywords the template fills and what each feeds. The pencil beside its name renames it; every save adds a version that History keeps. To change its settings, use it in Play, change the draft, then Save a setup.`,tutorial:{page:`Templates`,anchor:`see-a-templates-keywords`}},"templates.history":{title:`Template versions`,body:`Every saved version of the template, newest first. Pick one to compare its setup with the current one. Restore saves the older setup again as a new version, so nothing is lost. Drafts and projects made from it keep their setup.`,tutorial:{page:`Templates`,anchor:`history`}},"templates.save.channel":{title:`Template channel`,body:`The channel the template belongs to, and the one a draft made from it runs in. Default: the draft's own channel, or its template's channel when it has none.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"library.themes.yours":{title:`Your themes`,body:`Themes you made or copied from a built-in. Pick one on the Document row in Play or in Edit project. A project keeps its own copy of the settings, so editing or deleting a theme here never changes a PDF already made or queued.`,tutorial:{page:`Document-Themes`,anchor:`built-in-and-your-own-themes`}},"library.themes.built-in":{title:`Built-in themes`,body:`Looks that ship with Slopify and can't be changed. Plain is an unbranded flat page and what a new project gets. Copy one to make a theme of your own you can edit.`,tutorial:{page:`Document-Themes`,anchor:`built-in-and-your-own-themes`}},"library.theme.name":{title:`Theme name`,body:`What the theme is called on the Document row in Play and in Edit project. Up to 80 characters.`,tutorial:{page:`Document-Themes`,anchor:`make-a-theme`}},"library.theme.preview":{title:`Preview`,body:`A sample article laid out with this theme by the same renderer that makes a project's PDF, redrawn about half a second after you stop typing. It runs on your computer and costs nothing. Your projects use their own text and thumbnail.`,tutorial:{page:`Document-Themes`,anchor:`make-a-theme`}},"library.theme.page.format":{title:`Paper size`,body:`The page size of the PDF. A4 (210 × 297 mm) is used in most of the world; US Letter (216 × 279 mm) in the US and Canada. Pick the one your readers print on. Default: A4.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.page.margin":{title:`Margins`,body:`Blank space kept on every edge of each page, in millimetres. Wider margins mean shorter lines and more pages. From 5 to 60 mm. Default: 22 mm.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.page.content-top":{title:`Text starts at`,body:`How far from the top of the page the text begins on pages that carry the running header, in millimetres. Raise it when text crowds the header. From 5 to 80 mm. Default: 32 mm.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.background.image":{title:`Background`,body:`Parchment texture stretches an aged-paper picture over every page. Flat colour fills each page with the Page colour, drawn slightly darker at the edges. Default: Flat colour.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.background.color":{title:`Page colour`,body:`The colour of every page when Background is Flat colour; ignored with the parchment texture. Type a hex code like #fdfaf3 or use the picker. Default: #fdfaf3, a warm off-white.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.colors.heading":{title:`Heading colour`,body:`The colour of headings, drop caps, the brand name and links. Type a hex code like #1f3a5f or use the picker. Default: #1f3a5f, a dark blue.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.text":{title:`Body text colour`,body:`The colour of paragraphs, lists and bold or italic text. Keep it dark against the page colour so it reads and prints well. Default: #1a1a1a, near black.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.muted":{title:`Muted colour`,body:`The colour of dates, bullets, quotes and the dotted lines on the contents page. Default: #555555, a mid grey.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.faint":{title:`Faint colour`,body:`The colour of the running header and the page numbers, kept light so they stay out of the way. Default: #888888, a light grey.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.fonts.body":{title:`Body font`,body:`The font of paragraphs and lists. The first box picks the family, the second its weight or italic, the number adds space between letters in millimetres (-0.5 to 2). Cinzel is bundled and has no italics; Times, Helvetica and Courier are built into every PDF reader. Default: Cinzel Regular, 0.01 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.strong":{title:`Bold text font`,body:`The font of bold words inside paragraphs. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Bold, 0.02 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.emphasis":{title:`Italic text font`,body:`The font of italic words inside paragraphs. Cinzel has no italics, so the default borrows Times. Family, style and letter spacing in millimetres, as for Body. Default: Times Italic, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.heading":{title:`Heading font`,body:`The font of the article's headings and of the contents, sources and closing page titles. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Bold, 0.02 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.dramatic":{title:`Chapter numbers and brand font`,body:`The font of the big number in a heading like "Chapter 3:" and of the brand name on the title page. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Black, 0.03 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.decorative":{title:`Tagline and link font`,body:`The font of the tagline and the linked line on the title page, and of the link and closing line on the closing page. Default: Cinzel Medium, 0.015 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.drop-cap":{title:`Drop cap font`,body:`The font of the large first letter that starts a paragraph after a heading, when drop caps are on. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Black, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.footer":{title:`Header and page number font`,body:`The font of the running header and the page numbers. Family, style and letter spacing in millimetres, as for Body. Default: Times Regular, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.sizes.title":{title:`Title size`,body:`The size of the article's title on the title page, in points (1 pt is about 0.35 mm). From 6 to 72 pt. Default: 22 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.brand":{title:`Brand size`,body:`The size of the brand name on the title page, in points. Shown only when Branding has a brand name. From 6 to 72 pt. Default: 31 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.section":{title:`Top-level heading size`,body:`The size of top-level headings and of the contents, sources and closing page titles, in points. From 6 to 72 pt. Default: 19 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.heading":{title:`Second-level heading size`,body:`The size of second-level headings, the ones inside a top-level section, in points. From 6 to 72 pt. Default: 17 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.subheading":{title:`Third-level heading size`,body:`The size of third-level and deeper headings, in points. From 6 to 72 pt. Default: 13 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.body":{title:`Body size`,body:`The size of paragraphs, lists and the closing page text, in points. Bigger text means more pages. From 6 to 24 pt. Default: 10.5 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.meta":{title:`Date and word count size`,body:`The size of the date, word count and link lines under the title on the title page, in points. From 5 to 24 pt. Default: 10 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.footer":{title:`Header and page number size`,body:`The size of the running header and the page numbers, in points. From 5 to 24 pt. Default: 9 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.spacing.body-line":{title:`Body line height`,body:`The distance from one line of body text to the next, in millimetres. Raise it for airier pages, lower it to fit more on each page. From 3 to 20 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.heading-line":{title:`Heading line height`,body:`The distance between the lines of a top- or second-level heading that wraps, in millimetres. From 3 to 30 mm. Default: 11 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.subheading-line":{title:`Subheading line height`,body:`The distance between the lines of a third-level heading that wraps, in millimetres. From 3 to 30 mm. Default: 9 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.paragraph-gap":{title:`After a paragraph`,body:`Extra space after each paragraph, as a share of a body line: 0.5 is half a line. From 0 to 3. Default: 0.5.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.heading-gap":{title:`Before a heading`,body:`Extra space above each heading, as a share of a body line: 1 is one full line. From 0 to 5. Default: 1.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.item-gap":{title:`After a list item`,body:`Extra space after each bulleted or numbered item, as a share of a body line. From 0 to 3. Default: 0.2.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.list-indent":{title:`List indent`,body:`How far bulleted and numbered lists are pushed in from the left margin, in millimetres. From 0 to 30 mm. Default: 6 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.quote-indent":{title:`Quote indent`,body:`How far quotes are pushed in from the left margin, in millimetres. From 0 to 40 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.rule-width":{title:`Divider width`,body:`The width of the short centred line a --- in the article becomes, in millimetres. From 0 to 150 mm. Default: 30 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.drop-cap.enabled":{title:`Drop caps`,body:`Starts the first paragraph after each heading with a large first letter that spans several lines, as in printed books. Turn it off for a plainer page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.lines":{title:`Drop cap lines tall`,body:`How many lines of body text the large first letter spans. Default: 3 lines.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.scale":{title:`Drop cap letter size`,body:`The size of the large first letter, as a multiple of the height of the lines it spans. From 1 to 5. Default: 3.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.gap":{title:`Gap beside the drop cap`,body:`The space between the large first letter and the text beside it, in millimetres. From 0 to 20 mm. Default: 4 mm.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.min-length":{title:`Shortest paragraph`,body:`A paragraph shorter than this many characters starts plainly, so a one-line paragraph never gets a huge letter. From 0 to 2000. Default: 50.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.min-room":{title:`Room needed`,body:`With less than this share of the page left, a paragraph that starts with a drop cap moves to the next page. 0.25 is a quarter of the page. From 0 to 1. Default: 0.25.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.title-page.brand-y":{title:`Brand from top`,body:`Where the brand name sits on the title page, measured from the top edge of the page in millimetres. From 10 to 200 mm. Default: 60 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.tagline-offset":{title:`Tagline below brand`,body:`The distance from the brand name down to the tagline, in millimetres. From 0 to 60 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.title-y":{title:`Title from top`,body:`Where the article's title sits on the title page, measured from the top edge of the page in millimetres. From 10 to 250 mm. Default: 80 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.title-line":{title:`Title line height`,body:`The distance between the lines of a title that wraps, in millimetres. From 3 to 40 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.meta-offset":{title:`Details below title`,body:`The distance from the title down to the date and word count, in millimetres, when there is no cover picture. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.meta-line":{title:`Details line height`,body:`The distance between the date, word count and link lines on the title page, in millimetres. From 3 to 30 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.show-date":{title:`Show the date`,body:`Prints "Written on" and the date the PDF was made under the title on the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.show-word-count":{title:`Show the word count`,body:`Prints the article's word count under the title on the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover":{title:`Thumbnail as cover`,body:`Puts the project's thumbnail on the title page, between the title and the date, when the project has one. Without a thumbnail the page is laid out as if this were off. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover-gap":{title:`Space around cover`,body:`The space above and below the cover picture on the title page, in millimetres. From 0 to 40 mm. Default: 6 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover-height":{title:`Cover height at most`,body:`The tallest the cover picture may be, in millimetres. It keeps its shape and shrinks further when the page has less room. From 20 to 200 mm. Default: 110 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.brand.name":{title:`Brand name`,body:`Your channel or brand, printed large at the top of the title page and before the title in the running header ("Brand | Title"). Leave it empty to show no brand. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.tagline":{title:`Tagline`,body:`A short line under the brand name on the title page. Leave it empty to hide it. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.url":{title:`Website`,body:`The web address the brand name and the title-page link open when clicked in the PDF. Leave it empty for no link. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.link-label":{title:`Link text`,body:`The words of a linked line under the word count on the title page; it opens Website. Leave it empty to hide the line. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.contents.enabled":{title:`Contents page`,body:`Adds a table of contents after the title page, listing the article's headings with their page numbers. Each entry is a link to its page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.title":{title:`Contents page title`,body:`The heading at the top of the contents page. Up to 300 characters. Default: Table of Contents.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.depth":{title:`Lists headings down to`,body:`Which headings the contents page lists: only top-level ones, down to second-level, or down to third-level. Deeper lists take more room and can add a page. Default: Second level.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.title-offset":{title:`Contents title position`,body:`The distance from the top margin down to the contents page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.first-entry-offset":{title:`First entry position`,body:`The distance from the top margin down to the first entry of the contents, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.line":{title:`Contents line height`,body:`The distance from one contents entry to the next, in millimetres. From 3 to 30 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.indent":{title:`Indent per level`,body:`How much further in each deeper heading level is listed on the contents page, in millimetres. From 0 to 30 mm. Default: 5 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.header.enabled":{title:`Running header`,body:`Prints the brand and the article title ("Brand | Title") at the top of every page after the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.header.top":{title:`Header from top`,body:`The distance from the top edge of the page to the running header, in millimetres. From 3 to 60 mm. Default: 15 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.header.max-title":{title:`Header title at most`,body:`A title longer than this many characters is cut short in the running header so it fits on one line. From 5 to 200. Default: 35.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.enabled":{title:`Page numbers`,body:`Prints a page number at the bottom of every page after the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.text":{title:`Page number text`,body:`The words around the page number; {page} becomes the number, so "Page {page}" prints "Page 4". Default: Page {page}.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.bottom":{title:`Page number from the bottom`,body:`The distance from the bottom edge of the page to the page number, in millimetres. From 3 to 60 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.reserve":{title:`Space kept above page number`,body:`Space kept free above the page number, so body text always stops short of it, in millimetres. From 0 to 60 mm. Default: 15 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.sources.enabled":{title:`Sources page`,body:`Adds a page listing the web links the article and its research used, each one clickable. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.title":{title:`Sources page title`,body:`The heading at the top of the sources page. Up to 300 characters. Default: Sources Consulted.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.title-offset":{title:`Sources title position`,body:`The distance from the top margin down to the sources page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.body-offset":{title:`Sources list position`,body:`The distance from the top margin down to the first source, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.line":{title:`Sources line height`,body:`The distance between the lines of one source, in millimetres. From 3 to 30 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.gap":{title:`Gap between sources`,body:`Extra space between one source and the next, in millimetres. From 0 to 20 mm. Default: 2 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.end-page.enabled":{title:`Closing page`,body:`Adds a last page with your own text, such as an about section, a thank-you or a link to your site. Default: off.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.title":{title:`Closing page title`,body:`The heading at the top of the closing page. Up to 300 characters. Default: About.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.lines":{title:`Closing page text`,body:`The closing page text, one line per row, up to 60 lines of 300 characters. A line starting with "•" becomes a muted bullet, one ending with ":" a bold label, an empty line a gap. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.details":{title:`Add date, word and page counts`,body:`Adds a Document Details list under your text: the date written, the total words and the total pages. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.link":{title:`Closing page link`,body:`Adds a clickable line after your text: the words to show and the web address it opens. Leave the address empty to show the words without a link. Default: off.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.closing":{title:`Closing line`,body:`A last line after the text and the link, such as a sign-off, in the decorative font. Leave it empty to leave it out. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.title-offset":{title:`Closing title position`,body:`The distance from the top margin down to the closing page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.body-offset":{title:`Closing text position`,body:`The distance from the top margin down to the first line of the closing text, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.metadata.author":{title:`PDF author`,body:`The author a PDF reader shows in the document properties; it is not printed on the pages. {title} becomes the article title. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.subject":{title:`PDF subject`,body:`The subject a PDF reader shows in the document properties. {title} becomes the article title. Default: {title}.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.keywords":{title:`PDF keywords`,body:`Search words a PDF reader shows in the document properties, usually separated by commas. Up to 1000 characters. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.creator":{title:`PDF creator`,body:`The app or person a PDF reader shows as the creator in the document properties. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}}},qne={"planning.schedules":{title:`Schedules`,body:`A schedule starts a new project from a saved template at a local time, while Slopify is open on this machine. Each run makes a fresh project, so changing the template later never rewrites an old run. It uses the template version you picked and never includes uploaded media. Each run costs what that template's project costs.`,tutorial:{page:`Schedules`}},"planning.schedule.name":{title:`Schedule name`,body:`A name to tell this schedule apart in the list, on the calendar and on the channel page. It never appears in the videos. Up to 200 characters.`,tutorial:{page:`Schedules`,anchor:`create-a-schedule`}},"planning.schedule.template":{title:`Template`,body:`The saved template each run starts from, with its version. The schedule keeps this version when you save the template again; pick the template again here to use the newer one. The template decides the providers, and so what each run costs. Save templates from Play; they are listed in Library → Templates.`,tutorial:{page:`Schedules`,anchor:`create-a-schedule`}},"planning.schedule.cadence":{title:`Cadence`,body:`How often the schedule runs. Every day runs once a day at the local time. Selected weekdays runs on the days you tick. One time runs once at a date and time, then completes. Each run starts one project. Default: Every day at 09:00.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.time":{title:`Local time`,body:`The clock time each run starts, read in the timezone below. Default: 09:00. A run only starts while Slopify is open; Missed run decides what happens when it was closed.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.once-at":{title:`Run at`,body:`The date and time of the single run, read in the timezone below. After that run starts, the schedule shows as completed.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.weekdays":{title:`Weekdays`,body:`The days a Selected weekdays schedule runs, each at the local time. Tick at least one; each ticked day is one project a week. Default: Mon, Wed and Fri.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.timezone":{title:`Timezone`,body:`The IANA zone the run time is read in, such as Europe/Tirane or America/New_York. Default: this computer's zone. When clocks go back, a repeated time uses the earlier one; a time skipped when clocks go forward moves forward by the gap.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.timezone-once":{title:`Timezone`,body:`The IANA zone the one-off date and time are read in, such as Europe/Tirane or America/New_York. Default: this computer's zone. When clocks go back, a repeated time uses the earlier one; nonexistent spring-forward times are refused, so pick another.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.missed":{title:`Missed run`,body:`What happens to a run that came due while Slopify was closed or asleep. Skip drops it when it is more than 1 minute late and waits for the next time. Run once when Slopify reopens starts one catch-up run, however many were missed. Default: Skip.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.spend":{title:`Spend ceiling`,body:`The most one run may cost, in US dollars, such as 5 or 2.50. Before each run Slopify estimates the project's cost; when the high estimate is over this, or a cost can't be estimated, the run fails instead of starting. Leave it empty for no ceiling. Default: empty.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.topics":{title:`Topics`,body:`Each run takes the first topic, starts one project with it and removes it from the list. The schedule completes when the list is empty, unless topic generation is on. With no topics and generation off, every run uses the template as saved. Up to 500 topics.`,tutorial:{page:`Schedules`,anchor:`topics`}},"planning.schedule.inline-topics":{title:`Queued topics`,body:`Change the queue right here: type a topic and press Enter to add it, edit one in its field and press Enter to rename it, use the arrows to move it and the cross to remove it. Each change saves at once and changes only the queue; Undo on the notice puts it back. For a topic's own keyword values, press Edit.`,tutorial:{page:`Schedules`,anchor:`edit-the-queued-topics-in-place`}},"planning.schedule.topic-format":{title:`How to write the topics`,body:`Three ways to write the same list; switching keeps everything. One per line fills only the topic keyword. Table adds a column for each keyword a topic sets itself, such as its word count. YAML / JSON holds the same as text, for pasting or keeping in a file.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-lines":{title:`Topics, one per line`,body:`Type or paste one topic per line; blank lines are skipped. Each topic fills the keyword under Each topic fills, and the first line is the next run. Every other keyword uses its every-run value.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-yaml":{title:`Topics as YAML or JSON`,body:`A list such as "- Cleopatra", or one map per topic such as "- Topic: Cleopatra" with a line for each keyword it sets, like "Min. Word Count: 12000". A JSON array works too. A keyword a topic leaves out uses its every-run value. The schedule saves only once the list reads.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-table":{title:`Topic table`,body:`One row per run, in order. The first column fills the topic keyword; each extra column sets that keyword for that topic's run only, and a blank cell uses the every-run value. Set a keyword per topic adds a column; the x in a column's header drops it. Project title shows the result.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-keyword":{title:`Each topic fills`,body:`The template keyword, such as {{Topic}}, that each queued topic replaces. Default: the keyword the template's project title uses, else the first one. When the title doesn't use it, every project gets the same title.`,tutorial:{page:`Schedules`,anchor:`which-keyword-a-topic-fills`}},"planning.schedule.every-run":{title:`Every-run value`,body:`The value this keyword gets on every run, such as a word count. Default: the template's own value. A topic that sets the keyword itself, in Table or YAML / JSON, overrides it for that one run.`,tutorial:{page:`Schedules`,anchor:`which-keyword-a-topic-fills`}},"planning.schedule.generation":{title:`Topic generation`,body:`When the queue holds fewer topics than you ask for, Slopify asks an LLM for more: one call for what is missing plus 5 spare, at most 50. It sends the series brief and every title this schedule, your projects and the channel's existing videos already have, and drops near duplicates.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.brief":{title:`Series brief`,body:`What the series covers, its style and what makes a topic worth a video. Only topic generation reads it. Leave it empty to use the channel's series brief from the channel's Brand tab. Up to 4,000 characters.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.new-topics":{title:`New topics`,body:`Off: you add every topic yourself. Generate and queue directly: new topics join the end of the list. Generate and hold for approval: they wait under Topics waiting, and beside the calendar, until you approve them. Each generation is one LLM call. Default: Off.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.keep-count":{title:`Keep at least this many queued`,body:`Slopify asks for new topics whenever the queue, plus the topics waiting for approval when holding, drops below this number. A higher number keeps more topics lined up ahead of the runs, for you to review. From 1 to 100. Default: 10.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.generation-llm":{title:`Topic generation LLM`,body:`The text model that suggests topics. Ticked, it uses the provider and model the template writes with. Untick to pick another, such as a cheaper model. Either way each generation is one call on that provider. Default: the template's LLM.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.generate-now":{title:`Generate topics now`,body:`Asks the LLM for new topics right away, at least 5, even when the queue is full and even during the 5 minutes Slopify waits after a failed try. One LLM call. When holding for approval they wait for you; otherwise they join the queue.`,tutorial:{page:`Schedules`,anchor:`generate-topics-now`}},"planning.schedule.held-keywords":{title:`Keywords of a waiting topic`,body:`The template's other keywords, set for this one topic's run, the same as a column in the queue's table. Leave one empty to use the schedule's every-run value (shown greyed). They go with the topic into the queue when you approve it.`,tutorial:{page:`Schedules`,anchor:`approve-held-topics`}},"planning.schedule.held":{title:`Topics waiting`,body:`Topics the LLM suggested, waiting for you. Approve adds one to the end of the queue; Edit changes its words first; Reject drops it for good, so it is never suggested again. Approve all queues every one in order. Waiting topics count toward Keep at least.`,tutorial:{page:`Schedules`,anchor:`approve-held-topics`}},"planning.calendar.view":{title:`Calendar view`,body:`Weeks shows the coming 4 weeks as a grid: drag a topic to another day or onto another schedule's run, or focus it and press Alt+arrow keys. List shows the same runs day by day, with buttons to move each topic. This browser remembers your choice.`,tutorial:{page:`Calendar`,anchor:`switch-between-weeks-and-a-list`}},"planning.calendar.move":{title:`Moving topics`,body:`Earlier and later swap a topic with its neighbour in the same schedule's queue, so it takes the other's run. Move to puts it at the end of another schedule's queue, so it takes that schedule's next free run. No schedule runs outside its own times.`,tutorial:{page:`Calendar`,anchor:`move-a-topic-to-another-day`}},"planning.calendar.add-schedule":{title:`Schedule`,body:`The schedule the topics join. They go to the end of its queue, after the topics already there (the count beside each name), so they take its next free runs. Only active and paused schedules are listed.`,tutorial:{page:`Calendar`,anchor:`add-topics`}},"planning.calendar.add-topics":{title:`Topics, one per line`,body:`Each line becomes one topic, in order; blank lines are skipped. A topic fills the schedule's topic keyword, and every other keyword keeps its every-run value. To give topics their own values, edit the schedule's topics as a table under Schedules.`,tutorial:{page:`Calendar`,anchor:`add-topics`}},"planning.channels":{title:`Channels`,body:`A channel is one series: its brand kit, series brief, cast, templates and schedules. Every template belongs to one channel, and each run from it uses that channel's look and cast. The default channel holds everything made before channels and can't be deleted.`,tutorial:{page:`Channels`,anchor:`the-channels-page`}},"planning.channel.current":{title:`Current channel`,body:`Home, Projects and the calendar show only this channel's work. All channels shows everything. It only filters what you see; every project and schedule keeps its own channel. This browser remembers your choice, and every Slopify tab open in it follows the same pick.`,tutorial:{page:`Channels`,anchor:`show-one-channels-work`}},"planning.channel.name":{title:`Channel name`,body:`The name you see in the channel picker, on Play and on the calendar. It stays inside Slopify and doesn't have to match your YouTube channel. Up to 200 characters.`,tutorial:{page:`Channels`,anchor:`create-a-channel`}},"planning.channel.brief":{title:`Series brief`,body:`What the channel covers, its style and what makes a topic worth a video. Topic generation reads it for every schedule of this channel that has no brief of its own. It doesn't change how videos are written. Up to 10,000 characters.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.ai-disclosure":{title:`YouTube AI disclosure`,body:`Studio's AI use answer for this channel's videos and Shorts, given by Prepare upload and the Studio extension. Automatic says Yes only for YouTube's three cases: a voice marked as imitating a real person, real footage altered, or photorealistic AI pictures from a marked Image prompt. Saves as you pick. Default: Automatic.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`override-per-channel`}},"planning.channel.language":{title:`Language of new projects`,body:`The language this channel's new projects are written and narrated in when Play or the template picks none. It applies with the brand kit off too, since it is not styling. Pick voices that speak it. Not set means English. Projects already made keep their language.`,tutorial:{page:`Other-Languages`,anchor:`set-a-channels-language`}},"planning.channel.brand-kit":{title:`Brand kit`,body:`The look every template of this channel gets unless it sets its own: fonts, colours, end screen, intro, outro, PDF theme and ambient sound. It fills only what a template leaves at its default, and a blank field adds nothing. Turn it off for one video on Play or in Edit project.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-font":{title:`Caption font`,body:`The subtitle font for this channel's videos whose template leaves the font at Default. Not set leaves the template's font alone. Fonts you upload in the subtitle font picker on Play appear here.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-colour":{title:`Caption colour`,body:`The subtitle text colour, as # and six hex digits such as #FFFFFF, for videos whose template sets no colour of its own. Blank leaves the template's colour alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-outline":{title:`Caption outline`,body:`The colour of the line around each subtitle letter, as # and six hex digits such as #000000, for videos whose template sets none. A dark outline keeps light captions readable on bright pictures. Blank leaves the template's outline alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.font":{title:`Title font`,body:`The font of chapter cards and the end screen for videos whose template sets no title style. Not set leaves the template's font alone. Fonts you upload in the subtitle font picker on Play appear here.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.title-colour":{title:`Title colour`,body:`The text colour of chapter cards and the end screen, as # and six hex digits such as #FFD700, for videos whose template sets no title style. Blank leaves the template's colour alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.end-screen":{title:`End screen text`,body:`A line shown over the last 5 seconds of every video of this channel whose template sets no end screen, such as Subscribe for more. Up to 200 characters. Blank shows no end screen text.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.intro":{title:`Intro`,body:`An entry from Library → Intros & outros, narrated before every video of this channel whose template has no intro. Not set adds none. It adds its own length to each video and costs one voice request, since it is narrated.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.outro":{title:`Outro`,body:`An entry from Library → Intros & outros, narrated after every video of this channel whose template has no outro. Not set adds none. It adds its own length to each video and costs one voice request, since it is narrated.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.document-theme":{title:`PDF theme`,body:`The look of the PDF document for videos of this channel whose template picks no theme: a built-in theme or one you saved. Not set leaves the template's choice alone. A saved theme that was deleted is skipped.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.template-move":{title:`Move a template`,body:`Moves a template, and every schedule that runs it, to another channel. Their next runs use that channel's brand kit, cast and series brief. Projects already made keep what they were made with.`,tutorial:{page:`Channels`,anchor:`templates`}},"planning.channel.episode-memory":{title:`Episode memory`,body:`When a video of this channel finishes, one short call to its text model writes a summary of up to 150 words. A new episode about the same cast or title words gets up to 5 related summaries in its writing prompt, so it agrees with them. Videos already made never change. Default: on for new channels.`,tutorial:{page:`Channels`,anchor:`episodes-episode-memory`}},"planning.channel.episode-summary":{title:`Episode summary`,body:`What the text model wrote this episode covered. Related new episodes read it before they are written. Edit it to correct a fact; your text is kept even if the video finishes again.`,tutorial:{page:`Channels`,anchor:`episodes-episode-memory`}},"planning.channel.videos-paste":{title:`Existing video titles`,body:`Titles of videos this channel made before Slopify, one per line. Topic generation and its duplicate checks skip them, as they skip the videos made here. Titles already listed are skipped, whatever their case.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-csv":{title:`Import a YouTube Studio CSV`,body:`In YouTube Studio open Analytics → Content → Advanced mode and export the table as a CSV. Slopify reads its titles on this machine and lists them with ticks first, so you keep only this channel's videos.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-filter":{title:`Keep only titles containing`,body:`Ticks only the titles containing this text, in any case, such as "Egypt" or "History at Bedtime"; empty ticks them all. Use it when one Studio export holds several series. Remembered for this channel's next import.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-ticks":{title:`Titles in the CSV`,body:`Only ticked titles are added when you press Add. Untick videos of other series in the same export, or type in Keep only titles containing to tick by text.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.cast.kind":{title:`Kind`,body:`Character, creature, place or object. A generated reference picture of a character or creature is portrait (9:16), of a place or object landscape (16:9), and its starting prompt asks for the whole figure, place or object in view. It doesn't change how the member is matched.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.name":{title:`Name`,body:`The name matched against video titles and image briefs, as whole words, ignoring case. When it is found, this member's pictures go with that image as references. Add other spellings and plurals as aliases. Up to 200 characters.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.aliases":{title:`Aliases`,body:`Other names that count as this member, matched as whole words, ignoring case: Cleopatra is found in Cleopatra's palace but not in Cleopatraic. Add plurals and titles such as the Last Pharaoh. Up to 20.`,tutorial:{page:`Cast-Library`,anchor:`how-names-are-matched`}},"planning.cast.description":{title:`Description for the image model`,body:`What the member looks like, in a sentence. It goes to the image model with the member's reference pictures for every image that names it, and starts the prompt of a generated picture. Up to 2,000 characters.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.voice":{title:`Cast voice`,body:`How this member speaks in multi-voice runs: pick them under Speakers on Play and they read with this voice, model and pace in every episode. The list shows voices that speak the channel's language. Leave the provider empty for no voice. A run keeps the voice it started with.`,tutorial:{page:`Cast-Library`,anchor:`give-a-cast-member-a-voice`}},"planning.cast.host":{title:`Channel host`,body:`A recurring voice of this channel. When you pick Podcast or Interview on Play, the draft starts with the channel's hosts that have a voice as its hosts, so you don't add them every episode. You can still remove or add speakers on the draft. Projects already made are unchanged.`,tutorial:{page:`Cast-Library`,anchor:`make-a-member-one-of-the-channels-hosts`}},"planning.cast.pictures":{title:`Reference pictures`,body:`Up to 4 pictures per member, sent with every image whose brief, or the video's title, names it, so it looks the same each time. Upload a PNG or JPEG up to 10 MB, or generate one below. Videos already made keep the pictures they started with.`,tutorial:{page:`Cast-Library`,anchor:`add-reference-pictures`}},"planning.cast.generate":{title:`Make a reference picture`,body:`Pick an image provider and model, describe the picture, then press Generate a picture. Each press is one image call on that provider, billed at its price for one image. A plain background with the whole figure in view makes the best reference.`,tutorial:{page:`Cast-Library`,anchor:`generate-a-picture`}},"planning.cast.picture-prompt":{title:`Picture to make`,body:`The prompt for the generated reference picture. It starts from the name, the description and a request for a plain background; edit it as you like. Up to 4,000 characters.`,tutorial:{page:`Cast-Library`,anchor:`generate-a-picture`}},"planning.links.named":{title:`Named links`,body:`Write {{Name}} in a YouTube description, or ask for it in a Description prompt, and it becomes the link of that name when the description is shown, copied or downloaded, such as {{Patreon}} or {{Discord}}. Each channel keeps its own list on its Brand tab, so a project fills from its channel's links; its own {{Previous video}} wins over the channel's. A name with no link stays as typed. Save channel keeps the list.`,tutorial:{page:`YouTube-Description`,anchor:`links-in-the-description`}}},Jne={"play.output":{title:`What are you making?`,body:`Picks the stages the project uses. Video narrates images with captions. Article writes or takes text, with an optional PDF. Audiobook reads a text aloud. Podcast is a conversation between speakers. Images draws pictures from your prompts. Each choice turns on what it needs and folds the rest away; every stage can still be changed under its row.`,tutorial:{page:`Play-Overview`}},"play.template":{title:`Template`,body:`Starts this video from a saved setup: prompts, voice, images, style, outputs and reviews. Picking one opens a fresh draft made from it and carries the topic you typed. No template starts from the default setup. Save a setup you like with Save as template in the right rail.`,tutorial:{page:`Play-Overview`,anchor:`template`}},"play.title":{title:`Title`,body:`The project's name in Slopify, shown on the project and in Projects. For a YouTube video it is also the YouTube title unless the YouTube text writes its own, and YouTube takes at most 100 characters there, without < or >. Write a keyword in double braces, like {{Topic}}, and the title becomes a pattern: you type the topic per video, and Add topic queues more videos from the same setup. Up to 200 characters.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.title-pattern":{title:`Title pattern`,body:`The title with its keywords in double braces, like History: {{Topic}}. Each keyword in it is a topic you type at the top of Play, once per video, and templates save it empty. Change the pattern here; the topic values stay at the top.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.topic":{title:`Topic`,body:`What this video is about. The title names this keyword, so its value fills the title and every prompt that names it. Each video from this setup gets its own value, and a template leaves it empty. Up to 200 characters.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.keyword":{title:`Keyword`,body:`A value a picked prompt or the title asks for with {{name}}. You type it once and it fills every place that names it; the line under it lists where. Up to 200 characters. A keyword the title does not name is saved with a template.`,tutorial:{page:`Play-Overview`,anchor:`keywords`}},"play.more-videos":{title:`More videos from the same setup`,body:`Add topic queues another video with everything else the same: only its title and keywords differ. Press a chip to change that video's keywords. Start queues all of them, and they run one at a time. One Start queues at most 50 videos.`,tutorial:{page:`Play-Overview`,anchor:`more-videos-from-the-same-setup`}},"play.drafts":{title:`Drafts`,body:`Play saves every change to this draft on its own; nothing starts until you press the Play key. Drafts lists your saved setups to open again or delete. New draft starts an empty one and keeps this one in the list.`,tutorial:{page:`Play-Overview`,anchor:`drafts`}},"play.draft-conflict":{title:`Changed elsewhere`,body:`This draft was saved from another tab or window since you opened it. Reload saved draft shows that version and drops your unsaved change. Save as a new draft keeps your version as a separate draft and leaves the other one alone.`,tutorial:{page:`Play-Overview`,anchor:`when-a-draft-was-changed-elsewhere`}},"play.source.research":{title:`Research source`,body:`Generate has the text model plan chapters, research each one on the web and combine the notes before the article is written: one call to plan, one per chapter and one to combine. Provide uses notes you paste. Off, the default, writes from the prompt alone.`,tutorial:{page:`Play-Title-and-Article`,anchor:`research`}},"play.source.article":{title:`Article source`,body:`Write it for me has the text model write the article from the article prompt, one call. Use my text as written narrates text you paste, word for word, with no text-model cost. Adapt my text has the article prompt rewrite text you paste, one call. No text is for images only. The article is what the narration reads and the PDF lays out. Default: Write it for me.`,tutorial:{page:`Play-Title-and-Article`,anchor:`choose-where-the-article-comes-from`}},"play.source.audio":{title:`Narration source`,body:`Generate reads the article aloud with a text-to-speech voice, charged by the provider per character. Provide uses an audio file you upload, as it is. Off makes a silent video with no captions, YouTube description or shorts. Default: Generate.`,tutorial:{page:`Play-Narration`,anchor:`choose-where-the-narration-comes-from`}},"play.source.images":{title:`Images source`,body:`Generate draws images from the ticked image prompts, one image-model call each. Provide uses your own PNG, JPEG or WebP files in the order you pick them. Off turns off the video too. Default: Generate.`,tutorial:{page:`Play-Images`,anchor:`choose-where-the-images-come-from`}},"play.source.thumbnail":{title:`Thumbnail source`,body:`From prompt draws the thumbnail straight from the thumbnail prompt, one image call. Prompt by LLM first has the text model write the image prompt from yours, the title and the article, then draws it. Provide uses your own image. Default: Off.`,tutorial:{page:`Play-Outputs`,anchor:`thumbnail`}},"play.source.video":{title:`Video source`,body:`Generate renders the slideshow video on this computer from the images and narration; it costs no provider money, only time. Off leaves each finished stage to download on its own. It needs images, so it is Off while Images is Off. Default: Generate.`,tutorial:{page:`Play-Video-and-Style`,anchor:`choose-whether-to-render-a-video`}},"play.source.document":{title:`Document source`,body:`Generate lays out a PDF of the article and title on this computer, in the theme you pick. It needs no provider and costs nothing. Default: Off.`,tutorial:{page:`PDF-Documents`,anchor:`make-a-pdf`}},"play.article-prompt":{title:`Article prompt`,body:`The Library prompt the text model is sent to write the article, with its keywords filled in. A Script prompt, used when several speakers read, asks for speaker turns instead. Write or change prompts on Prompts; View prompt shows the text.`,tutorial:{page:`Play-Title-and-Article`,anchor:`generate-an-article-from-a-prompt`}},"play.provided.article":{title:`Article text`,body:`The article you paste is narrated word for word, and no text model writes one. Include everything that should be read, headings too. The count under it helps you judge the length: about 150 words is one minute of narration.`,tutorial:{page:`Play-Title-and-Article`,anchor:`paste-your-own-article`}},"play.provided.research":{title:`Research notes`,body:`Notes you paste are given to the text model with the article prompt, in place of web research. Paste facts, sources and quotes the article should draw on. Nothing is looked up.`,tutorial:{page:`Play-Title-and-Article`,anchor:`give-your-own-research-notes`}},"play.text-generation":{title:`Text generation`,body:`One text model writes everything this run needs in words: the article, research, the thumbnail's image prompt, entries set to LLM, Narration Preparation, the YouTube description and picking shorts. Each is a separate call, counted in usage. Set the default under Settings.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.provider":{title:`LLM`,body:`Who runs the text model: a command-line tool you are signed in to, such as Claude Code or Codex, or a keyed service such as OpenRouter, billed per token. A greyed provider says why it cannot be used; fix it under Settings.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.model":{title:`Text model`,body:`The model the provider runs for every text step. Bigger models write better and cost more per token. Refresh asks the provider for its current list; Custom ID lets you type a model the list does not show.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.thinking":{title:`Thinking`,body:`How long the model reasons before it answers, for models that offer it. Higher levels can write more carefully but take longer and use more tokens. Model default leaves it to the provider.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.tts.provider":{title:`TTS`,body:`The text-to-speech service that reads the narration, charged by the provider per character of text. A greyed provider says why it cannot be used; add its key under Settings. Changing it clears the model and voice.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.tts.model":{title:`TTS model`,body:`The provider's speech model. Models differ in quality, languages, speed and price per character. Some features need a particular model: Narration Preparation needs Inworld TTS-2. Refresh asks the provider for its current list.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.voice":{title:`Voice`,body:`Who reads the narration. The list holds the voices you added under Settings → Voices for this provider, filtered to the project's language. With several speakers, this voice reads the intro and outro.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.show-all-voices":{title:`Show all voices`,body:`The voice list hides voices listed for other languages than the project's. Tick this to pick one anyway, for example a multilingual voice whose languages are listed wrong. A voice with unknown languages is always shown.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.intro":{title:`Intro`,body:`A Library entry read before the article. A text entry is read as written; an LLM entry is written by the text model for each video, one extra call. Off reads no intro. Write entries in Library → Intros & outros.`,tutorial:{page:`Play-Narration`,anchor:`intro-and-outro`}},"play.outro":{title:`Outro`,body:`A Library entry read after the article, such as a sign-off. A text entry is read as written; an LLM entry is written by the text model for each video, one extra call. Off reads no outro.`,tutorial:{page:`Play-Narration`,anchor:`intro-and-outro`}},"play.chunking":{title:`Chunking`,body:`How the narration is split into text-to-speech requests. Whole sends it in one request; Paragraph sends one per paragraph; Every N words or characters ends each at a sentence end. Split when a provider refuses long text. Default: Whole. It changes the number of requests, not the characters charged.`,tutorial:{page:`Play-Narration`,anchor:`chunking`}},"play.chunking.count":{title:`Chunk size`,body:`How long each text-to-speech request may be. Each request ends at the last whole sentence that fits, so a single longer sentence stays whole. Defaults: 500 words or 3000 characters, spaces included.`,tutorial:{page:`Play-Narration`,anchor:`chunking`}},"play.narration-preparation":{title:`Narration Preparation`,body:`Has the text model add delivery directions and sounds, such as a sigh or a laugh, following the Library narration prompt you pick. One text-model call per narration chunk and per entry. Needs Inworld TTS-2. The article and captions stay unchanged. Default: Off.`,tutorial:{page:`Play-Narration`,anchor:`narration-preparation`}},"play.pronunciation-glossary":{title:`Pronunciation Glossary`,body:`Reads names with the IPA in the article's Pronunciation Glossary, such as Arda: /ˈɑɹdə/, with no extra text-model call. In your article prompt, ask for a glossary in slash-delimited standard-English IPA (Term: /IPA/), with an English approximation for foreign names; a line with sounds English lacks is read as plain text. Works with Inworld TTS-2 and TTS-2 Flash. The written text stays unchanged. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"play.share-glossary":{title:`Pronunciations from other projects`,body:`Adds every term from your other projects' glossaries, copied when this project starts. This project's own glossary wins where they differ. Turn it off to use only this article's glossary. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"play.describe-figures":{title:`Describe tables and figures`,body:`Instead of skipping tables, pictures, equations and code or reading them cell by cell, the text model writes a short spoken passage for each (a table's pattern, what a figure or equation means, what code does) and the narration says it in its place. One extra text-model call per block, in the estimate, kept for reuse. The article and PDF keep the real table; captions show what is said. Needs a text model. Default: on.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"play.show-figures":{title:`Show tables and figures on screen`,body:`Each table, figure, equation and code block the narration describes is also shown in the video while it is described: the article's own picture for a figure, a card drawn in your brand kit's title font and colour for the rest. The images take turns around them, and Shorts that include one show it upright. Drawn on this computer at no cost. Needs Describe tables and figures. Default: on.`,tutorial:{page:`Play-Outputs`,anchor:`show-tables-and-figures-on-screen`}},"play.skip-code":{title:`Leave code out`,body:`Drops code blocks from the narration instead of summarising each in a sentence or two. Tables, figures and equations are still described. Default: off.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"play.narration-aliases":{title:`Narration aliases`,body:`Says the words listed in Library → Narration aliases the way they are written there, such as Dr. as Doctor, with any generated voice. They are copied when the project starts. The article and captions keep the written words. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`use-aliases-in-a-video`}},"play.speakers.format":{title:`Speakers format`,body:`Narration uses one voice. Audiobook, Podcast, Radio drama and Interview give lines to several speakers, each with a voice. Several speakers need the text model to write or split the script. A new Podcast or Interview starts with the channel's hosts (cast members marked as hosts, with a voice).`,tutorial:{page:`Multiple-Voices`,anchor:`formats`}},"play.speakers.script":{title:`Script`,body:`Write a script has the text model write speaker turns from a Script prompt, one Name: words paragraph each. Split the article (audiobooks) keeps the article as written and has the text model hand its narration and dialogue to the speakers, one extra call. Adapt the article (podcasts, interviews, dramas) also keeps the article as written; one extra call rewrites it as a conversation for the speakers, kept beside it as the script.`,tutorial:{page:`Multiple-Voices`,anchor:`the-script`}},"play.speakers.add-from-cast":{title:`Add from the cast`,body:`Adds a member of this channel's cast as a speaker, with their name and voice. Only members with a voice are listed. Edit the cast on the channel's page.`,tutorial:{page:`Multiple-Voices`,anchor:`speakers-from-a-channels-cast`}},"play.speakers.book":{title:`A chapter of a book`,body:`Makes this audiobook one chapter of a book. The MP3 and M4B are tagged with the book as their album and the chapter as their track, so a player keeps the chapters together and in order. When the chapter is done, Make the next chapter on its project page starts the next one with the same speakers and settings.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.book-title":{title:`Book title`,body:`The book this chapter belongs to, the same for every chapter. It becomes the album of the MP3 and M4B files.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.book-chapter":{title:`Chapter`,body:`This chapter's number in the book, from 1 to 9999. It becomes the track number of the MP3 and M4B files.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.turn-gap":{title:`Gap between turns`,body:`The pause between one speaker's turn and the next, from 0 to 1.2 seconds. Longer feels calmer; shorter feels like a lively talk. Default: 0.35 s.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.name-tags":{title:`Speaker names on captions`,body:`Puts the speaker's name before their captions, like Ada: and their words, so viewers know who is talking. On by default for a podcast or interview.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.native-dialogue":{title:`One request for consecutive turns`,body:`Sends back-to-back turns as one multi-speaker request where the provider has one (ElevenLabs v3 with up to 10 voices, Gemini TTS with 2), so the voices react to each other. Fewer requests, same characters charged. Other providers read each turn on its own.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.audio-files":{title:`MP3 and M4B files`,body:`Also saves the narration as an MP3 and an M4B audiobook file with a chapter marker at each chapter, beside the video. Made on this computer at no provider cost.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speaker.name":{title:`Speaker name`,body:`The name the script uses for this speaker's turns (Name: words) and the one captions and the speaker panel show. Up to 40 characters.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.role":{title:`Role`,body:`What this speaker does in the format: narrator, host, guest or character. The text model is told each speaker's role when it writes or splits the script.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.provider":{title:`Voice provider`,body:`The text-to-speech service for this speaker, charged per character of their lines. Speakers may use different providers. Changing it clears the model and voice.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.model":{title:`Voice model`,body:`The provider's speech model for this speaker. Models differ in quality, languages and price per character. Pronunciations need an Inworld TTS-2 model.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.voice":{title:`Speaker voice`,body:`This speaker's voice, from the voices you added under Settings → Voices for their provider, filtered to the project's language. Press Audition to hear it read their first line.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.pace":{title:`Pace`,body:`How fast this speaker talks, from 0.8× to 1.2× of the voice's own speed. Default: Normal.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.pronunciations":{title:`Speaker pronunciations`,body:`One Term: /IPA/ per line, like the article's Pronunciation Glossary, for this speaker only. Used on Inworld TTS-2 voices, ahead of the glossary. A line with sounds the language does not use is skipped and read as ordinary text.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.audition":{title:`Audition`,body:`Speaks this speaker's first line in their voice so you can hear it before the run. It is one real text-to-speech request, charged by the provider at about the price shown on the button.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.images.provider":{title:`Image provider`,body:`Who draws the images, the thumbnail and the shorts' pictures: a keyed service such as fal.ai, billed per image, or a command-line tool you are signed in to. A greyed provider says why it cannot be used; fix it under Settings.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-provider-and-model`}},"play.images.model":{title:`Image model`,body:`The provider's image model. Models differ in quality, speed and price per image; the estimate in the right rail shows what this run costs. Refresh asks the provider for its current list.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-provider-and-model`}},"play.images.effort":{title:`Effort`,body:`How long an image agent, such as the Codex CLI, reasons before it draws. Higher effort can follow the prompt more closely but takes longer and uses more tokens. Model default leaves it to the provider.`,tutorial:{page:`Play-Images`,anchor:`drawing-with-the-codex-cli`}},"play.image-prompts":{title:`Image prompts`,body:`Tick the Library prompts that draw the video's images, and give each a number: how many images it makes, 1 to 20. A run makes at most 60 this way. Each image is one image-model call. The images play in the order you ticked the prompts.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-prompts`}},"play.reference":{title:`Establishing image`,body:`Made first and never shown in the video. Every other image, the shorts' and, if ticked, the thumbnail is drawn with it as a reference, so characters, style and palette stay the same. From a prompt costs one more image; Upload uses yours. Changing it marks those images outdated. Default: Off.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.reference.prompt":{title:`Establishing prompt`,body:`The Library image prompt that draws the establishing image, its keywords filled like the others. Describe the characters, setting and style every other image should share.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.reference.thumbnail":{title:`Thumbnail from the establishing image`,body:`Draws the thumbnail with the establishing image as a reference too, so it matches the video. Untick it for a thumbnail drawn on its own. Default: on.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.image-scale":{title:`More images for long videos`,body:`Adds images as the narration gets longer, planned from the expected length when the run starts. The extra images are shared among the ticked prompts in order, up to 240 in all; each is one more image call. The line under it shows the count. Turning it on switches Motion from Zoom to Mix of both.`,tutorial:{page:`Play-Images`,anchor:`more-images-for-long-videos`}},"play.batch-queue":{title:`Queue`,body:`With more than one video on the page: on, they run one after another, each starting when the one before finishes (Calendar → Batch queue shows the order); off, they all start at once. At once finishes sooner when the steps wait on providers, but the video renders share your computer's processor and plan limits are reached sooner. Default: on.`,tutorial:{page:`Play-Overview`,anchor:`queue-or-all-at-once`}},"play.image-scenes":{title:`Scenes from the article`,body:`Gives every image its own moment. The project's AI model reads the article once and writes a scene per image, from the opening to the ending in slideshow order. The scene goes where a prompt has {{Scene}}, or after its first paragraph. A thumbnail prompt with {{Scene}} gets a scene too: the article's most striking moment, a different one per thumbnail. Off, a {{Scene}} line is left out. One more AI call per run.`,tutorial:{page:`Play-Images`,anchor:`scenes-from-the-article`}},"play.image-scale.rate":{title:`Image rate`,body:`Give the rate as one image every N minutes of narration (0.25 to 60) or as N images per hour (1 to 240); switching keeps the same rate. Narration runs about 150 words a minute. Starts at one image every 2 minutes.`,tutorial:{page:`Play-Images`,anchor:`more-images-for-long-videos`}},"play.image-seconds":{title:`Seconds per image`,body:`How long each image stays on screen, 1 to 600 seconds. When cuts follow the narration, it is the target and a cut waits for a sentence end. When images run out they start again. Default: 15.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.zoom":{title:`Zoom`,body:`How far each image zooms in or out over its time on screen, 0 to 50 percent. 0 keeps images still. Default: 22.5 percent.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.motion":{title:`Motion`,body:`How each image moves while on screen: Zoom in and out, Pan across, a Mix of both by turns, or Still. A mix keeps a long video watchable. Default: Zoom in and out.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.edge-silence":{title:`Silence at start and end`,body:`Quiet time before the narration starts and after it ends, 0 to 30 seconds. Default: 2.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.silence-gap":{title:`Silence between segments`,body:`Seconds of quiet between the intro and the narration, and between the narration and the outro, 0 to 30. It only matters when an intro or outro is set. Leave it empty to use the gap set in Settings, 3 seconds unless you changed it.`,tutorial:{page:`Play-Narration`,anchor:`silence-at-the-edges-and-between-segments`}},"play.format":{title:`Frame format`,body:`16:9 is a landscape video for YouTube and screens. 9:16 is a portrait video for phones. 1:1 is square, for posts and feeds. Images are drawn in this shape and captions are placed for it; shorts stay 9:16 and the thumbnail stays 16:9 for YouTube. Default: 16:9.`,tutorial:{page:`Play-Video-and-Style`,anchor:`frame-format`}},"play.preview-text":{title:`Preview text`,body:`The sample sentence the style preview shows in your caption font, size and position. It is only for the preview and never reaches the video; real captions come from the narration.`,tutorial:{page:`Play-Video-and-Style`,anchor:`style-preview`}},"play.thumbnail-prompt":{title:`Thumbnail prompt`,body:`The Library thumbnail prompt, keywords filled in. From prompt sends it to the image model as it is; Prompt by LLM gives it to the text model with the title and article to write the image prompt. Write prompts on Prompts.`,tutorial:{page:`Play-Outputs`,anchor:`thumbnail`}},"play.thumbnail-count":{title:`Thumbnails`,body:`Three makes two more thumbnails from the same prompt with different compositions, for YouTube's Test & compare. Each costs one more image, so 3 thumbnails are 3 image calls. You can remake each on its own on the project page. Default: 1.`,tutorial:{page:`Play-Outputs`,anchor:`make-three-thumbnails-for-test--compare`}},"play.youtube-description":{title:`YouTube description`,body:`After subtitle timing, the text model writes a description with chapters at the narration's real times, hashtags at the end, and a separate list of tags, ready to copy. One text-model call. It runs beside the render. Needs narration. Default: off.`,tutorial:{page:`YouTube-Description`,anchor:`turn-it-on`}},"play.description-prompt":{title:`Description prompt`,body:`The Library prompt the description is written from. Built-in asks for a short summary, 5 to 12 chapters, 3 to 5 hashtags and 15 to 25 tags. Write your own description prompt on Prompts to change the tone or add links.`,tutorial:{page:`YouTube-Description`,anchor:`turn-it-on`}},"play.shorts":{title:`Shorts`,body:`After subtitle timing, the text model picks the best self-contained moments of the narration. Each becomes a vertical 1080×1920 clip with new images, big word-by-word captions and its own title, description and hashtags. It runs beside the render; its images are charged like any other. Needs narration. Default: off.`,tutorial:{page:`Shorts`,anchor:`turn-on-shorts`}},"play.shorts.count":{title:`How many shorts`,body:`How many shorts to cut from this video, 1 to 10. Each needs its own new images, so more shorts cost more image calls and render time. Default: 3.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.length":{title:`Short length`,body:`The shortest and longest a short may run, in seconds, between 15 and 180. The text model picks moments within these bounds. Default: 60 to 120.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.prompt":{title:`Shorts prompt`,body:`The Library prompt the text model follows to pick the moments and write each short's title, description and hashtags. Built-in picks moments that make sense alone and open on a hook.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.image-style":{title:`Image style`,body:`The Library image prompt the shorts' new vertical images are drawn from. Built-in draws cinematic, uncluttered images with the subject centred. Pick one of your image prompts to match the long video.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.title-on-screen":{title:`Title on screen`,body:`Keeps the short's title at the top for the whole clip, large and bold in the caption font, below where the apps draw their own buttons. Default: on.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.preview":{title:`Shorts preview`,body:`A few seconds of the sample project's narration and images as a short: vertical, through the same renderer your shorts use, with the big word-by-word captions in your caption font, the title on screen when it is on, and the speed you chose. It renders again by itself a moment after you change a setting, costs no API calls, and Render again forces a fresh one.`,tutorial:{page:`Shorts`,anchor:`shorts-preview`}},"play.shorts.speed":{title:`Speed`,body:`Plays each short faster than the narration, 1.00× to 1.25× in steps of 0.05, with the pitch kept. A little faster suits short-form viewers. Default: 1.00×.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.music-volume":{title:`Music volume`,body:`How loud the background music plays under every short, 0 to 100 percent; it dips while the narrator speaks. Only used when you add a music file below. Default: 15.`,tutorial:{page:`Shorts`,anchor:`add-background-music`}},"play.shorts.full-video-link":{title:`Full video link`,body:`Each short's description ends with a line pointing to the full video. Paste the video's link here; without it the line says [PASTE THE FULL VIDEO LINK HERE] for you to fill in.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.document-theme":{title:`Theme`,body:`How the PDF looks: a built-in theme or one of yours from Library → PDF themes. A theme of yours is copied into the project, so editing it later leaves this project alone until you pick it again. Edit themes opens the list.`,tutorial:{page:`PDF-Documents`,anchor:`options`}},"play.checkpoints":{title:`Review checkpoints`,body:`Holds the run before a step so you can check and edit what came before it. Steps that do not depend on it carry on. Approve each checkpoint on the project page to continue. A step must be generated to have a checkpoint.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`add-a-checkpoint-on-play`}},"play.reviews":{title:`Automatic reviews`,body:`A reviewer model checks each finished item and saves its verdict and reasons on the project page. Flag only marks a failed item; Flag and redo makes it again, up to the redos per item, then keeps and flags it. Each review is a text-model call, counted in usage. Default: Off.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.provider":{title:`Reviewer`,body:`Who runs the review model. Picture reviews, for images, the thumbnail and shorts, need Claude Code or Codex, which can look at images; other providers review text only.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.model":{title:`Reviewer model`,body:`The model that judges each item. A stronger model catches more but costs more per review. It can differ from the model that wrote the text.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.retries":{title:`Redos per item`,body:`How many times Flag and redo makes a failed item again before it keeps the last one and flags it, 0 to 5. Each redo costs the item again plus one more review. Default: 2.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.channel":{title:`Channel`,body:`The channel this video belongs to. Its brand kit fills what this setup leaves at its default, and its cast of characters goes with the images. A draft that picks none runs in its template's channel, or the default one.`,tutorial:{page:`Play-Overview`,anchor:`channel-row`}},"play.brand-kit":{title:`Channel's brand kit`,body:`Fills what this setup leaves at its default from the channel: the caption font, intro, outro, PDF theme and ambient sound. What you set here wins. Turn it off to take none of it; the cast and language still apply. Default: on.`,tutorial:{page:`Play-Overview`,anchor:`channel-row`}},"play.language":{title:`Language`,body:`The language the article, narration, YouTube description and shorts titles are written in. Pick a voice that speaks it. Outside English, captions are timed with a free 248 MB model, downloaded once, where one exists. On Play, blank uses the channel's language.`,tutorial:{page:`Other-Languages`,anchor:`pick-a-language-for-one-video`}},"play.estimate":{title:`Estimated cost`,body:`What the providers are likely to charge for this run, in US dollars, from their published prices. Actual usage can differ, and the estimate does not cap spending.`,tutorial:{page:`Play-Overview`,anchor:`estimated-cost`}},"play.expected-words":{title:`Expected article words`,body:`How long you expect each generated article to be. It drives the cost estimate and how many images More images for long videos adds; the article's real length is used once it is written. About 150 words is one minute. Default: 1500.`,tutorial:{page:`Play-Overview`,anchor:`expected-article-words-per-video`}},"play.refresh-review":{title:`Refresh review`,body:`Asks the server to check the setup again and recalculate the estimate now, instead of waiting for you to pause typing. Use it after changing a prompt in the Library.`,tutorial:{page:`Play-Overview`,anchor:`review-the-whole-setup`}},"play.template-name":{title:`Template name`,body:`The name the template is listed under on Play and Templates. The template keeps this setup's settings; the topic you typed and any extra videos are left out, as the list below says.`,tutorial:{page:`Play-Overview`,anchor:`save-as-template`}},"play.queue":{title:`Video queue`,body:`Videos started together run one at a time, in this order. Pausing a project holds the queue; when one fails or is canceled, the next one starts.`,tutorial:{page:`Play-Overview`,anchor:`the-video-queue`}},"play.voices.name":{title:`Voice name`,body:`The name you pick this voice by on Play and in Edit project. Only you see it.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.provider":{title:`Voice provider`,body:`The text-to-speech service the voice ID belongs to. Only providers set up under Settings are listed.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.voice-id":{title:`Voice ID`,body:`The provider's own id for the voice, copied from its voice library. It is not checked now; a wrong id fails when a run's narration uses it. For Google Gemini, pick one of its 30 prebuilt voices instead.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.languages":{title:`Voice languages`,body:`The languages the voice speaks, as codes such as es, de. Play lists the voice only for projects in these languages. Blank asks the provider when it can say; a voice with unknown languages is offered for every language.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.real-person":{title:`Real person`,body:`Turn this on for a voice cloned from, or made to sound like, a real person. Prepare upload then answers Yes to YouTube's AI use question for videos it narrates. An AI voice that imitates no one stays off.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}}},Yne={"project.next-chapter":{title:`Make the next chapter`,body:`Opens a new draft on Play for this book's next chapter: the same speakers and voices, channel and cast, prompts and settings, with the chapter number one higher. Write or paste the new chapter's text there, then start it. The MP3 and M4B carry the book as their album and the chapter as their track. An audiobook that is not a book yet becomes one, named after it, starting at chapter 2.`,tutorial:{page:`Multiple-Voices`,anchor:`make-the-next-chapter`}},"project.video.cuts":{title:`Cuts`,body:`Every N seconds holds each image for Seconds per image. Follow the narration cuts in the pause after a sentence, as close to that length as the sentences allow (never under 40% of it), and starts a new image at every chapter. It needs word timing, so it works in English and the languages that have it. New projects default to Follow the narration.`,tutorial:{page:`Video-Editing`,anchor:`cuts`}},"project.video.transition":{title:`Transition`,body:`How one image hands over to the next: Cut, Crossfade, Fade through black, Slide or Wipe. The change is centred on the cut and takes the length you pick (0.2 to 2 s), so the video stays exactly as long as its narration. Default: Cut, 0.6 s.`,tutorial:{page:`Video-Editing`,anchor:`cuts`}},"project.video.grade":{title:`Colour grade`,body:`A colour treatment over the whole video: Warm fantasy, Cold, Desaturated or Sepia. It is applied while the video renders, so it costs no API calls, only render time. Default: None.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.vignette":{title:`Vignette`,body:`Darkens the corners of the picture to draw the eye to the middle. Subtle or Strong. Applied while the video renders, with no API cost. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.grain":{title:`Film grain`,body:`Adds moving film grain over the whole picture for an older, filmic feel. Subtle or Strong. Applied while the video renders, with no API cost. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.atmosphere":{title:`Atmosphere`,body:`An overlay Slopify draws itself: rising embers, drifting dust, or low fog along the bottom of the frame. No footage is downloaded and no API is called; it only adds render time. Default: None.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.chapter-cards":{title:`Chapter cards`,body:`Shows each chapter's title in the middle of the picture for 2.5 seconds as the chapter starts, in the caption font. Chapters come from the YouTube description when that step runs, otherwise from the article's headings. Needs narration. Default: off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.animate":{title:`Animate images`,body:`Turns some images into 5-second moving clips with an image-to-video model on your image provider (fal.ai or Replicate). Chapter openers animates the first image of each chapter; Every Nth image animates every 2nd to 10th. Each clip is one paid call, shown in the estimate. An image that cannot be animated stays still. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.pause.sentence":{title:`Pause between sentences`,body:`The least quiet after each sentence, in seconds. Some voices barely breathe between sentences; this adds silence where the pause is shorter, never shortening one or cutting a word, and the captions follow. About 0.25 s is brisk, 0.35 to 0.45 natural or documentary, 0.5 to 0.8 an audiobook's relaxed pace, 0.8 and up sleep content. Default: 0.4; 0 keeps the voice's own.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.pause.paragraph":{title:`Pause between paragraphs`,body:`The least quiet at the end of a paragraph, in seconds, when you want more than between sentences. Usually the narration prompt and the voice pace paragraphs well already, so it is 0 by default: paragraphs get the sentence pause. Try 0.8 to 1.2 for a slower read. A speaker's turn gap is set under Speakers instead. Runs on this computer.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness":{title:`Level the volume`,body:`Brings every narration piece (each chunk, and each speaker's turn) to one loudness before they are joined, so the voice stops jumping between quiet and loud. Then the video, the shorts and the audio files are each set to a finished loudness. Runs on this computer, no API calls; turning it on remakes the levelled narration and the exports, never the speech. Default: on for new runs.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness.video":{title:`Video volume`,body:`How loud the finished video and shorts are, in dB from the recommended level. LUFS is how loud a file sounds on average (the scale YouTube and Spotify use); YouTube and Spotify play everything at about -14 LUFS, so 0 dB here is -14 LUFS. -6 dB is about half as loud (50%), +4 dB about 158%. Peaks always stay under -1.5 dBTP.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness.audio-files":{title:`Audio files volume`,body:`How loud the audio-only WAV and an audiobook's MP3 and M4B are, in dB from -18 LUFS, the level audiobook shops such as ACX ask for (-18 to -23 LUFS). LUFS is how loud a file sounds on average. Type dB or a percentage of the recommended level; peaks always stay under -3 dBTP, which those shops require.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.ambient.source":{title:`Ambient sound`,body:`Rain, a fireplace or wind made on this computer, or your own audio file, played quietly under the whole narration of the long video. It dips while the narrator speaks. Costs no API calls. Shorts never get it. Changing it remakes only the video. Default: None, or the channel's bed.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.level":{title:`Ambient level`,body:`How loud the ambient sound plays under the voice, in decibels from -40 (barely there) to -6 (close to the voice). Whole numbers only. Default: -18 dB.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.fade-in":{title:`Ambient fade in`,body:`How many seconds the ambient sound takes to rise from silence at the start of the video, 0 to 30 in half-second steps. Default: 3 seconds.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.tail":{title:`Ambient tail`,body:`How long the ambient sound keeps playing, fading out, after the narration ends: 0 to 30 seconds in half-second steps. A tail longer than the silence at the end makes the video that much longer. Default: 6 seconds.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.subtitles.mode":{title:`Subtitles`,body:`Off makes none. Subtitle files gives you .srt and .vtt files to upload beside the video. Burn into video draws the captions into the picture and also makes the files; it needs Video on. Captions are timed from your narration on this computer, with no paid API; the first use downloads a speech model of about 95 MB. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.font":{title:`Subtitle font`,body:`The typeface of burned-in captions and chapter cards. Pick a bundled font or one you uploaded (.ttf or .otf); uploaded fonts stay available to every project. Subtitle files carry no font, since players style them. Changing it remakes only the video. Default: the bundled font.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.size":{title:`Subtitle font size`,body:`How big burned-in captions are, from 16 to 120. Larger is easier to read on phones but covers more of the picture. Default: 48.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.position":{title:`Subtitle position`,body:`Where burned-in captions sit on the frame: Top, Upper-middle, Center, Lower-middle or Bottom. Move them up when the pictures have important detail near the bottom. Subtitle files ignore it. Default: Bottom.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.video.style-preview":{title:`Style preview`,body:`Six seconds of the sample project's narration and images, rendered on this computer by the real video renderer with your captions, Look and motion, on the establishing image or a cast picture when there is one. The captions follow the narration word by word. It renders again by itself a moment after you change a setting. It costs no API calls, only a few seconds of your computer's time. Render again forces a fresh one.`,tutorial:{page:`Video-Editing`,anchor:`style-preview`}},"project.edit.article-text":{title:`Article text`,body:`The script the narrator reads, in Markdown. Your edits are kept when other settings change and are saved as a new revision; the narration, images and video made from the old text turn outdated and are remade when you choose. Headings become chapters.`,tutorial:{page:`Editing-a-Project`,anchor:`change-the-article-text`}},"project.edit.regenerate-article":{title:`Regenerate article after review`,body:`Marks the article to be written again by the text model, which is one or more paid text calls. Nothing runs yet: the rebuild review lists it with the narration, images and video it outdates, and you start it there. It replaces any edits you made to the article.`,tutorial:{page:`Editing-a-Project`,anchor:`regenerate-the-article`}},"project.saved-revision":{title:`Saved revision`,body:`Every save of Edit project is a revision: a snapshot of the settings and content. Continuing a run always uses the current one. Saving never starts work; outputs the change affects turn outdated and keep their old version until remade. Remaking is offered as the next action, and History lets you go back.`,tutorial:{page:`Editing-a-Project`,anchor:`history-and-saved-revisions`}},"project.choose-remake":{title:`Choose what to remake`,body:`Opens the rebuild review for every outdated or failed output: what will be made again, kept or skipped, what it costs, and which inputs changed. Nothing runs until you press Remake there, and Keep things as they are closes it with nothing spent.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.prompts.template":{title:`Use saved template`,body:`Copies a prompt from your Library into this project, replacing the raw prompt below. The project keeps its own copy, so later Library edits reach it only when you pick it again or press Use the Library version. Outputs made from the old wording turn outdated; nothing is remade until you choose.`,tutorial:{page:`Editing-a-Project`,anchor:`prompts`}},"project.prompts.raw":{title:`Raw prompt`,body:`This project's own copy of the prompt, with keywords still in double braces such as {{Topic}}. Edit it to change what the model is asked for this project only; the Library prompt is untouched. Saving fills the keywords in again, and what was made from the old wording turns outdated.`,tutorial:{page:`Editing-a-Project`,anchor:`prompts`}},"project.edit.rewrite-description":{title:`Write the description again`,body:`Marks the YouTube description to be written again by the text model, one paid text call. Nothing runs yet: save, and it is remade when you continue the run or start the rebuild review. The description you have now is replaced.`,tutorial:{page:`YouTube-Description`,anchor:`write-it-again-or-turn-it-on-later`}},"project.shorts.clips":{title:`Picked clips`,body:`The moments the text model picked for your shorts, each shown by its first and last sentence. Earlier and Later move a clip's start or end by one sentence; Use my own range picks both from lists. Moving a clip costs no calls and keeps its images where the sentences stay the same. Changes apply when you save and continue the run.`,tutorial:{page:`Shorts`,anchor:`change-the-picked-moments`}},"project.shorts.range":{title:`Clip range`,body:`The first and last sentence of this short, from the narration's timed sentences. The clip must stay between the shortest and longest length you set for shorts and must not overlap another clip; the line under the clip says what to change. Back to the AI's choice restores its pick.`,tutorial:{page:`Shorts`,anchor:`change-the-picked-moments`}},"project.shorts.pick-again":{title:`Pick different moments`,body:`Asks the text model to pick new moments when you save and continue the run, one text call. Ranges you set by hand are dropped. A new clip on the same sentences as an old one keeps its images; any other clip gets new images, one image call each, and is rendered again.`,tutorial:{page:`Shorts`,anchor:`pick-new-moments-or-remake-one-short`}},"project.shorts.remake":{title:`Make this short again`,body:`Makes this one short again when you save and continue the run: its image prompts are written again, its images are drawn again (one image call each) and it is rendered again. Its moment, title and the other shorts stay as they are.`,tutorial:{page:`Shorts`,anchor:`pick-new-moments-or-remake-one-short`}},"project.images.editor":{title:`Edit images`,body:`Every image of the video in the order it is shown. You can edit a drawn image's prompt, replace any image with your own file, move it earlier or later, delete it, or add a drawn image, your own picture or a video clip. A clip plays muted in an image's place, trimmed, slowed or looped to fit. Changes apply after you save.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.images.prompt":{title:`Image prompt`,body:`The words this one image is drawn from, with keywords in double braces filled in from the project. Editing it outdates only this image and the video; it is drawn again, one image call, when you remake outdated outputs. Use saved wording as template copies the prompt as sent so you can edit it.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.images.regenerate":{title:`Regenerate image`,body:`Marks this image to be drawn again from its prompt, one paid image call, with a new result. Nothing runs yet: the image says it is marked, and Keep takes the mark off. Press Save changes, and the rebuild review lists it with the video it outdates. The current image stays until the new one is made.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.narration.editor":{title:`Edit narration`,body:`The narration split into the chunks it was spoken in. Edit a chunk's text, replace its audio with your own file, or have it spoken again. Only the chunks you touch are made again, paid per character, and the video is rendered again with them. Changes apply after you save.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.narration.chunk-text":{title:`Narration chunk text`,body:`What the narrator says in this chunk. Editing it has this chunk spoken again by your voice provider, paid per character of the chunk, when you remake outdated outputs; the other chunks keep their audio. Captions and the video follow. It does not change the article.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.narration.regenerate":{title:`Regenerate narration chunk after review`,body:`Marks this chunk to be spoken again with the same text and voice, paid per character of the chunk, for a new take when a word came out wrong. Nothing runs yet: save, and it is made again when you continue the run. The current audio stays until then.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.captions.editor":{title:`Caption text and timing`,body:`Each caption's words and when it shows, in seconds from the start of the narration. Fix a misheard word or move a caption a little earlier or later; captions must not overlap and must end after they start. Edits cost nothing and only the subtitle files and the video are made again. The narration is not changed.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-captions`}},"project.captions.apply":{title:`Apply caption edits to draft`,body:`Checks every caption (text present, times in order, inside the narration) and puts your edits into the project draft. Nothing is saved until you press Save changes, and the video is rendered again only when you remake outdated outputs.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-captions`}},"project.youtube.summary":{title:`Summary`,body:`The opening of the YouTube description, written by the text model from the article. Edit changes it in place and keeps your text as yours: when the description is written again, your summary stays and the new one waits beside it with Use it, Keep mine and View diff. Use generated goes back to the model's text.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.chapters":{title:`Chapters`,body:`Timestamped chapter lines at the narration's real times, which YouTube turns into chapters. YouTube needs the first at 0:00, at least three, each at least 10 seconds long. Edit changes them in place and your edit survives the next rewrite; Use generated goes back.`,tutorial:{page:`YouTube-Description`,anchor:`chapters-follow-youtubes-rules`}},"project.youtube.hashtags":{title:`Hashtags`,body:`The hashtags at the end of the description; YouTube shows the first three above the title. Edit changes them in place and your edit survives the next rewrite, with the new ones offered beside it. Use generated goes back to the model's.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.tags":{title:`Tags`,body:`Search tags for YouTube's Tags field, which allows 500 characters in all, commas included. They are not shown to viewers. Edit changes them in place and your edit survives the next rewrite; Copy gives them comma-separated, ready to paste.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.pinned-comment":{title:`Pinned comment`,body:`A comment to pin under the video, written with the description: a line or two asking viewers a question about the subject and what to cover next. Your Description prompt can shape it. YouTube pins comments only on a published video: post it from your channel, then choose Pin in its menu. Your edits survive the next rewrite.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.titles":{title:`Other titles`,body:`Two more titles for this video, written with the description, each a different angle. YouTube's A/B Testing, beside the title in Studio, shows up to three titles to viewers and keeps the one watched most. Edit them one per line; your edits survive the next rewrite.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.previous-video":{title:`Previous video for this project`,body:`The link that {{Previous video}} fills in this project's description, ahead of the one on its channel's Brand tab. Paste the video this one follows on from. It changes only what is shown and copied, with no text call. Save links keeps it.`,tutorial:{page:`YouTube-Description`,anchor:`previous-video`}},"project.live.writing":{title:`Live writing`,body:`The text model's words as they arrive, so you can see the article or research taking shape. When a stage makes several calls, the list picks which one to watch. Follow output keeps the newest text in view; untick it to read back. Watching costs nothing extra; the full text is saved when the stage finishes.`,tutorial:{page:`Project-Page`,anchor:`live`}},"project.checkpoints.choices":{title:`Checkpoint choices`,body:`A checkpoint holds the run before a step so you can check and edit what came before it. Tick a step that has not started to add one; untick to remove it, and work already admitted for that step carries on when ready. Pausing the project still applies. Only generated steps can have one. Save checkpoints applies the change.`,tutorial:{page:`Project-Page`,anchor:`checkpoints`}},"project.rebuild.keep-provided":{title:`Keep the provided content`,body:`This output uses a file or text you supplied, and something it depends on, such as the narration, has changed since. Tick to confirm it still fits and keep it as it is. To use something else, cancel and replace the file in Edit project first. Remake stays off until you tick it.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.rebuild.unknown-costs":{title:`Unknown cost estimates`,body:`Some steps use a model with no published price, so their cost cannot be estimated and is left out of the total shown. Tick to start anyway; the real cost is recorded under Cost once they run. Remake stays off until you tick it.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.cost.by-stage":{title:`Cost by stage`,body:`What each stage of this project has cost so far, from every provider call it made, retries and remakes included, priced from the model catalogue when each call finished. Failed calls are not charged here, and taxes and included credits are not counted. Working time is how long the stage's steps were running, over every run.`,tutorial:{page:`Costs-and-Run-Cost`,anchor:`after-a-run-the-run-cost-tab`}},"project.cost.by-model":{title:`Cost by model`,body:`The same spending split by provider and model. Cost is what you paid the provider. Calls through a signed-in command-line tool such as Claude Code or Codex cost $0 on your plan; Via API shows what the same work would cost through the provider's API, for comparison only.`,tutorial:{page:`Costs-and-Run-Cost`,anchor:`after-a-run-the-run-cost-tab`}},"project.upload.item":{title:`What to upload`,body:`Switches the list between the long video and each short, since each is uploaded to YouTube on its own with its own title, description and tags. The ticks and the Fill in YouTube Studio button follow the one you pick.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.real-footage":{title:`Real footage`,body:`Turn this on when the video clips you uploaded are filmed footage, not made by AI. The AI use answer then checks them: laying a Look atmosphere such as fog over real footage makes it Yes, while colour, vignette or grain count as minor edits and keep it No. It is saved with the project and changes nothing in the video.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`ai-use-disclosure`}},"project.upload.slot":{title:`Release time`,body:`When this video goes out. It takes the next free time of a posting-plan line for its series (Settings → YouTube Studio); each short follows at its own times. Pick another free time, or Not scheduled to set it in Studio yourself. Calendar → Releases shows and moves every time. Upload it before its upload-by time so YouTube's checks finish while it is private.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.steps":{title:`Upload steps`,body:`Everything YouTube Studio asks for, in the order it asks: file, title, description, thumbnail, playlist, audience, AI use, tags and the schedule. Copy puts each value on the clipboard. The tick box beside each step is only a note to yourself, remembered in this browser; it changes nothing in the project.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.fill-studio":{title:`Fill in YouTube Studio`,body:`Opens Studio's upload page and adds this item to what waits for the Slopify Studio extension, which must be installed and paired (Settings, YouTube Studio). Each upload dialog you start is filled with the first waiting item. If Studio's dialog lacks a field, nothing is filled and the whole pack is copied instead. You check it and press Publish; Slopify never uploads or publishes.`,tutorial:{page:`Studio-Extension`,anchor:`fill-in-an-upload`}},"project.upload.queue":{title:`Waiting for Studio`,body:`The videos and shorts Fill in YouTube Studio added, oldest first, from every project. Each new upload dialog in Studio is filled with the first, which then leaves the list. It survives restarting Slopify; an item waits up to 24 hours, and a new pairing token clears the list. Remove takes an item out without filling it.`,tutorial:{page:`Studio-Extension`,anchor:`upload-several-one-after-another`}},"project.free-space":{title:`Free space`,body:`Once a project has finished, it can drop the working files it was made from (images, narration parts, subtitle timing, render settings) and keep what gets published: the video, shorts, thumbnail, article, description, document and anything you uploaded. The button says how much space that frees. Changing the project later makes those files again first, which takes time and provider credits. Settings → Storage offers the same for every project.`,tutorial:{page:`Project-Page`,anchor:`free-space`}},"project.mark-uploaded":{title:`Mark uploaded`,body:`Records that you uploaded this finished video to YouTube yourself, so it leaves the ready-to-upload lists on Home and here and shows an Uploaded badge. Slopify does not upload anything or check YouTube. Undo takes the mark off.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`mark-a-video-uploaded`}},"project.edit.update-glossary":{title:`Update from other projects`,body:`Copies your other projects' Pronunciation Glossary terms into this project again, picking up any added since the last copy. The project keeps its own copy, so nothing changes until you press this. After you save, only the narration chunks whose words those terms change are spoken again, paid per character.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"project.edit.show-figures":{title:`Show tables and figures on screen`,body:`Shows each described table, figure, equation and code block in the video while its description is spoken, as the article's picture or a card drawn on this computer at no cost. Turning it on or off renders the video again, and any Shorts that include a card; the narration is kept. The cards appear under Images, From the article, and can be made again there.`,tutorial:{page:`Play-Outputs`,anchor:`show-tables-and-figures-on-screen`}},"project.edit.describe-figures":{title:`Describe tables and figures`,body:`The text model writes a short spoken passage for each table, figure, equation and code block, said in its place. Turning it on costs one text-model call per block, and after you save, the narration chunks that contain a block are spoken again, paid per character (the whole narration when Chunking is the whole article). Other chunks keep their audio; captions and timing are redone to match.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"project.edit.update-aliases":{title:`Update from Library`,body:`Copies Library, Aliases into this project again, picking up aliases added or changed since the last copy. The project keeps its own copy, so a Library edit reaches it only when you press this. After you save, only the narration chunks the changed aliases touch are spoken again, paid per character.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`use-aliases-in-a-video`}}},Xne={"settings.diagnostics":{title:`Download diagnostics`,body:`Saves slopify-diagnostics.json: the Slopify version, your system and Node version, which providers are set up or found, the project count and the model catalogue's state. It never holds your keys, prompts or project content. Attach it to a bug report so the problem can be found faster.`,tutorial:{page:`Troubleshooting`,anchor:`download-diagnostics`}},"settings.autostart":{title:`Start Slopify when you log in`,body:`Slopify starts in the background when you log in to this computer, without opening a browser tab; open it from your bookmark. It uses your account's own start-up list, so no administrator password is needed, and turning it off removes exactly what it added. Default: off. In Docker, Slopify starts whenever Docker does, so this only shows Docker's own setting.`,tutorial:{page:`Start-at-Login`,anchor:`turn-it-on`}},"settings.providers.api-key":{title:`API key`,body:`The key that lets Slopify call this provider on your account; the provider bills you for what it makes. It is stored on this computer only, sent only to that provider, and never put in a backup or export. Paste a new key and Save to replace the old one.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-key`}},"settings.providers.test-key":{title:`Test`,body:`Asks the provider whether the key works, with the cheapest harmless call it allows. A key pasted in the field is tested before you save it; with the field empty, the saved key is. Nothing is generated, billed or stored. When it fails, the answer says why: a rejected key, missing permission, no credit, or the provider being down.`,tutorial:{page:`Providers-and-Keys`,anchor:`test-a-key`}},"settings.provider.openrouter":{title:`OpenRouter`,body:`Writes the text (research, script, article, titles, descriptions) with hundreds of models from many companies through one key. Each call is charged per token from the credit you buy on OpenRouter; prices follow the model catalogue. Choose it when you want a model the command-line tools do not offer.`,tutorial:{page:`Providers-and-Keys`,anchor:`openrouter`}},"settings.provider.claude-code":{title:`Claude Code CLI`,body:`Writes the text with the Claude Code command-line tool on this computer, using your own Claude sign-in, so no API key is needed and calls count toward your Claude plan's limits instead of costing per call. Sign in first by running claude auth login in a terminal. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.codex":{title:`Codex CLI`,body:`Writes the text with the Codex command-line tool on this computer, using your own ChatGPT sign-in, so no API key is needed and calls count toward your plan's limits instead of costing per call. Sign in first by running codex login in a terminal. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.gemini":{title:`Gemini CLI`,body:`Writes the text with the Gemini command-line tool on this computer, using your own Google sign-in, so no API key is needed. Sign in first by running gemini in a terminal and following its login steps. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.codex-image":{title:`Codex CLI images`,body:`Draws the images with the Codex command-line tool, using your ChatGPT sign-in instead of an API key, so images count toward your plan's limits rather than costing per image. It shares its executable path and sign-in with Codex text. Slopify draws up to 4 images at once.`,tutorial:{page:`AI-CLIs`,anchor:`codex-images`}},"settings.provider.elevenlabs":{title:`ElevenLabs`,body:`Narrates the script with ElevenLabs voices, including voices you added to your ElevenLabs account. It is billed in characters of narration from your ElevenLabs plan. A restricted key needs Text to Speech and Models read access.`,tutorial:{page:`Providers-and-Keys`,anchor:`elevenlabs`}},"settings.provider.openai-tts":{title:`OpenAI speech`,body:`Narrates the script with OpenAI's text-to-speech voices. It is billed per character or per audio minute, depending on the model, from prepaid credit on your OpenAI platform account; new accounts need at least $5 of credit before any call works.`,tutorial:{page:`Providers-and-Keys`,anchor:`openai-speech`}},"settings.provider.cartesia":{title:`Cartesia`,body:`Narrates the script with Cartesia voices, billed in characters from your Cartesia plan. The free plan needs no card, so it is an easy way to try narration.`,tutorial:{page:`Providers-and-Keys`,anchor:`cartesia`}},"settings.provider.inworld":{title:`Inworld`,body:`Narrates the script with Inworld voices, billed per character from your Inworld account. Paste the Base64 credentials of a Standard key exactly as shown; Realtime-only keys do not work.`,tutorial:{page:`Providers-and-Keys`,anchor:`inworld`}},"settings.provider.system-voice":{title:`System voice`,body:`Narrates with the speech your computer already has: macOS voices, Windows voices, or on Linux Piper, SVOX Pico or eSpeak NG. No key, no account and no charge, but it sounds robotic next to ElevenLabs or OpenAI. On Linux, install espeak-ng if nothing is found. Its models are the speech programs Slopify found; add one of their voices in Settings → Voices.`,tutorial:{page:`Providers-and-Keys`,anchor:`the-system-voice`}},"settings.provider.google-tts":{title:`Google Gemini voices`,body:`Narrates with Gemini's 30 prebuilt voices, billed to your Gemini API key per text and audio token. It uses the key saved for Google images unless you save one here. Two speakers' consecutive turns can go in one request (see Speakers on Play).`,tutorial:{page:`Providers-and-Keys`,anchor:`google-gemini-speech`}},"settings.provider.fal":{title:`fal.ai`,body:`Draws the images and thumbnails with the image models fal.ai hosts, charged per image from prepaid credit. fal.ai locks the account when the balance runs out, so a run stops at the images step until you add credit.`,tutorial:{page:`Providers-and-Keys`,anchor:`falai`}},"settings.provider.replicate":{title:`Replicate`,body:`Draws the images and thumbnails with the image models Replicate hosts, charged per image or per second of compute from credit you buy up front.`,tutorial:{page:`Providers-and-Keys`,anchor:`replicate`}},"settings.provider.openai-image":{title:`OpenAI images`,body:`Draws the images and thumbnails with OpenAI's GPT Image models, charged per image from prepaid credit on your OpenAI platform account. GPT Image may also need Verify Organization on the OpenAI platform before it works.`,tutorial:{page:`Providers-and-Keys`,anchor:`openai-images`}},"settings.provider.google-image":{title:`Google images`,body:`Draws the images and thumbnails with Google's Gemini image models, charged per image. Use a key made in Google AI Studio on a project with billing set up; Gemini image models are not on the free tier.`,tutorial:{page:`Providers-and-Keys`,anchor:`google`}},"settings.cli.path":{title:`Executable path`,body:`Where the command-line tool is on this computer. Leave it blank and Slopify finds it on PATH, the list of folders your terminal searches. Set an absolute path, without quotes or arguments, when the tool is installed somewhere else or you have more than one copy. Save checks the tool answers.`,tutorial:{page:`AI-CLIs`,anchor:`set-the-executable-path`}},"settings.cli.managed-on-host":{title:`Managed on host`,body:`Slopify runs in Docker, so this tool runs on your computer outside the container, with the sign-in it already has there. Its path cannot be changed here. After you install, update or remove a command-line tool, run the Docker launcher again so Slopify sees the change.`,tutorial:{page:`AI-CLIs`,anchor:`in-docker-the-host-helper`}},"settings.health":{title:`Health check`,body:`Asks each command-line tool whether it is signed in, makes the cheapest harmless call each saved key allows (nothing is generated or billed), and checks that the models your templates, schedules, drafts and projects use are still offered and answer for your key. Run it after changing a key or when a run stops at a provider; Check again on a provider's row checks that one alone.`,tutorial:{page:`Providers-and-Keys`,anchor:`check-all-providers`}},"settings.models.catalogue":{title:`Model catalogue`,body:`The list of models, prices and retirements the pickers and cost estimates use. Slopify checks the published catalogue and OpenRouter's live list when it starts and once a day; Check now does it at once. New models appear and prices update; nothing you made changes. Your own edits to the local file are kept.`,tutorial:{page:`Models`,anchor:`what-the-catalogue-covers`}},"settings.models.replace":{title:`Replace with published file`,body:`Overwrites the local catalogue file with the published one, dropping any edits you made to it. The previous file is saved beside it first, so you can copy your edits back. Use it when the local file is broken or you want the published list exactly.`,tutorial:{page:`Models`,anchor:`replace-the-local-file-with-the-published-one`}},"settings.models.retired":{title:`Retired models in use`,body:`Templates, schedules, drafts and projects with steps still to run that pick a model the provider no longer offers. A run that reaches one stops and says so. Switch replaces only that one model choice with the suggestion shown; Switch all does every one that has a suggestion.`,tutorial:{page:`Models`,anchor:`switch-away-from-a-retired-model`}},"settings.playback.silence-gap":{title:`Silence between segments`,body:`Seconds of quiet between the intro and the narration, and between the narration and the outro, in every new video, unless Play sets a different gap for one video. It only matters when an intro or outro is set; 0 runs them together. Default: 3 seconds, from 0 to 30. Videos already started keep their own gap.`,tutorial:{page:`Settings-Reference`,anchor:`silence-between-segments`}},"settings.loudness":{title:`Level the volume for new runs`,body:`Whether a new run on Play (and a template or quick short) starts with Level the volume on, and at which volumes. On evens out every narration piece and sets the video to about -14 LUFS, the loudness YouTube plays at, and the audio files to -18 LUFS. A project keeps what it started with; change it there in Edit project. Default: on.`,tutorial:{page:`Settings-Reference`,anchor:`level-the-volume-for-new-runs`}},"settings.appearance":{title:`Appearance`,body:`Light or dark colours for Slopify on this computer. System follows your operating system's setting and changes with it. Default: System. It changes at once and does not affect your videos.`,tutorial:{page:`Settings-Reference`,anchor:`appearance`}},"settings.notifications":{title:`Notifications`,body:`Slopify tells you when a run finishes, fails, or stops to wait for your review, and when an automatic review kept an item flagged and needs your decision. The message holds the project title, what happened and a link to the project, never your keys. Browser notifications need a Slopify tab open; a Notification URL works with none open.`,tutorial:{page:`Notifications`,anchor:`when-slopify-notifies-you`}},"settings.notifications.sounds":{title:`Run sounds`,body:`Plays a chime when a run starts and a different, longer one when it finishes, fails or stops to wait for you, while any Slopify tab is open. Only one tab plays each. Needs no permission, but the browser stays silent until the page has been clicked once. This browser only. Default: on.`,tutorial:{page:`Notifications`,anchor:`run-sounds`}},"settings.notifications.browser":{title:`Browser notifications`,body:`Shows a notification from this browser while any Slopify tab is open, even in the background. Turning it on asks the browser's permission. It applies to this browser only, so turn it on in each browser you use. Default: off.`,tutorial:{page:`Notifications`,anchor:`turn-on-browser-notifications`}},"settings.notifications.url":{title:`Notification URL`,body:`An address Slopify POSTs a short plain-text message to, with no tab open. For your phone, install the ntfy app, subscribe to a topic with a long random name, and paste https://ntfy.sh/that-topic. Any address that accepts a POST works. Each message is sent once, with a 5 second timeout. Leave it empty to turn it off.`,tutorial:{page:`Notifications`,anchor:`get-notifications-on-your-phone-notification-url`}},"settings.studio.extension":{title:`Upload pack and extension`,body:`Slopify never uploads or publishes. A finished project's Prepare upload lists everything Studio asks for, with Copy buttons. The optional Slopify Studio browser extension fills Studio's upload dialog from that pack; you still press Publish. Install it from Install the Studio extension below: Download, three steps, then pair it with the token.`,tutorial:{page:`Studio-Extension`,anchor:`get-the-extension`}},"settings.studio.playlist":{title:`Playlists`,body:`The YouTube playlists upload packs offer, typed exactly as Studio names them. Pick Every channel for the default list, or a channel to give it its own. Ticked On by default means every project goes into it; Prepare upload changes the ticks for one project. The extension ticks each one in Studio. Default: none.`,tutorial:{page:`Studio-Extension`,anchor:`settings--youtube-studio`}},"settings.studio.install":{title:`Install the Studio extension`,body:`The extension comes with Slopify: Download saves it for the browser picked, nothing is fetched from a store. Chrome, Edge and Brave load the unzipped folder with Load unpacked (Developer mode); Firefox 128 or newer loads the zip as a temporary add-on, which it forgets on restart. Then pair it with the token above. A new Slopify may bring a new extension: download and load it again after updating.`,tutorial:{page:`Studio-Extension`,anchor:`get-the-extension`}},"settings.studio.pairing":{title:`Extension pairing token`,body:`A secret the Slopify Studio extension needs before it may read your upload packs, so no other page can. Copy it into the extension's options and press Pair. New pairing token makes a fresh one and unpairs the extension until you paste the new token.`,tutorial:{page:`Studio-Extension`,anchor:`pair-it-with-slopify`}},"settings.storage.export":{title:`Export and import`,body:`Export everything saves every project with its files and history, your library, templates, schedules, Play drafts, fonts, settings and usage in one .tar file; never provider keys. Import adds to this install and replaces nothing: projects already here are skipped, taken names arrive as “(imported)” and schedules arrive paused. Running projects must finish or pause first.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`export-and-import`}},"settings.storage.clean":{title:`Clear leftover files`,body:`Deletes files in the projects folder that no project records any more, and uploaded files that no draft, template or project uses. Your projects, outputs and library are never touched. Slopify also does this each time it starts; use it after a crash or to free space now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`clear-leftover-files`}},"settings.storage.disk":{title:`Disk space`,body:`What Slopify stores on this computer: project files (outputs plus the working files they were made from), staged uploads, and deleted projects still in the trash. Deleted projects free their space when the trash removes them after 30 days, or when you choose Delete now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`disk-space`}},"settings.storage.keep-outputs":{title:`Keep outputs only`,body:`On a finished project, deletes the working files it was made from (images, narration parts, subtitle timing, render settings) and keeps the video, shorts, thumbnail, article, description, document and your uploads. Changing the project later makes those files again first, which takes time and provider credits.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`keep-outputs-only`}},"settings.sample.restore":{title:`Sample projects`,body:`The finished examples that come with Slopify: a narrated video, an audiobook and a podcast, which you can look through without spending anything. Restore samples adds back any that were deleted and replaces the others with the originals. Your own copies of them are not touched.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`sample-projects`}},"settings.files":{title:`Your files`,body:`Your projects, automatic backups and exports live here; new installs use Documents/Slopify. The database, settings, keys and logs stay in Slopify's hidden data folder. Moving copies every file, checks each copy by size and checksum, then switches, and keeps the old folder until you delete it. It takes as long as copying your projects and cannot start while a project is being made.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`see-your-files`}},"settings.files.docker":{title:`Your files`,body:`Your projects and backups are in the folders Docker shares with this computer. The container cannot move its own folders, so run the command shown on the computer running Docker: the installer waits for running work, copies your projects, checks the copy and remounts the new folder.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`see-your-files`}},"settings.files.new-folder":{title:`New folder`,body:`The full path of the folder your files move to, on another disk or a synced folder for example. Slopify makes Projects and Backups inside it. It must be empty or not exist yet. The move needs as much free space there as your projects take now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`move-your-files-to-another-folder`}},"settings.backups":{title:`Daily backup`,body:`Once a day Slopify writes the file Export everything makes into the backup folder and deletes its own oldest backups beyond the number you keep. Nothing else there is touched. A backup waits while projects are being made; if Slopify was off at the time, it backs up a couple of minutes after it starts. Each backup can be many gigabytes.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.auto":{title:`Back up automatically`,body:`Turns the daily backup on or off. Default: off, because each backup holds every project's video and can fill a disk. Back up now works either way. Press Save after changing it.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.time":{title:`Time of day`,body:`When the daily backup runs, in this browser's time zone. Pick a time the computer is usually on and idle; a backup waits for running projects. Default: 03:00.`,tutorial:{page:`Backups`,anchor:`when-the-daily-backup-runs`}},"settings.backups.keep":{title:`Keep last`,body:`How many of Slopify's own backups stay in the folder; after a new one is written, the oldest beyond this number are deleted. Each holds everything, so disk use grows with this number. Default: 5, from 1 to 30.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.folder":{title:`Backup folder`,body:`Where backups are written. Leave it empty to use the Backups folder beside your projects (Documents/Slopify/Backups on a new install), which moves with them. Point it at another disk or a synced folder to keep copies away from this disk. Slopify only ever deletes its own backup files there.`,tutorial:{page:`Backups`,anchor:`where-the-files-go-and-what-they-are-called`}},"settings.trash":{title:`Trash`,body:`Deleted projects, prompts, intros and outros, templates and schedules stay here for 30 days, then are removed for good along with a project's files. Restore puts one back; if its name was taken meanwhile it comes back renamed, and a schedule comes back paused. Delete now frees the space at once. Channels, cast members, PDF themes and episode summaries never come here: deleting one removes it permanently.`,tutorial:{page:`Trash`}},"settings.patch-notes":{title:`Patch notes`,body:`What changed in each version of Slopify. The newest notes are open here; older versions are folded under Earlier versions, and each opens when you pick it. They ship with the app, so they work offline. After an update, the new version's notes open by themselves once; a fresh install skips that. On a major update the What's new tour shows instead and links here.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`read-the-patch-notes`}},"settings.whats-new":{title:`What's new in this version`,body:`Opens the patch notes for the version you are running, in Settings, Patch notes. When this version has no notes of its own, it opens the newest ones instead.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`whats-new-tour-on-a-major-update`}},"settings.updates":{title:`Updates`,body:`The circular-arrows button at the foot of the sidebar (at the top on a phone) checks for a newer Slopify and installs it. A dot on it means an update is ready. If a video is being made, the update waits until it finishes, and you can cancel it meanwhile. Slopify restarts itself and this page reconnects.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`update-from-the-app`}},"home.channel":{title:`Channel`,body:`Shows Home and the other screens for one channel, or for all of them. It only filters what you see: projects, schedules and costs of other channels keep running. Slopify remembers the choice in this browser.`,tutorial:{page:`Channels`,anchor:`show-one-channels-work`}},"home.needs-you":{title:`Needs you`,body:`Runs held at a review before a step, paused runs, topics a schedule suggested for you to accept or reject, and runs that failed with the fix to try; then finished videos you have not marked uploaded. Nothing here moves on until you act: approving a review from here lets that run continue, and Mark uploaded takes a finished video off the list (Projects still has it).`,tutorial:{page:`Home-and-Projects`,anchor:`needs-you`}},"home.running":{title:`Running now`,body:`Videos being made or paused, with the step each is on and how long it has taken. Up to 3 show here; Projects lists them all. Open one to follow it live, pause it or cancel it.`,tutorial:{page:`Home-and-Projects`,anchor:`running-now`}},"home.coming-up":{title:`Coming up`,body:`The schedule runs due in the next 7 days, with the template and topic each will use. Paused schedules show too. Plan or move runs on the calendar.`,tutorial:{page:`Home-and-Projects`,anchor:`coming-up`}},"home.this-week":{title:`This week`,body:`Videos made since Monday and what their provider calls cost. Calls billed to a command-line plan cost nothing per call, so the API figure says what they would have cost with API keys. The bars show how much of each plan's weekly limit is used, from the tool's last reading.`,tutorial:{page:`Home-and-Projects`,anchor:`this-week`}},"welcome.samples":{title:`Samples`,body:`Finished projects that come with Slopify: a narrated video, an audiobook and a podcast. They are read-only, so nothing you try on them costs anything; Make my own copy on a sample's page gives you one to edit.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`explore-the-samples`}},"welcome.found":{title:`Found on this computer`,body:`Claude Code, Codex and Gemini CLI write the text with your own sign-in, so no API key is needed for it, and Codex also draws the images. The narration uses a voice key (OpenAI, ElevenLabs, Cartesia or Inworld) when one is saved in Settings → Providers, and otherwise your computer's built-in voice, so no key is needed to start.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`found-on-this-computer`}},"welcome.voice":{title:`Narration voice`,body:`Who reads the script aloud. With a voice key saved (OpenAI, ElevenLabs, Cartesia or Inworld), that provider narrates. Without one, your computer's own speech does it for free: macOS or Windows voices, or eSpeak NG on Linux. It sounds robotic, so add a key in Settings → Providers when you want a better voice.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`narration-voice`}},"welcome.short":{title:`Make a 60-second short`,body:`Slopify writes a script of about 150 words, narrates it, draws four vertical images and renders a captioned 9:16 short, usually in about five minutes with the command-line tools. The narration uses your voice provider's credit, or nothing with the built-in voice; text and images through a command-line tool count toward its plan.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-3-make-a-60-second-short`}},"welcome.topic":{title:`Topic`,body:`What the short is about, in a few words or a question, up to 200 characters. Slopify writes the script from it without a research step, to keep the first short quick, so a specific topic gives a sharper short than a broad one.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-3-make-a-60-second-short`}},"welcome.pack":{title:`Style`,body:`The starter pack whose prompts, voice and art direction the short uses. General is a neutral explainer style. Making the short with a pack adds its prompts and suggested voice to your library; Add to library also adds its template for Play.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-2-pick-a-style`}},"welcome.packs":{title:`Starter packs`,body:`Each pack adds prompts, a suggested voice and a Play template for one kind of channel, so you can pick the template on Play, type a topic and go. Adding a pack twice changes nothing, and it never replaces a prompt or template of yours with the same name.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`starter-packs`}}},Zne={...Jne,...Yne,...Kne,...qne,...Xne};function Oy(e,t){let n=Zne[e];if(t===void 0)return n;let r=e=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e);return{...n,title:r(n.title),body:r(n.body)}}function Qne(e){return e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/`([^`]*)`/g,`$1`).replace(/(\*\*|__)(.+?)\1/g,`$2`).replace(/(^|[^\p{L}\p{N}])[*_]([^*_]+)[*_](?![\p{L}\p{N}])/gu,`$1$2`).replace(/<[^>]+>/g,``).trim()}function ky(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\p{M} _-]/gu,``).replace(/ /g,`-`)}var $ne=`/help/tutorials`;function Ay(e,t){return`${$ne}/${encodeURIComponent(e)}${t?`#${t}`:``}`}function ere(e,t,n){return e.replace(/\]\(([A-Za-z0-9][A-Za-z0-9-]*)?(?:#([^)\s]*))?\)/g,(e,r,i)=>{if(r===void 0&&i===void 0)return e;let a=r??n;return t.has(a)?`](${Ay(a,i)})`:e})}function tre(e){let t=/^\s*#\s+(.+?)\s*#*\s*(?:\n|$)/.exec(e);return t===null?{title:void 0,body:e}:{title:t[1],body:e.slice(t[0].length)}}function nre(e){let t=/^\/help\/tutorials\/([^/#?]+)(?:#(.*))?$/.exec(e);if(t===null)return;let n=t[2];return{page:decodeURIComponent(t[1]??``),anchor:n===void 0||n===``?void 0:decodeURIComponent(n)}}function rre(e,t,n=[]){let r=new Map;for(let e of n){let t=ky(Qne(e));r.set(t,(r.get(t)??0)+1)}for(let n of e.querySelectorAll(`h1, h2, h3, h4, h5, h6`)){let e=ky((n.textContent??``).trim()),i=r.get(e)??0;if(r.set(e,i+1),(i===0?e:`${e}-${String(i)}`)===t)return n}}var jy=xv,My=Sne,ire=Sv,are=Tne;function Ny({className:e,align:t=`start`,sideOffset:n=6,...r}){return(0,h.jsx)(Cne,{children:(0,h.jsx)(wne,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:12,className:R(`z-50 w-[min(340px,calc(100vw-24px))] rounded-control border border-line bg-raised p-3 text-small text-ink-2`,`shadow-[var(--shadow-pop)] outline-hidden`,e),...r})})}function H({id:e,label:t,vars:n,className:r}){let i=Oy(e,n);return(0,h.jsxs)(jy,{children:[(0,h.jsx)(My,{type:`button`,"aria-label":`About ${t??i.title}`,"data-help-id":e,className:R(`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-raised hover:text-ink`,r),children:(0,h.jsx)(el,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,h.jsxs)(Ny,{className:`space-y-2 leading-[1.45]`,children:[(0,h.jsx)(`p`,{className:`m-0 font-semibold text-ink`,children:i.title}),i.body.split(`
|
|
50
|
+
`},dee=0,Mm=[];function fee(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(dee++)[0],a=m.useState(fm)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Up([e.lockRef.current],(e.shards||[]).map(jm),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=km(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Em(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Em(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return cee(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(Mm.length&&Mm[Mm.length-1]===a){var r=`deltaY`in n?Am(n):km(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&lee(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(jm).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=m.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:pee(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=m.useCallback(function(e){n.current=km(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,Am(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,km(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return Mm.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,wm),document.addEventListener(`touchmove`,c,wm),document.addEventListener(`touchstart`,u,wm),function(){Mm=Mm.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,wm),document.removeEventListener(`touchmove`,c,wm),document.removeEventListener(`touchstart`,u,wm)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:uee(i)}):null,p?m.createElement(tee,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function pee(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var mee=nm(rm,fee),Nm=m.forwardRef(function(e,t){return m.createElement(am,Vp({},e,{ref:t,sideCar:mee}))});Nm.classNames=am.classNames;var hee=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Pm=new WeakMap,Fm=new WeakMap,Im={},Lm=0,Rm=function(e){return e&&(e.host||Rm(e.parentNode))},gee=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Rm(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},zm=function(e,t,n,r){var i=gee(t,Array.isArray(e)?e:[e]);Im[n]||(Im[n]=new WeakMap);var a=Im[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Pm.get(e)||0)+1,l=(a.get(e)||0)+1;Pm.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Fm.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Lm++,function(){o.forEach(function(e){var t=Pm.get(e)-1,i=a.get(e)-1;Pm.set(e,t),a.set(e,i),t||(Fm.has(e)||e.removeAttribute(r),Fm.delete(e)),i||e.removeAttribute(n)}),Lm--,Lm||(Pm=new WeakMap,Pm=new WeakMap,Fm=new WeakMap,Im={})}},Bm=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||hee(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),zm(r,i,n,`aria-hidden`)):function(){return null}},Vm=Object.defineProperty,Hm=(e,t)=>Vm(e,`name`,{value:t,configurable:!0}),Um=`Dialog`,[Wm,_ee]=Xd(Um),[vee,Gm]=Wm(Um),Km=Hm(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=m.useRef(null),c=m.useRef(null),[l,u]=kf({prop:r,defaultProp:i??!1,onChange:a,caller:Um}),[d,f]=m.useState(0),[p,g]=m.useState(0);return(0,h.jsx)(vee,{scope:t,triggerRef:s,contentRef:c,contentId:qf(),titleId:qf(),descriptionId:qf(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:g,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),qm=`DialogPortal`,[Jm,Ym]=Wm(qm,{forceMount:void 0}),Xm=Hm(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Gm(qm,t);return(0,h.jsx)(Jm,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,h.jsx)(Lf,{present:n||a.open,children:(0,h.jsx)(Np,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Zm=`DialogOverlay`,Qm=m.forwardRef(Hm(function(e,t){let n=Ym(Zm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Gm(Zm,e.__scopeDialog);return a.modal?(0,h.jsx)(Lf,{present:r||a.open,children:(0,h.jsx)(eh,{...i,ref:t})}):null},`DialogOverlay`)),$m=Od(`DialogOverlay.RemoveScroll`),eh=m.forwardRef(Hm(function(e,t){let{__scopeDialog:n,...r}=e,i=Gm(Zm,n),a=Td(t,lp());return(0,h.jsx)(Nm,{as:$m,allowPinchZoom:!0,shards:[i.contentRef],children:(0,h.jsx)(Gd.div,{"data-state":ch(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),th=`DialogContent`,nh=m.forwardRef(Hm(function(e,t){let n=Ym(th,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Gm(th,e.__scopeDialog);return(0,h.jsx)(Lf,{present:r||a.open,children:a.modal?(0,h.jsx)(rh,{...i,ref:t}):(0,h.jsx)(ih,{...i,ref:t})})},`DialogContent`)),rh=m.forwardRef(Hm(function(e,t){let n=Gm(th,e.__scopeDialog),r=m.useRef(null),i=Td(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return Bm(e)},[]),(0,h.jsx)(ah,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:hf(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:hf(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:hf(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),ih=m.forwardRef(Hm(function(e,t){let n=Gm(th,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(ah,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),ah=m.forwardRef(Hm(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Gm(th,n);return zp(),(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(bp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(cp,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":ch(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),oh=`DialogTitle`,sh=m.forwardRef(Hm(function(e,t){let{__scopeDialog:n,...r}=e,i=Gm(oh,n),{setTitleCount:a}=i;return bf(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(Gd.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),yee=`DialogDescription`,bee=m.forwardRef(Hm(function(e,t){let{__scopeDialog:n,...r}=e,i=Gm(yee,n),{setDescriptionCount:a}=i;return bf(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(Gd.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),xee=`DialogClose`,See=m.forwardRef(Hm(function(e,t){let{__scopeDialog:n,...r}=e,i=Gm(xee,n);return(0,h.jsx)(Gd.button,{type:`button`,...r,ref:t,onClick:hf(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function ch(e){return e?`open`:`closed`}Hm(ch,`getState`);var Cee=Object.defineProperty,wee=(e,t)=>Cee(e,`name`,{value:t,configurable:!0});function lh(e){let[t,n]=m.useState(void 0);return bf(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}wee(lh,`useSize`);var Tee=[`top`,`right`,`bottom`,`left`],uh=Math.min,dh=Math.max,fh=Math.round,ph=Math.floor,mh=e=>({x:e,y:e}),Eee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function hh(e,t,n){return dh(e,uh(t,n))}function gh(e,t){return typeof e==`function`?e(t):e}function _h(e){return e.split(`-`)[0]}function vh(e){return e.split(`-`)[1]}function yh(e){return e===`x`?`y`:`x`}function bh(e){return e===`y`?`height`:`width`}function xh(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Sh(e){return yh(xh(e))}function Dee(e,t,n){n===void 0&&(n=!1);let r=vh(e),i=Sh(e),a=bh(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Eh(o)),[o,Eh(o)]}function Oee(e){let t=Eh(e);return[Ch(e),t,Ch(t)]}function Ch(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var wh=[`left`,`right`],Th=[`right`,`left`],kee=[`top`,`bottom`],Aee=[`bottom`,`top`];function jee(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Th:wh:t?wh:Th;case`left`:case`right`:return t?kee:Aee;default:return[]}}function Mee(e,t,n,r){let i=vh(e),a=jee(_h(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ch)))),a}function Eh(e){let t=_h(e);return Eee[t]+e.slice(t.length)}function Nee(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Dh(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Nee(e)}function Oh(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function kh(e,t,n){let{reference:r,floating:i}=e,a=xh(t),o=Sh(t),s=bh(o),c=_h(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=vh(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Ah(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=gh(t,e),p=Dh(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Oh(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Oh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var jh=50,Mh=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ah},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=kh(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<jh&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=kh(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Nh=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=gh(e,t)||{};if(l==null)return{};let d=Dh(u),f={x:n,y:r},p=Sh(i),m=bh(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=uh(d[_],T),D=uh(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=hh(E,k,O),j=!c.arrow&&vh(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Ph=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=gh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=_h(r),_=xh(o),v=_h(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Eh(o)]:Oee(o)),x=p!==`none`;!d&&x&&b.push(...Mee(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Dee(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===xh(t)||T.every(e=>xh(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=xh(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Fh(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ih(e){return Tee.some(t=>e[t]>=0)}var Lh=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=gh(e,t);switch(i){case`referenceHidden`:{let e=Fh(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ih(e)}}}case`escaped`:{let e=Fh(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ih(e)}}}default:return{}}}}},Rh=new Set([`left`,`top`]);async function zh(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=_h(n),s=vh(n),c=xh(n)===`y`,l=Rh.has(o)?-1:1,u=a&&c?-1:1,d=gh(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Bh=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await zh(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Vh=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=gh(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=xh(i),p=yh(f),m=u[p],h=u[f],g=(e,t)=>hh(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Hh=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=gh(e,t),u={x:n,y:r},d=xh(i),f=yh(d),p=u[f],m=u[d],h=gh(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Rh.has(_h(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Uh=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=gh(e,t),c=await i.detectOverflow(t,s),l=_h(n),u=vh(n),d=xh(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=uh(p-c[m],g),y=uh(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*dh(c.left,c.right):S=p-2*dh(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Wh(){return typeof window<`u`}function Gh(e){return Jh(e)?(e.nodeName||``).toLowerCase():`#document`}function Kh(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function qh(e){return((Jh(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Jh(e){return Wh()?e instanceof Node||e instanceof Kh(e).Node:!1}function Yh(e){return Wh()?e instanceof Element||e instanceof Kh(e).Element:!1}function Xh(e){return Wh()?e instanceof HTMLElement||e instanceof Kh(e).HTMLElement:!1}function Zh(e){return!Wh()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Kh(e).ShadowRoot}function Qh(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=lg(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function $h(e){return/^(table|td|th)$/.test(Gh(e))}function eg(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var tg=/transform|translate|scale|rotate|perspective|filter/,ng=/paint|layout|strict|content/,rg=e=>!!e&&e!==`none`,ig;function ag(e){let t=Yh(e)?lg(e):e;return rg(t.transform)||rg(t.translate)||rg(t.scale)||rg(t.rotate)||rg(t.perspective)||!sg()&&(rg(t.backdropFilter)||rg(t.filter))||tg.test(t.willChange||``)||ng.test(t.contain||``)}function og(e){let t=dg(e);for(;Xh(t)&&!cg(t);){if(ag(t))return t;if(eg(t))return null;t=dg(t)}return null}function sg(){return ig??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ig}function cg(e){return/^(html|body|#document)$/.test(Gh(e))}function lg(e){return Kh(e).getComputedStyle(e)}function ug(e){return Yh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dg(e){if(Gh(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Zh(e)&&e.host||qh(e);return Zh(t)?t.host:t}function fg(e){let t=dg(e);return cg(t)?(e.ownerDocument||e).body:Xh(t)&&Qh(t)?t:fg(t)}function pg(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=fg(e),i=r===e.ownerDocument?.body,a=Kh(r);if(i){let e=mg(a);return t.concat(a,a.visualViewport||[],Qh(r)?r:[],e&&n?pg(e):[])}return t.concat(r,pg(r,[],n))}function mg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hg(e){let t=lg(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Xh(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=fh(n)!==a||fh(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function gg(e){return Yh(e)?e:e.contextElement}function _g(e){let t=gg(e);if(!Xh(t))return mh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=hg(t),o=(a?fh(n.width):n.width)/r,s=(a?fh(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var vg=mh(0);function yg(e){let t=Kh(e);return!sg()||!t.visualViewport?vg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Kh(e)}function xg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=gg(e),o=mh(1);t&&(r?Yh(r)&&(o=_g(r)):o=_g(e));let s=bg(a,n,r)?yg(a):mh(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Kh(a),t=Yh(r)?Kh(r):r,n=e,i=mg(n);for(;i&&t!==n;){let e=_g(i),t=i.getBoundingClientRect(),r=lg(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Kh(i),i=mg(n)}}return Oh({width:u,height:d,x:c,y:l})}function Sg(e,t){let n=ug(e).scrollLeft;return t?t.left+n:xg(qh(e)).left+n}function Cg(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Sg(e,n),y:n.top+t.scrollTop}}function wg(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=qh(r),s=t?eg(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=mh(1),u=mh(0),d=Xh(r);if((d||!a)&&((Gh(r)!==`body`||Qh(o))&&(c=ug(r)),d)){let e=xg(r);l=_g(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Cg(o,c):mh(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Tg(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Eg(e){let t=ug(e),n=e.ownerDocument.body,r=dh(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=dh(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Sg(e),o=-t.scrollTop;return lg(n).direction===`rtl`&&(a+=dh(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Dg=25;function Og(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Kh(e),a=qh(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!sg()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Sg(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Dg&&(s-=o)}return{width:s,height:c,x:l,y:u}}function kg(e,t){let n=xg(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=_g(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ag(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Og(e,n,t);else if(t===`document`)r=Eg(qh(e));else if(Yh(t))r=kg(t,n);else{let n=yg(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Oh(r)}function Pee(e,t){let n=t.get(e);if(n)return n;let r=pg(e,[],!1).filter(e=>Yh(e)&&Gh(e)!==`body`),i=null,a=lg(e).position===`fixed`,o=a?dg(e):e;for(;Yh(o)&&!cg(o);){let e=lg(o),t=ag(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=dg(o)}return t.set(e,r),r}function Fee(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?eg(t)?[]:Pee(t,this._c):[].concat(n),r],o=Ag(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ag(t,a[e],i);s=dh(n.top,s),c=uh(n.right,c),l=uh(n.bottom,l),u=dh(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Iee(e){let{width:t,height:n}=hg(e);return{width:t,height:n}}function Lee(e,t,n){let r=Xh(t),i=qh(t),a=n===`fixed`,o=xg(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=mh(0);if((r||!a)&&((Gh(t)!==`body`||Qh(i))&&(s=ug(t)),r)){let e=xg(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Sg(i));let l=i&&!r&&!a?Cg(i,s):mh(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function jg(e){return lg(e).position===`static`}function Mg(e,t){if(!Xh(e)||lg(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return qh(e)===n&&(n=n.ownerDocument.body),n}function Ng(e,t){let n=Kh(e);if(eg(e))return n;if(!Xh(e)){let t=dg(e);for(;t&&!cg(t);){if(Yh(t)&&!jg(t))return t;t=dg(t)}return n}let r=Mg(e,t);for(;r&&$h(r)&&jg(r);)r=Mg(r,t);return r&&cg(r)&&jg(r)&&!ag(r)?n:r||og(e)||n}var Ree=async function(e){let t=this.getOffsetParent||Ng,n=this.getDimensions,r=await n(e.floating);return{reference:Lee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zee(e){return lg(e).direction===`rtl`}var Bee={convertOffsetParentRelativeRectToViewportRelativeRect:wg,getDocumentElement:qh,getClippingRect:Fee,getOffsetParent:Ng,getElementRects:Ree,getClientRects:Tg,getDimensions:Iee,getScale:_g,isElement:Yh,isRTL:zee};function Pg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vee(e,t,n){let r=null,i,a=qh(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ph(d),h=ph(a.clientWidth-(u+f)),g=ph(a.clientHeight-(d+p)),_=ph(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:dh(0,uh(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Pg(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Kh(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Hee(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=gg(e),u=i||a?[...l?pg(l):[],...t?pg(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Vee(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?xg(e):null;c&&g();function g(){let t=xg(e);h&&!Pg(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Uee=Bh,Wee=Vh,Gee=Ph,Kee=Uh,qee=Lh,Fg=Nh,Jee=Hh,Yee=(e,t,n)=>{let r=new Map,i=n??{},a={...Bee,...i.platform,_c:r};return Mh(e,t,{...i,platform:a})},Ig=typeof document<`u`?m.useLayoutEffect:function(){};function Lg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Lg(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Lg(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Rg(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zg(e,t){let n=Rg(e);return Math.round(t*n)/n}function Bg(e){let t=m.useRef(e);return Ig(()=>{t.current=e}),t}function Xee(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);Lg(f,r)||p(r);let[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=m.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=m.useRef(null),w=m.useRef(null),T=m.useRef(u),E=c!=null,D=Bg(c),O=Bg(i),k=Bg(l),A=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Yee(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Lg(T.current,t)&&(T.current=t,Hd.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Ig(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=m.useRef(!1);Ig(()=>(j.current=!0,()=>{j.current=!1}),[]),Ig(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),ee=m.useMemo(()=>({reference:x,floating:S}),[x,S]),N=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!ee.floating)return e;let t=zg(ee.floating,u.x),r=zg(ee.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Rg(ee.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ee.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:A,refs:M,elements:ee,floatingStyles:N}),[u,A,M,ee,N])}var Zee=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Fg({element:r.current,padding:i}).fn(n):r?Fg({element:r,padding:i}).fn(n):{}}}},Qee=(e,t)=>{let n=Uee(e);return{name:n.name,fn:n.fn,options:[e,t]}},$ee=(e,t)=>{let n=Wee(e);return{name:n.name,fn:n.fn,options:[e,t]}},ete=(e,t)=>({fn:Jee(e).fn,options:[e,t]}),tte=(e,t)=>{let n=Gee(e);return{name:n.name,fn:n.fn,options:[e,t]}},nte=(e,t)=>{let n=Kee(e);return{name:n.name,fn:n.fn,options:[e,t]}},rte=(e,t)=>{let n=qee(e);return{name:n.name,fn:n.fn,options:[e,t]}},ite=(e,t)=>{let n=Zee(e);return{name:n.name,fn:n.fn,options:[e,t]}},ate=Object.defineProperty,Vg=(e,t)=>ate(e,`name`,{value:t,configurable:!0}),Hg=`Popper`,[Ug,Wg]=Xd(Hg),[ote,Gg]=Ug(Hg),ste=Vg(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,h.jsx)(ote,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),cte=`PopperAnchor`,lte=m.forwardRef(Vg(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Gg(cte,n),o=m.useRef(null),s=a.onAnchorChange,c=Td(t,m.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=m.useRef(null);m.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Jg(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,h.jsx)(Gd.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Kg=`PopperContent`,[ute,dte]=Ug(Kg),fte=m.forwardRef(Vg(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:g,..._}=e,v=Gg(Kg,n),[y,b]=m.useState(null),x=Td(t,b),[S,C]=m.useState(null),w=lh(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(qg),altBoundary:A},{refs:M,floatingStyles:ee,placement:N,isPositioned:te,middlewareData:P}=Xee({strategy:`fixed`,placement:D,whileElementsMounted:Vg((...e)=>Hee(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:v.anchor},middleware:[Qee({mainAxis:i+E,alignmentAxis:o}),c&&$ee({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?ete():void 0,...j}),c&&tte({...j}),nte({...j,apply:Vg(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&ite({element:S,padding:s}),pte({arrowWidth:T,arrowHeight:E}),f&&rte({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),ne=v.setPlacementState;bf(()=>(ne(N),()=>{ne(void 0)}),[N,ne]);let[re,ie]=Jg(N),ae=ep(g);bf(()=>{te&&ae?.()},[te,ae]);let oe=P.arrow?.x,se=P.arrow?.y,ce=P.arrow?.centerOffset!==0,[le,ue]=m.useState();return bf(()=>{y&&ue(window.getComputedStyle(y).zIndex)},[y]),(0,h.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:te?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:le,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,h.jsx)(ute,{scope:n,placedSide:re,placedAlign:ie,onArrowChange:C,arrowX:oe,arrowY:se,shouldHideArrow:ce,children:(0,h.jsx)(Gd.div,{"data-side":re,"data-align":ie,..._,ref:x,style:{..._.style,animation:te?_.style?.animation:`none`}})})})},`PopperContent`));function qg(e){return e!==null}Vg(qg,`isNotNull`);var pte=Vg(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Jg(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Jg(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Vg(Jg,`getSideAndAlignFromPlacement`);var Yg=ste,Xg=lte,Zg=fte,mte=Object.defineProperty,Qg=(e,t)=>mte(e,`name`,{value:t,configurable:!0}),$g=!1;function e_(){let[e,t]=m.useState($g);return m.useEffect(()=>{$g||($g=!0,t(!0))},[]),e}Qg(e_,`useIsHydrated`);var t_=m.useSyncExternalStore;function n_(){return()=>{}}Qg(n_,`subscribe`);function r_(){return t_(n_,()=>!0,()=>!1)}Qg(r_,`useIsHydratedModern`);var hte=typeof t_==`function`?r_:e_,gte=Object.defineProperty,i_=(e,t)=>gte(e,`name`,{value:t,configurable:!0}),a_=`rovingFocusGroup.onEntryFocus`,_te={bubbles:!1,cancelable:!0},o_=`RovingFocusGroup`,[s_,c_,vte]=ef(o_),[yte,l_]=Xd(o_,[vte]),[bte,xte]=yte(o_),Ste=m.forwardRef(i_(function(e,t){return(0,h.jsx)(s_.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(s_.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Cte,{...e,ref:t})})})},`RovingFocusGroup`)),Cte=m.forwardRef(i_(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=m.useRef(null),p=Td(t,f),g=Zf(a),[_,v]=kf({prop:o,defaultProp:s??null,onChange:c,caller:o_}),[y,b]=m.useState(!1),x=ep(l),S=c_(n),C=m.useRef(!1),[w,T]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(a_,x),()=>e.removeEventListener(a_,x)},[x]),(0,h.jsx)(bte,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:_,onItemFocus:m.useCallback(e=>v(e),[v]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:m.useCallback(()=>T(e=>e-1),[]),children:(0,h.jsx)(Gd.div,{tabIndex:y||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:hf(e.onMouseDown,()=>{C.current=!0}),onFocus:hf(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(a_,_te);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);f_([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}C.current=!1}),onBlur:hf(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),wte=`RovingFocusGroupItem`,Tte=m.forwardRef(i_(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=qf(),l=a||c,u=xte(wte,n),d=u.currentTabStopId===l,f=c_(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:_}=u,v=hte();return bf(()=>{if(v&&r)return p(),()=>g()},[v,r,p,g]),m.useEffect(()=>{if(!v&&r)return p(),()=>g()},[v,r,p,g]),(0,h.jsx)(s_.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,h.jsx)(Gd.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:hf(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:hf(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:hf(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=d_(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?p_(n,r+1):n.slice(r+1)}setTimeout(()=>f_(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})},`RovingFocusGroupItem`)),Ete={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function u_(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}i_(u_,`getDirectionAwareKey`);function d_(e,t,n){let r=u_(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Ete[r]}i_(d_,`getFocusIntent`);function f_(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}i_(f_,`focusFirst`);function p_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}i_(p_,`wrapArray`);var m_=Ste,h_=Tte,Dte=Object.defineProperty,g_=(e,t)=>Dte(e,`name`,{value:t,configurable:!0}),__=[`Enter`,` `],Ote=[`ArrowDown`,`PageUp`,`Home`],v_=[`ArrowUp`,`PageDown`,`End`],kte=[...Ote,...v_];[...__],[...__];var y_=`Menu`,[b_,Ate,jte]=ef(y_),[x_,S_]=Xd(y_,[jte,Wg,l_]),C_=Wg(),w_=l_(),[Mte,T_]=x_(y_),[Nte,E_]=x_(y_),Pte=g_(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=C_(t),[c,l]=m.useState(null),u=m.useRef(!1),d=ep(a),f=Zf(i);return m.useEffect(()=>{let e=g_(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=g_(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),m.useEffect(()=>{if(!n)return;let e=g_(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,h.jsx)(Yg,{...s,children:(0,h.jsx)(Mte,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,h.jsx)(Nte,{scope:t,onClose:m.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Fte=m.forwardRef(g_(function(e,t){let{__scopeMenu:n,...r}=e,i=C_(n);return(0,h.jsx)(Xg,{...i,...r,ref:t})},`MenuAnchor`)),D_=`MenuPortal`,[Ite,Lte]=x_(D_,{forceMount:void 0}),Rte=g_(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=T_(D_,t);return(0,h.jsx)(Ite,{scope:t,forceMount:n,children:(0,h.jsx)(Lf,{present:n||a.open,children:(0,h.jsx)(Np,{asChild:!0,container:i,children:r})})})},`MenuPortal`),O_=`MenuContent`,[zte,k_]=x_(O_),Bte=m.forwardRef(g_(function(e,t){let n=Lte(O_,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=T_(O_,e.__scopeMenu),o=E_(O_,e.__scopeMenu);return(0,h.jsx)(b_.Provider,{scope:e.__scopeMenu,children:(0,h.jsx)(Lf,{present:r||a.open,children:(0,h.jsx)(b_.Slot,{scope:e.__scopeMenu,children:o.modal?(0,h.jsx)(Vte,{...i,ref:t}):(0,h.jsx)(Hte,{...i,ref:t})})})})},`MenuContent`)),Vte=m.forwardRef(g_(function(e,t){let n=T_(O_,e.__scopeMenu),r=m.useRef(null),i=Td(t,r);return m.useEffect(()=>{let e=r.current;if(e)return Bm(e)},[]),(0,h.jsx)(A_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:hf(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Hte=m.forwardRef(g_(function(e,t){let n=T_(O_,e.__scopeMenu);return(0,h.jsx)(A_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Ute=Od(`MenuContent.ScrollLock`),A_=m.forwardRef(g_(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:g,..._}=e,v=T_(O_,n),y=E_(O_,n),b=C_(n),x=w_(n),S=Ate(n),[C,w]=m.useState(null),T=m.useRef(null),E=Td(t,T,v.onContentChange),D=m.useRef(0),O=m.useRef(``),k=m.useRef(0),A=m.useRef(null),j=m.useRef(`right`),M=m.useRef(0),ee=g?Nm:m.Fragment,N=g?{as:Ute,allowPinchZoom:!0}:void 0,te=g_(e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=L_(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;g_((function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);m.useEffect(()=>()=>window.clearTimeout(D.current),[]),zp();let P=m.useCallback(e=>j.current===A.current?.side&&z_(e,A.current?.area),[]);return(0,h.jsx)(zte,{scope:n,searchRef:O,onItemEnter:m.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:m.useCallback(e=>{P(e)||(T.current?.focus(),w(null))},[P]),onTriggerLeave:m.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:k,onPointerGraceIntentChange:m.useCallback(e=>{A.current=e},[]),children:(0,h.jsx)(ee,{...N,children:(0,h.jsx)(bp,{asChild:!0,trapped:i,onMountAutoFocus:hf(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,h.jsx)(cp,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,h.jsx)(m_,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:hf(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,h.jsx)(Zg,{role:`menu`,"aria-orientation":`vertical`,"data-state":N_(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:hf(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&te(e.key));let i=T.current;if(e.target!==i||!kte.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);v_.includes(e.key)&&a.reverse(),F_(a)}),onBlur:hf(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:hf(e.onPointerMove,B_(e=>{let t=e.target,n=M.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>M.current?`right`:`left`;j.current=t,M.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),j_=`MenuItem`,M_=`menu.itemSelect`,Wte=m.forwardRef(g_(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=m.useRef(null),o=E_(j_,e.__scopeMenu),s=k_(j_,e.__scopeMenu),c=Td(t,a),l=m.useRef(!1),u=g_(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(M_,{bubbles:!0,cancelable:!0});e.addEventListener(M_,e=>r?.(e),{once:!0}),Kd(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,h.jsx)(Gte,{...i,ref:c,disabled:n,onClick:hf(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:hf(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:hf(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&__.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Gte=m.forwardRef(g_(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=k_(j_,n),s=w_(n),c=m.useRef(null),l=Td(t,c),[u,d]=m.useState(!1),[f,p]=m.useState(``);return m.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,h.jsx)(b_.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,h.jsx)(h_,{asChild:!0,...s,focusable:!r,children:(0,h.jsx)(Gd.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:hf(e.onPointerMove,B_(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:hf(e.onPointerLeave,B_(e=>o.onItemLeave(e))),onFocus:hf(e.onFocus,()=>d(!0)),onBlur:hf(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[Kte,qte]=x_(`MenuRadioGroup`,{value:void 0,onValueChange:g_(()=>{},`onValueChange`)}),[Jte,Yte]=x_(`MenuItemIndicator`,{checked:!1}),Xte=m.forwardRef(g_(function(e,t){let{__scopeMenu:n,...r}=e;return(0,h.jsx)(Gd.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Zte,Qte]=x_(`MenuSub`);function N_(e){return e?`open`:`closed`}g_(N_,`getOpenState`);function P_(e){return e===`indeterminate`}g_(P_,`isIndeterminate`);function $te(e){return P_(e)?`indeterminate`:e?`checked`:`unchecked`}g_($te,`getCheckedState`);function F_(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}g_(F_,`focusFirst`);function I_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}g_(I_,`wrapArray`);function L_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=I_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}g_(L_,`getNextMatch`);function R_(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}g_(R_,`isPointInPolygon`);function z_(e,t){return t?R_({x:e.clientX,y:e.clientY},t):!1}g_(z_,`isPointerInGraceArea`);function B_(e){return t=>t.pointerType===`mouse`?e(t):void 0}g_(B_,`whenMouse`);var ene=Pte,tne=Fte,nne=Rte,rne=Bte,V_=Wte,ine=Xte,ane=Object.defineProperty,H_=(e,t)=>ane(e,`name`,{value:t,configurable:!0}),U_=`DropdownMenu`,[one,sne]=Xd(U_,[S_]),W_=S_(),[cne,G_]=one(U_),K_=H_(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=W_(t),l=m.useRef(null),[u,d]=kf({prop:i,defaultProp:a??!1,onChange:o,caller:U_});return(0,h.jsx)(cne,{scope:t,triggerId:qf(),triggerRef:l,contentId:qf(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,h.jsx)(ene,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),q_=`DropdownMenuTrigger`,J_=m.forwardRef(H_(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=G_(q_,n),o=W_(n),s=Td(t,a.triggerRef);return(0,h.jsx)(tne,{asChild:!0,...o,children:(0,h.jsx)(Gd.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:hf(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:hf(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),Y_=H_(e=>{let{__scopeDropdownMenu:t,...n}=e,r=W_(t);return(0,h.jsx)(nne,{...r,...n})},`DropdownMenuPortal`),X_=`DropdownMenuContent`,Z_=m.forwardRef(H_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=G_(X_,n),a=W_(n),o=m.useRef(!1);return(0,h.jsx)(rne,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:hf(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:hf(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),lne=m.forwardRef(H_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=W_(n);return(0,h.jsx)(V_,{...i,...r,ref:t})},`DropdownMenuItem`)),une=m.forwardRef(H_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=W_(n);return(0,h.jsx)(ine,{...i,...r,ref:t})},`DropdownMenuSeparator`)),dne=K_,fne=J_,pne=Y_,mne=Z_,hne=lne,gne=une,_ne=Object.defineProperty,vne=m.forwardRef(((e,t)=>_ne(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,h.jsx)(Gd.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),yne=Object.defineProperty,Q_=(e,t)=>yne(e,`name`,{value:t,configurable:!0}),$_=`Popover`,[ev,bne]=Xd($_,[Wg]),tv=Wg(),[xne,nv]=ev($_),rv=Q_(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=tv(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=kf({prop:r,defaultProp:i??!1,onChange:a,caller:$_});return(0,h.jsx)(Yg,{...s,children:(0,h.jsx)(xne,{scope:t,contentId:qf(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),iv=`PopoverAnchor`,av=m.forwardRef(Q_(function(e,t){let{__scopePopover:n,...r}=e,i=nv(iv,n),a=tv(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return m.useEffect(()=>(o(),()=>s()),[o,s]),(0,h.jsx)(Xg,{...a,...r,ref:t})},`PopoverAnchor`)),ov=`PopoverTrigger`,sv=m.forwardRef(Q_(function(e,t){let{__scopePopover:n,...r}=e,i=nv(ov,n),a=tv(n),o=Td(t,i.triggerRef),s=(0,h.jsx)(Gd.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":bv(i.open),...r,ref:o,onClick:hf(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,h.jsx)(Xg,{asChild:!0,...a,children:s})},`PopoverTrigger`)),cv=`PopoverPortal`,[lv,uv]=ev(cv,{forceMount:void 0}),dv=Q_(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=nv(cv,t);return(0,h.jsx)(lv,{scope:t,forceMount:n,children:(0,h.jsx)(Lf,{present:n||a.open,children:(0,h.jsx)(Np,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),fv=`PopoverContent`,pv=m.forwardRef(Q_(function(e,t){let n=uv(fv,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=nv(fv,e.__scopePopover);return(0,h.jsx)(Lf,{present:r||a.open,children:a.modal?(0,h.jsx)(hv,{...i,ref:t}):(0,h.jsx)(gv,{...i,ref:t})})},`PopoverContent`)),mv=Od(`PopoverContent.RemoveScroll`),hv=m.forwardRef(Q_(function(e,t){let n=nv(fv,e.__scopePopover),r=m.useRef(null),i=Td(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return Bm(e)},[]),(0,h.jsx)(Nm,{as:mv,allowPinchZoom:!0,children:(0,h.jsx)(_v,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:hf(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:hf(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:hf(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),gv=m.forwardRef(Q_(function(e,t){let n=nv(fv,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(_v,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),_v=m.forwardRef(Q_(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=nv(fv,n),p=tv(n);return zp(),(0,h.jsx)(bp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(cp,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,h.jsx)(Zg,{"data-state":bv(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.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)`}})})})},`PopoverContentImpl`)),vv=`PopoverClose`,yv=m.forwardRef(Q_(function(e,t){let{__scopePopover:n,...r}=e,i=nv(vv,n);return(0,h.jsx)(Gd.button,{type:`button`,...r,ref:t,onClick:hf(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function bv(e){return e?`open`:`closed`}Q_(bv,`getState`);var xv=rv,Sv=av,Sne=sv,Cne=dv,wne=pv,Tne=yv,Ene=Object.defineProperty,Dne=(e,t)=>Ene(e,`name`,{value:t,configurable:!0}),One=`Toggle`,kne=m.forwardRef(Dne(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=kf({prop:n,onChange:i,defaultProp:r??!1,caller:One});return(0,h.jsx)(Gd.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:hf(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Ane=Object.defineProperty,Cv=(e,t)=>Ane(e,`name`,{value:t,configurable:!0}),wv=`ToggleGroup`,[Tv,jne]=Xd(wv,[l_]),Ev=l_(),Mne=m.forwardRef(Cv(function(e,t){let{type:n,...r}=e;if(n===`single`)return(0,h.jsx)(Nne,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,h.jsx)(Pne,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${wv}\``)},`ToggleGroup`)),[Dv,Ov]=Tv(wv),Nne=m.forwardRef(Cv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Cv(()=>{},`onValueChange`),...a}=e,[o,s]=kf({prop:n,defaultProp:r??``,onChange:i,caller:wv});return(0,h.jsx)(Dv,{scope:e.__scopeToggleGroup,type:`single`,value:m.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:m.useCallback(()=>s(``),[s]),children:(0,h.jsx)(kv,{...a,ref:t})})},`ToggleGroupImplSingle`)),Pne=m.forwardRef(Cv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Cv(()=>{},`onValueChange`),...a}=e,[o,s]=kf({prop:n,defaultProp:r??[],onChange:i,caller:wv}),c=m.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=m.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,h.jsx)(Dv,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,h.jsx)(kv,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[Fne,Ine]=Tv(wv),kv=m.forwardRef(Cv(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=Ev(n),u=Zf(o),d={dir:u,...c};return(0,h.jsx)(Fne,{scope:n,rovingFocus:i,disabled:r,children:i?(0,h.jsx)(m_,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,h.jsx)(Gd.div,{...d,ref:t})}):(0,h.jsx)(Gd.div,{...d,ref:t})})},`ToggleGroupImpl`)),Av=`ToggleGroupItem`,Lne=m.forwardRef(Cv(function(e,t){let n=Ov(Av,e.__scopeToggleGroup),r=Ine(Av,e.__scopeToggleGroup),i=Ev(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=m.useRef(null);return r.rovingFocus?(0,h.jsx)(h_,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,h.jsx)(jv,{...s,ref:t})}):(0,h.jsx)(jv,{...s,ref:t})},`ToggleGroupItem`)),jv=m.forwardRef(Cv(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=Ov(Av,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===`single`?o:void 0;return(0,h.jsx)(kne,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`));function Mv({variant:e=`secondary`,size:t=`default`}={}){return R(`sl-btn`,`sl-btn--${e}`,t===`small`&&`sl-btn--small`)}function z({variant:e=`secondary`,size:t=`default`,disabledReason:n,focusableWhenDisabled:r=!1,className:i,type:a,title:o,disabled:s,onClick:c,children:l,...u}){let d=(0,m.useId)(),f=R(Mv({variant:e,size:t}),i),p=s===!0&&n!==``?n:void 0;if(p===void 0||!r)return(0,h.jsx)(`button`,{"data-slot":`button`,"data-variant":e,type:a??`button`,title:p??o,disabled:s,onClick:c,className:f,...u,children:l});let g=[u[`aria-describedby`],d].filter(Boolean).join(` `);return(0,h.jsxs)(`button`,{"data-slot":`button`,"data-variant":e,type:a??`button`,className:f,...u,"aria-disabled":`true`,"aria-describedby":g,"data-tip":p,"data-reason":``,onClick:e=>e.preventDefault(),onPointerDown:e=>e.preventDefault(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.preventDefault()},children:[l,(0,h.jsx)(`span`,{id:d,hidden:!0,children:p})]})}function Nv({label:e,tip:t,title:n,children:r,...i}){let a=t===!1?void 0:typeof t==`string`?t:e;return(0,h.jsx)(z,{variant:`icon`,"aria-label":e,...a===void 0?{title:n??e}:{"data-tip":a},...i,children:r})}function Pv({className:e,asChild:t=!1,type:n,...r}){let i=t?kd:`button`;return(0,h.jsx)(i,{"data-slot":`play-key`,...t?{}:{type:n??`button`},className:R(`sl-key`,e),...r})}function Fv({className:e,...t}){return(0,h.jsx)(`div`,{className:R(`sl-btn-row`,e),...t})}var Rne=5e3,zne=15e3;function Bne(e,t){if(e!==`error`)return t===void 0?Rne:zne}var Iv=(0,m.createContext)(void 0);function Vne({children:e}){let[t,n]=(0,m.useState)([]),r=(0,m.useRef)(0),i=(0,m.useRef)(new Map),a=(0,m.useRef)({hover:!1,focus:!1}),o=(0,m.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e));let t=i.current.get(e);t?.handle!==void 0&&clearTimeout(t.handle),i.current.delete(e)},[]),s=(0,m.useCallback)((e,t)=>{t.startedAt=Date.now(),t.handle=setTimeout(()=>o(e),t.remaining)},[o]),c=(0,m.useCallback)((e,t)=>{let n=a.current.hover||a.current.focus;a.current={...a.current,[e]:t};let r=a.current.hover||a.current.focus;if(n!==r)for(let[e,t]of i.current)r?(t.handle!==void 0&&clearTimeout(t.handle),t.handle=void 0,t.remaining=Math.max(0,t.remaining-(Date.now()-t.startedAt))):(t.remaining=Math.max(t.remaining,2e3),s(e,t))},[s]),l=(0,m.useCallback)((e,t=`info`,o)=>{r.current+=1;let c=r.current;n(n=>{let r=n.filter(t=>t.message!==e);for(let e of r.slice(0,Math.max(0,r.length-2))){let t=i.current.get(e.id);t?.handle!==void 0&&clearTimeout(t.handle),i.current.delete(e.id)}return[...r.slice(-2),{id:c,message:e,tone:t,action:o}]});let l=Bne(t,o);if(l===void 0)return;let u={remaining:l,startedAt:Date.now(),handle:void 0};i.current.set(c,u),a.current.hover||a.current.focus||s(c,u)},[s]);(0,m.useEffect)(()=>{t.length===0&&(a.current={hover:!1,focus:!1})},[t.length]),(0,m.useEffect)(()=>{let e=i.current;return()=>{for(let t of e.values())t.handle!==void 0&&clearTimeout(t.handle)}},[]);let u=(0,m.useMemo)(()=>l,[l]),d=t.filter(e=>e.tone!==`error`),f=t.filter(e=>e.tone===`error`),p=e=>(0,h.jsx)(Hne,{toast:e,dismiss:()=>o(e.id)},e.id);return(0,h.jsxs)(Iv.Provider,{value:u,children:[e,(0,h.jsxs)(`section`,{"aria-label":`Notifications`,className:`sl-toasts`,onPointerEnter:()=>c(`hover`,!0),onPointerLeave:()=>c(`hover`,!1),onFocus:()=>c(`focus`,!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||c(`focus`,!1)},children:[(0,h.jsx)(`div`,{"aria-live":`assertive`,"aria-relevant":`additions text`,className:`sl-toasts__list`,children:f.map(p)}),(0,h.jsx)(`div`,{"aria-live":`polite`,"aria-relevant":`additions text`,className:`sl-toasts__list`,children:d.map(p)})]})]})}function Hne({toast:e,dismiss:t}){return(0,h.jsxs)(`div`,{"data-tone":e.tone,className:R(`sl-toast sl-enter`,e.tone===`error`&&`sl-toast--failed`,e.tone===`success`&&`sl-toast--done`),children:[e.tone===`error`?(0,h.jsx)(Sl,{"aria-hidden":`true`,strokeWidth:1.75}):e.tone===`success`?(0,h.jsx)(Ac,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(el,{"aria-hidden":`true`,strokeWidth:1.75,className:`text-ink-2`}),(0,h.jsx)(`p`,{className:`sl-toast__text m-0 min-w-0 break-words`,children:e.message}),e.action===void 0?null:(0,h.jsx)(z,{variant:`quiet`,size:`small`,onClick:()=>{t(),e.action?.run()},children:e.action.label}),(0,h.jsx)(`button`,{type:`button`,"aria-label":`Dismiss notification`,onClick:t,className:`sl-btn sl-btn--icon sl-btn--small -mr-1 w-[30px]`,children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})}function Lv(){return(0,m.useContext)(Iv)??Une}function Une(){}var Rv=(0,m.createContext)(void 0);function Wne({deps:e,children:t}){return(0,h.jsx)(Rv.Provider,{value:e,children:(0,h.jsx)(Vne,{children:t})})}function B(){let e=(0,m.useContext)(Rv);if(e===void 0)throw Error(`useApp was called outside AppProvider`);return e}var zv=`Slopify`,Bv,Vv=[];function Hv(){if(typeof document>`u`)return;let e=Vv.at(-1)?.title??Bv;document.title=e===void 0||e===``?zv:`${e} · ${zv}`}function Uv(e){Bv=e,Hv()}function Wv(e){(0,m.useEffect)(()=>{if(e===void 0||e===``)return;let t={title:e};return Vv.push(t),Hv(),()=>{Vv.splice(Vv.indexOf(t),1),Hv()}},[e])}function Gv(e){return[[/^\/$/,`Home`],[/^\/projects\/?$/,`Projects`],[/^\/projects\/[^/]+/,`Project`],[/^\/play/,`Create`],[/^\/calendar/,`Calendar`],[/^\/schedules/,`Calendar`],[/^\/channels\/?$/,`Channels`],[/^\/channels\/[^/]+/,`Channel`],[/^\/prompts/,`Library · Prompts`],[/^\/entries/,`Library · Intros and outros`],[/^\/templates/,`Library · Templates`],[/^\/document-themes/,`Library · Documents`],[/^\/narration-aliases/,`Library · Narration aliases`],[/^\/ab-results/,`Library · A/B results`],[/^\/settings/,`Settings`],[/^\/help/,`Tutorials`],[/^\/welcome/,`Welcome`]].find(([t])=>t.test(e))?.[1]}var Kv=Km,qv=Xm;function Jv({className:e,...t}){return(0,h.jsx)(Qm,{"data-slot":`dialog-overlay`,className:R(`fixed inset-0 z-40 bg-scrim`,e),...t})}function Yv({className:e,children:t,...n}){return(0,h.jsxs)(qv,{children:[(0,h.jsx)(Jv,{}),(0,h.jsx)(nh,{"data-slot":`dialog-content`,className:R(`sl-dialog fixed top-1/2 left-1/2 z-50 max-h-[calc(100vh-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`data-[state=open]:animate-dialog-in motion-reduce:animate-none`,e),...n,children:t})]})}function Xv({className:e,...t}){return(0,h.jsx)(sh,{"data-slot":`dialog-title`,className:R(`sl-dialog__title text-ink`,e),...t})}function Zv({className:e,...t}){return(0,h.jsx)(bee,{"data-slot":`dialog-description`,className:R(`m-0 text-body text-ink-2`,e),...t})}function Qv({open:e,onOpenChange:t,title:n,description:r,footer:i,children:a,className:o,dismissible:s=!0}){return(0,h.jsx)(Kv,{open:e,...t===void 0?{}:{onOpenChange:t},children:(0,h.jsxs)(Yv,{className:o,...s?{}:{onEscapeKeyDown:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()},...r===void 0?{"aria-describedby":void 0}:{},children:[(0,h.jsx)(Xv,{children:n}),r===void 0?null:(0,h.jsx)(Zv,{children:r}),a,i===void 0?null:(0,h.jsx)(`div`,{className:`sl-dialog__foot`,children:i})]})})}function $v({open:e,title:t,consequence:n,confirmLabel:r,cancelLabel:i,tone:a=`destructive`,pending:o=!1,onConfirm:s,onCancel:c}){return(0,h.jsx)(Qv,{open:e,onOpenChange:e=>{e||c()},title:t,description:n,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{variant:`secondary`,autoFocus:!0,onClick:c,children:i??(a===`destructive`?`Keep it`:`Cancel`)}),(0,h.jsx)(z,{variant:a,disabled:o,disabledReason:`Working on it`,onClick:s,children:r})]})})}var ey=[`onboarding`],ty=[`onboarding`,`sample`],ny=(e,t)=>[`narration-peaks`,e,t],ry=(e,t,n)=>e.fetch(`${e.origin}/api/onboarding${t}`,{method:`POST`,...n===void 0?{}:{headers:{"content-type":`application/json`},body:JSON.stringify(n)}});async function iy(e){return L(await e.fetch(`${e.origin}/api/onboarding`))}async function ay(e){await L(await ry(e,`/dismiss`))}async function oy(e,t){return L(await ry(e,`/packs/${encodeURIComponent(t)}`))}async function sy(e,t){return L(await ry(e,`/short`,t))}async function cy(e,t){return L(await ry(e,`/full-video`,t))}async function ly(e){return L(await e.fetch(`${e.origin}/api/onboarding/sample`))}function uy(e,t){return e!==void 0&&Object.values(e.samples).includes(t)}async function dy(e){return L(await ry(e,`/sample/restore`))}async function fy(e,t=py()){return L(await ry(e,`/sample/copy`,t===void 0?void 0:{projectId:t}))}function py(){if(typeof window>`u`)return;let e=/\/projects\/([^/?#]+)/.exec(window.location.pathname);return e?.[1]===void 0?void 0:decodeURIComponent(e[1])}async function my(e,t){return L(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/narration/peaks`))}var V={projects:[`projects`],revisions:e=>[`project`,e,`revisions`],revision:(e,t)=>[`project`,e,`revision`,t],revisionFile:(e,t,n)=>[`revision-file`,e,t,n],project:e=>[`project`,e],runCost:e=>[`project`,e,`run-cost`],article:(e,t=null)=>[`project`,e,`article`,t],audioPreview:(e,t)=>[`audio-preview`,e,t],file:(e,t)=>[`file`,e,t],staging:[`staging`],notice:[`notice`],usage:[`usage`],providers:[`providers`],voices:[`voices`],prompts:[`prompts`],entries:[`entries`],documentThemes:[`document-themes`],narrationAliases:[`narration-aliases`],settings:[`settings`],youtubeEdits:e=>[`project`,e,`youtube-edits`],channelLinks:[`channel-links`],projectChannelLinks:e=>[`channel-links`,`project`,e]},hy=15e3,gy=new Set([`running`,`pending`]);function _y(e){return ot({queryKey:V.projects,queryFn:()=>jo(e),refetchInterval:e=>e.state.data?.projects.some(e=>gy.has(e.status))===!0&&hy,refetchIntervalInBackground:!1})}function vy(e,t){return ot({queryKey:V.project(t),queryFn:()=>Mo(e,t),refetchInterval:e=>e.state.data!==void 0&&gy.has(e.state.data.project.status)?hy:!1})}function yy(e,t){return ot({queryKey:V.runCost(t),queryFn:()=>No(e,t)})}function by(e){return ot({queryKey:V.notice,queryFn:()=>Ko(e)})}function Gne(e){return ot({queryKey:V.usage,queryFn:()=>Go(e)})}function xy(e){return ot({queryKey:V.providers,queryFn:()=>Yo(e)})}function Sy(e){return ot({queryKey:V.voices,queryFn:()=>As(e)})}function Cy(e){return ot({queryKey:V.prompts,queryFn:()=>Ls(e)})}function wy(e){return ot({queryKey:V.entries,queryFn:()=>Ys(e)})}function Ty(e){return ot({queryKey:V.documentThemes,queryFn:()=>Zs(e)})}function Ey(e){return ot({queryKey:V.narrationAliases,queryFn:()=>nc(e)})}function Dy(e){return ot({queryKey:V.settings,queryFn:()=>$o(e)})}var Kne={"library.prompt.kind":{title:`Prompt kind`,body:`What the prompt is for, which decides where Play offers it. Article writes the video's text, Image and Thumbnail describe pictures, Narration Preparation adds delivery cues, YouTube Description writes the description, Shorts picks the short clips, Review checks a finished stage, Script writes speaker turns for several voices.`,tutorial:{page:`Prompts`,anchor:`prompt-kinds`}},"library.prompt.name":{title:`Prompt name`,body:`What Play and Edit project list this prompt by. Up to 200 characters, and unique within its kind. Templates remember a prompt by name, so after a rename they use the copy saved with them until you pick it again.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.article":{title:`Article prompt`,body:`The instruction the text model gets to write the video's article, which becomes the narration. Each {{keyword}} becomes a field on Play. One call on the project's LLM, plus up to 3 more when the answer runs out of room; research notes go first when research ran. The answer's sources and pronunciation sections are never narrated.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.image":{title:`Image prompt`,body:`Sent as written to the image model, with the keywords filled in; no text model rewrites it. Play sets how many pictures each prompt makes (1 to 20, at most 60 a run), and each picture is one image call. Pictures show for 15 s each by default and repeat until the video ends.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.thumbnail":{title:`Thumbnail prompt`,body:`Sent to the image model to draw the thumbnail. With Thumbnail set to Prompt by LLM, the text model first turns it into a picture prompt using the title and article, one extra call. 1 thumbnail by default, or 3: the second a close-up, the third a wider shot, each one image call.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.narration":{title:`Narration Preparation prompt`,body:`Tells the text model how the narration should be delivered. It only adds cues, such as a short speaking direction or a laugh or sigh, and never rewrites the words. One call each for the body, the intro and the outro. Works only with the Inworld TTS-2 voice model. With several speakers, each speaker on TTS-2 gets cues suited to their role.`,tutorial:{page:`Play-Narration`,anchor:`narration-preparation`}},"library.prompt.body.description":{title:`YouTube Description prompt`,body:`Tells the text model how to write the video's YouTube description, chapters, hashtags and tags from the timestamped transcript. One call per video. Each {{keyword}} becomes a field on Play. A project that picks none uses the Built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.shorts":{title:`Shorts prompt`,body:`Tells the text model which moments of the video to cut into vertical shorts (3 of 60 to 120 s by default). One call picks them, then one call per short writes its picture prompts, and each picture is one image call. A project that picks none uses the Built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.review":{title:`Review prompt`,body:`Tells the reviewer what to check in a finished article, set of images, narration, thumbnail or shorts, and when to flag or redo it. One reviewer call per item checked; pictures can only be judged by the Claude Code and Codex reviewers. A stage with none picked uses its own built-in wording.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.body.script":{title:`Script prompt`,body:`Used in place of an Article prompt when a run has several voices and writes a script. The text model answers with # section headings and Name: words turns, one speaker per paragraph; text in [square brackets] is not spoken. One call on the project's LLM.`,tutorial:{page:`Prompts`,anchor:`write-a-new-prompt`}},"library.prompt.starter":{title:`Starter text`,body:`Fills the body with ready-made text to start from: the documentary delivery cues for Narration Preparation, or the Built-in wording YouTube Description and Shorts use when no prompt is picked. When the body already has text you confirm first. Nothing is saved until you choose Save.`,tutorial:{page:`Prompts`,anchor:`start-from-ready-made-text`}},"library.prompt.photorealistic":{title:`Draws photorealistic pictures`,body:`Turn on when this prompt's style looks like real photos or film. Prepare upload then answers Yes to YouTube's AI use question (a realistic-looking scene that didn't happen) for videos and shorts drawn with it. Leave off for painterly or illustrated styles. Applies at once, apart from Save; a channel's Always Yes or Always No wins. Default: off.`,tutorial:{page:`Prompts`,anchor:`mark-an-image-prompt-as-photorealistic`}},"library.slots":{title:`Detected slots`,body:`Every {{keyword}} in the body, listed as you type. Each becomes one field on Play, typed once and filled into every prompt that names it. Names are case-sensitive, so {{Topic}} and {{topic}} are two fields. A keyword the project title also names is typed per video and saved empty in templates.`,tutorial:{page:`Prompts`,anchor:`keywords-slots`}},"library.used-by":{title:`Used by`,body:`The templates, schedules and projects that name this item, matched by name within its kind. For a project it says how many of its revisions used it and whether the current one does. Projects keep their own text, so editing here changes only runs started later.`,tutorial:{page:`Prompts`,anchor:`used-by`}},"library.history":{title:`History`,body:`Every save that changes the name or text adds a version, and every version is kept. Here you see the latest change with the changed words marked. Compare versions opens them all side by side, with Restore for an older one.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.history.compare":{title:`Compare versions`,body:`Pick any two saved versions to see them side by side, with the words that changed marked. Older and Newer can be any versions; a rename between them is said above the text.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.history.versions":{title:`Versions`,body:`Every saved version, newest first. Restore saves an older version again as a new version, so nothing after it is lost and History notes where it came from. Projects already made keep their text.`,tutorial:{page:`Prompts`,anchor:`history-and-versions`}},"library.entry.category":{title:`Intro or outro`,body:`An intro is narrated before the body of the video, an outro after it, in the same voice. Play offers each in its own picker. A name only needs to be unique within its category.`,tutorial:{page:`Intros-and-Outros`,anchor:`text-or-llm`}},"library.inline-rename":{title:`Rename in the list`,body:`Changes only the name, right in the list; the text stays as it is. Enter saves, Escape keeps the old name, and Undo on the notice renames it back. A prompt or intro/outro keeps the rename in History; templates that picked the old name use the copy saved with them until you pick it again. A template saves a new version; schedules keep the version they were made from.`,tutorial:{page:`Library-Overview`,anchor:`rename-in-the-row`}},"library.entry.name":{title:`Entry name`,body:`What Play and Edit project list this intro or outro by. Up to 200 characters, and unique within its category.`,tutorial:{page:`Intros-and-Outros`,anchor:`write-an-intro-or-outro`}},"library.entry.mode":{title:`Mode`,body:`Text is narrated as written, with the keywords filled in and no extra call. LLM sends the body as an instruction to the project's text model, with the title, keyword values and article, and narrates the answer: one call per entry, and the run then needs an LLM. Default: Text.`,tutorial:{page:`Intros-and-Outros`,anchor:`text-or-llm`}},"library.entry.body":{title:`Entry body`,body:`In Text mode, the words the narrator says; in LLM mode, the instruction whose answer is said. Each {{keyword}} becomes a field on Play. It is narrated as its own audio file with the run's voice, one voice request each.`,tutorial:{page:`Intros-and-Outros`,anchor:`write-an-intro-or-outro`}},"library.aliases":{title:`Narration aliases`,body:`Words the narrator says differently from how they are written, such as Dr. as Doctor. Only what the voice and Narration Preparation receive changes; the article and captions keep the written words. A project copies this list when it starts and uses it while Use narration aliases is on. Up to 1000 aliases, saved as a whole.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`narration-aliases`}},"library.aliases.written":{title:`Written`,body:`The word or phrase as it appears in the article, up to 200 characters. Spaces inside it match any spacing. Two aliases can't share a written form; where two overlap, the one starting first wins, then the longer.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.spoken":{title:`Say it as`,body:`What the narrator says instead, spelled the way it sounds, up to 500 characters. Only the audio changes. An alias wins over a Pronunciation Glossary entry for the same words.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.whole-word":{title:`Whole word`,body:`On: matches only where the written form stands as a word of its own, so it never fires inside a longer word. Off: matches inside other words too. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"library.aliases.match-case":{title:`Match case`,body:`On: matches only with the same capital letters, so US is not us. Off: capitals are ignored. Default: off.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`rules`}},"templates.show-channel":{title:`Show templates of`,body:`Shows only the templates of one channel, or of all. A template's channel is the one a draft made from it runs in. Choosing here changes nothing about the templates.`,tutorial:{page:`Templates`,anchor:`filter-by-channel`}},"templates.apply":{title:`Use in Play`,body:`Makes a new Play draft from the template and opens it in Play for you to review; nothing starts. Keywords the project title names start empty for this video's topic, and uploaded files keep their names but must be attached again. The template itself is unchanged.`,tutorial:{page:`Templates`,anchor:`use-a-template`}},"templates.save":{title:`Save a setup`,body:`Keeps a saved Play draft as a reusable template: every setting and checkpoint choice, plus a copy of each picked prompt and intro or outro. Keywords the project title names, like {{Topic}}, are saved empty; other keywords keep their values. Queued extra videos and uploaded fonts are left out.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.save.draft":{title:`Saved Play draft`,body:`The Play draft whose setup the template keeps. Only drafts saved in Play are listed; open Play to prepare one first. The draft itself stays as it is.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.save.name":{title:`Template name`,body:`What the template is called in this list and wherever you pick a template, such as a schedule. Up to 120 characters.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"templates.edit":{title:`Edit a template`,body:`Shows the keywords the template fills and what each feeds. The pencil beside its name renames it; every save adds a version that History keeps. To change its settings, use it in Play, change the draft, then Save a setup.`,tutorial:{page:`Templates`,anchor:`see-a-templates-keywords`}},"templates.history":{title:`Template versions`,body:`Every saved version of the template, newest first. Pick one to compare its setup with the current one. Restore saves the older setup again as a new version, so nothing is lost. Drafts and projects made from it keep their setup.`,tutorial:{page:`Templates`,anchor:`history`}},"templates.save.channel":{title:`Template channel`,body:`The channel the template belongs to, and the one a draft made from it runs in. Default: the draft's own channel, or its template's channel when it has none.`,tutorial:{page:`Templates`,anchor:`save-a-template-from-library--templates`}},"library.themes.yours":{title:`Your themes`,body:`Themes you made or copied from a built-in. Pick one on the Document row in Play or in Edit project. A project keeps its own copy of the settings, so editing or deleting a theme here never changes a PDF already made or queued.`,tutorial:{page:`Document-Themes`,anchor:`built-in-and-your-own-themes`}},"library.themes.built-in":{title:`Built-in themes`,body:`Looks that ship with Slopify and can't be changed. Plain is an unbranded flat page and what a new project gets. Copy one to make a theme of your own you can edit.`,tutorial:{page:`Document-Themes`,anchor:`built-in-and-your-own-themes`}},"library.theme.name":{title:`Theme name`,body:`What the theme is called on the Document row in Play and in Edit project. Up to 80 characters.`,tutorial:{page:`Document-Themes`,anchor:`make-a-theme`}},"library.theme.preview":{title:`Preview`,body:`A sample article laid out with this theme by the same renderer that makes a project's PDF, redrawn about half a second after you stop typing. It runs on your computer and costs nothing. Your projects use their own text and thumbnail.`,tutorial:{page:`Document-Themes`,anchor:`make-a-theme`}},"library.theme.page.format":{title:`Paper size`,body:`The page size of the PDF. A4 (210 × 297 mm) is used in most of the world; US Letter (216 × 279 mm) in the US and Canada. Pick the one your readers print on. Default: A4.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.page.margin":{title:`Margins`,body:`Blank space kept on every edge of each page, in millimetres. Wider margins mean shorter lines and more pages. From 5 to 60 mm. Default: 22 mm.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.page.content-top":{title:`Text starts at`,body:`How far from the top of the page the text begins on pages that carry the running header, in millimetres. Raise it when text crowds the header. From 5 to 80 mm. Default: 32 mm.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.background.image":{title:`Background`,body:`Parchment texture stretches an aged-paper picture over every page. Flat colour fills each page with the Page colour, drawn slightly darker at the edges. Default: Flat colour.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.background.color":{title:`Page colour`,body:`The colour of every page when Background is Flat colour; ignored with the parchment texture. Type a hex code like #fdfaf3 or use the picker. Default: #fdfaf3, a warm off-white.`,tutorial:{page:`Document-Themes`,anchor:`page`}},"library.theme.colors.heading":{title:`Heading colour`,body:`The colour of headings, drop caps, the brand name and links. Type a hex code like #1f3a5f or use the picker. Default: #1f3a5f, a dark blue.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.text":{title:`Body text colour`,body:`The colour of paragraphs, lists and bold or italic text. Keep it dark against the page colour so it reads and prints well. Default: #1a1a1a, near black.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.muted":{title:`Muted colour`,body:`The colour of dates, bullets, quotes and the dotted lines on the contents page. Default: #555555, a mid grey.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.colors.faint":{title:`Faint colour`,body:`The colour of the running header and the page numbers, kept light so they stay out of the way. Default: #888888, a light grey.`,tutorial:{page:`Document-Themes`,anchor:`colours`}},"library.theme.fonts.body":{title:`Body font`,body:`The font of paragraphs and lists. The first box picks the family, the second its weight or italic, the number adds space between letters in millimetres (-0.5 to 2). Cinzel is bundled and has no italics; Times, Helvetica and Courier are built into every PDF reader. Default: Cinzel Regular, 0.01 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.strong":{title:`Bold text font`,body:`The font of bold words inside paragraphs. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Bold, 0.02 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.emphasis":{title:`Italic text font`,body:`The font of italic words inside paragraphs. Cinzel has no italics, so the default borrows Times. Family, style and letter spacing in millimetres, as for Body. Default: Times Italic, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.heading":{title:`Heading font`,body:`The font of the article's headings and of the contents, sources and closing page titles. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Bold, 0.02 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.dramatic":{title:`Chapter numbers and brand font`,body:`The font of the big number in a heading like "Chapter 3:" and of the brand name on the title page. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Black, 0.03 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.decorative":{title:`Tagline and link font`,body:`The font of the tagline and the linked line on the title page, and of the link and closing line on the closing page. Default: Cinzel Medium, 0.015 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.drop-cap":{title:`Drop cap font`,body:`The font of the large first letter that starts a paragraph after a heading, when drop caps are on. Family, style and letter spacing in millimetres, as for Body. Default: Cinzel Black, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.fonts.footer":{title:`Header and page number font`,body:`The font of the running header and the page numbers. Family, style and letter spacing in millimetres, as for Body. Default: Times Regular, 0 mm.`,tutorial:{page:`Document-Themes`,anchor:`fonts`}},"library.theme.sizes.title":{title:`Title size`,body:`The size of the article's title on the title page, in points (1 pt is about 0.35 mm). From 6 to 72 pt. Default: 22 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.brand":{title:`Brand size`,body:`The size of the brand name on the title page, in points. Shown only when Branding has a brand name. From 6 to 72 pt. Default: 31 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.section":{title:`Top-level heading size`,body:`The size of top-level headings and of the contents, sources and closing page titles, in points. From 6 to 72 pt. Default: 19 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.heading":{title:`Second-level heading size`,body:`The size of second-level headings, the ones inside a top-level section, in points. From 6 to 72 pt. Default: 17 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.subheading":{title:`Third-level heading size`,body:`The size of third-level and deeper headings, in points. From 6 to 72 pt. Default: 13 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.body":{title:`Body size`,body:`The size of paragraphs, lists and the closing page text, in points. Bigger text means more pages. From 6 to 24 pt. Default: 10.5 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.meta":{title:`Date and word count size`,body:`The size of the date, word count and link lines under the title on the title page, in points. From 5 to 24 pt. Default: 10 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.sizes.footer":{title:`Header and page number size`,body:`The size of the running header and the page numbers, in points. From 5 to 24 pt. Default: 9 pt.`,tutorial:{page:`Document-Themes`,anchor:`text-sizes`}},"library.theme.spacing.body-line":{title:`Body line height`,body:`The distance from one line of body text to the next, in millimetres. Raise it for airier pages, lower it to fit more on each page. From 3 to 20 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.heading-line":{title:`Heading line height`,body:`The distance between the lines of a top- or second-level heading that wraps, in millimetres. From 3 to 30 mm. Default: 11 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.subheading-line":{title:`Subheading line height`,body:`The distance between the lines of a third-level heading that wraps, in millimetres. From 3 to 30 mm. Default: 9 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.paragraph-gap":{title:`After a paragraph`,body:`Extra space after each paragraph, as a share of a body line: 0.5 is half a line. From 0 to 3. Default: 0.5.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.heading-gap":{title:`Before a heading`,body:`Extra space above each heading, as a share of a body line: 1 is one full line. From 0 to 5. Default: 1.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.item-gap":{title:`After a list item`,body:`Extra space after each bulleted or numbered item, as a share of a body line. From 0 to 3. Default: 0.2.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.list-indent":{title:`List indent`,body:`How far bulleted and numbered lists are pushed in from the left margin, in millimetres. From 0 to 30 mm. Default: 6 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.quote-indent":{title:`Quote indent`,body:`How far quotes are pushed in from the left margin, in millimetres. From 0 to 40 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.spacing.rule-width":{title:`Divider width`,body:`The width of the short centred line a --- in the article becomes, in millimetres. From 0 to 150 mm. Default: 30 mm.`,tutorial:{page:`Document-Themes`,anchor:`spacing`}},"library.theme.drop-cap.enabled":{title:`Drop caps`,body:`Starts the first paragraph after each heading with a large first letter that spans several lines, as in printed books. Turn it off for a plainer page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.lines":{title:`Drop cap lines tall`,body:`How many lines of body text the large first letter spans. Default: 3 lines.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.scale":{title:`Drop cap letter size`,body:`The size of the large first letter, as a multiple of the height of the lines it spans. From 1 to 5. Default: 3.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.gap":{title:`Gap beside the drop cap`,body:`The space between the large first letter and the text beside it, in millimetres. From 0 to 20 mm. Default: 4 mm.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.min-length":{title:`Shortest paragraph`,body:`A paragraph shorter than this many characters starts plainly, so a one-line paragraph never gets a huge letter. From 0 to 2000. Default: 50.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.drop-cap.min-room":{title:`Room needed`,body:`With less than this share of the page left, a paragraph that starts with a drop cap moves to the next page. 0.25 is a quarter of the page. From 0 to 1. Default: 0.25.`,tutorial:{page:`Document-Themes`,anchor:`drop-caps`}},"library.theme.title-page.brand-y":{title:`Brand from top`,body:`Where the brand name sits on the title page, measured from the top edge of the page in millimetres. From 10 to 200 mm. Default: 60 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.tagline-offset":{title:`Tagline below brand`,body:`The distance from the brand name down to the tagline, in millimetres. From 0 to 60 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.title-y":{title:`Title from top`,body:`Where the article's title sits on the title page, measured from the top edge of the page in millimetres. From 10 to 250 mm. Default: 80 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.title-line":{title:`Title line height`,body:`The distance between the lines of a title that wraps, in millimetres. From 3 to 40 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.meta-offset":{title:`Details below title`,body:`The distance from the title down to the date and word count, in millimetres, when there is no cover picture. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.meta-line":{title:`Details line height`,body:`The distance between the date, word count and link lines on the title page, in millimetres. From 3 to 30 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.show-date":{title:`Show the date`,body:`Prints "Written on" and the date the PDF was made under the title on the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.show-word-count":{title:`Show the word count`,body:`Prints the article's word count under the title on the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover":{title:`Thumbnail as cover`,body:`Puts the project's thumbnail on the title page, between the title and the date, when the project has one. Without a thumbnail the page is laid out as if this were off. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover-gap":{title:`Space around cover`,body:`The space above and below the cover picture on the title page, in millimetres. From 0 to 40 mm. Default: 6 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.title-page.cover-height":{title:`Cover height at most`,body:`The tallest the cover picture may be, in millimetres. It keeps its shape and shrinks further when the page has less room. From 20 to 200 mm. Default: 110 mm.`,tutorial:{page:`Document-Themes`,anchor:`title-page`}},"library.theme.brand.name":{title:`Brand name`,body:`Your channel or brand, printed large at the top of the title page and before the title in the running header ("Brand | Title"). Leave it empty to show no brand. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.tagline":{title:`Tagline`,body:`A short line under the brand name on the title page. Leave it empty to hide it. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.url":{title:`Website`,body:`The web address the brand name and the title-page link open when clicked in the PDF. Leave it empty for no link. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.brand.link-label":{title:`Link text`,body:`The words of a linked line under the word count on the title page; it opens Website. Leave it empty to hide the line. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`branding`}},"library.theme.contents.enabled":{title:`Contents page`,body:`Adds a table of contents after the title page, listing the article's headings with their page numbers. Each entry is a link to its page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.title":{title:`Contents page title`,body:`The heading at the top of the contents page. Up to 300 characters. Default: Table of Contents.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.depth":{title:`Lists headings down to`,body:`Which headings the contents page lists: only top-level ones, down to second-level, or down to third-level. Deeper lists take more room and can add a page. Default: Second level.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.title-offset":{title:`Contents title position`,body:`The distance from the top margin down to the contents page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.first-entry-offset":{title:`First entry position`,body:`The distance from the top margin down to the first entry of the contents, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.line":{title:`Contents line height`,body:`The distance from one contents entry to the next, in millimetres. From 3 to 30 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.contents.indent":{title:`Indent per level`,body:`How much further in each deeper heading level is listed on the contents page, in millimetres. From 0 to 30 mm. Default: 5 mm.`,tutorial:{page:`Document-Themes`,anchor:`contents-page`}},"library.theme.header.enabled":{title:`Running header`,body:`Prints the brand and the article title ("Brand | Title") at the top of every page after the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.header.top":{title:`Header from top`,body:`The distance from the top edge of the page to the running header, in millimetres. From 3 to 60 mm. Default: 15 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.header.max-title":{title:`Header title at most`,body:`A title longer than this many characters is cut short in the running header so it fits on one line. From 5 to 200. Default: 35.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.enabled":{title:`Page numbers`,body:`Prints a page number at the bottom of every page after the title page. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.text":{title:`Page number text`,body:`The words around the page number; {page} becomes the number, so "Page {page}" prints "Page 4". Default: Page {page}.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.bottom":{title:`Page number from the bottom`,body:`The distance from the bottom edge of the page to the page number, in millimetres. From 3 to 60 mm. Default: 10 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.footer.reserve":{title:`Space kept above page number`,body:`Space kept free above the page number, so body text always stops short of it, in millimetres. From 0 to 60 mm. Default: 15 mm.`,tutorial:{page:`Document-Themes`,anchor:`header-and-footer`}},"library.theme.sources.enabled":{title:`Sources page`,body:`Adds a page listing the web links the article and its research used, each one clickable. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.title":{title:`Sources page title`,body:`The heading at the top of the sources page. Up to 300 characters. Default: Sources Consulted.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.title-offset":{title:`Sources title position`,body:`The distance from the top margin down to the sources page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.body-offset":{title:`Sources list position`,body:`The distance from the top margin down to the first source, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.line":{title:`Sources line height`,body:`The distance between the lines of one source, in millimetres. From 3 to 30 mm. Default: 8 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.sources.gap":{title:`Gap between sources`,body:`Extra space between one source and the next, in millimetres. From 0 to 20 mm. Default: 2 mm.`,tutorial:{page:`Document-Themes`,anchor:`sources-page`}},"library.theme.end-page.enabled":{title:`Closing page`,body:`Adds a last page with your own text, such as an about section, a thank-you or a link to your site. Default: off.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.title":{title:`Closing page title`,body:`The heading at the top of the closing page. Up to 300 characters. Default: About.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.lines":{title:`Closing page text`,body:`The closing page text, one line per row, up to 60 lines of 300 characters. A line starting with "•" becomes a muted bullet, one ending with ":" a bold label, an empty line a gap. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.details":{title:`Add date, word and page counts`,body:`Adds a Document Details list under your text: the date written, the total words and the total pages. Default: on.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.link":{title:`Closing page link`,body:`Adds a clickable line after your text: the words to show and the web address it opens. Leave the address empty to show the words without a link. Default: off.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.closing":{title:`Closing line`,body:`A last line after the text and the link, such as a sign-off, in the decorative font. Leave it empty to leave it out. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.title-offset":{title:`Closing title position`,body:`The distance from the top margin down to the closing page title, in millimetres. From 0 to 100 mm. Default: 20 mm.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.end-page.body-offset":{title:`Closing text position`,body:`The distance from the top margin down to the first line of the closing text, in millimetres. From 0 to 150 mm. Default: 40 mm.`,tutorial:{page:`Document-Themes`,anchor:`closing-page`}},"library.theme.metadata.author":{title:`PDF author`,body:`The author a PDF reader shows in the document properties; it is not printed on the pages. {title} becomes the article title. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.subject":{title:`PDF subject`,body:`The subject a PDF reader shows in the document properties. {title} becomes the article title. Default: {title}.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.keywords":{title:`PDF keywords`,body:`Search words a PDF reader shows in the document properties, usually separated by commas. Up to 1000 characters. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}},"library.theme.metadata.creator":{title:`PDF creator`,body:`The app or person a PDF reader shows as the creator in the document properties. Default: empty.`,tutorial:{page:`Document-Themes`,anchor:`pdf-details`}}},qne={"planning.schedules":{title:`Schedules`,body:`A schedule starts a new project from a saved template at a local time, while Slopify is open on this machine. Each run makes a fresh project, so changing the template later never rewrites an old run. It uses the template version you picked and never includes uploaded media. Each run costs what that template's project costs.`,tutorial:{page:`Schedules`}},"planning.schedule.name":{title:`Schedule name`,body:`A name to tell this schedule apart in the list, on the calendar and on the channel page. It never appears in the videos. Up to 200 characters.`,tutorial:{page:`Schedules`,anchor:`create-a-schedule`}},"planning.schedule.template":{title:`Template`,body:`The saved template each run starts from, with its version. The schedule keeps this version when you save the template again; pick the template again here to use the newer one. The template decides the providers, and so what each run costs. Save templates from Play; they are listed in Library → Templates.`,tutorial:{page:`Schedules`,anchor:`create-a-schedule`}},"planning.schedule.cadence":{title:`Cadence`,body:`How often the schedule runs. Every day runs once a day at the local time. Selected weekdays runs on the days you tick. One time runs once at a date and time, then completes. Each run starts one project. Default: Every day at 09:00.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.time":{title:`Local time`,body:`The clock time each run starts, read in the timezone below. Default: 09:00. A run only starts while Slopify is open; Missed run decides what happens when it was closed.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.once-at":{title:`Run at`,body:`The date and time of the single run, read in the timezone below. After that run starts, the schedule shows as completed.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.weekdays":{title:`Weekdays`,body:`The days a Selected weekdays schedule runs, each at the local time. Tick at least one; each ticked day is one project a week. Default: Mon, Wed and Fri.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.timezone":{title:`Timezone`,body:`The IANA zone the run time is read in, such as Europe/Tirane or America/New_York. Default: this computer's zone. When clocks go back, a repeated time uses the earlier one; a time skipped when clocks go forward moves forward by the gap.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.timezone-once":{title:`Timezone`,body:`The IANA zone the one-off date and time are read in, such as Europe/Tirane or America/New_York. Default: this computer's zone. When clocks go back, a repeated time uses the earlier one; nonexistent spring-forward times are refused, so pick another.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.missed":{title:`Missed run`,body:`What happens to a run that came due while Slopify was closed or asleep. Skip drops it when it is more than 1 minute late and waits for the next time. Run once when Slopify reopens starts one catch-up run, however many were missed. Default: Skip.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.spend":{title:`Spend ceiling`,body:`The most one run may cost, in US dollars, such as 5 or 2.50. Before each run Slopify estimates the project's cost; when the high estimate is over this, or a cost can't be estimated, the run fails instead of starting. Leave it empty for no ceiling. Default: empty.`,tutorial:{page:`Schedules`,anchor:`when-it-runs`}},"planning.schedule.topics":{title:`Topics`,body:`Each run takes the first topic, starts one project with it and removes it from the list. The schedule completes when the list is empty, unless topic generation is on. With no topics and generation off, every run uses the template as saved. Up to 500 topics.`,tutorial:{page:`Schedules`,anchor:`topics`}},"planning.schedule.inline-topics":{title:`Queued topics`,body:`Change the queue right here: type a topic and press Enter to add it, edit one in its field and press Enter to rename it, use the arrows to move it and the cross to remove it. Each change saves at once and changes only the queue; Undo on the notice puts it back. For a topic's own keyword values, press Edit.`,tutorial:{page:`Schedules`,anchor:`edit-the-queued-topics-in-place`}},"planning.schedule.topic-format":{title:`How to write the topics`,body:`Three ways to write the same list; switching keeps everything. One per line fills only the topic keyword. Table adds a column for each keyword a topic sets itself, such as its word count. YAML / JSON holds the same as text, for pasting or keeping in a file.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-lines":{title:`Topics, one per line`,body:`Type or paste one topic per line; blank lines are skipped. Each topic fills the keyword under Each topic fills, and the first line is the next run. Every other keyword uses its every-run value.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-yaml":{title:`Topics as YAML or JSON`,body:`A list such as "- Cleopatra", or one map per topic such as "- Topic: Cleopatra" with a line for each keyword it sets, like "Min. Word Count: 12000". A JSON array works too. A keyword a topic leaves out uses its every-run value. The schedule saves only once the list reads.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-table":{title:`Topic table`,body:`One row per run, in order. The first column fills the topic keyword; each extra column sets that keyword for that topic's run only, and a blank cell uses the every-run value. Set a keyword per topic adds a column; the x in a column's header drops it. Project title shows the result.`,tutorial:{page:`Schedules`,anchor:`three-ways-to-write-the-list`}},"planning.schedule.topic-keyword":{title:`Each topic fills`,body:`The template keyword, such as {{Topic}}, that each queued topic replaces. Default: the keyword the template's project title uses, else the first one. When the title doesn't use it, every project gets the same title.`,tutorial:{page:`Schedules`,anchor:`which-keyword-a-topic-fills`}},"planning.schedule.every-run":{title:`Every-run value`,body:`The value this keyword gets on every run, such as a word count. Default: the template's own value. A topic that sets the keyword itself, in Table or YAML / JSON, overrides it for that one run.`,tutorial:{page:`Schedules`,anchor:`which-keyword-a-topic-fills`}},"planning.schedule.generation":{title:`Topic generation`,body:`When the queue holds fewer topics than you ask for, Slopify asks an LLM for more: one call for what is missing plus 5 spare, at most 50. It sends the series brief and every title this schedule, your projects and the channel's existing videos already have, and drops near duplicates.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.brief":{title:`Series brief`,body:`What the series covers, its style and what makes a topic worth a video. Only topic generation reads it. Leave it empty to use the channel's series brief from the channel's Brand tab. Up to 4,000 characters.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.new-topics":{title:`New topics`,body:`Off: you add every topic yourself. Generate and queue directly: new topics join the end of the list. Generate and hold for approval: they wait under Topics waiting, and beside the calendar, until you approve them. Each generation is one LLM call. Default: Off.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.keep-count":{title:`Keep at least this many queued`,body:`Slopify asks for new topics whenever the queue, plus the topics waiting for approval when holding, drops below this number. A higher number keeps more topics lined up ahead of the runs, for you to review. From 1 to 100. Default: 10.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.generation-llm":{title:`Topic generation LLM`,body:`The text model that suggests topics. Ticked, it uses the provider and model the template writes with. Untick to pick another, such as a cheaper model. Either way each generation is one call on that provider. Default: the template's LLM.`,tutorial:{page:`Schedules`,anchor:`topics-that-find-themselves`}},"planning.schedule.generate-now":{title:`Generate topics now`,body:`Asks the LLM for new topics right away, at least 5, even when the queue is full and even during the 5 minutes Slopify waits after a failed try. One LLM call. When holding for approval they wait for you; otherwise they join the queue.`,tutorial:{page:`Schedules`,anchor:`generate-topics-now`}},"planning.schedule.held-keywords":{title:`Keywords of a waiting topic`,body:`The template's other keywords, set for this one topic's run, the same as a column in the queue's table. Leave one empty to use the schedule's every-run value (shown greyed). They go with the topic into the queue when you approve it.`,tutorial:{page:`Schedules`,anchor:`approve-held-topics`}},"planning.schedule.held":{title:`Topics waiting`,body:`Topics the LLM suggested, waiting for you. Approve adds one to the end of the queue; Edit changes its words first; Reject drops it for good, so it is never suggested again. Approve all queues every one in order. Waiting topics count toward Keep at least.`,tutorial:{page:`Schedules`,anchor:`approve-held-topics`}},"planning.calendar.view":{title:`Calendar view`,body:`Weeks shows the coming 4 weeks as a grid: drag a topic to another day or onto another schedule's run, or focus it and press Alt+arrow keys. List shows the same runs day by day, with buttons to move each topic. This browser remembers your choice.`,tutorial:{page:`Calendar`,anchor:`switch-between-weeks-and-a-list`}},"planning.calendar.move":{title:`Moving topics`,body:`Earlier and later swap a topic with its neighbour in the same schedule's queue, so it takes the other's run. Move to puts it at the end of another schedule's queue, so it takes that schedule's next free run. No schedule runs outside its own times.`,tutorial:{page:`Calendar`,anchor:`move-a-topic-to-another-day`}},"planning.calendar.add-schedule":{title:`Schedule`,body:`The schedule the topics join. They go to the end of its queue, after the topics already there (the count beside each name), so they take its next free runs. Only active and paused schedules are listed.`,tutorial:{page:`Calendar`,anchor:`add-topics`}},"planning.calendar.add-topics":{title:`Topics, one per line`,body:`Each line becomes one topic, in order; blank lines are skipped. A topic fills the schedule's topic keyword, and every other keyword keeps its every-run value. To give topics their own values, edit the schedule's topics as a table under Schedules.`,tutorial:{page:`Calendar`,anchor:`add-topics`}},"planning.channels":{title:`Channels`,body:`A channel is one series: its brand kit, series brief, cast, templates and schedules. Every template belongs to one channel, and each run from it uses that channel's look and cast. The default channel holds everything made before channels and can't be deleted.`,tutorial:{page:`Channels`,anchor:`the-channels-page`}},"planning.channel.current":{title:`Current channel`,body:`Home, Projects and the calendar show only this channel's work. All channels shows everything. It only filters what you see; every project and schedule keeps its own channel. This browser remembers your choice, and every Slopify tab open in it follows the same pick.`,tutorial:{page:`Channels`,anchor:`show-one-channels-work`}},"planning.channel.name":{title:`Channel name`,body:`The name you see in the channel picker, on Play and on the calendar. It stays inside Slopify and doesn't have to match your YouTube channel. Up to 200 characters.`,tutorial:{page:`Channels`,anchor:`create-a-channel`}},"planning.channel.brief":{title:`Series brief`,body:`What the channel covers, its style and what makes a topic worth a video. Topic generation reads it for every schedule of this channel that has no brief of its own. It doesn't change how videos are written. Up to 10,000 characters.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.ai-disclosure":{title:`YouTube AI disclosure`,body:`Studio's AI use answer for this channel's videos and Shorts, given by Prepare upload and the Studio extension. Automatic says Yes only for YouTube's three cases: a voice marked as imitating a real person, real footage altered, or photorealistic AI pictures from a marked Image prompt. Saves as you pick. Default: Automatic.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`override-per-channel`}},"planning.channel.language":{title:`Language of new projects`,body:`The language this channel's new projects are written and narrated in when Play or the template picks none. It applies with the brand kit off too, since it is not styling. Pick voices that speak it. Not set means English. Projects already made keep their language.`,tutorial:{page:`Other-Languages`,anchor:`set-a-channels-language`}},"planning.channel.brand-kit":{title:`Brand kit`,body:`The look every template of this channel gets unless it sets its own: fonts, colours, end screen, intro, outro, PDF theme and ambient sound. It fills only what a template leaves at its default, and a blank field adds nothing. Turn it off for one video on Play or in Edit project.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-font":{title:`Caption font`,body:`The subtitle font for this channel's videos whose template leaves the font at Default. Not set leaves the template's font alone. Fonts you upload in the subtitle font picker on Play appear here.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-colour":{title:`Caption colour`,body:`The subtitle text colour, as # and six hex digits such as #FFFFFF, for videos whose template sets no colour of its own. Blank leaves the template's colour alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.caption-outline":{title:`Caption outline`,body:`The colour of the line around each subtitle letter, as # and six hex digits such as #000000, for videos whose template sets none. A dark outline keeps light captions readable on bright pictures. Blank leaves the template's outline alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.font":{title:`Title font`,body:`The font of chapter cards and the end screen for videos whose template sets no title style. Not set leaves the template's font alone. Fonts you upload in the subtitle font picker on Play appear here.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.title-colour":{title:`Title colour`,body:`The text colour of chapter cards and the end screen, as # and six hex digits such as #FFD700, for videos whose template sets no title style. Blank leaves the template's colour alone.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.end-screen":{title:`End screen text`,body:`A line shown over the last 5 seconds of every video of this channel whose template sets no end screen, such as Subscribe for more. Up to 200 characters. Blank shows no end screen text.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.intro":{title:`Intro`,body:`An entry from Library → Intros & outros, narrated before every video of this channel whose template has no intro. Not set adds none. It adds its own length to each video and costs one voice request, since it is narrated.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.outro":{title:`Outro`,body:`An entry from Library → Intros & outros, narrated after every video of this channel whose template has no outro. Not set adds none. It adds its own length to each video and costs one voice request, since it is narrated.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.brand.document-theme":{title:`PDF theme`,body:`The look of the PDF document for videos of this channel whose template picks no theme: a built-in theme or one you saved. Not set leaves the template's choice alone. A saved theme that was deleted is skipped.`,tutorial:{page:`Channels`,anchor:`brand`}},"planning.channel.template-move":{title:`Move a template`,body:`Moves a template, and every schedule that runs it, to another channel. Their next runs use that channel's brand kit, cast and series brief. Projects already made keep what they were made with.`,tutorial:{page:`Channels`,anchor:`templates`}},"planning.channel.episode-memory":{title:`Episode memory`,body:`When a video of this channel finishes, one short call to its text model writes a summary of up to 150 words. A new episode about the same cast or title words gets up to 5 related summaries in its writing prompt, so it agrees with them. Videos already made never change. Default: on for new channels.`,tutorial:{page:`Channels`,anchor:`episodes-episode-memory`}},"planning.channel.episode-summary":{title:`Episode summary`,body:`What the text model wrote this episode covered. Related new episodes read it before they are written. Edit it to correct a fact; your text is kept even if the video finishes again.`,tutorial:{page:`Channels`,anchor:`episodes-episode-memory`}},"planning.channel.videos-paste":{title:`Existing video titles`,body:`Titles of videos this channel made before Slopify, one per line. Topic generation and its duplicate checks skip them, as they skip the videos made here. Titles already listed are skipped, whatever their case.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-csv":{title:`Import a YouTube Studio CSV`,body:`In YouTube Studio open Analytics → Content → Advanced mode and export the table as a CSV. Slopify reads its titles on this machine and lists them with ticks first, so you keep only this channel's videos.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-filter":{title:`Keep only titles containing`,body:`Ticks only the titles containing this text, in any case, such as "Egypt" or "History at Bedtime"; empty ticks them all. Use it when one Studio export holds several series. Remembered for this channel's next import.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.channel.videos-ticks":{title:`Titles in the CSV`,body:`Only ticked titles are added when you press Add. Untick videos of other series in the same export, or type in Keep only titles containing to tick by text.`,tutorial:{page:`Channels`,anchor:`existing-videos`}},"planning.cast.kind":{title:`Kind`,body:`Character, creature, place or object. A generated reference picture of a character or creature is portrait (9:16), of a place or object landscape (16:9), and its starting prompt asks for the whole figure, place or object in view. It doesn't change how the member is matched.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.name":{title:`Name`,body:`The name matched against video titles and image briefs, as whole words, ignoring case. When it is found, this member's pictures go with that image as references. Add other spellings and plurals as aliases. Up to 200 characters.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.aliases":{title:`Aliases`,body:`Other names that count as this member, matched as whole words, ignoring case: Cleopatra is found in Cleopatra's palace but not in Cleopatraic. Add plurals and titles such as the Last Pharaoh. Up to 20.`,tutorial:{page:`Cast-Library`,anchor:`how-names-are-matched`}},"planning.cast.description":{title:`Description for the image model`,body:`What the member looks like, in a sentence. It goes to the image model with the member's reference pictures for every image that names it, and starts the prompt of a generated picture. Up to 2,000 characters.`,tutorial:{page:`Cast-Library`,anchor:`fields`}},"planning.cast.voice":{title:`Cast voice`,body:`How this member speaks in multi-voice runs: pick them under Speakers on Play and they read with this voice, model and pace in every episode. The list shows voices that speak the channel's language. Leave the provider empty for no voice. A run keeps the voice it started with.`,tutorial:{page:`Cast-Library`,anchor:`give-a-cast-member-a-voice`}},"planning.cast.host":{title:`Channel host`,body:`A recurring voice of this channel. When you pick Podcast or Interview on Play, the draft starts with the channel's hosts that have a voice as its hosts, so you don't add them every episode. You can still remove or add speakers on the draft. Projects already made are unchanged.`,tutorial:{page:`Cast-Library`,anchor:`make-a-member-one-of-the-channels-hosts`}},"planning.cast.pictures":{title:`Reference pictures`,body:`Up to 4 pictures per member, sent with every image whose brief, or the video's title, names it, so it looks the same each time. Upload a PNG or JPEG up to 10 MB, or generate one below. Videos already made keep the pictures they started with.`,tutorial:{page:`Cast-Library`,anchor:`add-reference-pictures`}},"planning.cast.generate":{title:`Make a reference picture`,body:`Pick an image provider and model, describe the picture, then press Generate a picture. Each press is one image call on that provider, billed at its price for one image. A plain background with the whole figure in view makes the best reference.`,tutorial:{page:`Cast-Library`,anchor:`generate-a-picture`}},"planning.cast.picture-prompt":{title:`Picture to make`,body:`The prompt for the generated reference picture. It starts from the name, the description and a request for a plain background; edit it as you like. Up to 4,000 characters.`,tutorial:{page:`Cast-Library`,anchor:`generate-a-picture`}},"planning.links.named":{title:`Named links`,body:`Write {{Name}} in a YouTube description, or ask for it in a Description prompt, and it becomes the link of that name when the description is shown, copied or downloaded, such as {{Patreon}} or {{Discord}}. Each channel keeps its own list on its Brand tab, so a project fills from its channel's links; its own {{Previous video}} wins over the channel's. A name with no link stays as typed. Save channel keeps the list.`,tutorial:{page:`YouTube-Description`,anchor:`links-in-the-description`}}},Jne={"play.output":{title:`What are you making?`,body:`Picks the stages the project uses. Video narrates images with captions. Article writes or takes text, with an optional PDF. Audiobook reads a text aloud. Podcast is a conversation between speakers. Images draws pictures from your prompts. Each choice turns on what it needs and folds the rest away; every stage can still be changed under its row.`,tutorial:{page:`Play-Overview`}},"play.template":{title:`Template`,body:`Starts this video from a saved setup: prompts, voice, images, style, outputs and reviews. Picking one opens a fresh draft made from it and carries the topic you typed. No template starts from the default setup. Save a setup you like with Save as template in the right rail.`,tutorial:{page:`Play-Overview`,anchor:`template`}},"play.title":{title:`Title`,body:`The project's name in Slopify, shown on the project and in Projects. For a YouTube video it is also the YouTube title unless the YouTube text writes its own, and YouTube takes at most 100 characters there, without < or >. Write a keyword in double braces, like {{Topic}}, and the title becomes a pattern: you type the topic per video, and Add topic queues more videos from the same setup. Up to 200 characters.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.title-pattern":{title:`Title pattern`,body:`The title with its keywords in double braces, like History: {{Topic}}. Each keyword in it is a topic you type at the top of Play, once per video, and templates save it empty. Change the pattern here; the topic values stay at the top.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.topic":{title:`Topic`,body:`What this video is about. The title names this keyword, so its value fills the title and every prompt that names it. Each video from this setup gets its own value, and a template leaves it empty. Up to 200 characters.`,tutorial:{page:`Play-Overview`,anchor:`title-title-pattern-and-topic`}},"play.keyword":{title:`Keyword`,body:`A value a picked prompt or the title asks for with {{name}}. You type it once and it fills every place that names it; the line under it lists where. Up to 200 characters. A keyword the title does not name is saved with a template.`,tutorial:{page:`Play-Overview`,anchor:`keywords`}},"play.more-videos":{title:`More videos from the same setup`,body:`Add topic queues another video with everything else the same: only its title and keywords differ. Press a chip to change that video's keywords. Start queues all of them, and they run one at a time. One Start queues at most 50 videos.`,tutorial:{page:`Play-Overview`,anchor:`more-videos-from-the-same-setup`}},"play.drafts":{title:`Drafts`,body:`Play saves every change to this draft on its own; nothing starts until you press the Play key. Drafts lists your saved setups to open again or delete. New draft starts an empty one and keeps this one in the list.`,tutorial:{page:`Play-Overview`,anchor:`drafts`}},"play.draft-conflict":{title:`Changed elsewhere`,body:`This draft was saved from another tab or window since you opened it. Reload saved draft shows that version and drops your unsaved change. Save as a new draft keeps your version as a separate draft and leaves the other one alone.`,tutorial:{page:`Play-Overview`,anchor:`when-a-draft-was-changed-elsewhere`}},"play.source.research":{title:`Research source`,body:`Generate has the text model plan chapters, research each one on the web and combine the notes before the article is written: one call to plan, one per chapter and one to combine. Provide uses notes you paste. Off, the default, writes from the prompt alone.`,tutorial:{page:`Play-Title-and-Article`,anchor:`research`}},"play.source.article":{title:`Article source`,body:`Write it for me has the text model write the article from the article prompt, one call. Use my text as written narrates text you paste, word for word, with no text-model cost. Adapt my text has the article prompt rewrite text you paste, one call. No text is for images only. The article is what the narration reads and the PDF lays out. Default: Write it for me.`,tutorial:{page:`Play-Title-and-Article`,anchor:`choose-where-the-article-comes-from`}},"play.source.audio":{title:`Narration source`,body:`Generate reads the article aloud with a text-to-speech voice, charged by the provider per character. Provide uses an audio file you upload, as it is. Off makes a silent video with no captions, YouTube description or shorts. Default: Generate.`,tutorial:{page:`Play-Narration`,anchor:`choose-where-the-narration-comes-from`}},"play.source.images":{title:`Images source`,body:`Generate draws images from the ticked image prompts, one image-model call each. Provide uses your own PNG, JPEG or WebP files in the order you pick them. Off turns off the video too. Default: Generate.`,tutorial:{page:`Play-Images`,anchor:`choose-where-the-images-come-from`}},"play.source.thumbnail":{title:`Thumbnail source`,body:`From prompt draws the thumbnail straight from the thumbnail prompt, one image call. Prompt by LLM first has the text model write the image prompt from yours, the title and the article, then draws it. Provide uses your own image. Default: Off.`,tutorial:{page:`Play-Outputs`,anchor:`thumbnail`}},"play.source.video":{title:`Video source`,body:`Generate renders the slideshow video on this computer from the images and narration; it costs no provider money, only time. Off leaves each finished stage to download on its own. It needs images, so it is Off while Images is Off. Default: Generate.`,tutorial:{page:`Play-Video-and-Style`,anchor:`choose-whether-to-render-a-video`}},"play.source.document":{title:`Document source`,body:`Generate lays out a PDF of the article and title on this computer, in the theme you pick. It needs no provider and costs nothing. Default: Off.`,tutorial:{page:`PDF-Documents`,anchor:`make-a-pdf`}},"play.article-prompt":{title:`Article prompt`,body:`The Library prompt the text model is sent to write the article, with its keywords filled in. A Script prompt, used when several speakers read, asks for speaker turns instead. Write or change prompts on Prompts; View prompt shows the text.`,tutorial:{page:`Play-Title-and-Article`,anchor:`generate-an-article-from-a-prompt`}},"play.provided.article":{title:`Article text`,body:`The article you paste is narrated word for word, and no text model writes one. Include everything that should be read, headings too. The count under it helps you judge the length: about 150 words is one minute of narration.`,tutorial:{page:`Play-Title-and-Article`,anchor:`paste-your-own-article`}},"play.provided.research":{title:`Research notes`,body:`Notes you paste are given to the text model with the article prompt, in place of web research. Paste facts, sources and quotes the article should draw on. Nothing is looked up.`,tutorial:{page:`Play-Title-and-Article`,anchor:`give-your-own-research-notes`}},"play.text-generation":{title:`Text generation`,body:`One text model writes everything this run needs in words: the article, research, the thumbnail's image prompt, entries set to LLM, Narration Preparation, the YouTube description and picking shorts. Each is a separate call, counted in usage. Set the default under Settings.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.provider":{title:`LLM`,body:`Who runs the text model: a command-line tool you are signed in to, such as Claude Code or Codex, or a keyed service such as OpenRouter, billed per token. A greyed provider says why it cannot be used; fix it under Settings.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.model":{title:`Text model`,body:`The model the provider runs for every text step. Bigger models write better and cost more per token. Refresh asks the provider for its current list; Custom ID lets you type a model the list does not show.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.llm.thinking":{title:`Thinking`,body:`How long the model reasons before it answers, for models that offer it. Higher levels can write more carefully but take longer and use more tokens. Model default leaves it to the provider.`,tutorial:{page:`Play-Title-and-Article`,anchor:`text-generation`}},"play.tts.provider":{title:`TTS`,body:`The text-to-speech service that reads the narration, charged by the provider per character of text. A greyed provider says why it cannot be used; add its key under Settings. Changing it clears the model and voice.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.tts.model":{title:`TTS model`,body:`The provider's speech model. Models differ in quality, languages, speed and price per character. Some features need a particular model: Narration Preparation needs Inworld TTS-2. Refresh asks the provider for its current list.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.voice":{title:`Voice`,body:`Who reads the narration. The list holds the voices you added under Settings → Voices for this provider, filtered to the project's language. With several speakers, this voice reads the intro and outro.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.show-all-voices":{title:`Show all voices`,body:`The voice list hides voices listed for other languages than the project's. Tick this to pick one anyway, for example a multilingual voice whose languages are listed wrong. A voice with unknown languages is always shown.`,tutorial:{page:`Play-Narration`,anchor:`pick-a-voice`}},"play.intro":{title:`Intro`,body:`A Library entry read before the article. A text entry is read as written; an LLM entry is written by the text model for each video, one extra call. Off reads no intro. Write entries in Library → Intros & outros.`,tutorial:{page:`Play-Narration`,anchor:`intro-and-outro`}},"play.outro":{title:`Outro`,body:`A Library entry read after the article, such as a sign-off. A text entry is read as written; an LLM entry is written by the text model for each video, one extra call. Off reads no outro.`,tutorial:{page:`Play-Narration`,anchor:`intro-and-outro`}},"play.chunking":{title:`Chunking`,body:`How the narration is split into text-to-speech requests. Whole sends it in one request; Paragraph sends one per paragraph; Every N words or characters ends each at a sentence end. Split when a provider refuses long text. Default: Whole. It changes the number of requests, not the characters charged.`,tutorial:{page:`Play-Narration`,anchor:`chunking`}},"play.chunking.count":{title:`Chunk size`,body:`How long each text-to-speech request may be. Each request ends at the last whole sentence that fits, so a single longer sentence stays whole. Defaults: 500 words or 3000 characters, spaces included.`,tutorial:{page:`Play-Narration`,anchor:`chunking`}},"play.narration-preparation":{title:`Narration Preparation`,body:`Has the text model add delivery directions and sounds, such as a sigh or a laugh, following the Library narration prompt you pick. One text-model call per narration chunk and per entry. Needs Inworld TTS-2. The article and captions stay unchanged. Default: Off.`,tutorial:{page:`Play-Narration`,anchor:`narration-preparation`}},"play.pronunciation-glossary":{title:`Pronunciation Glossary`,body:`Reads names with the IPA in the article's Pronunciation Glossary, such as Arda: /ˈɑɹdə/, with no extra text-model call. In your article prompt, ask for a glossary in slash-delimited standard-English IPA (Term: /IPA/), with an English approximation for foreign names; a line with sounds English lacks is read as plain text. Works with Inworld TTS-2 and TTS-2 Flash. The written text stays unchanged. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"play.share-glossary":{title:`Pronunciations from other projects`,body:`Adds every term from your other projects' glossaries, copied when this project starts. This project's own glossary wins where they differ. Turn it off to use only this article's glossary. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"play.describe-figures":{title:`Describe tables and figures`,body:`Instead of skipping tables, pictures, equations and code or reading them cell by cell, the text model writes a short spoken passage for each (a table's pattern, what a figure or equation means, what code does) and the narration says it in its place. One extra text-model call per block, in the estimate, kept for reuse. The article and PDF keep the real table; captions show what is said. Needs a text model. Default: on.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"play.show-figures":{title:`Show tables and figures on screen`,body:`Each table, figure, equation and code block the narration describes is also shown in the video while it is described: the article's own picture for a figure, a card drawn in your brand kit's title font and colour for the rest. The images take turns around them, and Shorts that include one show it upright. Drawn on this computer at no cost. Needs Describe tables and figures. Default: on.`,tutorial:{page:`Play-Outputs`,anchor:`show-tables-and-figures-on-screen`}},"play.skip-code":{title:`Leave code out`,body:`Drops code blocks from the narration instead of summarising each in a sentence or two. Tables, figures and equations are still described. Default: off.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"play.narration-aliases":{title:`Narration aliases`,body:`Says the words listed in Library → Narration aliases the way they are written there, such as Dr. as Doctor, with any generated voice. They are copied when the project starts. The article and captions keep the written words. Default: on.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`use-aliases-in-a-video`}},"play.speakers.format":{title:`Speakers format`,body:`Narration uses one voice. Audiobook, Podcast, Radio drama and Interview give lines to several speakers, each with a voice. Several speakers need the text model to write or split the script. A new Podcast or Interview starts with the channel's hosts (cast members marked as hosts, with a voice).`,tutorial:{page:`Multiple-Voices`,anchor:`formats`}},"play.speakers.script":{title:`Script`,body:`Write a script has the text model write speaker turns from a Script prompt, one Name: words paragraph each. Split the article (audiobooks) keeps the article as written and has the text model hand its narration and dialogue to the speakers, one extra call. Adapt the article (podcasts, interviews, dramas) also keeps the article as written; one extra call rewrites it as a conversation for the speakers, kept beside it as the script.`,tutorial:{page:`Multiple-Voices`,anchor:`the-script`}},"play.speakers.add-from-cast":{title:`Add from the cast`,body:`Adds a member of this channel's cast as a speaker, with their name and voice. Only members with a voice are listed. Edit the cast on the channel's page.`,tutorial:{page:`Multiple-Voices`,anchor:`speakers-from-a-channels-cast`}},"play.speakers.book":{title:`A chapter of a book`,body:`Makes this audiobook one chapter of a book. The MP3 and M4B are tagged with the book as their album and the chapter as their track, so a player keeps the chapters together and in order. When the chapter is done, Make the next chapter on its project page starts the next one with the same speakers and settings.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.book-title":{title:`Book title`,body:`The book this chapter belongs to, the same for every chapter. It becomes the album of the MP3 and M4B files.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.book-chapter":{title:`Chapter`,body:`This chapter's number in the book, from 1 to 9999. It becomes the track number of the MP3 and M4B files.`,tutorial:{page:`Multiple-Voices`,anchor:`audiobooks-in-chapters`}},"play.speakers.turn-gap":{title:`Gap between turns`,body:`The pause between one speaker's turn and the next, from 0 to 1.2 seconds. Longer feels calmer; shorter feels like a lively talk. Default: 0.35 s.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.name-tags":{title:`Speaker names on captions`,body:`Puts the speaker's name before their captions, like Ada: and their words, so viewers know who is talking. On by default for a podcast or interview.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.native-dialogue":{title:`One request for consecutive turns`,body:`Sends back-to-back turns as one multi-speaker request where the provider has one (ElevenLabs v3 with up to 10 voices, Gemini TTS with 2), so the voices react to each other. Fewer requests, same characters charged. Other providers read each turn on its own.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speakers.audio-files":{title:`MP3 and M4B files`,body:`Also saves the narration as an MP3 and an M4B audiobook file with a chapter marker at each chapter, beside the video. Made on this computer at no provider cost.`,tutorial:{page:`Multiple-Voices`,anchor:`run-wide-options`}},"play.speaker.name":{title:`Speaker name`,body:`The name the script uses for this speaker's turns (Name: words) and the one captions and the speaker panel show. Up to 40 characters.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.role":{title:`Role`,body:`What this speaker does in the format: narrator, host, guest or character. The text model is told each speaker's role when it writes or splits the script.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.provider":{title:`Voice provider`,body:`The text-to-speech service for this speaker, charged per character of their lines. Speakers may use different providers. Changing it clears the model and voice.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.model":{title:`Voice model`,body:`The provider's speech model for this speaker. Models differ in quality, languages and price per character. Pronunciations need an Inworld TTS-2 model.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.voice":{title:`Speaker voice`,body:`This speaker's voice, from the voices you added under Settings → Voices for their provider, filtered to the project's language. Press Audition to hear it read their first line.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.pace":{title:`Pace`,body:`How fast this speaker talks, from 0.8× to 1.2× of the voice's own speed. Default: Normal.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.pronunciations":{title:`Speaker pronunciations`,body:`One Term: /IPA/ per line, like the article's Pronunciation Glossary, for this speaker only. Used on Inworld TTS-2 voices, ahead of the glossary. A line with sounds the language does not use is skipped and read as ordinary text.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.speaker.audition":{title:`Audition`,body:`Speaks this speaker's first line in their voice so you can hear it before the run. It is one real text-to-speech request, charged by the provider at about the price shown on the button.`,tutorial:{page:`Multiple-Voices`,anchor:`speaker-options`}},"play.images.provider":{title:`Image provider`,body:`Who draws the images, the thumbnail and the shorts' pictures: a keyed service such as fal.ai, billed per image, or a command-line tool you are signed in to. A greyed provider says why it cannot be used; fix it under Settings.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-provider-and-model`}},"play.images.model":{title:`Image model`,body:`The provider's image model. Models differ in quality, speed and price per image; the estimate in the right rail shows what this run costs. Refresh asks the provider for its current list.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-provider-and-model`}},"play.images.effort":{title:`Effort`,body:`How long an image agent, such as the Codex CLI, reasons before it draws. Higher effort can follow the prompt more closely but takes longer and uses more tokens. Model default leaves it to the provider.`,tutorial:{page:`Play-Images`,anchor:`drawing-with-the-codex-cli`}},"play.image-prompts":{title:`Image prompts`,body:`Tick the Library prompts that draw the video's images, and give each a number: how many images it makes, 1 to 20. A run makes at most 60 this way. Each image is one image-model call. The images play in the order you ticked the prompts.`,tutorial:{page:`Play-Images`,anchor:`pick-the-image-prompts`}},"play.reference":{title:`Establishing image`,body:`Made first and never shown in the video. Every other image, the shorts' and, if ticked, the thumbnail is drawn with it as a reference, so characters, style and palette stay the same. From a prompt costs one more image; Upload uses yours. Changing it marks those images outdated. Default: Off.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.reference.prompt":{title:`Establishing prompt`,body:`The Library image prompt that draws the establishing image, its keywords filled like the others. Describe the characters, setting and style every other image should share.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.reference.thumbnail":{title:`Thumbnail from the establishing image`,body:`Draws the thumbnail with the establishing image as a reference too, so it matches the video. Untick it for a thumbnail drawn on its own. Default: on.`,tutorial:{page:`Play-Images`,anchor:`establishing-image`}},"play.image-scale":{title:`More images for long videos`,body:`Adds images as the narration gets longer, planned from the expected length when the run starts. The extra images are shared among the ticked prompts in order, up to 240 in all; each is one more image call. The line under it shows the count. Turning it on switches Motion from Zoom to Mix of both.`,tutorial:{page:`Play-Images`,anchor:`more-images-for-long-videos`}},"play.batch-queue":{title:`Queue`,body:`With more than one video on the page: on, they run one after another, each starting when the one before finishes (Calendar → Batch queue shows the order); off, they all start at once. At once finishes sooner when the steps wait on providers, but the video renders share your computer's processor and plan limits are reached sooner. Default: on.`,tutorial:{page:`Play-Overview`,anchor:`queue-or-all-at-once`}},"play.image-scenes":{title:`Scenes from the article`,body:`Gives every image its own moment. The project's AI model reads the article once and writes a scene per image, from the opening to the ending in slideshow order. The scene goes where a prompt has {{Scene}}, or after its first paragraph. A thumbnail prompt with {{Scene}} gets a scene too: the article's most striking moment, a different one per thumbnail. Off, a {{Scene}} line is left out. One more AI call per run.`,tutorial:{page:`Play-Images`,anchor:`scenes-from-the-article`}},"play.image-scale.rate":{title:`Image rate`,body:`Give the rate as one image every N minutes of narration (0.25 to 60) or as N images per hour (1 to 240); switching keeps the same rate. Narration runs about 150 words a minute. Starts at one image every 2 minutes.`,tutorial:{page:`Play-Images`,anchor:`more-images-for-long-videos`}},"play.image-seconds":{title:`Seconds per image`,body:`How long each image stays on screen, 1 to 600 seconds. When cuts follow the narration, it is the target and a cut waits for a sentence end. When images run out they start again. Default: 15.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.zoom":{title:`Zoom`,body:`How far each image zooms in or out over its time on screen, 0 to 50 percent. 0 keeps images still. Default: 22.5 percent.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.motion":{title:`Motion`,body:`How each image moves while on screen: Zoom in and out, Pan across, a Mix of both by turns, or Still. A mix keeps a long video watchable. Default: Zoom in and out.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.edge-silence":{title:`Silence at start and end`,body:`Quiet time before the narration starts and after it ends, 0 to 30 seconds. Default: 2.`,tutorial:{page:`Play-Video-and-Style`,anchor:`timing-and-motion`}},"play.silence-gap":{title:`Silence between segments`,body:`Seconds of quiet between the intro and the narration, and between the narration and the outro, 0 to 30. It only matters when an intro or outro is set. Leave it empty to use the gap set in Settings, 3 seconds unless you changed it.`,tutorial:{page:`Play-Narration`,anchor:`silence-at-the-edges-and-between-segments`}},"play.format":{title:`Frame format`,body:`16:9 is a landscape video for YouTube and screens. 9:16 is a portrait video for phones. 1:1 is square, for posts and feeds. Images are drawn in this shape and captions are placed for it; shorts stay 9:16 and the thumbnail stays 16:9 for YouTube. Default: 16:9.`,tutorial:{page:`Play-Video-and-Style`,anchor:`frame-format`}},"play.preview-text":{title:`Preview text`,body:`The sample sentence the style preview shows in your caption font, size and position. It is only for the preview and never reaches the video; real captions come from the narration.`,tutorial:{page:`Play-Video-and-Style`,anchor:`style-preview`}},"play.thumbnail-prompt":{title:`Thumbnail prompt`,body:`The Library thumbnail prompt, keywords filled in. From prompt sends it to the image model as it is; Prompt by LLM gives it to the text model with the title and article to write the image prompt. Write prompts on Prompts.`,tutorial:{page:`Play-Outputs`,anchor:`thumbnail`}},"play.thumbnail-count":{title:`Thumbnails`,body:`Three makes two more thumbnails from the same prompt with different compositions, for YouTube's Test & compare. Each costs one more image, so 3 thumbnails are 3 image calls. You can remake each on its own on the project page. Default: 1.`,tutorial:{page:`Play-Outputs`,anchor:`make-three-thumbnails-for-test--compare`}},"play.youtube-description":{title:`YouTube description`,body:`After subtitle timing, the text model writes a description with chapters at the narration's real times, hashtags at the end, and a separate list of tags, ready to copy. One text-model call. It runs beside the render. Needs narration. Default: off.`,tutorial:{page:`YouTube-Description`,anchor:`turn-it-on`}},"play.description-prompt":{title:`Description prompt`,body:`The Library prompt the description is written from. Built-in asks for a short summary, 5 to 12 chapters, 3 to 5 hashtags and 15 to 25 tags. Write your own description prompt on Prompts to change the tone or add links.`,tutorial:{page:`YouTube-Description`,anchor:`turn-it-on`}},"play.shorts":{title:`Shorts`,body:`After subtitle timing, the text model picks the best self-contained moments of the narration. Each becomes a vertical 1080×1920 clip with new images, big word-by-word captions and its own title, description and hashtags. It runs beside the render; its images are charged like any other. Needs narration. Default: off.`,tutorial:{page:`Shorts`,anchor:`turn-on-shorts`}},"play.shorts.count":{title:`How many shorts`,body:`How many shorts to cut from this video, 1 to 10. Each needs its own new images, so more shorts cost more image calls and render time. Default: 3.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.length":{title:`Short length`,body:`The shortest and longest a short may run, in seconds, between 15 and 180. The text model picks moments within these bounds. Default: 60 to 120.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.prompt":{title:`Shorts prompt`,body:`The Library prompt the text model follows to pick the moments and write each short's title, description and hashtags. Built-in picks moments that make sense alone and open on a hook.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.image-style":{title:`Image style`,body:`The Library image prompt the shorts' new vertical images are drawn from. Built-in draws cinematic, uncluttered images with the subject centred. Pick one of your image prompts to match the long video.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.title-on-screen":{title:`Title on screen`,body:`Keeps the short's title at the top for the whole clip, large and bold in the caption font, below where the apps draw their own buttons. Default: on.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.preview":{title:`Shorts preview`,body:`A few seconds of the sample project's narration and images as a short: vertical, through the same renderer your shorts use, with the big word-by-word captions in your caption font, the title on screen when it is on, and the speed you chose. It renders again by itself a moment after you change a setting, costs no API calls, and Render again forces a fresh one.`,tutorial:{page:`Shorts`,anchor:`shorts-preview`}},"play.shorts.speed":{title:`Speed`,body:`Plays each short faster than the narration, 1.00× to 1.25× in steps of 0.05, with the pitch kept. A little faster suits short-form viewers. Default: 1.00×.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.shorts.music-volume":{title:`Music volume`,body:`How loud the background music plays under every short, 0 to 100 percent; it dips while the narrator speaks. Only used when you add a music file below. Default: 15.`,tutorial:{page:`Shorts`,anchor:`add-background-music`}},"play.shorts.full-video-link":{title:`Full video link`,body:`Each short's description ends with a line pointing to the full video. Paste the video's link here; without it the line says [PASTE THE FULL VIDEO LINK HERE] for you to fill in.`,tutorial:{page:`Shorts`,anchor:`options`}},"play.document-theme":{title:`Theme`,body:`How the PDF looks: a built-in theme or one of yours from Library → PDF themes. A theme of yours is copied into the project, so editing it later leaves this project alone until you pick it again. Edit themes opens the list.`,tutorial:{page:`PDF-Documents`,anchor:`options`}},"play.checkpoints":{title:`Review checkpoints`,body:`Holds the run before a step so you can check and edit what came before it. Steps that do not depend on it carry on. Approve each checkpoint on the project page to continue. A step must be generated to have a checkpoint.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`add-a-checkpoint-on-play`}},"play.reviews":{title:`Automatic reviews`,body:`A reviewer model checks each finished item and saves its verdict and reasons on the project page. Flag only marks a failed item; Flag and redo makes it again, up to the redos per item, then keeps and flags it. Each review is a text-model call, counted in usage. Default: Off.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.provider":{title:`Reviewer`,body:`Who runs the review model. Picture reviews, for images, the thumbnail and shorts, need Claude Code or Codex, which can look at images; other providers review text only.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.model":{title:`Reviewer model`,body:`The model that judges each item. A stronger model catches more but costs more per review. It can differ from the model that wrote the text.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.reviews.retries":{title:`Redos per item`,body:`How many times Flag and redo makes a failed item again before it keeps the last one and flags it, 0 to 5. Each redo costs the item again plus one more review. Default: 2.`,tutorial:{page:`Reviews-and-Checkpoints`,anchor:`set-up-automatic-reviews`}},"play.channel":{title:`Channel`,body:`The channel this video belongs to. Its brand kit fills what this setup leaves at its default, and its cast of characters goes with the images. A draft that picks none runs in its template's channel, or the default one.`,tutorial:{page:`Play-Overview`,anchor:`channel-row`}},"play.brand-kit":{title:`Channel's brand kit`,body:`Fills what this setup leaves at its default from the channel: the caption font, intro, outro, PDF theme and ambient sound. What you set here wins. Turn it off to take none of it; the cast and language still apply. Default: on.`,tutorial:{page:`Play-Overview`,anchor:`channel-row`}},"play.language":{title:`Language`,body:`The language the article, narration, YouTube description and shorts titles are written in. Pick a voice that speaks it. Outside English, captions are timed with a free 248 MB model, downloaded once, where one exists. On Play, blank uses the channel's language.`,tutorial:{page:`Other-Languages`,anchor:`pick-a-language-for-one-video`}},"play.estimate":{title:`Estimated cost`,body:`What the providers are likely to charge for this run, in US dollars, from their published prices. Actual usage can differ, and the estimate does not cap spending.`,tutorial:{page:`Play-Overview`,anchor:`estimated-cost`}},"play.expected-words":{title:`Expected article words`,body:`How long you expect each generated article to be. It drives the cost estimate and how many images More images for long videos adds; the article's real length is used once it is written. About 150 words is one minute. Default: 1500.`,tutorial:{page:`Play-Overview`,anchor:`expected-article-words-per-video`}},"play.refresh-review":{title:`Refresh review`,body:`Asks the server to check the setup again and recalculate the estimate now, instead of waiting for you to pause typing. Use it after changing a prompt in the Library.`,tutorial:{page:`Play-Overview`,anchor:`review-the-whole-setup`}},"play.template-name":{title:`Template name`,body:`The name the template is listed under on Play and Templates. The template keeps this setup's settings; the topic you typed and any extra videos are left out, as the list below says.`,tutorial:{page:`Play-Overview`,anchor:`save-as-template`}},"play.queue":{title:`Video queue`,body:`Videos started together run one at a time, in this order. Pausing a project holds the queue; when one fails or is canceled, the next one starts.`,tutorial:{page:`Play-Overview`,anchor:`the-video-queue`}},"play.voices.name":{title:`Voice name`,body:`The name you pick this voice by on Play and in Edit project. Only you see it.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.provider":{title:`Voice provider`,body:`The text-to-speech service the voice ID belongs to. Only providers set up under Settings are listed.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.voice-id":{title:`Voice ID`,body:`The provider's own id for the voice, copied from its voice library. It is not checked now; a wrong id fails when a run's narration uses it. For Google Gemini, pick one of its 30 prebuilt voices instead.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.languages":{title:`Voice languages`,body:`The languages the voice speaks, as codes such as es, de. Play lists the voice only for projects in these languages. Blank asks the provider when it can say; a voice with unknown languages is offered for every language.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}},"play.voices.real-person":{title:`Real person`,body:`Turn this on for a voice cloned from, or made to sound like, a real person. Prepare upload then answers Yes to YouTube's AI use question for videos it narrates. An AI voice that imitates no one stays off.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-voice`}}},Yne={"project.next-chapter":{title:`Make the next chapter`,body:`Opens a new draft on Play for this book's next chapter: the same speakers and voices, channel and cast, prompts and settings, with the chapter number one higher. Write or paste the new chapter's text there, then start it. The MP3 and M4B carry the book as their album and the chapter as their track. An audiobook that is not a book yet becomes one, named after it, starting at chapter 2.`,tutorial:{page:`Multiple-Voices`,anchor:`make-the-next-chapter`}},"project.video.cuts":{title:`Cuts`,body:`Every N seconds holds each image for Seconds per image. Follow the narration cuts in the pause after a sentence, as close to that length as the sentences allow (never under 40% of it), and starts a new image at every chapter. It needs word timing, so it works in English and the languages that have it. New projects default to Follow the narration.`,tutorial:{page:`Video-Editing`,anchor:`cuts`}},"project.video.transition":{title:`Transition`,body:`How one image hands over to the next: Cut, Crossfade, Fade through black, Slide or Wipe. The change is centred on the cut and takes the length you pick (0.2 to 2 s), so the video stays exactly as long as its narration. Default: Cut, 0.6 s.`,tutorial:{page:`Video-Editing`,anchor:`cuts`}},"project.video.grade":{title:`Colour grade`,body:`A colour treatment over the whole video: Warm fantasy, Cold, Desaturated or Sepia. It is applied while the video renders, so it costs no API calls, only render time. Default: None.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.vignette":{title:`Vignette`,body:`Darkens the corners of the picture to draw the eye to the middle. Subtle or Strong. Applied while the video renders, with no API cost. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.grain":{title:`Film grain`,body:`Adds moving film grain over the whole picture for an older, filmic feel. Subtle or Strong. Applied while the video renders, with no API cost. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.atmosphere":{title:`Atmosphere`,body:`An overlay Slopify draws itself: rising embers, drifting dust, or low fog along the bottom of the frame. No footage is downloaded and no API is called; it only adds render time. Default: None.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.chapter-cards":{title:`Chapter cards`,body:`Shows each chapter's title in the middle of the picture for 2.5 seconds as the chapter starts, in the caption font. Chapters come from the YouTube description when that step runs, otherwise from the article's headings. Needs narration. Default: off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.video.animate":{title:`Animate images`,body:`Turns some images into 5-second moving clips with an image-to-video model on your image provider (fal.ai or Replicate). Chapter openers animates the first image of each chapter; Every Nth image animates every 2nd to 10th. Each clip is one paid call, shown in the estimate. An image that cannot be animated stays still. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`the-look`}},"project.pause.sentence":{title:`Pause between sentences`,body:`The least quiet after each sentence, in seconds. Some voices barely breathe between sentences; this adds silence where the pause is shorter, never shortening one or cutting a word, and the captions follow. About 0.25 s is brisk, 0.35 to 0.45 natural or documentary, 0.5 to 0.8 an audiobook's relaxed pace, 0.8 and up sleep content. Default: 0.4; 0 keeps the voice's own.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.pause.paragraph":{title:`Pause between paragraphs`,body:`The least quiet at the end of a paragraph, in seconds, when you want more than between sentences. Usually the narration prompt and the voice pace paragraphs well already, so it is 0 by default: paragraphs get the sentence pause. Try 0.8 to 1.2 for a slower read. A speaker's turn gap is set under Speakers instead. Runs on this computer.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness":{title:`Level the volume`,body:`Brings every narration piece (each chunk, and each speaker's turn) to one loudness before they are joined, so the voice stops jumping between quiet and loud. Then the video, the shorts and the audio files are each set to a finished loudness. Runs on this computer, no API calls; turning it on remakes the levelled narration and the exports, never the speech. Default: on for new runs.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness.video":{title:`Video volume`,body:`How loud the finished video and shorts are, in dB from the recommended level. LUFS is how loud a file sounds on average (the scale YouTube and Spotify use); YouTube and Spotify play everything at about -14 LUFS, so 0 dB here is -14 LUFS. -6 dB is about half as loud (50%), +4 dB about 158%. Peaks always stay under -1.5 dBTP.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.loudness.audio-files":{title:`Audio files volume`,body:`How loud the audio-only WAV and an audiobook's MP3 and M4B are, in dB from -18 LUFS, the level audiobook shops such as ACX ask for (-18 to -23 LUFS). LUFS is how loud a file sounds on average. Type dB or a percentage of the recommended level; peaks always stay under -3 dBTP, which those shops require.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.ambient.source":{title:`Ambient sound`,body:`Rain, a fireplace or wind made on this computer, or your own audio file, played quietly under the whole narration of the long video. It dips while the narrator speaks. Costs no API calls. Shorts never get it. Changing it remakes only the video. Default: None, or the channel's bed.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.level":{title:`Ambient level`,body:`How loud the ambient sound plays under the voice, in decibels from -40 (barely there) to -6 (close to the voice). Whole numbers only. Default: -18 dB.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.fade-in":{title:`Ambient fade in`,body:`How many seconds the ambient sound takes to rise from silence at the start of the video, 0 to 30 in half-second steps. Default: 3 seconds.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.ambient.tail":{title:`Ambient tail`,body:`How long the ambient sound keeps playing, fading out, after the narration ends: 0 to 30 seconds in half-second steps. A tail longer than the silence at the end makes the video that much longer. Default: 6 seconds.`,tutorial:{page:`Video-Editing`,anchor:`ambient-sound`}},"project.subtitles.mode":{title:`Subtitles`,body:`Off makes none. Subtitle files gives you .srt and .vtt files to upload beside the video. Burn into video draws the captions into the picture and also makes the files; it needs Video on. Captions are timed from your narration on this computer, with no paid API; the first use downloads a speech model of about 95 MB. Default: Off.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.font":{title:`Subtitle font`,body:`The typeface of burned-in captions and chapter cards. Pick a bundled font or one you uploaded (.ttf or .otf); uploaded fonts stay available to every project. Subtitle files carry no font, since players style them. Changing it remakes only the video. Default: the bundled font.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.size":{title:`Subtitle font size`,body:`How big burned-in captions are, from 16 to 120. Larger is easier to read on phones but covers more of the picture. Default: 48.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.subtitles.position":{title:`Subtitle position`,body:`Where burned-in captions sit on the frame: Top, Upper-middle, Center, Lower-middle or Bottom. Move them up when the pictures have important detail near the bottom. Subtitle files ignore it. Default: Bottom.`,tutorial:{page:`Video-Editing`,anchor:`subtitles`}},"project.video.style-preview":{title:`Style preview`,body:`Six seconds of the sample project's narration and images, rendered on this computer by the real video renderer with your captions, Look and motion, on the establishing image or a cast picture when there is one. The captions follow the narration word by word. It renders again by itself a moment after you change a setting. It costs no API calls, only a few seconds of your computer's time. Render again forces a fresh one.`,tutorial:{page:`Video-Editing`,anchor:`style-preview`}},"project.edit.article-text":{title:`Article text`,body:`The script the narrator reads, in Markdown. Your edits are kept when other settings change and are saved as a new revision; the narration, images and video made from the old text turn outdated and are remade when you choose. Headings become chapters.`,tutorial:{page:`Editing-a-Project`,anchor:`change-the-article-text`}},"project.edit.regenerate-article":{title:`Regenerate article after review`,body:`Marks the article to be written again by the text model, which is one or more paid text calls. Nothing runs yet: the rebuild review lists it with the narration, images and video it outdates, and you start it there. It replaces any edits you made to the article.`,tutorial:{page:`Editing-a-Project`,anchor:`regenerate-the-article`}},"project.saved-revision":{title:`Saved revision`,body:`Every save of Edit project is a revision: a snapshot of the settings and content. Continuing a run always uses the current one. Saving never starts work; outputs the change affects turn outdated and keep their old version until remade. Remaking is offered as the next action, and History lets you go back.`,tutorial:{page:`Editing-a-Project`,anchor:`history-and-saved-revisions`}},"project.choose-remake":{title:`Choose what to remake`,body:`Opens the rebuild review for every outdated or failed output: what will be made again, kept or skipped, what it costs, and which inputs changed. Nothing runs until you press Remake there, and Keep things as they are closes it with nothing spent.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.prompts.template":{title:`Use saved template`,body:`Copies a prompt from your Library into this project, replacing the raw prompt below. The project keeps its own copy, so later Library edits reach it only when you pick it again or press Use the Library version. Outputs made from the old wording turn outdated; nothing is remade until you choose.`,tutorial:{page:`Editing-a-Project`,anchor:`prompts`}},"project.prompts.raw":{title:`Raw prompt`,body:`This project's own copy of the prompt, with keywords still in double braces such as {{Topic}}. Edit it to change what the model is asked for this project only; the Library prompt is untouched. Saving fills the keywords in again, and what was made from the old wording turns outdated.`,tutorial:{page:`Editing-a-Project`,anchor:`prompts`}},"project.edit.rewrite-description":{title:`Write the description again`,body:`Marks the YouTube description to be written again by the text model, one paid text call. Nothing runs yet: save, and it is remade when you continue the run or start the rebuild review. The description you have now is replaced.`,tutorial:{page:`YouTube-Description`,anchor:`write-it-again-or-turn-it-on-later`}},"project.shorts.clips":{title:`Picked clips`,body:`The moments the text model picked for your shorts, each shown by its first and last sentence. Earlier and Later move a clip's start or end by one sentence; Use my own range picks both from lists. Moving a clip costs no calls and keeps its images where the sentences stay the same. Changes apply when you save and continue the run.`,tutorial:{page:`Shorts`,anchor:`change-the-picked-moments`}},"project.shorts.range":{title:`Clip range`,body:`The first and last sentence of this short, from the narration's timed sentences. The clip must stay between the shortest and longest length you set for shorts and must not overlap another clip; the line under the clip says what to change. Back to the AI's choice restores its pick.`,tutorial:{page:`Shorts`,anchor:`change-the-picked-moments`}},"project.shorts.pick-again":{title:`Pick different moments`,body:`Asks the text model to pick new moments when you save and continue the run, one text call. Ranges you set by hand are dropped. A new clip on the same sentences as an old one keeps its images; any other clip gets new images, one image call each, and is rendered again.`,tutorial:{page:`Shorts`,anchor:`pick-new-moments-or-remake-one-short`}},"project.shorts.remake":{title:`Make this short again`,body:`Makes this one short again when you save and continue the run: its image prompts are written again, its images are drawn again (one image call each) and it is rendered again. Its moment, title and the other shorts stay as they are.`,tutorial:{page:`Shorts`,anchor:`pick-new-moments-or-remake-one-short`}},"project.images.editor":{title:`Edit images`,body:`Every image of the video in the order it is shown. You can edit a drawn image's prompt, replace any image with your own file, move it earlier or later, delete it, or add a drawn image, your own picture or a video clip. A clip plays muted in an image's place, trimmed, slowed or looped to fit. Changes apply after you save.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.images.prompt":{title:`Image prompt`,body:`The words this one image is drawn from, with keywords in double braces filled in from the project. Editing it outdates only this image and the video; it is drawn again, one image call, when you remake outdated outputs. Use saved wording as template copies the prompt as sent so you can edit it.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.images.regenerate":{title:`Regenerate image`,body:`Marks this image to be drawn again from its prompt, one paid image call, with a new result. Nothing runs yet: the image says it is marked, and Keep takes the mark off. Press Save changes, and the rebuild review lists it with the video it outdates. The current image stays until the new one is made.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-images`}},"project.narration.editor":{title:`Edit narration`,body:`The narration split into the chunks it was spoken in. Edit a chunk's text, replace its audio with your own file, or have it spoken again. Only the chunks you touch are made again, paid per character, and the video is rendered again with them. Changes apply after you save.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.narration.chunk-text":{title:`Narration chunk text`,body:`What the narrator says in this chunk. Editing it has this chunk spoken again by your voice provider, paid per character of the chunk, when you remake outdated outputs; the other chunks keep their audio. Captions and the video follow. It does not change the article.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.narration.regenerate":{title:`Regenerate narration chunk after review`,body:`Marks this chunk to be spoken again with the same text and voice, paid per character of the chunk, for a new take when a word came out wrong. Nothing runs yet: save, and it is made again when you continue the run. The current audio stays until then.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-narration`}},"project.captions.editor":{title:`Caption text and timing`,body:`Each caption's words and when it shows, in seconds from the start of the narration. Fix a misheard word or move a caption a little earlier or later; captions must not overlap and must end after they start. Edits cost nothing and only the subtitle files and the video are made again. The narration is not changed.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-captions`}},"project.captions.apply":{title:`Apply caption edits to draft`,body:`Checks every caption (text present, times in order, inside the narration) and puts your edits into the project draft. Nothing is saved until you press Save changes, and the video is rendered again only when you remake outdated outputs.`,tutorial:{page:`Editing-a-Project`,anchor:`edit-captions`}},"project.youtube.summary":{title:`Summary`,body:`The opening of the YouTube description, written by the text model from the article. Edit changes it in place and keeps your text as yours: when the description is written again, your summary stays and the new one waits beside it with Use it, Keep mine and View diff. Use generated goes back to the model's text.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.chapters":{title:`Chapters`,body:`Timestamped chapter lines at the narration's real times, which YouTube turns into chapters. YouTube needs the first at 0:00, at least three, each at least 10 seconds long. Edit changes them in place and your edit survives the next rewrite; Use generated goes back.`,tutorial:{page:`YouTube-Description`,anchor:`chapters-follow-youtubes-rules`}},"project.youtube.hashtags":{title:`Hashtags`,body:`The hashtags at the end of the description; YouTube shows the first three above the title. Edit changes them in place and your edit survives the next rewrite, with the new ones offered beside it. Use generated goes back to the model's.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.tags":{title:`Tags`,body:`Search tags for YouTube's Tags field, which allows 500 characters in all, commas included. They are not shown to viewers. Edit changes them in place and your edit survives the next rewrite; Copy gives them comma-separated, ready to paste.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.pinned-comment":{title:`Pinned comment`,body:`A comment to pin under the video, written with the description: a line or two asking viewers a question about the subject and what to cover next. Your Description prompt can shape it. YouTube pins comments only on a published video: post it from your channel, then choose Pin in its menu. Your edits survive the next rewrite.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.titles":{title:`Other titles`,body:`Two more titles for this video, written with the description, each a different angle. YouTube's A/B Testing, beside the title in Studio, shows up to three titles to viewers and keeps the one watched most. Edit them one per line; your edits survive the next rewrite.`,tutorial:{page:`YouTube-Description`,anchor:`edit-a-part`}},"project.youtube.previous-video":{title:`Previous video for this project`,body:`The link that {{Previous video}} fills in this project's description, ahead of the one on its channel's Brand tab. Paste the video this one follows on from. It changes only what is shown and copied, with no text call. Save links keeps it.`,tutorial:{page:`YouTube-Description`,anchor:`previous-video`}},"project.live.writing":{title:`Live writing`,body:`The text model's words as they arrive, so you can see the article or research taking shape. When a stage makes several calls, the list picks which one to watch. Follow output keeps the newest text in view; untick it to read back. Watching costs nothing extra; the full text is saved when the stage finishes.`,tutorial:{page:`Project-Page`,anchor:`live`}},"project.checkpoints.choices":{title:`Checkpoint choices`,body:`A checkpoint holds the run before a step so you can check and edit what came before it. Tick a step that has not started to add one; untick to remove it, and work already admitted for that step carries on when ready. Pausing the project still applies. Only generated steps can have one. Save checkpoints applies the change.`,tutorial:{page:`Project-Page`,anchor:`checkpoints`}},"project.rebuild.keep-provided":{title:`Keep the provided content`,body:`This output uses a file or text you supplied, and something it depends on, such as the narration, has changed since. Tick to confirm it still fits and keep it as it is. To use something else, cancel and replace the file in Edit project first. Remake stays off until you tick it.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.rebuild.unknown-costs":{title:`Unknown cost estimates`,body:`Some steps use a model with no published price, so their cost cannot be estimated and is left out of the total shown. Tick to start anyway; the real cost is recorded under Cost once they run. Remake stays off until you tick it.`,tutorial:{page:`Editing-a-Project`,anchor:`choose-what-to-remake`}},"project.cost.by-stage":{title:`Cost by stage`,body:`What each stage of this project has cost so far, from every provider call it made, retries and remakes included, priced from the model catalogue when each call finished. Failed calls are not charged here, and taxes and included credits are not counted. Working time is how long the stage's steps were running, over every run.`,tutorial:{page:`Costs-and-Run-Cost`,anchor:`after-a-run-the-run-cost-tab`}},"project.cost.by-model":{title:`Cost by model`,body:`The same spending split by provider and model. Cost is what you paid the provider. Calls through a signed-in command-line tool such as Claude Code or Codex cost $0 on your plan; Via API shows what the same work would cost through the provider's API, for comparison only.`,tutorial:{page:`Costs-and-Run-Cost`,anchor:`after-a-run-the-run-cost-tab`}},"project.upload.item":{title:`What to upload`,body:`Switches the list between the long video and each short, since each is uploaded to YouTube on its own with its own title, description and tags. The ticks and the Fill in YouTube Studio button follow the one you pick.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.real-footage":{title:`Real footage`,body:`Turn this on when the video clips you uploaded are filmed footage, not made by AI. The AI use answer then checks them: laying a Look atmosphere such as fog over real footage makes it Yes, while colour, vignette or grain count as minor edits and keep it No. It is saved with the project and changes nothing in the video.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`ai-use-disclosure`}},"project.upload.slot":{title:`Release time`,body:`When this video goes out. It takes the next free time of a posting-plan line for its series (Settings → YouTube Studio); each short follows at its own times. Pick another free time, or Not scheduled to set it in Studio yourself. Calendar → Releases shows and moves every time. Upload it before its upload-by time so YouTube's checks finish while it is private.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.steps":{title:`Upload steps`,body:`Everything YouTube Studio asks for, in the order it asks: file, title, description, thumbnail, playlist, audience, AI use, tags and the schedule. Copy puts each value on the clipboard. The tick box beside each step is only a note to yourself, remembered in this browser; it changes nothing in the project.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`upload-a-video`}},"project.upload.fill-studio":{title:`Fill in YouTube Studio`,body:`Opens Studio's upload page and adds this item to what waits for the Slopify Studio extension, which must be installed and paired (Settings, YouTube Studio). Each upload dialog you start is filled with the first waiting item. If Studio's dialog lacks a field, nothing is filled and the whole pack is copied instead. You check it and press Publish; Slopify never uploads or publishes.`,tutorial:{page:`Studio-Extension`,anchor:`fill-in-an-upload`}},"project.upload.queue":{title:`Waiting for Studio`,body:`The videos and shorts Fill in YouTube Studio added, oldest first, from every project. Each new upload dialog in Studio is filled with the first, which then leaves the list. It survives restarting Slopify; an item waits up to 24 hours, and a new pairing token clears the list. Remove takes an item out without filling it.`,tutorial:{page:`Studio-Extension`,anchor:`upload-several-one-after-another`}},"project.free-space":{title:`Free space`,body:`Once a project has finished, it can drop the working files it was made from (images, narration parts, subtitle timing, render settings) and keep what gets published: the video, shorts, thumbnail, article, description, document and anything you uploaded. The button says how much space that frees. Changing the project later makes those files again first, which takes time and provider credits. Settings → Storage offers the same for every project.`,tutorial:{page:`Project-Page`,anchor:`free-space`}},"project.mark-uploaded":{title:`Mark uploaded`,body:`Records that you uploaded this finished video to YouTube yourself, so it leaves the ready-to-upload lists on Home and here and shows an Uploaded badge. Slopify does not upload anything or check YouTube. Undo takes the mark off.`,tutorial:{page:`Publishing-to-YouTube`,anchor:`mark-a-video-uploaded`}},"project.edit.update-glossary":{title:`Update from other projects`,body:`Copies your other projects' Pronunciation Glossary terms into this project again, picking up any added since the last copy. The project keeps its own copy, so nothing changes until you press this. After you save, only the narration chunks whose words those terms change are spoken again, paid per character.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`the-pronunciation-glossary`}},"project.edit.show-figures":{title:`Show tables and figures on screen`,body:`Shows each described table, figure, equation and code block in the video while its description is spoken, as the article's picture or a card drawn on this computer at no cost. Turning it on or off renders the video again, and any Shorts that include a card; the narration is kept. The cards appear under Images, From the article, and can be made again there.`,tutorial:{page:`Play-Outputs`,anchor:`show-tables-and-figures-on-screen`}},"project.edit.describe-figures":{title:`Describe tables and figures`,body:`The text model writes a short spoken passage for each table, figure, equation and code block, said in its place. Turning it on costs one text-model call per block, and after you save, the narration chunks that contain a block are spoken again, paid per character (the whole narration when Chunking is the whole article). Other chunks keep their audio; captions and timing are redone to match.`,tutorial:{page:`Play-Narration`,anchor:`tables-figures-and-code`}},"project.edit.update-aliases":{title:`Update from Library`,body:`Copies Library, Aliases into this project again, picking up aliases added or changed since the last copy. The project keeps its own copy, so a Library edit reaches it only when you press this. After you save, only the narration chunks the changed aliases touch are spoken again, paid per character.`,tutorial:{page:`Narration-Aliases-and-Glossary`,anchor:`use-aliases-in-a-video`}}},Xne={"settings.diagnostics":{title:`Download diagnostics`,body:`Saves slopify-diagnostics.json: the Slopify version, your system and Node version, which providers are set up or found, the project count and the model catalogue's state. It never holds your keys, prompts or project content. Attach it to a bug report so the problem can be found faster.`,tutorial:{page:`Troubleshooting`,anchor:`download-diagnostics`}},"settings.autostart":{title:`Start Slopify when you log in`,body:`Slopify starts in the background when you log in to this computer, without opening a browser tab; open it from your bookmark. It uses your account's own start-up list, so no administrator password is needed, and turning it off removes exactly what it added. Default: off. In Docker, Slopify starts whenever Docker does, so this only shows Docker's own setting.`,tutorial:{page:`Start-at-Login`,anchor:`turn-it-on`}},"settings.providers.api-key":{title:`API key`,body:`The key that lets Slopify call this provider on your account; the provider bills you for what it makes. It is stored on this computer only, sent only to that provider, and never put in a backup or export. Paste a new key and Save to replace the old one.`,tutorial:{page:`Providers-and-Keys`,anchor:`add-a-key`}},"settings.providers.test-key":{title:`Test`,body:`Asks the provider whether the key works, with the cheapest harmless call it allows. A key pasted in the field is tested before you save it; with the field empty, the saved key is. Nothing is generated, billed or stored. When it fails, the answer says why: a rejected key, missing permission, no credit, or the provider being down.`,tutorial:{page:`Providers-and-Keys`,anchor:`test-a-key`}},"settings.provider.openrouter":{title:`OpenRouter`,body:`Writes the text (research, script, article, titles, descriptions) with hundreds of models from many companies through one key. Each call is charged per token from the credit you buy on OpenRouter; prices follow the model catalogue. Choose it when you want a model the command-line tools do not offer.`,tutorial:{page:`Providers-and-Keys`,anchor:`openrouter`}},"settings.provider.claude-code":{title:`Claude Code CLI`,body:`Writes the text with the Claude Code command-line tool on this computer, using your own Claude sign-in, so no API key is needed and calls count toward your Claude plan's limits instead of costing per call. Sign in first by running claude auth login in a terminal. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.codex":{title:`Codex CLI`,body:`Writes the text with the Codex command-line tool on this computer, using your own ChatGPT sign-in, so no API key is needed and calls count toward your plan's limits instead of costing per call. Sign in first by running codex login in a terminal. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.gemini":{title:`Gemini CLI`,body:`Writes the text with the Gemini command-line tool on this computer, using your own Google sign-in, so no API key is needed. Sign in first by running gemini in a terminal and following its login steps. Slopify runs up to 3 calls at once.`,tutorial:{page:`AI-CLIs`,anchor:`set-up-a-cli`}},"settings.provider.codex-image":{title:`Codex CLI images`,body:`Draws the images with the Codex command-line tool, using your ChatGPT sign-in instead of an API key, so images count toward your plan's limits rather than costing per image. It shares its executable path and sign-in with Codex text. Slopify draws up to 4 images at once.`,tutorial:{page:`AI-CLIs`,anchor:`codex-images`}},"settings.provider.elevenlabs":{title:`ElevenLabs`,body:`Narrates the script with ElevenLabs voices, including voices you added to your ElevenLabs account. It is billed in characters of narration from your ElevenLabs plan. A restricted key needs Text to Speech and Models read access.`,tutorial:{page:`Providers-and-Keys`,anchor:`elevenlabs`}},"settings.provider.openai-tts":{title:`OpenAI speech`,body:`Narrates the script with OpenAI's text-to-speech voices. It is billed per character or per audio minute, depending on the model, from prepaid credit on your OpenAI platform account; new accounts need at least $5 of credit before any call works.`,tutorial:{page:`Providers-and-Keys`,anchor:`openai-speech`}},"settings.provider.cartesia":{title:`Cartesia`,body:`Narrates the script with Cartesia voices, billed in characters from your Cartesia plan. The free plan needs no card, so it is an easy way to try narration.`,tutorial:{page:`Providers-and-Keys`,anchor:`cartesia`}},"settings.provider.inworld":{title:`Inworld`,body:`Narrates the script with Inworld voices, billed per character from your Inworld account. Paste the Base64 credentials of a Standard key exactly as shown; Realtime-only keys do not work.`,tutorial:{page:`Providers-and-Keys`,anchor:`inworld`}},"settings.provider.system-voice":{title:`System voice`,body:`Narrates with the speech your computer already has: macOS voices, Windows voices, or on Linux Piper, SVOX Pico or eSpeak NG. No key, no account and no charge, but it sounds robotic next to ElevenLabs or OpenAI. On Linux, install espeak-ng if nothing is found. Its models are the speech programs Slopify found; add one of their voices in Settings → Voices.`,tutorial:{page:`Providers-and-Keys`,anchor:`the-system-voice`}},"settings.provider.google-tts":{title:`Google Gemini voices`,body:`Narrates with Gemini's 30 prebuilt voices, billed to your Gemini API key per text and audio token. It uses the key saved for Google images unless you save one here. Two speakers' consecutive turns can go in one request (see Speakers on Play).`,tutorial:{page:`Providers-and-Keys`,anchor:`google-gemini-speech`}},"settings.provider.fal":{title:`fal.ai`,body:`Draws the images and thumbnails with the image models fal.ai hosts, charged per image from prepaid credit. fal.ai locks the account when the balance runs out, so a run stops at the images step until you add credit.`,tutorial:{page:`Providers-and-Keys`,anchor:`falai`}},"settings.provider.replicate":{title:`Replicate`,body:`Draws the images and thumbnails with the image models Replicate hosts, charged per image or per second of compute from credit you buy up front.`,tutorial:{page:`Providers-and-Keys`,anchor:`replicate`}},"settings.provider.openai-image":{title:`OpenAI images`,body:`Draws the images and thumbnails with OpenAI's GPT Image models, charged per image from prepaid credit on your OpenAI platform account. GPT Image may also need Verify Organization on the OpenAI platform before it works.`,tutorial:{page:`Providers-and-Keys`,anchor:`openai-images`}},"settings.provider.google-image":{title:`Google images`,body:`Draws the images and thumbnails with Google's Gemini image models, charged per image. Use a key made in Google AI Studio on a project with billing set up; Gemini image models are not on the free tier.`,tutorial:{page:`Providers-and-Keys`,anchor:`google`}},"settings.cli.path":{title:`Executable path`,body:`Where the command-line tool is on this computer. Leave it blank and Slopify finds it on PATH, the list of folders your terminal searches. Set an absolute path, without quotes or arguments, when the tool is installed somewhere else or you have more than one copy. Save checks the tool answers.`,tutorial:{page:`AI-CLIs`,anchor:`set-the-executable-path`}},"settings.cli.managed-on-host":{title:`Managed on host`,body:`Slopify runs in Docker, so this tool runs on your computer outside the container, with the sign-in it already has there. Its path cannot be changed here. After you install, update or remove a command-line tool, run the Docker launcher again so Slopify sees the change.`,tutorial:{page:`AI-CLIs`,anchor:`in-docker-the-host-helper`}},"settings.health":{title:`Health check`,body:`Asks each command-line tool whether it is signed in, makes the cheapest harmless call each saved key allows (nothing is generated or billed), and checks that the models your templates, schedules, drafts and projects use are still offered and answer for your key. Run it after changing a key or when a run stops at a provider; Check again on a provider's row checks that one alone.`,tutorial:{page:`Providers-and-Keys`,anchor:`check-all-providers`}},"settings.models.catalogue":{title:`Model catalogue`,body:`The list of models, prices and retirements the pickers and cost estimates use. Slopify checks the published catalogue and OpenRouter's live list when it starts and once a day; Check now does it at once. New models appear and prices update; nothing you made changes. Your own edits to the local file are kept.`,tutorial:{page:`Models`,anchor:`what-the-catalogue-covers`}},"settings.models.replace":{title:`Replace with published file`,body:`Overwrites the local catalogue file with the published one, dropping any edits you made to it. The previous file is saved beside it first, so you can copy your edits back. Use it when the local file is broken or you want the published list exactly.`,tutorial:{page:`Models`,anchor:`replace-the-local-file-with-the-published-one`}},"settings.models.retired":{title:`Retired models in use`,body:`Templates, schedules, drafts and projects with steps still to run that pick a model the provider no longer offers. A run that reaches one stops and says so. Switch replaces only that one model choice with the suggestion shown; Switch all does every one that has a suggestion.`,tutorial:{page:`Models`,anchor:`switch-away-from-a-retired-model`}},"settings.playback.silence-gap":{title:`Silence between segments`,body:`Seconds of quiet between the intro and the narration, and between the narration and the outro, in every new video, unless Play sets a different gap for one video. It only matters when an intro or outro is set; 0 runs them together. Default: 3 seconds, from 0 to 30. Videos already started keep their own gap.`,tutorial:{page:`Settings-Reference`,anchor:`silence-between-segments`}},"settings.loudness":{title:`Level the volume for new runs`,body:`Whether a new run on Play (and a template or quick short) starts with Level the volume on, and at which volumes. On evens out every narration piece and sets the video to about -14 LUFS, the loudness YouTube plays at, and the audio files to -18 LUFS. A project keeps what it started with; change it there in Edit project. Default: on.`,tutorial:{page:`Settings-Reference`,anchor:`level-the-volume-for-new-runs`}},"settings.appearance":{title:`Appearance`,body:`Light or dark colours for Slopify on this computer. System follows your operating system's setting and changes with it. Default: System. It changes at once and does not affect your videos.`,tutorial:{page:`Settings-Reference`,anchor:`appearance`}},"settings.notifications":{title:`Notifications`,body:`Slopify tells you when a run finishes, fails, or stops to wait for your review, and when an automatic review kept an item flagged and needs your decision. The message holds the project title, what happened and a link to the project, never your keys. Browser notifications need a Slopify tab open; a Notification URL works with none open.`,tutorial:{page:`Notifications`,anchor:`when-slopify-notifies-you`}},"settings.notifications.sounds":{title:`Run sounds`,body:`Plays a chime when a run starts and a different, longer one when it finishes, fails or stops to wait for you, while any Slopify tab is open. Only one tab plays each. Needs no permission, but the browser stays silent until the page has been clicked once. This browser only. Default: on.`,tutorial:{page:`Notifications`,anchor:`run-sounds`}},"settings.notifications.browser":{title:`Browser notifications`,body:`Shows a notification from this browser while any Slopify tab is open, even in the background. Turning it on asks the browser's permission. It applies to this browser only, so turn it on in each browser you use. Default: off.`,tutorial:{page:`Notifications`,anchor:`turn-on-browser-notifications`}},"settings.notifications.url":{title:`Notification URL`,body:`An address Slopify POSTs a short plain-text message to, with no tab open. For your phone, install the ntfy app, subscribe to a topic with a long random name, and paste https://ntfy.sh/that-topic. Any address that accepts a POST works. Each message is sent once, with a 5 second timeout. Leave it empty to turn it off.`,tutorial:{page:`Notifications`,anchor:`get-notifications-on-your-phone-notification-url`}},"settings.studio.extension":{title:`Upload pack and extension`,body:`Slopify never uploads or publishes. A finished project's Prepare upload lists everything Studio asks for, with Copy buttons. The optional Slopify Studio browser extension fills Studio's upload dialog from that pack; you still press Publish. Install it from Install the Studio extension below: Download, three steps, then pair it with the token.`,tutorial:{page:`Studio-Extension`,anchor:`get-the-extension`}},"settings.studio.playlist":{title:`Playlists`,body:`The YouTube playlists upload packs offer, typed exactly as Studio names them. Pick Every channel for the default list, or a channel to give it its own. Ticked On by default means every project goes into it; Prepare upload changes the ticks for one project. The extension ticks each one in Studio. Default: none.`,tutorial:{page:`Studio-Extension`,anchor:`settings--youtube-studio`}},"settings.studio.install":{title:`Install the Studio extension`,body:`The extension comes with Slopify, nothing is fetched from a store. Chrome, Edge and Brave load it once with Load unpacked (Developer mode) from the folder shown here: Slopify puts each new version there when it updates, and the extension switches to it by itself after 45 minutes without use. Firefox 128 or newer loads the downloaded zip as a temporary add-on, which it forgets on restart. Then pair it with the token above.`,tutorial:{page:`Studio-Extension`,anchor:`get-the-extension`}},"settings.studio.pairing":{title:`Extension pairing token`,body:`A secret the Slopify Studio extension needs before it may read your upload packs, so no other page can. Copy it into the extension's options and press Pair. New pairing token makes a fresh one and unpairs the extension until you paste the new token.`,tutorial:{page:`Studio-Extension`,anchor:`pair-it-with-slopify`}},"settings.storage.export":{title:`Export and import`,body:`Export everything saves every project with its files and history, your library, templates, schedules, Play drafts, fonts, settings and usage in one .tar file; never provider keys. Import adds to this install and replaces nothing: projects already here are skipped, taken names arrive as “(imported)” and schedules arrive paused. Running projects must finish or pause first.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`export-and-import`}},"settings.storage.clean":{title:`Clear leftover files`,body:`Deletes files in the projects folder that no project records any more, and uploaded files that no draft, template or project uses. Your projects, outputs and library are never touched. Slopify also does this each time it starts; use it after a crash or to free space now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`clear-leftover-files`}},"settings.storage.disk":{title:`Disk space`,body:`What Slopify stores on this computer: project files (outputs plus the working files they were made from), staged uploads, and deleted projects still in the trash. Deleted projects free their space when the trash removes them after 30 days, or when you choose Delete now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`disk-space`}},"settings.storage.keep-outputs":{title:`Keep outputs only`,body:`On a finished project, deletes the working files it was made from (images, narration parts, subtitle timing, render settings) and keeps the video, shorts, thumbnail, article, description, document and your uploads. Changing the project later makes those files again first, which takes time and provider credits.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`keep-outputs-only`}},"settings.sample.restore":{title:`Sample projects`,body:`The finished examples that come with Slopify: a narrated video, an audiobook and a podcast, which you can look through without spending anything. Restore samples adds back any that were deleted and replaces the others with the originals. Your own copies of them are not touched.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`sample-projects`}},"settings.files":{title:`Your files`,body:`Your projects, automatic backups and exports live here; new installs use Documents/Slopify. The database, settings, keys and logs stay in Slopify's hidden data folder. Moving copies every file, checks each copy by size and checksum, then switches, and keeps the old folder until you delete it. It takes as long as copying your projects and cannot start while a project is being made.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`see-your-files`}},"settings.files.docker":{title:`Your files`,body:`Your projects and backups are in the folders Docker shares with this computer. The container cannot move its own folders, so run the command shown on the computer running Docker: the installer waits for running work, copies your projects, checks the copy and remounts the new folder.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`see-your-files`}},"settings.files.new-folder":{title:`New folder`,body:`The full path of the folder your files move to, on another disk or a synced folder for example. Slopify makes Projects and Backups inside it. It must be empty or not exist yet. The move needs as much free space there as your projects take now.`,tutorial:{page:`Where-Your-Files-Live`,anchor:`move-your-files-to-another-folder`}},"settings.backups":{title:`Daily backup`,body:`Once a day Slopify writes the file Export everything makes into the backup folder and deletes its own oldest backups beyond the number you keep. Nothing else there is touched. A backup waits while projects are being made; if Slopify was off at the time, it backs up a couple of minutes after it starts. Each backup can be many gigabytes.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.auto":{title:`Back up automatically`,body:`Turns the daily backup on or off. Default: off, because each backup holds every project's video and can fill a disk. Back up now works either way. Press Save after changing it.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.time":{title:`Time of day`,body:`When the daily backup runs, in this browser's time zone. Pick a time the computer is usually on and idle; a backup waits for running projects. Default: 03:00.`,tutorial:{page:`Backups`,anchor:`when-the-daily-backup-runs`}},"settings.backups.keep":{title:`Keep last`,body:`How many of Slopify's own backups stay in the folder; after a new one is written, the oldest beyond this number are deleted. Each holds everything, so disk use grows with this number. Default: 5, from 1 to 30.`,tutorial:{page:`Backups`,anchor:`turn-on-daily-backups`}},"settings.backups.folder":{title:`Backup folder`,body:`Where backups are written. Leave it empty to use the Backups folder beside your projects (Documents/Slopify/Backups on a new install), which moves with them. Point it at another disk or a synced folder to keep copies away from this disk. Slopify only ever deletes its own backup files there.`,tutorial:{page:`Backups`,anchor:`where-the-files-go-and-what-they-are-called`}},"settings.trash":{title:`Trash`,body:`Deleted projects, prompts, intros and outros, templates and schedules stay here for 30 days, then are removed for good along with a project's files. Restore puts one back; if its name was taken meanwhile it comes back renamed, and a schedule comes back paused. Delete now frees the space at once. Channels, cast members, PDF themes and episode summaries never come here: deleting one removes it permanently.`,tutorial:{page:`Trash`}},"settings.patch-notes":{title:`Patch notes`,body:`What changed in each version of Slopify. The newest notes are open here; older versions are folded under Earlier versions, and each opens when you pick it. They ship with the app, so they work offline. After an update, the new version's notes open by themselves once; a fresh install skips that. On a major update the What's new tour shows instead and links here.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`read-the-patch-notes`}},"settings.whats-new":{title:`What's new in this version`,body:`Opens the patch notes for the version you are running, in Settings, Patch notes. When this version has no notes of its own, it opens the newest ones instead.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`whats-new-tour-on-a-major-update`}},"settings.updates":{title:`Updates`,body:`The circular-arrows button at the foot of the sidebar (at the top on a phone) checks for a newer Slopify and installs it. A dot on it means an update is ready. If a video is being made, the update waits until it finishes, and you can cancel it meanwhile. Slopify restarts itself and this page reconnects.`,tutorial:{page:`Updating-and-Patch-Notes`,anchor:`update-from-the-app`}},"home.channel":{title:`Channel`,body:`Shows Home and the other screens for one channel, or for all of them. It only filters what you see: projects, schedules and costs of other channels keep running. Slopify remembers the choice in this browser.`,tutorial:{page:`Channels`,anchor:`show-one-channels-work`}},"home.needs-you":{title:`Needs you`,body:`Runs held at a review before a step, paused runs, topics a schedule suggested for you to accept or reject, and runs that failed with the fix to try; then finished videos you have not marked uploaded. Nothing here moves on until you act: approving a review from here lets that run continue, and Mark uploaded takes a finished video off the list (Projects still has it).`,tutorial:{page:`Home-and-Projects`,anchor:`needs-you`}},"home.running":{title:`Running now`,body:`Videos being made or paused, with the step each is on and how long it has taken. Up to 3 show here; Projects lists them all. Open one to follow it live, pause it or cancel it.`,tutorial:{page:`Home-and-Projects`,anchor:`running-now`}},"home.coming-up":{title:`Coming up`,body:`The schedule runs due in the next 7 days, with the template and topic each will use. Paused schedules show too. Plan or move runs on the calendar.`,tutorial:{page:`Home-and-Projects`,anchor:`coming-up`}},"home.this-week":{title:`This week`,body:`Videos made since Monday and what their provider calls cost. Calls billed to a command-line plan cost nothing per call, so the API figure says what they would have cost with API keys. The bars show how much of each plan's weekly limit is used, from the tool's last reading.`,tutorial:{page:`Home-and-Projects`,anchor:`this-week`}},"welcome.samples":{title:`Samples`,body:`Finished projects that come with Slopify: a narrated video, an audiobook and a podcast. They are read-only, so nothing you try on them costs anything; Make my own copy on a sample's page gives you one to edit.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`explore-the-samples`}},"welcome.found":{title:`Found on this computer`,body:`Claude Code, Codex and Gemini CLI write the text with your own sign-in, so no API key is needed for it, and Codex also draws the images. The narration uses a voice key (OpenAI, ElevenLabs, Cartesia or Inworld) when one is saved in Settings → Providers, and otherwise your computer's built-in voice, so no key is needed to start.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`found-on-this-computer`}},"welcome.voice":{title:`Narration voice`,body:`Who reads the script aloud. With a voice key saved (OpenAI, ElevenLabs, Cartesia or Inworld), that provider narrates. Without one, your computer's own speech does it for free: macOS or Windows voices, or eSpeak NG on Linux. It sounds robotic, so add a key in Settings → Providers when you want a better voice.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`narration-voice`}},"welcome.short":{title:`Make a 60-second short`,body:`Slopify writes a script of about 150 words, narrates it, draws four vertical images and renders a captioned 9:16 short, usually in about five minutes with the command-line tools. The narration uses your voice provider's credit, or nothing with the built-in voice; text and images through a command-line tool count toward its plan.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-3-make-a-60-second-short`}},"welcome.topic":{title:`Topic`,body:`What the short is about, in a few words or a question, up to 200 characters. Slopify writes the script from it without a research step, to keep the first short quick, so a specific topic gives a sharper short than a broad one.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-3-make-a-60-second-short`}},"welcome.pack":{title:`Style`,body:`The starter pack whose prompts, voice and art direction the short uses. General is a neutral explainer style. Making the short with a pack adds its prompts and suggested voice to your library; Add to library also adds its template for Play.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`step-2-pick-a-style`}},"welcome.packs":{title:`Starter packs`,body:`Each pack adds prompts, a suggested voice and a Play template for one kind of channel, so you can pick the template on Play, type a topic and go. Adding a pack twice changes nothing, and it never replaces a prompt or template of yours with the same name.`,tutorial:{page:`First-Launch-and-Welcome`,anchor:`starter-packs`}}},Zne={...Jne,...Yne,...Kne,...qne,...Xne};function Oy(e,t){let n=Zne[e];if(t===void 0)return n;let r=e=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??e);return{...n,title:r(n.title),body:r(n.body)}}function Qne(e){return e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/`([^`]*)`/g,`$1`).replace(/(\*\*|__)(.+?)\1/g,`$2`).replace(/(^|[^\p{L}\p{N}])[*_]([^*_]+)[*_](?![\p{L}\p{N}])/gu,`$1$2`).replace(/<[^>]+>/g,``).trim()}function ky(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\p{M} _-]/gu,``).replace(/ /g,`-`)}var $ne=`/help/tutorials`;function Ay(e,t){return`${$ne}/${encodeURIComponent(e)}${t?`#${t}`:``}`}function ere(e,t,n){return e.replace(/\]\(([A-Za-z0-9][A-Za-z0-9-]*)?(?:#([^)\s]*))?\)/g,(e,r,i)=>{if(r===void 0&&i===void 0)return e;let a=r??n;return t.has(a)?`](${Ay(a,i)})`:e})}function tre(e){let t=/^\s*#\s+(.+?)\s*#*\s*(?:\n|$)/.exec(e);return t===null?{title:void 0,body:e}:{title:t[1],body:e.slice(t[0].length)}}function nre(e){let t=/^\/help\/tutorials\/([^/#?]+)(?:#(.*))?$/.exec(e);if(t===null)return;let n=t[2];return{page:decodeURIComponent(t[1]??``),anchor:n===void 0||n===``?void 0:decodeURIComponent(n)}}function rre(e,t,n=[]){let r=new Map;for(let e of n){let t=ky(Qne(e));r.set(t,(r.get(t)??0)+1)}for(let n of e.querySelectorAll(`h1, h2, h3, h4, h5, h6`)){let e=ky((n.textContent??``).trim()),i=r.get(e)??0;if(r.set(e,i+1),(i===0?e:`${e}-${String(i)}`)===t)return n}}var jy=xv,My=Sne,ire=Sv,are=Tne;function Ny({className:e,align:t=`start`,sideOffset:n=6,...r}){return(0,h.jsx)(Cne,{children:(0,h.jsx)(wne,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:12,className:R(`z-50 w-[min(340px,calc(100vw-24px))] rounded-control border border-line bg-raised p-3 text-small text-ink-2`,`shadow-[var(--shadow-pop)] outline-hidden`,e),...r})})}function H({id:e,label:t,vars:n,className:r}){let i=Oy(e,n);return(0,h.jsxs)(jy,{children:[(0,h.jsx)(My,{type:`button`,"aria-label":`About ${t??i.title}`,"data-help-id":e,className:R(`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-raised hover:text-ink`,r),children:(0,h.jsx)(el,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,h.jsxs)(Ny,{className:`space-y-2 leading-[1.45]`,children:[(0,h.jsx)(`p`,{className:`m-0 font-semibold text-ink`,children:i.title}),i.body.split(`
|
|
51
51
|
|
|
52
52
|
`).map(e=>(0,h.jsx)(`p`,{className:`m-0`,children:e},e)),i.tutorial===void 0?null:(0,h.jsx)(ore,{tutorial:i.tutorial})]})]})}function ore({tutorial:e}){let t=hi({warn:!1}),n=`sl-link inline-flex items-center gap-1 text-small`,r=(0,h.jsxs)(h.Fragment,{children:[`Learn more`,(0,h.jsx)(Sc,{"aria-hidden":`true`,className:`size-[13px]`})]});return t?(0,h.jsx)(are,{asChild:!0,children:(0,h.jsx)(pa,{to:`/help/tutorials/$page`,params:{page:e.page},...e.anchor===void 0?{}:{hash:e.anchor},className:n,children:r})}):(0,h.jsx)(`a`,{href:Ay(e.page,e.anchor),className:n,children:r})}var Py={"data-help-scope":``};function U({title:e,kicker:t,meta:n,info:r,infoLabel:i=e,as:a=`h2`,size:o=a===`h3`?`small`:`default`,id:s,status:c,row:l=!1,className:u,children:d}){return(0,h.jsxs)(`div`,{className:R(`sl-section-head`,u),"data-slot":`section-head`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[t===void 0?null:(0,h.jsx)(`div`,{className:`sl-kicker`,children:t}),(0,h.jsxs)(`div`,{className:R(`flex items-center gap-2`,l&&`flex-wrap items-baseline gap-x-3 gap-y-0`),children:[(0,h.jsx)(a,{id:s,className:R(`sl-section-head__title`,o===`small`&&`text-title-3`),children:e}),r===void 0?null:(0,h.jsx)(H,{id:r,label:i}),c,l&&n!==void 0?(0,h.jsx)(`p`,{className:`sl-section-head__meta m-0 min-w-0`,children:n}):null]}),l||n===void 0?null:(0,h.jsx)(`p`,{className:`sl-section-head__meta`,children:n})]}),d===void 0?null:(0,h.jsx)(`div`,{className:`sl-btn-row min-w-0 shrink-0 justify-end max-md:shrink max-md:justify-start`,children:d})]})}function Fy({checked:e,onChange:t,label:n,disabled:r,className:i,describedBy:a,tip:o,tipLabel:s}){let c=(0,h.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-describedby":a,disabled:r,onClick:()=>t(!e),className:R(`sl-switch`,i),children:[(0,h.jsx)(`span`,{className:`sl-switch__track`,"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:n})]});return o===void 0?c:(0,h.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,...Py,children:[c,(0,h.jsx)(H,{id:o,label:s??(typeof n==`string`?n:void 0)})]})}function Iy({value:e,options:t,onChange:n,label:r,className:i,tip:a}){let o=(0,m.useRef)(null),s=(0,h.jsx)(`div`,{ref:o,role:`group`,"aria-label":r,onKeyDown:r=>{if(r.key!==`ArrowRight`&&r.key!==`ArrowLeft`)return;let i=t.filter(e=>!e.disabled),a=i[(i.findIndex(t=>t.value===e)+(r.key===`ArrowRight`?1:-1)+i.length)%i.length];a!==void 0&&(r.preventDefault(),n(a.value),o.current?.querySelector(`[data-value="${CSS.escape(a.value)}"]`)?.focus())},className:R(`sl-seg`,i),children:t.map(t=>(0,h.jsx)(`button`,{type:`button`,"data-value":t.value,"aria-pressed":t.value===e,tabIndex:t.value===e?0:-1,disabled:t.disabled,onClick:()=>n(t.value),className:`sl-seg__opt`,children:t.label},t.value))});return a===void 0?s:(0,h.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,...Py,children:[s,(0,h.jsx)(H,{id:a,label:r})]})}var Ly=[`settings`,`autostart`],Ry=(e,t=``)=>`${e.origin}/api/settings/autostart${t}`;async function zy(e){return L(await e.fetch(Ry(e)))}async function sre(e,t){return L(await e.fetch(Ry(e),{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:t})}))}async function cre(e){return L(await e.fetch(Ry(e,`/answer`),{method:`POST`}))}var By=`Start Slopify when I log in`;function lre(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Vy(){let{api:e}=B(),t=_();return{view:F({queryKey:Ly,queryFn:()=>zy(e)}),turn:I({mutationFn:t=>sre(e,t),onSuccess:e=>t.setQueryData(Ly,e)}),decline:I({mutationFn:()=>cre(e),onSuccess:e=>t.setQueryData(Ly,e)})}}function ure(){let{view:e,turn:t}=Vy(),n=e.data;return(0,h.jsxs)(`div`,{...Py,children:[(0,h.jsx)(U,{title:By,info:`settings.autostart`}),e.error===null?null:(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 mb-3 text-body text-danger`,children:[`Starting at login couldn't be checked: `,e.error.message]}),n===void 0?e.error===null?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:`Checking…`}):null:n.kind===`docker`?(0,h.jsx)(Hy,{view:n}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(Fy,{label:By,checked:n.enabled===!0,disabled:!n.available||t.isPending,describedBy:`autostart-summary`,onChange:e=>t.mutate(e)}),(0,h.jsxs)(`p`,{id:`autostart-summary`,className:`m-0 text-small text-ink-2`,children:[n.summary,n.enabled===!0&&n.where!==null?` Login entry: ${n.where}`:``]}),t.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:t.error.message})]})]})}function Hy({view:e}){return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(`p`,{className:`m-0 text-body`,children:(0,h.jsx)(`span`,{className:`font-semibold`,children:e.enabled===!0?`Starts with Docker: yes`:e.enabled===!1?`Starts with Docker: no`:`Starts with Docker: unknown`})}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.summary}),e.howTo===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.howTo}),e.checkedAt===null?null:(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Checked by the installer on `,lre(e.checkedAt),`.`]})]})}function dre(){let{view:e,turn:t,decline:n}=Vy();if(t.isSuccess&&e.data?.enabled===!0)return(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:`Slopify now starts when you log in. Change it any time in Settings → General.`});if(e.data?.kind===`docker`)return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(U,{title:By,info:`settings.autostart`}),(0,h.jsx)(`div`,{className:`mb-6`,children:(0,h.jsx)(Hy,{view:e.data})})]});if(e.data?.offer!==!0)return null;let r=t.error??n.error;return(0,h.jsxs)(`section`,{children:[(0,h.jsx)(U,{title:By,info:`settings.autostart`}),(0,h.jsx)(`p`,{className:`m-0 mb-3 text-small text-ink-2`,children:`Have Slopify ready whenever you open your bookmark, without starting it from a terminal.`}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,h.jsx)(z,{variant:`primary`,disabled:t.isPending||n.isPending,onClick:()=>t.mutate(!0),children:`Start when I log in`}),(0,h.jsx)(z,{variant:`quiet`,disabled:t.isPending||n.isPending,onClick:()=>n.mutate(),children:`No thanks`})]}),r===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-3 text-small text-danger`,children:r.message})]})}function fre(){let{api:e}=B(),t=Ha({select:e=>e.pathname}),{view:n,turn:r,decline:i}=Vy(),a=F(by(e)),o=F({queryKey:ey,queryFn:()=>iy(e)}),s=n.data?.offer===!0&&a.data?.seen===!0&&o.data?.show===!1&&t!==`/welcome`,c=r.isPending||i.isPending,l=r.error??i.error;return(0,h.jsx)(Qv,{open:s,onOpenChange:e=>{!e&&!c&&i.mutate()},title:`Start Slopify when you log in?`,description:`Have Slopify ready whenever you open your bookmark, without starting it from a terminal. Change it any time in Settings → General.`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{variant:`secondary`,disabled:c,onClick:()=>i.mutate(),children:`No thanks`}),(0,h.jsx)(z,{variant:`primary`,autoFocus:!0,disabled:c,onClick:()=>r.mutate(!0),children:`Start when I log in`})]}),children:l===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:l.message})})}function pre(){let{api:e}=B(),t=F({queryKey:Ly,queryFn:()=>zy(e),retry:!1,staleTime:1/0}).data?.kind;(0,m.useEffect)(()=>{t!==void 0&&_o(t)},[t])}var Uy=`00000000-0000-4000-8000-000000000001`,Wy=[`character`,`creature`,`place`,`object`],Gy={character:`Character`,creature:`Creature`,place:`Place`,object:`Object`},Ky=[`channels`],qy=e=>[`channels`,e],Jy=e=>`${e.origin}/api/channels`,Yy=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)});function Xy(e){return ot({queryKey:Ky,queryFn:async()=>(await L(await e.fetch(Jy(e)))).channels})}function Zy(e,t){return ot({queryKey:qy(t),queryFn:async()=>L(await e.fetch(`${Jy(e)}/${t}`)),refetchInterval:e=>e.state.data?.cast.some(e=>e.images.some(e=>e.state===`generating`))?3e3:!1})}async function mre(e,t,n){return L(await e.fetch(Jy(e),Yy(`POST`,{id:t,name:n})))}async function Qy(e,t,n){return L(await e.fetch(`${Jy(e)}/${t}`,Yy(`PUT`,n)))}async function $y(e,t){let n=await e.fetch(`${Jy(e)}/${t}`,{method:`DELETE`});n.ok||await L(n)}async function eb(e,t,n,r){return L(await e.fetch(`${Jy(e)}/${t}/cast`,Yy(`POST`,{id:n,...r})))}async function hre(e,t,n){return L(await e.fetch(`${Jy(e)}/cast/${t}`,Yy(`PUT`,n)))}async function gre(e,t){let n=await e.fetch(`${Jy(e)}/cast/${t}`,{method:`DELETE`});n.ok||await L(n)}async function _re(e,t,n,r){return(await L(await e.fetch(`${Jy(e)}/${t}/cast/move`,Yy(`POST`,{memberId:n,to:r})))).cast}async function vre(e,t,n){return L(await e.fetch(`${Jy(e)}/cast/${t}/images`,{method:`POST`,headers:{"content-type":n.type||`application/octet-stream`},body:n}))}async function yre(e,t,n){return L(await e.fetch(`${Jy(e)}/cast/${t}/generate`,Yy(`POST`,n)))}async function bre(e,t,n){let r=await e.fetch(`${Jy(e)}/cast/${t}/images/${n}`,{method:`DELETE`});r.ok||await L(r)}async function xre(e,t,n){await L(await e.fetch(`${Jy(e)}/templates/${t}`,Yy(`PUT`,{channelId:n})))}async function Sre(e,t,n){return L(await e.fetch(`${Jy(e)}/${t}/ai-disclosure`,Yy(`PUT`,{aiDisclosure:n})))}function tb(e,t){return`${Jy(e)}/pictures/${t}`}var nb=`slopify.channel`,rb=(0,m.createContext)(void 0);function ib(){try{let e=window.localStorage.getItem(nb);return e===null||e===``?null:e}catch{return null}}function Cre({children:e}){let{api:t}=B(),n=F(Xy(t)),[r,i]=(0,m.useState)(ib),a=n.data??[],o=r!==null&&n.data!==void 0&&!a.some(e=>e.id===r)?null:r;(0,m.useEffect)(()=>{let e=e=>{(e.key===nb||e.key===null)&&i(ib())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let s=(0,m.useCallback)(e=>{i(e);try{e===null?window.localStorage.removeItem(nb):window.localStorage.setItem(nb,e)}catch{}},[]),c=(0,m.useMemo)(()=>({channelId:o,channel:a.find(e=>e.id===o),channels:a,setChannelId:s,includes:e=>o===null||e===o}),[o,a,s]);return(0,h.jsx)(rb,{value:c,children:e})}var wre={channelId:null,channel:void 0,channels:[],setChannelId:()=>{},includes:()=>!0};function ab(){return(0,m.useContext)(rb)??wre}function ob({className:e}){let t=ab(),n=(0,m.useId)();return(0,h.jsxs)(`div`,{className:R(`flex flex-col gap-1`,e),...Py,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1 px-2`,children:[(0,h.jsx)(`label`,{htmlFor:n,className:`sl-kicker`,children:`Channel`}),(0,h.jsx)(H,{id:`planning.channel.current`,className:`-my-1`})]}),(0,h.jsxs)(`select`,{id:n,className:`sl-select`,value:t.channelId??``,onChange:e=>t.setChannelId(e.target.value===``?null:e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`All channels`}),t.channels.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})}var Tre=1500,Ere=2e4,Dre=4e3;function Ore(e){return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}}function kre(){return typeof navigator>`u`||navigator.onLine!==!1}function Are(e){let t=(0,m.useSyncExternalStore)(Ore,kre,()=>!0),[n,r]=(0,m.useState)(`live`),i=(0,m.useRef)(!1);i.current=n!==`live`&&n!==`back`;let a=!t||e===`lost`;return(0,m.useEffect)(()=>{if(!t){r(`offline`);return}if(e===`lost`){let e=setTimeout(()=>r(`reconnecting`),Tre),t=setTimeout(()=>r(`unreachable`),Ere);return()=>{clearTimeout(e),clearTimeout(t)}}if(!i.current){r(e=>e===`back`?e:`live`);return}r(`back`);let n=setTimeout(()=>r(`live`),Dre);return()=>clearTimeout(n)},[t,e]),a&&n===`back`?`live`:n}var jre={reconnecting:`Reconnecting… Numbers on this page may be out of date.`,unreachable:`Can't reach Slopify, so numbers on this page may be out of date. Check that Slopify is still running; this page reconnects by itself.`,offline:`Offline. Numbers on this page may be out of date until the connection is back.`,back:`Back online. The page is up to date.`};function Mre({connection:e}){let t=Are(e),n=t===`back`?Ol:t===`reconnecting`?ml:Rc;return(0,h.jsx)(`div`,{"aria-live":`polite`,className:`sl-connection-slot`,children:t===`live`?null:(0,h.jsxs)(`p`,{"data-view":t,className:R(`sl-connection sl-enter`,t!==`back`&&`sl-connection--down`),children:[(0,h.jsx)(n,{"aria-hidden":`true`,strokeWidth:1.75}),jre[t]]})})}var Nre=class{commands=new Map;listeners=new Set;version=0;snapshot=[];register(e){return this.commands.set(e.id,e),this.changed(),()=>{this.commands.get(e.id)===e&&(this.commands.delete(e.id),this.changed())}}list(){return this.snapshot}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.version;changed(){this.version+=1,this.snapshot=[...this.commands.values()];for(let e of this.listeners)e()}},sb=(0,m.createContext)(void 0);function cb(e){let t=(0,m.useContext)(sb),n=(0,m.useRef)(e);n.current=e;let{id:r,title:i,group:a,context:o,searchOnly:s}=e,c=e.keywords?.join(`\0`),l=e.shortcut?.join(`\0`),u=e.numbered!==void 0,d=t?.registry;(0,m.useEffect)(()=>{if(d===void 0)return;let{icon:e}=n.current;return d.register({id:r,title:i,group:a,...o===void 0?{}:{context:o},...c===void 0?{}:{keywords:c.split(`\0`)},...e===void 0?{}:{icon:e},...l===void 0?{}:{shortcut:l.split(`\0`)},...u?{numbered:e=>n.current.numbered?.(e)??i}:{},...s===!0?{searchOnly:!0}:{},run:e=>n.current.run(e)})},[d,r,i,a,o,c,l,u,s])}function lb(e,t){let n=[`/`];return cb({id:`list.search`,title:`Search ${t}`,group:`This page`,keywords:[`find`,`filter`],shortcut:n,run:()=>{e.current?.focus(),e.current?.select()}}),n}function ub(){return(0,m.useContext)(sb)??{open:!1,setOpen:Pre}}function Pre(){}function Fre(e,t){let n=e.trim().toLowerCase();if(n===``)return 0;let r=t.toLowerCase(),i=0,a=0,o=-2;for(let e of n){if(e===` `)continue;let t=r.indexOf(e,a);if(t===-1)return null;i+=1,t===o+1&&(i+=3),(t===0||/[\s\-_:/.]/.test(r[t-1]??``))&&(i+=4),i-=Math.min(t-a,5)*.1,o=t,a=t+1}return r.startsWith(n)||r.includes(` ${n}`)?i+=6:r.includes(n)&&(i+=3),i}function db(e){return[{text:e.title,bonus:2},...e.context===void 0?[]:[{text:e.context,bonus:1}],...(e.keywords??[]).map(e=>({text:e,bonus:0})),{text:e.group,bonus:0}]}function fb(e,t,n){let r=null;for(let i of t){let t=Fre(e,i.text);if(t===null)continue;let a=n&&i.text.toLowerCase().split(/[\s\-_:/.,&]+/).includes(e)?4:0,o=t+i.bonus+a;(r===null||o>r)&&(r=o)}return r}function pb(e,t){if(e.length===0)return 0;let n=fb(e.join(` `),t,!1);if(e.length===1)return n;let r=0;for(let i of e){let e=fb(i,t,!0);if(e===null)return n;r+=e}return n===null?r:Math.max(n,r)}function Ire(e,t){let n=t.trim()===``,r=t.trim().toLowerCase().split(/\s+/).filter(Boolean),i=r.find(e=>/^\d+$/.test(e)),a=[];return e.forEach((e,t)=>{if(n&&e.searchOnly===!0)return;let o=e.numbered;if(o!==void 0&&i!==void 0){let n=Number(i),s=r.indexOf(i),c=pb([...r.slice(0,s),...r.slice(s+1)],db(e));c!==null&&a.push({command:{...e,title:o(n),run:()=>e.run(n)},score:c,order:t});return}let s=pb(r,db(e));s!==null&&a.push({command:e,score:s,order:t})}),a.sort((e,t)=>{let r=Number(t.command.context!==void 0)-Number(e.command.context!==void 0);return n?r===0?e.order-t.order:r:t.score-e.score||r||e.order-t.order}),a.map(e=>e.command)}var mb=`slopify.palette.recent`,hb=5;function gb(){try{let e=JSON.parse(window.localStorage.getItem(mb)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,hb):[]}catch{return[]}}function Lre(e){try{let t=[e,...gb().filter(t=>t!==e)].slice(0,hb);window.localStorage.setItem(mb,JSON.stringify(t))}catch{}}var _b=`recent:`;function Rre(e,t,n,r){if(r.trim()!==``||n.length===0)return e;let i=new Map(t.map(e=>[e.id,e])),a=n.map(e=>i.get(e)).filter(e=>e!==void 0&&e.numbered===void 0).map(e=>({...e,id:`${_b}${e.id}`,group:`Recent`})),o=new Set(n);return[...a,...e.filter(e=>!o.has(e.id))]}var zre=new Set([`Ctrl`,`Alt`,`Shift`]);function vb(e){return{mod:e.includes(`Ctrl`),alt:e.includes(`Alt`),shift:e.includes(`Shift`),keys:e.filter(e=>!zre.has(e)).map(e=>e.toLowerCase())}}var yb=e=>!e.mod&&!e.alt&&!e.shift&&e.keys.length>1;function bb(e){if(e===void 0)return;let t=vb(e);if(yb(t)||t.keys.length!==1)return;let n=e.at(-1)??``,r=[...t.alt?[`Alt`]:[],...t.shift?[`Shift`]:[],n].join(`+`);return t.mod?`Control+${r} Meta+${r}`:r}function Bre(e,t,n){return e.mod!==(n.ctrlKey||n.metaKey)||e.alt!==n.altKey||/^[a-z0-9]$/.test(t)&&e.shift!==n.shiftKey?!1:n.key.toLowerCase()===t}function Vre(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?!0:e instanceof HTMLInputElement&&![`checkbox`,`radio`,`button`,`submit`,`reset`,`range`,`color`,`file`].includes(e.type):!1}var Hre=()=>document.querySelector(`[role="dialog"][data-state="open"], [role="alertdialog"]`)!==null;function xb(e){return e.map((e,t)=>({command:e,order:t})).filter(e=>e.command.shortcut!==void 0).sort((e,t)=>Number(t.command.context!==void 0)-Number(e.command.context!==void 0)||t.order-e.order).map(e=>e.command)}var Ure=1500;function Sb({children:e,registry:t}){let[n]=(0,m.useState)(()=>t??new Nre),[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)(!1),s=(0,m.useRef)(!1);s.current=r,(0,m.useEffect)(()=>n.register({id:`help.shortcuts`,title:`Show keyboard shortcuts`,group:`Help`,keywords:[`keys`,`keyboard`,`hotkeys`,`help`],shortcut:[`?`],run:()=>o(!0)}),[n]),(0,m.useEffect)(()=>{let e,t=t=>{if((t.ctrlKey||t.metaKey)&&!t.altKey&&t.key.toLowerCase()===`k`){t.preventDefault(),i(e=>!e);return}if(t.defaultPrevented||t.isComposing||s.current||Hre())return;let r=Vre(t.target),a=xb(n.list()),o=t.key.toLowerCase(),c=!t.ctrlKey&&!t.metaKey&&!t.altKey,l=n=>{t.preventDefault(),e=void 0,n.run()};if(e!==void 0&&c&&!r&&t.timeStamp-e.at<Ure){let t=e.key,n=a.find(e=>{let n=vb(e.shortcut??[]);return yb(n)&&n.keys[0]===t&&n.keys[1]===o});if(n!==void 0)return l(n)}e=void 0;let u=a.find(e=>{let n=vb(e.shortcut??[]);return yb(n)||n.keys.length!==1||r&&!n.mod?!1:Bre(n,n.keys[0]??``,t)});if(u!==void 0)return l(u);c&&!r&&!t.shiftKey&&a.some(e=>{let t=vb(e.shortcut??[]);return yb(t)&&t.keys[0]===o})&&(e={key:o,at:t.timeStamp})};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[n]);let c=(0,m.useMemo)(()=>({registry:n,open:r,setOpen:i}),[n,r]);return(0,h.jsxs)(sb.Provider,{value:c,children:[e,(0,h.jsx)(Tb,{}),(0,h.jsx)(wb,{registry:n,open:a,onOpenChange:o})]})}function Cb({shortcut:e}){let t=yb(vb(e));return(0,h.jsx)(`span`,{className:`sl-kbd`,children:e.map((e,n)=>(0,h.jsxs)(m.Fragment,{children:[t&&n>0?(0,h.jsx)(`span`,{className:`text-caption text-ink-3`,children:`then`}):null,(0,h.jsx)(`kbd`,{children:e})]},e))})}function wb({registry:e,open:t,onOpenChange:n}){(0,m.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot);let r=new Set,i=xb(e.list()).filter(e=>{let t=e.shortcut?.join(`+`)??``;return!r.has(t)&&(r.add(t),!0)}).toSorted((e,t)=>e.group.localeCompare(t.group)||e.title.localeCompare(t.title));return(0,h.jsx)(Qv,{open:t,onOpenChange:n,title:`Keyboard shortcuts`,description:`Ctrl works as Cmd on a Mac. Keys without Ctrl wait while you type in a field. A screen's own shortcuts are listed while it is open.`,children:(0,h.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] items-center gap-x-4 gap-y-2 text-small`,children:[{keys:[`Ctrl`,`K`],title:`Search or run a command`},{keys:[`Esc`],title:`Close a dialog, a drawer or the palette`},...i.map(e=>({keys:e.shortcut??[],title:e.title}))].map(e=>(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(`dt`,{children:(0,h.jsx)(Cb,{shortcut:e.keys})}),(0,h.jsx)(`dd`,{className:`m-0 min-w-0`,children:e.title})]},e.keys.join(`+`)))})})}function Tb(){let e=(0,m.useContext)(sb);return e===void 0?null:(0,h.jsx)(Km,{open:e.open,onOpenChange:e.setOpen,children:(0,h.jsxs)(Xm,{children:[(0,h.jsx)(Qm,{className:`sl-overlay`}),(0,h.jsxs)(nh,{className:`sl-overlay-content sl-palette sl-enter`,"aria-describedby":void 0,children:[(0,h.jsx)(sh,{className:`sr-only`,children:`Command palette`}),(0,h.jsx)(Eb,{registry:e.registry,close:()=>e.setOpen(!1)})]})]})})}function Eb({registry:e,close:t}){(0,m.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot);let n=e.list(),[r,i]=(0,m.useState)(``),[a,o]=(0,m.useState)(0),s=(0,m.useId)(),[c]=(0,m.useState)(gb),l=(0,m.useMemo)(()=>Rre(Ire(n,r),n,c,r),[n,r,c]),u=Math.min(a,Math.max(0,l.length-1)),d=(0,m.useRef)(null),f=(0,m.useMemo)(()=>{let e=new Map;return l.forEach((t,n)=>{let r=e.get(t.group)??[];r.push({command:t,index:n}),e.set(t.group,r)}),[...e.entries()]},[l]),p=e=>`${s}-option-${String(e)}`;(0,m.useEffect)(()=>{d.current?.querySelector(`[data-index="${String(u)}"]`)?.scrollIntoView?.({block:`nearest`})},[u]);let g=(0,m.useCallback)(e=>{e!==void 0&&(t(),e.numbered===void 0&&Lre(e.id.startsWith(_b)?e.id.slice(7):e.id),e.run())},[t]);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`sl-palette__input`,children:[(0,h.jsx)(_l,{"aria-hidden":`true`,strokeWidth:1.75}),(0,h.jsx)(`input`,{autoFocus:!0,role:`combobox`,"aria-expanded":`true`,"aria-controls":s,"aria-autocomplete":`list`,"aria-activedescendant":l.length===0?void 0:p(u),"aria-label":`Search or run a command`,placeholder:`Search or run a command`,value:r,onChange:e=>{i(e.target.value),o(0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),o(l.length===0?0:(u+1)%l.length)):e.key===`ArrowUp`?(e.preventDefault(),o(l.length===0?0:(u-1+l.length)%l.length)):e.key===`Home`?(e.preventDefault(),o(0)):e.key===`End`?(e.preventDefault(),o(Math.max(0,l.length-1))):e.key===`Enter`&&(e.preventDefault(),g(l[u]))}}),(0,h.jsx)(`span`,{className:`sl-kbd`,"aria-hidden":`true`,children:(0,h.jsx)(`kbd`,{children:`Esc`})})]}),(0,h.jsx)(`div`,{ref:d,id:s,role:`listbox`,"aria-label":`Commands`,className:`sl-palette__list`,children:l.length===0?(0,h.jsx)(`p`,{className:`sl-palette__empty`,children:n.length===0?`No commands here yet.`:`Nothing matches "${r.trim()}". Try fewer letters or another word.`}):f.map(([e,t])=>(0,h.jsxs)(`div`,{role:`group`,"aria-label":e,className:`sl-palette__group`,children:[(0,h.jsx)(`div`,{className:`sl-kicker px-[10px] pb-1`,"aria-hidden":`true`,children:e}),t.map(({command:e,index:t})=>(0,h.jsxs)(`div`,{id:p(t),"data-index":t,role:`option`,tabIndex:-1,"aria-selected":t===u,className:`sl-palette__item`,onMouseMove:()=>{t!==u&&o(t)},onClick:()=>g(e),children:[e.icon,(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title}),e.context===void 0?null:(0,h.jsx)(`span`,{className:`sl-palette__meta`,children:e.context}),e.shortcut===void 0?null:(0,h.jsx)(Cb,{shortcut:e.shortcut})]},e.id))]},e))})]})}var Db=[`16:9`,`9:16`,`1:1`],Ob=[`research`,`article`,`audio`,`images`,`thumbnail`,`video`,`document`],kb=[`running`,`paused`,`canceled`,`failed`,`partial`,`done`,`pending`],Ab=[`generate`,`provide`,`off`,`from_prompt`,`prompt_by_llm`];function jb(e,t){return e[t]??`off`}var Mb=[`zoom`,`pan`,`mixed`,`still`],Nb=[`text`,`llm`];function Pb(e){if(e===`thumbnail:image`)return 1;let t=/^thumbnail:image:([23])$/.exec(e);return t===null?void 0:Number(t[1])}function Fb(e){return e.thumbnailCount===3&&(e.sources.thumbnail===`from_prompt`||e.sources.thumbnail===`prompt_by_llm`)?3:1}var Ib=[`prompt`,`provide`],Lb=[`video`,`short`],Rb=[`article`,`image`,`thumbnail`,`narration`,`description`,`shorts`,`review`,`script`],zb=[`intro`,`outro`],Bb=1e5,Vb=zb.map(e=>({value:e,label:Ub(e)})),Hb=Nb.map(e=>({value:e,label:Wb(e)}));function Ub(e){switch(e){case`intro`:return`Intro`;case`outro`:return`Outro`}}function Wb(e){switch(e){case`text`:return`Text`;case`llm`:return`LLM`}}function Gb(e){switch(e){case`text`:return`Text is narrated as written.`;case`llm`:return`LLM is an instruction whose answer is narrated.`}}function Kb(e){switch(e){case`text`:return`No slots. This text is narrated as written.`;case`llm`:return`No slots. This instruction runs as written.`}}function qb(e){return zb.find(t=>t===e)??`intro`}var Jb=Rb.map(e=>({value:e,label:Yb(e)}));function Yb(e){switch(e){case`article`:return`Article`;case`image`:return`Image`;case`thumbnail`:return`Thumbnail`;case`narration`:return`Narration Preparation`;case`description`:return`YouTube Description`;case`shorts`:return`Shorts`;case`review`:return`Review`;case`script`:return`Script (speakers)`}}function Xb(e){return Rb.find(t=>t===e)??`article`}function Zb(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Qb(e,t=`|`){return e.map(e=>_x(e)).join(t)}function $b(e,t){return typeof t==`bigint`?t.toString():t}function ex(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function tx(e){return e==null}function nx(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function rx(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function ix(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ax(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ox(e){return JSON.stringify(e)}function sx(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var cx=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function lx(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ux=ex(()=>{if(nS.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function dx(e){if(lx(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return lx(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function fx(e){return dx(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var px=new Set([`string`,`number`,`symbol`]);function mx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function hx(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function gx(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function _x(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function vx(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var yx={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function bx(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return hx(e,ax(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&ix(e,r,n.shape[r])}return ix(this,`shape`,e),e},checks:[]}))}function xx(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return hx(e,ax(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return ix(this,`shape`,r),r},checks:[]}))}function Sx(e,t){if(!dx(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return hx(e,ax(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ix(this,`shape`,n),n}}))}function Cx(e,t){if(!dx(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return hx(e,ax(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ix(this,`shape`,n),n}}))}function wx(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return hx(e,ax(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ix(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Tx(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return hx(t,ax(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ix(this,`shape`,i),i},checks:[]}))}function Ex(e,t,n){return hx(t,ax(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return ix(this,`shape`,i),i}}))}function Dx(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ox(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function kx(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ax(e){return typeof e==`string`?e:e?.message}function jx(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Mx(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Ax(e.inst?._zod.def?.error?.(e))??Ax(a?.(e))??Ax(t?.error?.(e))??Ax(n.customError?.(e))??Ax(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}var Nx=/[\uD800-\uDBFF]/;function Px(e){let t=e.length;if(!Nx.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Fx(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ix(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Lx(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Rx(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Vx(e,n,r.value)}}function zx(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Bx(e,t,n){return zx(e,t,n,!1)}function Vx(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:zx(this,t,n.bind(this))},set(e){zx(this,t,e)}})}function Hx(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ux,Wx=!1,Gx={configurable:!0,get(){Wx=!0}};function Kx(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ux!==e._zod){Ux=void 0;return}Ux=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Gx);let e=Wx;Wx=!1;try{let r=n(this);return Wx?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Wx||=e,r}catch(n){throw delete this[t],Wx||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function qx(e,t,n,r){let i=Hx(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Jx=`~constantCatch`;function Yx(e){let t=()=>e;return t[Jx]=!0,t}var Xx,Zx={value:void 0,enumerable:!1},Qx=`captureStackTrace`in Error?Error:null;function $x(e){let t=Qx;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Qx=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function W(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Zx.value=new a(r);try{Object.defineProperty(n,"_zod",Zx)}finally{Zx.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Rx(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?$x(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var eS=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},tS=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Xx=globalThis).__zod_globalConfig??(Xx.__zod_globalConfig={});var nS=globalThis.__zod_globalConfig;function rS(e){return e&&Object.assign(nS,e),nS}function iS(){let e=this._zod;return e.message??=JSON.stringify(e.def,$b,2),e.message}function aS(e){this._zod.message=e}var oS={get:iS,set:aS,enumerable:!0,configurable:!0},sS={value:void 0,enumerable:!1},cS={value:void 0,enumerable:!1},lS=new WeakSet([Object.prototype,Error.prototype]),uS=(e,t)=>{e.name=`$ZodError`,sS.value=e._zod,Object.defineProperty(e,"_zod",sS),cS.value=t,Object.defineProperty(e,"issues",cS),sS.value=void 0,cS.value=void 0,Object.defineProperty(e,"message",oS);let n=Object.getPrototypeOf(e);lS.has(n)||(lS.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},dS=W(`$ZodError`,uS),fS=W(`$ZodError`,uS,void 0,{Parent:Error});function pS(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function mS(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?pS(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function hS(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function gS(e,t){return{callee:t?.callee??e,Err:t?.Err}}var _S=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new eS;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Mx(e,o,rS())));throw cx(n,a?.callee??t),n}return s.value};return t},vS=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Mx(e,o,rS())));throw cx(n,a?.callee??t),n}return s.value};return t},yS=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new eS;return a.issues.length?{success:!1,error:new(e??dS)(a.issues.map(e=>Mx(e,i,rS())))}:{success:!0,data:a.value}},bS=yS(fS),xS=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Mx(e,i,rS())))}:{success:!0,data:a.value}},SS=xS(fS),CS=e=>{let t=_S(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,gS(n,a))};return n},wS=e=>{let t=_S(e),n=(e,r,i,a)=>t(e,r,i,gS(n,a));return n},TS=e=>{let t=vS(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,gS(n,a))};return n},ES=e=>{let t=vS(e),n=async(e,r,i,a)=>await t(e,r,i,gS(n,a));return n},DS=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return yS(e)(t,n,i)},OS=e=>(t,n,r)=>yS(e)(t,n,r),kS=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return xS(e)(t,n,i)},AS=e=>async(t,n,r)=>xS(e)(t,n,r),jS=/^[cC][0-9a-z]{6,}$/,MS=/^[0-9a-z]+$/,NS=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,PS=/^[0-9a-vA-V]{20}$/,FS=/^[A-Za-z0-9]{27}$/,IS=/^[a-zA-Z0-9_-]{21}$/;function LS(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var RS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zS=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,BS=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,VS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,HS=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function US(){return new RegExp(HS,`u`)}var WS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,GS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,KS=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,qS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,JS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,YS=/^[A-Za-z0-9_-]*$/,XS=/^https?$/,ZS=/^\+[1-9]\d{6,14}$/,QS=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function $S(e){return RegExp(`^${e}$`)}var eC=$S(QS);function tC(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function nC(e){return RegExp(`^${tC(e)}$`)}function rC(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${tC({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${tC({precision:e.precision})}`:n;return RegExp(`^${QS}T(?:${r})$`)}var iC=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},aC=/^-?\d+$/,oC=/^-?\d+(?:\.\d+)?$/,sC=/^(?:true|false)$/i,cC=/^null$/i,lC=/^[^A-Z]*$/,uC=/^[^a-z]*$/,dC=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),fC=e=>{let t=e.value;return!tx(t)&&t.length!==void 0},pC={number:`number`,bigint:`bigint`,object:`date`},mC=W(`$ZodCheckLessThan`,(e,t)=>{dC.init(e,t);let n=pC[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:pC[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hC=W(`$ZodCheckGreaterThan`,(e,t)=>{dC.init(e,t);let n=pC[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:pC[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),gC=W(`$ZodCheckMultipleOf`,(e,t)=>{dC.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):rx(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),_C=W(`$ZodCheckNumberFormat`,(e,t)=>{dC.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=yx[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=aC)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),vC=W(`$ZodCheckMaxLength`,(e,t)=>{var n;dC.init(e,t),(n=e._zod.def).when??(n.when=fC),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Px(r):i)<=t.maximum)return;let a=Fx(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wre=W(`$ZodCheckMinLength`,(e,t)=>{var n;dC.init(e,t),(n=e._zod.def).when??(n.when=fC),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Px(r):i)>=t.minimum)return;let a=Fx(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Gre=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;dC.init(e,t),(n=e._zod.def).when??(n.when=fC),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Px(r):i;if(a===t.length)return;let o=Fx(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),yC=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;dC.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Kre=W(`$ZodCheckRegex`,(e,t)=>{yC.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qre=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=lC,yC.init(e,t)}),Jre=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=uC,yC.init(e,t)}),Yre=W(`$ZodCheckIncludes`,(e,t)=>{dC.init(e,t);let n=mx(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Xre=W(`$ZodCheckStartsWith`,(e,t)=>{dC.init(e,t);let n=RegExp(`^${mx(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Zre=W(`$ZodCheckEndsWith`,(e,t)=>{dC.init(e,t);let n=RegExp(`.*${mx(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Qre=W(`$ZodCheckOverwrite`,(e,t)=>{dC.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),$re=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
53
53
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
@@ -157,7 +157,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
157
157
|
`)}function Sve({results:e}){return(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.map(e=>{let t=[...e.variants].sort((e,t)=>(t.share??0)-(e.share??0));return(0,h.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`div`,{className:`sl-row__title`,children:e.projectTitle}),(0,h.jsx)(`ol`,{className:`m-0 flex flex-col gap-1 pl-5 text-small`,children:t.map((e,t)=>(0,h.jsxs)(`li`,{className:t===0?`text-ink`:`text-ink-2`,children:[PL(e,t),e.share===null?``:` · ${String(e.share)}% of watch time`,t===0?` · winner`:``]},PL(e,t)))})]},`${e.projectId}-${String(e.short??0)}`)})})}function Cve(){let{api:e}=B(),t=Lv(),n=F({queryKey:[`studio`,`ab-results`],queryFn:()=>bs(e)}),r=n.data??[];return(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(`p`,{className:`m-0 flex-1 text-small text-ink-2`,children:`Finished A/B tests, as the Slopify Studio extension read them from YouTube Studio once a day. The winner is listed first.`}),(0,h.jsxs)(z,{type:`button`,variant:`secondary`,disabled:r.length===0,disabledReason:n.data===void 0?`The A/B results haven't loaded`:`No finished A/B tests yet`,onClick:()=>void navigator.clipboard?.writeText(xve(r)).then(()=>t(`Copied the notes. Paste them into the prompt that writes titles.`,`success`),()=>t(`Couldn't copy the notes. Select them and copy by hand.`,`error`)),children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,strokeWidth:1.75}),`Copy as prompt notes`]})]}),(0,h.jsx)(NL,{query:n,what:`The A/B results`,loading:(0,h.jsx)(AL,{label:`Loading the A/B results…`,rows:3,rowClassName:`h-14`}),children:e=>e.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`No finished A/B tests yet. Start one from a project's Video section (On YouTube → A/B test) or the extension; its result shows here once Studio has one.`}):(0,h.jsx)(Sve,{results:e})})]})}function wve(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e!==``)}function Tve({open:e,onOpenChange:t,schedules:n}){let{api:r}=B(),i=_(),a=Lv(),o=n.filter(e=>e.deletedAt===null&&(e.status===`active`||e.status===`paused`)),[s,c]=(0,m.useState)(``),[l,u]=(0,m.useState)(``),[d,f]=(0,m.useState)(void 0),p=o.find(e=>e.id===s)??o[0],g=wve(l),v=I({mutationFn:async e=>{let{id:t,...n}=e;return AT(r,t,{name:n.name,templateId:n.templateId,templateVersion:n.templateVersion,cadence:n.cadence,timezone:n.timezone,missedPolicy:n.missedPolicy,overlapPolicy:n.overlapPolicy,spendLimitCents:n.spendLimitCents,items:[...n.items,...g.map(e=>({title:e,values:{}}))],topicKeyword:n.topicKeyword,values:n.values,brief:n.brief,topicGeneration:n.topicGeneration,releases:n.releases,baseVersion:n.version,mutationId:crypto.randomUUID()})},onSuccess:(e,n)=>{if(!e.ok){f(e.reason===`conflict`?`${n.name} changed while you were typing. Your topics are kept: press Add to calendar again.`:e.message);return}a(`Added ${String(g.length)} ${g.length===1?`topic`:`topics`} to ${n.name}.`,`success`),u(``),f(void 0),t(!1)},onError:e=>f(`The topics weren't added: ${e.message} Your text is kept; try again.`),onSettled:async()=>{await Promise.all([i.invalidateQueries({queryKey:DT}),i.invalidateQueries({queryKey:BT})])}});return(0,h.jsx)(Qv,{open:e,onOpenChange:t,title:`Add to calendar`,description:`Each line becomes a topic at the end of the schedule's queue, so it takes that schedule's next free run.`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{variant:`secondary`,onClick:()=>t(!1),children:`Keep the calendar as it is`}),(0,h.jsx)(z,{variant:`primary`,disabled:p===void 0||g.length===0||v.isPending,disabledReason:p===void 0?`Create a schedule first.`:g.length===0?`Type at least one topic.`:`Adding…`,onClick:()=>{p!==void 0&&v.mutate(p)},children:g.length===0?`Add to calendar`:`Add ${String(g.length)} ${g.length===1?`topic`:`topics`}`})]}),children:o.length===0?(0,h.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`Topics go on a schedule, and there is none yet.`,` `,(0,h.jsx)(pa,{to:`/calendar`,search:{tab:`schedules`},onClick:()=>{zO(IO.newSchedule),t(!1)},children:`Create a schedule`}),` `,`first.`]}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(iL,{label:`Schedule`,tip:`planning.calendar.add-schedule`,help:p===void 0?void 0:(0,h.jsxs)(KO,{to:`/calendar`,search:{tab:`schedules`,schedule:p.id},onClick:()=>t(!1),children:[`Open `,p.name,` and its queue`]}),children:(0,h.jsx)(sL,{value:p?.id??``,onChange:e=>c(e.target.value),children:o.map(e=>(0,h.jsx)(`option`,{value:e.id,children:`${e.name} · ${String(e.items.length)} queued`},e.id))})}),(0,h.jsx)(iL,{label:`Topics, one per line`,error:d,tip:`planning.calendar.add-topics`,children:(0,h.jsx)(oL,{rows:8,value:l,placeholder:`Nefertiti
|
|
158
158
|
The Library of Alexandria
|
|
159
159
|
The Old Kingdom`,onChange:e=>u(e.target.value)})})]})})}var FL={running:{tone:`running`,word:`Running`},paused:{tone:`waiting`,word:`Paused`},pending:{tone:`off`,word:`Queued`},failed:{tone:`failed`,word:`Failed`},partial:{tone:`waiting`,word:`Done with problems`},done:{tone:`done`,word:`Done`},canceled:{tone:`off`,word:`Canceled`}},IL={tone:`done`,word:`Kept as is`},LL={pending:`Not started`,running:`Running`,done:`Done`,provided:`Provided`,failed:`Failed`,canceled:`Canceled`,skipped:`Off`},RL=`Waiting for your review`,zL=`Waiting to try again`,BL={active:{tone:`running`,word:`Active`},paused:{tone:`waiting`,word:`Paused`},completed:{tone:`done`,word:`Completed`},canceled:{tone:`off`,word:`Canceled`}};function VL(e,t=Eve){let n=e?.[0];if(e===void 0||n===void 0)return;let r=n.resetsAt===null?`checking again at ${t(n.retryAt)}`:`resets at ${t(n.resetsAt)}`;return`Waiting for ${HL(e)} limits (${r})`}function HL(e){let t=[...new Set(e.map(e=>e.name))];return t.length<=1?t[0]??``:`${t.slice(0,-1).join(`, `)} and ${t.at(-1)??``}`}function Eve(e){let t=new Date(e),n=t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});return t.toDateString()===new Date().toDateString()?n:`${t.toLocaleDateString(void 0,{weekday:`short`})} ${n}`}function UL(e,t){switch(e.needs){case`failed`:return{tone:`failed`,word:`Failed`,action:{kind:`open`,label:`Open to fix`}};case`paused`:return{tone:`waiting`,word:`Paused`,action:{kind:`open`,label:`Open to continue`}};case`review`:return{tone:`waiting`,word:RL,action:{kind:`open`,label:`Open to review`}};case void 0:}let n=VL(e.limitWaits,t);return n===void 0?e.readyToUpload===!0?{tone:`done`,word:`Ready to upload`,action:{kind:`upload`}}:FL[e.state]:{tone:`waiting`,word:n}}function Dve(e){let t=e.filter(e=>e.needs!==void 0).length,n=e.length-t;return[t===0?void 0:`${String(t)} waiting for you`,n===0?void 0:`${String(n)} ready to upload`].filter(e=>e!==void 0).join(` · `)}function Ove(e){return[...e.filter(e=>e.needs!==void 0),...e.filter(e=>e.needs===void 0&&e.readyToUpload===!0)]}var WL=`sl-hit`,GL=`sl-hit__target`;function KL({label:e,className:t,children:n}){return(0,h.jsx)(`ul`,{"aria-label":e,className:R(`sl-list m-0 list-none p-0`,t),children:n})}function qL({title:e,meta:t,lead:n,actions:r,selected:i=!1,onSelect:a,className:o,children:s}){return(0,h.jsxs)(`li`,{"data-selected":i?`true`:void 0,"aria-current":i?`true`:void 0,className:R(`sl-row`,WL,o),children:[(0,h.jsxs)(`div`,{className:`sl-row__lead`,children:[n,(0,h.jsxs)(`div`,{className:`sl-row__text`,children:[a===void 0?(0,h.jsx)(`span`,{className:`sl-row__title`,children:e}):(0,h.jsx)(JL,{onSelect:a,children:e}),t===void 0?null:(0,h.jsx)(`span`,{className:`sl-row__meta`,children:t})]})]}),r===void 0?null:(0,h.jsx)(`div`,{className:`sl-row__actions`,children:r}),s==null||s===!1?null:(0,h.jsx)(`div`,{className:`sl-row__body`,children:s})]})}function JL({onSelect:e,className:t,children:n}){return(0,h.jsx)(`button`,{type:`button`,onClick:e,className:R(`sl-row__title border-0 bg-transparent p-0 text-left font-[inherit] text-ink`,GL,t),children:n})}var YL=864e5;function XL(e){return`${String(e.getFullYear())}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function ZL(e){let t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+6)%7),t}function QL(e,t){let n=ZL(e);return Array.from({length:t},(e,t)=>Array.from({length:7},(e,r)=>{let i=new Date(n);return i.setDate(n.getDate()+t*7+r),i}))}function $L(e,t=new Date){let n=new Map,r=e=>{let t=new Date(e),r=XL(t),i=n.get(r);if(i===void 0){let e=new Date(t);e.setHours(0,0,0,0),i={key:r,date:e,runs:[],projects:[]},n.set(r,i)}return i},i=new Set(e.queued.map(e=>e.projectId));for(let n of e.projects)i.has(n.id)||r(n.finishedAt??t.toISOString()).projects.push(n);for(let t of e.runs)r(t.at).runs.push(t);return n}function eR(e,t){let n=ZL(e);return{from:n.toISOString(),to:new Date(n.valueOf()+t*7*YL+YL).toISOString()}}function tR(e,t,n){return e.index===null?{kind:`refused`,message:`This run has no queued topic to move: it will use ${e.topicSource===`held`?`a topic waiting for your approval`:e.topicSource===`generated`?`a topic Slopify suggests`:`the template as saved`}.`}:t===void 0?{kind:`refused`,message:`No run is planned on ${n}. Drop the topic on a day that has one, or change the schedule's days under Schedules.`}:t.scheduleId===e.scheduleId?t.index===null?{kind:`refused`,message:`The run on ${n} is past the end of ${e.scheduleName}'s queue. Drop the topic on a run that has one.`}:t.index===e.index?{kind:`none`}:{kind:`move`,scheduleId:e.scheduleId,baseVersion:e.scheduleVersion,from:e.index,to:t.index}:{kind:`transfer`,scheduleId:e.scheduleId,baseVersion:e.scheduleVersion,index:e.index,targetId:t.scheduleId,position:t.index??void 0}}function nR(e,t,n){if(t.index===null)return;let r=t.index+n;return e.find(e=>e.scheduleId===t.scheduleId&&e.index===r)}function rR(e){return e.renderedTitle!==null&&e.renderedTitle.trim()!==``?e.renderedTitle:e.topic??(e.topicSource===`held`?`A topic waiting for your approval`:e.topicSource===`generated`?`A topic Slopify will suggest`:`The template as saved`)}var iR=new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`}),aR=new Intl.DateTimeFormat(void 0,{dateStyle:`full`}),oR=new Intl.DateTimeFormat(void 0,{timeStyle:`short`});function sR({date:e,today:t,day:n,dragging:r,busy:i,onDragStart:a,onDragEnd:o,onDrop:s,onStep:c}){let[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(!1),p=n?.runs??[],g=n?.projects??[],_=d?g:g.slice(0,cR),v=()=>p.find(e=>e.scheduleId===r?.scheduleId)??p[0];return(0,h.jsxs)(`section`,{"aria-label":aR.format(e),className:R(`sl-cal-day`,t&&`sl-cal-day--today`,l&&`sl-cal-day--over`),onDragOver:e=>{r!==null&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,u(!0))},onDragLeave:()=>u(!1),onDrop:e=>{e.preventDefault(),u(!1),s(v())},children:[(0,h.jsx)(`div`,{className:`sl-kicker`,children:t?`Today · ${iR.format(e)}`:iR.format(e)}),p.map(e=>(0,h.jsx)(lR,{run:e,busy:i,onDragStart:a,onDragEnd:o,onDrop:t=>{t.preventDefault(),t.stopPropagation(),u(!1),s(e)},onStep:c},`${e.scheduleId}-${e.at}`)),_.map(e=>{let t=UL(e);return(0,h.jsxs)(`div`,{className:`sl-cal-item sl-cal-item--project ${WL}`,children:[(0,h.jsx)(pa,{to:`/projects/$projectId`,params:{projectId:e.id},className:`text-small font-semibold ${GL}`,children:e.title}),(0,h.jsx)(tk,{tone:t.tone,children:t.word})]},e.id)}),g.length>cR?(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-expanded":d,className:`self-start`,onClick:()=>f(e=>!e),children:d?`Show fewer`:`+${String(g.length-cR)} more`}):null]})}var cR=3;function lR({run:e,busy:t,onDragStart:n,onDragEnd:r,onDrop:i,onStep:a}){let o=e.index!==null&&!t,s=rR(e);return(0,h.jsxs)(`article`,{tabIndex:e.index===null?void 0:0,"aria-label":`${s}, ${oR.format(new Date(e.at))}, ${e.scheduleName}${e.index===null?``:`. Alt+arrow keys move it.`}`,draggable:o,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,s),n(e)},onDragEnd:r,onDragOver:e=>e.preventDefault(),onDrop:i,onKeyDown:t=>{o&&t.altKey&&(t.key===`ArrowLeft`||t.key===`ArrowUp`?(t.preventDefault(),a(e,-1)):(t.key===`ArrowRight`||t.key===`ArrowDown`)&&(t.preventDefault(),a(e,1)))},title:o?`Drag to another day, or press Alt+arrow keys`:void 0,className:R(`sl-cal-item`,o&&`sl-cal-item--movable`),children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1 text-label text-ink-3 tabular-nums`,children:[e.index===null?null:(0,h.jsx)(Yc,{"aria-hidden":`true`,strokeWidth:1.75,className:`size-3 shrink-0 text-ink-3`}),oR.format(new Date(e.at))]}),(0,h.jsx)(`b`,{className:R(`text-small`,e.topic===null&&`font-normal text-ink-2`),children:s}),(0,h.jsx)(KO,{to:`/calendar`,search:{tab:`schedules`,schedule:e.scheduleId},className:`self-start text-label`,draggable:!1,children:e.scheduleName}),e.paused?(0,h.jsx)(tk,{tone:`waiting`,children:`Paused`}):e.topicSource===`held`?(0,h.jsx)(tk,{tone:`info`,children:`Needs a topic`}):e.prepared===null?(0,h.jsx)(tk,{tone:`off`,children:`Queued`}):(0,h.jsx)(tk,{tone:`info`,children:`Prepared`}),(0,h.jsx)(uR,{run:e,compact:!0})]})}function uR({run:e,compact:t=!1}){let{api:n}=B(),r=_(),[i,a]=(0,m.useState)(),o=I({mutationFn:async()=>{if(e.topic===null)throw Error(`This run has no topic to prepare yet.`);let t=await ace(n,e.scheduleId,e.topic);if(!t.ok)throw Error(t.message);return t.value},onSuccess:()=>{a(void 0),r.invalidateQueries({queryKey:BT}),r.invalidateQueries({queryKey:[`projects`]})},onError:e=>a(e.message)});return e.prepared===null?e.index===null||e.topic===null||e.topicSource!==`queued`?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{size:`small`,variant:t?`quiet`:`secondary`,disabled:o.isPending,onClick:e=>{e.stopPropagation(),o.mutate()},children:o.isPending?`Preparing…`:`Prepare`}),i===void 0?null:(0,h.jsx)(`span`,{role:`alert`,className:`text-label text-danger`,children:i})]}):(0,h.jsx)(GO,{to:`/projects/$projectId`,params:{projectId:e.prepared},size:`small`,variant:`quiet`,children:t?`Open`:`Open prepared`})}var dR=`https://www.youtube.com/upload`,fR=[`video`,`title`,`description`,`thumbnails`,`playlist`,`audience`,`altered`,`tags`,`schedule`];function pR(e){return e.join(`, `)}var mR=5e3,hR=[`Write a YouTube description for this video.`,``,`- Summary: a 2-3 sentence hook that says what the viewer gets from watching, in plain words, without clickbait.`,`- Chapters: split the video where the topic changes, 5-12 chapters for a long video and fewer for a short one. Chapter titles are 2-6 words, in title case, and name what that part covers.`,`- Hashtags: 3-5 hashtags about the subject, most specific last.`,`- Tags: 15-25 search terms a viewer might type to find this video, from broad to specific.`].join(`
|
|
160
|
-
`),gR=`Built-in`,_R=/[<>]/;function vR(e){let t=e.trim();if(t.length>100)return`YouTube takes titles of up to 100 characters; this one has ${String(t.length)}. Shorten it.`;if(_R.test(t))return`YouTube doesn't allow < or > in a title. Remove them.`}function yR(e){if(e.length>5e3)return`YouTube takes descriptions of up to ${mR.toLocaleString(`en-US`)} characters; this one has ${e.length.toLocaleString(`en-US`)}. Shorten it.`;if(_R.test(e))return`YouTube doesn't allow < or > in a description. Remove them.`}function bR(e){let t=e.split(/\s+/u).filter(e=>e.startsWith(`#`)&&e.length>1).length;if(t!==0)return t>60?`${String(t)} hashtags: YouTube ignores every hashtag when there are more than 60. Remove ${String(t-60)}.`:`${String(t)} hashtag${t===1?``:`s`}; the first ${String(Math.min(t,3))} show above the title.`}var xR={info:`text-ink-2`,error:`text-danger`,warning:`text-waiting`,success:`text-accent-ink`};function SR({children:e,tone:t=`info`,className:n,id:r}){let i=typeof e==`string`?e:void 0;return(0,h.jsx)(`div`,{id:r,"data-slot":`status-slot`,role:t===`error`?`alert`:`status`,title:i,className:R(`flex min-h-8 min-w-0 flex-1 items-center gap-2 overflow-hidden text-small`,xR[t],n),children:e==null||e===!1?null:i===void 0?e:(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:i})})}function CR({status:e,children:t,className:n}){return(0,h.jsxs)(`div`,{"data-slot":`action-bar`,className:R(`sticky bottom-0 z-20 -mx-4 mt-6 flex min-h-14 flex-wrap items-center gap-x-3 gap-y-2 border-t border-line bg-surface px-4 py-2 pb-[max(8px,env(safe-area-inset-bottom))] max-md:bottom-[calc(48px+max(12px,env(safe-area-inset-bottom)))] md:-mx-10 md:px-10`,n),children:[(0,h.jsx)(`div`,{className:`flex w-full min-w-0 sm:w-auto sm:flex-1`,children:e??(0,h.jsx)(SR,{})}),(0,h.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:t})]})}var wR=[.75,1,1.25,1.5,1.75,2],TR=`slopify.playback`,ER={volume:1,muted:!1,rate:1};function DR(){try{let e=window.localStorage.getItem(TR);if(e===null)return ER;let t=JSON.parse(e);if(typeof t!=`object`||!t)return ER;let{volume:n,muted:r,rate:i}=t;return{volume:typeof n==`number`&&n>=0&&n<=1?n:1,muted:r===!0,rate:typeof i==`number`&&wR.some(e=>e===i)?i:1}}catch{return ER}}function OR(e){try{window.localStorage.setItem(TR,JSON.stringify({...DR(),...e}))}catch{}}var kR=null;function AR(e){kR!==null&&kR!==e&&!kR.paused&&kR.pause(),kR=e}function jR(e){kR===e&&(kR=null)}function MR(e,t){e.volume=t.volume,e.muted=t.muted,e.playbackRate=t.rate}function NR(e){let t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0,n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${String(n)}:${String(r).padStart(2,`0`)}:${i}`:`${String(r)}:${i}`}function PR(e){return`${String(e)}×`}function FR(e,t){return e.filter(e=>e.start<=t).at(-1)}function IR(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}var LR=(e,t,n)=>Math.min(n,Math.max(t,e));function RR(){let e=(0,m.useRef)(null),t=(0,m.useId)(),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(0),[o,s]=(0,m.useState)(0),[c,l]=(0,m.useState)(0),[u]=(0,m.useState)(DR),[d,f]=(0,m.useState)(u.volume),[p,h]=(0,m.useState)(u.muted),[g,_]=(0,m.useState)(u.rate);(0,m.useEffect)(()=>{let t=e.current;return t!==null&&MR(t,u),()=>{t!==null&&jR(t)}},[u]);let[v,y]=(0,m.useState)(!1),[b,x]=(0,m.useState)(null),[S,C]=(0,m.useState)(!1),w=Number.isFinite(o)&&o>0,T=()=>{let t=e.current;t!==null&&(t.paused||t.ended?t.play()?.catch(()=>void 0):t.pause())},E=t=>{let n=e.current;if(n===null||!w)return;let r=LR(t,0,o);n.currentTime=r,a(r)},D=t=>E((e.current?.currentTime??i)+t),O=t=>{let n=e.current;if(n===null)return;let r=LR(Math.round(t*100)/100,0,1);n.volume=r,n.muted=r===0,f(r),h(r===0),OR({volume:r,muted:r===0})},k=()=>{let t=e.current;t!==null&&(t.muted=!t.muted,h(t.muted),OR({muted:t.muted}))};return{media:e,menuId:t,playing:n,current:i,duration:o,buffered:c,known:w,volume:d,muted:p,rate:g,menu:v,setMenu:y,hover:b,setHover:x,seeking:S,setSeeking:C,toggle:T,seekTo:E,jump:D,setLevel:O,toggleMute:k,pickRate:n=>{let r=e.current;r!==null&&(r.playbackRate=n),_(n),OR({rate:n}),y(!1),document.getElementById(`${t}-button`)?.focus()},keyAction:e=>{let t=e.length===1?e.toLowerCase():e;if(t===` `||t===`k`)return T;if(t===`j`)return()=>D(-10);if(t===`l`)return()=>D(10);if(t===`ArrowLeft`)return()=>D(-5);if(t===`ArrowRight`)return()=>D(5);if(t===`m`)return k;if(/^[0-9]$/.test(t))return()=>E(Number(t)/10*o)},events:{onPlay:e=>{AR(e.currentTarget),r(!0)},onPause:()=>r(!1),onEnded:()=>r(!1),onTimeUpdate:e=>{S||a(e.currentTarget.currentTime)},onDurationChange:e=>s(e.currentTarget.duration),onLoadedMetadata:e=>{s(e.currentTarget.duration),e.currentTarget.playbackRate=g},onProgress:e=>{let t=e.currentTarget.buffered;l(t.length>0?t.end(t.length-1):0)},onVolumeChange:e=>{f(e.currentTarget.volume),h(e.currentTarget.muted)},onRateChange:e=>_(e.currentTarget.playbackRate)}}}function zR(e,t){let n=e?.getBoundingClientRect();return n===void 0||n.width===0?0:LR((t-n.left)/n.width,0,1)}function BR(e,t){t!==void 0&&(e.preventDefault(),e.stopPropagation(),t())}function VR({controls:e,className:t}){return(0,h.jsx)(Nv,{size:`small`,label:e.playing?`Pause`:`Play`,className:t,onClick:e.toggle,children:e.playing?(0,h.jsx)(ll,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(fl,{"aria-hidden":`true`,strokeWidth:1.75})})}function HR({controls:e}){return(0,h.jsxs)(`span`,{className:`sl-player__time`,children:[(0,h.jsx)(`span`,{className:`sl-player__now`,children:NR(e.current)}),(0,h.jsx)(`span`,{className:`sl-player__total`,children:` / ${e.known?NR(e.duration):`-:--`}`})]})}function UR({controls:e,chapters:t=[],waveform:n}){let r=(0,m.useRef)(null),{known:i,duration:a,current:o,buffered:s,seeking:c,hover:l}=e,u=JR(r),d=n===void 0?void 0:qR(n,u),f=i?t.filter(e=>e.start>0&&e.start<a):[],p=t=>{i&&(t.currentTarget.setPointerCapture?.(t.pointerId),e.setSeeking(!0),e.seekTo(zR(r.current,t.clientX)*a))},g=t=>{let n=zR(r.current,t.clientX);e.setHover(n),c&&e.seekTo(n*a)},_=t=>{t.currentTarget.releasePointerCapture?.(t.pointerId),e.setSeeking(!1)},v=t=>{BR(t,{ArrowLeft:()=>e.jump(-5),ArrowDown:()=>e.jump(-5),ArrowRight:()=>e.jump(5),ArrowUp:()=>e.jump(5),PageDown:()=>e.jump(-10),PageUp:()=>e.jump(10),Home:()=>e.seekTo(0),End:()=>e.seekTo(a)}[t.key])},y=i?o/a*100:0,b=i?s/a*100:0,x=l===null||!i?void 0:l*a,S=x===void 0?void 0:FR(t,x);return(0,h.jsxs)(`div`,{ref:r,role:`slider`,tabIndex:0,"aria-label":`Seek`,"aria-valuemin":0,"aria-valuemax":i?Math.floor(a):0,"aria-valuenow":Math.floor(o),"aria-valuetext":`${NR(o)} of ${i?NR(a):`unknown length`}`,"aria-disabled":!i,className:`sl-player__track`,onPointerDown:p,onPointerMove:g,onPointerUp:_,onPointerCancel:_,onPointerLeave:()=>e.setHover(null),onKeyDown:v,children:[d===void 0||d.length===0?(0,h.jsxs)(`span`,{className:`sl-player__rail`,children:[(0,h.jsx)(`span`,{className:`sl-player__buffered`,style:{width:`${String(b)}%`}}),(0,h.jsx)(`span`,{className:`sl-player__played`,style:{width:`${String(y)}%`}})]}):(0,h.jsx)(`span`,{className:`sl-player__wave`,"data-slot":`waveform`,"aria-hidden":`true`,children:d.map((e,t)=>(0,h.jsx)(`span`,{className:`sl-player__peak`,"data-played":(t+.5)/d.length*100<=y?``:void 0,style:{height:`${String(Math.max(12,Math.round(e*100)))}%`}},t))}),f.map(e=>(0,h.jsx)(`span`,{className:`sl-player__mark`,"data-chapter":e.title,title:e.title,style:{left:`${String(e.start/a*100)}%`}},`${String(e.start)}-${e.title}`)),(0,h.jsx)(`span`,{className:`sl-player__knob`,style:{left:`${String(y)}%`}}),x===void 0||l===null?null:(0,h.jsxs)(`span`,{className:`sl-player__tip`,"aria-hidden":`true`,style:{left:`${String(l*100)}%`},children:[S===void 0?null:(0,h.jsx)(`span`,{className:`sl-player__tip-title`,children:S.title}),NR(x)]})]})}function WR({controls:e}){let t=(0,m.useRef)(null),{muted:n,volume:r}=e,i=n?0:r;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Nv,{size:`small`,label:n?`Unmute`:`Mute`,"aria-pressed":n,className:`sl-player__mute`,onClick:e.toggleMute,children:n||r===0?(0,h.jsx)(Dl,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(El,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(`div`,{ref:t,role:`slider`,tabIndex:0,"aria-label":`Volume`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i*100),"aria-valuetext":n?`Muted`:`${String(Math.round(i*100))}%`,className:`sl-player__volume`,onPointerDown:n=>{n.currentTarget.setPointerCapture?.(n.pointerId),e.setLevel(zR(t.current,n.clientX))},onPointerMove:n=>{n.buttons===1&&e.setLevel(zR(t.current,n.clientX))},onKeyDown:t=>{let n={ArrowLeft:i-.05,ArrowDown:i-.05,ArrowRight:i+.05,ArrowUp:i+.05,Home:0,End:1}[t.key];BR(t,n===void 0?void 0:()=>e.setLevel(n))},children:(0,h.jsx)(`span`,{className:`sl-player__rail`,children:(0,h.jsx)(`span`,{className:`sl-player__played`,style:{width:`${String(i*100)}%`}})})})]})}function GR({controls:e}){let{menuId:t,menu:n,rate:r}=e;return(0,h.jsxs)(`span`,{className:`sl-player__speed`,children:[(0,h.jsx)(z,{id:`${t}-button`,variant:`quiet`,size:`small`,className:`sl-player__rate`,"aria-label":`Playback speed, ${PR(r)}`,"aria-haspopup":`menu`,"aria-expanded":n,"aria-controls":n?`${t}-menu`:void 0,onClick:()=>e.setMenu(e=>!e),children:PR(r)}),n?(0,h.jsx)(`div`,{id:`${t}-menu`,role:`menu`,"aria-label":`Playback speed`,className:`sl-player__menu`,onKeyDown:n=>{if(n.key===`Escape`){BR(n,()=>{e.setMenu(!1),document.getElementById(`${t}-button`)?.focus()});return}if(n.key!==`ArrowDown`&&n.key!==`ArrowUp`)return;let r=[...n.currentTarget.querySelectorAll(`[role=menuitemradio]`)],i=r[(r.indexOf(document.activeElement)+(n.key===`ArrowDown`?1:-1)+r.length)%r.length];BR(n,()=>i?.focus())},children:wR.map(t=>(0,h.jsx)(z,{variant:`quiet`,size:`small`,role:`menuitemradio`,"aria-checked":t===r,className:R(`sl-player__option`),autoFocus:t===r,onClick:()=>e.pickRate(t),children:t===1?`Normal`:PR(t)},t))}):null]})}var KR=4;function qR(e,t){let n=Math.floor(t/KR);if(n<=0||e.length<=n)return e;let r=[];for(let t=0;t<n;t+=1){let i=Math.floor(t*e.length/n),a=Math.max(i+1,Math.floor((t+1)*e.length/n));r.push(Math.max(...e.slice(i,a)))}return r}function JR(e){let[t,n]=(0,m.useState)(0);return(0,m.useEffect)(()=>{let t=e.current;if(t===null||(n(t.clientWidth),typeof ResizeObserver>`u`))return;let r=new ResizeObserver(()=>n(t.clientWidth));return r.observe(t),()=>r.disconnect()},[e]),t}var YR=2500;function XR({src:e,poster:t,label:n,portrait:r=!1,square:i=!1,captions:a,chapters:o=[],ref:s,className:c,children:l}){let u=RR(),d=u.media,f=(0,m.useRef)(null),p=(0,m.useRef)(void 0),[g,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(!1),[b,x]=(0,m.useState)(0),[S,C]=(0,m.useState)(!1),[w,T]=(0,m.useState)(!1),[E,D]=(0,m.useState)(!1),[O,k]=(0,m.useState)(!0),{playing:A,menu:j,seeking:M,hover:ee,events:N}=u,te=a!==void 0||b>0,P=typeof document<`u`&&`pictureInPictureEnabled`in document&&document.pictureInPictureEnabled===!0,ne=(0,m.useCallback)(()=>{k(!0),clearTimeout(p.current),p.current=setTimeout(()=>k(!1),YR)},[]);(0,m.useEffect)(()=>()=>clearTimeout(p.current),[]);let re=A&&!O&&!j&&!E&&!M&&ee===null;(0,m.useEffect)(()=>{let e=()=>C(document.fullscreenElement===f.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),(0,m.useEffect)(()=>{let e=d.current;if(e===null)return;let t=()=>T(!0),n=()=>T(!1);return e.addEventListener(`enterpictureinpicture`,t),e.addEventListener(`leavepictureinpicture`,n),()=>{e.removeEventListener(`enterpictureinpicture`,t),e.removeEventListener(`leavepictureinpicture`,n)}},[d]),(0,m.useEffect)(()=>{let e=d.current?.textTracks;if(e!==void 0)for(let t=0;t<e.length;t+=1){let n=e[t];n!==void 0&&(n.mode=v&&t===0?`showing`:`hidden`)}},[v,d]);let ie=()=>{let e=d.current;e!==null&&(e.paused||e.ended)&&_(!0),u.toggle()},ae=()=>{let e=f.current;e!==null&&(document.fullscreenElement===e?document.exitFullscreen?.():e.requestFullscreen?.()?.catch(()=>void 0))},oe=()=>{let e=d.current;e!==null&&(document.pictureInPictureElement===e?document.exitPictureInPicture?.().catch(()=>void 0):e.requestPictureInPicture?.().catch(()=>void 0))};return(0,h.jsxs)(`div`,{ref:f,"data-slot":`player`,"data-state":A?`playing`:`paused`,className:R(`sl-player`,r&&`sl-player--portrait`,i&&`sl-player--square`,re&&`sl-player--bare`,S&&`sl-player--full`,c),onKeyDown:e=>{if(e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.closest(`button`)!==null,n=e.key.length===1?e.key.toLowerCase():e.key,r=n===` `&&t?void 0:n===` `||n===`k`?ie:n===`f`?ae:n===`c`?te?()=>y(e=>!e):void 0:u.keyAction(n);r!==void 0&&(e.preventDefault(),e.stopPropagation(),ne(),r())},onPointerMove:ne,onPointerDown:ne,onFocus:()=>D(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(D(!1),u.setMenu(!1))},children:[(0,h.jsxs)(`video`,{ref:IR(d,s),src:e,poster:t,preload:`metadata`,playsInline:!0,"aria-label":n,onClick:ie,...N,onPlay:e=>{N.onPlay(e),_(!0),ne()},onPause:e=>{N.onPause(e),k(!0)},onEnded:e=>{N.onEnded(e),k(!0)},onLoadedMetadata:e=>{N.onLoadedMetadata(e),x(e.currentTarget.textTracks?.length??0)},children:[a===void 0?null:(0,h.jsx)(`track`,{kind:`captions`,src:a.src,srcLang:a.lang,label:a.label}),l]}),g?null:(0,h.jsx)(Nv,{label:`Play ${n}`,tip:!1,className:`sl-player__big`,onClick:ie,children:(0,h.jsx)(fl,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsxs)(`div`,{className:`sl-player__bar`,role:`group`,"aria-label":`${n} controls`,children:[(0,h.jsx)(VR,{controls:{...u,toggle:ie}}),(0,h.jsx)(HR,{controls:u}),(0,h.jsx)(UR,{controls:u,chapters:o}),(0,h.jsx)(WR,{controls:u}),(0,h.jsx)(GR,{controls:u}),te?(0,h.jsx)(Nv,{size:`small`,label:`Captions`,"aria-pressed":v,onClick:()=>y(e=>!e),children:(0,h.jsx)(kc,{"aria-hidden":`true`,strokeWidth:1.75})}):null,P?(0,h.jsx)(Nv,{size:`small`,label:`Picture in picture`,"aria-pressed":w,className:`sl-player__pip`,onClick:oe,children:(0,h.jsx)(dl,{"aria-hidden":`true`,strokeWidth:1.75})}):null,(0,h.jsx)(Nv,{size:`small`,label:S?`Exit full screen`:`Full screen`,"aria-pressed":S,onClick:ae,children:S?(0,h.jsx)(cl,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(ol,{"aria-hidden":`true`,strokeWidth:1.75})})]})]})}var ZR=[1,2,4];function QR(e,t){let n=ZR.indexOf(e);return ZR[Math.min(ZR.length-1,Math.max(0,n+t))]??1}function $R({src:e,alt:t,zoom:n,onZoom:r}){let[i,a]=(0,m.useState)({x:0,y:0}),o=(0,m.useRef)(null),s=n===1?{x:0,y:0}:i,c=e=>{n!==1&&(e.currentTarget.setPointerCapture?.(e.pointerId),o.current={x:e.clientX,y:e.clientY,from:s})},l=e=>{let t=o.current;t!==null&&a({x:t.from.x+(e.clientX-t.x)/n,y:t.from.y+(e.clientY-t.y)/n})},u=()=>{o.current=null};return(0,h.jsx)(`img`,{src:e,alt:t,draggable:!1,"data-zoom":n,className:n===1?`cursor-zoom-in`:`cursor-grab touch-none active:cursor-grabbing`,style:{transform:`scale(${String(n)}) translate(${String(s.x)}px, ${String(s.y)}px)`,transition:o.current===null?`transform 120ms ease-out`:`none`},onDoubleClick:()=>{a({x:0,y:0}),r(n===1?2:1)},onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u})}var ez={landscape:void 0,portrait:`sl-media__frame--portrait`,square:`sl-media__frame--square`};function tz({src:e,alt:t,kind:n=`image`,poster:r,aspect:i=`landscape`,title:a,meta:o,badge:s,actions:c,actionsShown:l=!1,generating:u,onOpen:d,openLabel:f,className:p}){let m=u==null||u===!1;return(0,h.jsxs)(`figure`,{className:R(`sl-media m-0`,p),"data-slot":`media-frame`,children:[(0,h.jsxs)(`div`,{className:R(`sl-media__frame`,ez[i]),children:[m&&e!==void 0?n===`video`?(0,h.jsx)(`video`,{src:e,poster:r,muted:!0,preload:`metadata`,"aria-label":t}):(0,h.jsx)(`img`,{src:e,alt:t,loading:`lazy`,decoding:`async`}):null,m?null:(0,h.jsxs)(`div`,{className:`sl-media__generating`,role:`status`,children:[(0,h.jsx)(ek,{tone:`running`}),(0,h.jsx)(`span`,{children:u})]}),s===void 0?null:(0,h.jsx)(`span`,{className:`sl-media__badge`,children:s}),c===void 0?null:(0,h.jsx)(`div`,{className:R(`sl-media__actions`,l&&`sl-media__actions--shown`),children:c})]}),d!==void 0&&m&&e!==void 0?(0,h.jsx)(`button`,{type:`button`,className:`sl-media__open`,"aria-label":f??`Open ${t} full size`,onClick:d}):null,a===void 0&&o===void 0?null:(0,h.jsxs)(`figcaption`,{className:`sl-media__caption`,children:[a===void 0?(0,h.jsx)(`span`,{}):(0,h.jsx)(`strong`,{className:`min-w-0 truncate`,children:a}),o===void 0?null:(0,h.jsx)(`span`,{className:`shrink-0`,children:o})]})]})}function nz({shorts:e=!1,density:t=`default`,list:n=!1,className:r,children:i,label:a}){let o=R(`sl-grid`,e&&`sl-grid--shorts`,t===`compact`&&`sl-grid--compact`,n&&`m-0 list-none p-0`,r);return n?(0,h.jsx)(`ul`,{"aria-label":a,className:o,"data-slot":`media-grid`,children:i}):(0,h.jsx)(`section`,{"aria-label":a,className:o,"data-slot":`media-grid`,children:i})}function rz({items:e,index:t,onIndex:n,onClose:r,actions:i}){let a=t===null?void 0:e[t],o=e.length,[s,c]=(0,m.useState)(1),l=a!==void 0&&a.kind!==`video`,u=e=>{t!==null&&o!==0&&(c(1),n((t+e+o)%o))};return(0,h.jsx)(Km,{open:a!==void 0,onOpenChange:e=>{e||(c(1),r())},children:(0,h.jsx)(Xm,{children:(0,h.jsx)(nh,{className:`sl-lightbox sl-enter`,onKeyDown:e=>{let t=e.key===`+`||e.key===`=`?1:e.key===`-`?-1:void 0;l&&t!==void 0?(e.preventDefault(),c(e=>QR(e,t))):l&&e.key===`0`?(e.preventDefault(),c(1)):e.key===`ArrowRight`?(e.preventDefault(),u(1)):e.key===`ArrowLeft`&&(e.preventDefault(),u(-1))},"aria-describedby":void 0,children:a===void 0||t===null?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`sl-lightbox__bar`,children:[(0,h.jsx)(sh,{className:`m-0 text-small font-semibold`,children:`${String(t+1)} of ${String(o)} · ${a.alt}`}),(0,h.jsxs)(`div`,{className:`sl-btn-row`,children:[i?.(a,t),l?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Nv,{label:`Zoom out`,disabled:s===1,onClick:()=>c(e=>QR(e,-1)),children:(0,h.jsx)(jl,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Nv,{label:`Zoom in${s===1?``:`, now ${String(s)}×`}`,disabled:s===4,onClick:()=>c(e=>QR(e,1)),children:(0,h.jsx)(Al,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Nv,{label:`Fit`,disabled:s===1,onClick:()=>c(1),children:(0,h.jsx)(al,{"aria-hidden":`true`,strokeWidth:1.75})})]}):null,(0,h.jsx)(Nv,{label:`Previous`,onClick:()=>u(-1),disabled:o<2,children:(0,h.jsx)(Mc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Nv,{label:`Next`,onClick:()=>u(1),disabled:o<2,children:(0,h.jsx)(Nc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(See,{asChild:!0,children:(0,h.jsx)(Nv,{label:`Close`,children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})})]})]}),(0,h.jsx)(`div`,{className:`sl-lightbox__stage`,children:a.kind===`video`?(0,h.jsx)(XR,{src:a.src,label:a.alt,className:`sl-lightbox__player`,...a.poster===void 0?{}:{poster:a.poster}},a.src):(0,h.jsx)($R,{src:a.src,alt:a.alt,zoom:s,onZoom:c},a.src)}),a.caption===void 0?(0,h.jsx)(`span`,{}):(0,h.jsx)(`p`,{className:`sl-lightbox__caption`,children:a.caption})]})})})})}var iz={location:tT(`docker-host`),path:G().min(1)},az=Yw([J({opened:tT(!0)}).strict(),J({opened:tT(!0),...iz}).strict(),J({opened:tT(!1),...iz}).strict()]),oz={catalogue:[`catalogue`],retired:[`catalogue`,`retired`],firstRun:[`first-run`]},sz={method:`POST`};async function cz(e,t,n){return L(await e.fetch(`${e.origin}/api/providers/${t}/key/test`,n===void 0?sz:{...sz,headers:{"content-type":`application/json`},body:JSON.stringify({key:n})}))}async function lz(e,t){let n=t===void 0?``:`?provider=${encodeURIComponent(t)}`;return L(await e.fetch(`${e.origin}/api/providers/health${n}`,sz))}async function uz(e){return L(await e.fetch(`${e.origin}/api/providers/catalogue`))}async function dz(e){return L(await e.fetch(`${e.origin}/api/providers/catalogue/check`,sz))}async function fz(e){return L(await e.fetch(`${e.origin}/api/providers/catalogue/refresh`,sz))}async function pz(e){return(await L(await e.fetch(`${e.origin}/api/providers/catalogue/retired`))).usages}async function mz(e,t){await L(await e.fetch(`${e.origin}/api/providers/catalogue/retired/switch`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({kind:t.kind,id:t.id,slot:t.slot,from:{provider:t.provider,model:t.model},to:t.replacement?.id??``})}))}async function hz(e){return L(await e.fetch(`${e.origin}/api/providers/catalogue/retired/switch-all`,sz))}async function gz(e){return L(await e.fetch(`${e.origin}/api/providers/first-run`))}async function _z(e){let t=await e.fetch(`${e.origin}/api/providers/first-run/dismiss`,sz);t.ok||await L(t)}function vz(e,t){let n=e.providers.find(e=>e.id===t.cli)?.checks.find(e=>e.label===`Signed in`);return n?.state===`ok`?`signed-in`:n?.state===`problem`?`signed-out`:`unknown`}function yz(e){return e.label.replace(/^Sign in to /,``)}async function bz(e){if(!navigator.clipboard)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function xz({fix:e,retry:t,variant:n=`primary`,size:r=`default`}){let{api:i}=B(),a=Lv(),o=yz(e),s=I({mutationFn:async()=>vz(await lz(i,e.cli),e),onSuccess:n=>{if(n===`signed-out`){a(`${o} is still signed out. Run ${e.command} in a terminal on the computer running Slopify, sign in, then press Check again.`,`error`);return}if(t===void 0){a(n===`signed-in`?`${o} is signed in.`:`Slopify couldn't tell whether ${o} is signed in. If ${e.command} finished without an error, try the step again.`,n===`signed-in`?`success`:`info`);return}a(`${o} is signed in. Trying again.`,`success`),t.run()},onError:e=>a(`Slopify couldn't check ${o}'s sign-in: ${e.message} Press Check again in a moment, or use Check all in Settings → Providers.`,`error`)}),c=async()=>{let t=await bz(e.command);a(t?`Copied ${e.command}. Paste it in a terminal on the computer running Slopify and sign in, then press Check again.`:`Couldn't copy: the browser blocked the clipboard. Type ${e.command} in a terminal on the computer running Slopify, sign in, then press Check again.`,t?`success`:`error`)};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{variant:n,size:r,onClick:()=>void c(),children:`Copy sign-in command`}),(0,h.jsx)(z,{variant:`secondary`,size:r,disabled:s.isPending||t?.busy===!0,disabledReason:`Checking the sign-in…`,onClick:()=>s.mutate(),children:s.isPending?`Checking…`:`Check again`})]})}function Sz({fix:e,retry:t,edit:n,variant:r=`primary`,size:i=`default`}){switch(e.kind){case`sign-in`:return(0,h.jsx)(xz,{fix:e,retry:t,variant:r,size:i});case`provider-settings`:return(0,h.jsx)(GO,{to:`/settings`,search:{section:`providers`},variant:r,size:i,children:e.label});case`free-space`:return(0,h.jsx)(GO,{to:`/settings`,search:{section:`storage`},variant:r,size:i,children:e.label});case`refused`:case`switch-model`:return n??null}}var Cz=Xw(`kind`,[J({kind:tT(`allAffected`)}).strict(),J({kind:tT(`selected`),workKeys:q(G().min(1).max(200)).min(1).max(1e4)}).strict()]),wz=G().min(1).max(64),Tz=J({baseRevisionId:wz,request:Cz}).strict(),Ez=J({baseRevisionId:wz,idempotencyKey:Uw(),previewId:G().min(1).max(64),acknowledgeUnknownCosts:Kw(),confirmedProvidedWorkKeys:q(G().min(1).max(200)).max(1e4)}).strict(),Dz=J({stage:G(),low:K().finite().nonnegative().nullable(),high:K().finite().nonnegative().nullable(),detail:G(),onPlan:Kw().optional(),apiLow:K().finite().nonnegative().nullable().optional(),apiHigh:K().finite().nonnegative().nullable().optional()}),Oz=J({currency:tT(`USD`),rows:q(Dz),low:K().finite().nonnegative(),high:K().finite().nonnegative(),unknown:K().int().nonnegative(),apiLow:K().finite().nonnegative().optional(),apiHigh:K().finite().nonnegative().optional(),apiUnknown:K().int().nonnegative().optional(),expectedWords:K().finite().nonnegative(),catalogueDate:G().nullable(),assumptions:q(G())}),kz=J({revisionId:wz,admissionId:G().min(1).max(64),workIds:q(G().min(1).max(64)),replayed:Kw()}),Az=J({id:G().min(1).max(64),projectId:G().min(1).max(64),baseRevisionId:wz,planFingerprint:G().min(1),selection:Cz,changedInputs:q(J({path:G(),before:G().nullable(),after:G().nullable()})),work:q(J({key:G(),stage:Y(Ob),kind:Y([`provider`,`local`,`provided`]),disposition:Y([`reuse`,`generate`,`local`,`review`,`blocked`]),requestFingerprint:G(),fingerprint:G(),dependsOn:q(G()),reason:G(),inflight:Kw(),pieceIds:q(G())})),retained:q(J({slot:G(),outputId:G(),assetId:G(),state:Y([`ready`,`outdated`,`review`])})),providedReuseRequired:q(G()),costs:Oz,wholeRequestNotice:G().nullable(),warnings:q(G()),review:J({inputChanges:q(J({label:G(),before:G().nullable(),after:G().nullable()})),requests:q(J({key:G(),label:G(),text:G().nullable(),settings:G().nullable()}))}).optional()}),jz=[`chapter`,`chunk`,`segment`,`image`,`prompt_written`,`article_written`],Mz=[`pending`,`running`,`done`,`failed`];J({id:G(),stage_id:G(),kind:Y(jz),idx:K(),state:Y(Mz),payload:G().nullable()});var Nz=`notes.article_md.article_txt.narration_txt.tts_script.sources.glossary.audio_body.audio_intro.audio_outro.audio_export.image.thumbnail.video.render_params.subtitles_srt.subtitles_vtt.subtitle_words.subtitle_ass.subtitle_font.instructions.document_pdf.youtube_description.youtube_tags.youtube_pinned_comment.youtube_titles.shorts.short_image.short_video.animated_image.figure_card.reference.script_md.audio_mp3.audio_m4b.audio_levelled`.split(`.`),Pz=[`copying`,`staged`],Fz=J({segment:Y([`body`,`intro`,`outro`]).optional(),subtitleOmissions:q(J({start:K().finite().nonnegative(),text:G()})).optional(),subtitlesMode:Y([`off`,`files`,`burn-in`]).optional(),promptName:G().optional(),prompt:G().optional(),index:K().optional(),short:K().optional(),format:Y([`16:9`,`9:16`,`1:1`]).optional(),sentences:Tse([K(),K()]).optional(),warnings:q(G()).optional(),provider:G().optional(),model:G().optional(),voice:G().optional(),loudness:J({pieces:K(),skipped:K(),spreadBefore:K(),spreadAfter:K(),target:K()}).optional(),master:J({target:K(),integrated:K(),truePeak:K()}).optional()}),Iz=J({id:G(),projectId:G(),stageKind:Y(Ob),role:Y(Nz),path:G(),originalFilename:G().nullable(),bytes:K().nonnegative(),durationMs:K().nonnegative().nullable(),meta:Fz,createdAt:G()});J({id:G(),stageKind:Y(Ob),path:G(),originalFilename:G(),bytes:K().nonnegative(),state:Y(Pz),createdAt:G()});var Lz=G().min(1).max(64).regex(/^[0-9A-Za-z_-]+$/),Rz=G().min(1).max(256),zz=Qw(Rz,Lz),Bz=J({id:Lz,text:G().trim().min(1).max(1e4),start:K().finite().nonnegative(),end:K().finite().positive(),speaker:G().min(1).max(60).regex(/^[a-z0-9-]+$/).optional()}).strict().refine(e=>e.end>e.start,{path:[`end`],message:`The end time must be after the start time.`}),Vz=J({from:K().int().positive().max(99),opening:G().min(1).max(2e4),closing:G().min(1).max(2e4),sentences:K().int().positive().max(1e4),title:G().max(200),description:G().max(5e3),hashtags:q(G().max(100)).max(30),why:G().max(2e3),seed:G().max(128).nullable().optional()}).strict(),Hz=J({articleMarkdown:G().max(5e5).optional(),articleEdited:Kw().default(!1),picturesArticle:G().max(5e5).optional(),provided:J({research:Lz.optional(),article:Lz.optional(),audio:Lz.optional(),thumbnail:Lz.optional(),reference:Lz.optional()}).strict(),imageOrder:q(Lz).max(240),imageDefinitions:Qw(Lz,J({source:Y([`generate`,`provide`]),assetId:Lz.nullable(),prompt:G().max(5e5).nullable(),templateKey:G().min(1).max(256).nullable().optional()}).strict()),narrationOverrides:Qw(Rz,Xw(`kind`,[J({kind:tT(`asset`),assetId:Lz}).strict(),J({kind:tT(`text`),text:G().trim().min(1).max(5e5),direction:G().trim().min(1).max(2e4).optional()}).strict()])),narrationSources:Qw(Rz,J({text:G().min(1).max(5e5),start:K().int().nonnegative().max(5e5),bodyFingerprint:G().regex(/^[0-9a-f]{64}$/u),chunkingFingerprint:G().regex(/^[0-9a-f]{64}$/u)}).strict()).refine(e=>Object.keys(e).length<=1e4&&Object.values(e).reduce((e,t)=>e+t.text.length,0)<=5e5,`Narration source bindings exceed the article limit.`).optional(),narrationAnchors:J({chunkingFingerprint:G().regex(/^[0-9a-f]{64}$/u),texts:q(G().min(1).max(5e5)).max(1e4)}).strict().refine(e=>e.texts.reduce((e,t)=>e+t.length,0)<=5e5,`Narration anchors exceed the article limit.`).optional(),subtitleCues:J({audioFingerprint:G().min(1),cues:q(Bz)}).strict().optional(),regenerationTokens:zz,promptTemplates:Qw(G().min(1),G().max(5e5).nullable()),shortsMusic:Lz.optional(),shortsRanges:Qw(G().regex(/^[1-9]\d?$/u),J({first:K().int().positive(),last:K().int().positive(),pick:G().min(1).max(128)}).strict()).optional(),shortsKeep:q(Vz).max(20).optional(),ambientBed:Lz.optional(),thumbnailOverrides:$w(Y([`1`,`2`,`3`]),Lz).optional()}).strict(),Uz=J({baseRevisionId:Lz,idempotencyKey:Lz,edit:J({config:oO.strict(),content:Hz,regenerate:q(Rz).optional(),uploads:q(J({stagedFileId:Lz,destination:Xw(`kind`,[J({kind:tT(`provided`),stage:Y([`audio`,`thumbnail`,`reference`])}).strict(),J({kind:tT(`image`),imageKey:Lz}).strict(),J({kind:tT(`narration`),key:Rz}).strict(),J({kind:tT(`shortsMusic`)}).strict(),J({kind:tT(`thumbnail`),variant:K().int().min(1).max(3)}).strict()])}).strict()).max(1e4).optional()}).strict()}).strict(),Wz=J({baseRevisionId:Lz,idempotencyKey:Lz,targetRevisionId:Lz}).strict(),Gz=J({id:Lz,projectId:Lz,parentId:Lz.nullable(),restoredFromId:Lz.nullable(),config:oO,content:Hz,fingerprints:Qw(Rz,G()),createdAt:G()}),Kz=J({id:Lz,stageId:Lz,kind:Y(jz),idx:K().int(),state:Y(Mz),payload:G().nullable()}),qz=J({slot:G(),workKey:Rz,assetId:Lz,output:Iz,fingerprint:G(),state:Y([`ready`,`outdated`,`review`])}),Jz=J({key:Rz,stageKind:Y(Ob),piece:Kz,assetId:Lz.nullable(),fingerprint:G()}),Yz={recordId:Lz,publicationId:Lz.nullable(),selected:Kw(),available:Kw()},Xz=J({articleMarkdown:G().nullable(),revision:Gz,outputs:q(qz.extend(Yz)),pieces:q(Jz.extend(Yz)),current:Kw()}),Zz=J({id:Lz,parentId:Lz.nullable(),restoredFromId:Lz.nullable(),title:G(),createdAt:G(),current:Kw()}),Qz=J({ok:tT(!0),view:Xz,duplicate:Kw()}),$z=J({ok:tT(!0),view:Xz,created:Kw()}),eB=J({title:G(),status:K(),detail:G().optional(),reason:G().optional(),currentRevisionId:G().nullable().optional(),fields:q(J({field:G(),message:G()})).optional(),errors:q(J({path:G(),message:G()})).optional()});async function tB(e,t){let n;try{n=await e.json()}catch{throw mo(e,void 0)}if(e.ok)return{ok:!0,value:Co(t,n)};let r=eB.safeParse(n);if(!r.success)throw mo(e,void 0);let i=r.data;if(![400,404,409].includes(e.status))throw mo(e,{title:i.title,status:i.status,...i.detail===void 0?{}:{detail:i.detail},...i.fields===void 0?{}:{fields:i.fields}});return{ok:!1,reason:i.reason??`invalid-request`,message:i.detail??i.title,currentRevisionId:i.currentRevisionId??null,fields:i.fields??i.errors?.map(e=>({field:e.path,message:e.message}))??[]}}async function nB(e,t,n,r,i){return tB(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}${n}`,i===void 0?{method:`GET`}:{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(i)}),r)}function rB(e,t){return nB(e,t,`/revisions/prepare`,$z,{})}function iB(e,t,n){return nB(e,t,`/revisions`,Qz,Uz.parse(n))}function aB(e,t,n){return nB(e,t,`/revisions/restore`,Qz,Wz.parse(n))}function oB(e,t){return nB(e,t,`/revisions`,J({revisions:q(Zz)}))}function sB(e,t,n){return nB(e,t,`/revisions/${encodeURIComponent(n)}`,J({view:Xz}))}var cB=q(G()).readonly();function lB(e,t,n){return nB(e,t,`/revisions/${encodeURIComponent(n)}/narration-chunks`,J({chunks:J({intro:cB.optional(),body:cB.optional(),outro:cB.optional()}).nullable()}))}function uB(e,t,n){return nB(e,t,`/rebuild/preview`,J({ok:tT(!0),value:Az}),Tz.parse(n))}function dB(e,t,n){return nB(e,t,`/rebuild`,J({ok:tT(!0),value:kz}),Ez.parse(n))}function fB(e,t,n,r){return`${e.origin}/files/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/${encodeURIComponent(r)}`}async function pB(e,t,n,r){let i=await tB(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/${encodeURIComponent(r)}/open-folder`,{method:`POST`}),az);if(!i.ok)throw Error(i.message);return i.value}function mB(e,t,n){return fB(e,t,n,`images.zip`)}async function hB(e,{projectId:t,asset:n,folder:r=null}){if(r)return pB(e,t,r.revisionId,r.recordId);let i=await e.client.projects[`:id`][`open-folder`].$post({param:{id:t},json:{asset:n}});if(!i.ok)throw mo(i,await ho(i));return az.parse(await i.json())}var gB=`Slopify runs in Docker, which can't open windows on your desktop. Copy this path into your file manager. To have Open folder open it directly, run the Docker launcher again (npx @gentbajko/slopify@latest --docker) so it sets up the host helper.`;function _B(e){return(0,h.jsx)(vB,{...e},JSON.stringify([e.projectId,e.asset,e.folder?.revisionId,e.folder?.recordId]))}function vB(e){let{api:t}=B(),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(),[o,s]=(0,m.useState)();async function c(){r(!0),a(void 0),s(void 0);try{let n=await hB(t,e);n.opened||s(n.path)}catch(e){a(e instanceof Error?e.message:`The folder couldn't be opened. Press Open folder to try again.`)}finally{r(!1)}}return(0,h.jsxs)(jy,{open:o!==void 0||i!==void 0,onOpenChange:e=>{e||(s(void 0),a(void 0))},children:[(0,h.jsx)(ire,{asChild:!0,children:(0,h.jsxs)(z,{variant:`secondary`,size:e.size??`default`,disabled:n,onClick:()=>void c(),title:`Locate the saved output folder on the machine running Slopify`,children:[(0,h.jsx)(Jc,{"aria-hidden":`true`,strokeWidth:1.75}),n?`Locating…`:o?`Locate folder`:`Open folder`]})}),(0,h.jsxs)(Ny,{className:`flex flex-col gap-2`,children:[o===void 0?null:(0,h.jsxs)(`div`,{role:`status`,className:`flex min-w-0 flex-col gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`p`,{className:`m-0`,children:gB}),(0,h.jsx)(`input`,{"aria-label":`Saved folder path`,readOnly:!0,value:o,onFocus:e=>e.currentTarget.select(),className:`sl-input w-full min-w-0 font-mono text-small`}),(0,h.jsx)(yB,{path:o})]}),i===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:i})]})]})}function yB({path:e}){let[t,n]=(0,m.useState)();return(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(z,{variant:`secondary`,size:`small`,onClick:()=>void bz(e).then(n),children:`Copy path`}),t===void 0?null:(0,h.jsx)(`span`,{role:`status`,className:`text-small text-ink-2`,children:t?`Copied.`:`The browser blocked copying. Select the path and copy it.`})]})}var bB={chrome:`Chrome, Edge, Brave`,firefox:`Firefox`};function xB(){return typeof navigator<`u`&&/firefox/i.test(navigator.userAgent)?`firefox`:`chrome`}function SB(){let{api:e}=B(),[t,n]=(0,m.useState)(xB),r=`slopify-studio-${t}.zip`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(Iy,{label:`Browser`,value:t,onChange:n,tip:`settings.studio.install`,options:[`chrome`,`firefox`].map(e=>({value:e,label:bB[e]}))}),(0,h.jsxs)(qO,{href:xs(e,t),download:r,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Download for ${t===`chrome`?`Chrome`:`Firefox`}`]})]}),(0,h.jsxs)(`ol`,{"aria-label":`Install steps`,className:`m-0 flex list-decimal flex-col gap-1 pl-5`,children:[t===`chrome`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`li`,{children:[`Press Download for Chrome, then unzip `,(0,h.jsx)(cL,{children:r}),` into a folder you keep: the browser loads the extension from there.`]}),(0,h.jsxs)(`li`,{children:[`Open `,(0,h.jsx)(cL,{children:`chrome://extensions`}),` (Edge: `,(0,h.jsx)(cL,{children:`edge://extensions`}),`), turn on Developer mode, press Load unpacked and pick that folder.`]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`li`,{children:`Press Download for Firefox. It needs Firefox 128 or newer; keep the zip, you pick it in the next step.`}),(0,h.jsxs)(`li`,{children:[`Open `,(0,h.jsx)(cL,{children:`about:debugging#/runtime/this-firefox`}),`, press Load Temporary Add-on and pick `,(0,h.jsx)(cL,{children:r}),`. Firefox removes it when it restarts; load it again then.`]})]}),(0,h.jsx)(`li`,{children:`Pair it: press Copy beside the pairing token in Settings → YouTube Studio, click the Slopify extension's toolbar button, paste the token and press Pair.`})]})]})}function CB({dirty:e,onDiscard:t,saveLabel:n=`Save`,className:r}){return(0,h.jsx)(SR,{tone:e?`warning`:`info`,...r===void 0?{}:{className:r},children:e?(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,h.jsx)(`span`,{children:`Unsaved changes. Press ${n} or Enter to keep them.`}),(0,h.jsx)(z,{variant:`quiet`,size:`small`,onClick:t,children:`Discard`})]}):null})}function wB({className:e,revealLabel:t=`key`,...n}){let[r,i]=(0,m.useState)(!1);return(0,h.jsxs)(`span`,{className:R(`flex min-w-0 items-center gap-1`,e),children:[(0,h.jsx)(X,{...n,type:r?`text`:`password`,className:`min-w-0 flex-1`}),(0,h.jsx)(Nv,{label:r?`Hide ${t}`:`Show ${t}`,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?(0,h.jsx)(Wc,{"aria-hidden":`true`}):(0,h.jsx)(Gc,{"aria-hidden":`true`})})]})}function TB({value:e,revealLabel:t=`token`,className:n}){let[r,i]=(0,m.useState)(!1);return(0,h.jsxs)(`span`,{className:R(`flex min-w-0 items-center gap-1`,n),children:[(0,h.jsx)(`code`,{className:`sl-code min-w-0 flex-1 truncate py-2 select-all`,children:e===void 0?`…`:r?e:`•`.repeat(Math.min(e.length,24))}),(0,h.jsx)(Nv,{label:r?`Hide ${t}`:`Show ${t}`,"aria-pressed":r,disabled:e===void 0,onClick:()=>i(e=>!e),children:r?(0,h.jsx)(Wc,{"aria-hidden":`true`}):(0,h.jsx)(Gc,{"aria-hidden":`true`})})]})}var EB=[`studio`,`plan`];function DB({autoComment:e}){let{api:t}=B(),n=_(),r=Lv(),i=F({queryKey:EB,queryFn:()=>ls(t)}),a=F(OT(t)),o=I({mutationFn:e=>us(t,{...e,rows:[]}),onSuccess:e=>{n.setQueryData(EB,e),n.invalidateQueries({queryKey:[`studio`,`releases`]}),r(`Removed the old posting plan. Each schedule's release times apply now.`,`success`)},onError:e=>r(`The old posting plan wasn't removed: ${e.message} Try Remove the old plan again.`,`error`)}),s=I({mutationFn:e=>ds(t,e),onSuccess:e=>{n.setQueryData(EB,e),n.invalidateQueries({queryKey:[`studio`,`releases`]}),r(`Each upload is now due ${String(e.leadHours)} hours before its release.`,`success`)},onError:e=>r(`The lead time wasn't saved: ${e.message}`,`error`)}),c=I({mutationFn:e=>gs(t,e),onSuccess:()=>n.invalidateQueries({queryKey:[`studio`,`settings`]}),onError:e=>r(`Not saved: ${e.message}`,`error`)});if(i.data===void 0)return(0,h.jsxs)(`section`,{"aria-label":`Release times`,className:`flex flex-col gap-3`,children:[(0,h.jsx)(U,{as:`h3`,title:`Release times`}),i.error===null?(0,h.jsx)(AL,{label:`Loading the release settings…`,rows:2,rowClassName:`h-10`}):(0,h.jsx)(jL,{what:`The release settings`,error:i.error,onRetry:()=>void i.refetch(),retrying:i.isFetching})]});let l=i.data.plan,u=(a.data??[]).filter(e=>e.deletedAt===null);return(0,h.jsxs)(`section`,{"aria-label":`Release times`,className:`flex flex-col gap-3`,children:[(0,h.jsx)(U,{as:`h3`,title:`Release times`}),(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Each schedule sets when its videos and shorts go out, one line for each day it runs, with a time for every short its template makes:`,` `,(0,h.jsx)(pa,{to:`/calendar`,search:{tab:`schedules`},children:`Calendar → Schedules`}),` `,`→ Edit → Release times. See and move them in Calendar → Releases.`]}),u.length===0?null:(0,h.jsx)(`p`,{className:`m-0 flex flex-wrap gap-x-3 gap-y-1 text-small`,children:u.map(e=>(0,h.jsx)(KO,{to:`/calendar`,search:{tab:`schedules`,schedule:e.id},children:e.name},e.id))}),l.rows.length>0?(0,h.jsx)(fM,{tone:`info`,title:`An older posting plan still applies`,actions:(0,h.jsx)(z,{variant:`secondary`,disabled:o.isPending,onClick:()=>o.mutate(l),children:`Remove the old plan`}),children:(0,h.jsx)(`p`,{className:`m-0`,children:`It has ${String(l.rows.length)} line${l.rows.length===1?``:`s`}, and gives release times to projects no schedule made, and to a schedule's projects when its own times are taken. Set release times in your schedules, then remove it. Times already given keep.`})}):null,(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-small text-ink-2`,children:[`Upload and schedule each video and short at least`,(0,h.jsx)(X,{"aria-label":`Hours before release`,type:`number`,min:1,max:168,className:`w-[72px]`,defaultValue:i.data?.leadHours??24,onBlur:e=>{let t=Number(e.currentTarget.value);Number.isInteger(t)&&t>=1&&t<=168&&t!==i.data?.leadHours&&s.mutate(t)}},i.data?.leadHours??24),`hours before its release, so YouTube's copyright and ad checks finish while it is private.`]}),(0,h.jsx)(Fy,{checked:e===!0,disabled:c.isPending||e===void 0,onChange:e=>c.mutate(e),label:`Post and pin each video's comment once it is public (the extension posts it in your name)`})]})}var OB=[`studio`,`settings`];function kB(){let{api:e}=B(),t=F({queryKey:OB,queryFn:()=>as(e)});return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(U,{title:`Upload pack and extension`,info:`settings.studio.extension`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsx)(jB,{}),(0,h.jsx)(DB,{autoComment:t.data?.autoComment??!1}),(0,h.jsx)(PB,{}),(0,h.jsxs)(`section`,{"aria-label":`Install the Studio extension`,children:[(0,h.jsx)(U,{as:`h3`,title:`Install the Studio extension`,className:`mb-3`}),(0,h.jsx)(SB,{})]})]})]})}var AB=``;function jB(){let{api:e}=B(),t=_(),n=Lv(),r=(0,m.useId)(),i=F({queryKey:OB,queryFn:()=>as(e)}),a=F(Xy(e)),o=(0,m.useId)(),[s,c]=(0,m.useState)(AB),[l,u]=(0,m.useState)({}),d=l[s],f=e=>{u(t=>{let{[s]:n,...r}=t;return e===void 0?r:{...r,[s]:e}})},p=i.data?.playlists??[],g=s===AB?void 0:i.data?.channelPlaylists[s],v=d??(s===AB?p:g??[]),y=NB(v),b=I({mutationFn:t=>os(e,t,s===AB?void 0:s),onSuccess:()=>{f(void 0),t.invalidateQueries({queryKey:OB}),n(`Playlists saved.`,`success`)}}),x=e=>{b.reset(),f(e)},S=y??b.error?.message,C=[{value:AB,label:`Every channel (default)`},...(a.data??[]).map(e=>({value:e.id,label:e.name}))];return(0,h.jsxs)(iL,{label:`Playlists`,tip:`settings.studio.playlist`,help:s===AB?`The playlists upload packs offer, for every channel without its own. Ticked ones are on for every project; Prepare upload changes them for one project.`:g===void 0&&p.length>0?`This channel uses the default list (${(e=>e.map(e=>e.name).join(`, `))(p)}) until you add its own.`:`This channel's own playlists. Ticked ones are on for every project; Prepare upload changes them for one project.`,children:[(0,h.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),!b.isPending&&d!==void 0&&y===void 0&&b.mutate(v)},children:[(0,h.jsx)(sL,{id:o,"aria-label":`Channel`,value:s,options:C,onChange:e=>{b.reset(),c(e.currentTarget.value)},className:`max-w-[260px]`}),v.length===0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Type each name exactly as the playlist is called in YouTube Studio.`}),v.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(X,{autoComplete:`off`,"aria-label":`Playlist ${String(t+1)} name`,className:`min-w-0 flex-1 basis-[220px]`,value:e.name,disabled:i.data===void 0,"aria-invalid":e.name.trim().length>150,"aria-describedby":S===void 0?void 0:r,onChange:e=>x(v.map((n,r)=>r===t?{...n,name:e.target.value}:n))}),(0,h.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-[var(--color-accent)]`,checked:e.byDefault,onChange:e=>{let n=e.currentTarget.checked;x(v.map((e,r)=>r===t?{...e,byDefault:n}:e))}}),`On by default`]}),(0,h.jsx)(sL,{"aria-label":`${e.name.trim()||`Playlist ${String(t+1)}`}: takes`,className:`w-[190px]`,value:e.for??`all`,onChange:e=>{let n=e.currentTarget.value,r=n===`long`||n===`shorts`?n:`all`;x(v.map((e,n)=>n===t?{...e,for:r}:e))},options:[{value:`all`,label:`Videos and shorts`},{value:`long`,label:`Long videos only`},{value:`shorts`,label:`Shorts only`}]}),(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Remove ${e.name.trim()||`playlist ${String(t+1)}`}`,onClick:()=>x(v.filter((e,n)=>n!==t)),children:`Remove`})]},t)),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(z,{variant:`secondary`,disabled:i.data===void 0||v.length>=20,onClick:()=>x([...v,{name:``,byDefault:v.length===0}]),children:[(0,h.jsx)(pl,{"aria-hidden":`true`,strokeWidth:1.75}),`Add playlist`]}),(0,h.jsx)(z,{type:`submit`,variant:`primary`,disabled:b.isPending||d===void 0||y!==void 0,disabledReason:y??`Nothing changed since the last save.`,children:`Save playlists`})]}),MB(v)===void 0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-waiting`,children:MB(v)}),(0,h.jsx)(CB,{dirty:d!==void 0,saveLabel:`Save playlists`,onDiscard:()=>{b.reset(),f(void 0)}})]}),S===void 0?null:(0,h.jsx)(`p`,{id:r,role:`alert`,className:`m-0 text-small text-danger`,children:S})]})}function MB(e){let t=e.find(e=>/\bshorts?\b/i.test(e.name)&&(e.for??`all`)===`all`);if(t!==void 0)return`"${t.name.trim()}" takes long videos too, and shorts also go into every playlist set to Videos and shorts. Set it to Shorts only, and your long-video playlists to Long videos only.`}function NB(e){if(e.find(e=>e.name.trim().length>150)!==void 0)return`A playlist name is longer than YouTube allows (150 characters). Shorten it.`;let t=new Set;for(let n of e){let e=n.name.trim().toLowerCase();if(e!==``){if(t.has(e))return`"${n.name.trim()}" is listed twice. Remove one.`;t.add(e)}}}function PB(){let{api:e}=B(),t=_(),n=Lv(),r=F({queryKey:OB,queryFn:()=>as(e)}),i=I({mutationFn:()=>ws(e),onSuccess:()=>{t.invalidateQueries({queryKey:OB}),n(`New pairing token made. Pair the extension again with it.`,`success`)}}),a=r.data?.pairing;return(0,h.jsxs)(`div`,{className:`sl-field`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`sl-field__label`,children:`Extension pairing token`}),(0,h.jsx)(H,{id:`settings.studio.pairing`,className:`-my-1`})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(TB,{value:a?.token,revealLabel:`pairing token`,className:`flex-1 basis-[220px]`}),(0,h.jsxs)(z,{variant:`quiet`,disabled:a===void 0,onClick:()=>{if(a!==void 0){if(!navigator.clipboard){n(`Couldn't copy the token. Select it and copy it.`,`error`);return}navigator.clipboard.writeText(a.token).then(()=>n(`Pairing token copied. Paste it into the extension's options.`,`success`),()=>n(`Couldn't copy the token. Select it and copy it.`,`error`))}},children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),`Copy`]}),(0,h.jsx)(z,{variant:`quiet`,disabled:i.isPending||a===void 0,onClick:()=>i.mutate(),children:`New pairing token`})]}),(0,h.jsx)(`p`,{className:`sl-field__help m-0`,children:a?.origin==null?`No extension is paired. Paste this token into the Slopify Studio extension's options and press Pair.`:`Paired with the extension at ${a.origin}. A new token unpairs it.`}),i.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:i.error.message})]})}var FB=[`studio`,`queue`];function IB({projectId:e,ready:t,variant:n=`secondary`,size:r=`default`}){let[i,a]=(0,m.useState)(!1);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{variant:n,size:r,disabled:!t,disabledReason:`Available once the video has been made`,onClick:()=>a(!0),children:`Prepare upload`}),i?(0,h.jsx)(BB,{projectId:e,onClose:()=>a(!1)}):null]})}var LB={video:`Video file`,title:`Title`,description:`Description`,thumbnails:`Thumbnail`,playlist:`Playlist`,audience:`Audience`,altered:`AI use (under Show more)`,tags:`Tags (under Show more)`,schedule:`Schedule (Visibility)`};function RB(e){return new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e))}function zB(e){return e.kind===`video`?`video`:`short-${String(e.short)}`}function BB({projectId:e,onClose:t}){let{api:n}=B(),r=_(),i=[`studio`,`pack`,e],a=F({queryKey:i,queryFn:()=>Ts(n,e)}),[o,s]=(0,m.useState)(`video`),[c,l]=(0,m.useState)(),u=a.data?.items??[],d=u.find(e=>zB(e)===o)??u[0],f=F({queryKey:OB,queryFn:()=>as(n)}),p=f.data===void 0?void 0:f.data.pairing.origin!==null,g=F({queryKey:FB,queryFn:()=>Ss(n)}),v=I({mutationFn:t=>Ds(n,e,t.short),onSuccess:e=>{r.setQueryData(FB,e),l({text:e.length>1?`Added; ${String(e.length)} uploads are waiting. Studio is opening: each upload you start there is filled with the next one, in the order under Waiting for Studio. Check everything and publish yourself.`:`Studio is opening. The Slopify Studio extension puts the video into its upload dialog and fills in the details. Check everything and publish yourself.`,tone:`success`})},onError:e=>l({text:`Couldn't hand this to the extension: ${e.message}`,tone:`error`})}),y=I({mutationFn:e=>Cs(n,e.projectId,e.short),onSuccess:e=>r.setQueryData(FB,e),onError:e=>l({text:`Couldn't remove it from Waiting for Studio: ${e.message} Press Remove again.`,tone:`error`})}),b=I({mutationFn:t=>Es(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved. The AI use answer is updated.`,tone:`success`})},onError:e=>l({text:`Couldn't save whether the clips are real footage: ${e.message} Press the switch again.`,tone:`error`})}),x=I({mutationFn:t=>ss(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved this project's playlists.`,tone:`success`})},onError:e=>l({text:`Couldn't save the playlists: ${e.message} Tick the playlist again.`,tone:`error`})}),S=I({mutationFn:t=>_s(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved when this project goes out.`,tone:`success`})},onError:e=>l({text:`Couldn't change the slot: ${e.message} Choose it again.`,tone:`error`})}),C=I({mutationFn:t=>cs(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved what the upload uses.`,tone:`success`})},onError:e=>l({text:`Couldn't save the choice: ${e.message} Choose it again.`,tone:`error`})});return(0,h.jsxs)(eM,{open:!0,title:`Prepare upload`,onClose:t,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(SR,{tone:c?.tone??`info`,children:c?.text}),p===!1?(0,h.jsx)(qO,{href:dR,target:`_blank`,rel:`noopener noreferrer`,variant:`secondary`,children:`Open YouTube Studio`}):null,(0,h.jsx)(z,{variant:`primary`,disabled:d===void 0||v.isPending||p!==!0,disabledReason:p===!1?`Install and pair the Slopify Studio extension first (steps above)`:f.error===null?`Wait for the upload pack to load`:`Couldn't check whether the extension is paired: ${f.error.message} Close Prepare upload and open it again.`,onClick:()=>{d!==void 0&&(window.open(dR,`_blank`,`noopener`),v.mutate(d))},children:`Fill in YouTube Studio`}),(0,h.jsx)(H,{id:`project.upload.fill-studio`})]}),children:[a.error===null?null:(0,h.jsx)(fM,{tone:`danger`,title:`The upload pack couldn't be read.`,children:`${a.error.message} Close Prepare upload and open it again.`}),a.data===void 0?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[p===!1?(0,h.jsx)(fM,{tone:`waiting`,title:`The Slopify Studio extension isn't paired.`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(`p`,{className:`m-0`,children:`Without it, the steps below are the upload pack: copy each into Studio's upload dialog. To have Studio filled in for you, install the extension:`}),(0,h.jsx)(SB,{})]})}):null,u.length>1?(0,h.jsx)(Iy,{label:`What to upload`,value:d===void 0?``:zB(d),onChange:s,tip:`project.upload.item`,options:u.map(e=>({value:zB(e),label:e.kind===`video`?`Video`:`Short ${String(e.short)}`})),className:`self-start`}):null,a.data.missing.length===0?null:(0,h.jsx)(fM,{tone:`waiting`,title:`Some of it isn't made yet.`,children:(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.data.missing.map(e=>(0,h.jsx)(`li`,{children:e},e))})}),d===void 0?null:(0,h.jsx)(UB,{projectId:e,item:d,footageSwitch:d.kind===`video`&&a.data.footage!==void 0?(0,h.jsx)(Fy,{checked:b.isPending?b.variables:a.data.footage.real,disabled:b.isPending,onChange:e=>b.mutate(e),tip:`project.upload.real-footage`,label:`The ${a.data.footage.clips===1?`uploaded clip is`:`${String(a.data.footage.clips)} uploaded clips are`} real footage (filmed, not made by AI)`}):void 0,playlistPicker:a.data.playlistChoices.length>1?(0,h.jsx)(`span`,{className:`flex flex-col gap-1`,children:a.data.playlistChoices.map(e=>(0,h.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-[var(--color-accent)]`,checked:e.chosen,disabled:x.isPending,onChange:t=>{let n=t.currentTarget.checked;x.mutate(a.data.playlistChoices.filter(t=>t.name===e.name?n:t.chosen).map(e=>e.name))}}),e.name]},e.name))}):void 0,copy:(e,t)=>{if(!navigator.clipboard){l({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`});return}navigator.clipboard.writeText(e).then(()=>l({text:`Copied the ${t}.`,tone:`success`}),()=>l({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`}))},onPick:e=>C.mutate(e),slotPicker:d.kind===`video`?(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,...Py,children:[(0,h.jsx)(sL,{"aria-label":`Posting plan slot`,value:a.data.schedule===void 0?``:`${a.data.schedule.row}|${a.data.schedule.longAt}`,disabled:S.isPending,onChange:e=>{let[t,n]=e.currentTarget.value.split(`|`);S.mutate(t===void 0||n===void 0?null:{row:t,longAt:n})},options:[{value:``,label:`Not scheduled (set it in Studio yourself)`},...a.data.schedule===void 0?[]:[{value:`${a.data.schedule.row}|${a.data.schedule.longAt}`,label:RB(a.data.schedule.longAt)}],...(a.data.slotChoices??[]).map(e=>({value:`${e.row}|${e.longAt}`,label:RB(e.longAt)}))]}),(0,h.jsx)(H,{id:`project.upload.slot`})]}):void 0,picking:C.isPending,doneKey:`slopify.upload.${e}.${zB(d)}`},zB(d)),(g.data??[]).length===0?null:(0,h.jsxs)(`section`,{"aria-label":`Waiting for Studio`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center gap-1`,children:[(0,h.jsx)(`div`,{className:`sl-kicker`,children:`Waiting for Studio`}),(0,h.jsx)(H,{id:`project.upload.queue`,className:`-my-1`})]}),(0,h.jsx)(KL,{label:`Waiting to be filled`,children:(g.data??[]).map((e,t)=>{let n=e.short===null?`Video`:`Short ${String(e.short)}`;return(0,h.jsx)(qL,{title:`${e.projectTitle} · ${n}`,meta:t===0?`Next: filled in the next upload dialog you open in Studio.`:`Filled after ${String(t)} more upload${t===1?``:`s`}.`,actions:(0,h.jsx)(z,{variant:`quiet`,size:`small`,disabled:y.isPending,"aria-label":`Remove ${e.projectTitle} ${n.toLowerCase()} from Waiting for Studio`,onClick:()=>y.mutate(e),children:`Remove`})},`${e.projectId}-${String(e.short)}`)})})]}),(0,h.jsx)(fM,{title:`Slopify never publishes.`,children:p===!1?`Copy each step into Studio's upload dialog (Open YouTube Studio), check it and press Publish yourself.`:`Fill in YouTube Studio hands this to the Slopify Studio extension, which puts the video into Studio's upload dialog and fills in the details. You check it and press Publish.`})]})]})}function VB(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function HB({href:e,filename:t}){return(0,h.jsxs)(qO,{href:e,download:t,"aria-label":`Download ${t}`,variant:`secondary`,size:`small`,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Download`]})}function UB({projectId:e,item:t,footageSwitch:n,playlistPicker:r,copy:i,onPick:a,picking:o,slotPicker:s,doneKey:c}){let{api:l}=B(),[u,d]=(0,m.useState)(()=>VB(c)),[f,p]=(0,m.useState)(null),g=e=>{d(e);try{localStorage.setItem(c,JSON.stringify(e))}catch{}},_=(e,t)=>g(t?[...u,e]:u.filter(t=>t!==e)),v=fR.filter(e=>e!==`thumbnails`||t.kind===`video`),y=v.filter(e=>u.includes(e)).length,b=e=>{let n=GB(t,e);return(0,h.jsxs)(z,{variant:`quiet`,size:`small`,disabled:n===``,disabledReason:`Nothing to copy yet`,"aria-label":`Copy ${LB[e].toLowerCase()}`,onClick:()=>i(n,LB[e].toLowerCase()),children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Copy`]})},x=c=>{switch(c){case`video`:return t.video===null?{value:(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Not made yet.`})}:{value:t.video.filename,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(HB,{href:`${l.origin}${t.video.url}`,filename:t.video.filename}),(0,h.jsx)(_B,{projectId:e,asset:t.video.asset,size:`small`})]})};case`thumbnails`:return t.thumbnails.length===0?{value:(0,h.jsx)(`span`,{className:`text-ink-3`,children:`None made.`})}:{value:t.thumbnails.length>1?`${WB(t.pickable?.thumbnail??0)} under Thumbnail (choose below). The A/B test tries all ${String(t.thumbnails.length)} once the video is public.`:t.thumbnails[0]?.filename??``,actions:(0,h.jsx)(_B,{projectId:e,asset:t.thumbnails[0]?.asset??`thumbnail`,size:`small`})};case`audience`:return{value:`No, it's not made for kids`};case`altered`:return{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:t.alteredContent.altered?`Yes`:`No`}),(0,h.jsx)(`span`,{className:`text-ink-2`,children:t.alteredContent.why}),n]})};case`description`:return{value:t.chapterNotice===void 0?GB(t,c)||(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Not written yet.`}):(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{children:t.description}),(0,h.jsx)(`span`,{className:`text-waiting`,children:t.chapterNotice})]}),actions:b(c)};case`title`:return t.titles.length===0||t.pickable===void 0?{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{children:GB(t,c)}),(0,h.jsx)(KB,{title:t.title})]}),actions:b(c)}:{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(KB,{title:t.title}),(0,h.jsx)(`span`,{role:`radiogroup`,"aria-label":`Title the upload uses`,className:`flex flex-col gap-1`,children:t.pickable.titles.map((n,r)=>(0,h.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`radio`,name:`upload-title-${e}`,className:`size-4 accent-[var(--color-accent)]`,checked:r===t.pickable?.title,disabled:o,onChange:()=>a({title:r,thumbnail:t.pickable?.thumbnail??0})}),n]},n))}),(0,h.jsx)(`span`,{className:`text-ink-2`,children:`The upload uses the chosen title; the A/B test tries the others beside it once the video is public.`})]}),actions:(0,h.jsxs)(h.Fragment,{children:[b(c),(0,h.jsxs)(z,{variant:`quiet`,size:`small`,"aria-label":`Copy the other titles`,onClick:()=>i(t.titles.join(`
|
|
160
|
+
`),gR=`Built-in`,_R=/[<>]/;function vR(e){let t=e.trim();if(t.length>100)return`YouTube takes titles of up to 100 characters; this one has ${String(t.length)}. Shorten it.`;if(_R.test(t))return`YouTube doesn't allow < or > in a title. Remove them.`}function yR(e){if(e.length>5e3)return`YouTube takes descriptions of up to ${mR.toLocaleString(`en-US`)} characters; this one has ${e.length.toLocaleString(`en-US`)}. Shorten it.`;if(_R.test(e))return`YouTube doesn't allow < or > in a description. Remove them.`}function bR(e){let t=e.split(/\s+/u).filter(e=>e.startsWith(`#`)&&e.length>1).length;if(t!==0)return t>60?`${String(t)} hashtags: YouTube ignores every hashtag when there are more than 60. Remove ${String(t-60)}.`:`${String(t)} hashtag${t===1?``:`s`}; the first ${String(Math.min(t,3))} show above the title.`}var xR={info:`text-ink-2`,error:`text-danger`,warning:`text-waiting`,success:`text-accent-ink`};function SR({children:e,tone:t=`info`,className:n,id:r}){let i=typeof e==`string`?e:void 0;return(0,h.jsx)(`div`,{id:r,"data-slot":`status-slot`,role:t===`error`?`alert`:`status`,title:i,className:R(`flex min-h-8 min-w-0 flex-1 items-center gap-2 overflow-hidden text-small`,xR[t],n),children:e==null||e===!1?null:i===void 0?e:(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:i})})}function CR({status:e,children:t,className:n}){return(0,h.jsxs)(`div`,{"data-slot":`action-bar`,className:R(`sticky bottom-0 z-20 -mx-4 mt-6 flex min-h-14 flex-wrap items-center gap-x-3 gap-y-2 border-t border-line bg-surface px-4 py-2 pb-[max(8px,env(safe-area-inset-bottom))] max-md:bottom-[calc(48px+max(12px,env(safe-area-inset-bottom)))] md:-mx-10 md:px-10`,n),children:[(0,h.jsx)(`div`,{className:`flex w-full min-w-0 sm:w-auto sm:flex-1`,children:e??(0,h.jsx)(SR,{})}),(0,h.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:t})]})}var wR=[.75,1,1.25,1.5,1.75,2],TR=`slopify.playback`,ER={volume:1,muted:!1,rate:1};function DR(){try{let e=window.localStorage.getItem(TR);if(e===null)return ER;let t=JSON.parse(e);if(typeof t!=`object`||!t)return ER;let{volume:n,muted:r,rate:i}=t;return{volume:typeof n==`number`&&n>=0&&n<=1?n:1,muted:r===!0,rate:typeof i==`number`&&wR.some(e=>e===i)?i:1}}catch{return ER}}function OR(e){try{window.localStorage.setItem(TR,JSON.stringify({...DR(),...e}))}catch{}}var kR=null;function AR(e){kR!==null&&kR!==e&&!kR.paused&&kR.pause(),kR=e}function jR(e){kR===e&&(kR=null)}function MR(e,t){e.volume=t.volume,e.muted=t.muted,e.playbackRate=t.rate}function NR(e){let t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0,n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${String(n)}:${String(r).padStart(2,`0`)}:${i}`:`${String(r)}:${i}`}function PR(e){return`${String(e)}×`}function FR(e,t){return e.filter(e=>e.start<=t).at(-1)}function IR(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}var LR=(e,t,n)=>Math.min(n,Math.max(t,e));function RR(){let e=(0,m.useRef)(null),t=(0,m.useId)(),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(0),[o,s]=(0,m.useState)(0),[c,l]=(0,m.useState)(0),[u]=(0,m.useState)(DR),[d,f]=(0,m.useState)(u.volume),[p,h]=(0,m.useState)(u.muted),[g,_]=(0,m.useState)(u.rate);(0,m.useEffect)(()=>{let t=e.current;return t!==null&&MR(t,u),()=>{t!==null&&jR(t)}},[u]);let[v,y]=(0,m.useState)(!1),[b,x]=(0,m.useState)(null),[S,C]=(0,m.useState)(!1),w=Number.isFinite(o)&&o>0,T=()=>{let t=e.current;t!==null&&(t.paused||t.ended?t.play()?.catch(()=>void 0):t.pause())},E=t=>{let n=e.current;if(n===null||!w)return;let r=LR(t,0,o);n.currentTime=r,a(r)},D=t=>E((e.current?.currentTime??i)+t),O=t=>{let n=e.current;if(n===null)return;let r=LR(Math.round(t*100)/100,0,1);n.volume=r,n.muted=r===0,f(r),h(r===0),OR({volume:r,muted:r===0})},k=()=>{let t=e.current;t!==null&&(t.muted=!t.muted,h(t.muted),OR({muted:t.muted}))};return{media:e,menuId:t,playing:n,current:i,duration:o,buffered:c,known:w,volume:d,muted:p,rate:g,menu:v,setMenu:y,hover:b,setHover:x,seeking:S,setSeeking:C,toggle:T,seekTo:E,jump:D,setLevel:O,toggleMute:k,pickRate:n=>{let r=e.current;r!==null&&(r.playbackRate=n),_(n),OR({rate:n}),y(!1),document.getElementById(`${t}-button`)?.focus()},keyAction:e=>{let t=e.length===1?e.toLowerCase():e;if(t===` `||t===`k`)return T;if(t===`j`)return()=>D(-10);if(t===`l`)return()=>D(10);if(t===`ArrowLeft`)return()=>D(-5);if(t===`ArrowRight`)return()=>D(5);if(t===`m`)return k;if(/^[0-9]$/.test(t))return()=>E(Number(t)/10*o)},events:{onPlay:e=>{AR(e.currentTarget),r(!0)},onPause:()=>r(!1),onEnded:()=>r(!1),onTimeUpdate:e=>{S||a(e.currentTarget.currentTime)},onDurationChange:e=>s(e.currentTarget.duration),onLoadedMetadata:e=>{s(e.currentTarget.duration),e.currentTarget.playbackRate=g},onProgress:e=>{let t=e.currentTarget.buffered;l(t.length>0?t.end(t.length-1):0)},onVolumeChange:e=>{f(e.currentTarget.volume),h(e.currentTarget.muted)},onRateChange:e=>_(e.currentTarget.playbackRate)}}}function zR(e,t){let n=e?.getBoundingClientRect();return n===void 0||n.width===0?0:LR((t-n.left)/n.width,0,1)}function BR(e,t){t!==void 0&&(e.preventDefault(),e.stopPropagation(),t())}function VR({controls:e,className:t}){return(0,h.jsx)(Nv,{size:`small`,label:e.playing?`Pause`:`Play`,className:t,onClick:e.toggle,children:e.playing?(0,h.jsx)(ll,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(fl,{"aria-hidden":`true`,strokeWidth:1.75})})}function HR({controls:e}){return(0,h.jsxs)(`span`,{className:`sl-player__time`,children:[(0,h.jsx)(`span`,{className:`sl-player__now`,children:NR(e.current)}),(0,h.jsx)(`span`,{className:`sl-player__total`,children:` / ${e.known?NR(e.duration):`-:--`}`})]})}function UR({controls:e,chapters:t=[],waveform:n}){let r=(0,m.useRef)(null),{known:i,duration:a,current:o,buffered:s,seeking:c,hover:l}=e,u=JR(r),d=n===void 0?void 0:qR(n,u),f=i?t.filter(e=>e.start>0&&e.start<a):[],p=t=>{i&&(t.currentTarget.setPointerCapture?.(t.pointerId),e.setSeeking(!0),e.seekTo(zR(r.current,t.clientX)*a))},g=t=>{let n=zR(r.current,t.clientX);e.setHover(n),c&&e.seekTo(n*a)},_=t=>{t.currentTarget.releasePointerCapture?.(t.pointerId),e.setSeeking(!1)},v=t=>{BR(t,{ArrowLeft:()=>e.jump(-5),ArrowDown:()=>e.jump(-5),ArrowRight:()=>e.jump(5),ArrowUp:()=>e.jump(5),PageDown:()=>e.jump(-10),PageUp:()=>e.jump(10),Home:()=>e.seekTo(0),End:()=>e.seekTo(a)}[t.key])},y=i?o/a*100:0,b=i?s/a*100:0,x=l===null||!i?void 0:l*a,S=x===void 0?void 0:FR(t,x);return(0,h.jsxs)(`div`,{ref:r,role:`slider`,tabIndex:0,"aria-label":`Seek`,"aria-valuemin":0,"aria-valuemax":i?Math.floor(a):0,"aria-valuenow":Math.floor(o),"aria-valuetext":`${NR(o)} of ${i?NR(a):`unknown length`}`,"aria-disabled":!i,className:`sl-player__track`,onPointerDown:p,onPointerMove:g,onPointerUp:_,onPointerCancel:_,onPointerLeave:()=>e.setHover(null),onKeyDown:v,children:[d===void 0||d.length===0?(0,h.jsxs)(`span`,{className:`sl-player__rail`,children:[(0,h.jsx)(`span`,{className:`sl-player__buffered`,style:{width:`${String(b)}%`}}),(0,h.jsx)(`span`,{className:`sl-player__played`,style:{width:`${String(y)}%`}})]}):(0,h.jsx)(`span`,{className:`sl-player__wave`,"data-slot":`waveform`,"aria-hidden":`true`,children:d.map((e,t)=>(0,h.jsx)(`span`,{className:`sl-player__peak`,"data-played":(t+.5)/d.length*100<=y?``:void 0,style:{height:`${String(Math.max(12,Math.round(e*100)))}%`}},t))}),f.map(e=>(0,h.jsx)(`span`,{className:`sl-player__mark`,"data-chapter":e.title,title:e.title,style:{left:`${String(e.start/a*100)}%`}},`${String(e.start)}-${e.title}`)),(0,h.jsx)(`span`,{className:`sl-player__knob`,style:{left:`${String(y)}%`}}),x===void 0||l===null?null:(0,h.jsxs)(`span`,{className:`sl-player__tip`,"aria-hidden":`true`,style:{left:`${String(l*100)}%`},children:[S===void 0?null:(0,h.jsx)(`span`,{className:`sl-player__tip-title`,children:S.title}),NR(x)]})]})}function WR({controls:e}){let t=(0,m.useRef)(null),{muted:n,volume:r}=e,i=n?0:r;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Nv,{size:`small`,label:n?`Unmute`:`Mute`,"aria-pressed":n,className:`sl-player__mute`,onClick:e.toggleMute,children:n||r===0?(0,h.jsx)(Dl,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(El,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(`div`,{ref:t,role:`slider`,tabIndex:0,"aria-label":`Volume`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i*100),"aria-valuetext":n?`Muted`:`${String(Math.round(i*100))}%`,className:`sl-player__volume`,onPointerDown:n=>{n.currentTarget.setPointerCapture?.(n.pointerId),e.setLevel(zR(t.current,n.clientX))},onPointerMove:n=>{n.buttons===1&&e.setLevel(zR(t.current,n.clientX))},onKeyDown:t=>{let n={ArrowLeft:i-.05,ArrowDown:i-.05,ArrowRight:i+.05,ArrowUp:i+.05,Home:0,End:1}[t.key];BR(t,n===void 0?void 0:()=>e.setLevel(n))},children:(0,h.jsx)(`span`,{className:`sl-player__rail`,children:(0,h.jsx)(`span`,{className:`sl-player__played`,style:{width:`${String(i*100)}%`}})})})]})}function GR({controls:e}){let{menuId:t,menu:n,rate:r}=e;return(0,h.jsxs)(`span`,{className:`sl-player__speed`,children:[(0,h.jsx)(z,{id:`${t}-button`,variant:`quiet`,size:`small`,className:`sl-player__rate`,"aria-label":`Playback speed, ${PR(r)}`,"aria-haspopup":`menu`,"aria-expanded":n,"aria-controls":n?`${t}-menu`:void 0,onClick:()=>e.setMenu(e=>!e),children:PR(r)}),n?(0,h.jsx)(`div`,{id:`${t}-menu`,role:`menu`,"aria-label":`Playback speed`,className:`sl-player__menu`,onKeyDown:n=>{if(n.key===`Escape`){BR(n,()=>{e.setMenu(!1),document.getElementById(`${t}-button`)?.focus()});return}if(n.key!==`ArrowDown`&&n.key!==`ArrowUp`)return;let r=[...n.currentTarget.querySelectorAll(`[role=menuitemradio]`)],i=r[(r.indexOf(document.activeElement)+(n.key===`ArrowDown`?1:-1)+r.length)%r.length];BR(n,()=>i?.focus())},children:wR.map(t=>(0,h.jsx)(z,{variant:`quiet`,size:`small`,role:`menuitemradio`,"aria-checked":t===r,className:R(`sl-player__option`),autoFocus:t===r,onClick:()=>e.pickRate(t),children:t===1?`Normal`:PR(t)},t))}):null]})}var KR=4;function qR(e,t){let n=Math.floor(t/KR);if(n<=0||e.length<=n)return e;let r=[];for(let t=0;t<n;t+=1){let i=Math.floor(t*e.length/n),a=Math.max(i+1,Math.floor((t+1)*e.length/n));r.push(Math.max(...e.slice(i,a)))}return r}function JR(e){let[t,n]=(0,m.useState)(0);return(0,m.useEffect)(()=>{let t=e.current;if(t===null||(n(t.clientWidth),typeof ResizeObserver>`u`))return;let r=new ResizeObserver(()=>n(t.clientWidth));return r.observe(t),()=>r.disconnect()},[e]),t}var YR=2500;function XR({src:e,poster:t,label:n,portrait:r=!1,square:i=!1,captions:a,chapters:o=[],ref:s,className:c,children:l}){let u=RR(),d=u.media,f=(0,m.useRef)(null),p=(0,m.useRef)(void 0),[g,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(!1),[b,x]=(0,m.useState)(0),[S,C]=(0,m.useState)(!1),[w,T]=(0,m.useState)(!1),[E,D]=(0,m.useState)(!1),[O,k]=(0,m.useState)(!0),{playing:A,menu:j,seeking:M,hover:ee,events:N}=u,te=a!==void 0||b>0,P=typeof document<`u`&&`pictureInPictureEnabled`in document&&document.pictureInPictureEnabled===!0,ne=(0,m.useCallback)(()=>{k(!0),clearTimeout(p.current),p.current=setTimeout(()=>k(!1),YR)},[]);(0,m.useEffect)(()=>()=>clearTimeout(p.current),[]);let re=A&&!O&&!j&&!E&&!M&&ee===null;(0,m.useEffect)(()=>{let e=()=>C(document.fullscreenElement===f.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),(0,m.useEffect)(()=>{let e=d.current;if(e===null)return;let t=()=>T(!0),n=()=>T(!1);return e.addEventListener(`enterpictureinpicture`,t),e.addEventListener(`leavepictureinpicture`,n),()=>{e.removeEventListener(`enterpictureinpicture`,t),e.removeEventListener(`leavepictureinpicture`,n)}},[d]),(0,m.useEffect)(()=>{let e=d.current?.textTracks;if(e!==void 0)for(let t=0;t<e.length;t+=1){let n=e[t];n!==void 0&&(n.mode=v&&t===0?`showing`:`hidden`)}},[v,d]);let ie=()=>{let e=d.current;e!==null&&(e.paused||e.ended)&&_(!0),u.toggle()},ae=()=>{let e=f.current;e!==null&&(document.fullscreenElement===e?document.exitFullscreen?.():e.requestFullscreen?.()?.catch(()=>void 0))},oe=()=>{let e=d.current;e!==null&&(document.pictureInPictureElement===e?document.exitPictureInPicture?.().catch(()=>void 0):e.requestPictureInPicture?.().catch(()=>void 0))};return(0,h.jsxs)(`div`,{ref:f,"data-slot":`player`,"data-state":A?`playing`:`paused`,className:R(`sl-player`,r&&`sl-player--portrait`,i&&`sl-player--square`,re&&`sl-player--bare`,S&&`sl-player--full`,c),onKeyDown:e=>{if(e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.closest(`button`)!==null,n=e.key.length===1?e.key.toLowerCase():e.key,r=n===` `&&t?void 0:n===` `||n===`k`?ie:n===`f`?ae:n===`c`?te?()=>y(e=>!e):void 0:u.keyAction(n);r!==void 0&&(e.preventDefault(),e.stopPropagation(),ne(),r())},onPointerMove:ne,onPointerDown:ne,onFocus:()=>D(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(D(!1),u.setMenu(!1))},children:[(0,h.jsxs)(`video`,{ref:IR(d,s),src:e,poster:t,preload:`metadata`,playsInline:!0,"aria-label":n,onClick:ie,...N,onPlay:e=>{N.onPlay(e),_(!0),ne()},onPause:e=>{N.onPause(e),k(!0)},onEnded:e=>{N.onEnded(e),k(!0)},onLoadedMetadata:e=>{N.onLoadedMetadata(e),x(e.currentTarget.textTracks?.length??0)},children:[a===void 0?null:(0,h.jsx)(`track`,{kind:`captions`,src:a.src,srcLang:a.lang,label:a.label}),l]}),g?null:(0,h.jsx)(Nv,{label:`Play ${n}`,tip:!1,className:`sl-player__big`,onClick:ie,children:(0,h.jsx)(fl,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsxs)(`div`,{className:`sl-player__bar`,role:`group`,"aria-label":`${n} controls`,children:[(0,h.jsx)(VR,{controls:{...u,toggle:ie}}),(0,h.jsx)(HR,{controls:u}),(0,h.jsx)(UR,{controls:u,chapters:o}),(0,h.jsx)(WR,{controls:u}),(0,h.jsx)(GR,{controls:u}),te?(0,h.jsx)(Nv,{size:`small`,label:`Captions`,"aria-pressed":v,onClick:()=>y(e=>!e),children:(0,h.jsx)(kc,{"aria-hidden":`true`,strokeWidth:1.75})}):null,P?(0,h.jsx)(Nv,{size:`small`,label:`Picture in picture`,"aria-pressed":w,className:`sl-player__pip`,onClick:oe,children:(0,h.jsx)(dl,{"aria-hidden":`true`,strokeWidth:1.75})}):null,(0,h.jsx)(Nv,{size:`small`,label:S?`Exit full screen`:`Full screen`,"aria-pressed":S,onClick:ae,children:S?(0,h.jsx)(cl,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(ol,{"aria-hidden":`true`,strokeWidth:1.75})})]})]})}var ZR=[1,2,4];function QR(e,t){let n=ZR.indexOf(e);return ZR[Math.min(ZR.length-1,Math.max(0,n+t))]??1}function $R({src:e,alt:t,zoom:n,onZoom:r}){let[i,a]=(0,m.useState)({x:0,y:0}),o=(0,m.useRef)(null),s=n===1?{x:0,y:0}:i,c=e=>{n!==1&&(e.currentTarget.setPointerCapture?.(e.pointerId),o.current={x:e.clientX,y:e.clientY,from:s})},l=e=>{let t=o.current;t!==null&&a({x:t.from.x+(e.clientX-t.x)/n,y:t.from.y+(e.clientY-t.y)/n})},u=()=>{o.current=null};return(0,h.jsx)(`img`,{src:e,alt:t,draggable:!1,"data-zoom":n,className:n===1?`cursor-zoom-in`:`cursor-grab touch-none active:cursor-grabbing`,style:{transform:`scale(${String(n)}) translate(${String(s.x)}px, ${String(s.y)}px)`,transition:o.current===null?`transform 120ms ease-out`:`none`},onDoubleClick:()=>{a({x:0,y:0}),r(n===1?2:1)},onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u})}var ez={landscape:void 0,portrait:`sl-media__frame--portrait`,square:`sl-media__frame--square`};function tz({src:e,alt:t,kind:n=`image`,poster:r,aspect:i=`landscape`,title:a,meta:o,badge:s,actions:c,actionsShown:l=!1,generating:u,onOpen:d,openLabel:f,className:p}){let m=u==null||u===!1;return(0,h.jsxs)(`figure`,{className:R(`sl-media m-0`,p),"data-slot":`media-frame`,children:[(0,h.jsxs)(`div`,{className:R(`sl-media__frame`,ez[i]),children:[m&&e!==void 0?n===`video`?(0,h.jsx)(`video`,{src:e,poster:r,muted:!0,preload:`metadata`,"aria-label":t}):(0,h.jsx)(`img`,{src:e,alt:t,loading:`lazy`,decoding:`async`}):null,m?null:(0,h.jsxs)(`div`,{className:`sl-media__generating`,role:`status`,children:[(0,h.jsx)(ek,{tone:`running`}),(0,h.jsx)(`span`,{children:u})]}),s===void 0?null:(0,h.jsx)(`span`,{className:`sl-media__badge`,children:s}),c===void 0?null:(0,h.jsx)(`div`,{className:R(`sl-media__actions`,l&&`sl-media__actions--shown`),children:c})]}),d!==void 0&&m&&e!==void 0?(0,h.jsx)(`button`,{type:`button`,className:`sl-media__open`,"aria-label":f??`Open ${t} full size`,onClick:d}):null,a===void 0&&o===void 0?null:(0,h.jsxs)(`figcaption`,{className:`sl-media__caption`,children:[a===void 0?(0,h.jsx)(`span`,{}):(0,h.jsx)(`strong`,{className:`min-w-0 truncate`,children:a}),o===void 0?null:(0,h.jsx)(`span`,{className:`shrink-0`,children:o})]})]})}function nz({shorts:e=!1,density:t=`default`,list:n=!1,className:r,children:i,label:a}){let o=R(`sl-grid`,e&&`sl-grid--shorts`,t===`compact`&&`sl-grid--compact`,n&&`m-0 list-none p-0`,r);return n?(0,h.jsx)(`ul`,{"aria-label":a,className:o,"data-slot":`media-grid`,children:i}):(0,h.jsx)(`section`,{"aria-label":a,className:o,"data-slot":`media-grid`,children:i})}function rz({items:e,index:t,onIndex:n,onClose:r,actions:i}){let a=t===null?void 0:e[t],o=e.length,[s,c]=(0,m.useState)(1),l=a!==void 0&&a.kind!==`video`,u=e=>{t!==null&&o!==0&&(c(1),n((t+e+o)%o))};return(0,h.jsx)(Km,{open:a!==void 0,onOpenChange:e=>{e||(c(1),r())},children:(0,h.jsx)(Xm,{children:(0,h.jsx)(nh,{className:`sl-lightbox sl-enter`,onKeyDown:e=>{let t=e.key===`+`||e.key===`=`?1:e.key===`-`?-1:void 0;l&&t!==void 0?(e.preventDefault(),c(e=>QR(e,t))):l&&e.key===`0`?(e.preventDefault(),c(1)):e.key===`ArrowRight`?(e.preventDefault(),u(1)):e.key===`ArrowLeft`&&(e.preventDefault(),u(-1))},"aria-describedby":void 0,children:a===void 0||t===null?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`sl-lightbox__bar`,children:[(0,h.jsx)(sh,{className:`m-0 text-small font-semibold`,children:`${String(t+1)} of ${String(o)} · ${a.alt}`}),(0,h.jsxs)(`div`,{className:`sl-btn-row`,children:[i?.(a,t),l?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Nv,{label:`Zoom out`,disabled:s===1,onClick:()=>c(e=>QR(e,-1)),children:(0,h.jsx)(jl,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Nv,{label:`Zoom in${s===1?``:`, now ${String(s)}×`}`,disabled:s===4,onClick:()=>c(e=>QR(e,1)),children:(0,h.jsx)(Al,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Nv,{label:`Fit`,disabled:s===1,onClick:()=>c(1),children:(0,h.jsx)(al,{"aria-hidden":`true`,strokeWidth:1.75})})]}):null,(0,h.jsx)(Nv,{label:`Previous`,onClick:()=>u(-1),disabled:o<2,children:(0,h.jsx)(Mc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Nv,{label:`Next`,onClick:()=>u(1),disabled:o<2,children:(0,h.jsx)(Nc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(See,{asChild:!0,children:(0,h.jsx)(Nv,{label:`Close`,children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})})]})]}),(0,h.jsx)(`div`,{className:`sl-lightbox__stage`,children:a.kind===`video`?(0,h.jsx)(XR,{src:a.src,label:a.alt,className:`sl-lightbox__player`,...a.poster===void 0?{}:{poster:a.poster}},a.src):(0,h.jsx)($R,{src:a.src,alt:a.alt,zoom:s,onZoom:c},a.src)}),a.caption===void 0?(0,h.jsx)(`span`,{}):(0,h.jsx)(`p`,{className:`sl-lightbox__caption`,children:a.caption})]})})})})}var iz={location:tT(`docker-host`),path:G().min(1)},az=Yw([J({opened:tT(!0)}).strict(),J({opened:tT(!0),...iz}).strict(),J({opened:tT(!1),...iz}).strict()]),oz={catalogue:[`catalogue`],retired:[`catalogue`,`retired`],firstRun:[`first-run`]},sz={method:`POST`};async function cz(e,t,n){return L(await e.fetch(`${e.origin}/api/providers/${t}/key/test`,n===void 0?sz:{...sz,headers:{"content-type":`application/json`},body:JSON.stringify({key:n})}))}async function lz(e,t){let n=t===void 0?``:`?provider=${encodeURIComponent(t)}`;return L(await e.fetch(`${e.origin}/api/providers/health${n}`,sz))}async function uz(e){return L(await e.fetch(`${e.origin}/api/providers/catalogue`))}async function dz(e){return L(await e.fetch(`${e.origin}/api/providers/catalogue/check`,sz))}async function fz(e){return L(await e.fetch(`${e.origin}/api/providers/catalogue/refresh`,sz))}async function pz(e){return(await L(await e.fetch(`${e.origin}/api/providers/catalogue/retired`))).usages}async function mz(e,t){await L(await e.fetch(`${e.origin}/api/providers/catalogue/retired/switch`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({kind:t.kind,id:t.id,slot:t.slot,from:{provider:t.provider,model:t.model},to:t.replacement?.id??``})}))}async function hz(e){return L(await e.fetch(`${e.origin}/api/providers/catalogue/retired/switch-all`,sz))}async function gz(e){return L(await e.fetch(`${e.origin}/api/providers/first-run`))}async function _z(e){let t=await e.fetch(`${e.origin}/api/providers/first-run/dismiss`,sz);t.ok||await L(t)}function vz(e,t){let n=e.providers.find(e=>e.id===t.cli)?.checks.find(e=>e.label===`Signed in`);return n?.state===`ok`?`signed-in`:n?.state===`problem`?`signed-out`:`unknown`}function yz(e){return e.label.replace(/^Sign in to /,``)}async function bz(e){if(!navigator.clipboard)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function xz({fix:e,retry:t,variant:n=`primary`,size:r=`default`}){let{api:i}=B(),a=Lv(),o=yz(e),s=I({mutationFn:async()=>vz(await lz(i,e.cli),e),onSuccess:n=>{if(n===`signed-out`){a(`${o} is still signed out. Run ${e.command} in a terminal on the computer running Slopify, sign in, then press Check again.`,`error`);return}if(t===void 0){a(n===`signed-in`?`${o} is signed in.`:`Slopify couldn't tell whether ${o} is signed in. If ${e.command} finished without an error, try the step again.`,n===`signed-in`?`success`:`info`);return}a(`${o} is signed in. Trying again.`,`success`),t.run()},onError:e=>a(`Slopify couldn't check ${o}'s sign-in: ${e.message} Press Check again in a moment, or use Check all in Settings → Providers.`,`error`)}),c=async()=>{let t=await bz(e.command);a(t?`Copied ${e.command}. Paste it in a terminal on the computer running Slopify and sign in, then press Check again.`:`Couldn't copy: the browser blocked the clipboard. Type ${e.command} in a terminal on the computer running Slopify, sign in, then press Check again.`,t?`success`:`error`)};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{variant:n,size:r,onClick:()=>void c(),children:`Copy sign-in command`}),(0,h.jsx)(z,{variant:`secondary`,size:r,disabled:s.isPending||t?.busy===!0,disabledReason:`Checking the sign-in…`,onClick:()=>s.mutate(),children:s.isPending?`Checking…`:`Check again`})]})}function Sz({fix:e,retry:t,edit:n,variant:r=`primary`,size:i=`default`}){switch(e.kind){case`sign-in`:return(0,h.jsx)(xz,{fix:e,retry:t,variant:r,size:i});case`provider-settings`:return(0,h.jsx)(GO,{to:`/settings`,search:{section:`providers`},variant:r,size:i,children:e.label});case`free-space`:return(0,h.jsx)(GO,{to:`/settings`,search:{section:`storage`},variant:r,size:i,children:e.label});case`refused`:case`switch-model`:return n??null}}var Cz=Xw(`kind`,[J({kind:tT(`allAffected`)}).strict(),J({kind:tT(`selected`),workKeys:q(G().min(1).max(200)).min(1).max(1e4)}).strict()]),wz=G().min(1).max(64),Tz=J({baseRevisionId:wz,request:Cz}).strict(),Ez=J({baseRevisionId:wz,idempotencyKey:Uw(),previewId:G().min(1).max(64),acknowledgeUnknownCosts:Kw(),confirmedProvidedWorkKeys:q(G().min(1).max(200)).max(1e4)}).strict(),Dz=J({stage:G(),low:K().finite().nonnegative().nullable(),high:K().finite().nonnegative().nullable(),detail:G(),onPlan:Kw().optional(),apiLow:K().finite().nonnegative().nullable().optional(),apiHigh:K().finite().nonnegative().nullable().optional()}),Oz=J({currency:tT(`USD`),rows:q(Dz),low:K().finite().nonnegative(),high:K().finite().nonnegative(),unknown:K().int().nonnegative(),apiLow:K().finite().nonnegative().optional(),apiHigh:K().finite().nonnegative().optional(),apiUnknown:K().int().nonnegative().optional(),expectedWords:K().finite().nonnegative(),catalogueDate:G().nullable(),assumptions:q(G())}),kz=J({revisionId:wz,admissionId:G().min(1).max(64),workIds:q(G().min(1).max(64)),replayed:Kw()}),Az=J({id:G().min(1).max(64),projectId:G().min(1).max(64),baseRevisionId:wz,planFingerprint:G().min(1),selection:Cz,changedInputs:q(J({path:G(),before:G().nullable(),after:G().nullable()})),work:q(J({key:G(),stage:Y(Ob),kind:Y([`provider`,`local`,`provided`]),disposition:Y([`reuse`,`generate`,`local`,`review`,`blocked`]),requestFingerprint:G(),fingerprint:G(),dependsOn:q(G()),reason:G(),inflight:Kw(),pieceIds:q(G())})),retained:q(J({slot:G(),outputId:G(),assetId:G(),state:Y([`ready`,`outdated`,`review`])})),providedReuseRequired:q(G()),costs:Oz,wholeRequestNotice:G().nullable(),warnings:q(G()),review:J({inputChanges:q(J({label:G(),before:G().nullable(),after:G().nullable()})),requests:q(J({key:G(),label:G(),text:G().nullable(),settings:G().nullable()}))}).optional()}),jz=[`chapter`,`chunk`,`segment`,`image`,`prompt_written`,`article_written`],Mz=[`pending`,`running`,`done`,`failed`];J({id:G(),stage_id:G(),kind:Y(jz),idx:K(),state:Y(Mz),payload:G().nullable()});var Nz=`notes.article_md.article_txt.narration_txt.tts_script.sources.glossary.audio_body.audio_intro.audio_outro.audio_export.image.thumbnail.video.render_params.subtitles_srt.subtitles_vtt.subtitle_words.subtitle_ass.subtitle_font.instructions.document_pdf.youtube_description.youtube_tags.youtube_pinned_comment.youtube_titles.shorts.short_image.short_video.animated_image.figure_card.reference.script_md.audio_mp3.audio_m4b.audio_levelled`.split(`.`),Pz=[`copying`,`staged`],Fz=J({segment:Y([`body`,`intro`,`outro`]).optional(),subtitleOmissions:q(J({start:K().finite().nonnegative(),text:G()})).optional(),subtitlesMode:Y([`off`,`files`,`burn-in`]).optional(),promptName:G().optional(),prompt:G().optional(),index:K().optional(),short:K().optional(),format:Y([`16:9`,`9:16`,`1:1`]).optional(),sentences:Tse([K(),K()]).optional(),warnings:q(G()).optional(),provider:G().optional(),model:G().optional(),voice:G().optional(),loudness:J({pieces:K(),skipped:K(),spreadBefore:K(),spreadAfter:K(),target:K()}).optional(),master:J({target:K(),integrated:K(),truePeak:K()}).optional()}),Iz=J({id:G(),projectId:G(),stageKind:Y(Ob),role:Y(Nz),path:G(),originalFilename:G().nullable(),bytes:K().nonnegative(),durationMs:K().nonnegative().nullable(),meta:Fz,createdAt:G()});J({id:G(),stageKind:Y(Ob),path:G(),originalFilename:G(),bytes:K().nonnegative(),state:Y(Pz),createdAt:G()});var Lz=G().min(1).max(64).regex(/^[0-9A-Za-z_-]+$/),Rz=G().min(1).max(256),zz=Qw(Rz,Lz),Bz=J({id:Lz,text:G().trim().min(1).max(1e4),start:K().finite().nonnegative(),end:K().finite().positive(),speaker:G().min(1).max(60).regex(/^[a-z0-9-]+$/).optional()}).strict().refine(e=>e.end>e.start,{path:[`end`],message:`The end time must be after the start time.`}),Vz=J({from:K().int().positive().max(99),opening:G().min(1).max(2e4),closing:G().min(1).max(2e4),sentences:K().int().positive().max(1e4),title:G().max(200),description:G().max(5e3),hashtags:q(G().max(100)).max(30),why:G().max(2e3),seed:G().max(128).nullable().optional()}).strict(),Hz=J({articleMarkdown:G().max(5e5).optional(),articleEdited:Kw().default(!1),picturesArticle:G().max(5e5).optional(),provided:J({research:Lz.optional(),article:Lz.optional(),audio:Lz.optional(),thumbnail:Lz.optional(),reference:Lz.optional()}).strict(),imageOrder:q(Lz).max(240),imageDefinitions:Qw(Lz,J({source:Y([`generate`,`provide`]),assetId:Lz.nullable(),prompt:G().max(5e5).nullable(),templateKey:G().min(1).max(256).nullable().optional()}).strict()),narrationOverrides:Qw(Rz,Xw(`kind`,[J({kind:tT(`asset`),assetId:Lz}).strict(),J({kind:tT(`text`),text:G().trim().min(1).max(5e5),direction:G().trim().min(1).max(2e4).optional()}).strict()])),narrationSources:Qw(Rz,J({text:G().min(1).max(5e5),start:K().int().nonnegative().max(5e5),bodyFingerprint:G().regex(/^[0-9a-f]{64}$/u),chunkingFingerprint:G().regex(/^[0-9a-f]{64}$/u)}).strict()).refine(e=>Object.keys(e).length<=1e4&&Object.values(e).reduce((e,t)=>e+t.text.length,0)<=5e5,`Narration source bindings exceed the article limit.`).optional(),narrationAnchors:J({chunkingFingerprint:G().regex(/^[0-9a-f]{64}$/u),texts:q(G().min(1).max(5e5)).max(1e4)}).strict().refine(e=>e.texts.reduce((e,t)=>e+t.length,0)<=5e5,`Narration anchors exceed the article limit.`).optional(),subtitleCues:J({audioFingerprint:G().min(1),cues:q(Bz)}).strict().optional(),regenerationTokens:zz,promptTemplates:Qw(G().min(1),G().max(5e5).nullable()),shortsMusic:Lz.optional(),shortsRanges:Qw(G().regex(/^[1-9]\d?$/u),J({first:K().int().positive(),last:K().int().positive(),pick:G().min(1).max(128)}).strict()).optional(),shortsKeep:q(Vz).max(20).optional(),ambientBed:Lz.optional(),thumbnailOverrides:$w(Y([`1`,`2`,`3`]),Lz).optional()}).strict(),Uz=J({baseRevisionId:Lz,idempotencyKey:Lz,edit:J({config:oO.strict(),content:Hz,regenerate:q(Rz).optional(),uploads:q(J({stagedFileId:Lz,destination:Xw(`kind`,[J({kind:tT(`provided`),stage:Y([`audio`,`thumbnail`,`reference`])}).strict(),J({kind:tT(`image`),imageKey:Lz}).strict(),J({kind:tT(`narration`),key:Rz}).strict(),J({kind:tT(`shortsMusic`)}).strict(),J({kind:tT(`thumbnail`),variant:K().int().min(1).max(3)}).strict()])}).strict()).max(1e4).optional()}).strict()}).strict(),Wz=J({baseRevisionId:Lz,idempotencyKey:Lz,targetRevisionId:Lz}).strict(),Gz=J({id:Lz,projectId:Lz,parentId:Lz.nullable(),restoredFromId:Lz.nullable(),config:oO,content:Hz,fingerprints:Qw(Rz,G()),createdAt:G()}),Kz=J({id:Lz,stageId:Lz,kind:Y(jz),idx:K().int(),state:Y(Mz),payload:G().nullable()}),qz=J({slot:G(),workKey:Rz,assetId:Lz,output:Iz,fingerprint:G(),state:Y([`ready`,`outdated`,`review`])}),Jz=J({key:Rz,stageKind:Y(Ob),piece:Kz,assetId:Lz.nullable(),fingerprint:G()}),Yz={recordId:Lz,publicationId:Lz.nullable(),selected:Kw(),available:Kw()},Xz=J({articleMarkdown:G().nullable(),revision:Gz,outputs:q(qz.extend(Yz)),pieces:q(Jz.extend(Yz)),current:Kw()}),Zz=J({id:Lz,parentId:Lz.nullable(),restoredFromId:Lz.nullable(),title:G(),createdAt:G(),current:Kw()}),Qz=J({ok:tT(!0),view:Xz,duplicate:Kw()}),$z=J({ok:tT(!0),view:Xz,created:Kw()}),eB=J({title:G(),status:K(),detail:G().optional(),reason:G().optional(),currentRevisionId:G().nullable().optional(),fields:q(J({field:G(),message:G()})).optional(),errors:q(J({path:G(),message:G()})).optional()});async function tB(e,t){let n;try{n=await e.json()}catch{throw mo(e,void 0)}if(e.ok)return{ok:!0,value:Co(t,n)};let r=eB.safeParse(n);if(!r.success)throw mo(e,void 0);let i=r.data;if(![400,404,409].includes(e.status))throw mo(e,{title:i.title,status:i.status,...i.detail===void 0?{}:{detail:i.detail},...i.fields===void 0?{}:{fields:i.fields}});return{ok:!1,reason:i.reason??`invalid-request`,message:i.detail??i.title,currentRevisionId:i.currentRevisionId??null,fields:i.fields??i.errors?.map(e=>({field:e.path,message:e.message}))??[]}}async function nB(e,t,n,r,i){return tB(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}${n}`,i===void 0?{method:`GET`}:{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(i)}),r)}function rB(e,t){return nB(e,t,`/revisions/prepare`,$z,{})}function iB(e,t,n){return nB(e,t,`/revisions`,Qz,Uz.parse(n))}function aB(e,t,n){return nB(e,t,`/revisions/restore`,Qz,Wz.parse(n))}function oB(e,t){return nB(e,t,`/revisions`,J({revisions:q(Zz)}))}function sB(e,t,n){return nB(e,t,`/revisions/${encodeURIComponent(n)}`,J({view:Xz}))}var cB=q(G()).readonly();function lB(e,t,n){return nB(e,t,`/revisions/${encodeURIComponent(n)}/narration-chunks`,J({chunks:J({intro:cB.optional(),body:cB.optional(),outro:cB.optional()}).nullable()}))}function uB(e,t,n){return nB(e,t,`/rebuild/preview`,J({ok:tT(!0),value:Az}),Tz.parse(n))}function dB(e,t,n){return nB(e,t,`/rebuild`,J({ok:tT(!0),value:kz}),Ez.parse(n))}function fB(e,t,n,r){return`${e.origin}/files/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/${encodeURIComponent(r)}`}async function pB(e,t,n,r){let i=await tB(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/${encodeURIComponent(r)}/open-folder`,{method:`POST`}),az);if(!i.ok)throw Error(i.message);return i.value}function mB(e,t,n){return fB(e,t,n,`images.zip`)}async function hB(e,{projectId:t,asset:n,folder:r=null}){if(r)return pB(e,t,r.revisionId,r.recordId);let i=await e.client.projects[`:id`][`open-folder`].$post({param:{id:t},json:{asset:n}});if(!i.ok)throw mo(i,await ho(i));return az.parse(await i.json())}var gB=`Slopify runs in Docker, which can't open windows on your desktop. Copy this path into your file manager. To have Open folder open it directly, run the Docker launcher again (npx @gentbajko/slopify@latest --docker) so it sets up the host helper.`;function _B(e){return(0,h.jsx)(vB,{...e},JSON.stringify([e.projectId,e.asset,e.folder?.revisionId,e.folder?.recordId]))}function vB(e){let{api:t}=B(),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(),[o,s]=(0,m.useState)();async function c(){r(!0),a(void 0),s(void 0);try{let n=await hB(t,e);n.opened||s(n.path)}catch(e){a(e instanceof Error?e.message:`The folder couldn't be opened. Press Open folder to try again.`)}finally{r(!1)}}return(0,h.jsxs)(jy,{open:o!==void 0||i!==void 0,onOpenChange:e=>{e||(s(void 0),a(void 0))},children:[(0,h.jsx)(ire,{asChild:!0,children:(0,h.jsxs)(z,{variant:`secondary`,size:e.size??`default`,disabled:n,onClick:()=>void c(),title:`Locate the saved output folder on the machine running Slopify`,children:[(0,h.jsx)(Jc,{"aria-hidden":`true`,strokeWidth:1.75}),n?`Locating…`:o?`Locate folder`:`Open folder`]})}),(0,h.jsxs)(Ny,{className:`flex flex-col gap-2`,children:[o===void 0?null:(0,h.jsxs)(`div`,{role:`status`,className:`flex min-w-0 flex-col gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`p`,{className:`m-0`,children:gB}),(0,h.jsx)(`input`,{"aria-label":`Saved folder path`,readOnly:!0,value:o,onFocus:e=>e.currentTarget.select(),className:`sl-input w-full min-w-0 font-mono text-small`}),(0,h.jsx)(yB,{path:o})]}),i===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:i})]})]})}function yB({path:e}){let[t,n]=(0,m.useState)();return(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(z,{variant:`secondary`,size:`small`,onClick:()=>void bz(e).then(n),children:`Copy path`}),t===void 0?null:(0,h.jsx)(`span`,{role:`status`,className:`text-small text-ink-2`,children:t?`Copied.`:`The browser blocked copying. Select the path and copy it.`})]})}var bB={chrome:`Chrome, Edge, Brave`,firefox:`Firefox`};function xB(){return typeof navigator<`u`&&/firefox/i.test(navigator.userAgent)?`firefox`:`chrome`}function SB(){let{api:e}=B(),t=Lv(),[n,r]=(0,m.useState)(xB),i=`slopify-studio-${n}.zip`,a=F({queryKey:[`studio`,`settings`],queryFn:()=>as(e)}).data?.unpacked;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(Iy,{label:`Browser`,value:n,onChange:r,tip:`settings.studio.install`,options:[`chrome`,`firefox`].map(e=>({value:e,label:bB[e]}))}),(0,h.jsxs)(qO,{href:xs(e,n),download:i,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Download for ${n===`chrome`?`Chrome`:`Firefox`}`]})]}),(0,h.jsxs)(`ol`,{"aria-label":`Install steps`,className:`m-0 flex list-decimal flex-col gap-1 pl-5`,children:[n===`chrome`&&a!=null?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`li`,{children:[`Open `,(0,h.jsx)(cL,{children:`chrome://extensions`}),` (Edge: `,(0,h.jsx)(cL,{children:`edge://extensions`}),`), turn on Developer mode, press Load unpacked and pick this folder:`,` `,(0,h.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(cL,{children:a.path}),(0,h.jsxs)(z,{variant:`quiet`,size:`small`,onClick:()=>{navigator.clipboard.writeText(a.path).then(()=>t(`Folder path copied.`,`success`)).catch(()=>t(`Couldn't copy the folder path. Select it and copy it.`,`error`))},children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Copy`]})]})]}),(0,h.jsx)(`li`,{children:`Nothing to download: Slopify puts each new version of the extension in that folder when it updates, and the extension switches to it by itself once you haven't used it for 45 minutes.`})]}):n===`chrome`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`li`,{children:[`Press Download for Chrome, then unzip `,(0,h.jsx)(cL,{children:i}),` into a folder you keep: the browser loads the extension from there.`]}),(0,h.jsxs)(`li`,{children:[`Open `,(0,h.jsx)(cL,{children:`chrome://extensions`}),` (Edge: `,(0,h.jsx)(cL,{children:`edge://extensions`}),`), turn on Developer mode, press Load unpacked and pick that folder.`]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`li`,{children:`Press Download for Firefox. It needs Firefox 128 or newer; keep the zip, you pick it in the next step.`}),(0,h.jsxs)(`li`,{children:[`Open `,(0,h.jsx)(cL,{children:`about:debugging#/runtime/this-firefox`}),`, press Load Temporary Add-on and pick `,(0,h.jsx)(cL,{children:i}),`. Firefox removes it when it restarts; load it again then.`]})]}),(0,h.jsx)(`li`,{children:`Pair it: press Copy beside the pairing token in Settings → YouTube Studio, click the Slopify extension's toolbar button, paste the token and press Pair.`})]})]})}function CB({dirty:e,onDiscard:t,saveLabel:n=`Save`,className:r}){return(0,h.jsx)(SR,{tone:e?`warning`:`info`,...r===void 0?{}:{className:r},children:e?(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,h.jsx)(`span`,{children:`Unsaved changes. Press ${n} or Enter to keep them.`}),(0,h.jsx)(z,{variant:`quiet`,size:`small`,onClick:t,children:`Discard`})]}):null})}function wB({className:e,revealLabel:t=`key`,...n}){let[r,i]=(0,m.useState)(!1);return(0,h.jsxs)(`span`,{className:R(`flex min-w-0 items-center gap-1`,e),children:[(0,h.jsx)(X,{...n,type:r?`text`:`password`,className:`min-w-0 flex-1`}),(0,h.jsx)(Nv,{label:r?`Hide ${t}`:`Show ${t}`,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?(0,h.jsx)(Wc,{"aria-hidden":`true`}):(0,h.jsx)(Gc,{"aria-hidden":`true`})})]})}function TB({value:e,revealLabel:t=`token`,className:n}){let[r,i]=(0,m.useState)(!1);return(0,h.jsxs)(`span`,{className:R(`flex min-w-0 items-center gap-1`,n),children:[(0,h.jsx)(`code`,{className:`sl-code min-w-0 flex-1 truncate py-2 select-all`,children:e===void 0?`…`:r?e:`•`.repeat(Math.min(e.length,24))}),(0,h.jsx)(Nv,{label:r?`Hide ${t}`:`Show ${t}`,"aria-pressed":r,disabled:e===void 0,onClick:()=>i(e=>!e),children:r?(0,h.jsx)(Wc,{"aria-hidden":`true`}):(0,h.jsx)(Gc,{"aria-hidden":`true`})})]})}var EB=[`studio`,`plan`];function DB({autoComment:e}){let{api:t}=B(),n=_(),r=Lv(),i=F({queryKey:EB,queryFn:()=>ls(t)}),a=F(OT(t)),o=I({mutationFn:e=>us(t,{...e,rows:[]}),onSuccess:e=>{n.setQueryData(EB,e),n.invalidateQueries({queryKey:[`studio`,`releases`]}),r(`Removed the old posting plan. Each schedule's release times apply now.`,`success`)},onError:e=>r(`The old posting plan wasn't removed: ${e.message} Try Remove the old plan again.`,`error`)}),s=I({mutationFn:e=>ds(t,e),onSuccess:e=>{n.setQueryData(EB,e),n.invalidateQueries({queryKey:[`studio`,`releases`]}),r(`Each upload is now due ${String(e.leadHours)} hours before its release.`,`success`)},onError:e=>r(`The lead time wasn't saved: ${e.message}`,`error`)}),c=I({mutationFn:e=>gs(t,e),onSuccess:()=>n.invalidateQueries({queryKey:[`studio`,`settings`]}),onError:e=>r(`Not saved: ${e.message}`,`error`)});if(i.data===void 0)return(0,h.jsxs)(`section`,{"aria-label":`Release times`,className:`flex flex-col gap-3`,children:[(0,h.jsx)(U,{as:`h3`,title:`Release times`}),i.error===null?(0,h.jsx)(AL,{label:`Loading the release settings…`,rows:2,rowClassName:`h-10`}):(0,h.jsx)(jL,{what:`The release settings`,error:i.error,onRetry:()=>void i.refetch(),retrying:i.isFetching})]});let l=i.data.plan,u=(a.data??[]).filter(e=>e.deletedAt===null);return(0,h.jsxs)(`section`,{"aria-label":`Release times`,className:`flex flex-col gap-3`,children:[(0,h.jsx)(U,{as:`h3`,title:`Release times`}),(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Each schedule sets when its videos and shorts go out, one line for each day it runs, with a time for every short its template makes:`,` `,(0,h.jsx)(pa,{to:`/calendar`,search:{tab:`schedules`},children:`Calendar → Schedules`}),` `,`→ Edit → Release times. See and move them in Calendar → Releases.`]}),u.length===0?null:(0,h.jsx)(`p`,{className:`m-0 flex flex-wrap gap-x-3 gap-y-1 text-small`,children:u.map(e=>(0,h.jsx)(KO,{to:`/calendar`,search:{tab:`schedules`,schedule:e.id},children:e.name},e.id))}),l.rows.length>0?(0,h.jsx)(fM,{tone:`info`,title:`An older posting plan still applies`,actions:(0,h.jsx)(z,{variant:`secondary`,disabled:o.isPending,onClick:()=>o.mutate(l),children:`Remove the old plan`}),children:(0,h.jsx)(`p`,{className:`m-0`,children:`It has ${String(l.rows.length)} line${l.rows.length===1?``:`s`}, and gives release times to projects no schedule made, and to a schedule's projects when its own times are taken. Set release times in your schedules, then remove it. Times already given keep.`})}):null,(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-small text-ink-2`,children:[`Upload and schedule each video and short at least`,(0,h.jsx)(X,{"aria-label":`Hours before release`,type:`number`,min:1,max:168,className:`w-[72px]`,defaultValue:i.data?.leadHours??24,onBlur:e=>{let t=Number(e.currentTarget.value);Number.isInteger(t)&&t>=1&&t<=168&&t!==i.data?.leadHours&&s.mutate(t)}},i.data?.leadHours??24),`hours before its release, so YouTube's copyright and ad checks finish while it is private.`]}),(0,h.jsx)(Fy,{checked:e===!0,disabled:c.isPending||e===void 0,onChange:e=>c.mutate(e),label:`Post and pin each video's comment once it is public (the extension posts it in your name)`})]})}var OB=[`studio`,`settings`];function kB(){let{api:e}=B(),t=F({queryKey:OB,queryFn:()=>as(e)});return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(U,{title:`Upload pack and extension`,info:`settings.studio.extension`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsx)(jB,{}),(0,h.jsx)(DB,{autoComment:t.data?.autoComment??!1}),(0,h.jsx)(PB,{}),(0,h.jsxs)(`section`,{"aria-label":`Install the Studio extension`,children:[(0,h.jsx)(U,{as:`h3`,title:`Install the Studio extension`,className:`mb-3`}),(0,h.jsx)(SB,{})]})]})]})}var AB=``;function jB(){let{api:e}=B(),t=_(),n=Lv(),r=(0,m.useId)(),i=F({queryKey:OB,queryFn:()=>as(e)}),a=F(Xy(e)),o=(0,m.useId)(),[s,c]=(0,m.useState)(AB),[l,u]=(0,m.useState)({}),d=l[s],f=e=>{u(t=>{let{[s]:n,...r}=t;return e===void 0?r:{...r,[s]:e}})},p=i.data?.playlists??[],g=s===AB?void 0:i.data?.channelPlaylists[s],v=d??(s===AB?p:g??[]),y=NB(v),b=I({mutationFn:t=>os(e,t,s===AB?void 0:s),onSuccess:()=>{f(void 0),t.invalidateQueries({queryKey:OB}),n(`Playlists saved.`,`success`)}}),x=e=>{b.reset(),f(e)},S=y??b.error?.message,C=[{value:AB,label:`Every channel (default)`},...(a.data??[]).map(e=>({value:e.id,label:e.name}))];return(0,h.jsxs)(iL,{label:`Playlists`,tip:`settings.studio.playlist`,help:s===AB?`The playlists upload packs offer, for every channel without its own. Ticked ones are on for every project; Prepare upload changes them for one project.`:g===void 0&&p.length>0?`This channel uses the default list (${(e=>e.map(e=>e.name).join(`, `))(p)}) until you add its own.`:`This channel's own playlists. Ticked ones are on for every project; Prepare upload changes them for one project.`,children:[(0,h.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),!b.isPending&&d!==void 0&&y===void 0&&b.mutate(v)},children:[(0,h.jsx)(sL,{id:o,"aria-label":`Channel`,value:s,options:C,onChange:e=>{b.reset(),c(e.currentTarget.value)},className:`max-w-[260px]`}),v.length===0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Type each name exactly as the playlist is called in YouTube Studio.`}),v.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(X,{autoComplete:`off`,"aria-label":`Playlist ${String(t+1)} name`,className:`min-w-0 flex-1 basis-[220px]`,value:e.name,disabled:i.data===void 0,"aria-invalid":e.name.trim().length>150,"aria-describedby":S===void 0?void 0:r,onChange:e=>x(v.map((n,r)=>r===t?{...n,name:e.target.value}:n))}),(0,h.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-[var(--color-accent)]`,checked:e.byDefault,onChange:e=>{let n=e.currentTarget.checked;x(v.map((e,r)=>r===t?{...e,byDefault:n}:e))}}),`On by default`]}),(0,h.jsx)(sL,{"aria-label":`${e.name.trim()||`Playlist ${String(t+1)}`}: takes`,className:`w-[190px]`,value:e.for??`all`,onChange:e=>{let n=e.currentTarget.value,r=n===`long`||n===`shorts`?n:`all`;x(v.map((e,n)=>n===t?{...e,for:r}:e))},options:[{value:`all`,label:`Videos and shorts`},{value:`long`,label:`Long videos only`},{value:`shorts`,label:`Shorts only`}]}),(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Remove ${e.name.trim()||`playlist ${String(t+1)}`}`,onClick:()=>x(v.filter((e,n)=>n!==t)),children:`Remove`})]},t)),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(z,{variant:`secondary`,disabled:i.data===void 0||v.length>=20,onClick:()=>x([...v,{name:``,byDefault:v.length===0}]),children:[(0,h.jsx)(pl,{"aria-hidden":`true`,strokeWidth:1.75}),`Add playlist`]}),(0,h.jsx)(z,{type:`submit`,variant:`primary`,disabled:b.isPending||d===void 0||y!==void 0,disabledReason:y??`Nothing changed since the last save.`,children:`Save playlists`})]}),MB(v)===void 0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-waiting`,children:MB(v)}),(0,h.jsx)(CB,{dirty:d!==void 0,saveLabel:`Save playlists`,onDiscard:()=>{b.reset(),f(void 0)}})]}),S===void 0?null:(0,h.jsx)(`p`,{id:r,role:`alert`,className:`m-0 text-small text-danger`,children:S})]})}function MB(e){let t=e.find(e=>/\bshorts?\b/i.test(e.name)&&(e.for??`all`)===`all`);if(t!==void 0)return`"${t.name.trim()}" takes long videos too, and shorts also go into every playlist set to Videos and shorts. Set it to Shorts only, and your long-video playlists to Long videos only.`}function NB(e){if(e.find(e=>e.name.trim().length>150)!==void 0)return`A playlist name is longer than YouTube allows (150 characters). Shorten it.`;let t=new Set;for(let n of e){let e=n.name.trim().toLowerCase();if(e!==``){if(t.has(e))return`"${n.name.trim()}" is listed twice. Remove one.`;t.add(e)}}}function PB(){let{api:e}=B(),t=_(),n=Lv(),r=F({queryKey:OB,queryFn:()=>as(e)}),i=I({mutationFn:()=>ws(e),onSuccess:()=>{t.invalidateQueries({queryKey:OB}),n(`New pairing token made. Pair the extension again with it.`,`success`)}}),a=r.data?.pairing;return(0,h.jsxs)(`div`,{className:`sl-field`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`sl-field__label`,children:`Extension pairing token`}),(0,h.jsx)(H,{id:`settings.studio.pairing`,className:`-my-1`})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(TB,{value:a?.token,revealLabel:`pairing token`,className:`flex-1 basis-[220px]`}),(0,h.jsxs)(z,{variant:`quiet`,disabled:a===void 0,onClick:()=>{if(a!==void 0){if(!navigator.clipboard){n(`Couldn't copy the token. Select it and copy it.`,`error`);return}navigator.clipboard.writeText(a.token).then(()=>n(`Pairing token copied. Paste it into the extension's options.`,`success`),()=>n(`Couldn't copy the token. Select it and copy it.`,`error`))}},children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),`Copy`]}),(0,h.jsx)(z,{variant:`quiet`,disabled:i.isPending||a===void 0,onClick:()=>i.mutate(),children:`New pairing token`})]}),(0,h.jsx)(`p`,{className:`sl-field__help m-0`,children:a?.origin==null?`No extension is paired. Paste this token into the Slopify Studio extension's options and press Pair.`:`Paired with the extension at ${a.origin}. A new token unpairs it.`}),i.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:i.error.message})]})}var FB=[`studio`,`queue`];function IB({projectId:e,ready:t,variant:n=`secondary`,size:r=`default`}){let[i,a]=(0,m.useState)(!1);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{variant:n,size:r,disabled:!t,disabledReason:`Available once the video has been made`,onClick:()=>a(!0),children:`Prepare upload`}),i?(0,h.jsx)(BB,{projectId:e,onClose:()=>a(!1)}):null]})}var LB={video:`Video file`,title:`Title`,description:`Description`,thumbnails:`Thumbnail`,playlist:`Playlist`,audience:`Audience`,altered:`AI use (under Show more)`,tags:`Tags (under Show more)`,schedule:`Schedule (Visibility)`};function RB(e){return new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e))}function zB(e){return e.kind===`video`?`video`:`short-${String(e.short)}`}function BB({projectId:e,onClose:t}){let{api:n}=B(),r=_(),i=[`studio`,`pack`,e],a=F({queryKey:i,queryFn:()=>Ts(n,e)}),[o,s]=(0,m.useState)(`video`),[c,l]=(0,m.useState)(),u=a.data?.items??[],d=u.find(e=>zB(e)===o)??u[0],f=F({queryKey:OB,queryFn:()=>as(n)}),p=f.data===void 0?void 0:f.data.pairing.origin!==null,g=F({queryKey:FB,queryFn:()=>Ss(n)}),v=I({mutationFn:t=>Ds(n,e,t.short),onSuccess:e=>{r.setQueryData(FB,e),l({text:e.length>1?`Added; ${String(e.length)} uploads are waiting. Studio is opening: each upload you start there is filled with the next one, in the order under Waiting for Studio. Check everything and publish yourself.`:`Studio is opening. The Slopify Studio extension puts the video into its upload dialog and fills in the details. Check everything and publish yourself.`,tone:`success`})},onError:e=>l({text:`Couldn't hand this to the extension: ${e.message}`,tone:`error`})}),y=I({mutationFn:e=>Cs(n,e.projectId,e.short),onSuccess:e=>r.setQueryData(FB,e),onError:e=>l({text:`Couldn't remove it from Waiting for Studio: ${e.message} Press Remove again.`,tone:`error`})}),b=I({mutationFn:t=>Es(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved. The AI use answer is updated.`,tone:`success`})},onError:e=>l({text:`Couldn't save whether the clips are real footage: ${e.message} Press the switch again.`,tone:`error`})}),x=I({mutationFn:t=>ss(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved this project's playlists.`,tone:`success`})},onError:e=>l({text:`Couldn't save the playlists: ${e.message} Tick the playlist again.`,tone:`error`})}),S=I({mutationFn:t=>_s(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved when this project goes out.`,tone:`success`})},onError:e=>l({text:`Couldn't change the slot: ${e.message} Choose it again.`,tone:`error`})}),C=I({mutationFn:t=>cs(n,e,t),onSuccess:e=>{r.setQueryData(i,e),l({text:`Saved what the upload uses.`,tone:`success`})},onError:e=>l({text:`Couldn't save the choice: ${e.message} Choose it again.`,tone:`error`})});return(0,h.jsxs)(eM,{open:!0,title:`Prepare upload`,onClose:t,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(SR,{tone:c?.tone??`info`,children:c?.text}),p===!1?(0,h.jsx)(qO,{href:dR,target:`_blank`,rel:`noopener noreferrer`,variant:`secondary`,children:`Open YouTube Studio`}):null,(0,h.jsx)(z,{variant:`primary`,disabled:d===void 0||v.isPending||p!==!0,disabledReason:p===!1?`Install and pair the Slopify Studio extension first (steps above)`:f.error===null?`Wait for the upload pack to load`:`Couldn't check whether the extension is paired: ${f.error.message} Close Prepare upload and open it again.`,onClick:()=>{d!==void 0&&(window.open(dR,`_blank`,`noopener`),v.mutate(d))},children:`Fill in YouTube Studio`}),(0,h.jsx)(H,{id:`project.upload.fill-studio`})]}),children:[a.error===null?null:(0,h.jsx)(fM,{tone:`danger`,title:`The upload pack couldn't be read.`,children:`${a.error.message} Close Prepare upload and open it again.`}),a.data===void 0?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[p===!1?(0,h.jsx)(fM,{tone:`waiting`,title:`The Slopify Studio extension isn't paired.`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(`p`,{className:`m-0`,children:`Without it, the steps below are the upload pack: copy each into Studio's upload dialog. To have Studio filled in for you, install the extension:`}),(0,h.jsx)(SB,{})]})}):null,u.length>1?(0,h.jsx)(Iy,{label:`What to upload`,value:d===void 0?``:zB(d),onChange:s,tip:`project.upload.item`,options:u.map(e=>({value:zB(e),label:e.kind===`video`?`Video`:`Short ${String(e.short)}`})),className:`self-start`}):null,a.data.missing.length===0?null:(0,h.jsx)(fM,{tone:`waiting`,title:`Some of it isn't made yet.`,children:(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.data.missing.map(e=>(0,h.jsx)(`li`,{children:e},e))})}),d===void 0?null:(0,h.jsx)(UB,{projectId:e,item:d,footageSwitch:d.kind===`video`&&a.data.footage!==void 0?(0,h.jsx)(Fy,{checked:b.isPending?b.variables:a.data.footage.real,disabled:b.isPending,onChange:e=>b.mutate(e),tip:`project.upload.real-footage`,label:`The ${a.data.footage.clips===1?`uploaded clip is`:`${String(a.data.footage.clips)} uploaded clips are`} real footage (filmed, not made by AI)`}):void 0,playlistPicker:a.data.playlistChoices.length>1?(0,h.jsx)(`span`,{className:`flex flex-col gap-1`,children:a.data.playlistChoices.map(e=>(0,h.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-[var(--color-accent)]`,checked:e.chosen,disabled:x.isPending,onChange:t=>{let n=t.currentTarget.checked;x.mutate(a.data.playlistChoices.filter(t=>t.name===e.name?n:t.chosen).map(e=>e.name))}}),e.name]},e.name))}):void 0,copy:(e,t)=>{if(!navigator.clipboard){l({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`});return}navigator.clipboard.writeText(e).then(()=>l({text:`Copied the ${t}.`,tone:`success`}),()=>l({text:`Couldn't copy the ${t}. Select the text and copy it.`,tone:`error`}))},onPick:e=>C.mutate(e),slotPicker:d.kind===`video`?(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,...Py,children:[(0,h.jsx)(sL,{"aria-label":`Posting plan slot`,value:a.data.schedule===void 0?``:`${a.data.schedule.row}|${a.data.schedule.longAt}`,disabled:S.isPending,onChange:e=>{let[t,n]=e.currentTarget.value.split(`|`);S.mutate(t===void 0||n===void 0?null:{row:t,longAt:n})},options:[{value:``,label:`Not scheduled (set it in Studio yourself)`},...a.data.schedule===void 0?[]:[{value:`${a.data.schedule.row}|${a.data.schedule.longAt}`,label:RB(a.data.schedule.longAt)}],...(a.data.slotChoices??[]).map(e=>({value:`${e.row}|${e.longAt}`,label:RB(e.longAt)}))]}),(0,h.jsx)(H,{id:`project.upload.slot`})]}):void 0,picking:C.isPending,doneKey:`slopify.upload.${e}.${zB(d)}`},zB(d)),(g.data??[]).length===0?null:(0,h.jsxs)(`section`,{"aria-label":`Waiting for Studio`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center gap-1`,children:[(0,h.jsx)(`div`,{className:`sl-kicker`,children:`Waiting for Studio`}),(0,h.jsx)(H,{id:`project.upload.queue`,className:`-my-1`})]}),(0,h.jsx)(KL,{label:`Waiting to be filled`,children:(g.data??[]).map((e,t)=>{let n=e.short===null?`Video`:`Short ${String(e.short)}`;return(0,h.jsx)(qL,{title:`${e.projectTitle} · ${n}`,meta:t===0?`Next: filled in the next upload dialog you open in Studio.`:`Filled after ${String(t)} more upload${t===1?``:`s`}.`,actions:(0,h.jsx)(z,{variant:`quiet`,size:`small`,disabled:y.isPending,"aria-label":`Remove ${e.projectTitle} ${n.toLowerCase()} from Waiting for Studio`,onClick:()=>y.mutate(e),children:`Remove`})},`${e.projectId}-${String(e.short)}`)})})]}),(0,h.jsx)(fM,{title:`Slopify never publishes.`,children:p===!1?`Copy each step into Studio's upload dialog (Open YouTube Studio), check it and press Publish yourself.`:`Fill in YouTube Studio hands this to the Slopify Studio extension, which puts the video into Studio's upload dialog and fills in the details. You check it and press Publish.`})]})]})}function VB(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function HB({href:e,filename:t}){return(0,h.jsxs)(qO,{href:e,download:t,"aria-label":`Download ${t}`,variant:`secondary`,size:`small`,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Download`]})}function UB({projectId:e,item:t,footageSwitch:n,playlistPicker:r,copy:i,onPick:a,picking:o,slotPicker:s,doneKey:c}){let{api:l}=B(),[u,d]=(0,m.useState)(()=>VB(c)),[f,p]=(0,m.useState)(null),g=e=>{d(e);try{localStorage.setItem(c,JSON.stringify(e))}catch{}},_=(e,t)=>g(t?[...u,e]:u.filter(t=>t!==e)),v=fR.filter(e=>e!==`thumbnails`||t.kind===`video`),y=v.filter(e=>u.includes(e)).length,b=e=>{let n=GB(t,e);return(0,h.jsxs)(z,{variant:`quiet`,size:`small`,disabled:n===``,disabledReason:`Nothing to copy yet`,"aria-label":`Copy ${LB[e].toLowerCase()}`,onClick:()=>i(n,LB[e].toLowerCase()),children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Copy`]})},x=c=>{switch(c){case`video`:return t.video===null?{value:(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Not made yet.`})}:{value:t.video.filename,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(HB,{href:`${l.origin}${t.video.url}`,filename:t.video.filename}),(0,h.jsx)(_B,{projectId:e,asset:t.video.asset,size:`small`})]})};case`thumbnails`:return t.thumbnails.length===0?{value:(0,h.jsx)(`span`,{className:`text-ink-3`,children:`None made.`})}:{value:t.thumbnails.length>1?`${WB(t.pickable?.thumbnail??0)} under Thumbnail (choose below). The A/B test tries all ${String(t.thumbnails.length)} once the video is public.`:t.thumbnails[0]?.filename??``,actions:(0,h.jsx)(_B,{projectId:e,asset:t.thumbnails[0]?.asset??`thumbnail`,size:`small`})};case`audience`:return{value:`No, it's not made for kids`};case`altered`:return{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:t.alteredContent.altered?`Yes`:`No`}),(0,h.jsx)(`span`,{className:`text-ink-2`,children:t.alteredContent.why}),n]})};case`description`:return{value:t.chapterNotice===void 0?GB(t,c)||(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Not written yet.`}):(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{children:t.description}),(0,h.jsx)(`span`,{className:`text-waiting`,children:t.chapterNotice})]}),actions:b(c)};case`title`:return t.titles.length===0||t.pickable===void 0?{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{children:GB(t,c)}),(0,h.jsx)(KB,{title:t.title})]}),actions:b(c)}:{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(KB,{title:t.title}),(0,h.jsx)(`span`,{role:`radiogroup`,"aria-label":`Title the upload uses`,className:`flex flex-col gap-1`,children:t.pickable.titles.map((n,r)=>(0,h.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`radio`,name:`upload-title-${e}`,className:`size-4 accent-[var(--color-accent)]`,checked:r===t.pickable?.title,disabled:o,onChange:()=>a({title:r,thumbnail:t.pickable?.thumbnail??0})}),n]},n))}),(0,h.jsx)(`span`,{className:`text-ink-2`,children:`The upload uses the chosen title; the A/B test tries the others beside it once the video is public.`})]}),actions:(0,h.jsxs)(h.Fragment,{children:[b(c),(0,h.jsxs)(z,{variant:`quiet`,size:`small`,"aria-label":`Copy the other titles`,onClick:()=>i(t.titles.join(`
|
|
161
161
|
`),`other titles`),children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-4 shrink-0`,strokeWidth:1.75}),`Copy others`]})]})};case`schedule`:return{value:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[s,(0,h.jsx)(`span`,{className:`text-ink-2`,children:t.scheduleAt===void 0?`Not scheduled: Slopify has no slot for it. Set the date in Studio's Visibility step.`:`${RB(t.scheduleAt)}, your time. The extension types it into Studio's Visibility step; you press Schedule.`})]})};case`playlist`:return{value:r??(t.playlists.length>0?t.playlists.join(`, `):(0,h.jsx)(`span`,{className:`text-ink-3`,children:`None set (Settings → YouTube Studio).`})),actions:b(c)};default:return{value:GB(t,c)||(0,h.jsx)(`span`,{className:`text-ink-3`,children:`Not written yet.`}),actions:b(c)}}};return(0,h.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,h.jsxs)(`section`,{"aria-label":`In the order Studio asks`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex items-center gap-1`,children:[(0,h.jsx)(`div`,{className:`sl-kicker`,children:`In the order Studio asks`}),(0,h.jsx)(H,{id:`project.upload.steps`,className:`-my-1`}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsxs)(`label`,{className:`flex min-h-8 cursor-pointer items-center gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:y===v.length,ref:e=>{e!==null&&(e.indeterminate=y>0&&y<v.length)},onChange:e=>g(e.currentTarget.checked?[...v]:[]),className:`size-4 shrink-0 accent-[var(--color-accent)]`}),`Select all`]})]}),(0,h.jsx)(KL,{label:`Upload steps`,className:`[&_.sl-row__actions]:flex-wrap`,children:v.map(e=>{let{value:t,actions:n}=x(e);return(0,h.jsx)(qL,{className:`items-start`,lead:(0,h.jsx)(`input`,{type:`checkbox`,checked:u.includes(e),onChange:t=>_(e,t.currentTarget.checked),className:`mt-1 size-4 shrink-0 self-start accent-[var(--color-accent)]`,"aria-label":`${LB[e]} done`}),title:LB[e],meta:(0,h.jsx)(`span`,{className:`line-clamp-4 whitespace-pre-wrap break-words text-ink`,children:t}),actions:n},e)})})]}),t.thumbnails.length===0?null:(0,h.jsxs)(`section`,{"aria-label":`Thumbnails`,children:[(0,h.jsx)(U,{as:`h3`,kicker:`Thumbnails · A/B Testing`,title:`${String(t.thumbnails.length)} ${t.thumbnails.length===1?`thumbnail`:`thumbnails`}`,className:`mb-3`}),(0,h.jsx)(nz,{label:`Thumbnails to upload`,density:`compact`,children:(t.pickable?.thumbnails??t.thumbnails).map((e,n)=>{let r=n===(t.pickable?.thumbnail??0);return(0,h.jsx)(tz,{src:`${l.origin}${e.url}`,alt:`Thumbnail ${WB(n)}`,title:r&&t.thumbnails.length>1?`${WB(n)} · upload`:WB(n),meta:e.filename,onOpen:()=>p(n),openLabel:`Open thumbnail ${WB(n)} full size`,actionsShown:!0,actions:(0,h.jsxs)(h.Fragment,{children:[r||t.pickable===void 0?null:(0,h.jsx)(z,{variant:`quiet`,size:`small`,disabled:o,onClick:()=>a({title:t.pickable?.title??0,thumbnail:n}),children:`Use for upload`}),(0,h.jsx)(HB,{href:`${l.origin}${e.url}`,filename:e.filename})]})},e.asset)})}),(0,h.jsx)(rz,{items:(t.pickable?.thumbnails??t.thumbnails).map((e,t)=>({src:`${l.origin}${e.url}`,alt:`Thumbnail ${String.fromCharCode(65+t)}`,caption:e.filename})),index:f,onIndex:p,onClose:()=>p(null),actions:(e,n)=>{let r=(t.pickable?.thumbnails??t.thumbnails)[n];return r===void 0?null:(0,h.jsx)(HB,{href:`${l.origin}${r.url}`,filename:r.filename})}})]})]})}function WB(e){return String.fromCharCode(65+e)}function GB(e,t){switch(t){case`title`:return e.title;case`description`:return e.description;case`tags`:return pR(e.tags);case`playlist`:return e.playlists.join(`, `);default:return``}}function KB({title:e}){let t=vR(e);return t===void 0?null:(0,h.jsx)(`span`,{role:`alert`,className:`text-danger`,children:`${t} Change it in the project's YouTube section (Video), then open Prepare upload again.`})}var qB=new Intl.DateTimeFormat(void 0,{dateStyle:`full`}),JB=new Intl.DateTimeFormat(void 0,{timeStyle:`short`}),YB=new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`});function XB({project:e}){let t=UL(e);return(0,h.jsx)(qL,{title:(0,h.jsx)(pa,{to:`/projects/$projectId`,params:{projectId:e.id},children:e.title}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(tk,{tone:t.tone,children:t.word}),t.action===void 0?null:t.action.kind===`upload`?(0,h.jsx)(IB,{projectId:e.id,ready:!0}):(0,h.jsx)(GO,{to:`/projects/$projectId`,params:{projectId:e.id},size:`small`,variant:`secondary`,children:t.action.label})]})})}function ZB({days:e,busy:t,schedules:n,onStep:r,onMove:i,onTransfer:a}){let o=[...e.values()].sort((e,t)=>e.key.localeCompare(t.key));if(o.length===0)return(0,h.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`Nothing is planned in these weeks. Add topics with Add to calendar, or create a schedule on the`,` `,(0,h.jsx)(pa,{to:`/calendar`,search:{tab:`schedules`},children:`Schedules`}),` `,`tab.`]});let s=o.flatMap(e=>e.runs),c=n.filter(e=>e.deletedAt===null&&(e.status===`active`||e.status===`paused`));return(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,...Py,children:[(0,h.jsxs)(`p`,{className:`m-0 flex items-center gap-1 text-small text-ink-2`,children:[`Move a topic earlier, later, to another day or to another schedule from its row.`,(0,h.jsx)(H,{id:`planning.calendar.move`,className:`-my-1`})]}),o.map(e=>(0,h.jsxs)(`section`,{"aria-label":qB.format(e.date),children:[(0,h.jsx)(U,{title:qB.format(e.date),as:`h3`}),(0,h.jsxs)(KL,{label:`Planned on ${qB.format(e.date)}`,children:[e.runs.map(e=>{let n=rR(e),o=c.filter(t=>t.id!==e.scheduleId),l=s.filter(t=>t.scheduleId===e.scheduleId&&t.index!==null&&t.index!==e.index);return(0,h.jsx)(qL,{title:n,meta:(0,h.jsxs)(h.Fragment,{children:[JB.format(new Date(e.at)),` ·`,` `,(0,h.jsx)(KO,{to:`/calendar`,search:{tab:`schedules`,schedule:e.scheduleId},children:e.scheduleName}),e.templateName===null?null:(0,h.jsxs)(h.Fragment,{children:[` · `,(0,h.jsx)(KO,{to:`/templates`,search:{item:e.templateId},children:e.templateName})]}),e.paused?` · Paused`:``]}),actions:e.index===null?void 0:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(uR,{run:e}),(0,h.jsx)(Nv,{size:`small`,label:`Move ${n} earlier`,disabled:t,onClick:()=>r(e,-1),children:(0,h.jsx)(wc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Nv,{size:`small`,label:`Move ${n} later`,disabled:t,onClick:()=>r(e,1),children:(0,h.jsx)(bc,{"aria-hidden":`true`,strokeWidth:1.75})}),o.length===0&&l.length===0?null:(0,h.jsx)(QB,{title:n,busy:t,days:l,schedules:o,onDay:t=>i(e,t),onSchedule:t=>a(e,t)})]})},`${e.scheduleId}-${e.at}`)}),e.projects.map(e=>(0,h.jsx)(XB,{project:e},e.id))]})]},e.key))]})}function QB({title:e,busy:t,days:n,schedules:r,onDay:i,onSchedule:a}){let[o,s]=(0,m.useState)(``);return(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`select`,{"aria-label":`Move ${e} to…`,className:`sl-select h-8 w-auto text-small`,value:o,disabled:t,onChange:e=>s(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`Move to…`}),n.length===0?null:(0,h.jsx)(`optgroup`,{label:`Another day`,children:n.map(e=>(0,h.jsx)(`option`,{value:`day:${String(e.index)}`,children:YB.format(new Date(e.at))},e.at))}),r.length===0?null:(0,h.jsx)(`optgroup`,{label:`End of another schedule`,children:r.map(e=>(0,h.jsx)(`option`,{value:`schedule:${e.id}`,children:e.name},e.id))})]}),(0,h.jsx)(z,{size:`small`,variant:`secondary`,disabled:t||o===``,onClick:()=>{let[e,t]=o.split(`:`),r=n.find(e=>String(e.index)===t);e===`day`&&r!==void 0&&i(r),e===`schedule`&&t!==void 0&&a(t),s(``)},children:`Move`})]})}var $B=Symbol.for(`yaml.alias`),eV=Symbol.for(`yaml.document`),tV=Symbol.for(`yaml.map`),nV=Symbol.for(`yaml.pair`),rV=Symbol.for(`yaml.scalar`),iV=Symbol.for(`yaml.seq`),aV=Symbol.for(`yaml.node.type`),oV=e=>!!e&&typeof e==`object`&&e[aV]===$B,sV=e=>!!e&&typeof e==`object`&&e[aV]===eV,cV=e=>!!e&&typeof e==`object`&&e[aV]===tV,lV=e=>!!e&&typeof e==`object`&&e[aV]===nV,uV=e=>!!e&&typeof e==`object`&&e[aV]===rV,dV=e=>!!e&&typeof e==`object`&&e[aV]===iV;function fV(e){if(e&&typeof e==`object`)switch(e[aV]){case tV:case iV:return!0}return!1}function pV(e){if(e&&typeof e==`object`)switch(e[aV]){case $B:case tV:case rV:case iV:return!0}return!1}var mV=e=>(uV(e)||fV(e))&&!!e.anchor,hV=Symbol(`break visit`),gV=Symbol(`skip children`),_V=Symbol(`remove node`);function vV(e,t){let n=bV(t);sV(e)?yV(null,e.contents,n,Object.freeze([e]))===_V&&(e.contents=null):yV(null,e,n,Object.freeze([]))}vV.BREAK=hV,vV.SKIP=gV,vV.REMOVE=_V;function yV(e,t,n,r){let i=xV(e,t,n,r);if(pV(i)||lV(i))return SV(e,r,i),yV(e,i,n,r);if(typeof i!=`symbol`){if(fV(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=yV(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===hV)return hV;else i===_V&&(t.items.splice(e,1),--e)}}else if(lV(t)){r=Object.freeze(r.concat(t));let e=yV(`key`,t.key,n,r);if(e===hV)return hV;e===_V&&(t.key=null);let i=yV(`value`,t.value,n,r);if(i===hV)return hV;i===_V&&(t.value=null)}}return i}function bV(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function xV(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(cV(t))return n.Map?.(e,t,r);if(dV(t))return n.Seq?.(e,t,r);if(lV(t))return n.Pair?.(e,t,r);if(uV(t))return n.Scalar?.(e,t,r);if(oV(t))return n.Alias?.(e,t,r)}function SV(e,t,n){let r=t[t.length-1];if(fV(r))r.items[e]=n;else if(lV(r))e===`key`?r.key=n:r.value=n;else if(sV(r))r.contents=n;else{let e=oV(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var CV={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},wV=e=>e.replace(/[!,[\]{}]/g,e=>CV[e]),TV=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+wV(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&pV(e.contents)){let t={};vV(e.contents,(e,n)=>{pV(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)(i!==`!!`||a!==`tag:yaml.org,2002:`)&&(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
162
162
|
`)}};TV.defaultYaml={explicit:!1,version:`1.2`},TV.defaultTags={"!!":`tag:yaml.org,2002:`};function EV(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function DV(e){let t=new Set;return vV(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function OV(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function kV(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=DV(e);let a=OV(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(uV(t.node)||fV(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function AV(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=AV(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=AV(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=AV(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=AV(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function jV(e,t,n){if(Array.isArray(e))return e.map((e,t)=>jV(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!mV(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var MV=class{constructor(e){Object.defineProperty(this,aV,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!sV(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=jV(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?AV(i,{"":o},``,o):o}},NV=class extends MV{constructor(e){super($B),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],vV(e,{Node:(e,t)=>{(oV(t)||mV(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(jV(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=PV(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(EV(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function PV(e,t,n){if(oV(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(fV(t)){let r=0;for(let i of t.items){let t=PV(e,i,n);t>r&&(r=t)}return r}if(lV(t)){let r=PV(e,t.key,n),i=PV(e,t.value,n);return Math.max(r,i)}return 1}var FV=e=>!e||typeof e!=`function`&&typeof e!=`object`,IV=class extends MV{constructor(e){super(rV),this.value=e}toJSON(e,t){return t?.keep?this.value:jV(this.value,e,t)}toString(){return String(this.value)}};IV.BLOCK_FOLDED=`BLOCK_FOLDED`,IV.BLOCK_LITERAL=`BLOCK_LITERAL`,IV.PLAIN=`PLAIN`,IV.QUOTE_DOUBLE=`QUOTE_DOUBLE`,IV.QUOTE_SINGLE=`QUOTE_SINGLE`;var LV=`tag:yaml.org,2002:`;function RV(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function zV(e,t,n){if(sV(e)&&(e=e.contents),pV(e))return e;if(lV(e)){let t=n.schema[tV].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new NV(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=LV+t.slice(2));let l=RV(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new IV(e);return c&&(c.node=t),t}l=e instanceof Map?o[tV]:Symbol.iterator in Object(e)?o[iV]:o[tV]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new IV(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function BV(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return zV(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var VV=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,HV=class extends MV{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>pV(t)||lV(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(VV(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(fV(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,BV(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(fV(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&uV(i)?i.value:i:fV(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!lV(t))return!1;let n=t.value;return n==null||e&&uV(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return fV(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(fV(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,BV(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},UV=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function WV(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var GV=(e,t,n)=>e.endsWith(`
|
|
163
163
|
`)?WV(n,t):n.includes(`
|
|
@@ -271,7 +271,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
271
271
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return i(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function y(e,t){return r(e)||h(e,t)||C(e,t)||g()}function b(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function x(e){var t=b(e,`string`);return typeof t==`symbol`?t:t+``}function S(e){"@babel/helpers - typeof";return S=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},S(e)}function C(e,t){if(e){if(typeof e==`string`)return n(e,t);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function w(e){var t=typeof Map==`function`?new Map:void 0;return w=function(e){function n(){return s(e,arguments,d(this).constructor)}if(e===null||!p(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,e)},w(e)}var T=function(e){var t=Math.abs,n=Math.max,r=Math.floor;function i(e,t){var n;if(o(this,i),n=a(this,i,[e]),n.sign=t,Object.setPrototypeOf(n,i.prototype),e>i.__kMaxLength)throw RangeError(`Maximum BigInt size exceeded`);return n}return f(i,e),l(i,[{key:`toDebugString`,value:function(){var e,t=[`BigInt[`],n=u(this);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.push((r&&(r>>>0).toString(16))+`, `)}}catch(e){n.e(e)}finally{n.f()}return t.push(`]`),t.join(``)}},{key:`toString`,value:function(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:10;if(2>e||36<e)throw RangeError(`toString() radix argument must be between 2 and 36`);return this.length===0?`0`:e&e-1?i.__toStringGeneric(this,e,!1):i.__toStringBasePowerOfTwo(this,e)}},{key:`valueOf`,value:function(){throw Error("Convert JSBI instances to native numbers using `toNumber`.")}},{key:`__copy`,value:function(){for(var e=new i(this.length,this.sign),t=0;t<this.length;t++)e[t]=this[t];return e}},{key:`__trim`,value:function(){for(var e=this.length,t=this[e-1];t===0;)e--,t=this[e-1],this.pop();return e===0&&(this.sign=!1),this}},{key:`__initializeDigits`,value:function(){for(var e=0;e<this.length;e++)this[e]=0}},{key:`__clzmsd`,value:function(){return i.__clz30(this.__digit(this.length-1))}},{key:`__inplaceMultiplyAdd`,value:function(e,t,n){n>this.length&&(n=this.length);for(var r=32767&e,a=e>>>15,o=0,s=t,c=0;c<n;c++){var l=this.__digit(c),u=32767&l,d=l>>>15,f=i.__imul(u,r),p=i.__imul(u,a),m=i.__imul(d,r),h=i.__imul(d,a),g=s+f+o;o=g>>>30,g&=1073741823,g+=((32767&p)<<15)+((32767&m)<<15),o+=g>>>30,s=h+(p>>>15)+(m>>>15),this.__setDigit(c,1073741823&g)}if(o!==0||s!==0)throw Error(`implementation bug`)}},{key:`__inplaceAdd`,value:function(e,t,n){for(var r,i=0,a=0;a<n;a++)r=this.__halfDigit(t+a)+e.__halfDigit(a)+i,i=r>>>15,this.__setHalfDigit(t+a,32767&r);return i}},{key:`__inplaceSub`,value:function(e,t,n){var r=n-1>>>1,i=0;if(1&t){t>>=1;for(var a=this.__digit(t),o=32767&a,s=0;s<r;s++){var c=e.__digit(s),l=(a>>>15)-(32767&c)-i;i=1&l>>>15,this.__setDigit(t+s,(32767&l)<<15|32767&o),a=this.__digit(t+s+1),o=(32767&a)-(c>>>15)-i,i=1&o>>>15}var u=e.__digit(s),d=(a>>>15)-(32767&u)-i;i=1&d>>>15,this.__setDigit(t+s,(32767&d)<<15|32767&o);var f=u>>>15;if(t+s+1>=this.length)throw RangeError(`out of bounds`);!(1&n)&&(a=this.__digit(t+s+1),o=(32767&a)-f-i,i=1&o>>>15,this.__setDigit(t+e.length,1073709056&a|32767&o))}else{t>>=1;for(var p=0;p<e.length-1;p++){var m=this.__digit(t+p),h=e.__digit(p),g=(32767&m)-(32767&h)-i;i=1&g>>>15;var _=(m>>>15)-(h>>>15)-i;i=1&_>>>15,this.__setDigit(t+p,(32767&_)<<15|32767&g)}var v=this.__digit(t+p),y=e.__digit(p),b=(32767&v)-(32767&y)-i;i=1&b>>>15;var x=0;!(1&n)&&(x=(v>>>15)-(y>>>15)-i,i=1&x>>>15),this.__setDigit(t+p,(32767&x)<<15|32767&b)}return i}},{key:`__inplaceRightShift`,value:function(e){if(e!==0){for(var t,n=this.__digit(0)>>>e,r=this.length-1,i=0;i<r;i++)t=this.__digit(i+1),this.__setDigit(i,1073741823&t<<30-e|n),n=t>>>e;this.__setDigit(r,n)}}},{key:`__digit`,value:function(e){return this[e]}},{key:`__unsignedDigit`,value:function(e){return this[e]>>>0}},{key:`__setDigit`,value:function(e,t){this[e]=0|t}},{key:`__setDigitGrow`,value:function(e,t){this[e]=0|t}},{key:`__halfDigitLength`,value:function(){var e=this.length;return 32767>=this.__unsignedDigit(e-1)?2*e-1:2*e}},{key:`__halfDigit`,value:function(e){return 32767&this[e>>>1]>>>15*(1&e)}},{key:`__setHalfDigit`,value:function(e,t){var n=e>>>1,r=this.__digit(n),i=1&e?32767&r|t<<15:1073709056&r|32767&t;this.__setDigit(n,i)}}],[{key:`BigInt`,value:function(e){var t=Number.isFinite;if(typeof e==`number`){if(e===0)return i.__zero();if(i.__isOneDigitInt(e))return 0>e?i.__oneDigit(-e,!0):i.__oneDigit(e,!1);if(!t(e)||r(e)!==e)throw RangeError(`The number `+e+` cannot be converted to BigInt because it is not an integer`);return i.__fromDouble(e)}if(typeof e==`string`){var n=i.__fromString(e);if(n===null)throw SyntaxError(`Cannot convert `+e+` to a BigInt`);return n}if(typeof e==`boolean`)return!0===e?i.__oneDigit(1,!1):i.__zero();if(S(e)===`object`){if(e.constructor===i)return e;var a=i.__toPrimitive(e);return i.BigInt(a)}throw TypeError(`Cannot convert `+e+` to a BigInt`)}},{key:`toNumber`,value:function(e){var t=e.length;if(t===0)return 0;if(t===1){var n=e.__unsignedDigit(0);return e.sign?-n:n}var r=e.__digit(t-1),a=i.__clz30(r),o=30*t-a;if(1024<o)return e.sign?-1/0:1/0;var s=o-1,c=r,l=t-1,u=a+3,d=u===32?0:c<<u;d>>>=12;var f=u-12,p=12<=u?0:c<<20+u,m=20+u;for(0<f&&0<l&&(l--,c=e.__digit(l),d|=c>>>30-f,p=c<<f+2,m=f+2);0<m&&0<l;)l--,c=e.__digit(l),p|=30<=m?c<<m-30:c>>>30-m,m-=30;var h=i.__decideRounding(e,m,l,c);if((h===1||h===0&&(1&p)==1)&&(p=p+1>>>0,p===0&&(d++,d>>>20&&(d=0,s++,1023<s))))return e.sign?-1/0:1/0;var g=e.sign?-2147483648:0;return s=s+1023<<20,i.__kBitConversionInts[i.__kBitConversionIntHigh]=g|s|d,i.__kBitConversionInts[i.__kBitConversionIntLow]=p,i.__kBitConversionDouble[0]}},{key:`unaryMinus`,value:function(e){if(e.length===0)return e;var t=e.__copy();return t.sign=!e.sign,t}},{key:`bitwiseNot`,value:function(e){return e.sign?i.__absoluteSubOne(e).__trim():i.__absoluteAddOne(e,!0)}},{key:`exponentiate`,value:function(e,t){if(t.sign)throw RangeError(`Exponent must be positive`);if(t.length===0)return i.__oneDigit(1,!1);if(e.length===0)return e;if(e.length===1&&e.__digit(0)===1)return e.sign&&!(1&t.__digit(0))?i.unaryMinus(e):e;if(1<t.length)throw RangeError(`BigInt too big`);var n=t.__unsignedDigit(0);if(n===1)return e;if(n>=i.__kMaxLengthBits)throw RangeError(`BigInt too big`);if(e.length===1&&e.__digit(0)===2){var r=1+(0|n/30),a=new i(r,e.sign&&!!(1&n));a.__initializeDigits();var o=1<<n%30;return a.__setDigit(r-1,o),a}var s=null,c=e;for(1&n&&(s=e),n>>=1;n!==0;n>>=1)c=i.multiply(c,c),1&n&&(s=s===null?c:i.multiply(s,c));return s}},{key:`multiply`,value:function(e,t){if(e.length===0)return e;if(t.length===0)return t;var n=e.length+t.length;30<=e.__clzmsd()+t.__clzmsd()&&n--;var r=new i(n,e.sign!==t.sign);r.__initializeDigits();for(var a=0;a<e.length;a++)i.__multiplyAccumulate(t,e.__digit(a),r,a);return r.__trim()}},{key:`divide`,value:function(e,t){if(t.length===0)throw RangeError(`Division by zero`);if(0>i.__absoluteCompare(e,t))return i.__zero();var n,r=e.sign!==t.sign,a=t.__unsignedDigit(0);if(t.length===1&&32767>=a){if(a===1)return r===e.sign?e:i.unaryMinus(e);n=i.__absoluteDivSmall(e,a,null)}else n=i.__absoluteDivLarge(e,t,!0,!1);return n.sign=r,n.__trim()}},{key:`remainder`,value:function(e,t){if(t.length===0)throw RangeError(`Division by zero`);if(0>i.__absoluteCompare(e,t))return e;var n=t.__unsignedDigit(0);if(t.length===1&&32767>=n){if(n===1)return i.__zero();var r=i.__absoluteModSmall(e,n);return r===0?i.__zero():i.__oneDigit(r,e.sign)}var a=i.__absoluteDivLarge(e,t,!1,!0);return a.sign=e.sign,a.__trim()}},{key:`add`,value:function(e,t){var n=e.sign;return n===t.sign?i.__absoluteAdd(e,t,n):0<=i.__absoluteCompare(e,t)?i.__absoluteSub(e,t,n):i.__absoluteSub(t,e,!n)}},{key:`subtract`,value:function(e,t){var n=e.sign;return n===t.sign?0<=i.__absoluteCompare(e,t)?i.__absoluteSub(e,t,n):i.__absoluteSub(t,e,!n):i.__absoluteAdd(e,t,n)}},{key:`leftShift`,value:function(e,t){return t.length===0||e.length===0?e:t.sign?i.__rightShiftByAbsolute(e,t):i.__leftShiftByAbsolute(e,t)}},{key:`signedRightShift`,value:function(e,t){return t.length===0||e.length===0?e:t.sign?i.__leftShiftByAbsolute(e,t):i.__rightShiftByAbsolute(e,t)}},{key:`unsignedRightShift`,value:function(){throw TypeError(`BigInts have no unsigned right shift; use >> instead`)}},{key:`lessThan`,value:function(e,t){return 0>i.__compareToBigInt(e,t)}},{key:`lessThanOrEqual`,value:function(e,t){return 0>=i.__compareToBigInt(e,t)}},{key:`greaterThan`,value:function(e,t){return 0<i.__compareToBigInt(e,t)}},{key:`greaterThanOrEqual`,value:function(e,t){return 0<=i.__compareToBigInt(e,t)}},{key:`equal`,value:function(e,t){if(e.sign!==t.sign||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e.__digit(n)!==t.__digit(n))return!1;return!0}},{key:`notEqual`,value:function(e,t){return!i.equal(e,t)}},{key:`bitwiseAnd`,value:function(e,t){if(!e.sign&&!t.sign)return i.__absoluteAnd(e,t).__trim();if(e.sign&&t.sign){var r=n(e.length,t.length)+1,a=i.__absoluteSubOne(e,r),o=i.__absoluteSubOne(t);return a=i.__absoluteOr(a,o,a),i.__absoluteAddOne(a,!0,a).__trim()}if(e.sign){var s=[t,e];e=s[0],t=s[1]}return i.__absoluteAndNot(e,i.__absoluteSubOne(t)).__trim()}},{key:`bitwiseXor`,value:function(e,t){if(!e.sign&&!t.sign)return i.__absoluteXor(e,t).__trim();if(e.sign&&t.sign){var r=n(e.length,t.length),a=i.__absoluteSubOne(e,r),o=i.__absoluteSubOne(t);return i.__absoluteXor(a,o,a).__trim()}var s=n(e.length,t.length)+1;if(e.sign){var c=[t,e];e=c[0],t=c[1]}var l=i.__absoluteSubOne(t,s);return l=i.__absoluteXor(l,e,l),i.__absoluteAddOne(l,!0,l).__trim()}},{key:`bitwiseOr`,value:function(e,t){var r=n(e.length,t.length);if(!e.sign&&!t.sign)return i.__absoluteOr(e,t).__trim();if(e.sign&&t.sign){var a=i.__absoluteSubOne(e,r),o=i.__absoluteSubOne(t);return a=i.__absoluteAnd(a,o,a),i.__absoluteAddOne(a,!0,a).__trim()}if(e.sign){var s=[t,e];e=s[0],t=s[1]}var c=i.__absoluteSubOne(t,r);return c=i.__absoluteAndNot(c,e,c),i.__absoluteAddOne(c,!0,c).__trim()}},{key:`asIntN`,value:function(e,t){if(t.length===0)return t;if(e=r(e),0>e)throw RangeError(`Invalid value: not (convertible to) a safe integer`);if(e===0)return i.__zero();if(e>=i.__kMaxLengthBits)return t;var n=0|(e+29)/30;if(t.length<n)return t;var a=t.__unsignedDigit(n-1),o=1<<(e-1)%30;if(t.length===n&&a<o)return t;if((a&o)!==o)return i.__truncateToNBits(e,t);if(!t.sign)return i.__truncateAndSubFromPowerOfTwo(e,t,!0);if(!(a&o-1)){for(var s=n-2;0<=s;s--)if(t.__digit(s)!==0)return i.__truncateAndSubFromPowerOfTwo(e,t,!1);return t.length===n&&a===o?t:i.__truncateToNBits(e,t)}return i.__truncateAndSubFromPowerOfTwo(e,t,!1)}},{key:`asUintN`,value:function(e,t){if(t.length===0)return t;if(e=r(e),0>e)throw RangeError(`Invalid value: not (convertible to) a safe integer`);if(e===0)return i.__zero();if(t.sign){if(e>i.__kMaxLengthBits)throw RangeError(`BigInt too big`);return i.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=i.__kMaxLengthBits)return t;var n=0|(e+29)/30;if(t.length<n)return t;var a=e%30;return t.length==n&&(a===0||!(t.__digit(n-1)>>>a))?t:i.__truncateToNBits(e,t)}},{key:`ADD`,value:function(e,t){if(e=i.__toPrimitive(e),t=i.__toPrimitive(t),typeof e==`string`)return typeof t!=`string`&&(t=t.toString()),e+t;if(typeof t==`string`)return e.toString()+t;if(e=i.__toNumeric(e),t=i.__toNumeric(t),i.__isBigInt(e)&&i.__isBigInt(t))return i.add(e,t);if(typeof e==`number`&&typeof t==`number`)return e+t;throw TypeError(`Cannot mix BigInt and other types, use explicit conversions`)}},{key:`LT`,value:function(e,t){return i.__compare(e,t,0)}},{key:`LE`,value:function(e,t){return i.__compare(e,t,1)}},{key:`GT`,value:function(e,t){return i.__compare(e,t,2)}},{key:`GE`,value:function(e,t){return i.__compare(e,t,3)}},{key:`EQ`,value:function(e,t){for(;;){if(i.__isBigInt(e))return i.__isBigInt(t)?i.equal(e,t):i.EQ(t,e);if(typeof e==`number`){if(i.__isBigInt(t))return i.__equalToNumber(t,e);if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(typeof e==`string`){if(i.__isBigInt(t))return e=i.__fromString(e),e!==null&&i.equal(e,t);if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(typeof e==`boolean`){if(i.__isBigInt(t))return i.__equalToNumber(t,+e);if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(S(e)===`symbol`){if(i.__isBigInt(t))return!1;if(S(t)!==`object`)return e==t;t=i.__toPrimitive(t)}else if(S(e)===`object`){if(S(t)===`object`&&t.constructor!==i)return e==t;e=i.__toPrimitive(e)}else return e==t}}},{key:`NE`,value:function(e,t){return!i.EQ(e,t)}},{key:`DataViewGetBigInt64`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0&&arguments[2];return i.asIntN(64,i.DataViewGetBigUint64(e,t,n))}},{key:`DataViewGetBigUint64`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0&&arguments[2],r=y(n?[4,0]:[0,4],2),a=r[0],o=r[1],s=e.getUint32(t+a,n),c=e.getUint32(t+o,n),l=new i(3,!1);return l.__setDigit(0,1073741823&c),l.__setDigit(1,(268435455&s)<<2|c>>>30),l.__setDigit(2,s>>>28),l.__trim()}},{key:`DataViewSetBigInt64`,value:function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0&&arguments[3];i.DataViewSetBigUint64(e,t,n,r)}},{key:`DataViewSetBigUint64`,value:function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0&&arguments[3];n=i.asUintN(64,n);var a=0,o=0;if(0<n.length&&(o=n.__digit(0),1<n.length)){var s=n.__digit(1);o|=s<<30,a=s>>>2,2<n.length&&(a|=n.__digit(2)<<28)}var c=y(r?[4,0]:[0,4],2),l=c[0],u=c[1];e.setUint32(t+l,a,r),e.setUint32(t+u,o,r)}},{key:`__zero`,value:function(){return new i(0,!1)}},{key:`__oneDigit`,value:function(e,t){var n=new i(1,t);return n.__setDigit(0,e),n}},{key:`__decideRounding`,value:function(e,t,n,r){if(0<t)return-1;var i;if(0>t)i=-t-1;else{if(n===0)return-1;n--,r=e.__digit(n),i=29}var a=1<<i;if((r&a)==0)return-1;if(--a,(r&a)!=0)return 1;for(;0<n;)if(n--,e.__digit(n)!==0)return 1;return 0}},{key:`__fromDouble`,value:function(e){var t=0>e;i.__kBitConversionDouble[0]=e;var n,r=(2047&i.__kBitConversionInts[i.__kBitConversionIntHigh]>>>20)-1023,a=(0|r/30)+1,o=new i(a,t),s=1048575&i.__kBitConversionInts[i.__kBitConversionIntHigh]|1048576,c=i.__kBitConversionInts[i.__kBitConversionIntLow],l=20,u=r%30,d=0;if(u<l){var f=l-u;d=f+32,n=s>>>f,s=s<<32-f|c>>>f,c<<=32-f}else if(u===l)d=32,n=s,s=c,c=0;else{var p=u-l;d=32-p,n=s<<p|c>>>32-p,s=c<<p,c=0}o.__setDigit(a-1,n);for(var m=a-2;0<=m;m--)0<d?(d-=30,n=s>>>2,s=s<<30|c>>>2,c<<=30):n=0,o.__setDigit(m,n);return o.__trim()}},{key:`__isWhitespace`,value:function(e){return 13>=e&&9<=e||(159>=e?e==32:131071>=e?e==160||e==5760:196607>=e?(e&=131071,10>=e||e==40||e==41||e==47||e==95||e==4096):e==65279)}},{key:`__fromString`,value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,n=0,r=e.length,a=0;if(a===r)return i.__zero();for(var o=e.charCodeAt(a);i.__isWhitespace(o);){if(++a===r)return i.__zero();o=e.charCodeAt(a)}if(o===43){if(++a===r)return null;o=e.charCodeAt(a),n=1}else if(o===45){if(++a===r)return null;o=e.charCodeAt(a),n=-1}if(t===0){if(t=10,o===48){if(++a===r)return i.__zero();if(o=e.charCodeAt(a),o===88||o===120){if(t=16,++a===r)return null;o=e.charCodeAt(a)}else if(o===79||o===111){if(t=8,++a===r)return null;o=e.charCodeAt(a)}else if(o===66||o===98){if(t=2,++a===r)return null;o=e.charCodeAt(a)}}}else if(t===16&&o===48){if(++a===r)return i.__zero();if(o=e.charCodeAt(a),o===88||o===120){if(++a===r)return null;o=e.charCodeAt(a)}}if(n!==0&&t!==10)return null;for(;o===48;){if(++a===r)return i.__zero();o=e.charCodeAt(a)}var s=r-a,c=i.__kMaxBitsPerChar[t],l=i.__kBitsPerCharTableMultiplier-1;if(s>1073741824/c)return null;var u=new i(0|((c*s+l>>>i.__kBitsPerCharTableShift)+29)/30,!1),d=10>t?t:10,f=10<t?t-10:0;if(t&t-1){u.__initializeDigits();var p=!1,m=0;do{for(var h,g=0,_=1;;){if(h=void 0,o-48>>>0<d)h=o-48;else if((32|o)-97>>>0<f)h=(32|o)-87;else{p=!0;break}var v=_*t;if(1073741823<v)break;if(_=v,g=g*t+h,m++,++a===r){p=!0;break}o=e.charCodeAt(a)}l=30*i.__kBitsPerCharTableMultiplier-1;var y=0|(c*m+l>>>i.__kBitsPerCharTableShift)/30;u.__inplaceMultiplyAdd(_,g,y)}while(!p)}else{c>>=i.__kBitsPerCharTableShift;var b=[],x=[],S=!1;do{for(var C,w=0,T=0;;){if(C=void 0,o-48>>>0<d)C=o-48;else if((32|o)-97>>>0<f)C=(32|o)-87;else{S=!0;break}if(T+=c,w=w<<c|C,++a===r){S=!0;break}if(o=e.charCodeAt(a),30<T+c)break}b.push(w),x.push(T)}while(!S);i.__fillFromParts(u,b,x)}if(a!==r){if(!i.__isWhitespace(o))return null;for(a++;a<r;a++)if(o=e.charCodeAt(a),!i.__isWhitespace(o))return null}return u.sign=n===-1,u.__trim()}},{key:`__fillFromParts`,value:function(e,t,n){for(var r=0,i=0,a=0,o=t.length-1;0<=o;o--){var s=t[o],c=n[o];i|=s<<a,a+=c,a===30?(e.__setDigit(r++,i),a=0,i=0):30<a&&(e.__setDigit(r++,1073741823&i),a-=30,i=s>>>c-a)}if(i!==0){if(r>=e.length)throw Error(`implementation bug`);e.__setDigit(r++,i)}for(;r<e.length;r++)e.__setDigit(r,0)}},{key:`__toStringBasePowerOfTwo`,value:function(e,t){var n=e.length,r=t-1;r=(85&r>>>1)+(85&r),r=(51&r>>>2)+(51&r),r=(15&r>>>4)+(15&r);var a=r,o=t-1,s=e.__digit(n-1),c=i.__clz30(s),l=0|(30*n-c+a-1)/a;if(e.sign&&l++,268435456<l)throw Error(`string too long`);for(var u=Array(l),d=l-1,f=0,p=0,m=0;m<n-1;m++){var h=e.__digit(m),g=(f|h<<p)&o;u[d--]=i.__kConversionChars[g];var _=a-p;for(f=h>>>_,p=30-_;p>=a;)u[d--]=i.__kConversionChars[f&o],f>>>=a,p-=a}var v=(f|s<<p)&o;for(u[d--]=i.__kConversionChars[v],f=s>>>a-p;f!==0;)u[d--]=i.__kConversionChars[f&o],f>>>=a;if(e.sign&&(u[d--]=`-`),d!==-1)throw Error(`implementation bug`);return u.join(``)}},{key:`__toStringGeneric`,value:function(e,t,n){var r=e.length;if(r===0)return``;if(r===1){var a=e.__unsignedDigit(0).toString(t);return!1===n&&e.sign&&(a=`-`+a),a}var o=30*r-i.__clz30(e.__digit(r-1)),s=i.__kMaxBitsPerChar[t]-1,c=o*i.__kBitsPerCharTableMultiplier;c+=s-1,c=0|c/s;var l,u,d=c+1>>1,f=i.exponentiate(i.__oneDigit(t,!1),i.__oneDigit(d,!1)),p=f.__unsignedDigit(0);if(f.length===1&&32767>=p){l=new i(e.length,!1),l.__initializeDigits();for(var m,h=0,g=2*e.length-1;0<=g;g--)m=h<<15|e.__halfDigit(g),l.__setHalfDigit(g,0|m/p),h=0|m%p;u=h.toString(t)}else{var _=i.__absoluteDivLarge(e,f,!0,!0);l=_.quotient;var v=_.remainder.__trim();u=i.__toStringGeneric(v,t,!0)}l.__trim();for(var y=i.__toStringGeneric(l,t,!0);u.length<d;)u=`0`+u;return!1===n&&e.sign&&(y=`-`+y),y+u}},{key:`__unequalSign`,value:function(e){return e?-1:1}},{key:`__absoluteGreater`,value:function(e){return e?-1:1}},{key:`__absoluteLess`,value:function(e){return e?1:-1}},{key:`__compareToBigInt`,value:function(e,t){var n=e.sign;if(n!==t.sign)return i.__unequalSign(n);var r=i.__absoluteCompare(e,t);return 0<r?i.__absoluteGreater(n):0>r?i.__absoluteLess(n):0}},{key:`__compareToNumber`,value:function(e,n){if(i.__isOneDigitInt(n)){var r=e.sign,a=0>n;if(r!==a)return i.__unequalSign(r);if(e.length===0){if(a)throw Error(`implementation bug`);return n===0?0:-1}if(1<e.length)return i.__absoluteGreater(r);var o=t(n),s=e.__unsignedDigit(0);return s>o?i.__absoluteGreater(r):s<o?i.__absoluteLess(r):0}return i.__compareToDouble(e,n)}},{key:`__compareToDouble`,value:function(e,t){if(t!==t)return t;if(t===1/0)return-1;if(t===-1/0)return 1;var n=e.sign;if(n!==0>t)return i.__unequalSign(n);if(t===0)throw Error(`implementation bug: should be handled elsewhere`);if(e.length===0)return-1;i.__kBitConversionDouble[0]=t;var r=2047&i.__kBitConversionInts[i.__kBitConversionIntHigh]>>>20;if(r==2047)throw Error(`implementation bug: handled elsewhere`);var a=r-1023;if(0>a)return i.__absoluteGreater(n);var o=e.length,s=e.__digit(o-1),c=i.__clz30(s),l=30*o-c,u=a+1;if(l<u)return i.__absoluteLess(n);if(l>u)return i.__absoluteGreater(n);var d=1048576|1048575&i.__kBitConversionInts[i.__kBitConversionIntHigh],f=i.__kBitConversionInts[i.__kBitConversionIntLow],p=20,m=29-c;if(m!==(0|(l-1)%30))throw Error(`implementation bug`);var h,g=0;if(m<p){var _=p-m;g=_+32,h=d>>>_,d=d<<32-_|f>>>_,f<<=32-_}else if(m===p)g=32,h=d,d=f,f=0;else{var v=m-p;g=32-v,h=d<<v|f>>>32-v,d=f<<v,f=0}if(s>>>=0,h>>>=0,s>h)return i.__absoluteGreater(n);if(s<h)return i.__absoluteLess(n);for(var y=o-2;0<=y;y--){0<g?(g-=30,h=d>>>2,d=d<<30|f>>>2,f<<=30):h=0;var b=e.__unsignedDigit(y);if(b>h)return i.__absoluteGreater(n);if(b<h)return i.__absoluteLess(n)}if(d!==0||f!==0){if(g===0)throw Error(`implementation bug`);return i.__absoluteLess(n)}return 0}},{key:`__equalToNumber`,value:function(e,n){return i.__isOneDigitInt(n)?n===0?e.length===0:e.length===1&&e.sign===0>n&&e.__unsignedDigit(0)===t(n):i.__compareToDouble(e,n)===0}},{key:`__comparisonResultToBool`,value:function(e,t){return t===0?0>e:t===1?0>=e:t===2?0<e:t===3?0<=e:void 0}},{key:`__compare`,value:function(e,t,n){if(e=i.__toPrimitive(e),t=i.__toPrimitive(t),typeof e==`string`&&typeof t==`string`)switch(n){case 0:return e<t;case 1:return e<=t;case 2:return e>t;case 3:return e>=t}if(i.__isBigInt(e)&&typeof t==`string`)return t=i.__fromString(t),t!==null&&i.__comparisonResultToBool(i.__compareToBigInt(e,t),n);if(typeof e==`string`&&i.__isBigInt(t))return e=i.__fromString(e),e!==null&&i.__comparisonResultToBool(i.__compareToBigInt(e,t),n);if(e=i.__toNumeric(e),t=i.__toNumeric(t),i.__isBigInt(e)){if(i.__isBigInt(t))return i.__comparisonResultToBool(i.__compareToBigInt(e,t),n);if(typeof t!=`number`)throw Error(`implementation bug`);return i.__comparisonResultToBool(i.__compareToNumber(e,t),n)}if(typeof e!=`number`)throw Error(`implementation bug`);if(i.__isBigInt(t))return i.__comparisonResultToBool(i.__compareToNumber(t,e),2^n);if(typeof t!=`number`)throw Error(`implementation bug`);return n===0?e<t:n===1?e<=t:n===2?e>t:n===3?e>=t:void 0}},{key:`__absoluteAdd`,value:function(e,t,n){if(e.length<t.length)return i.__absoluteAdd(t,e,n);if(e.length===0)return e;if(t.length===0)return e.sign===n?e:i.unaryMinus(e);var r=e.length;(e.__clzmsd()===0||t.length===e.length&&t.__clzmsd()===0)&&r++;for(var a,o=new i(r,n),s=0,c=0;c<t.length;c++)a=e.__digit(c)+t.__digit(c)+s,s=a>>>30,o.__setDigit(c,1073741823&a);for(;c<e.length;c++){var l=e.__digit(c)+s;s=l>>>30,o.__setDigit(c,1073741823&l)}return c<o.length&&o.__setDigit(c,s),o.__trim()}},{key:`__absoluteSub`,value:function(e,t,n){if(e.length===0)return e;if(t.length===0)return e.sign===n?e:i.unaryMinus(e);for(var r,a=new i(e.length,n),o=0,s=0;s<t.length;s++)r=e.__digit(s)-t.__digit(s)-o,o=1&r>>>30,a.__setDigit(s,1073741823&r);for(;s<e.length;s++){var c=e.__digit(s)-o;o=1&c>>>30,a.__setDigit(s,1073741823&c)}return a.__trim()}},{key:`__absoluteAddOne`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length;n===null?n=new i(r,t):n.sign=t;for(var a,o=1,s=0;s<r;s++)a=e.__digit(s)+o,o=a>>>30,n.__setDigit(s,1073741823&a);return o!==0&&n.__setDigitGrow(r,1),n}},{key:`__absoluteSubOne`,value:function(e,t){var n=e.length;t||=n;for(var r,a=new i(t,!1),o=1,s=0;s<n;s++)r=e.__digit(s)-o,o=1&r>>>30,a.__setDigit(s,1073741823&r);if(o!==0)throw Error(`implementation bug`);for(var c=n;c<t;c++)a.__setDigit(c,0);return a}},{key:`__absoluteAnd`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;if(r<a){o=r;var s=e,c=r;e=t,r=a,t=s,a=c}var l=o;n===null?n=new i(l,!1):l=n.length;for(var u=0;u<o;u++)n.__setDigit(u,e.__digit(u)&t.__digit(u));for(;u<l;u++)n.__setDigit(u,0);return n}},{key:`__absoluteAndNot`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;r<a&&(o=r);var s=r;n===null?n=new i(s,!1):s=n.length;for(var c=0;c<o;c++)n.__setDigit(c,e.__digit(c)&~t.__digit(c));for(;c<r;c++)n.__setDigit(c,e.__digit(c));for(;c<s;c++)n.__setDigit(c,0);return n}},{key:`__absoluteOr`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;if(r<a){o=r;var s=e,c=r;e=t,r=a,t=s,a=c}var l=r;n===null?n=new i(l,!1):l=n.length;for(var u=0;u<o;u++)n.__setDigit(u,e.__digit(u)|t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<l;u++)n.__setDigit(u,0);return n}},{key:`__absoluteXor`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,r=e.length,a=t.length,o=a;if(r<a){o=r;var s=e,c=r;e=t,r=a,t=s,a=c}var l=r;n===null?n=new i(l,!1):l=n.length;for(var u=0;u<o;u++)n.__setDigit(u,e.__digit(u)^t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<l;u++)n.__setDigit(u,0);return n}},{key:`__absoluteCompare`,value:function(e,t){var n=e.length-t.length;if(n!=0)return n;for(var r=e.length-1;0<=r&&e.__digit(r)===t.__digit(r);)r--;return 0>r?0:e.__unsignedDigit(r)>t.__unsignedDigit(r)?1:-1}},{key:`__multiplyAccumulate`,value:function(e,t,n,r){if(t!==0){for(var a=32767&t,o=t>>>15,s=0,c=0,l=0;l<e.length;l++,r++){var u=n.__digit(r),d=e.__digit(l),f=32767&d,p=d>>>15,m=i.__imul(f,a),h=i.__imul(f,o),g=i.__imul(p,a),_=i.__imul(p,o);u+=c+m+s,s=u>>>30,u&=1073741823,u+=((32767&h)<<15)+((32767&g)<<15),s+=u>>>30,c=_+(h>>>15)+(g>>>15),n.__setDigit(r,1073741823&u)}for(;s!==0||c!==0;r++){var v=n.__digit(r);v+=s+c,c=0,s=v>>>30,n.__setDigit(r,1073741823&v)}}}},{key:`__internalMultiplyAdd`,value:function(e,t,n,r,a){for(var o=n,s=0,c=0;c<r;c++){var l=e.__digit(c),u=i.__imul(32767&l,t),d=i.__imul(l>>>15,t),f=u+((32767&d)<<15)+s+o;o=f>>>30,s=d>>>15,a.__setDigit(c,1073741823&f)}if(a.length>r)for(a.__setDigit(r++,o+s);r<a.length;)a.__setDigit(r++,0);else if(o+s!==0)throw Error(`implementation bug`)}},{key:`__absoluteDivSmall`,value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;n===null&&(n=new i(e.length,!1));for(var r=0,a=2*e.length-1;0<=a;a-=2){var o=(r<<15|e.__halfDigit(a))>>>0,s=0|o/t;r=0|o%t,o=(r<<15|e.__halfDigit(a-1))>>>0;var c=0|o/t;r=0|o%t,n.__setDigit(a>>>1,s<<15|c)}return n}},{key:`__absoluteModSmall`,value:function(e,t){for(var n,r=0,i=2*e.length-1;0<=i;i--)n=(r<<15|e.__halfDigit(i))>>>0,r=0|n%t;return r}},{key:`__absoluteDivLarge`,value:function(e,t,n,r){var a=t.__halfDigitLength(),o=t.length,s=e.__halfDigitLength()-a,c=null;n&&(c=new i(s+2>>>1,!1),c.__initializeDigits());var l=new i(a+2>>>1,!1);l.__initializeDigits();var u=i.__clz15(t.__halfDigit(a-1));0<u&&(t=i.__specialLeftShift(t,u,0));for(var d=i.__specialLeftShift(e,u,1),f=t.__halfDigit(a-1),p=0,m=s;0<=m;m--){var h=32767,g=d.__halfDigit(m+a);if(g!==f){var _=(g<<15|d.__halfDigit(m+a-1))>>>0;h=0|_/f;for(var v=0|_%f,y=t.__halfDigit(a-2),b=d.__halfDigit(m+a-2);i.__imul(h,y)>>>0>(v<<16|b)>>>0&&(h--,v+=f,!(32767<v)););}i.__internalMultiplyAdd(t,h,0,o,l);var x=d.__inplaceSub(l,m,a+1);x!==0&&(x=d.__inplaceAdd(t,m,a),d.__setHalfDigit(m+a,32767&d.__halfDigit(m+a)+x),h--),n&&(1&m?p=h<<15:c.__setDigit(m>>>1,p|h))}if(r)return d.__inplaceRightShift(u),n?{quotient:c,remainder:d}:d;if(n)return c;throw Error(`unreachable`)}},{key:`__clz15`,value:function(e){return i.__clz30(e)-15}},{key:`__specialLeftShift`,value:function(e,t,n){var r=e.length,a=new i(r+n,!1);if(t===0){for(var o=0;o<r;o++)a.__setDigit(o,e.__digit(o));return 0<n&&a.__setDigit(r,0),a}for(var s,c=0,l=0;l<r;l++)s=e.__digit(l),a.__setDigit(l,1073741823&s<<t|c),c=s>>>30-t;return 0<n&&a.__setDigit(r,c),a}},{key:`__leftShiftByAbsolute`,value:function(e,t){var n=i.__toShiftAmount(t);if(0>n)throw RangeError(`BigInt too big`);var r=0|n/30,a=n%30,o=e.length,s=a!==0&&!!(e.__digit(o-1)>>>30-a),c=o+r+ +!!s,l=new i(c,e.sign);if(a===0){for(var u=0;u<r;u++)l.__setDigit(u,0);for(;u<c;u++)l.__setDigit(u,e.__digit(u-r))}else{for(var d=0,f=0;f<r;f++)l.__setDigit(f,0);for(var p,m=0;m<o;m++)p=e.__digit(m),l.__setDigit(m+r,1073741823&p<<a|d),d=p>>>30-a;if(s)l.__setDigit(o+r,d);else if(d!==0)throw Error(`implementation bug`)}return l.__trim()}},{key:`__rightShiftByAbsolute`,value:function(e,t){var n=e.length,r=e.sign,a=i.__toShiftAmount(t);if(0>a)return i.__rightShiftByMaximum(r);var o=0|a/30,s=a%30,c=n-o;if(0>=c)return i.__rightShiftByMaximum(r);var l=!1;if(r){var u=(1<<s)-1;if((e.__digit(o)&u)!=0)l=!0;else for(var d=0;d<o;d++)if(e.__digit(d)!==0){l=!0;break}}l&&s===0&&~e.__digit(n-1)==0&&c++;var f=new i(c,r);if(s===0){f.__setDigit(c-1,0);for(var p=o;p<n;p++)f.__setDigit(p-o,e.__digit(p))}else{for(var m,h=e.__digit(o)>>>s,g=n-o-1,_=0;_<g;_++)m=e.__digit(_+o+1),f.__setDigit(_,1073741823&m<<30-s|h),h=m>>>s;f.__setDigit(g,h)}return l&&(f=i.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:`__rightShiftByMaximum`,value:function(e){return e?i.__oneDigit(1,!0):i.__zero()}},{key:`__toShiftAmount`,value:function(e){if(1<e.length)return-1;var t=e.__unsignedDigit(0);return t>i.__kMaxLengthBits?-1:t}},{key:`__toPrimitive`,value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:`default`;if(S(e)!==`object`||e.constructor===i)return e;if(typeof Symbol<`u`&&S(Symbol.toPrimitive)===`symbol`&&e[Symbol.toPrimitive]){var n=e[Symbol.toPrimitive](t);if(S(n)!==`object`)return n;throw TypeError(`Cannot convert object to primitive value`)}var r=e.valueOf;if(r){var a=r.call(e);if(S(a)!==`object`)return a}var o=e.toString;if(o){var s=o.call(e);if(S(s)!==`object`)return s}throw TypeError(`Cannot convert object to primitive value`)}},{key:`__toNumeric`,value:function(e){return i.__isBigInt(e)?e:+e}},{key:`__isBigInt`,value:function(e){return S(e)===`object`&&e!==null&&e.constructor===i}},{key:`__truncateToNBits`,value:function(e,t){for(var n=0|(e+29)/30,r=new i(n,t.sign),a=n-1,o=0;o<a;o++)r.__setDigit(o,t.__digit(o));var s=t.__digit(a);if(e%30!=0){var c=32-e%30;s=s<<c>>>c}return r.__setDigit(a,s),r.__trim()}},{key:`__truncateAndSubFromPowerOfTwo`,value:function(e,t,n){for(var r=Math.min,a,o=0|(e+29)/30,s=new i(o,n),c=0,l=o-1,u=0,d=r(l,t.length);c<d;c++)a=0-t.__digit(c)-u,u=1&a>>>30,s.__setDigit(c,1073741823&a);for(;c<l;c++)s.__setDigit(c,0|1073741823&-u);var f,p=l<t.length?t.__digit(l):0,m=e%30;if(m===0)f=0-p-u,f&=1073741823;else{var h=32-m;p=p<<h>>>h;var g=1<<32-h;f=g-p-u,f&=g-1}return s.__setDigit(l,f),s.__trim()}},{key:`__digitPow`,value:function(e,t){for(var n=1;0<t;)1&t&&(n*=e),t>>>=1,e*=e;return n}},{key:`__detectBigEndian`,value:function(){return i.__kBitConversionDouble[0]=-0,i.__kBitConversionInts[0]!==0}},{key:`__isOneDigitInt`,value:function(e){return(1073741823&e)===e}}])}(w(Array));return T.__kMaxLength=33554432,T.__kMaxLengthBits=T.__kMaxLength<<5,T.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],T.__kBitsPerCharTableShift=5,T.__kBitsPerCharTableMultiplier=1<<T.__kBitsPerCharTableShift,T.__kConversionChars=`0123456789abcdefghijklmnopqrstuvwxyz`.split(``),T.__kBitConversionBuffer=new ArrayBuffer(8),T.__kBitConversionDouble=new Float64Array(T.__kBitConversionBuffer),T.__kBitConversionInts=new Int32Array(T.__kBitConversionBuffer),T.__kBitConversionIntHigh=+!T.__detectBigEndian(),T.__kBitConversionIntLow=+!!T.__detectBigEndian(),T.__clz30=t?function(e){return t(e)-2}:function(e){var t=Math.LN2,n=Math.log;return e===0?30:0|29-(0|n(e>>>0)/t)},T.__imul=e||function(e,t){return 0|e*t},T})}))(),1),EG=Z.default.BigInt(0),DG=Z.default.BigInt(1),OG=Z.default.BigInt(2),kve=Z.default.BigInt(10),Ave=Z.default.BigInt(24),jve=Z.default.BigInt(60),Mve=Z.default.BigInt(1e3),kG=Z.default.BigInt(1e6),AG=Z.default.BigInt(1e9),jG=Z.default.multiply(Z.default.BigInt(3600),AG),Nve=Z.default.multiply(jve,AG),MG=Z.default.multiply(jG,Ave);function NG(e){return typeof e==`bigint`?Z.default.BigInt(e.toString(10)):e}function PG(e){return Z.default.equal(Z.default.remainder(e,OG),EG)}function FG(e){return Z.default.lessThan(e,EG)?Z.default.unaryMinus(e):e}function IG(e,t){return Z.default.lessThan(e,t)?-1:+!!Z.default.greaterThan(e,t)}function LG(e,t){return{quotient:Z.default.divide(e,t),remainder:Z.default.remainder(e,t)}}var RG,zG,BG=`slot-epochNanoSeconds`,VG=`slot-iso-date`,HG=`slot-iso-date-time`,UG=`slot-time`,WG=`slot-calendar`,GG=`slot-date-brand`,KG=`slot-year-month-brand`,qG=`slot-month-day-brand`,JG=`slot-time-zone`,YG=`slot-years`,XG=`slot-months`,ZG=`slot-weeks`,QG=`slot-days`,$G=`slot-hours`,eK=`slot-minutes`,tK=`slot-seconds`,nK=`slot-milliseconds`,rK=`slot-microseconds`,iK=`slot-nanoseconds`,aK=`date`,oK=`ym`,sK=`md`,cK=`time`,lK=`datetime`,uK=`instant`,dK=`original`,fK=`timezone-canonical`,pK=`timezone-original`,mK=`calendar-id`,hK=`locale`,gK=`options`,_K=new WeakMap,vK=Symbol.for(`@@Temporal__GetSlots`);(RG=globalThis)[vK]||(RG[vK]=function(e){return _K.get(e)});var yK=globalThis[vK],bK=Symbol.for(`@@Temporal__CreateSlots`);(zG=globalThis)[bK]||(zG[bK]=function(e){_K.set(e,Object.create(null))});var xK=globalThis[bK];function SK(e,...t){if(!e||typeof e!=`object`)return!1;let n=yK(e);return!!n&&t.every((e=>e in n))}function Q(e,t){let n=yK(e)?.[t];if(n===void 0)throw TypeError(`Missing internal slot ${t}`);return n}function CK(e,t,n){let r=yK(e);if(r===void 0)throw TypeError(`Missing slots for the given container`);if(r[t])throw TypeError(`${t} already has set`);r[t]=n}var wK={};function TK(e,t){Object.defineProperty(e.prototype,Symbol.toStringTag,{value:t,writable:!1,enumerable:!1,configurable:!0});let n=Object.getOwnPropertyNames(e);for(let t=0;t<n.length;t++){let r=n[t],i=Object.getOwnPropertyDescriptor(e,r);i.configurable&&i.enumerable&&(i.enumerable=!1,Object.defineProperty(e,r,i))}let r=Object.getOwnPropertyNames(e.prototype);for(let t=0;t<r.length;t++){let n=r[t],i=Object.getOwnPropertyDescriptor(e.prototype,n);i.configurable&&i.enumerable&&(i.enumerable=!1,Object.defineProperty(e.prototype,n,i))}EK(t,e),EK(`${t}.prototype`,e.prototype)}function EK(e,t){let n=`%${e}%`;if(wK[n]!==void 0)throw Error(`intrinsic ${e} already exists`);wK[n]=t}function DK(e){return wK[e]}function OK(e,t){let n=e;if(n===0)return{div:n,mod:n};let r=Math.sign(n);n=Math.abs(n);let i=Math.trunc(1+Math.log10(n));if(t>=i)return{div:0*r,mod:r*n};if(t===0)return{div:r*n,mod:0*r};let a=n.toPrecision(i);return{div:r*Number.parseInt(a.slice(0,i-t),10),mod:r*Number.parseInt(a.slice(i-t),10)}}function kK(e,t,n){let r=e,i=n;if(r===0)return i;let a=Math.sign(r)||Math.sign(i);r=Math.abs(r),i=Math.abs(i);let o=r.toPrecision(Math.trunc(1+Math.log10(r)));if(i===0)return a*Number.parseInt(o+`0`.repeat(t),10);let s=o+i.toPrecision(Math.trunc(1+Math.log10(i))).padStart(t,`0`);return a*Number.parseInt(s,10)}function AK(e,t){let n=t===`negative`;switch(e){case`ceil`:return n?`zero`:`infinity`;case`floor`:return n?`infinity`:`zero`;case`expand`:return`infinity`;case`trunc`:return`zero`;case`halfCeil`:return n?`half-zero`:`half-infinity`;case`halfFloor`:return n?`half-infinity`:`half-zero`;case`halfExpand`:return`half-infinity`;case`halfTrunc`:return`half-zero`;case`halfEven`:return`half-even`}}function jK(e,t,n,r,i){return i===`zero`?e:i===`infinity`?t:n<0?e:n>0?t:i===`half-zero`?e:i===`half-infinity`?t:r?e:t}var MK=class e{constructor(e){this.totalNs=NG(e),this.sec=Z.default.toNumber(Z.default.divide(this.totalNs,AG)),this.subsec=Z.default.toNumber(Z.default.remainder(this.totalNs,AG))}static validateNew(t,n){if(Z.default.greaterThan(FG(t),e.MAX))throw RangeError(`${n} of duration time units cannot exceed ${e.MAX} s`);return new e(t)}static fromEpochNsDiff(t,n){let r=Z.default.subtract(NG(t),NG(n));return new e(r)}static fromComponents(t,n,r,i,a,o){let s=Z.default.add(Z.default.add(Z.default.add(Z.default.add(Z.default.add(Z.default.BigInt(o),Z.default.multiply(Z.default.BigInt(a),Mve)),Z.default.multiply(Z.default.BigInt(i),kG)),Z.default.multiply(Z.default.BigInt(r),AG)),Z.default.multiply(Z.default.BigInt(n),Nve)),Z.default.multiply(Z.default.BigInt(t),jG));return e.validateNew(s,`total`)}abs(){return new e(FG(this.totalNs))}add(t){return e.validateNew(Z.default.add(this.totalNs,t.totalNs),`sum`)}add24HourDays(t){return e.validateNew(Z.default.add(this.totalNs,Z.default.multiply(Z.default.BigInt(t),MG)),`sum`)}addToEpochNs(e){return Z.default.add(NG(e),this.totalNs)}cmp(e){return IG(this.totalNs,e.totalNs)}divmod(t){let{quotient:n,remainder:r}=LG(this.totalNs,Z.default.BigInt(t));return{quotient:Z.default.toNumber(n),remainder:new e(r)}}fdiv(e){let t=NG(e),n=Z.default.BigInt(t),{quotient:r,remainder:i}=LG(this.totalNs,n),a=[],o,s=(Z.default.lessThan(this.totalNs,EG)?-1:1)*Math.sign(Z.default.toNumber(t));for(;!Z.default.equal(i,EG)&&a.length<50;)i=Z.default.multiply(i,kve),{quotient:o,remainder:i}=LG(i,n),a.push(Math.abs(Z.default.toNumber(o)));return s*Number(FG(r).toString()+`.`+a.join(``))}isZero(){return Z.default.equal(this.totalNs,EG)}round(t,n){let r=NG(t);if(Z.default.equal(r,DG))return this;let{quotient:i,remainder:a}=LG(this.totalNs,r),o=Z.default.lessThan(this.totalNs,EG)?`negative`:`positive`,s=Z.default.multiply(FG(i),r),c=Z.default.add(s,r),l=IG(FG(Z.default.multiply(a,OG)),r),u=AK(n,o),d=Z.default.equal(FG(this.totalNs),s)?s:jK(s,c,l,PG(i),u),f=o===`positive`?d:Z.default.unaryMinus(d);return e.validateNew(f,`rounding`)}sign(){return this.cmp(new e(EG))}subtract(t){return e.validateNew(Z.default.subtract(this.totalNs,t.totalNs),`difference`)}};MK.MAX=Z.default.BigInt(`9007199254740991999999999`),MK.ZERO=new MK(EG);var NK=/[A-Za-z._][A-Za-z._0-9+-]*/,PK=RegExp(`(?:(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)|(?:${NK.source})(?:\\/(?:${NK.source}))*)`),FK=/(?:[+-]\d{6}|\d{4})/,IK=/(?:0[1-9]|1[0-2])/,LK=/(?:0[1-9]|[12]\d|3[01])/,Pve=RegExp(`(${FK.source})(?:-(${IK.source})-(${LK.source})|(${IK.source})(${LK.source}))`),RK=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,zK=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,BK=RegExp(`([zZ])|${zK.source}?`),VK=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,Fve=new RegExp([`^${Pve.source}`,`(?:(?:[tT]|\\s+)${RK.source}(?:${BK.source})?)?`,`(?:\\[!?(${PK.source})\\])?`,`((?:${VK.source})*)$`].join(``)),Ive=new RegExp([`^[tT]?${RK.source}`,`(?:${BK.source})?`,`(?:\\[!?${PK.source}\\])?`,`((?:${VK.source})*)$`].join(``)),Lve=RegExp(`^(${FK.source})-?(${IK.source})(?:\\[!?${PK.source}\\])?((?:${VK.source})*)$`),Rve=RegExp(`^(?:--)?(${IK.source})-?(${LK.source})(?:\\[!?${PK.source}\\])?((?:${VK.source})*)$`),HK=/(\d+)(?:[.,](\d{1,9}))?/,zve=RegExp(`(?:${HK.source}H)?(?:${HK.source}M)?(?:${HK.source}S)?`),Bve=RegExp(`^([+-])?P(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)W)?(?:(\\d+)D)?(?:T(?!$)${zve.source})?$`,`i`),UK=864e5,WK=1e6*UK,Vve=6e10,GK=1e8*UK,KK=PX(GK),qK=Z.default.unaryMinus(KK),Hve=Z.default.add(Z.default.subtract(qK,MG),DG),Uve=Z.default.subtract(Z.default.add(KK,MG),DG),Wve=146097*UK,JK=-271821,YK=275760,XK=Date.UTC(1847,0,1),Gve=[`iso8601`,`hebrew`,`islamic`,`islamic-umalqura`,`islamic-tbla`,`islamic-civil`,`islamic-rgsa`,`islamicc`,`persian`,`ethiopic`,`ethioaa`,`ethiopic-amete-alem`,`coptic`,`chinese`,`dangi`,`roc`,`indian`,`buddhist`,`japanese`,`gregory`],Kve=new Set([`ACT`,`AET`,`AGT`,`ART`,`AST`,`BET`,`BST`,`CAT`,`CNT`,`CST`,`CTT`,`EAT`,`ECT`,`IET`,`IST`,`JST`,`MIT`,`NET`,`NST`,`PLT`,`PNT`,`PRT`,`PST`,`SST`,`VST`]);function ZK(e){return typeof e==`object`&&!!e||typeof e==`function`}function QK(e){if(typeof e==`bigint`)throw TypeError(`Cannot convert BigInt to number`);return Number(e)}function $K(e){if(typeof e==`symbol`)throw TypeError(`Cannot convert a Symbol value to a String`);return String(e)}function eq(e){let t=QK(e);if(t===0)return 0;if(Number.isNaN(t)||t===1/0||t===-1/0)throw RangeError(`invalid number value`);let n=Math.trunc(t);return n===0?0:n}function tq(e,t){let n=eq(e);if(n<=0)throw RangeError(t===void 0?`Cannot convert a number less than one to a positive integer`:`property '${t}' cannot be a a number less than one`);return n}function nq(e){let t=QK(e);if(Number.isNaN(t))throw RangeError(`not a number`);if(t===1/0||t===-1/0)throw RangeError(`infinity is out of range`);if(!function(e){if(typeof e!=`number`||Number.isNaN(e)||e===1/0||e===-1/0)return!1;let t=Math.abs(e);return Math.floor(t)===t}(t))throw RangeError(`unsupported fractional value ${e}`);return t===0?0:t}function rq(e,t){return String(e).padStart(t,`0`)}function iq(e){if(typeof e!=`string`)throw TypeError(`expected a string, not ${String(e)}`);return e}function aq(e,t){if(ZK(e)){let t=e?.toString();if(typeof t==`string`||typeof t==`number`)return t;throw TypeError(`Cannot convert object to primitive value`)}return e}var oq=[`era`,`eraYear`,`year`,`month`,`monthCode`,`day`,`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],qve={era:$K,eraYear:eq,year:eq,month:tq,monthCode:function(e){let t=iq(aq(e));if(t.length<3||t.length>4||t[0]!==`M`||`0123456789`.indexOf(t[1])===-1||`0123456789`.indexOf(t[2])===-1||t[1]+t[2]===`00`&&t[3]!==`L`||t[3]!==`L`&&t[3]!==void 0)throw RangeError(`bad month code ${t}; must match M01-M99 or M00L-M99L`);return t},day:tq,hour:eq,minute:eq,second:eq,millisecond:eq,microsecond:eq,nanosecond:eq,offset:function(e){let t=iq(aq(e));return cY(t),t},timeZone:BJ},Jve={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},sq=[[`years`,`year`,`date`],[`months`,`month`,`date`],[`weeks`,`week`,`date`],[`days`,`day`,`date`],[`hours`,`hour`,`time`],[`minutes`,`minute`,`time`],[`seconds`,`second`,`time`],[`milliseconds`,`millisecond`,`time`],[`microseconds`,`microsecond`,`time`],[`nanoseconds`,`nanosecond`,`time`]],cq=Object.fromEntries(sq.map((e=>[e[0],e[1]]))),Yve=Object.fromEntries(sq.map((([e,t])=>[t,e]))),lq=sq.map((([,e])=>e)),uq={day:WK,hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},dq=[`days`,`hours`,`microseconds`,`milliseconds`,`minutes`,`months`,`nanoseconds`,`seconds`,`weeks`,`years`],Xve=Intl.DateTimeFormat,fq=new Map;function pq(e){let t=UX(e),n=fq.get(t);return n===void 0&&(n=new Xve(`en-us`,{timeZone:t,hour12:!1,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),fq.set(t,n)),n}function mq(e){return SK(e,BG)&&!SK(e,JG,WG)}function hq(e){return SK(e,YG,XG,QG,$G,eK,tK,nK,rK,iK)}function gq(e){return SK(e,GG)}function _q(e){return SK(e,UG)}function vq(e){return SK(e,HG)}function yq(e){return SK(e,KG)}function bq(e){return SK(e,qG)}function xq(e){return SK(e,BG,JG,WG)}function $(e,t){if(!t(e))throw TypeError(`invalid receiver: method called with the wrong type of this-object`)}function Sq(e){if(SK(e,WG)||SK(e,JG))throw TypeError(`with() does not support a calendar or timeZone property`);if(_q(e))throw TypeError(`with() does not accept Temporal.PlainTime, use withPlainTime() instead`);if(e.calendar!==void 0)throw TypeError(`with() does not support a calendar property`);if(e.timeZone!==void 0)throw TypeError(`with() does not support a timeZone property`)}function Cq(e,t){return t===`never`||t===`auto`&&e===`iso8601`?``:`[${t===`critical`?`!`:``}u-ca=${e}]`}function wq(e){let t,n,r=!1;for(VK.lastIndex=0;n=VK.exec(e);){let{1:i,2:a,3:o}=n;if(a===`u-ca`){if(t===void 0)t=o,r=i===`!`;else if(i===`!`||r)throw RangeError(`Invalid annotations in ${e}: more than one u-ca present with critical flag`)}else if(i===`!`)throw RangeError(`Unrecognized annotation: !${a}=${o}`)}return t}function Tq(e){let t=Fve.exec(e);if(!t)throw RangeError(`invalid RFC 9557 string: ${e}`);let n=wq(t[16]),r=t[1];if(r===`-000000`)throw RangeError(`invalid RFC 9557 string: ${e}`);let i=+r,a=+(t[2]??t[4]??1),o=+(t[3]??t[5]??1),s=t[6]!==void 0,c=+(t[6]??0),l=+(t[7]??t[10]??0),u=+(t[8]??t[11]??0);u===60&&(u=59);let d=(t[9]??t[12]??``)+`000000000`,f=+d.slice(0,3),p=+d.slice(3,6),m=+d.slice(6,9),h,g=!1;t[13]?(h=void 0,g=!0):t[14]&&(h=t[14]);let _=t[15];return RY(i,a,o,c,l,u,f,p,m),{year:i,month:a,day:o,time:s?{hour:c,minute:l,second:u,millisecond:f,microsecond:p,nanosecond:m}:`start-of-day`,tzAnnotation:_,offset:h,z:g,calendar:n}}function Eq(e){let t=Ive.exec(e),n,r,i,a,o,s,c;if(t){c=wq(t[10]),n=+(t[1]??0),r=+(t[2]??t[5]??0),i=+(t[3]??t[6]??0),i===60&&(i=59);let e=(t[4]??t[7]??``)+`000000000`;if(a=+e.slice(0,3),o=+e.slice(3,6),s=+e.slice(6,9),t[8])throw RangeError(`Z designator not supported for PlainTime`)}else{let t,l;if({time:t,z:l,calendar:c}=Tq(e),t===`start-of-day`)throw RangeError(`time is missing in string: ${e}`);if(l)throw RangeError(`Z designator not supported for PlainTime`);({hour:n,minute:r,second:i,millisecond:a,microsecond:o,nanosecond:s}=t)}if(LY(n,r,i,a,o,s),/[tT ][0-9][0-9]/.test(e))return{hour:n,minute:r,second:i,millisecond:a,microsecond:o,nanosecond:s,calendar:c};try{let{month:t,day:n}=Oq(e);FY(1972,t,n)}catch{try{let{year:t,month:n}=Dq(e);FY(t,n,1)}catch{return{hour:n,minute:r,second:i,millisecond:a,microsecond:o,nanosecond:s,calendar:c}}}throw RangeError(`invalid RFC 9557 time-only string ${e}; may need a T prefix`)}function Dq(e){let t=Lve.exec(e),n,r,i,a;if(t){i=wq(t[3]);let o=t[1];if(o===`-000000`)throw RangeError(`invalid RFC 9557 string: ${e}`);if(n=+o,r=+t[2],a=1,i!==void 0&&i!==`iso8601`)throw RangeError(`YYYY-MM format is only valid with iso8601 calendar`)}else{let t;if({year:n,month:r,calendar:i,day:a,z:t}=Tq(e),t)throw RangeError(`Z designator not supported for PlainYearMonth`)}return{year:n,month:r,calendar:i,referenceISODay:a}}function Oq(e){let t=Rve.exec(e),n,r,i,a;if(t){if(i=wq(t[3]),n=+t[1],r=+t[2],i!==void 0&&i!==`iso8601`)throw RangeError(`MM-DD format is only valid with iso8601 calendar`)}else{let t;if({month:n,day:r,calendar:i,year:a,z:t}=Tq(e),t)throw RangeError(`Z designator not supported for PlainMonthDay`)}return{month:n,day:r,calendar:i,referenceISOYear:a}}var kq=RegExp(`^${PK.source}$`,`i`),Aq=RegExp(`^([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?$`);function jq(e){let t=Qve.test(e)?`Seconds not allowed in offset time zone`:`Invalid time zone`;throw RangeError(`${t}: ${e}`)}function Mq(e){return kq.test(e)||jq(e),Aq.test(e)?{offsetMinutes:cY(e)/6e10}:{tzName:e}}function Nq(e,t,n,r){let i=e,a=t,o=n;switch(r){case`reject`:FY(i,a,o);break;case`constrain`:({year:i,month:a,day:o}=NY(i,a,o))}return{year:i,month:a,day:o}}function Pq(e,t,n,r,i,a,o){let s=e,c=t,l=n,u=r,d=i,f=a;switch(o){case`reject`:LY(s,c,l,u,d,f);break;case`constrain`:s=MY(s,0,23),c=MY(c,0,59),l=MY(l,0,59),u=MY(u,0,999),d=MY(d,0,999),f=MY(f,0,999)}return{hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}function Fq(e){if(!ZK(e))throw TypeError(`invalid duration-like`);let t={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0},n=!1;for(let r=0;r<dq.length;r++){let i=dq[r],a=e[i];a!==void 0&&(n=!0,t[i]=nq(a))}if(!n)throw TypeError(`invalid duration-like`);return t}function Iq({years:e,months:t,weeks:n,days:r},i,a,o){return{years:e,months:o??t,weeks:a??n,days:i??r}}function Lq(e,t){return{isoDate:e,time:t}}function Rq(e){return VX(e,`overflow`,[`constrain`,`reject`],`constrain`)}function zq(e){return VX(e,`disambiguation`,[`compatible`,`earlier`,`later`,`reject`],`compatible`)}function Bq(e,t){return VX(e,`roundingMode`,[`ceil`,`floor`,`expand`,`trunc`,`halfCeil`,`halfFloor`,`halfExpand`,`halfTrunc`,`halfEven`],t)}function Vq(e,t){return VX(e,`offset`,[`prefer`,`use`,`ignore`,`reject`],t)}function Hq(e){return VX(e,`calendarName`,[`auto`,`always`,`never`,`critical`],`auto`)}function Uq(e){let t=e.roundingIncrement;if(t===void 0)return 1;let n=eq(t);if(n<1||n>1e9)throw RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${t}`);return n}function Wq(e,t,n){let r=n?t:t-1;if(e>r)throw RangeError(`roundingIncrement must be at least 1 and less than ${r}, not ${e}`);if(t%e!=0)throw RangeError(`Rounding increment must divide evenly into ${t}`)}function Gq(e){let t=e.fractionalSecondDigits;if(t===void 0)return`auto`;if(typeof t!=`number`){if($K(t)!==`auto`)throw RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`);return`auto`}let n=Math.floor(t);if(!Number.isFinite(n)||n<0||n>9)throw RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`);return n}function Kq(e,t){switch(e){case`minute`:return{precision:`minute`,unit:`minute`,increment:1};case`second`:return{precision:0,unit:`second`,increment:1};case`millisecond`:return{precision:3,unit:`millisecond`,increment:1};case`microsecond`:return{precision:6,unit:`microsecond`,increment:1};case`nanosecond`:return{precision:9,unit:`nanosecond`,increment:1}}switch(t){case`auto`:return{precision:t,unit:`nanosecond`,increment:1};case 0:return{precision:t,unit:`second`,increment:1};case 1:case 2:case 3:return{precision:t,unit:`millisecond`,increment:10**(3-t)};case 4:case 5:case 6:return{precision:t,unit:`microsecond`,increment:10**(6-t)};case 7:case 8:case 9:return{precision:t,unit:`nanosecond`,increment:10**(9-t)};default:throw RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`)}}var qq=Symbol(`~required~`);function Jq(e,t,n,r,i=[]){let a=[];for(let e=0;e<sq.length;e++){let t=sq[e],r=t[1],i=t[2];n!==`datetime`&&n!==i||a.push(r)}a=a.concat(i);let o=r;o===qq?o=void 0:o!==void 0&&a.push(o);let s=[];s=s.concat(a);for(let e=0;e<a.length;e++){let t=Yve[a[e]];t!==void 0&&s.push(t)}let c=VX(e,t,s,o);if(c===void 0&&r===qq)throw RangeError(`${t} is required`);return c&&c in cq?cq[c]:c}function Yq(e){let t=e.relativeTo;if(t===void 0)return{};let n,r,i,a,o,s=`option`,c=!1;if(ZK(t)){if(xq(t))return{zonedRelativeTo:t};if(gq(t))return{plainRelativeTo:t};if(vq(t))return{plainRelativeTo:_J(Q(t,HG).isoDate,Q(t,WG))};i=FJ(t);let e=rJ(i,t,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],[]);({isoDate:n,time:r}=oJ(i,e,`constrain`)),{offset:o,timeZone:a}=e,o===void 0&&(s=`wall`)}else{let e,l,u,d,f;if({year:u,month:d,day:f,time:r,calendar:i,tzAnnotation:e,offset:o,z:l}=Tq(iq(t)),e)a=BJ(e),l?s=`exact`:o||(s=`wall`),c=!0;else if(l)throw RangeError(`Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone`);i||=`iso8601`,i=HX(i),n={year:u,month:d,day:f}}return a===void 0?{plainRelativeTo:_J(n,i)}:{zonedRelativeTo:kJ(mJ(n,r,s,s===`option`?cY(o):0,a,`compatible`,`reject`,c),a,i)}}function Xq(e){return Q(e,YG)===0?Q(e,XG)===0?Q(e,ZG)===0?Q(e,QG)===0?Q(e,$G)===0?Q(e,eK)===0?Q(e,tK)===0?Q(e,nK)===0?Q(e,rK)===0?`nanosecond`:`microsecond`:`millisecond`:`second`:`minute`:`hour`:`day`:`week`:`month`:`year`}function Zq(e,t){return lq.indexOf(e)>lq.indexOf(t)?t:e}function Qq(e){return e===`year`||e===`month`||e===`week`}function $q(e){return Qq(e)||e===`day`?`date`:`time`}function eJ(e){return DK(`%calendarImpl%`)(e)}function tJ(e){return DK(`%calendarImpl%`)(Q(e,WG))}function nJ(e,t,n=`date`){let r=Object.create(null),i=eJ(e).isoToDate(t,{year:!0,monthCode:!0,day:!0});return r.monthCode=i.monthCode,n!==`month-day`&&n!==`date`||(r.day=i.day),n!==`year-month`&&n!==`date`||(r.year=i.year),r}function rJ(e,t,n,r,i){let a=eJ(e).extraFields(n),o=n.concat(r,a),s=Object.create(null),c=!1;o.sort();for(let e=0;e<o.length;e++){let n=o[e],r=t[n];if(r!==void 0)c=!0,s[n]=(0,qve[n])(r);else if(i!==`partial`){if(i.includes(n))throw TypeError(`required property '${n}' missing or undefined`);s[n]=Jve[n]}}if(i===`partial`&&!c)throw TypeError(`no supported properties found`);return s}function iJ(e,t=`complete`){let n=[`hour`,`microsecond`,`millisecond`,`minute`,`nanosecond`,`second`],r=!1,i=Object.create(null);for(let a=0;a<n.length;a++){let o=n[a],s=e[o];s===void 0?t===`complete`&&(i[o]=0):(i[o]=eq(s),r=!0)}if(!r)throw TypeError(`invalid time-like`);return i}function aJ(e,t){if(ZK(e)){if(gq(e))return Rq(zX(t)),_J(Q(e,VG),Q(e,WG));if(xq(e)){let n=WJ(Q(e,JG),Q(e,BG));return Rq(zX(t)),_J(n.isoDate,Q(e,WG))}if(vq(e))return Rq(zX(t)),_J(Q(e,HG).isoDate,Q(e,WG));let n=FJ(e);return _J(LJ(n,rJ(n,e,[`year`,`month`,`monthCode`,`day`],[],[]),Rq(zX(t))),n)}let{year:n,month:r,day:i,calendar:a,z:o}=Tq(iq(e));if(o)throw RangeError(`Z designator not supported for PlainDate`);return a||=`iso8601`,a=HX(a),Rq(zX(t)),_J({year:n,month:r,day:i},a)}function oJ(e,t,n){return Lq(LJ(e,t,n),Pq(t.hour,t.minute,t.second,t.millisecond,t.microsecond,t.nanosecond,n))}function sJ(e,t){let n,r,i;if(ZK(e)){if(vq(e))return Rq(zX(t)),yJ(Q(e,HG),Q(e,WG));if(xq(e)){let n=WJ(Q(e,JG),Q(e,BG));return Rq(zX(t)),yJ(n,Q(e,WG))}if(gq(e))return Rq(zX(t)),yJ(Lq(Q(e,VG),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),Q(e,WG));i=FJ(e);let a=rJ(i,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],[]),o=Rq(zX(t));({isoDate:n,time:r}=oJ(i,a,o))}else{let a,o,s,c;if({year:o,month:s,day:c,time:r,calendar:i,z:a}=Tq(iq(e)),a)throw RangeError(`Z designator not supported for PlainDateTime`);r===`start-of-day`&&(r={deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),RY(o,s,c,r.hour,r.minute,r.second,r.millisecond,r.microsecond,r.nanosecond),i||=`iso8601`,i=HX(i),Rq(zX(t)),n={year:o,month:s,day:c}}return yJ(Lq(n,r),i)}function cJ(e){let t=DK(`%Temporal.Duration%`);if(hq(e))return new t(Q(e,YG),Q(e,XG),Q(e,ZG),Q(e,QG),Q(e,$G),Q(e,eK),Q(e,tK),Q(e,nK),Q(e,rK),Q(e,iK));if(!ZK(e))return function(e){let{years:t,months:n,weeks:r,days:i,hours:a,minutes:o,seconds:s,milliseconds:c,microseconds:l,nanoseconds:u}=function(e){let t=Bve.exec(e);if(!t||t.every(((e,t)=>t<2||e===void 0)))throw RangeError(`invalid duration: ${e}`);let n=t[1]===`-`?-1:1,r=t[2]===void 0?0:eq(t[2])*n,i=t[3]===void 0?0:eq(t[3])*n,a=t[4]===void 0?0:eq(t[4])*n,o=t[5]===void 0?0:eq(t[5])*n,s=t[6]===void 0?0:eq(t[6])*n,c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=0,m=0,h=0;if(c!==void 0){if(l??u??d??f)throw RangeError(`only the smallest unit can be fractional`);h=3600*eq((c+`000000000`).slice(0,9))*n}else if(p=l===void 0?0:eq(l)*n,u!==void 0){if(d??f)throw RangeError(`only the smallest unit can be fractional`);h=60*eq((u+`000000000`).slice(0,9))*n}else m=d===void 0?0:eq(d)*n,f!==void 0&&(h=eq((f+`000000000`).slice(0,9))*n);let g=h%1e3,_=Math.trunc(h/1e3)%1e3,v=Math.trunc(h/1e6)%1e3;return m+=Math.trunc(h/1e9)%60,p+=Math.trunc(h/6e10),UY(r,i,a,o,s,p,m,v,_,g),{years:r,months:i,weeks:a,days:o,hours:s,minutes:p,seconds:m,milliseconds:v,microseconds:_,nanoseconds:g}}(e);return new(DK(`%Temporal.Duration%`))(t,n,r,i,a,o,s,c,l,u)}(iq(e));let n={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},r=Fq(e);for(let e=0;e<dq.length;e++){let t=dq[e],i=r[t];i!==void 0&&(n[t]=i)}return new t(n.years,n.months,n.weeks,n.days,n.hours,n.minutes,n.seconds,n.milliseconds,n.microseconds,n.nanoseconds)}function lJ(e){let t;if(ZK(e)){if(mq(e)||xq(e))return DJ(Q(e,BG));t=aq(e)}else t=e;let{year:n,month:r,day:i,time:a,offset:o,z:s}=function(e){let t=Tq(e);if(!t.z&&!t.offset)throw RangeError(`Temporal.Instant requires a time zone offset`);return t}(iq(t)),{hour:c=0,minute:l=0,second:u=0,millisecond:d=0,microsecond:f=0,nanosecond:p=0}=a===`start-of-day`?{}:a,m=OY(n,r,i,c,l,u,d,f,p-(s?0:cY(o)));return XY(m.isoDate),DJ(gY(m))}function uJ(e,t){if(ZK(e)){if(bq(e))return Rq(zX(t)),xJ(Q(e,VG),Q(e,WG));let n;return SK(e,WG)?n=Q(e,WG):(n=e.calendar,n===void 0&&(n=`iso8601`),n=PJ(n)),xJ(zJ(n,rJ(n,e,[`year`,`month`,`monthCode`,`day`],[],[]),Rq(zX(t))),n)}let{month:n,day:r,referenceISOYear:i,calendar:a}=Oq(iq(e));if(a===void 0&&(a=`iso8601`),a=HX(a),Rq(zX(t)),a===`iso8601`)return xJ({year:1972,month:n,day:r},a);let o={year:i,month:n,day:r};return IY(o),o=zJ(a,nJ(a,o,`month-day`),`constrain`),xJ(o,a)}function dJ(e,t){let n;if(ZK(e)){if(_q(e))return Rq(zX(t)),CJ(Q(e,UG));if(vq(e))return Rq(zX(t)),CJ(Q(e,HG).time);if(xq(e)){let n=WJ(Q(e,JG),Q(e,BG));return Rq(zX(t)),CJ(n.time)}let{hour:r,minute:i,second:a,millisecond:o,microsecond:s,nanosecond:c}=iJ(e);n=Pq(r,i,a,o,s,c,Rq(zX(t)))}else n=Eq(iq(e)),Rq(zX(t));return CJ(n)}function fJ(e){return e===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:Q(dJ(e),UG)}function pJ(e,t){if(ZK(e)){if(yq(e))return Rq(zX(t)),TJ(Q(e,VG),Q(e,WG));let n=FJ(e);return TJ(RJ(n,rJ(n,e,[`year`,`month`,`monthCode`],[],[]),Rq(zX(t))),n)}let{year:n,month:r,referenceISODay:i,calendar:a}=Dq(iq(e));a===void 0&&(a=`iso8601`),a=HX(a),Rq(zX(t));let o={year:n,month:r,day:i};return HY(o),o=RJ(a,nJ(a,o,`year-month`),`constrain`),TJ(o,a)}function mJ(e,t,n,r,i,a,o,s){if(t===`start-of-day`)return JJ(i,e);let c=Lq(e,t);if(n===`wall`||o===`ignore`)return GJ(i,c,a);if(n===`exact`||o===`use`){let n=OY(e.year,e.month,e.day,t.hour,t.minute,t.second,t.millisecond,t.microsecond,t.nanosecond-r);XY(n.isoDate);let i=gY(n);return VY(i),i}XY(e);let l=gY(c),u=qJ(i,c);for(let e=0;e<u.length;e++){let t=u[e],n=Z.default.toNumber(Z.default.subtract(l,t)),i=CX(n,6e10,`halfExpand`);if(n===r||s&&i===r)return t}if(o===`reject`){let e=UJ(r),t=rY(c,`iso8601`,`auto`);throw RangeError(`Offset ${e} is invalid for ${t} in ${i}`)}return KJ(u,i,c,a)}function hJ(e,t){let n,r,i,a,o,s,c,l=!1,u=`option`;if(ZK(e)){if(xq(e)){let n=zX(t);return zq(n),Vq(n,`reject`),Rq(n),kJ(Q(e,BG),Q(e,JG),Q(e,WG))}o=FJ(e);let l=rJ(o,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],[`timeZone`]);({offset:a,timeZone:i}=l),a===void 0&&(u=`wall`);let d=zX(t);s=zq(d),c=Vq(d,`reject`);let f=Rq(d);({isoDate:n,time:r}=oJ(o,l,f))}else{let d,f,p,m,h;({year:p,month:m,day:h,time:r,tzAnnotation:d,offset:a,z:f,calendar:o}=function(e){let t=Tq(e);if(!t.tzAnnotation)throw RangeError(`Temporal.ZonedDateTime requires a time zone ID in brackets`);return t}(iq(e))),i=BJ(d),f?u=`exact`:a||(u=`wall`),o||=`iso8601`,o=HX(o),l=!0;let g=zX(t);s=zq(g),c=Vq(g,`reject`),Rq(g),n={year:p,month:m,day:h}}let d=0;return u===`option`&&(d=cY(a)),kJ(mJ(n,r,u,d,i,s,c,l),i,o)}function gJ(e,t,n){IY(t),xK(e),CK(e,VG,t),CK(e,WG,n),CK(e,GG,!0)}function _J(e,t){let n=DK(`%Temporal.PlainDate%`),r=Object.create(n.prototype);return gJ(r,e,t),r}function vJ(e,t,n){zY(t),xK(e),CK(e,HG,t),CK(e,WG,n)}function yJ(e,t){let n=DK(`%Temporal.PlainDateTime%`),r=Object.create(n.prototype);return vJ(r,e,t),r}function bJ(e,t,n){IY(t),xK(e),CK(e,VG,t),CK(e,WG,n),CK(e,qG,!0)}function xJ(e,t){let n=DK(`%Temporal.PlainMonthDay%`),r=Object.create(n.prototype);return bJ(r,e,t),r}function SJ(e,t){xK(e),CK(e,UG,t)}function CJ(e){let t=DK(`%Temporal.PlainTime%`),n=Object.create(t.prototype);return SJ(n,e),n}function wJ(e,t,n){HY(t),xK(e),CK(e,VG,t),CK(e,WG,n),CK(e,KG,!0)}function TJ(e,t){let n=DK(`%Temporal.PlainYearMonth%`),r=Object.create(n.prototype);return wJ(r,e,t),r}function EJ(e,t){VY(t),xK(e),CK(e,BG,t)}function DJ(e){let t=DK(`%Temporal.Instant%`),n=Object.create(t.prototype);return EJ(n,e),n}function OJ(e,t,n,r){VY(t),xK(e),CK(e,BG,t),CK(e,JG,n),CK(e,WG,r)}function kJ(e,t,n=`iso8601`){let r=DK(`%Temporal.ZonedDateTime%`),i=Object.create(r.prototype);return OJ(i,e,t,n),i}function AJ(e){return oq.filter((t=>e[t]!==void 0))}function jJ(e,t,n){let r=AJ(n),i=eJ(e).fieldKeysToIgnore(r),a=Object.create(null),o=AJ(t);for(let e=0;e<oq.length;e++){let s,c=oq[e];o.includes(c)&&!i.includes(c)&&(s=t[c]),r.includes(c)&&(s=n[c]),s!==void 0&&(a[c]=s)}return a}function MJ(e,t,n,r){let i=eJ(e).dateAdd(t,n,r);return IY(i),i}function NJ(e,t,n,r){return eJ(e).dateUntil(t,n,r)}function PJ(e){if(ZK(e)&&SK(e,WG))return Q(e,WG);let t=iq(e);try{return HX(t)}catch{}let n;try{({calendar:n}=Tq(t))}catch{try{({calendar:n}=Eq(t))}catch{try{({calendar:n}=Dq(t))}catch{({calendar:n}=Oq(t))}}}return n||=`iso8601`,HX(n)}function FJ(e){if(SK(e,WG))return Q(e,WG);let{calendar:t}=e;return t===void 0?`iso8601`:PJ(t)}function IJ(e,t){return HX(e)===HX(t)}function LJ(e,t,n){let r=eJ(e);r.resolveFields(t,`date`);let i=r.dateToISO(t,n);return IY(i),i}function RJ(e,t,n){let r=eJ(e);r.resolveFields(t,`year-month`),t.day=1;let i=r.dateToISO(t,n);return HY(i),i}function zJ(e,t,n){let r=eJ(e);r.resolveFields(t,`month-day`);let i=r.monthDayToISOReferenceDate(t,n);return IY(i),i}function BJ(e){if(ZK(e)&&xq(e))return Q(e,JG);let t=iq(e);if(t===`UTC`)return`UTC`;let{tzName:n,offsetMinutes:r}=function(e){let{tzAnnotation:t,offset:n,z:r}=function(e){if(kq.test(e))return{tzAnnotation:e,offset:void 0,z:!1};try{let{tzAnnotation:t,offset:n,z:r}=Tq(e);if(r||t||n)return{tzAnnotation:t,offset:n,z:r}}catch{}jq(e)}(e);return t?Mq(t):r?Mq(`UTC`):n?Mq(n):void 0}(t);if(r!==void 0)return pY(r);let i=uY(n);if(!i)throw RangeError(`Unrecognized time zone ${n}`);return i.identifier}function VJ(e,t){if(e===t)return!0;let n=Mq(e).offsetMinutes,r=Mq(t).offsetMinutes;if(n===void 0&&r===void 0){let n=uY(t);if(!n)return!1;let r=uY(e);return!!r&&r.primaryIdentifier===n.primaryIdentifier}return n===r}function HJ(e,t){let n=Mq(e).offsetMinutes;return n===void 0?fY(e,t):6e10*n}function UJ(e){let t=e<0?`-`:`+`,n=Math.abs(e),r=Math.floor(n/36e11),i=Math.floor(n/6e10)%60,a=Math.floor(n/1e9)%60,o=n%1e9;return`${t}${QJ(r,i,a,o,a===0&&o===0?`minute`:`auto`)}`}function WJ(e,t){let n=HJ(e,t),{isoDate:{year:r,month:i,day:a},time:{hour:o,minute:s,second:c,millisecond:l,microsecond:u,nanosecond:d}}=_Y(t);return OY(r,i,a,o,s,c,l,u,d+n)}function GJ(e,t,n){return KJ(qJ(e,t),e,t,n)}function KJ(e,t,n,r){let i=e.length;if(i===1)return e[0];if(i)switch(r){case`compatible`:case`earlier`:return e[0];case`later`:return e[i-1];case`reject`:throw RangeError(`multiple instants found`)}if(r===`reject`)throw RangeError(`multiple instants found`);let a=gY(n),o=Z.default.subtract(a,MG);VY(o);let s=HJ(t,o),c=Z.default.add(a,MG);VY(c);let l=HJ(t,c)-s;switch(r){case`earlier`:{let e=MK.fromComponents(0,0,0,0,0,-l),r=pX(n.time,e);return qJ(t,Lq(DY(n.isoDate.year,n.isoDate.month,n.isoDate.day+r.deltaDays),r))[0]}case`compatible`:case`later`:{let e=MK.fromComponents(0,0,0,0,0,l),r=pX(n.time,e),i=qJ(t,Lq(DY(n.isoDate.year,n.isoDate.month,n.isoDate.day+r.deltaDays),r));return i[i.length-1]}}}function qJ(e,t){if(e===`UTC`)return XY(t.isoDate),[gY(t)];let n=Mq(e).offsetMinutes;if(n!==void 0){let e=OY(t.isoDate.year,t.isoDate.month,t.isoDate.day,t.time.hour,t.time.minute-n,t.time.second,t.time.millisecond,t.time.microsecond,t.time.nanosecond);XY(e.isoDate);let r=gY(e);return VY(r),[r]}return XY(t.isoDate),function(e,t){let n=gY(t),r=Z.default.subtract(n,MG);Z.default.lessThan(r,qK)&&(r=n);let i=Z.default.add(n,MG);Z.default.greaterThan(i,KK)&&(i=n);let a=fY(e,r),o=fY(e,i);return(a===o?[a]:[a,o]).map((r=>{let i=Z.default.subtract(n,Z.default.BigInt(r));if(jX(t,function(e,t){let{epochMilliseconds:n,time:{millisecond:r,microsecond:i,nanosecond:a}}=_Y(t),{year:o,month:s,day:c,hour:l,minute:u,second:d}=bY(e,n);return OY(o,s,c,l,u,d,r,i,a)}(e,i))===0)return VY(i),i})).filter((e=>e!==void 0))}(e,t)}function JJ(e,t){let n=Lq(t,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),r=qJ(e,n);if(r.length)return r[0];let i=gY(n),a=Z.default.subtract(i,MG);return VY(a),vY(e,a)}function YJ(e){let t;return t=e<0||e>9999?(e<0?`-`:`+`)+rq(Math.abs(e),6):rq(e,4),t}function XJ(e){return rq(e,2)}function ZJ(e,t){let n;if(t===`auto`){if(e===0)return``;n=rq(e,9).replace(/0+$/,``)}else{if(t===0)return``;n=rq(e,9).slice(0,t)}return`.${n}`}function QJ(e,t,n,r,i){let a=`${XJ(e)}:${XJ(t)}`;return i===`minute`||(a+=`:${XJ(n)}`,a+=ZJ(r,i)),a}function $J(e,t,n){let r=t;r===void 0&&(r=`UTC`);let i=Q(e,BG),a=rY(WJ(r,i),`iso8601`,n,`never`),o=`Z`;return t!==void 0&&(o=mY(HJ(r,i))),`${a}${o}`}function eY(e,t){let n=Q(e,YG),r=Q(e,XG),i=Q(e,ZG),a=Q(e,QG),o=Q(e,$G),s=Q(e,eK),c=CY(e),l=``;n!==0&&(l+=`${Math.abs(n)}Y`),r!==0&&(l+=`${Math.abs(r)}M`),i!==0&&(l+=`${Math.abs(i)}W`),a!==0&&(l+=`${Math.abs(a)}D`);let u=``;o!==0&&(u+=`${Math.abs(o)}H`),s!==0&&(u+=`${Math.abs(s)}M`);let d=MK.fromComponents(0,0,Q(e,tK),Q(e,nK),Q(e,rK),Q(e,iK));d.isZero()&&![`second`,`millisecond`,`microsecond`,`nanosecond`].includes(Xq(e))&&t===`auto`||(u+=`${Math.abs(d.sec)}${ZJ(Math.abs(d.subsec),t)}S`);let f=`${c<0?`-`:``}P${l}`;return u&&(f=`${f}T${u}`),f}function tY(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,VG);return`${YJ(n)}-${XJ(r)}-${XJ(i)}${Cq(Q(e,WG),t)}`}function nY({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o){return QJ(e,t,n,1e6*r+1e3*i+a,o)}function rY(e,t,n,r=`auto`){let{isoDate:{year:i,month:a,day:o},time:{hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}=e;return`${YJ(i)}-${XJ(a)}-${XJ(o)}T${QJ(s,c,l,1e6*u+1e3*d+f,n)}${Cq(t,r)}`}function iY(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,VG),a=`${XJ(r)}-${XJ(i)}`,o=Q(e,WG);t!==`always`&&t!==`critical`&&o===`iso8601`||(a=`${YJ(n)}-${a}`);let s=Cq(o,t);return s&&(a+=s),a}function aY(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,VG),a=`${YJ(n)}-${XJ(r)}`,o=Q(e,WG);t!==`always`&&t!==`critical`&&o===`iso8601`||(a+=`-${XJ(i)}`);let s=Cq(o,t);return s&&(a+=s),a}function oY(e,t,n=`auto`,r=`auto`,i=`auto`,a=void 0){let o=Q(e,BG);if(a){let{unit:e,increment:t,roundingMode:n}=a;o=wX(o,t,e,n)}let s=Q(e,JG),c=HJ(s,o),l=rY(WJ(s,o),`iso8601`,t,`never`);return i!==`never`&&(l+=mY(c)),r!==`never`&&(l+=`[${r===`critical`?`!`:``}${s}]`),l+=Cq(Q(e,WG),n),l}function sY(e){return Aq.test(e)}function cY(e){let t=$ve.exec(e);if(!t)throw RangeError(`invalid time zone offset: ${e}; must match ±HH:MM[:SS.SSSSSSSSS]`);return(t[1]===`-`?-1:1)*(1e9*(60*(60*t[2]+ +(t[3]||0))+ +(t[4]||0))+ +((t[5]||0)+`000000000`).slice(0,9))}var lY,Zve=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function uY(e){if(lY===void 0){let e=Intl.supportedValuesOf?.(`timeZone`);if(e){lY=new Map;for(let t=0;t<e.length;t++){let n=e[t];lY.set(UX(n),n)}}else lY=null}let t=UX(e),n=lY?.get(t);if(n)return{identifier:n,primaryIdentifier:n};try{n=pq(e).resolvedOptions().timeZone}catch{return}if(t===`antarctica/south_pole`&&(n=`Antarctica/McMurdo`),Kve.has(e))throw RangeError(`${e} is a legacy time zone identifier from ICU. Use ${n} instead`);let r=[...t].map(((e,n)=>n===0||Zve[t[n-1]]?e.toUpperCase():e)).join(``).split(`/`);if(r.length===1)return t===`gb-eire`?{identifier:`GB-Eire`,primaryIdentifier:n}:{identifier:t.length<=3||/[-0-9]/.test(t)?t.toUpperCase():r[0],primaryIdentifier:n};if(r[0]===`Etc`)return{identifier:`Etc/${[`Zulu`,`Greenwich`,`Universal`].includes(r[1])?r[1]:r[1].toUpperCase()}`,primaryIdentifier:n};if(r[0]===`Us`)return{identifier:`US/${r[1]}`,primaryIdentifier:n};let i=new Map([[`Act`,`ACT`],[`Lhi`,`LHI`],[`Nsw`,`NSW`],[`Dar_Es_Salaam`,`Dar_es_Salaam`],[`Port_Of_Spain`,`Port_of_Spain`],[`Port-Au-Prince`,`Port-au-Prince`],[`Isle_Of_Man`,`Isle_of_Man`],[`Comodrivadavia`,`ComodRivadavia`],[`Knox_In`,`Knox_IN`],[`Dumontdurville`,`DumontDUrville`],[`Mcmurdo`,`McMurdo`],[`Denoronha`,`DeNoronha`],[`Easterisland`,`EasterIsland`],[`Bajanorte`,`BajaNorte`],[`Bajasur`,`BajaSur`]]);return r[1]=i.get(r[1])??r[1],r.length>2&&(r[2]=i.get(r[2])??r[2]),{identifier:r.join(`/`),primaryIdentifier:n}}function dY(e,t){let{year:n,month:r,day:i,hour:a,minute:o,second:s}=bY(e,t),c=t%1e3;return c<0&&(c+=1e3),1e6*(hY({isoDate:{year:n,month:r,day:i},time:{hour:a,minute:o,second:s,millisecond:c}})-t)}function fY(e,t){return dY(e,NX(t,`floor`))}function pY(e){let t=e<0?`-`:`+`,n=Math.abs(e);return`${t}${QJ(Math.floor(n/60),n%60,0,0,`minute`)}`}function mY(e){return pY(CX(e,Vve,`halfExpand`)/6e10)}function hY({isoDate:{year:e,month:t,day:n},time:{hour:r,minute:i,second:a,millisecond:o}}){let s=e%400,c=(e-s)/400,l=new Date;return l.setUTCHours(r,i,a,o),l.setUTCFullYear(s,t-1,n),l.getTime()+Wve*c}function gY(e){let t=hY(e),n=1e3*e.time.microsecond+e.time.nanosecond;return Z.default.add(PX(t),Z.default.BigInt(n))}function _Y(e){let t=NX(e,`trunc`),n=Z.default.toNumber(Z.default.remainder(e,kG));n<0&&(n+=1e6,--t);let r=Math.floor(n/1e3)%1e3,i=n%1e3,a=new Date(t);return{epochMilliseconds:t,isoDate:{year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate()},time:{hour:a.getUTCHours(),minute:a.getUTCMinutes(),second:a.getUTCSeconds(),millisecond:a.getUTCMilliseconds(),microsecond:r,nanosecond:i}}}function vY(e,t){if(e===`UTC`)return null;let n=NX(t,`floor`);if(n<XK)return vY(e,PX(XK));let r=Math.max(n,Date.now())+366*UK*3,i=n,a=dY(e,i),o=i,s=a;for(;a===s&&i<r;){if(o=i+2*UK*7,o>GK)return null;s=dY(e,o),a===s&&(i=o)}return a===s?null:PX(GX((t=>dY(e,t)),i,o,a,s))}function yY(e,t){if(e===`UTC`)return null;let n=NX(t,`ceil`),r=Date.now(),i=r+366*UK*3;if(n>i){let t=yY(e,PX(i));if(t===null||Z.default.lessThan(t,PX(r)))return t}if(e===`Africa/Casablanca`||e===`Africa/El_Aaiun`){let t=Date.UTC(2088,0,1);if(t<n)return yY(e,PX(t))}let a=n-1;if(a<XK)return null;let o=dY(e,a),s=a,c=o;for(;o===c&&a>XK;){if(s=a-2*UK*7,s<XK)return null;c=dY(e,s),o===c&&(a=s)}return o===c?null:PX(GX((t=>dY(e,t)),s,a,c,o))}function bY(e,t){return function(e){let t=e.split(/[^\w]+/);if(t.length!==7)throw RangeError(`expected 7 parts in "${e}`);let n=+t[0],r=+t[1],i=+t[2],a=t[3];if(a[0]===`b`||a[0]===`B`)i=1-i;else if(a[0]!==`a`&&a[0]!==`A`)throw RangeError(`Unknown era ${a} in "${e}`);let o=t[4]===`24`?0:+t[4],s=+t[5],c=+t[6];if(!(Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(s)&&Number.isFinite(c)))throw RangeError(`Invalid number in "${e}`);return{year:i,month:n,day:r,hour:o,minute:s,second:c}}(pq(e).format(t))}function xY(e){return e!==void 0&&!(e%4!=0||e%100==0&&e%400!=0)}function SY(e,t){return{standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[xY(e)?`leapyear`:`standard`][t-1]}function CY(e){let t=[Q(e,YG),Q(e,XG),Q(e,ZG),Q(e,QG),Q(e,$G),Q(e,eK),Q(e,tK),Q(e,nK),Q(e,rK),Q(e,iK)];for(let e=0;e<t.length;e++){let n=t[e];if(n!==0)return n<0?-1:1}return 0}function wY(e){let t=[`years`,`months`,`weeks`,`days`];for(let n=0;n<t.length;n++){let r=e[t[n]];if(r!==0)return r<0?-1:1}return 0}function TY(e){let t=wY(e.date);return t===0?e.time.sign():t}function EY(e,t){let n=e,r=t;if(!Number.isFinite(n)||!Number.isFinite(r))throw RangeError(`infinity is out of range`);return--r,n+=Math.floor(r/12),r%=12,r<0&&(r+=12),r+=1,{year:n,month:r}}function DY(e,t,n){let r=e,i=t,a=n;if(!Number.isFinite(a))throw RangeError(`infinity is out of range`);({year:r,month:i}=EY(r,i));let o=146097;if(Math.abs(a)>o){let e=Math.trunc(a/o);r+=400*e,a-=e*o}let s=0,c=i>2?r:r-1;for(;s=xY(c)?366:365,a<-s;)--r,--c,a+=s;for(c+=1;s=xY(c)?366:365,a>s;)r+=1,c+=1,a-=s;for(;a<1;)({year:r,month:i}=EY(r,i-1)),a+=SY(r,i);for(;a>SY(r,i);)a-=SY(r,i),{year:r,month:i}=EY(r,i+1);return{year:r,month:i,day:a}}function OY(e,t,n,r,i,a,o,s,c){let l=kY(r,i,a,o,s,c);return Lq(DY(e,t,n+l.deltaDays),l)}function kY(e,t,n,r,i,a){let o,s=e,c=t,l=n,u=r,d=i,f=a;({div:o,mod:f}=OK(f,3)),d+=o,f<0&&(--d,f+=1e3),{div:o,mod:d}=OK(d,3),u+=o,d<0&&(--u,d+=1e3),l+=Math.trunc(u/1e3),u%=1e3,u<0&&(--l,u+=1e3),c+=Math.trunc(l/60),l%=60,l<0&&(--c,l+=60),s+=Math.trunc(c/60),c%=60,c<0&&(--s,c+=60);let p=Math.trunc(s/24);return s%=24,s<0&&(--p,s+=24),p+=0,s+=0,c+=0,l+=0,u+=0,d+=0,f+=0,{deltaDays:p,hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}function AY(e,t){let n=Iq(e,0);if(wY(n)===0)return e.days;let r=Q(t,VG),i=MJ(Q(t,WG),r,n,`constrain`),a=YY(r.year,r.month-1,r.day),o=YY(i.year,i.month-1,i.day)-a;return e.days+o}function jY(e){return new(DK(`%Temporal.Duration%`))(-Q(e,YG),-Q(e,XG),-Q(e,ZG),-Q(e,QG),-Q(e,$G),-Q(e,eK),-Q(e,tK),-Q(e,nK),-Q(e,rK),-Q(e,iK))}function MY(e,t,n){return Math.min(n,Math.max(t,e))}function NY(e,t,n){let r=MY(t,1,12);return{year:e,month:r,day:MY(n,1,SY(e,r))}}function PY(e,t,n){if(e<t||e>n)throw RangeError(`value out of range: ${t} <= ${e} <= ${n}`)}function FY(e,t,n){PY(t,1,12),PY(n,1,SY(e,t))}function IY(e){zY(Lq(e,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function LY(e,t,n,r,i,a){PY(e,0,23),PY(t,0,59),PY(n,0,59),PY(r,0,999),PY(i,0,999),PY(a,0,999)}function RY(e,t,n,r,i,a,o,s,c){FY(e,t,n),LY(r,i,a,o,s,c)}function zY(e){let t=gY(e);(Z.default.lessThan(t,Hve)||Z.default.greaterThan(t,Uve))&&VY(t)}function BY(e){gY(e)}function VY(e){if(Z.default.lessThan(e,qK)||Z.default.greaterThan(e,KK))throw RangeError(`date/time value is outside of supported range`)}function HY({year:e,month:t}){PY(e,JK,YK),e===JK?PY(t,4,12):e===YK&&PY(t,1,9)}function UY(e,t,n,r,i,a,o,s,c,l){let u=0,d=[e,t,n,r,i,a,o,s,c,l];for(let e=0;e<d.length;e++){let t=d[e];if(t===1/0||t===-1/0)throw RangeError(`infinite values not allowed as duration fields`);if(t!==0){let e=t<0?-1:1;if(u!==0&&e!==u)throw RangeError(`mixed-sign values not allowed as duration fields`);u=e}}if(Math.abs(e)>=2**32||Math.abs(t)>=2**32||Math.abs(n)>=2**32)throw RangeError(`years, months, and weeks must be < 2³²`);let f=OK(s,3),p=OK(c,6),m=OK(l,9),h=OK(1e6*f.mod+1e3*p.mod+m.mod,9).div,g=86400*r+3600*i+60*a+o+f.div+p.div+m.div+h;if(!Number.isSafeInteger(g))throw RangeError(`total of duration time units cannot exceed 9007199254740991.999999999 s`)}function WY(e){return{date:{years:Q(e,YG),months:Q(e,XG),weeks:Q(e,ZG),days:Q(e,QG)},time:MK.fromComponents(Q(e,$G),Q(e,eK),Q(e,tK),Q(e,nK),Q(e,rK),Q(e,iK))}}function GY(e){let t=MK.fromComponents(Q(e,$G),Q(e,eK),Q(e,tK),Q(e,nK),Q(e,rK),Q(e,iK)).add24HourDays(Q(e,QG));return{date:{years:Q(e,YG),months:Q(e,XG),weeks:Q(e,ZG),days:0},time:t}}function KY(e){let t=GY(e),n=Math.trunc(t.time.sec/86400);return UY(t.date.years,t.date.months,t.date.weeks,n,0,0,0,0,0,0),{...t.date,days:n}}function qY(e,t){let n=e.time.sign(),r=e.time.abs().subsec,i=0,a=0,o=e.time.abs().sec,s=0,c=0,l=0;switch(t){case`year`:case`month`:case`week`:case`day`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3,s=Math.trunc(o/60),o%=60,c=Math.trunc(s/60),s%=60,l=Math.trunc(c/24),c%=24;break;case`hour`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3,s=Math.trunc(o/60),o%=60,c=Math.trunc(s/60),s%=60;break;case`minute`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3,s=Math.trunc(o/60),o%=60;break;case`second`:i=Math.trunc(r/1e3),r%=1e3,a=Math.trunc(i/1e3),i%=1e3,o+=Math.trunc(a/1e3),a%=1e3;break;case`millisecond`:i=Math.trunc(r/1e3),r%=1e3,a=kK(o,3,Math.trunc(i/1e3)),i%=1e3,o=0;break;case`microsecond`:i=kK(o,6,Math.trunc(r/1e3)),r%=1e3,o=0;break;case`nanosecond`:r=kK(o,9,r),o=0}return new(DK(`%Temporal.Duration%`))(e.date.years,e.date.months,e.date.weeks,e.date.days+n*l,n*c,n*s,n*o,n*a,n*i,n*r)}function JY(e,t){return wY(e),t.sign(),{date:e,time:t}}function YY(e,t,n){return hY({isoDate:{year:e,month:t+1,day:n},time:{hour:0,minute:0,second:0,millisecond:0}})/UK}function XY({year:e,month:t,day:n}){if(Math.abs(YY(e,t-1,n))>1e8)throw RangeError(`date/time value is outside the supported range`)}function ZY(e,t){let n=t.hour-e.hour,r=t.minute-e.minute,i=t.second-e.second,a=t.millisecond-e.millisecond,o=t.microsecond-e.microsecond,s=t.nanosecond-e.nanosecond;return MK.fromComponents(n,r,i,a,o,s)}function QY(e,t,n,r,i){let a=MK.fromEpochNsDiff(t,e);return a=DX(a,n,r,i),JY({years:0,months:0,weeks:0,days:0},a)}function $Y(e,t,n,r){BY(e),BY(t);let i=ZY(e.time,t.time),a=i.sign(),o=kX(e.isoDate,t.isoDate),s=t.isoDate;o===a&&(s=DY(s.year,s.month,s.day+a),i=i.add24HourDays(-a));let c=Zq(`day`,r),l=NJ(n,e.isoDate,s,c);return r!==c&&(i=i.add24HourDays(l.days),l.days=0),JY(l,i)}function eX(e,t,n,r,i){let a=Z.default.subtract(t,e);if(Z.default.equal(a,EG))return{date:{years:0,months:0,weeks:0,days:0},time:MK.ZERO};let o=Z.default.lessThan(a,EG)?-1:1,s=WJ(n,e),c=WJ(n,t),l,u=0,d=o===1?2:1,f=ZY(s.time,c.time);for(f.sign()===-o&&u++;u<=d;u++){l=Lq(DY(c.isoDate.year,c.isoDate.month,c.isoDate.day-u*o),s.time);let e=GJ(n,l,`compatible`);if(f=MK.fromEpochNsDiff(t,e),f.sign()!==-o)break}let p=Zq(`day`,i);return JY(NJ(r,s.isoDate,l.isoDate,p),f)}function tX(e,t,n,r,i,a,o,s,c){let l,u,d,f,p=t;switch(s){case`year`:{let t=CX(p.date.years,o,`trunc`);l=t,u=t+o*e,d={years:l,months:0,weeks:0,days:0},f={...d,years:u};break}case`month`:{let t=CX(p.date.months,o,`trunc`);l=t,u=t+o*e,d=Iq(p.date,0,0,l),f=Iq(p.date,0,0,u);break}case`week`:{let t=Iq(p.date,0,0),n=MJ(a,r.isoDate,t,`constrain`),i=NJ(a,n,DY(n.year,n.month,n.day+p.date.days),`week`),s=CX(p.date.weeks+i.weeks,o,`trunc`);l=s,u=s+o*e,d=Iq(p.date,0,l),f=Iq(p.date,0,u);break}case`day`:{let t=CX(p.date.days,o,`trunc`);l=t,u=t+o*e,d=Iq(p.date,l),f=Iq(p.date,u);break}}let m=MJ(a,r.isoDate,d,`constrain`),h=MJ(a,r.isoDate,f,`constrain`),g,_,v=Lq(m,r.time),y=Lq(h,r.time);i?(g=GJ(i,v,`compatible`),_=GJ(i,y,`compatible`)):(g=gY(v),_=gY(y));let b=MK.fromEpochNsDiff(n,g),x=MK.fromEpochNsDiff(_,g),S=AK(c,e<0?`negative`:`positive`),C=b.add(b).abs().subtract(x.abs()).sign(),w=Math.abs(l)/o%2==0,T=b.isZero()?Math.abs(l):b.cmp(x)?jK(Math.abs(l),Math.abs(u),C,w,S):Math.abs(u),E=new MK(Z.default.add(Z.default.multiply(x.totalNs,Z.default.BigInt(l)),Z.default.multiply(b.totalNs,Z.default.BigInt(o*e)))).fdiv(x.totalNs),D=T===Math.abs(u);return p={date:D?f:d,time:MK.ZERO},{nudgeResult:{duration:p,nudgedEpochNs:D?_:g,didExpandCalendarUnit:D},total:E}}function nX(e,t,n,r,i,a,o,s,c){let l=e,u=Qq(s)||r&&s===`day`,d=TY(l)<0?-1:1,f;return u?{nudgeResult:f}=tX(d,l,t,n,r,i,o,s,c):f=r?function(e,t,n,r,i,a,o,s){let c=t,l=MJ(i,n.isoDate,c.date,`constrain`),u=Lq(l,n.time),d=Lq(DY(l.year,l.month,l.day+e),n.time),f=GJ(r,u,`compatible`),p=GJ(r,d,`compatible`),m=MK.fromEpochNsDiff(p,f);if(m.sign()!==e)throw RangeError(`time zone returned inconsistent Instants`);let h=Z.default.BigInt(uq[o]*a),g=c.time.round(h,s),_=g.subtract(m),v=_.sign()!==-e,y,b;return v?(y=e,g=_.round(h,s),b=g.addToEpochNs(p)):(y=0,b=g.addToEpochNs(f)),{duration:JY(Iq(c.date,c.date.days+y),g),nudgedEpochNs:b,didExpandCalendarUnit:v}}(d,l,n,r,i,o,s,c):function(e,t,n,r,i,a){let o=e,s=o.time.add24HourDays(o.date.days),c=s.round(Z.default.BigInt(r*uq[i]),a),l=c.subtract(s),{quotient:u}=s.divmod(WK),{quotient:d}=c.divmod(WK),f=Math.sign(d-u)===s.sign(),p=l.addToEpochNs(t),m=0,h=c;return $q(n)===`date`&&(m=d,h=c.add(MK.fromComponents(24*-d,0,0,0,0,0))),{duration:{date:Iq(o.date,m),time:h},nudgedEpochNs:p,didExpandCalendarUnit:f}}(l,t,a,o,s,c),l=f.duration,f.didExpandCalendarUnit&&s!==`week`&&(l=function(e,t,n,r,i,a,o,s){let c=t;if(s===o)return c;let l=lq.indexOf(o);for(let t=lq.indexOf(s)-1;t>=l;t--){let s=lq[t];if(s===`week`&&o!==`week`)continue;let l;switch(s){case`year`:l={years:c.date.years+e,months:0,weeks:0,days:0};break;case`month`:{let t=c.date.months+e;l=Iq(c.date,0,0,t);break}case`week`:{let t=c.date.weeks+e;l=Iq(c.date,0,t);break}}let u=Lq(MJ(a,r.isoDate,l,`constrain`),r.time),d;if(d=i?GJ(i,u,`compatible`):gY(u),IG(n,d)===-e)break;c={date:l,time:MK.ZERO}}return c}(d,l,f.nudgedEpochNs,n,r,i,a,Zq(s,`day`))),l}function rX(e,t,n,r,i,a){return Qq(a)||r&&a===`day`?tX(TY(e)<0?-1:1,e,t,n,r,i,1,a,`trunc`).total:OX(e.time.add24HourDays(e.date.days),a)}function iX(e,t,n,r,i,a,o){if(jX(e,t)==0)return{date:{years:0,months:0,weeks:0,days:0},time:MK.ZERO};zY(e),zY(t);let s=$Y(e,t,n,r);return a===`nanosecond`&&i===1?s:nX(s,gY(t),e,null,n,r,i,a,o)}function aX(e,t,n,r,i,a,o,s){if($q(i)===`time`)return QY(e,t,a,o,s);let c=eX(e,t,n,r,i);return o===`nanosecond`&&a===1?c:nX(c,t,WJ(n,e),n,r,i,a,o,s)}function oX(e,t,n,r,i,a){let o=sq.reduce(((e,t)=>{let i=t[0],a=t[1],o=t[2];return n!==`datetime`&&o!==n||r.includes(a)||e.push(a,i),e}),[]),s=Jq(t,`largestUnit`,n,`auto`);if(r.includes(s))throw RangeError(`largestUnit must be one of ${o.join(`, `)}, not ${s}`);let c=Uq(t),l=Bq(t,`trunc`);e===`since`&&(l=function(e){switch(e){case`ceil`:return`floor`;case`floor`:return`ceil`;case`halfCeil`:return`halfFloor`;case`halfFloor`:return`halfCeil`;default:return e}}(l));let u=Jq(t,`smallestUnit`,n,i);if(r.includes(u))throw RangeError(`smallestUnit must be one of ${o.join(`, `)}, not ${u}`);let d=Zq(a,u);if(s===`auto`&&(s=d),Zq(s,u)!==s)throw RangeError(`largestUnit ${s} cannot be smaller than smallestUnit ${u}`);let f={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[u];return f!==void 0&&Wq(c,f,!1),{largestUnit:s,roundingIncrement:c,roundingMode:l,smallestUnit:u}}function sX(e,t,n,r){let i=lJ(n),a=oX(e,zX(r),`time`,[],`nanosecond`,`second`),o=qY(QY(Q(t,BG),Q(i,BG),a.roundingIncrement,a.smallestUnit,a.roundingMode),a.largestUnit);return e===`since`&&(o=jY(o)),o}function cX(e,t,n,r){let i=aJ(n),a=Q(t,WG),o=Q(i,WG);if(!IJ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=oX(e,zX(r),`date`,[],`day`,`day`),c=DK(`%Temporal.Duration%`),l=Q(t,VG),u=Q(i,VG);if(kX(l,u)===0)return new c;let d={date:NJ(a,l,u,s.largestUnit),time:MK.ZERO};if(s.smallestUnit!==`day`||s.roundingIncrement!==1){let e=Lq(l,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});d=nX(d,gY(Lq(u,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),e,null,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode)}let f=qY(d,`day`);return e===`since`&&(f=jY(f)),f}function lX(e,t,n,r){let i=sJ(n),a=Q(t,WG),o=Q(i,WG);if(!IJ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=oX(e,zX(r),`datetime`,[],`nanosecond`,`day`),c=DK(`%Temporal.Duration%`),l=Q(t,HG),u=Q(i,HG);if(jX(l,u)===0)return new c;let d=qY(iX(l,u,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode),s.largestUnit);return e===`since`&&(d=jY(d)),d}function uX(e,t,n,r){let i=dJ(n),a=oX(e,zX(r),`time`,[],`nanosecond`,`hour`),o=ZY(Q(t,UG),Q(i,UG));o=DX(o,a.roundingIncrement,a.smallestUnit,a.roundingMode);let s=qY(JY({years:0,months:0,weeks:0,days:0},o),a.largestUnit);return e===`since`&&(s=jY(s)),s}function dX(e,t,n,r){let i=pJ(n),a=Q(t,WG),o=Q(i,WG);if(!IJ(a,o))throw RangeError(`cannot compute difference between months of ${a} and ${o} calendars`);let s=oX(e,zX(r),`date`,[`week`,`day`],`month`,`year`),c=DK(`%Temporal.Duration%`);if(kX(Q(t,VG),Q(i,VG))==0)return new c;let l=nJ(a,Q(t,VG),`year-month`);l.day=1;let u=LJ(a,l,`constrain`),d=nJ(a,Q(i,VG),`year-month`);d.day=1;let f=LJ(a,d,`constrain`),p={date:Iq(NJ(a,u,f,s.largestUnit),0,0),time:MK.ZERO};if(s.smallestUnit!==`month`||s.roundingIncrement!==1){let e=Lq(u,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});p=nX(p,gY(Lq(f,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),e,null,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode)}let m=qY(p,`day`);return e===`since`&&(m=jY(m)),m}function fX(e,t,n,r){let i=hJ(n),a=Q(t,WG),o=Q(i,WG);if(!IJ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=oX(e,zX(r),`datetime`,[],`nanosecond`,`hour`),c=Q(t,BG),l=Q(i,BG),u=DK(`%Temporal.Duration%`),d;if($q(s.largestUnit)!==`date`)d=qY(QY(c,l,s.roundingIncrement,s.smallestUnit,s.roundingMode),s.largestUnit);else{let e=Q(t,JG);if(!VJ(e,Q(i,JG)))throw RangeError(`When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.`);if(Z.default.equal(c,l))return new u;d=qY(aX(c,l,e,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode),`hour`)}return e===`since`&&(d=jY(d)),d}function pX({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o){let s=n,c=a;return s+=o.sec,c+=o.subsec,kY(e,t,s,r,i,c)}function mX(e,t){let n=t.addToEpochNs(e);return VY(n),n}function hX(e,t,n,r,i=`constrain`){if(wY(r.date)===0)return mX(e,r.time);let a=WJ(t,e);return mX(GJ(t,Lq(MJ(n,a.isoDate,r.date,i),a.time),`compatible`),r.time)}function gX(e,t,n){let r=cJ(n);e===`subtract`&&(r=jY(r));let i=Zq(Xq(t),Xq(r));if(Qq(i))throw RangeError(`For years, months, or weeks arithmetic, use date arithmetic relative to a starting point`);let a=GY(t),o=GY(r);return qY(JY({years:0,months:0,weeks:0,days:0},a.time.add(o.time)),i)}function _X(e,t,n){let r=cJ(n);e===`subtract`&&(r=jY(r));let i=Xq(r);if($q(i)===`date`)throw RangeError(`Duration field ${i} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let a=GY(r);return DJ(mX(Q(t,BG),a.time))}function vX(e,t,n,r){let i=Q(t,WG),a=cJ(n);e===`subtract`&&(a=jY(a));let o=KY(a),s=Rq(zX(r));return _J(MJ(i,Q(t,VG),o,s),i)}function yX(e,t,n,r){let i=cJ(n);e===`subtract`&&(i=jY(i));let a=Rq(zX(r)),o=Q(t,WG),s=GY(i),c=Q(t,HG),l=pX(c.time,s.time),u=Iq(s.date,l.deltaDays);return UY(u.years,u.months,u.weeks,u.days,0,0,0,0,0,0),yJ(Lq(MJ(o,c.isoDate,u,a),l),o)}function bX(e,t,n){let r=cJ(n);e===`subtract`&&(r=jY(r));let i=GY(r),{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=pX(Q(t,UG),i.time);return CJ(Pq(a,o,s,c,l,u,`reject`))}function xX(e,t,n,r){let i=cJ(n);e===`subtract`&&(i=jY(i));let a=Rq(zX(r)),o=CY(i),s=Q(t,WG),c=nJ(s,Q(t,VG),`year-month`);c.day=1;let l=LJ(s,c,`constrain`);if(o<0){let e=MJ(s,l,{months:1},`constrain`);l=DY(e.year,e.month,e.day-1)}let u=KY(i);return IY(l),TJ(RJ(s,nJ(s,MJ(s,l,u,a),`year-month`),a),s)}function SX(e,t,n,r){let i=cJ(n);e===`subtract`&&(i=jY(i));let a=Rq(zX(r)),o=Q(t,JG),s=Q(t,WG),c=WY(i);return kJ(hX(Q(t,BG),o,s,c,a),o,s)}function CX(e,t,n){let r=Math.trunc(e/t),i=e%t,a=e<0?`negative`:`positive`,o=Math.abs(r),s=o+1,c=RX(Math.abs(2*i)-t),l=o%2==0,u=AK(n,a),d=i===0?o:jK(o,s,c,l,u);return t*(a===`positive`?d:-d)}function wX(e,t,n,r){let i=uq[n]*t;return function(e,t,n){let r=NG(e),i=NG(t),a=Z.default.divide(r,i),o=Z.default.remainder(r,i),s=AK(n,`positive`),c,l;Z.default.lessThan(r,EG)?(c=Z.default.subtract(a,DG),l=a):(c=a,l=Z.default.add(a,DG));let u=IG(FG(Z.default.multiply(o,OG)),i)*(Z.default.lessThan(r,EG)?-1:1)+0,d=Z.default.equal(o,EG)?a:jK(c,l,u,PG(c),s);return Z.default.multiply(d,i)}(e,Z.default.BigInt(i),r)}function TX(e,t,n,r){BY(e);let{year:i,month:a,day:o}=e.isoDate,s=EX(e.time,t,n,r);return Lq(DY(i,a,o+s.deltaDays),s)}function EX({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o,s,c){let l;switch(s){case`day`:case`hour`:l=1e3*(1e3*(1e3*(60*(60*e+t)+n)+r)+i)+a;break;case`minute`:l=1e3*(1e3*(1e3*(60*t+n)+r)+i)+a;break;case`second`:l=1e3*(1e3*(1e3*n+r)+i)+a;break;case`millisecond`:l=1e3*(1e3*r+i)+a;break;case`microsecond`:l=1e3*i+a;break;case`nanosecond`:l=a}let u=uq[s],d=CX(l,u*o,c)/u;switch(s){case`day`:return{deltaDays:d,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case`hour`:return kY(d,0,0,0,0,0);case`minute`:return kY(e,d,0,0,0,0);case`second`:return kY(e,t,d,0,0,0);case`millisecond`:return kY(e,t,n,d,0,0);case`microsecond`:return kY(e,t,n,r,d,0);case`nanosecond`:return kY(e,t,n,r,i,d);default:throw Error(`Invalid unit ${s}`)}}function DX(e,t,n,r){let i=uq[n];return e.round(Z.default.BigInt(i*t),r)}function OX(e,t){let n=uq[t];return e.fdiv(Z.default.BigInt(n))}function kX(e,t){return e.year===t.year?e.month===t.month?e.day===t.day?0:RX(e.day-t.day):RX(e.month-t.month):RX(e.year-t.year)}function AX(e,t){return e.hour===t.hour?e.minute===t.minute?e.second===t.second?e.millisecond===t.millisecond?e.microsecond===t.microsecond?e.nanosecond===t.nanosecond?0:RX(e.nanosecond-t.nanosecond):RX(e.microsecond-t.microsecond):RX(e.millisecond-t.millisecond):RX(e.second-t.second):RX(e.minute-t.minute):RX(e.hour-t.hour)}function jX(e,t){let n=kX(e.isoDate,t.isoDate);return n===0?AX(e.time,t.time):n}function MX(e){let t=FX(e);return globalThis.BigInt===void 0?t:globalThis.BigInt(t.toString(10))}function NX(e,t){let{quotient:n,remainder:r}=LG(NG(e),kG),i=Z.default.toNumber(n);return t===`floor`&&Z.default.toNumber(r)<0&&--i,t===`ceil`&&Z.default.toNumber(r)>0&&(i+=1),i}function PX(e){if(!Number.isInteger(e))throw RangeError(`epoch milliseconds must be an integer`);return Z.default.multiply(Z.default.BigInt(e),kG)}function FX(e){let t=e;if(typeof e==`object`){let n=e[Symbol.toPrimitive];n&&typeof n==`function`&&(t=n.call(e,`number`))}if(typeof t==`number`)throw TypeError(`cannot convert number to bigint`);return typeof t==`bigint`?Z.default.BigInt(t.toString(10)):Z.default.BigInt(t)}var IX=(()=>{let e=Z.default.BigInt(Date.now()%1e6);return()=>{let t=Date.now(),n=Z.default.BigInt(t),r=Z.default.add(PX(t),e);return e=Z.default.remainder(n,kG),Z.default.greaterThan(r,KK)?KK:Z.default.lessThan(r,qK)?qK:r}})();function LX(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function RX(e){return e<0?-1:e>0?1:e}function zX(e){if(e===void 0)return Object.create(null);if(ZK(e)&&e!==null)return e;throw TypeError(`Options parameter must be an object, not `+(e===null?`null`:typeof e))}function BX(e,t){let n=Object.create(null);return n[e]=t,n}function VX(e,t,n,r){let i=e[t];if(i!==void 0){if(i=$K(i),!n.includes(i))throw RangeError(`${t} must be one of ${n.join(`, `)}, not ${i}`);return i}if(r===qq)throw RangeError(`${t} option is required`);return r}function HX(e){let t=UX(e);if(!Gve.includes(UX(t)))throw RangeError(`invalid calendar identifier ${t}`);switch(t){case`ethiopic-amete-alem`:return`ethioaa`;case`islamicc`:return`islamic-civil`}return t}function UX(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t+=r>=65&&r<=90?String.fromCharCode(r+32):String.fromCharCode(r)}return t}function WX(e){throw TypeError(`Do not use built-in arithmetic operators with Temporal objects. When comparing, use ${e===`PlainMonthDay`?`Temporal.PlainDate.compare(obj1.toPlainDate(year), obj2.toPlainDate(year))`:`Temporal.${e}.compare(obj1, obj2)`}, not obj1 > obj2. When coercing to strings, use \`\${obj}\` or String(obj), not '' + obj. When coercing to numbers, use properties or methods of the object, not \`+obj\`. When concatenating with strings, use \`\${str}\${obj}\` or str.concat(obj), not str + obj. In React, coerce to a string before rendering a Temporal object.`)}var Qve=RegExp(`^${zK.source}$`),$ve=RegExp(`^([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\\d{1,9}))?)?)?$`);function GX(e,t,n,r=e(t),i=e(n)){let a=t,o=n,s=r,c=i;for(;o-a>1;){let t=Math.trunc((a+o)/2),n=e(t);n===s?(a=t,s=n):n===c&&(o=t,c=n)}return o}function KX(e){return[...e]}function qX(e,t){if(e!==`gregory`&&e!==`iso8601`)return;let n=YX[e],r=t.year,{dayOfWeek:i,dayOfYear:a,daysInYear:o}=n.isoToDate(t,{dayOfWeek:!0,dayOfYear:!0,daysInYear:!0}),s=n.getFirstDayOfWeek(),c=n.getMinimalDaysInFirstWeek(),l=(i+7-s)%7,u=(i-a+7001-s)%7,d=Math.floor((a-1+u)/7);if(7-u>=c&&++d,d==0)d=function(e,t,n,r){let i=(r-e-n+1)%7;i<0&&(i+=7);let a=Math.floor((n+i-1)/7);return 7-i>=t&&++a,a}(s,c,a+n.isoToDate(n.dateAdd(t,{years:-1},`constrain`),{daysInYear:!0}).daysInYear,i),r--;else if(a>=o-5){let e=(l+o-a)%7;e<0&&(e+=7),6-e>=c&&a+7-l>o&&(d=1,r++)}return{week:d,year:r}}function JX(e,t,n,r,i){if(t!==i.year){if(e*(t-i.year)>0)return!0}else if(n!==i.month){if(e*(n-i.month)>0)return!0}else if(r!==i.day&&e*(r-i.day)>0)return!0;return!1}var YX={};function XX(e){if(!e.startsWith(`M`))throw RangeError(`Invalid month code: ${e}. Month codes must start with M.`);let t=+e.slice(1);if(Number.isNaN(t))throw RangeError(`Invalid month code: ${e}`);return t}function ZX(e,t=!1){return`M${`${e}`.padStart(2,`0`)}${t?`L`:``}`}function QX(e,t=void 0,n=12){let{month:r,monthCode:i}=e;if(i===void 0){if(r===void 0)throw TypeError(`Either month or monthCode are required`);t===`reject`&&PY(r,1,n),t===`constrain`&&(r=MY(r,1,n)),i=ZX(r)}else{let e=XX(i);if(i!==ZX(e))throw RangeError(`Invalid month code: ${i}`);if(r!==void 0&&r!==e)throw RangeError(`monthCode ${i} and month ${r} must match if both are present`);if(r=e,r<1||r>n)throw RangeError(`Invalid monthCode: ${i}`)}return{...e,month:r,monthCode:i}}YX.iso8601={resolveFields(e,t){if((t===`date`||t===`year-month`)&&e.year===void 0)throw TypeError(`year is required`);if((t===`date`||t===`month-day`)&&e.day===void 0)throw TypeError(`day is required`);Object.assign(e,QX(e))},dateToISO:(e,t)=>Nq(e.year,e.month,e.day,t),monthDayToISOReferenceDate(e,t){let{month:n,day:r}=Nq(e.year??1972,e.month,e.day,t);return{month:n,day:r,year:1972}},extraFields:()=>[],fieldKeysToIgnore(e){let t=new Set;for(let n=0;n<e.length;n++){let r=e[n];t.add(r),r===`month`?t.add(`monthCode`):r===`monthCode`&&t.add(`month`)}return KX(t)},dateAdd(e,{years:t=0,months:n=0,weeks:r=0,days:i=0},a){let{year:o,month:s,day:c}=e;return o+=t,s+=n,{year:o,month:s}=EY(o,s),{year:o,month:s,day:c}=Nq(o,s,c,a),c+=i+7*r,DY(o,s,c)},dateUntil(e,t,n){let r=-kX(e,t);if(r===0)return{years:0,months:0,weeks:0,days:0};let i,a=0,o=0;if(n===`year`||n===`month`){let s=t.year-e.year;for(s!==0&&(s-=r);!JX(r,e.year+s,e.month,e.day,t);)a=s,s+=r;let c=r;for(i=EY(e.year+a,e.month+c);!JX(r,i.year,i.month,e.day,t);)o=c,c+=r,i=EY(i.year,i.month+r);n===`month`&&(o+=12*a,a=0)}i=EY(e.year+a,e.month+o);let s=NY(i.year,i.month,e.day),c=0,l=YY(t.year,t.month-1,t.day)-YY(s.year,s.month-1,s.day);return n===`week`&&(c=Math.trunc(l/7),l%=7),{years:a,months:o,weeks:c,days:l}},isoToDate({year:e,month:t,day:n},r){let i={era:void 0,eraYear:void 0,year:e,month:t,day:n,daysInWeek:7,monthsInYear:12};if(r.monthCode&&(i.monthCode=ZX(t)),r.dayOfWeek){let r=t+(t<3?10:-2),a=e-+(t<3),o=Math.floor(a/100),s=a-100*o,c=(n+Math.floor(2.6*r-.2)+(s+Math.floor(s/4))+(Math.floor(o/4)-2*o))%7;i.dayOfWeek=c+(c<=0?7:0)}if(r.dayOfYear){let r=n;for(let n=t-1;n>0;n--)r+=SY(e,n);i.dayOfYear=r}return r.weekOfYear&&(i.weekOfYear=qX(`iso8601`,{year:e,month:t,day:n})),r.daysInMonth&&(i.daysInMonth=SY(e,t)),(r.daysInYear||r.inLeapYear)&&(i.inLeapYear=xY(e),i.daysInYear=i.inLeapYear?366:365),i},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};var $X=class e{constructor(t){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,t!==void 0){let n=0;for(let r of t.map.entries()){if(++n>e.MAX_CACHE_ENTRIES)break;this.map.set(...r)}}}get(e){let t=this.map.get(e);return t&&(this.hits++,this.report()),this.calls++,t}set(e,t){this.map.set(e,t),this.misses++,this.report()}report(){}setObject(t){if(e.objectMap.get(t))throw RangeError(`object already cached`);e.objectMap.set(t,this),this.report()}static getCacheForObject(t){let n=e.objectMap.get(t);return n||(n=new e,e.objectMap.set(t,n)),n}};function eZ({isoYear:e,isoMonth:t,isoDay:n}){return`${YJ(e)}-${XJ(t)}-${XJ(n)}T00:00Z`}function tZ(e,t){return{years:e.year-t.year,months:e.month-t.month,days:e.day-t.day}}$X.objectMap=new WeakMap,$X.MAX_CACHE_ENTRIES=1e3;var nZ=class{constructor(){this.eras=[],this.hasEra=!1,this.erasBeginMidYear=!1}getFormatter(){return this.formatter===void 0&&(this.formatter=new Intl.DateTimeFormat(`en-US-u-ca-${this.id}`,{day:`numeric`,month:`numeric`,year:`numeric`,era:`short`,timeZone:`UTC`})),this.formatter}getCalendarParts(e){let t=this.getFormatter(),n=new Date(e);if(e===`-271821-04-19T00:00Z`){let e=t.resolvedOptions();t=new Intl.DateTimeFormat(e.locale,{...e,timeZone:`Etc/GMT+1`}),n=new Date(`-271821-04-20T00:00Z`)}try{return t.formatToParts(n)}catch{throw RangeError(`Invalid ISO date: ${e}`)}}isoToCalendarDate(e,t){let{year:n,month:r,day:i}=e,a=JSON.stringify({func:`isoToCalendarDate`,isoYear:n,isoMonth:r,isoDay:i,id:this.id}),o=t.get(a);if(o)return o;let s=eZ({isoYear:n,isoMonth:r,isoDay:i}),c=this.getCalendarParts(s),l={};for(let e=0;e<c.length;e++){let{type:t,value:n}=c[e];if(t!==`year`&&t!==`relatedYear`||(this.hasEra?l.eraYear=+n:l.year=+n),t===`month`){let e=/^([0-9]*)(.*?)$/.exec(n);if(!e||e.length!=3||!e[1]&&!e[2])throw RangeError(`Unexpected month: ${n}`);if(l.month=e[1]?+e[1]:1,l.month<1)throw RangeError(`Invalid month ${n} from ${s}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(l.month>13)throw RangeError(`Invalid month ${n} from ${s}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);e[2]&&(l.monthExtra=e[2])}t===`day`&&(l.day=+n),this.hasEra&&t===`era`&&n!=null&&n!==``&&(l.era=n.split(` (`)[0].normalize(`NFD`).replace(/[^-0-9 \p{L}]/gu,``).replace(/ /g,`-`).toLowerCase())}if(this.hasEra&&l.eraYear===void 0)throw RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.hasEra){let e=this.eras.find((e=>l.era===e.genericName));e&&(l.era=e.code)}if(this.reviseIntlEra){let{era:t,eraYear:n}=this.reviseIntlEra(l,e);l.era=t,l.eraYear=n}this.checkIcuBugs&&this.checkIcuBugs(e);let u=this.adjustCalendarDate(l,t,`constrain`,!0);if(u.year===void 0)throw RangeError(`Missing year converting ${JSON.stringify(e)}`);if(u.month===void 0)throw RangeError(`Missing month converting ${JSON.stringify(e)}`);if(u.day===void 0)throw RangeError(`Missing day converting ${JSON.stringify(e)}`);return t.set(a,u),[`constrain`,`reject`].forEach((n=>{let r=JSON.stringify({func:`calendarToIsoDate`,year:u.year,month:u.month,day:u.day,overflow:n,id:this.id});t.set(r,e)})),u}validateCalendarDate(e){let{month:t,year:n,day:r,eraYear:i,monthCode:a,monthExtra:o}=e;if(o!==void 0)throw RangeError("Unexpected `monthExtra` value");if(n===void 0&&i===void 0)throw TypeError(`year or eraYear is required`);if(t===void 0&&a===void 0)throw TypeError(`month or monthCode is required`);if(r===void 0)throw RangeError(`Missing day`);if(a!==void 0){if(typeof a!=`string`)throw RangeError(`monthCode must be a string, not `+typeof a);if(!/^M([01]?\d)(L?)$/.test(a))throw RangeError(`Invalid monthCode: ${a}`)}if(this.hasEra&&e.era===void 0!=(e.eraYear===void 0))throw TypeError(`properties era and eraYear must be provided together`)}adjustCalendarDate(e,t=void 0,n=`constrain`,r=!1){if(this.calendarType===`lunisolar`)throw RangeError(`Override required for lunisolar calendars`);let i=e;this.validateCalendarDate(i);let a=this.monthsInYear(i,t),{month:o,monthCode:s}=i;return{month:o,monthCode:s}=QX(i,n,a),{...i,month:o,monthCode:s}}regulateMonthDayNaive(e,t,n){let r=this.monthsInYear(e,n),{month:i,day:a}=e;return t===`reject`?(PY(i,1,r),PY(a,1,this.maximumMonthLength(e))):(i=MY(i,1,r),a=MY(a,1,this.maximumMonthLength({...e,month:i}))),{...e,month:i,day:a}}calendarToIsoDate(e,t=`constrain`,n){let r=e,i=this.adjustCalendarDate(e,n,t,!1);i=this.regulateMonthDayNaive(i,t,n);let{year:a,month:o,day:s}=i,c=JSON.stringify({func:`calendarToIsoDate`,year:a,month:o,day:s,overflow:t,id:this.id}),l,u=n.get(c);if(u||r.year!==void 0&&r.month!==void 0&&r.day!==void 0&&(r.year!==i.year||r.month!==i.month||r.day!==i.day)&&(l=JSON.stringify({func:`calendarToIsoDate`,year:r.year,month:r.month,day:r.day,overflow:t,id:this.id}),u=n.get(l),u))return u;let d=this.estimateIsoDate({year:a,month:o,day:s}),f=e=>{let r=this.addDaysIso(d,e);if(i.day>this.minimumMonthLength(i)){let e=this.isoToCalendarDate(r,n);for(;e.month!==o||e.year!==a;){if(t===`reject`)throw RangeError(`day ${s} does not exist in month ${o} of year ${a}`);r=this.addDaysIso(r,-1),e=this.isoToCalendarDate(r,n)}}return r},p=0,m=this.isoToCalendarDate(d,n),h=tZ(i,m);if(h.years!==0||h.months!==0||h.days!==0){let e=365*h.years+30*h.months+h.days;d=this.addDaysIso(d,e),m=this.isoToCalendarDate(d,n),h=tZ(i,m),h.years===0&&h.months===0?d=f(h.days):p=this.compareCalendarDates(i,m)}let g=8;for(;p;){d=this.addDaysIso(d,p*g);let e=m;m=this.isoToCalendarDate(d,n);let a=p;if(p=this.compareCalendarDates(i,m),p){if(h=tZ(i,m),h.years===0&&h.months===0)d=f(h.days),p=0;else if(a&&p!==a){if(g>1)g/=2;else{if(t===`reject`)throw RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...r})}`);this.compareCalendarDates(m,e)>0&&(d=this.addDaysIso(d,-1)),p=0}}}}if(n.set(c,d),l&&n.set(l,d),i.year===void 0||i.month===void 0||i.day===void 0||i.monthCode===void 0||this.hasEra&&(i.era===void 0||i.eraYear===void 0))throw RangeError(`Unexpected missing property`);return d}compareCalendarDates(e,t){return e.year===t.year?e.month===t.month?e.day===t.day?0:RX(e.day-t.day):RX(e.month-t.month):RX(e.year-t.year)}regulateDate(e,t=`constrain`,n){let r=this.calendarToIsoDate(e,t,n);return this.isoToCalendarDate(r,n)}addDaysIso(e,t){return DY(e.year,e.month,e.day+t)}addDaysCalendar(e,t,n){let r=this.calendarToIsoDate(e,`constrain`,n),i=this.addDaysIso(r,t);return this.isoToCalendarDate(i,n)}addMonthsCalendar(e,t,n,r){let i=e,{day:a}=i;for(let e=0,n=Math.abs(t);e<n;e++){let{month:e}=i,n=i,o=t<0?-Math.max(a,this.daysInPreviousMonth(i,r)):this.daysInMonth(i,r),s=this.calendarToIsoDate(i,`constrain`,r),c=this.addDaysIso(s,o);if(i=this.isoToCalendarDate(c,r),t>0){let t=this.monthsInYear(n,r);for(;i.month-1!=e%t;)c=this.addDaysIso(c,-1),i=this.isoToCalendarDate(c,r)}i.day!==a&&(i=this.regulateDate({...i,day:a},`constrain`,r))}if(n===`reject`&&i.day!==a)throw RangeError(`Day ${a} does not exist in resulting calendar month`);return i}addCalendar(e,{years:t=0,months:n=0,weeks:r=0,days:i=0},a,o){let{year:s,day:c,monthCode:l}=e,u=this.adjustCalendarDate({year:s+t,monthCode:l,day:c},o),d=this.addMonthsCalendar(u,n,a,o),f=i+7*r;return this.addDaysCalendar(d,f,o)}untilCalendar(e,t,n,r){let i=0,a=0,o=0,s=0;switch(n){case`day`:i=this.calendarDaysUntil(e,t,r);break;case`week`:{let n=this.calendarDaysUntil(e,t,r);i=n%7,a=(n-i)/7;break}case`month`:case`year`:{let a=this.compareCalendarDates(t,e);if(!a)return{years:0,months:0,weeks:0,days:0};let c=t.year-e.year,l=t.day-e.day;if(n===`year`&&c){let n=0;t.monthCode>e.monthCode&&(n=1),t.monthCode<e.monthCode&&(n=-1),n||=Math.sign(l),s=n*a<0?c-a:c}let u,d=s?this.addCalendar(e,{years:s},`constrain`,r):e;do o+=a,u=d,d=this.addMonthsCalendar(u,a,`constrain`,r),d.day!==e.day&&(d=this.regulateDate({...d,day:e.day},`constrain`,r));while(this.compareCalendarDates(t,d)*a>=0);o-=a,i=this.calendarDaysUntil(u,t,r);break}}return{years:s,months:o,weeks:a,days:i}}daysInMonth(e,t){let{day:n}=e,r=this.maximumMonthLength(e),i=this.minimumMonthLength(e);if(i===r)return i;let a=n<=r-i?r:i,o=this.calendarToIsoDate(e,`constrain`,t),s=this.addDaysIso(o,a),c=this.isoToCalendarDate(s,t),l=this.addDaysIso(s,-c.day);return this.isoToCalendarDate(l,t).day}daysInPreviousMonth(e,t){let{day:n,month:r,year:i}=e,a={year:r>1?i:i-1,month:r,day:1},o=r>1?r-1:this.monthsInYear(a,t);a={...a,month:o};let s=this.minimumMonthLength(a),c=this.maximumMonthLength(a);if(s===c)return c;let l=this.calendarToIsoDate(e,`constrain`,t),u=this.addDaysIso(l,-n);return this.isoToCalendarDate(u,t).day}startOfCalendarYear(e){return{year:e.year,month:1,monthCode:`M01`,day:1}}startOfCalendarMonth(e){return{year:e.year,month:e.month,day:1}}calendarDaysUntil(e,t,n){let r=this.calendarToIsoDate(e,`constrain`,n),i=this.calendarToIsoDate(t,`constrain`,n);return YY(i.year,i.month-1,i.day)-YY(r.year,r.month-1,r.day)}monthDaySearchStartYear(e,t){return 1972}monthDayFromFields(e,t,n){let r,i,a,o,s,{era:c,eraYear:l,year:u,month:d,monthCode:f,day:p}=e;if(d!==void 0&&u===void 0&&(!this.hasEra||c===void 0||l===void 0))throw TypeError(`when month is present, year (or era and eraYear) are required`);(f===void 0||u!==void 0||this.hasEra&&l!==void 0)&&({monthCode:f,day:p}=this.isoToCalendarDate(this.calendarToIsoDate(e,t,n),n));let m={year:this.monthDaySearchStartYear(f,p),month:12,day:31},h=this.isoToCalendarDate(m,n),g=h.monthCode>f||h.monthCode===f&&h.day>=p?h.year:h.year-1;for(let e=0;e<20;e++){let c=this.adjustCalendarDate({day:p,monthCode:f,year:g-e},n),l=this.calendarToIsoDate(c,`constrain`,n),u=this.isoToCalendarDate(l,n);if({year:r,month:i,day:a}=l,u.monthCode===f&&u.day===p)return{month:i,day:a,year:r};if(t===`constrain`){let e=this.maxLengthOfMonthCodeInAnyYear(u.monthCode);if(u.monthCode===f&&u.day===e&&p>e)return{month:i,day:a,year:r};(o===void 0||u.monthCode===o.monthCode&&u.day>o.day)&&(o=u,s=l)}}if(t===`constrain`&&s!==void 0)return s;throw RangeError(`No recent ${this.id} year with monthCode ${f} and day ${p}`)}getFirstDayOfWeek(){}getMinimalDaysInFirstWeek(){}},eye=class extends nZ{constructor(){super(...arguments),this.id=`hebrew`,this.calendarType=`lunisolar`,this.months={Tishri:{leap:1,regular:1,monthCode:`M01`,days:30},Heshvan:{leap:2,regular:2,monthCode:`M02`,days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:`M03`,days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:`M04`,days:29},Shevat:{leap:5,regular:5,monthCode:`M05`,days:30},Adar:{leap:void 0,regular:6,monthCode:`M06`,days:29},"Adar I":{leap:6,regular:void 0,monthCode:`M05L`,days:30},"Adar II":{leap:7,regular:void 0,monthCode:`M06`,days:29},Nisan:{leap:8,regular:7,monthCode:`M07`,days:30},Iyar:{leap:9,regular:8,monthCode:`M08`,days:29},Sivan:{leap:10,regular:9,monthCode:`M09`,days:30},Tamuz:{leap:11,regular:10,monthCode:`M10`,days:29},Av:{leap:12,regular:11,monthCode:`M11`,days:30},Elul:{leap:13,regular:12,monthCode:`M12`,days:29}}}inLeapYear(e){let{year:t}=e;return(7*t+1)%19<7}monthsInYear(e){return this.inLeapYear(e)?13:12}minimumMonthLength(e){return this.minMaxMonthLength(e,`min`)}maximumMonthLength(e){return this.minMaxMonthLength(e,`max`)}minMaxMonthLength(e,t){let{month:n,year:r}=e,i=this.getMonthCode(r,n),a=Object.entries(this.months).find((e=>e[1].monthCode===i));if(a===void 0)throw RangeError(`unmatched Hebrew month: ${n}`);let o=a[1].days;return typeof o==`number`?o:o[t]}maxLengthOfMonthCodeInAnyYear(e){return[`M04`,`M06`,`M08`,`M10`,`M12`].includes(e)?29:30}estimateIsoDate(e){let{year:t}=e;return{year:t-3760,month:1,day:1}}getMonthCode(e,t){return this.inLeapYear({year:e})?t===6?ZX(5,!0):ZX(t<6?t:t-1):ZX(t)}adjustCalendarDate(e,t,n=`constrain`,r=!1){let{year:i,month:a,monthCode:o,day:s,monthExtra:c}=e;if(i===void 0)throw TypeError(`Missing property: year`);if(r){if(c){let e=this.months[c];if(!e)throw RangeError(`Unrecognized month from formatToParts: ${c}`);a=this.inLeapYear({year:i})?e.leap:e.regular}return o=this.getMonthCode(i,a),{year:i,month:a,day:s,monthCode:o}}if(this.validateCalendarDate(e),a===void 0){if(o.endsWith(`L`)){if(o!==`M05L`)throw RangeError(`Hebrew leap month must have monthCode M05L, not ${o}`);if(a=6,!this.inLeapYear({year:i})){if(n===`reject`)throw RangeError(`Hebrew monthCode M05L is invalid in year ${i} which is not a leap year`);a=6,o=`M06`}}else{a=XX(o),this.inLeapYear({year:i})&&a>=6&&a++;let e=this.monthsInYear({year:i});if(a<1||a>e)throw RangeError(`Invalid monthCode: ${o}`)}}else if(n===`reject`?(PY(a,1,this.monthsInYear({year:i})),PY(s,1,this.maximumMonthLength({year:i,month:a}))):(a=MY(a,1,this.monthsInYear({year:i})),s=MY(s,1,this.maximumMonthLength({year:i,month:a}))),o===void 0)o=this.getMonthCode(i,a);else if(this.getMonthCode(i,a)!==o)throw RangeError(`monthCode ${o} doesn't correspond to month ${a} in Hebrew year ${i}`);return{...e,day:s,month:a,monthCode:o,year:i}}},rZ=class extends nZ{constructor(){super(...arguments),this.calendarType=`lunar`,this.DAYS_PER_ISLAMIC_YEAR=354+11/30,this.DAYS_PER_ISO_YEAR=365.2425}inLeapYear(e,t){let n={year:e.year,month:1,monthCode:`M01`,day:1},r={year:e.year+1,month:1,monthCode:`M01`,day:1};return this.calendarDaysUntil(n,r,t)===355}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(){return 30}estimateIsoDate(e){let{year:t}=this.adjustCalendarDate(e);return{year:Math.floor(t*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}},tye=class extends rZ{constructor(){super(...arguments),this.id=`islamic`}},nye=class extends rZ{constructor(){super(...arguments),this.id=`islamic-umalqura`}},rye=class extends rZ{constructor(){super(...arguments),this.id=`islamic-tbla`}},iye=class extends rZ{constructor(){super(...arguments),this.id=`islamic-civil`}},aye=class extends rZ{constructor(){super(...arguments),this.id=`islamic-rgsa`}},oye=class extends rZ{constructor(){super(...arguments),this.id=`islamicc`}},sye=class extends nZ{constructor(){super(...arguments),this.id=`persian`,this.calendarType=`solar`}inLeapYear(e,t){return this.daysInMonth({year:e.year,month:12,day:1},t)===30}monthsInYear(){return 12}minimumMonthLength(e){let{month:t}=e;return t===12?29:t<=6?31:30}maximumMonthLength(e){let{month:t}=e;return t===12?30:t<=6?31:30}maxLengthOfMonthCodeInAnyYear(e){return XX(e)<=6?31:30}estimateIsoDate(e){let{year:t}=this.adjustCalendarDate(e);return{year:t+621,month:1,day:1}}},cye=class extends nZ{constructor(){super(...arguments),this.id=`indian`,this.calendarType=`solar`,this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug=new Date(`0000-01-01T00:00Z`).toLocaleDateString(`en-US-u-ca-indian`,{timeZone:`UTC`})!==`10/11/-79 Saka`}inLeapYear(e){return iZ(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}maxLengthOfMonthCodeInAnyYear(e){let t=XX(e),n=this.months[t];return n=n.leap??n,n.length}getMonthInfo(e){let{month:t}=e,n=this.months[t];if(n===void 0)throw RangeError(`Invalid month: ${t}`);return this.inLeapYear(e)&&n.leap&&(n=n.leap),n}estimateIsoDate(e){let t=this.adjustCalendarDate(e),n=this.getMonthInfo(t);return DY(t.year+78+ +!!n.nextYear,n.month,n.day+t.day-1)}checkIcuBugs(e){if(this.vulnerableToBceBug&&e.year<1)throw RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}};function iZ(e){return e%4==0&&(e%100!=0||e%400==0)}var aZ=class extends nZ{constructor(e,t){super(),this.calendarType=`solar`,this.id=e,this.isoEpoch=t}inLeapYear(e){let{year:t}=this.estimateIsoDate({month:1,day:1,year:e.year});return iZ(t)}monthsInYear(){return 12}minimumMonthLength(e){let{month:t}=e;return t===2?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(t)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}maxLengthOfMonthCodeInAnyYear(e){return[31,29,31,30,31,30,31,31,30,31,30,31][XX(e)-1]}estimateIsoDate(e){let t=this.adjustCalendarDate(e);return Nq(t.year+this.isoEpoch.year,t.month+this.isoEpoch.month,t.day+this.isoEpoch.day,`constrain`)}},oZ=class extends nZ{constructor(e,t){super(),this.hasEra=!0,this.calendarType=`solar`,this.id=e;let{eras:n,anchorEra:r}=function(e){let t,n=e;if(n.length===0)throw RangeError(`Invalid era data: eras are required`);if(n.length===1&&n[0].reverseOf)throw RangeError(`Invalid era data: anchor era cannot count years backwards`);if(n.length===1&&!n[0].code)throw RangeError(`Invalid era data: at least one named era is required`);if(n.filter((e=>e.reverseOf!=null)).length>1)throw RangeError(`Invalid era data: only one era can count years backwards`);n.forEach((e=>{if(e.isAnchor||!e.anchorEpoch&&!e.reverseOf){if(t)throw RangeError(`Invalid era data: cannot have multiple anchor eras`);t=e,e.anchorEpoch={year:+!e.hasYearZero}}else if(!e.code)throw RangeError(`If era name is blank, it must be the anchor era`)})),n=n.filter((e=>e.code)),n.forEach((e=>{let{reverseOf:t}=e;if(t){let r=n.find((e=>e.code===t));if(r===void 0)throw RangeError(`Invalid era data: unmatched reverseOf era: ${t}`);e.reverseOf=r,e.anchorEpoch=r.anchorEpoch,e.isoEpoch=r.isoEpoch}e.anchorEpoch.month===void 0&&(e.anchorEpoch.month=1),e.anchorEpoch.day===void 0&&(e.anchorEpoch.day=1)})),n.sort(((e,t)=>{if(e.reverseOf)return 1;if(t.reverseOf)return-1;if(!e.isoEpoch||!t.isoEpoch)throw RangeError(`Invalid era data: missing ISO epoch`);return t.isoEpoch.year-e.isoEpoch.year}));let r=n[n.length-1].reverseOf;if(r&&r!==n[n.length-2])throw RangeError(`Invalid era data: invalid reverse-sign era`);return n.forEach(((e,t)=>{e.genericName=`era`+(n.length-1-t)})),{eras:n,anchorEra:t||n[0]}}(t);this.anchorEra=r,this.eras=n}inLeapYear(e){let{year:t}=this.estimateIsoDate({month:1,day:1,year:e.year});return iZ(t)}monthsInYear(){return 12}minimumMonthLength(e){let{month:t}=e;return t===2?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(t)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}maxLengthOfMonthCodeInAnyYear(e){return[31,29,31,30,31,30,31,31,30,31,30,31][XX(e)-1]}completeEraYear(e){let t=(t,n,r)=>{let i=e[t];if(i!=null&&i!=n&&!(r||[]).includes(i)){let e=r?.[0];throw RangeError(`Input ${t} ${i} doesn't match calculated value ${e?`${n} (also called ${e})`:n}`)}},n=t=>{let n,r={...e,year:t},i=this.eras.find(((e,i)=>{if(i===this.eras.length-1){if(e.reverseOf){if(t>0)throw RangeError(`Signed year ${t} is invalid for era ${e.code}`);return n=e.anchorEpoch.year-t,!0}return n=t-e.anchorEpoch.year+ +!e.hasYearZero,!0}return this.compareCalendarDates(r,e.anchorEpoch)>=0&&(n=t-e.anchorEpoch.year+ +!e.hasYearZero,!0)}));if(!i)throw RangeError(`Year ${t} was not matched by any era`);return{eraYear:n,era:i.code,eraNames:i.names}},{year:r,eraYear:i,era:a}=e;if(r!=null){let e=n(r);({eraYear:i,era:a}=e),t(`era`,a,e?.eraNames),t(`eraYear`,i)}else{if(i==null)throw RangeError(`Either year or eraYear and era are required`);{if(a===void 0)throw RangeError(`era and eraYear must be provided together`);let e=this.eras.find((({code:e,names:t=[]})=>e===a||t.includes(a)));if(!e)throw RangeError(`Era ${a} (ISO year ${i}) was not matched by any era`);r=e.reverseOf?e.anchorEpoch.year-i:i+e.anchorEpoch.year-+!e.hasYearZero,t(`year`,r),{eraYear:i,era:a}=n(r)}}return{...e,year:r,eraYear:i,era:a}}adjustCalendarDate(e,t,n=`constrain`){let r=e,{month:i,monthCode:a}=r;return i===void 0&&(r={...r,month:XX(a)}),this.validateCalendarDate(r),r=this.completeEraYear(r),super.adjustCalendarDate(r,t,n)}estimateIsoDate(e){let{year:t,month:n,day:r}=this.adjustCalendarDate(e),{anchorEra:i}=this;return Nq(t+i.isoEpoch.year-+!i.hasYearZero,n,r,`constrain`)}},sZ=class extends oZ{constructor(e,t){super(e,t)}isoToCalendarDate(e){let{year:t,month:n,day:r}=e,i=ZX(n),a=t-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:a,month:n,monthCode:i,day:r})}},cZ={inLeapYear(e){let{year:t}=e;return(t+1)%4==0},monthsInYear:()=>13,minimumMonthLength(e){let{month:t}=e;return t===13?this.inLeapYear(e)?6:5:30},maximumMonthLength(e){return this.minimumMonthLength(e)},maxLengthOfMonthCodeInAnyYear:e=>e===`M13`?6:30},lye=class extends aZ{constructor(e,t){super(e,t),this.inLeapYear=cZ.inLeapYear,this.monthsInYear=cZ.monthsInYear,this.minimumMonthLength=cZ.minimumMonthLength,this.maximumMonthLength=cZ.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=cZ.maxLengthOfMonthCodeInAnyYear}},lZ=class extends oZ{constructor(e,t){super(e,t),this.inLeapYear=cZ.inLeapYear,this.monthsInYear=cZ.monthsInYear,this.minimumMonthLength=cZ.minimumMonthLength,this.maximumMonthLength=cZ.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=cZ.maxLengthOfMonthCodeInAnyYear}},uye=class extends lye{constructor(){super(`ethioaa`,{year:-5492,month:7,day:17})}},dye=class extends lZ{constructor(){super(`coptic`,[{code:`coptic`,isoEpoch:{year:284,month:8,day:29}},{code:`coptic-inverse`,reverseOf:`coptic`}])}},fye=class extends lZ{constructor(){super(`ethiopic`,[{code:`ethioaa`,names:[`ethiopic-amete-alem`,`mundi`],isoEpoch:{year:-5492,month:7,day:17}},{code:`ethiopic`,names:[`incar`],isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}])}},pye=class extends sZ{constructor(){super(`roc`,[{code:`roc`,names:[`minguo`],isoEpoch:{year:1912,month:1,day:1}},{code:`roc-inverse`,names:[`before-roc`],reverseOf:`roc`}])}},mye=class extends aZ{constructor(){super(`buddhist`,{year:-543,month:1,day:1})}},hye=class extends sZ{constructor(){super(`gregory`,[{code:`gregory`,names:[`ad`,`ce`],isoEpoch:{year:1,month:1,day:1}},{code:`gregory-inverse`,names:[`be`,`bce`],reverseOf:`gregory`}])}reviseIntlEra(e){let{era:t,eraYear:n}=e;return t===`b`&&(t=`gregory-inverse`),t===`a`&&(t=`gregory`),{era:t,eraYear:n}}getFirstDayOfWeek(){return 1}getMinimalDaysInFirstWeek(){return 1}},gye=class extends sZ{constructor(){super(`japanese`,[{code:`reiwa`,isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{code:`heisei`,isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{code:`showa`,isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{code:`taisho`,isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{code:`meiji`,isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{code:`japanese`,names:[`japanese`,`gregory`,`ad`,`ce`],isoEpoch:{year:1,month:1,day:1}},{code:`japanese-inverse`,names:[`japanese-inverse`,`gregory-inverse`,`bc`,`bce`],reverseOf:`japanese`}]),this.erasBeginMidYear=!0}reviseIntlEra(e,t){let{era:n,eraYear:r}=e,{year:i}=t;return this.eras.find((e=>e.code===n))?{era:n,eraYear:r}:i<1?{era:`japanese-inverse`,eraYear:1-i}:{era:`japanese`,eraYear:i}}},uZ=class extends nZ{constructor(){super(...arguments),this.calendarType=`lunisolar`}inLeapYear(e,t){let n=this.getMonthList(e.year,t);return Object.entries(n).length===13}monthsInYear(e,t){return this.inLeapYear(e,t)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(e){return[`M01L`,`M09L`,`M10L`,`M11L`,`M12L`].includes(e)?29:30}monthDaySearchStartYear(e,t){let n={M01L:[1651,1651],M02L:[1947,1765],M03L:[1966,1955],M04L:[1963,1944],M05L:[1971,1952],M06L:[1960,1941],M07L:[1968,1938],M08L:[1957,1718],M09L:[1832,1832],M10L:[1870,1870],M11L:[1814,1814],M12L:[1890,1890]}[e]??[1972,1972];return t<30?n[0]:n[1]}getMonthList(e,t){if(e===void 0)throw TypeError(`Missing year`);let n=JSON.stringify({func:`getMonthList`,calendarYear:e,id:this.id}),r=t.get(n);if(r)return r;let i=this.getFormatter(),a=(e,t)=>{let n=eZ({isoYear:e,isoMonth:2,isoDay:1}),r=new Date(n);r.setUTCDate(t+1);let a=i.formatToParts(r),o=a.find((e=>e.type===`month`)).value,s=+a.find((e=>e.type===`day`)).value,c=a.find((e=>e.type===`relatedYear`)),l;if(c===void 0)throw RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return l=+c.value,{calendarMonthString:o,calendarDay:s,calendarYearToVerify:l}},o=17,{calendarMonthString:s,calendarDay:c,calendarYearToVerify:l}=a(e,o);s!==`1`&&(o+=29,{calendarMonthString:s,calendarDay:c}=a(e,o)),o-=c-5;let u={},d,f,p=1,m=!1;do({calendarMonthString:s,calendarDay:c,calendarYearToVerify:l}=a(e,o)),d&&(u[f].daysInMonth=d+30-c),l===e?(u[s]={monthIndex:p++},o+=30):m=!0,d=c,f=s;while(!m);return u[f].daysInMonth=d+30-c,t.set(n,u),u}estimateIsoDate(e){let{year:t,month:n}=e;return{year:t,month:n>=12?12:n+1,day:1}}adjustCalendarDate(e,t,n=`constrain`,r=!1){let{year:i,month:a,monthExtra:o,day:s,monthCode:c}=e;if(i===void 0)throw TypeError(`Missing property: year`);if(r){if(o&&o!==`bis`)throw RangeError(`Unexpected leap month suffix: ${o}`);let e=ZX(a,o!==void 0),n=`${a}${o||``}`,r=this.getMonthList(i,t)[n];if(r===void 0)throw RangeError(`Unmatched month ${n} in Chinese year ${i}`);return a=r.monthIndex,{year:i,month:a,day:s,monthCode:e}}if(this.validateCalendarDate(e),a===void 0){let e=this.getMonthList(i,t),r=c.replace(/^M|L$/g,(e=>e===`L`?`bis`:``));r[0]===`0`&&(r=r.slice(1));let o=e[r];if(a=o&&o.monthIndex,a===void 0&&c.endsWith(`L`)&&c!=`M13L`&&n===`constrain`){let t=+c.replace(/^M0?|L$/g,``);o=e[t],o&&(a=o.monthIndex,c=ZX(t))}if(a===void 0)throw RangeError(`Unmatched month ${c} in Chinese year ${i}`)}else if(c===void 0){let e=this.getMonthList(i,t),r=Object.entries(e),o=r.length;n===`reject`?(PY(a,1,o),PY(s,1,this.maximumMonthLength())):(a=MY(a,1,o),s=MY(s,1,this.maximumMonthLength()));let l=r.find((e=>e[1].monthIndex===a));if(l===void 0)throw RangeError(`Invalid month ${a} in Chinese year ${i}`);c=ZX(+l[0].replace(`bis`,``),l[0].indexOf(`bis`)!==-1)}else{let e=this.getMonthList(i,t),n=c.replace(/^M|L$/g,(e=>e===`L`?`bis`:``));n[0]===`0`&&(n=n.slice(1));let r=e[n];if(!r)throw RangeError(`Unmatched monthCode ${c} in Chinese year ${i}`);if(a!==r.monthIndex)throw RangeError(`monthCode ${c} doesn't correspond to month ${a} in Chinese year ${i}`)}return{...e,year:i,month:a,monthCode:c,day:s}}},_ye=class extends uZ{constructor(){super(...arguments),this.id=`chinese`}},vye=class extends uZ{constructor(){super(...arguments),this.id=`dangi`}},yye=class{constructor(e){this.helper=e}extraFields(e){return this.helper.hasEra&&e.includes(`year`)?[`era`,`eraYear`]:[]}resolveFields(e){if(this.helper.calendarType!==`lunisolar`){let t=new $X;QX(e,void 0,this.helper.monthsInYear({year:e.year??1972},t))}}dateToISO(e,t){let n=new $X,r=this.helper.calendarToIsoDate(e,t,n);return n.setObject(r),r}monthDayToISOReferenceDate(e,t){let n=new $X,r=this.helper.monthDayFromFields(e,t,n);return n.setObject(r),r}fieldKeysToIgnore(e){let t=new Set;for(let n=0;n<e.length;n++){let r=e[n];switch(t.add(r),r){case`era`:t.add(`eraYear`),t.add(`year`);break;case`eraYear`:t.add(`era`),t.add(`year`);break;case`year`:t.add(`era`),t.add(`eraYear`);break;case`month`:t.add(`monthCode`),this.helper.erasBeginMidYear&&(t.add(`era`),t.add(`eraYear`));break;case`monthCode`:t.add(`month`),this.helper.erasBeginMidYear&&(t.add(`era`),t.add(`eraYear`));break;case`day`:this.helper.erasBeginMidYear&&(t.add(`era`),t.add(`eraYear`))}}return KX(t)}dateAdd(e,{years:t,months:n,weeks:r,days:i},a){let o=$X.getCacheForObject(e),s=this.helper.isoToCalendarDate(e,o),c=this.helper.addCalendar(s,{years:t,months:n,weeks:r,days:i},a,o),l=this.helper.calendarToIsoDate(c,`constrain`,o);return $X.getCacheForObject(l)||new $X(o).setObject(l),l}dateUntil(e,t,n){let r=$X.getCacheForObject(e),i=$X.getCacheForObject(t),a=this.helper.isoToCalendarDate(e,r),o=this.helper.isoToCalendarDate(t,i);return this.helper.untilCalendar(a,o,n,r)}isoToDate(e,t){let n=$X.getCacheForObject(e),r=this.helper.isoToCalendarDate(e,n);if(t.dayOfWeek&&(r.dayOfWeek=YX.iso8601.isoToDate(e,{dayOfWeek:!0}).dayOfWeek),t.dayOfYear){let e=this.helper.startOfCalendarYear(r);r.dayOfYear=this.helper.calendarDaysUntil(e,r,n)+1}if(t.weekOfYear&&(r.weekOfYear=qX(this.helper.id,e)),r.daysInWeek=7,t.daysInMonth&&(r.daysInMonth=this.helper.daysInMonth(r,n)),t.daysInYear){let e=this.helper.startOfCalendarYear(r),t=this.helper.addCalendar(e,{years:1},`constrain`,n);r.daysInYear=this.helper.calendarDaysUntil(e,t,n)}return t.monthsInYear&&(r.monthsInYear=this.helper.monthsInYear(r,n)),t.inLeapYear&&(r.inLeapYear=this.helper.inLeapYear(r,n)),r}getFirstDayOfWeek(){return this.helper.getFirstDayOfWeek()}getMinimalDaysInFirstWeek(){return this.helper.getMinimalDaysInFirstWeek()}};for(let e of[eye,sye,fye,uye,dye,_ye,vye,pye,cye,mye,hye,gye,tye,nye,rye,iye,aye,oye]){let t=new e;YX[t.id]=new yye(t)}EK(`calendarImpl`,(function(e){return YX[e]}));var dZ=Intl.DateTimeFormat;function fZ(e,t){let n=Q(e,t);return typeof n==`function`&&(n=new dZ(Q(e,hK),n(Q(e,gK))),function(e,t,n){let r=yK(e);if(r===void 0)throw TypeError(`Missing slots for the given container`);if(r[t]===void 0)throw TypeError(`tried to reset ${t} which was not set`);r[t]=n}(e,t,n)),n}function pZ(e){return SK(e,dK)}var mZ=class{constructor(e=void 0,t=void 0){(function(e,t,n){let r=n!==void 0,i;if(r){let e=[`localeMatcher`,`calendar`,`numberingSystem`,`hour12`,`hourCycle`,`timeZone`,`weekday`,`era`,`year`,`month`,`day`,`dayPeriod`,`hour`,`minute`,`second`,`fractionalSecondDigits`,`timeZoneName`,`formatMatcher`,`dateStyle`,`timeStyle`];i=function(e){if(e==null)throw TypeError(`Expected object not ${e}`);return Object(e)}(n);let t=Object.create(null);for(let n=0;n<e.length;n++){let r=e[n];Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}i=t}else i=Object.create(null);let a=new dZ(t,i),o=a.resolvedOptions();if(xK(e),r){let t=Object.assign(Object.create(null),o);for(let e in t)Object.prototype.hasOwnProperty.call(i,e)||delete t[e];t.hour12=i.hour12,t.hourCycle=i.hourCycle,CK(e,gK,t)}else CK(e,gK,i);CK(e,hK,o.locale),CK(e,dK,a),CK(e,fK,o.timeZone),CK(e,mK,o.calendar),CK(e,aK,Oye),CK(e,oK,Eye),CK(e,sK,Dye),CK(e,cK,Tye),CK(e,lK,kye),CK(e,uK,Aye);let s=r?i.timeZone:void 0;if(s===void 0)CK(e,pK,o.timeZone);else{let t=$K(s);if(t.startsWith(`−`))throw RangeError(`Unicode minus (U+2212) is not supported in time zone offsets`);CK(e,pK,BJ(t))}})(this,e,t)}get format(){$(this,pZ);let e=xye.bind(this);return Object.defineProperties(e,{length:{value:1,enumerable:!1,writable:!1,configurable:!0},name:{value:``,enumerable:!1,writable:!1,configurable:!0}}),e}formatRange(e,t){return $(this,pZ),Cye.call(this,e,t)}formatToParts(e,...t){return $(this,pZ),Sye.call(this,e,...t)}formatRangeToParts(e,t){return $(this,pZ),wye.call(this,e,t)}resolvedOptions(){return $(this,pZ),bye.call(this)}};`formatToParts`in dZ.prototype||delete mZ.prototype.formatToParts,`formatRangeToParts`in dZ.prototype||delete mZ.prototype.formatRangeToParts;var hZ=function(e=void 0,t=void 0){return new mZ(e,t)};function bye(){let e=Q(this,dK).resolvedOptions();return e.timeZone=Q(this,pK),e}function xye(e,...t){let n,r,i=CZ(e,this);return i.formatter?(n=i.formatter,r=[NX(i.epochNs,`floor`)]):(n=Q(this,dK),r=[e,...t]),n.format(...r)}function Sye(e,...t){let n,r,i=CZ(e,this);return i.formatter?(n=i.formatter,r=[NX(i.epochNs,`floor`)]):(n=Q(this,dK),r=[e,...t]),n.formatToParts(...r)}function Cye(e,t){if(e===void 0||t===void 0)throw TypeError(`Intl.DateTimeFormat.formatRange requires two values`);let n=xZ(e),r=xZ(t),i,a=[n,r];if(bZ(n)!==bZ(r))throw TypeError(`Intl.DateTimeFormat.formatRange accepts two values of the same type`);if(bZ(n)){if(!SZ(n,r))throw TypeError(`Intl.DateTimeFormat.formatRange accepts two values of the same type`);let{epochNs:e,formatter:t}=CZ(n,this),{epochNs:o,formatter:s}=CZ(r,this);t&&(i=t,a=[NX(e,`floor`),NX(o,`floor`)])}return i||=Q(this,dK),i.formatRange(...a)}function wye(e,t){if(e===void 0||t===void 0)throw TypeError(`Intl.DateTimeFormat.formatRange requires two values`);let n=xZ(e),r=xZ(t),i,a=[n,r];if(bZ(n)!==bZ(r))throw TypeError(`Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type`);if(bZ(n)){if(!SZ(n,r))throw TypeError(`Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type`);let{epochNs:e,formatter:t}=CZ(n,this),{epochNs:o,formatter:s}=CZ(r,this);t&&(i=t,a=[NX(e,`floor`),NX(o,`floor`)])}return i||=Q(this,dK),i.formatRangeToParts(...a)}function gZ(e={},t={}){let n=Object.assign({},e),r=[`year`,`month`,`day`,`hour`,`minute`,`second`,`weekday`,`dayPeriod`,`timeZoneName`,`dateStyle`,`timeStyle`];for(let e=0;e<r.length;e++){let i=r[e];n[i]=i in t?t[i]:n[i],!1!==n[i]&&n[i]!==void 0||delete n[i]}return n}function Tye(e){let t=gZ(e,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});if(t.timeStyle!==`long`&&t.timeStyle!==`full`||(delete t.timeStyle,Object.assign(t,{hour:`numeric`,minute:`2-digit`,second:`2-digit`})),!vZ(t)){if(yZ(e))throw TypeError(`cannot format Temporal.PlainTime with options [${Object.keys(e)}]`);Object.assign(t,{hour:`numeric`,minute:`numeric`,second:`numeric`})}return t}function Eye(e){let t={short:{year:`2-digit`,month:`numeric`},medium:{year:`numeric`,month:`short`},long:{year:`numeric`,month:`long`},full:{year:`numeric`,month:`long`}},n=gZ(e,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(`dateStyle`in n&&n.dateStyle){let e=n.dateStyle;delete n.dateStyle,Object.assign(n,t[e])}if(!(`year`in n||`month`in n||`era`in n)){if(yZ(e))throw TypeError(`cannot format PlainYearMonth with options [${Object.keys(e)}]`);Object.assign(n,{year:`numeric`,month:`numeric`})}return n}function Dye(e){let t={short:{month:`numeric`,day:`numeric`},medium:{month:`short`,day:`numeric`},long:{month:`long`,day:`numeric`},full:{month:`long`,day:`numeric`}},n=gZ(e,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(`dateStyle`in n&&n.dateStyle){let e=n.dateStyle;delete n.dateStyle,Object.assign(n,t[e])}if(!(`month`in n)&&!(`day`in n)){if(yZ(e))throw TypeError(`cannot format PlainMonthDay with options [${Object.keys(e)}]`);Object.assign(n,{month:`numeric`,day:`numeric`})}return n}function Oye(e){let t=gZ(e,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!_Z(t)){if(yZ(e))throw TypeError(`cannot format PlainDate with options [${Object.keys(e)}]`);Object.assign(t,{year:`numeric`,month:`numeric`,day:`numeric`})}return t}function kye(e){let t=gZ(e,{timeZoneName:!1});if((t.timeStyle===`long`||t.timeStyle===`full`)&&(delete t.timeStyle,Object.assign(t,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}),t.dateStyle)&&(Object.assign(t,{short:{year:`numeric`,month:`numeric`,day:`numeric`},medium:{year:`numeric`,month:`short`,day:`numeric`},long:{year:`numeric`,month:`long`,day:`numeric`},full:{year:`numeric`,month:`long`,day:`numeric`,weekday:`long`}}[t.dateStyle]),delete t.dateStyle),!vZ(t)&&!_Z(t)){if(yZ(e))throw TypeError(`cannot format PlainDateTime with options [${Object.keys(e)}]`);Object.assign(t,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`})}return t}function Aye(e){let t=e;return vZ(t)||_Z(t)||(t=Object.assign({},t,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`})),t}function _Z(e){return`year`in e||`month`in e||`day`in e||`weekday`in e||`dateStyle`in e||`era`in e}function vZ(e){return`hour`in e||`minute`in e||`second`in e||`timeStyle`in e||`dayPeriod`in e||`fractionalSecondDigits`in e}function yZ(e){return _Z(e)||vZ(e)||`dateStyle`in e||`timeStyle`in e||`timeZoneName`in e}function bZ(e){return gq(e)||_q(e)||vq(e)||xq(e)||yq(e)||bq(e)||mq(e)}function xZ(e){return bZ(e)?e:QK(e)}function SZ(e,t){return!(!bZ(e)||!bZ(t)||_q(e)&&!_q(t)||gq(e)&&!gq(t)||vq(e)&&!vq(t)||xq(e)&&!xq(t)||yq(e)&&!yq(t)||bq(e)&&!bq(t)||mq(e)&&!mq(t))}function CZ(e,t){if(_q(e)){let n={isoDate:{year:1970,month:1,day:1},time:Q(e,UG)};return{epochNs:GJ(Q(t,fK),n,`compatible`),formatter:fZ(t,cK)}}if(yq(e)){let n=Q(e,WG),r=Q(t,mK);if(n!==r)throw RangeError(`cannot format PlainYearMonth with calendar ${n} in locale with calendar ${r}`);let i=Lq(Q(e,VG),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:GJ(Q(t,fK),i,`compatible`),formatter:fZ(t,oK)}}if(bq(e)){let n=Q(e,WG),r=Q(t,mK);if(n!==r)throw RangeError(`cannot format PlainMonthDay with calendar ${n} in locale with calendar ${r}`);let i=Lq(Q(e,VG),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:GJ(Q(t,fK),i,`compatible`),formatter:fZ(t,sK)}}if(gq(e)){let n=Q(e,WG),r=Q(t,mK);if(n!==`iso8601`&&n!==r)throw RangeError(`cannot format PlainDate with calendar ${n} in locale with calendar ${r}`);let i=Lq(Q(e,VG),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:GJ(Q(t,fK),i,`compatible`),formatter:fZ(t,aK)}}if(vq(e)){let n=Q(e,WG),r=Q(t,mK);if(n!==`iso8601`&&n!==r)throw RangeError(`cannot format PlainDateTime with calendar ${n} in locale with calendar ${r}`);let i=Q(e,HG);return{epochNs:GJ(Q(t,fK),i,`compatible`),formatter:fZ(t,lK)}}if(xq(e))throw TypeError(`Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.`);return mq(e)?{epochNs:Q(e,BG),formatter:fZ(t,uK)}:{}}function wZ(e){let t=Object.create(null);return t.years=Q(e,YG),t.months=Q(e,XG),t.weeks=Q(e,ZG),t.days=Q(e,QG),t.hours=Q(e,$G),t.minutes=Q(e,eK),t.seconds=Q(e,tK),t.milliseconds=Q(e,nK),t.microseconds=Q(e,rK),t.nanoseconds=Q(e,iK),t}mZ.prototype.constructor=hZ,Object.defineProperty(hZ,"prototype",{value:mZ.prototype,writable:!1,enumerable:!1,configurable:!1}),hZ.supportedLocalesOf=dZ.supportedLocalesOf,TK(hZ,`Intl.DateTimeFormat`);var{format:jye,formatToParts:Mye}=Intl.DurationFormat?.prototype??Object.create(null);function TZ(e){Intl.DurationFormat.prototype.resolvedOptions.call(this);let t=wZ(cJ(e));return jye.call(this,t)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=TZ,Intl.DurationFormat.prototype.formatToParts=function(e){Intl.DurationFormat.prototype.resolvedOptions.call(this);let t=wZ(cJ(e));return Mye.call(this,t)}),Object.freeze({__proto__:null,DateTimeFormat:hZ,ModifiedIntlDurationFormatPrototypeFormat:TZ});var EZ=class{constructor(e){if(arguments.length<1)throw TypeError(`missing argument: epochNanoseconds is required`);EJ(this,FX(e))}get epochMilliseconds(){return $(this,mq),NX(Q(this,BG),`floor`)}get epochNanoseconds(){return $(this,mq),MX(Z.default.BigInt(Q(this,BG)))}add(e){return $(this,mq),_X(`add`,this,e)}subtract(e){return $(this,mq),_X(`subtract`,this,e)}until(e,t=void 0){return $(this,mq),sX(`until`,this,e,t)}since(e,t=void 0){return $(this,mq),sX(`since`,this,e,t)}round(e){if($(this,mq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?BX(`smallestUnit`,e):zX(e),n=Uq(t),r=Bq(t,`halfExpand`),i=Jq(t,`smallestUnit`,`time`,qq);return Wq(n,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[i],!0),DJ(wX(Q(this,BG),n,i,r))}equals(e){$(this,mq);let t=lJ(e),n=Q(this,BG),r=Q(t,BG);return Z.default.equal(Z.default.BigInt(n),Z.default.BigInt(r))}toString(e=void 0){$(this,mq);let t=zX(e),n=Gq(t),r=Bq(t,`trunc`),i=Jq(t,`smallestUnit`,`time`,void 0);if(i===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let a=t.timeZone;a!==void 0&&(a=BJ(a));let{precision:o,unit:s,increment:c}=Kq(i,n);return $J(DJ(wX(Q(this,BG),c,s,r)),a,o)}toJSON(){return $(this,mq),$J(this,void 0,`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,mq),new hZ(e,t).format(this)}valueOf(){WX(`Instant`)}toZonedDateTimeISO(e){$(this,mq);let t=BJ(e);return kJ(Q(this,BG),t,`iso8601`)}static fromEpochMilliseconds(e){return DJ(PX(QK(e)))}static fromEpochNanoseconds(e){return DJ(FX(e))}static from(e){return lJ(e)}static compare(e,t){let n=lJ(e),r=lJ(t),i=Q(n,BG),a=Q(r,BG);return Z.default.lessThan(i,a)?-1:+!!Z.default.greaterThan(i,a)}};TK(EZ,`Temporal.Instant`);var DZ=class{constructor(e,t,n,r=`iso8601`){let i=eq(e),a=eq(t),o=eq(n),s=HX(r===void 0?`iso8601`:iq(r));FY(i,a,o),gJ(this,{year:i,month:a,day:o},s)}get calendarId(){return $(this,gq),Q(this,WG)}get era(){return OZ(this,`era`)}get eraYear(){return OZ(this,`eraYear`)}get year(){return OZ(this,`year`)}get month(){return OZ(this,`month`)}get monthCode(){return OZ(this,`monthCode`)}get day(){return OZ(this,`day`)}get dayOfWeek(){return OZ(this,`dayOfWeek`)}get dayOfYear(){return OZ(this,`dayOfYear`)}get weekOfYear(){return OZ(this,`weekOfYear`)?.week}get yearOfWeek(){return OZ(this,`weekOfYear`)?.year}get daysInWeek(){return OZ(this,`daysInWeek`)}get daysInMonth(){return OZ(this,`daysInMonth`)}get daysInYear(){return OZ(this,`daysInYear`)}get monthsInYear(){return OZ(this,`monthsInYear`)}get inLeapYear(){return OZ(this,`inLeapYear`)}with(e,t=void 0){if($(this,gq),!ZK(e))throw TypeError(`invalid argument`);Sq(e);let n=Q(this,WG),r=nJ(n,Q(this,VG));return r=jJ(n,r,rJ(n,e,[`year`,`month`,`monthCode`,`day`],[],`partial`)),_J(LJ(n,r,Rq(zX(t))),n)}withCalendar(e){$(this,gq);let t=PJ(e);return _J(Q(this,VG),t)}add(e,t=void 0){return $(this,gq),vX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,gq),vX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,gq),cX(`until`,this,e,t)}since(e,t=void 0){return $(this,gq),cX(`since`,this,e,t)}equals(e){$(this,gq);let t=aJ(e);return kX(Q(this,VG),Q(t,VG))===0&&IJ(Q(this,WG),Q(t,WG))}toString(e=void 0){return $(this,gq),tY(this,Hq(zX(e)))}toJSON(){return $(this,gq),tY(this)}toLocaleString(e=void 0,t=void 0){return $(this,gq),new hZ(e,t).format(this)}valueOf(){WX(`PlainDate`)}toPlainDateTime(e=void 0){$(this,gq);let t=fJ(e);return yJ(Lq(Q(this,VG),t),Q(this,WG))}toZonedDateTime(e){let t,n;if($(this,gq),ZK(e)){let r=e.timeZone;r===void 0?t=BJ(e):(t=BJ(r),n=e.plainTime)}else t=BJ(e);let r=Q(this,VG),i;return n===void 0?i=JJ(t,r):(n=dJ(n),i=GJ(t,Lq(r,Q(n,UG)),`compatible`)),kJ(i,t,Q(this,WG))}toPlainYearMonth(){$(this,gq);let e=Q(this,WG);return TJ(RJ(e,nJ(e,Q(this,VG)),`constrain`),e)}toPlainMonthDay(){$(this,gq);let e=Q(this,WG);return xJ(zJ(e,nJ(e,Q(this,VG)),`constrain`),e)}static from(e,t=void 0){return aJ(e,t)}static compare(e,t){let n=aJ(e),r=aJ(t);return kX(Q(n,VG),Q(r,VG))}};function OZ(e,t){$(e,gq);let n=Q(e,VG);return tJ(e).isoToDate(n,{[t]:!0})[t]}TK(DZ,`Temporal.PlainDate`);var kZ=class{constructor(e,t,n,r=0,i=0,a=0,o=0,s=0,c=0,l=`iso8601`){let u=eq(e),d=eq(t),f=eq(n),p=r===void 0?0:eq(r),m=i===void 0?0:eq(i),h=a===void 0?0:eq(a),g=o===void 0?0:eq(o),_=s===void 0?0:eq(s),v=c===void 0?0:eq(c),y=HX(l===void 0?`iso8601`:iq(l));RY(u,d,f,p,m,h,g,_,v),vJ(this,{isoDate:{year:u,month:d,day:f},time:{hour:p,minute:m,second:h,millisecond:g,microsecond:_,nanosecond:v}},y)}get calendarId(){return $(this,vq),Q(this,WG)}get year(){return AZ(this,`year`)}get month(){return AZ(this,`month`)}get monthCode(){return AZ(this,`monthCode`)}get day(){return AZ(this,`day`)}get hour(){return jZ(this,`hour`)}get minute(){return jZ(this,`minute`)}get second(){return jZ(this,`second`)}get millisecond(){return jZ(this,`millisecond`)}get microsecond(){return jZ(this,`microsecond`)}get nanosecond(){return jZ(this,`nanosecond`)}get era(){return AZ(this,`era`)}get eraYear(){return AZ(this,`eraYear`)}get dayOfWeek(){return AZ(this,`dayOfWeek`)}get dayOfYear(){return AZ(this,`dayOfYear`)}get weekOfYear(){return AZ(this,`weekOfYear`)?.week}get yearOfWeek(){return AZ(this,`weekOfYear`)?.year}get daysInWeek(){return AZ(this,`daysInWeek`)}get daysInYear(){return AZ(this,`daysInYear`)}get daysInMonth(){return AZ(this,`daysInMonth`)}get monthsInYear(){return AZ(this,`monthsInYear`)}get inLeapYear(){return AZ(this,`inLeapYear`)}with(e,t=void 0){if($(this,vq),!ZK(e))throw TypeError(`invalid argument`);Sq(e);let n=Q(this,WG),r=Q(this,HG),i={...nJ(n,r.isoDate),...r.time};return i=jJ(n,i,rJ(n,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],`partial`)),yJ(oJ(n,i,Rq(zX(t))),n)}withPlainTime(e=void 0){$(this,vq);let t=fJ(e);return yJ(Lq(Q(this,HG).isoDate,t),Q(this,WG))}withCalendar(e){$(this,vq);let t=PJ(e);return yJ(Q(this,HG),t)}add(e,t=void 0){return $(this,vq),yX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,vq),yX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,vq),lX(`until`,this,e,t)}since(e,t=void 0){return $(this,vq),lX(`since`,this,e,t)}round(e){if($(this,vq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?BX(`smallestUnit`,e):zX(e),n=Uq(t),r=Bq(t,`halfExpand`),i=Jq(t,`smallestUnit`,`time`,qq,[`day`]),a={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];Wq(n,a,a===1);let o=Q(this,HG);return yJ(n===1&&i===`nanosecond`?o:TX(o,n,i,r),Q(this,WG))}equals(e){$(this,vq);let t=sJ(e);return jX(Q(this,HG),Q(t,HG))===0&&IJ(Q(this,WG),Q(t,WG))}toString(e=void 0){$(this,vq);let t=zX(e),n=Hq(t),r=Gq(t),i=Bq(t,`trunc`),a=Jq(t,`smallestUnit`,`time`,void 0);if(a===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let{precision:o,unit:s,increment:c}=Kq(a,r),l=TX(Q(this,HG),c,s,i);return zY(l),rY(l,Q(this,WG),o,n)}toJSON(){return $(this,vq),rY(Q(this,HG),Q(this,WG),`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,vq),new hZ(e,t).format(this)}valueOf(){WX(`PlainDateTime`)}toZonedDateTime(e,t=void 0){$(this,vq);let n=BJ(e),r=zq(zX(t));return kJ(GJ(n,Q(this,HG),r),n,Q(this,WG))}toPlainDate(){return $(this,vq),_J(Q(this,HG).isoDate,Q(this,WG))}toPlainTime(){return $(this,vq),CJ(Q(this,HG).time)}static from(e,t=void 0){return sJ(e,t)}static compare(e,t){let n=sJ(e),r=sJ(t);return jX(Q(n,HG),Q(r,HG))}};function AZ(e,t){$(e,vq);let n=Q(e,HG).isoDate;return tJ(e).isoToDate(n,{[t]:!0})[t]}function jZ(e,t){return $(e,vq),Q(e,HG).time[t]}TK(kZ,`Temporal.PlainDateTime`);var MZ=class e{constructor(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0){let u=e===void 0?0:nq(e),d=t===void 0?0:nq(t),f=n===void 0?0:nq(n),p=r===void 0?0:nq(r),m=i===void 0?0:nq(i),h=a===void 0?0:nq(a),g=o===void 0?0:nq(o),_=s===void 0?0:nq(s),v=c===void 0?0:nq(c),y=l===void 0?0:nq(l);UY(u,d,f,p,m,h,g,_,v,y),xK(this),CK(this,YG,u),CK(this,XG,d),CK(this,ZG,f),CK(this,QG,p),CK(this,$G,m),CK(this,eK,h),CK(this,tK,g),CK(this,nK,_),CK(this,rK,v),CK(this,iK,y)}get years(){return $(this,hq),Q(this,YG)}get months(){return $(this,hq),Q(this,XG)}get weeks(){return $(this,hq),Q(this,ZG)}get days(){return $(this,hq),Q(this,QG)}get hours(){return $(this,hq),Q(this,$G)}get minutes(){return $(this,hq),Q(this,eK)}get seconds(){return $(this,hq),Q(this,tK)}get milliseconds(){return $(this,hq),Q(this,nK)}get microseconds(){return $(this,hq),Q(this,rK)}get nanoseconds(){return $(this,hq),Q(this,iK)}get sign(){return $(this,hq),CY(this)}get blank(){return $(this,hq),CY(this)===0}with(t){$(this,hq);let{years:n=Q(this,YG),months:r=Q(this,XG),weeks:i=Q(this,ZG),days:a=Q(this,QG),hours:o=Q(this,$G),minutes:s=Q(this,eK),seconds:c=Q(this,tK),milliseconds:l=Q(this,nK),microseconds:u=Q(this,rK),nanoseconds:d=Q(this,iK)}=Fq(t);return new e(n,r,i,a,o,s,c,l,u,d)}negated(){return $(this,hq),jY(this)}abs(){return $(this,hq),new e(Math.abs(Q(this,YG)),Math.abs(Q(this,XG)),Math.abs(Q(this,ZG)),Math.abs(Q(this,QG)),Math.abs(Q(this,$G)),Math.abs(Q(this,eK)),Math.abs(Q(this,tK)),Math.abs(Q(this,nK)),Math.abs(Q(this,rK)),Math.abs(Q(this,iK)))}add(e){return $(this,hq),gX(`add`,this,e)}subtract(e){return $(this,hq),gX(`subtract`,this,e)}round(e){if($(this,hq),e===void 0)throw TypeError(`options parameter is required`);let t=Xq(this),n=typeof e==`string`?BX(`smallestUnit`,e):zX(e),r=Jq(n,`largestUnit`,`datetime`,void 0,[`auto`]),{plainRelativeTo:i,zonedRelativeTo:a}=Yq(n),o=Uq(n),s=Bq(n,`halfExpand`),c=Jq(n,`smallestUnit`,`datetime`,void 0),l=!0;c||=(l=!1,`nanosecond`);let u=Zq(t,c),d=!0;if(r||=(d=!1,u),r===`auto`&&(r=u),!l&&!d)throw RangeError(`at least one of smallestUnit or largestUnit is required`);if(Zq(r,c)!==r)throw RangeError(`largestUnit ${r} cannot be smaller than smallestUnit ${c}`);let f={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[c];if(f!==void 0&&Wq(o,f,!1),o>1&&$q(c)===`date`&&r!==c)throw RangeError(`For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit`);if(a){let e=WY(this),t=Q(a,JG),n=Q(a,WG),i=Q(a,BG);return e=aX(i,hX(i,t,n,e),t,n,r,o,c,s),$q(r)===`date`&&(r=`hour`),qY(e,r)}if(i){let e=GY(this),t=pX({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},e.time),n=Q(i,VG),a=Q(i,WG),l=MJ(a,n,Iq(e.date,t.deltaDays),`constrain`);return e=iX(Lq(n,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),Lq(l,t),a,r,o,c,s),qY(e,r)}if(Qq(t))throw RangeError(`a starting point is required for ${t}s balancing`);if(Qq(r))throw RangeError(`a starting point is required for ${r}s balancing`);let p=GY(this);if(c===`day`){let{quotient:e,remainder:t}=p.time.divmod(WK),n=p.date.days+e+OX(t,`day`);n=CX(n,o,s),p=JY({years:0,months:0,weeks:0,days:n},MK.ZERO)}else p=JY({years:0,months:0,weeks:0,days:0},DX(p.time,o,c,s));return qY(p,r)}total(e){if($(this,hq),e===void 0)throw TypeError(`options argument is required`);let t=typeof e==`string`?BX(`unit`,e):zX(e),{plainRelativeTo:n,zonedRelativeTo:r}=Yq(t),i=Jq(t,`unit`,`datetime`,qq);if(r){let e=WY(this),t=Q(r,JG),n=Q(r,WG),a=Q(r,BG);return function(e,t,n,r,i){return $q(i)===`time`?OX(MK.fromEpochNsDiff(t,e),i):rX(eX(e,t,n,r,i),t,WJ(n,e),n,r,i)}(a,hX(a,t,n,e),t,n,i)}if(n){let e=GY(this),t=pX({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},e.time),r=Q(n,VG),a=Q(n,WG),o=MJ(a,r,Iq(e.date,t.deltaDays),`constrain`);return function(e,t,n,r){if(jX(e,t)==0)return 0;zY(e),zY(t);let i=$Y(e,t,n,r);return r===`nanosecond`?Z.default.toNumber(i.time.totalNs):rX(i,gY(t),e,null,n,r)}(Lq(r,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),Lq(o,t),a,i)}let a=Xq(this);if(Qq(a))throw RangeError(`a starting point is required for ${a}s total`);if(Qq(i))throw RangeError(`a starting point is required for ${i}s total`);return OX(GY(this).time,i)}toString(e=void 0){$(this,hq);let t=zX(e),n=Gq(t),r=Bq(t,`trunc`),i=Jq(t,`smallestUnit`,`time`,void 0);if(i===`hour`||i===`minute`)throw RangeError(`smallestUnit must be a time unit other than "hours" or "minutes"`);let{precision:a,unit:o,increment:s}=Kq(i,n);if(o===`nanosecond`&&s===1)return eY(this,a);let c=Xq(this),l=WY(this),u=DX(l.time,s,o,r);return l=JY(l.date,u),eY(qY(l,Zq(c,`second`)),a)}toJSON(){return $(this,hq),eY(this,`auto`)}toLocaleString(e=void 0,t=void 0){if($(this,hq),typeof Intl.DurationFormat==`function`){let n=new Intl.DurationFormat(e,t);return TZ.call(n,this)}return console.warn(`Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat.`),eY(this,`auto`)}valueOf(){WX(`Duration`)}static from(e){return cJ(e)}static compare(e,t,n=void 0){let r=cJ(e),i=cJ(t),{plainRelativeTo:a,zonedRelativeTo:o}=Yq(zX(n));if(Q(r,YG)===Q(i,YG)&&Q(r,XG)===Q(i,XG)&&Q(r,ZG)===Q(i,ZG)&&Q(r,QG)===Q(i,QG)&&Q(r,$G)===Q(i,$G)&&Q(r,eK)===Q(i,eK)&&Q(r,tK)===Q(i,tK)&&Q(r,nK)===Q(i,nK)&&Q(r,rK)===Q(i,rK)&&Q(r,iK)===Q(i,iK))return 0;let s=Xq(r),c=Xq(i),l=WY(r),u=WY(i);if(o&&($q(s)===`date`||$q(c)===`date`)){let e=Q(o,JG),t=Q(o,WG),n=Q(o,BG),r=hX(n,e,t,l),i=hX(n,e,t,u);return RX(Z.default.toNumber(Z.default.subtract(r,i)))}let d=l.date.days,f=u.date.days;if(Qq(s)||Qq(c)){if(!a)throw RangeError(`A starting point is required for years, months, or weeks comparison`);d=AY(l.date,a),f=AY(u.date,a)}let p=l.time.add24HourDays(d),m=u.time.add24HourDays(f);return p.cmp(m)}};TK(MZ,`Temporal.Duration`);var NZ=class{constructor(e,t,n=`iso8601`,r=1972){let i=eq(e),a=eq(t),o=HX(n===void 0?`iso8601`:iq(n)),s=eq(r);FY(s,i,a),bJ(this,{year:s,month:i,day:a},o)}get monthCode(){return PZ(this,`monthCode`)}get day(){return PZ(this,`day`)}get calendarId(){return $(this,bq),Q(this,WG)}with(e,t=void 0){if($(this,bq),!ZK(e))throw TypeError(`invalid argument`);Sq(e);let n=Q(this,WG),r=nJ(n,Q(this,VG),`month-day`);return r=jJ(n,r,rJ(n,e,[`year`,`month`,`monthCode`,`day`],[],`partial`)),xJ(zJ(n,r,Rq(zX(t))),n)}equals(e){$(this,bq);let t=uJ(e);return kX(Q(this,VG),Q(t,VG))===0&&IJ(Q(this,WG),Q(t,WG))}toString(e=void 0){return $(this,bq),iY(this,Hq(zX(e)))}toJSON(){return $(this,bq),iY(this)}toLocaleString(e=void 0,t=void 0){return $(this,bq),new hZ(e,t).format(this)}valueOf(){WX(`PlainMonthDay`)}toPlainDate(e){if($(this,bq),!ZK(e))throw TypeError(`argument should be an object`);let t=Q(this,WG);return _J(LJ(t,jJ(t,nJ(t,Q(this,VG),`month-day`),rJ(t,e,[`year`],[],[])),`constrain`),t)}static from(e,t=void 0){return uJ(e,t)}};function PZ(e,t){$(e,bq);let n=Q(e,VG);return tJ(e).isoToDate(n,{[t]:!0})[t]}function FZ(e){return WJ(e,IX())}TK(NZ,`Temporal.PlainMonthDay`);var IZ={instant:()=>DJ(IX()),plainDateTimeISO:(e=LX())=>yJ(FZ(BJ(e)),`iso8601`),plainDateISO:(e=LX())=>_J(FZ(BJ(e)).isoDate,`iso8601`),plainTimeISO:(e=LX())=>CJ(FZ(BJ(e)).time),timeZoneId:()=>LX(),zonedDateTimeISO:(e=LX())=>{let t=BJ(e);return kJ(IX(),t,`iso8601`)},[Symbol.toStringTag]:`Temporal.Now`};Object.defineProperty(IZ,Symbol.toStringTag,{value:`Temporal.Now`,writable:!1,enumerable:!1,configurable:!0});var LZ=class e{constructor(e=0,t=0,n=0,r=0,i=0,a=0){let o=e===void 0?0:eq(e),s=t===void 0?0:eq(t),c=n===void 0?0:eq(n),l=r===void 0?0:eq(r),u=i===void 0?0:eq(i),d=a===void 0?0:eq(a);LY(o,s,c,l,u,d),SJ(this,{hour:o,minute:s,second:c,millisecond:l,microsecond:u,nanosecond:d})}get hour(){return $(this,_q),Q(this,UG).hour}get minute(){return $(this,_q),Q(this,UG).minute}get second(){return $(this,_q),Q(this,UG).second}get millisecond(){return $(this,_q),Q(this,UG).millisecond}get microsecond(){return $(this,_q),Q(this,UG).microsecond}get nanosecond(){return $(this,_q),Q(this,UG).nanosecond}with(t,n=void 0){if($(this,_q),!ZK(t))throw TypeError(`invalid argument`);Sq(t);let r=iJ(t,`partial`),i=iJ(this),{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=Object.assign(i,r),d=Rq(zX(n));return{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=Pq(a,o,s,c,l,u,d),new e(a,o,s,c,l,u)}add(e){return $(this,_q),bX(`add`,this,e)}subtract(e){return $(this,_q),bX(`subtract`,this,e)}until(e,t=void 0){return $(this,_q),uX(`until`,this,e,t)}since(e,t=void 0){return $(this,_q),uX(`since`,this,e,t)}round(e){if($(this,_q),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?BX(`smallestUnit`,e):zX(e),n=Uq(t),r=Bq(t,`halfExpand`),i=Jq(t,`smallestUnit`,`time`,qq);return Wq(n,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i],!1),CJ(EX(Q(this,UG),n,i,r))}equals(e){$(this,_q);let t=dJ(e);return AX(Q(this,UG),Q(t,UG))===0}toString(e=void 0){$(this,_q);let t=zX(e),n=Gq(t),r=Bq(t,`trunc`),i=Jq(t,`smallestUnit`,`time`,void 0);if(i===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let{precision:a,unit:o,increment:s}=Kq(i,n);return nY(EX(Q(this,UG),s,o,r),a)}toJSON(){return $(this,_q),nY(Q(this,UG),`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,_q),new hZ(e,t).format(this)}valueOf(){WX(`PlainTime`)}static from(e,t=void 0){return dJ(e,t)}static compare(e,t){let n=dJ(e),r=dJ(t);return AX(Q(n,UG),Q(r,UG))}};TK(LZ,`Temporal.PlainTime`);var RZ=class{constructor(e,t,n=`iso8601`,r=1){let i=eq(e),a=eq(t),o=HX(n===void 0?`iso8601`:iq(n)),s=eq(r);FY(i,a,s),wJ(this,{year:i,month:a,day:s},o)}get year(){return zZ(this,`year`)}get month(){return zZ(this,`month`)}get monthCode(){return zZ(this,`monthCode`)}get calendarId(){return $(this,yq),Q(this,WG)}get era(){return zZ(this,`era`)}get eraYear(){return zZ(this,`eraYear`)}get daysInMonth(){return zZ(this,`daysInMonth`)}get daysInYear(){return zZ(this,`daysInYear`)}get monthsInYear(){return zZ(this,`monthsInYear`)}get inLeapYear(){return zZ(this,`inLeapYear`)}with(e,t=void 0){if($(this,yq),!ZK(e))throw TypeError(`invalid argument`);Sq(e);let n=Q(this,WG),r=nJ(n,Q(this,VG),`year-month`);return r=jJ(n,r,rJ(n,e,[`year`,`month`,`monthCode`],[],`partial`)),TJ(RJ(n,r,Rq(zX(t))),n)}add(e,t=void 0){return $(this,yq),xX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,yq),xX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,yq),dX(`until`,this,e,t)}since(e,t=void 0){return $(this,yq),dX(`since`,this,e,t)}equals(e){$(this,yq);let t=pJ(e);return kX(Q(this,VG),Q(t,VG))===0&&IJ(Q(this,WG),Q(t,WG))}toString(e=void 0){return $(this,yq),aY(this,Hq(zX(e)))}toJSON(){return $(this,yq),aY(this)}toLocaleString(e=void 0,t=void 0){return $(this,yq),new hZ(e,t).format(this)}valueOf(){WX(`PlainYearMonth`)}toPlainDate(e){if($(this,yq),!ZK(e))throw TypeError(`argument should be an object`);let t=Q(this,WG);return _J(LJ(t,jJ(t,nJ(t,Q(this,VG),`year-month`),rJ(t,e,[`day`],[],[])),`constrain`),t)}static from(e,t=void 0){return pJ(e,t)}static compare(e,t){let n=pJ(e),r=pJ(t);return kX(Q(n,VG),Q(r,VG))}};function zZ(e,t){$(e,yq);let n=Q(e,VG);return tJ(e).isoToDate(n,{[t]:!0})[t]}TK(RZ,`Temporal.PlainYearMonth`);var Nye=hZ.prototype.resolvedOptions,BZ=class{constructor(e,t,n=`iso8601`){if(arguments.length<1)throw TypeError(`missing argument: epochNanoseconds is required`);let r=FX(e),i=iq(t),{tzName:a,offsetMinutes:o}=Mq(i);if(o===void 0){let e=uY(a);if(!e)throw RangeError(`unknown time zone ${a}`);i=e.identifier}else i=pY(o);OJ(this,r,i,HX(n===void 0?`iso8601`:iq(n)))}get calendarId(){return $(this,xq),Q(this,WG)}get timeZoneId(){return $(this,xq),Q(this,JG)}get year(){return HZ(this,`year`)}get month(){return HZ(this,`month`)}get monthCode(){return HZ(this,`monthCode`)}get day(){return HZ(this,`day`)}get hour(){return UZ(this,`hour`)}get minute(){return UZ(this,`minute`)}get second(){return UZ(this,`second`)}get millisecond(){return UZ(this,`millisecond`)}get microsecond(){return UZ(this,`microsecond`)}get nanosecond(){return UZ(this,`nanosecond`)}get era(){return HZ(this,`era`)}get eraYear(){return HZ(this,`eraYear`)}get epochMilliseconds(){return $(this,xq),NX(Q(this,BG),`floor`)}get epochNanoseconds(){return $(this,xq),MX(Q(this,BG))}get dayOfWeek(){return HZ(this,`dayOfWeek`)}get dayOfYear(){return HZ(this,`dayOfYear`)}get weekOfYear(){return HZ(this,`weekOfYear`)?.week}get yearOfWeek(){return HZ(this,`weekOfYear`)?.year}get hoursInDay(){$(this,xq);let e=Q(this,JG),t=VZ(this).isoDate,n=DY(t.year,t.month,t.day+1),r=JJ(e,t),i=JJ(e,n);return OX(MK.fromEpochNsDiff(i,r),`hour`)}get daysInWeek(){return HZ(this,`daysInWeek`)}get daysInMonth(){return HZ(this,`daysInMonth`)}get daysInYear(){return HZ(this,`daysInYear`)}get monthsInYear(){return HZ(this,`monthsInYear`)}get inLeapYear(){return HZ(this,`inLeapYear`)}get offset(){return $(this,xq),UJ(HJ(Q(this,JG),Q(this,BG)))}get offsetNanoseconds(){return $(this,xq),HJ(Q(this,JG),Q(this,BG))}with(e,t=void 0){if($(this,xq),!ZK(e))throw TypeError(`invalid zoned-date-time-like`);Sq(e);let n=Q(this,WG),r=Q(this,JG),i=HJ(r,Q(this,BG)),a=VZ(this),o={...nJ(n,a.isoDate),...a.time,offset:UJ(i)};o=jJ(n,o,rJ(n,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`],`partial`));let s=zX(t),c=zq(s),l=Vq(s,`prefer`),u=oJ(n,o,Rq(s)),d=cY(o.offset);return kJ(mJ(u.isoDate,u.time,`option`,d,r,c,l,!1),r,n)}withPlainTime(e=void 0){$(this,xq);let t=Q(this,JG),n=Q(this,WG),r=VZ(this).isoDate,i;return i=e===void 0?JJ(t,r):GJ(t,Lq(r,Q(dJ(e),UG)),`compatible`),kJ(i,t,n)}withTimeZone(e){$(this,xq);let t=BJ(e);return kJ(Q(this,BG),t,Q(this,WG))}withCalendar(e){$(this,xq);let t=PJ(e);return kJ(Q(this,BG),Q(this,JG),t)}add(e,t=void 0){return $(this,xq),SX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,xq),SX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,xq),fX(`until`,this,e,t)}since(e,t=void 0){return $(this,xq),fX(`since`,this,e,t)}round(e){if($(this,xq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?BX(`smallestUnit`,e):zX(e),n=Uq(t),r=Bq(t,`halfExpand`),i=Jq(t,`smallestUnit`,`time`,qq,[`day`]),a={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];if(Wq(n,a,a===1),i===`nanosecond`&&n===1)return kJ(Q(this,BG),Q(this,JG),Q(this,WG));let o=Q(this,JG),s=Q(this,BG),c=VZ(this),l;if(i===`day`){let e=c.isoDate,t=DY(e.year,e.month,e.day+1),n=JJ(o,e),i=JJ(o,t),a=Z.default.subtract(i,n);l=MK.fromEpochNsDiff(s,n).round(a,r).addToEpochNs(n)}else{let e=TX(c,n,i,r),t=HJ(o,s);l=mJ(e.isoDate,e.time,`option`,t,o,`compatible`,`prefer`,!1)}return kJ(l,o,Q(this,WG))}equals(e){$(this,xq);let t=hJ(e),n=Q(this,BG),r=Q(t,BG);return!!Z.default.equal(Z.default.BigInt(n),Z.default.BigInt(r))&&!!VJ(Q(this,JG),Q(t,JG))&&IJ(Q(this,WG),Q(t,WG))}toString(e=void 0){$(this,xq);let t=zX(e),n=Hq(t),r=Gq(t),i=function(e){return VX(e,`offset`,[`auto`,`never`],`auto`)}(t),a=Bq(t,`trunc`),o=Jq(t,`smallestUnit`,`time`,void 0);if(o===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let s=function(e){return VX(e,`timeZoneName`,[`auto`,`never`,`critical`],`auto`)}(t),{precision:c,unit:l,increment:u}=Kq(o,r);return oY(this,c,n,s,i,{unit:l,increment:u,roundingMode:a})}toLocaleString(e=void 0,t=void 0){$(this,xq);let n=zX(t),r=Object.create(null);if(function(e,t,n,r){if(t==null)return;let i=Reflect.ownKeys(t);for(let r=0;r<i.length;r++){let a=i[r];!n.some((e=>Object.is(e,a)))&&Object.prototype.propertyIsEnumerable.call(t,a)&&(e[a]=t[a])}}(r,n,[`timeZone`]),n.timeZone!==void 0)throw TypeError(`ZonedDateTime toLocaleString does not accept a timeZone option`);if(r.year===void 0&&r.month===void 0&&r.day===void 0&&r.era===void 0&&r.weekday===void 0&&r.dateStyle===void 0&&r.hour===void 0&&r.minute===void 0&&r.second===void 0&&r.fractionalSecondDigits===void 0&&r.timeStyle===void 0&&r.dayPeriod===void 0&&r.timeZoneName===void 0&&(r.timeZoneName=`short`),r.timeZone=Q(this,JG),sY(r.timeZone))throw RangeError(`toLocaleString does not currently support offset time zones`);let i=new hZ(e,r),a=Nye.call(i).calendar,o=Q(this,WG);if(o!==`iso8601`&&a!==`iso8601`&&!IJ(a,o))throw RangeError(`cannot format ZonedDateTime with calendar ${o} in locale with calendar ${a}`);return i.format(DJ(Q(this,BG)))}toJSON(){return $(this,xq),oY(this,`auto`)}valueOf(){WX(`ZonedDateTime`)}startOfDay(){$(this,xq);let e=Q(this,JG);return kJ(JJ(e,VZ(this).isoDate),e,Q(this,WG))}getTimeZoneTransition(e){$(this,xq);let t=Q(this,JG);if(e===void 0)throw TypeError(`options parameter is required`);let n=VX(typeof e==`string`?BX(`direction`,e):zX(e),`direction`,[`next`,`previous`],qq);if(n===void 0)throw TypeError(`direction option is required`);if(sY(t)||t===`UTC`)return null;let r=Q(this,BG),i=n===`next`?vY(t,r):yY(t,r);return i===null?null:kJ(i,t,Q(this,WG))}toInstant(){return $(this,xq),DJ(Q(this,BG))}toPlainDate(){return $(this,xq),_J(VZ(this).isoDate,Q(this,WG))}toPlainTime(){return $(this,xq),CJ(VZ(this).time)}toPlainDateTime(){return $(this,xq),yJ(VZ(this),Q(this,WG))}static from(e,t=void 0){return hJ(e,t)}static compare(e,t){let n=hJ(e),r=hJ(t),i=Q(n,BG),a=Q(r,BG);return Z.default.lessThan(Z.default.BigInt(i),Z.default.BigInt(a))?-1:+!!Z.default.greaterThan(Z.default.BigInt(i),Z.default.BigInt(a))}};function VZ(e){return WJ(Q(e,JG),Q(e,BG))}function HZ(e,t){$(e,xq);let n=VZ(e).isoDate;return tJ(e).isoToDate(n,{[t]:!0})[t]}function UZ(e,t){return $(e,xq),VZ(e).time[t]}TK(BZ,`Temporal.ZonedDateTime`);var Pye=Object.freeze({__proto__:null,Duration:MZ,Instant:EZ,Now:IZ,PlainDate:DZ,PlainDateTime:kZ,PlainMonthDay:NZ,PlainTime:LZ,PlainYearMonth:RZ,ZonedDateTime:BZ});(class{toTemporalInstant(){return DJ(PX(Date.prototype.valueOf.call(this)))}}).prototype.toTemporalInstant;var Fye=[EZ,DZ,kZ,MZ,NZ,LZ,RZ,BZ];for(let e of Fye){let t=Object.getOwnPropertyDescriptor(e,`prototype`);(t.configurable||t.enumerable||t.writable)&&(t.configurable=!1,t.enumerable=!1,t.writable=!1,Object.defineProperty(e,"prototype",t))}function Iye(e,t){let n=new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).formatToParts(e),r=e=>{let t=n.find(t=>t.type===e);if(!t)throw Error(`This timezone isn't recognised. Enter a timezone name like Europe/Tirane.`);return t.value};return`${r(`year`)}-${r(`month`)}-${r(`day`)}T${r(`hour`)}:${r(`minute`)}`}function Lye(e,t){return Iye(new Date(e),t)}function Rye(e,t){if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(e))throw Error(`Pick a date and time for the one-off run.`);let n=Pye.PlainDateTime.from(e,{overflow:`reject`}),r=n.toZonedDateTime(t,{disambiguation:`compatible`});if(!n.equals(r.toPlainDateTime()))throw Error(`That time is skipped in this timezone (a clock change). Choose another time.`);return r.toInstant().toString({smallestUnit:`millisecond`})}function WZ(e,t){return new Intl.DateTimeFormat(void 0,{timeZone:t,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e))}function zye(e,t){return new Intl.DateTimeFormat(void 0,{timeZone:t,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`}).format(new Date(e))}var GZ={"claude-code":{name:`Claude Code`,command:`claude auth login`},codex:{name:`Codex`,command:`codex login`},gemini:{name:`Gemini`,command:`gemini`}},Bye=/not signed in|sign-in has expired|not logged in|run\s+"?(?:codex login|claude auth login)|authentication required/i,Vye=/ENOSPC|no space left on device|disk (?:is )?full|not enough (?:free )?(?:disk )?space/i,Hye=/refused to make|content (?:rules|policy|filter)|safety (?:system|filter)|flagged|moderation/i,Uye=/\bunknown model\b|\bmodel\b[^\n]{0,80}?\b(?:not found|does not exist|retired|deprecated|decommissioned|no longer (?:available|supported)|is not available)/i,Wye=/did not accept the API key|API key is saved|invalid api key|key may be wrong/i,Gye=[`images`,`thumbnail`],Kye=/^Short \d+ image \d+:/;function KZ(e){let t=e.reason??``,n=qye(e.provider,t);if(n!==void 0&&(Bye.test(t)||e.kind===`auth`))return{kind:`sign-in`,label:`Sign in to ${GZ[n].name}`,cli:n,command:GZ[n].command};if(Vye.test(t))return{kind:`free-space`,label:`Free space`};if(e.kind===`refusal`||Hye.test(t))return Gye.includes(e.stage)||e.stage===`video`&&Kye.test(t)?{kind:`refused`,label:`Soften and retry`,soften:!0}:{kind:`refused`,label:`Edit the prompt`,soften:!1};if(Uye.test(t))return{kind:`switch-model`,label:`Switch model`};if(e.kind===`auth`||e.kind===`missing_key`||Wye.test(t)){let t=Jye(e.provider);return{kind:`provider-settings`,label:t===void 0?`Open Settings → Providers`:`Open Settings → Providers → ${t}`,provider:e.provider??``}}}function qye(e,t){if(e===`claude-code`||e===`gemini`)return e;if(e===`codex`||e===`codex-image`||/Codex CLI/.test(t))return`codex`;if(/Claude Code CLI/.test(t))return`claude-code`;if(/Gemini CLI/.test(t))return`gemini`}function Jye(e){return zA.find(t=>t.id===e)?.displayName}function Yye(e,t){switch(t){case`audio`:return e.audio?.provider;case`images`:case`thumbnail`:return e.images?.provider;case`research`:case`article`:return e.llm?.provider;default:return}}function Xye(e){let t=e.topics.error;if(t!==null)return KZ({stage:`article`,reason:t,provider:e.topicGeneration.llm?.provider})}function qZ({schedule:e,title:t,retry:n,className:r}){if(e.topics.error===null)return null;let i=Xye(e);return(0,h.jsx)(fM,{tone:`danger`,title:t,...r===void 0?{}:{className:r},...i===void 0?{}:{actions:(0,h.jsx)(Sz,{fix:i,retry:n,variant:`secondary`,size:`small`})},children:e.topics.error})}var JZ=e=>e.length===1?`“${e[0]?.title??``}”`:CG(e.length,`topic`,`topics`);function Zye({schedule:e}){let{api:t}=B(),n=_(),[r,i]=(0,m.useState)(null),a=Lv(),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(!1),u=e.deletedAt===null&&(e.status===`active`||e.status===`paused`),d=F({queryKey:[...MT(e.id),e.topics.held,e.topics.generatedAt],enabled:u&&e.topicGeneration.mode===`hold`,queryFn:async()=>{let n=await NT(t,e.id);if(!n.ok)throw Error(n.message);return n.value}}),f=F({queryKey:[`project-template`,e.templateId],enabled:u&&e.topicGeneration.mode===`hold`,queryFn:async()=>{let n=await jO(t,e.templateId);if(!n.ok)throw Error(n.message);return n.value}}).data?.document.form,p=(f===void 0?[]:eG(f)).filter(t=>t!==e.topicKeyword),g=t=>e.values[t]??f?.values[t]??``,v=d.data??[],y=vG(v.map(e=>e.id)),b=I({mutationFn:e=>e(),onSuccess:e=>{i(e.ok?null:e.message),e.ok&&s(null)},onError:e=>i(e.message),onSettled:async()=>{await Promise.all([n.invalidateQueries({queryKey:DT}),n.invalidateQueries({queryKey:MT(e.id)}),n.invalidateQueries({queryKey:BT})])}}),x=b.isPending,S=(e,t)=>b.mutate(e,{onSuccess:e=>{e.ok&&t!==void 0&&(y.clear(),a(t.message,`success`,t.undo===void 0?void 0:{label:`Undo`,run:t.undo}))}}),C=n=>S(()=>sce(t,e.id,n.map(e=>e.id)),{message:`Turned down ${JZ(n)}. Later generations won't suggest ${n.length===1?`it`:`them`} again.`,undo:()=>S(()=>cce(t,e.id,n),{message:`${JZ(n)} ${n.length===1?`is`:`are`} waiting again.`})}),w=n=>S(()=>n.length===1&&n[0]!==void 0?IT(t,e.id,n[0].id):oce(t,e.id,n.map(e=>e.id)),{message:`Approved ${JZ(n)}: added to the end of the queue.`}),T=v.filter(e=>y.has(e.id));if(!u||e.topicGeneration.mode===`off`)return null;let{topics:E}=e;return(0,h.jsxs)(`section`,{"aria-label":`Topic generation`,children:[(0,h.jsx)(_G,{className:`my-6`}),(0,h.jsxs)(U,{as:`h3`,title:`Topic generation`,meta:`${E.generatingSince===null?E.generatedAt===null?`No topics generated yet.`:`Topics last generated ${zye(E.generatedAt,e.timezone)}.`:`Generating topics now…`} Keeps at least ${String(e.topicGeneration.keepAtLeast)} ${e.topicGeneration.mode===`hold`?`queued or waiting`:`queued`}.`,children:[(0,h.jsx)(H,{id:`planning.schedule.generate-now`}),(0,h.jsx)(z,{disabled:x||E.generatingSince!==null,disabledReason:`Topics are being generated now`,onClick:()=>b.mutate(()=>FT(t,e.id)),children:`Generate topics now`})]}),(0,h.jsx)(qZ,{schedule:e,title:`The last topic generation failed.`,className:`mt-3`,retry:{run:()=>b.mutate(()=>FT(t,e.id)),busy:x||E.generatingSince!==null}}),r===null?null:(0,h.jsx)(fM,{tone:`danger`,title:`That didn't work.`,className:`mt-3`,children:r}),e.topicGeneration.mode===`hold`?(0,h.jsxs)(`div`,{className:`mt-4`,...Py,children:[(0,h.jsxs)(U,{as:`h3`,title:`Topics waiting · ${String(v.length)}`,info:`planning.schedule.held`,children:[(0,h.jsx)(z,{variant:`primary`,disabled:x||v.length===0,disabledReason:`Nothing is waiting`,onClick:()=>S(()=>LT(t,e.id),{message:`Approved ${JZ(v)}: added to the end of the queue.`}),children:`Approve all`}),(0,h.jsx)(z,{variant:`quiet`,disabled:x||v.length===0,disabledReason:`Nothing is waiting`,onClick:()=>l(!0),children:`Reject all`})]}),d.error?(0,h.jsx)(`p`,{className:`m-0 mt-2 text-small text-danger`,children:`The waiting topics couldn't be loaded: ${d.error.message} Reload the page to try again.`}):v.length===0?(0,h.jsx)(`p`,{className:`m-0 mt-2 text-small text-ink-3`,children:`Nothing is waiting. New topics appear here for you to approve.`}):(0,h.jsxs)(`div`,{onKeyDown:y.onKeyDown,children:[v.length>1?(0,h.jsx)(SG,{className:`mt-2`,selection:y,total:v.length,noun:[`topic waiting`,`topics waiting`],actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{size:`small`,disabled:x||T.length===0,disabledReason:`Tick the topics to approve`,onClick:()=>w(T),children:`Approve selected`}),(0,h.jsx)(z,{size:`small`,variant:`quiet`,disabled:x||T.length===0,disabledReason:`Tick the topics to turn down`,onClick:()=>C(T),children:`Reject selected`})]})}):null,(0,h.jsx)(KL,{label:`Topics waiting`,className:`mt-2 [&_.sl-row__actions]:flex-wrap`,children:v.map(n=>(0,h.jsx)(TG,{topic:n,editing:o?.id===n.id?o:void 0,keywords:p,everyRun:g,busy:x,selection:y,onEdit:s,onCancel:()=>s(null),onSave:()=>{o!==null&&b.mutate(()=>uce(t,e.id,n.id,o.title.trim(),Object.fromEntries(Object.entries(o.values).filter(([,e])=>e.trim()!==``))))},onApprove:()=>w([n]),onReject:()=>C([n])},n.id))})]}),(0,h.jsx)($v,{open:c,title:`Reject all ${CG(v.length,`waiting topic`,`waiting topics`)}?`,consequence:`Turns down the ${CG(v.length,`topic`,`topics`)} waiting for ${e.name} now (topics generated after this list was shown are not included). Later generations won't suggest them again; Undo in the message that follows brings them back.`,confirmLabel:`Reject ${CG(v.length,`topic`,`topics`)}`,cancelLabel:`Keep them waiting`,pending:x,onCancel:()=>l(!1),onConfirm:()=>{l(!1),C(v)}})]}):null]})}function YZ(e){return e.filter(e=>e.deletedAt===null&&e.topicGeneration.mode!==`off`&&(e.status===`active`||e.status===`paused`))}function Qye({schedules:e}){let t=YZ(e),n=e.filter(e=>e.deletedAt===null&&(e.status===`active`||e.status===`paused`));return(0,h.jsx)(`div`,{className:`flex flex-col gap-6`,children:t.length===0?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(U,{title:`Suggested topics`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No schedule suggests its own topics yet. Turn on topic generation in a schedule and its suggestions wait here for you.`}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:n.length===0?(0,h.jsx)(KO,{to:`/calendar`,search:{tab:`schedules`},children:`Open schedules`}):n.slice(0,4).map(e=>(0,h.jsxs)(KO,{to:`/calendar`,search:{tab:`schedules`,schedule:e.id},children:[`Open `,e.name]},e.id))})]}):t.map((e,t)=>(0,h.jsx)($ye,{schedule:e,first:t===0},e.id))})}function $ye({schedule:e,first:t}){let{api:n}=B(),r=_(),i=Lv(),a=F({queryKey:[...MT(e.id),e.topics.held,e.version],queryFn:async()=>{let t=await NT(n,e.id);if(!t.ok)throw Error(t.message);return t.value},enabled:e.topics.held>0}),o=I({mutationFn:e=>e(),onSuccess:e=>{e.ok||i(e.message,`error`)},onError:e=>i(`The topics weren't changed: ${e.message} Try again in a moment.`,`error`),onSettled:async()=>{await Promise.all([r.invalidateQueries({queryKey:DT}),r.invalidateQueries({queryKey:BT}),r.invalidateQueries({queryKey:MT(e.id)})])}}),s=e.topics.held>0?a.data??[]:[],c=()=>o.mutate(()=>LT(n,e.id));cb({id:`calendar.approve-all.${e.id}`,title:`Queue all suggested topics`,group:`Calendar`,context:e.name,keywords:[`approve`,`suggestions`,`topics`],run:c});let l=e.topics.generatingSince!==null,u=e.topicGeneration.mode===`hold`;return(0,h.jsxs)(`section`,{"aria-label":`Suggested topics for ${e.name}`,className:`flex flex-col gap-3`,children:[(0,h.jsx)(U,{title:t?`Suggested topics`:e.name,kicker:t?e.name:void 0,meta:`From the series brief · not made or queued before`,info:`planning.schedule.held`,children:s.length>0?(0,h.jsx)(z,{size:`small`,variant:`secondary`,disabled:o.isPending,onClick:c,children:`Queue all ${String(s.length)}`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(H,{id:`planning.schedule.generate-now`,label:`Suggest topics now`}),(0,h.jsx)(z,{size:`small`,variant:`quiet`,disabled:o.isPending||l,disabledReason:l?`Slopify is suggesting topics now.`:`Working…`,onClick:()=>o.mutate(()=>FT(n,e.id)),children:l?`Suggesting…`:`Suggest topics now`})]})}),(0,h.jsx)(qZ,{schedule:e,title:`The last suggestion failed.`,retry:{run:()=>o.mutate(()=>FT(n,e.id)),busy:o.isPending||l}}),a.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:`The suggestions didn't load: ${a.error.message} Reload the page to try again.`}),s.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:l?`Slopify is asking for new topics. They appear here when it finishes.`:`No suggestions are waiting.`}):(0,h.jsx)(KL,{label:`Suggestions for ${e.name}`,children:s.map(t=>(0,h.jsx)(qL,{title:t.title,meta:wG(t.values),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{size:`small`,variant:`quiet`,disabled:o.isPending,onClick:()=>o.mutate(()=>IT(n,e.id,t.id)),"aria-label":`Queue ${t.title}`,children:`Queue`}),(0,h.jsx)(Nv,{size:`small`,label:`Reject ${t.title}`,disabled:o.isPending,onClick:()=>o.mutate(()=>lce(n,e.id,t.id)),children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})},t.id))}),(0,h.jsx)(fM,{title:`Keeps at least ${String(e.topicGeneration.keepAtLeast)} ${e.topicGeneration.keepAtLeast===1?`topic`:`topics`} queued.`,children:u?`New suggestions wait here for you. Change this under Schedules → Edit.`:`New suggestions join the queue straight away. Change this under Schedules → Edit.`})]})}function ebe(e,t){if(e.kind===`move`)return{kind:`move`,scheduleId:e.scheduleId,baseVersion:t.source.version,from:e.to,to:e.from};let n=t.target??t.source;return{kind:`transfer`,scheduleId:e.targetId,baseVersion:n.version,index:e.position??n.items.length-1,targetId:e.scheduleId,position:e.index}}function tbe(e,t){if(t.kind!==`move`)return e;let n=e.runs.filter(e=>e.scheduleId===t.scheduleId&&e.index!==null).toSorted((e,t)=>(e.index??0)-(t.index??0)),r=n.map(nbe),[i]=r.splice(t.from,1);if(i===void 0)return e;r.splice(t.to,0,i);let a=new Map(n.map((e,t)=>[e,r[t]]));return{...e,runs:e.runs.map(e=>{let t=a.get(e);return t===void 0?e:{...e,...t}})}}function nbe(e){return{topic:e.topic,topicSource:e.topicSource,renderedTitle:e.renderedTitle,prepared:e.prepared}}function rbe(e,t){let{api:n}=B(),r=_(),i=Lv(),a=I({mutationFn:async({drop:e})=>{if(e.kind===`move`){let t=await RT(n,e.scheduleId,{baseVersion:e.baseVersion,from:e.from,to:e.to});return t.ok?{ok:!0,value:{source:t.value}}:t}return dce(n,e.scheduleId,{baseVersion:e.baseVersion,index:e.index,targetId:e.targetId,...e.position===void 0?{}:{position:e.position}})},onMutate:async({drop:n})=>{await r.cancelQueries({queryKey:e});let i=r.getQueryData(e);return i!==void 0&&r.setQueryData(e,tbe(i,n)),t(null),{before:i}},onSuccess:(n,o,s)=>{if(!n.ok){s.before!==void 0&&r.setQueryData(e,s.before),t(`${o.title} wasn't moved: ${n.message} The calendar shows where it is now; move it again if you still want to.`);return}if(o.undo===!0){i(`${o.title} is back where it was.`,`success`);return}i(`Moved ${o.title} to ${o.where}.`,`success`,{label:`Undo`,run:()=>a.mutate({drop:ebe(o.drop,n.value),title:o.title,where:``,undo:!0})})},onError:(n,i,a)=>{a?.before!==void 0&&r.setQueryData(e,a.before),t(`${i.title} wasn't moved: ${n.message} The calendar has been read again; try the move once more.`)},onSettled:async()=>{await Promise.all([r.invalidateQueries({queryKey:BT}),r.invalidateQueries({queryKey:DT})])}});return a}var XZ=[`trash`];async function ZZ(e){return(await L(await e.client.trash.$get())).items}async function QZ(e,t,n){return(await L(await e.client.trash[`:kind`][`:id`].restore.$post({param:{kind:t,id:n}}))).restored}async function ibe(e,t,n){let r=await e.client.trash[`:kind`][`:id`].$delete({param:{kind:t,id:n}});if(!r.ok)throw await po(r)}async function $Z(e,t){return L(await e.client.trash.bulk.restore.$post({json:{items:[...t]}}))}async function abe(e,t){return L(await e.client.trash.bulk.delete.$post({json:{items:[...t]}}))}var eQ=[`batch-queue`];function obe(){let{api:e}=B(),t=F({queryKey:eQ,queryFn:async()=>L(await e.fetch(`${e.origin}/api/projects/queue`)),refetchInterval:2e3,retry:!1}),n=F(_y(e)),r=t.data?.queue.length,i=r===void 0?t.error===null?`…`:`?`:String(r);return(0,h.jsxs)(jy,{children:[(0,h.jsx)(My,{asChild:!0,children:(0,h.jsxs)(z,{variant:`quiet`,disabled:r===0&&t.error===null,disabledReason:`Nothing is queued`,"aria-label":r===void 0?t.error===null?`Video queue: loading`:`Video queue: didn't load`:`Video queue: ${String(r)} remaining`,children:[(0,h.jsx)(il,{"aria-hidden":`true`,className:`size-4`}),(0,h.jsxs)(`span`,{className:`tabular-nums`,children:[`Queue · `,i]})]})}),(0,h.jsxs)(Ny,{align:`end`,className:`p-0`,children:[(0,h.jsx)(`p`,{className:`border-b border-line px-3 py-2 text-small text-ink-2`,children:Oy(`play.queue`).body}),(0,h.jsx)(`div`,{className:`px-3 py-2 empty:hidden`,children:(0,h.jsx)(NL,{query:t,what:`The video queue`,compact:!0,loading:null,children:()=>null})}),(0,h.jsx)(sbe,{queue:t.data?.queue??[],projects:n.data?.projects})]})]})}function sbe({queue:e,projects:t}){let n=e.filter(e=>e.state===`queued`);return(0,h.jsx)(`ol`,{className:`max-h-60 overflow-y-auto px-4 py-2`,children:e.map((e,r)=>{let i=t?.find(t=>t.id===e.projectId),a=i?.title??`Video`;return(0,h.jsxs)(`li`,{className:`flex items-center justify-between gap-2 py-1 text-small`,children:[(0,h.jsxs)(pa,{className:`min-w-0 truncate`,to:`/projects/$projectId`,params:{projectId:e.projectId},children:[r+1,`. `,a]}),(0,h.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-ink-2`,children:[i?.status===`paused`?`Paused`:e.state===`active`?`Active`:`Queued`,e.state===`queued`?(0,h.jsx)(tQ,{projectId:e.projectId,title:a,place:n.indexOf(e),waiting:n.length}):null]})]},e.projectId)})})}function tQ({projectId:e,title:t,place:n,waiting:r}){let{api:i}=B(),a=_(),o=Lv(),s=()=>{a.invalidateQueries({queryKey:eQ}),a.invalidateQueries({queryKey:[`projects`]}),a.invalidateQueries({queryKey:[`calendar`]})},c=I({mutationFn:t=>cbe(i,e,t),onSuccess:s,onError:e=>{s(),o(`${t} wasn't moved: ${e.message}`,`error`)}}),l=I({mutationFn:()=>Fo(i,e),onSuccess:()=>{s(),o(`${t} left the queue and is in Settings → Trash.`,`success`,{label:`Undo`,run:()=>void QZ(i,`project`,e).then(s,e=>o(`${t} wasn't put back: ${e.message} Restore it from Settings → Trash.`,`error`))})},onError:e=>o(`${t} wasn't removed: ${e.message}`,`error`)}),u=c.isPending||l.isPending;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Nv,{size:`small`,label:`Move ${t} earlier in the queue`,disabled:u||n<=0,onClick:()=>c.mutate(-1),children:(0,h.jsx)(wc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Nv,{size:`small`,label:`Move ${t} later in the queue`,disabled:u||n>=r-1,onClick:()=>c.mutate(1),children:(0,h.jsx)(bc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(Nv,{size:`small`,label:`Remove ${t} from the queue`,disabled:u,onClick:()=>l.mutate(),children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})}async function cbe(e,t,n){return L(await e.fetch(`${e.origin}/api/projects/queue/${encodeURIComponent(t)}/move`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({by:n})}))}var nQ=`sl-tab inline-flex items-center gap-[6px]`;function rQ({items:e,value:t,onChange:n,label:r,idPrefix:i,trailing:a,className:o}){let s=(0,m.useRef)(null);return fG(s,t),(0,h.jsxs)(`div`,{className:R(`flex min-w-0 items-end gap-3 border-b border-line`,o),"data-slot":`tabs`,children:[(0,h.jsx)(`div`,{ref:s,role:`tablist`,"aria-label":r,onKeyDown:r=>{let a=e.filter(e=>!e.disabled),o=a.findIndex(e=>e.id===t),c=r.key===`ArrowRight`?a[(o+1)%a.length]:r.key===`ArrowLeft`?a[(o-1+a.length)%a.length]:r.key===`Home`?a[0]:r.key===`End`?a[a.length-1]:void 0;c&&(r.preventDefault(),n(c.id),s.current?.querySelector(`#${i}-tab-${c.id}`)?.focus())},className:`sl-tabs min-w-0 flex-1 border-b-0`,children:e.map(e=>(0,h.jsxs)(`button`,{id:`${i}-tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":e.id===t,"aria-controls":`${i}-panel-${e.id}`,tabIndex:e.id===t?0:-1,disabled:e.disabled,onClick:()=>n(e.id),className:nQ,children:[e.label,e.badge===void 0?null:(0,h.jsx)(`span`,{className:`sl-tab__count ml-0`,children:e.badge})]},e.id))}),a?(0,h.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 pb-1`,children:a}):null]})}function lbe({items:e,label:t,className:n}){let r=(0,m.useRef)(null);return fG(r,Ha({select:e=>e.pathname})),(0,h.jsx)(`nav`,{ref:r,"aria-label":t,className:R(`sl-tabs min-w-0`,n),children:e.map(e=>(0,h.jsx)(pa,{to:e.to,...e.search?{search:e.search}:{},activeOptions:{exact:!1,includeSearch:!1},className:nQ,activeProps:{"aria-current":`page`},children:e.label},e.to))})}function iQ({idPrefix:e,id:t,active:n,children:r,className:i}){return(0,h.jsx)(`div`,{id:`${e}-panel-${t}`,role:`tabpanel`,"aria-labelledby":`${e}-tab-${t}`,hidden:!n,className:i,children:r})}function aQ({title:e,children:t,actions:n,className:r}){return(0,h.jsxs)(`div`,{className:R(`sl-empty`,r),"data-slot":`empty-state`,children:[(0,h.jsx)(`h2`,{className:`sl-section-head__title`,children:e}),t===void 0?null:(0,h.jsx)(`p`,{children:t}),n===void 0?null:(0,h.jsx)(`div`,{className:`sl-btn-row`,children:n})]})}function oQ(e){return e.channelId??`00000000-0000-4000-8000-000000000001`}function ube({channelId:e}){let{api:t}=B(),n=_(),r=F(AO(t)),i=F(Xy(t)),a=I({mutationFn:e=>xre(t,e.templateId,e.channelId),onSettled:()=>Promise.all([n.invalidateQueries({queryKey:EO}),n.invalidateQueries({queryKey:Ky})])}),o=(r.data??[]).filter(t=>oQ(t)===e);return(0,h.jsxs)(`div`,{...Py,children:[(0,h.jsxs)(`p`,{className:`m-0 mb-4 max-w-[68ch] text-small text-ink-2`,children:[`Runs from these templates use this channel's brand kit and cast. Save new ones from Play in`,` `,(0,h.jsx)(pa,{to:`/templates`,className:`underline`,children:`Library → Templates`}),`. Move to sends a template and its schedules to another channel.`,` `,(0,h.jsx)(H,{id:`planning.channel.template-move`,className:`-my-1 align-middle`})]}),(0,h.jsx)(SR,{tone:a.error||r.error?`error`:`info`,className:`mb-2`,children:a.error?.message??r.error?.message}),r.data&&o.length===0?(0,h.jsx)(aQ,{title:`No templates in this channel`,children:`Pick this channel on Play, then save the setup as a template, or move one here from another channel.`}):null,o.length>0?(0,h.jsx)(KL,{label:`Channel templates`,className:`[&_.sl-row__actions]:flex-wrap`,children:o.map(t=>(0,h.jsx)(qL,{title:t.name,meta:`Version ${String(t.version)}`,actions:(0,h.jsxs)(`span`,{className:`flex items-center gap-2 text-small text-ink-2`,children:[`Move to`,(0,h.jsx)(sL,{"aria-label":`Channel of ${t.name}`,value:e,disabled:a.isPending,onChange:e=>a.mutate({templateId:t.id,channelId:e.target.value}),options:(i.data??[]).map(e=>({value:e.id,label:e.name}))})]})},t.id))}):null]})}function dbe({channelId:e}){let{api:t}=B(),n=F(AO(t)),r=F(OT(t)),i=new Set((n.data??[]).filter(t=>oQ(t)===e).map(e=>e.id)),a=(r.data??[]).filter(e=>e.deletedAt===null&&i.has(e.templateId));return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`p`,{className:`m-0 mb-4 max-w-[68ch] text-small text-ink-2`,children:[`A schedule belongs to the channel of the template it runs. Create and change schedules in`,` `,(0,h.jsx)(pa,{to:`/calendar`,search:{tab:`schedules`},className:`underline`,children:`Calendar → Schedules`}),`.`]}),(0,h.jsx)(SR,{tone:r.error?`error`:`info`,className:`mb-2`,children:r.error?.message}),r.data&&a.length===0?(0,h.jsx)(aQ,{title:`No schedules run this channel's templates`,children:`Make one in Calendar → Schedules from one of this channel's templates.`}):null,a.length>0?(0,h.jsx)(KL,{label:`Channel schedules`,children:a.map(e=>(0,h.jsx)(qL,{title:(0,h.jsx)(KO,{to:`/calendar`,search:{tab:`schedules`,schedule:e.id},children:e.name}),meta:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(tk,{tone:BL[e.status].tone,children:BL[e.status].word}),` · ${e.nextRunAt===null?`No next run`:`Next run ${WZ(e.nextRunAt,e.timezone)}`} · ${String(e.items.length)} queued`]})},e.id))}):null]})}function sQ(e,t,n){let r=new Intl.NumberFormat(`en-US`),i=e-t,a=`${r.format(e)} of ${r.format(t)} ${n}`;return i>0?`${a}: ${r.format(i)} over the limit, shorten it to save.`:a}function cQ(e){return $E(e)?`script`:`article`}function fbe(e){let{form:t}=e,n=[],r=[];if(pQ(n,t.title),cD(t)&&pQ(n,dQ(e.prompts,`narration`,t.narrationPrompt??``)),t.sources.article===`generate`&&pQ(n,dQ(e.prompts,cQ(t),t.articlePrompt)),t.sources.audio===`generate`&&(pQ(n,fQ(e.entries,`intro`,t.intro)),pQ(n,fQ(e.entries,`outro`,t.outro))),lD(t)&&pQ(n,dQ(e.prompts,`description`,t.descriptionPrompt??``)),$k(t)&&(pQ(n,dQ(e.prompts,`shorts`,t.shorts?.prompt??``)),pQ(r,dQ(e.prompts,`image`,t.shorts?.imagePrompt??``))),t.sources.images===`generate`){for(let n of t.imagePrompts)pQ(r,dQ(e.prompts,`image`,n.name));t.reference?.source===`prompt`&&pQ(r,dQ(e.prompts,`image`,t.reference.prompt))}return(t.sources.thumbnail===`from_prompt`||t.sources.thumbnail===`prompt_by_llm`)&&pQ(r,dQ(e.prompts,`thumbnail`,t.thumbnailPrompt)),XW(n,r)}function pbe(e){let t=fbe(e),n={form:e.form,entries:e.entries,slots:t.map(e=>e.name),silenceGapSeconds:e.silenceGapSeconds},r=iA(n),i=ule({draft:r,staged:Tue(e.form.provided),requiredSlots:n.slots}),a=Qk(r.subtitles??e.form.subtitles)?i:{ok:!1,fields:[...i.ok?[]:i.fields,{field:`subtitles.fontSize`,message:`Choose a whole subtitle font size from 16 to 120.`}]};return{fields:t,draft:r,result:a,blocker:mbe(e.form,a)}}var lQ=`sources,provided.research,articlePrompt,provided.article,audio,provided.audio,voices,narrationPrompt,imagePrompts,images,provided.images,reference,provided.reference,thumbnailPrompt,provided.thumbnail,subtitles,title,intro,outro,llm,values,silenceGapSeconds,edgeSilenceSeconds,imageSeconds,zoomPercent,motionStyle,youtubeDescription,descriptionPrompt,shorts.enabled,shorts.count,shorts.minSeconds,shorts.maxSeconds,shorts.prompt,shorts.imagePrompt,shorts.speed,shorts.musicVolume,shorts.music,shorts.fullVideoLink,videoEdit.transitionSeconds,videoEdit.chapterCards,videoEdit.animate,videoEdit.animateEvery,videoEdit.animateModel,ambientBed,sentencePauseSeconds,paragraphPauseSeconds,loudness.videoLufs,loudness.audioFilesLufs`.split(`,`);function mbe(e,t){let n=hbe(e);if(n!==void 0)return n;if(t.ok)return;let r=[...t.fields].sort((e,t)=>uQ(e.field)-uQ(t.field))[0];return r===void 0?void 0:{field:r.field,hint:gbe(e,r)}}function hbe(e){let{sources:t,provided:n}=e,r=[];if(t.audio===`provide`&&n.audio!==void 0&&r.push(n.audio),t.images===`provide`&&r.push(...n.images),t.thumbnail===`provide`&&n.thumbnail!==void 0&&r.push(n.thumbnail),t.images===`generate`&&e.reference?.source===`provide`&&n.reference!==void 0&&r.push(n.reference),$k(e)&&n.shortsMusic!==void 0&&r.push(n.shortsMusic),eA(e)&&n.ambientBed!==void 0&&r.push(n.ambientBed),r.some(e=>e.error!==void 0))return{field:`provided`,hint:`Remove the upload that failed to play`};if(r.some(e=>e.file===void 0))return{field:`provided`,hint:`Wait for the uploads to finish to play`}}function uQ(e){let t=lQ.length;for(let[n,r]of lQ.entries())(e===r||e.startsWith(`${r}.`))&&n<t&&(t=n);return t}function gbe(e,t){if(t.field.startsWith(`values.`))return`Fill ${t.field.slice(7)} to play`;if(t.field.startsWith(`imagePrompts.`))return t.field.endsWith(`.number`)?`Set a Number between 1 and 20 to play`:`Pick an image prompt to play`;switch(t.field){case`title`:return e.title.trim()===``?`Name the video to play`:`Shorten the title to 200 characters to play`;case`imagePrompts`:return e.imagePrompts.length===0?`Tick an image prompt to play`:`Lower the Numbers to play: a run makes at most 60 images`;case`llm`:return`Pick an LLM provider and model to play`;case`articlePrompt`:return cQ(e)===`script`?`Pick a script prompt to play`:`Pick an article prompt to play`;case`audio`:return`Pick a narration provider to play`;case`audio.voice`:return`Pick a voice to play`;case`images`:return`Pick an image provider and model to play`;case`thumbnailPrompt`:return`Pick a thumbnail prompt to play`;case`youtubeDescription`:return`Turn narration on, or the YouTube description off, to play`;case`shorts.enabled`:return`Turn narration on, or Shorts off, to play`;case`shorts.count`:return`Set how many shorts to make to play`;case`shorts.minSeconds`:case`shorts.maxSeconds`:return`Set the shorts' length to play`;case`shorts.speed`:return`Choose the shorts' speed to play`;case`shorts.musicVolume`:return`Set the shorts' music volume to play`;case`shorts.music`:return`Attach the shorts' background music again, or remove it, to play`;case`shorts.fullVideoLink`:return`Fix the full video link to play`;case`provided.research`:return`Paste your text under Article to play`;case`provided.article`:return`Paste the article to play`;case`provided.audio`:return`Attach the narration audio to play`;case`provided.images`:return e.provided.images.length>60?`Remove images to play: a run holds at most 60`:`Attach at least one image to play`;case`provided.thumbnail`:return`Attach the thumbnail image to play`;case`reference.prompt`:return`Pick the establishing image's prompt to play`;case`provided.reference`:return`Attach the establishing image to play`;default:return t.message}}function dQ(e,t,n){if(n!==``)return e.find(e=>e.kind===t&&e.name===n)?.body}function fQ(e,t,n){if(n!==``)return e.find(e=>e.category===t&&e.name===n)?.body}function pQ(e,t){t!==void 0&&e.push(t)}function mQ(e){let t=new Map,n=(e,n)=>{if(e)for(let r of JW(e).names){let e=t.get(r)??[];e.includes(n)||e.push(n),t.set(r,e)}},{form:r,prompts:i,entries:a}=e;if(n(r.title,`Project title`),cD(r)&&n(dQ(i,`narration`,r.narrationPrompt??``),`Narration Preparation`),r.sources.article===`generate`&&n(dQ(i,cQ(r),r.articlePrompt),`Article`),r.sources.images===`generate`){for(let e of r.imagePrompts)n(dQ(i,`image`,e.name),`Image: ${e.name}`);r.reference?.source===`prompt`&&n(dQ(i,`image`,r.reference.prompt),`Establishing image`)}if((r.sources.thumbnail===`from_prompt`||r.sources.thumbnail===`prompt_by_llm`)&&n(dQ(i,`thumbnail`,r.thumbnailPrompt),`Thumbnail`),r.sources.audio===`generate`)for(let e of[`intro`,`outro`])n(fQ(a,e,r[e]),e===`intro`?`Intro`:`Outro`);return lD(r)&&n(dQ(i,`description`,r.descriptionPrompt??``),`YouTube description`),$k(r)&&(n(dQ(i,`shorts`,r.shorts?.prompt??``),`Shorts`),n(dQ(i,`image`,r.shorts?.imagePrompt??``),`Shorts images`)),t}var hQ=[`name`,`template`,`once`,`time`,`weekdays`,`timezone`,`spend`,`topics`,`brief`,`generation`],_be={name:`schedule-name`,template:`schedule-template`,once:`schedule-once`,time:`schedule-time`,weekdays:`schedule-weekdays`,timezone:`schedule-timezone`,spend:`schedule-spend`,topics:`schedule-topics`,brief:`schedule-brief`,generation:`schedule-generation`},vbe={name:`Name`,template:`Template`,once:`Run at`,time:`Local time`,weekdays:`Weekdays`,timezone:`Timezone`,spend:`Spend ceiling`,topics:`Topics`,brief:`Series brief`,generation:`Topic generation`};function ybe(e){let t={};return e.name.trim()===``&&(t.name=`Give the schedule a name.`),e.templateChosen||(t.template=`Choose the template each run starts from.`),e.kind===`once`&&e.onceAt===``&&(t.once=`Pick the date and time of the one run.`),e.kind!==`once`&&e.time===``&&(t.time=`Pick the time of day runs start.`),e.kind===`weekly`&&e.days.length===0&&(t.weekdays=`Choose at least one weekday for a weekly schedule.`),dT(e.timezone.trim())||(t.timezone=`Enter a timezone name like Europe/Tirane or America/New_York; start typing to see the list.`),gQ(e.spend)===void 0&&(t.spend=`Enter the ceiling in US dollars, such as 5 or 2.50, or leave it empty for no ceiling.`),e.topicProblems.length>0?t.topics=`Fix the topics first. ${e.topicProblems.slice(0,3).join(` `)}`:e.topicCount>500&&(t.topics=`Keep the list to 500 topics or fewer; it has ${String(e.topicCount)}.`),e.brief.trim().length>4e3&&(t.brief=`Keep the series brief to ${String(_T)} characters or fewer.`),e.generationLlm!==null&&(e.generationLlm.provider===``||e.generationLlm.model===``)&&(t.generation=`Pick both a provider and a model for topic generation, or tick Use the template's LLM.`),t}function bbe(e){return hQ.find(t=>e[t]!==void 0)}function xbe(e){return hQ.filter(t=>e[t]!==void 0).map(t=>`${vbe[t]}: ${e[t]??``}`).join(` `)}function gQ(e){let t=e.trim().replace(/^\$/,``);if(t===``)return null;if(/^\d+(\.\d{1,2})?$/.test(t))return Math.round(Number(t)*100)}function Sbe(e){return e==null?``:e%100==0?String(e/100):(e/100).toFixed(2)}function Cbe(){try{return typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]}catch{return[]}}var wbe=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],_Q=J({day:K().int().min(0).max(6),time:G().regex(/^([01]\d|2[0-3]):[0-5]\d$/)}),Tbe=J({name:G().trim().min(1).max(20),series:G().trim().max(100).default(``),long:_Q,shorts:q(_Q).max(10),schedule:G().optional(),runDay:K().int().min(0).max(6).optional(),timeZone:G().optional(),label:G().optional()});J({timeZone:G().min(1).max(100),rows:q(Tbe).max(14)});var Ebe=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],Dbe=[1,2,3,4,5,6,0];function vQ(e,t){return{day:(e+1+Math.floor(t/2))%7,time:t%2==0?`12:00`:`17:00`}}function Obe(e,t){return{day:e,long:{day:e,time:`20:00`},shorts:Array.from({length:t},(t,n)=>vQ(e,n))}}function yQ(e,t,n){return Dbe.filter(e=>t.includes(e)).map(t=>{let r=e.find(e=>e.day===t)??Obe(t,n);return{...r,shorts:Array.from({length:n},(e,n)=>r.shorts[n]??vQ(t,n))}})}function bQ({value:e,label:t,onChange:n}){return(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`w-[64px] shrink-0 text-small text-ink-3`,children:t}),(0,h.jsx)(sL,{"aria-label":`${t}: day`,className:`w-[84px]`,value:String(e.day),onChange:t=>n({...e,day:Number(t.currentTarget.value)}),options:wbe.map((e,t)=>({value:String(t),label:e}))}),(0,h.jsx)(X,{"aria-label":`${t}: time`,type:`time`,className:`w-[124px]`,value:e.time,onChange:t=>n({...e,time:t.currentTarget.value||e.time})})]})}function kbe({releases:e,onReleases:t,runDays:n,shorts:r,once:i,timezone:a}){let o=e===null?[]:yQ(e,n,r),s=(e,n)=>t(o.map(t=>t.day===e?n:t));return(0,h.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-3 border-0 border-t border-line p-0 pt-5 min-[700px]:col-span-2`,...Py,children:[(0,h.jsx)(`legend`,{className:`float-left mb-1 w-full text-title-3 font-semibold`,children:`Release times`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:i?`A one-time schedule has no release times: set the project's in its Video section once it is done.`:`When each run's project goes out on YouTube, in ${a}. Each short goes out the first time its day and hour come round after the one before it. Calendar → Releases shows them, and the Studio extension types them into Studio.`}),i?null:e===null?(0,h.jsx)(`div`,{children:(0,h.jsx)(z,{variant:`secondary`,onClick:()=>t(yQ([],n,r)),disabled:n.length===0,children:`Set release times`})}):(0,h.jsxs)(h.Fragment,{children:[o.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-line pb-3 last:border-b-0`,children:[(0,h.jsxs)(`div`,{className:`text-small font-semibold`,children:[Ebe[e.day],`'s run`]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,h.jsx)(bQ,{label:`Video`,value:e.long,onChange:t=>s(e.day,{...e,long:t})}),e.shorts.map((t,n)=>(0,h.jsx)(bQ,{label:`Short ${String(n+1)}`,value:t,onChange:t=>s(e.day,{...e,shorts:e.shorts.map((e,r)=>r===n?t:e)})},n))]})]},e.day)),r===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`The template makes no shorts, so only the long video has a time.`}):null,(0,h.jsx)(`div`,{children:(0,h.jsx)(z,{variant:`quiet`,onClick:()=>t(null),children:`Set no release times`})})]})]})}function xQ(e){let t=[e.feeds.length===0?`Not used by any picked prompt`:`Feeds ${e.feeds.join(` · `)}`,...e.topic?[`left empty in templates`]:[]].join(` · `);return e.note===void 0?t:`${t}. ${e.note}`}function SQ({keywords:e,onChange:t,problem:n,fieldPrefix:r=`values`,empty:i,label:a=e=>e,inputLabel:o,tip:s=`play.keyword`,maxLength:c=200}){if(e.length===0)return i===void 0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:i});let l=xQ;return t===void 0?(0,h.jsx)(KL,{label:`Keywords`,children:e.map(e=>(0,h.jsx)(qL,{title:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`code`,{className:`sl-code`,children:`{{${e.name}}}`}),` `,e.value===``?(0,h.jsx)(`span`,{className:`text-ink-3`,children:e.topic?`the topic`:`empty`}):e.value]}),meta:l(e)},e.name))}):(0,h.jsx)(`div`,{"data-tour":`play-keywords`,className:`grid min-w-0 grid-cols-1 gap-4 min-[700px]:grid-cols-2`,children:e.map(e=>(0,h.jsx)(iL,{label:a(e.name),tip:s,help:l(e),error:n?.(`${r}.${e.name}`),children:(0,h.jsx)(X,{"data-play-field":`${r}.${e.name}`,value:e.value,maxLength:c,...o===void 0?{}:{"aria-label":o(e.name)},spellCheck:e.topic===!0,"aria-invalid":n?.(`${r}.${e.name}`)!==void 0,onChange:n=>t(e.name,n.target.value)})},e.name))})}var CQ={lines:`One per line`,table:`Table`,yaml:`YAML / JSON`};function wQ(e){return{mode:`lines`,rows:e,lines:lG(e),base:e,yaml:``,columns:TQ(e,[])}}function TQ(e,t){return[...new Set([...t,...e.flatMap(e=>Object.keys(e.values))])]}function EQ(e){return e.keywords.filter(t=>t!==e.topicKeyword&&(e.everyRun[t]??``).trim()===``)}function DQ(e,t){if(t.form===void 0)return{rows:e.rows,problems:[]};if(e.mode===`yaml`){let n=uG(e.yaml,{keywords:t.keywords,topicKeyword:t.topicKeyword,required:EQ(t)});return n.ok?{rows:n.rows,problems:[]}:{rows:[],problems:n.problems}}let n=e.rows.map(e=>({title:e.title.trim(),values:Object.fromEntries(Object.entries(e.values).filter(([,e])=>e!==``))}));return{rows:n,problems:oG(n,{keywords:t.keywords,topicKeyword:t.topicKeyword,...e.mode===`table`?{required:EQ(t)}:{},kept:t.kept})}}function Abe(e,t,n){if(t===e.mode)return{queue:e,problems:[]};let r=e.rows;if(e.mode===`yaml`){let t=uG(e.yaml,{keywords:n.keywords.length===0?Object.keys(n.everyRun):n.keywords,topicKeyword:n.topicKeyword});if(!t.ok)return{queue:e,problems:t.problems};r=t.rows}return{queue:{...e,mode:t,rows:r,lines:t===`lines`?lG(r):e.lines,base:t===`lines`?r:e.base,yaml:t===`yaml`?dG(r,n.topicKeyword):e.yaml,columns:TQ(r,e.columns)},problems:[]}}function OQ(e,t,n){return{...e,rows:t,lines:e.mode===`lines`?lG(t):e.lines,base:e.mode===`lines`?t:e.base,yaml:e.mode===`yaml`?dG(t,n):e.yaml,columns:TQ(t,e.columns)}}function jbe(e,t,n){if(!/\.(ya?ml|json)$/i.test(e))return{ok:!0,rows:cG(t,[])};let r=uG(t,{keywords:n.keywords.length===0?Object.keys(n.everyRun):n.keywords,topicKeyword:n.topicKeyword});return r.ok?{ok:!0,rows:r.rows}:{ok:!1,problems:r.problems}}var kQ={"aria-hidden":!0,strokeWidth:1.75};function AQ(e,t,n){if(!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return!1;e.preventDefault();let r=e.key===`ArrowUp`;return t.busy||r&&t.index===0||!r&&t.index===t.count-1||n(t.index+(r?-1:1),r?`up`:`down`),!0}var jQ=`Alt+ArrowUp Alt+ArrowDown`;function MQ({name:e,index:t,count:n,busy:r,onMove:i,onRemove:a,onInsertBelow:o,onDuplicate:s}){let c=(0,m.useRef)(!1),l=t===0,u=t===n-1;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Nv,{size:`small`,label:`Move ${e} up`,disabled:r||l,onClick:()=>i(t-1,`up`),children:(0,h.jsx)(wc,{...kQ})}),(0,h.jsx)(Nv,{size:`small`,label:`Move ${e} down`,disabled:r||u,onClick:()=>i(t+1,`down`),children:(0,h.jsx)(bc,{...kQ})}),(0,h.jsx)(Nv,{size:`small`,label:`Remove ${e}`,disabled:r,onClick:a,children:(0,h.jsx)(kl,{...kQ})}),(0,h.jsxs)(YO,{children:[(0,h.jsx)(XO,{asChild:!0,children:(0,h.jsx)(Nv,{size:`small`,label:`More for ${e}`,disabled:r,children:(0,h.jsx)(Hc,{...kQ})})}),(0,h.jsxs)(ZO,{onCloseAutoFocus:e=>{c.current&&(c.current=!1,e.preventDefault(),o())},children:[(0,h.jsxs)(QO,{disabled:l,onSelect:()=>i(0,`to the top`),children:[(0,h.jsx)(Cc,{...kQ,className:`size-4`}),`Move to top`]}),(0,h.jsxs)(QO,{disabled:u,onSelect:()=>i(n-1,`to the bottom`),children:[(0,h.jsx)(vc,{...kQ,className:`size-4`}),`Move to bottom`]}),(0,h.jsxs)(QO,{onSelect:()=>{c.current=!0},children:[(0,h.jsx)(rl,{...kQ,className:`size-4`}),`Insert below`]}),(0,h.jsxs)(QO,{onSelect:s,children:[(0,h.jsx)(Bc,{...kQ,className:`size-4`}),`Duplicate`]})]})]})]})}function NQ(e){return e.split(/\r?\n/).map(e=>e.replace(/^\s*[-*•]\s+/,``).trim()).filter(e=>e!==``)}function PQ(e,t,n){let r=[...e],[i]=r.splice(t,1);return i===void 0||r.splice(Math.min(Math.max(n,0),r.length),0,i),r}function FQ(e,t,n){let r=Math.min(Math.max(t,0),e.length);return[...e.slice(0,r),...n,...e.slice(r)]}var IQ=0;function LQ(e){return Array.from({length:e},()=>(IQ+=1,`row-${String(IQ)}`))}function RQ(e,t,n){let r=new Map;return e.forEach((e,n)=>{let i=t[n];i!==void 0&&r.set(e.title,[...r.get(e.title)??[],i])}),n.map(e=>r.get(e.title)?.shift()??LQ(1)[0]??``)}var zQ=()=>({title:``,values:{}});function Mbe({queue:e,onQueue:t,keyword:n,addable:r,titleOf:i}){let a=Lv(),o=n===null?`Title`:`{{${n}}}`,s=(0,m.useRef)({rows:e.rows,keys:LQ(e.rows.length)});s.current.rows!==e.rows&&(s.current={rows:e.rows,keys:RQ(s.current.rows,s.current.keys,e.rows)});let c=s.current.keys,l=(0,m.useRef)(e);l.current=e;let u=vG(c),d=(0,m.useRef)(new Map),f=(0,m.useRef)(null);(0,m.useEffect)(()=>{let e=f.current;e!==null&&c.includes(e)&&(f.current=null,d.current.get(e)?.focus())},[c]);let p=(n,r,i)=>{s.current={rows:n,keys:r},i!==void 0&&(f.current=i),t({...e,rows:n})},g=(t,n)=>{let r=LQ(n.length);p(FQ(e.rows,t,n),FQ(c,t,r),r[0])},_=(t,n)=>p(e.rows.map((e,r)=>r===t?n:e),c),v=(t,n)=>{let r=c[t];p(PQ(e.rows,t,n),PQ(c,t,n),r)},y=r=>{let i=[...new Set(r)].filter(e=>e>=0).sort((e,t)=>e-t),o=i.flatMap(t=>{let n=e.rows[t];return n===void 0?[]:[{at:t,row:n}]});if(o.length===0)return;let s=new Set(i);p(e.rows.filter((e,t)=>!s.has(t)),c.filter((e,t)=>!s.has(t)));let u=o[0]?.row.title.trim()??``;a(o.length===1?`Removed ${u===``?`an empty topic`:`“${u}”`}. Save the schedule to keep it.`:`Removed ${CG(o.length,`topic`,`topics`)}. Save the schedule to keep it.`,`success`,{label:`Undo`,run:()=>{let e=[...l.current.rows];for(let{at:t,row:n}of o)e=FQ(e,t,[n]);t(OQ(l.current,e,n))}})};return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,...Py,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(z,{size:`small`,onClick:()=>g(e.rows.length,[zQ()]),children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add topic`]}),r.length===0?null:(0,h.jsxs)(sL,{"aria-label":`Set a keyword per topic`,value:``,className:`w-auto`,onChange:n=>{let r=n.target.value;r!==``&&t({...e,columns:[...e.columns,r]})},children:[(0,h.jsx)(`option`,{value:``,children:`Set a keyword per topic…`}),r.map(e=>(0,h.jsx)(`option`,{value:e,children:e},e))]})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,onKeyDown:u.onKeyDown,children:[e.rows.length>1?(0,h.jsx)(SG,{selection:u,total:e.rows.length,noun:[`topic`,`topics`],actions:(0,h.jsx)(z,{size:`small`,variant:`quiet`,disabled:u.count===0,disabledReason:`Tick the topics to remove`,onClick:()=>{y(u.selected.map(e=>c.indexOf(e))),u.clear()},children:`Remove selected`})}):null,(0,h.jsx)(`div`,{className:`overflow-x-auto`,children:(0,h.jsxs)(`table`,{className:`sl-table`,"aria-label":`Topics`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`th`,{scope:`col`,children:(0,h.jsx)(`span`,{className:`sr-only`,children:`Select`})}),(0,h.jsx)(`th`,{scope:`col`,children:`#`}),(0,h.jsx)(`th`,{scope:`col`,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[o,(0,h.jsx)(H,{id:`planning.schedule.topic-table`,className:`-my-1`})]})}),e.columns.map(n=>(0,h.jsx)(`th`,{scope:`col`,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`{{${n}}}`,(0,h.jsx)(Nv,{label:`Use the every-run ${n} for all topics`,size:`small`,onClick:()=>t({...e,columns:e.columns.filter(e=>e!==n),rows:e.rows.map(e=>({title:e.title,values:Object.fromEntries(Object.entries(e.values).filter(([e])=>e!==n))}))}),children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})},n)),(0,h.jsx)(`th`,{scope:`col`,children:`Project title`}),(0,h.jsx)(`th`,{scope:`col`,children:(0,h.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,h.jsx)(`tbody`,{children:e.rows.map((t,n)=>{let r=c[n]??String(n),a=t.title.trim()===``?`topic ${String(n+1)}`:t.title;return(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`td`,{children:(0,h.jsx)(bG,{selection:u,value:r,label:a})}),(0,h.jsx)(`td`,{className:`num`,children:n+1}),(0,h.jsx)(`td`,{children:(0,h.jsx)(X,{ref:e=>{e===null?d.current.delete(r):d.current.set(r,e)},"aria-label":`Topic ${String(n+1)} ${o}`,"aria-keyshortcuts":jQ,maxLength:200,value:t.title,className:`min-w-[14rem]`,onChange:e=>_(n,{...t,title:e.target.value}),onPaste:t=>{let r=NQ(t.clipboardData.getData(`text`));if(r.length<2)return;t.preventDefault();let[i=``,...a]=r,o=e.rows.map((e,t)=>t===n?{...e,title:`${e.title}${i}`}:e),s=LQ(a.length);p(FQ(o,n+1,a.map(e=>({title:e,values:{}}))),FQ(c,n+1,s),s.at(-1))},onKeyDown:t=>{AQ(t,{index:n,count:e.rows.length,busy:!1},e=>v(n,e))||t.key===`Enter`&&(t.preventDefault(),g(n+1,[zQ()]))}})}),e.columns.map(e=>(0,h.jsx)(`td`,{children:(0,h.jsx)(X,{"aria-label":`Topic ${String(n+1)} ${e}`,maxLength:$W,placeholder:`Every-run value`,value:t.values[e]??``,className:`min-w-[8rem]`,onChange:r=>_(n,{...t,values:{...t.values,[e]:r.target.value}})})},e)),(0,h.jsx)(`td`,{className:`min-w-[180px] text-small text-ink-2`,children:i(t)??`—`}),(0,h.jsx)(`td`,{children:(0,h.jsx)(`span`,{className:`flex items-center gap-1`,children:(0,h.jsx)(MQ,{name:a,index:n,count:e.rows.length,busy:!1,onMove:e=>v(n,e),onRemove:()=>y([n]),onInsertBelow:()=>g(n+1,[zQ()]),onDuplicate:()=>g(n+1,[t])})})})]},r)})})]})})]})]})}function Nbe({queue:e,onQueue:t,context:n,onKeyword:r,onValue:i,loading:a,exportName:o}){let[s,c]=(0,m.useState)([]),[l,u]=(0,m.useState)(null),{keywords:d,topicKeyword:f,form:p,everyRun:g}=n,_=e=>n.origins?.get(e)??[],v=DQ(e,n),y=e.mode===`yaml`?v.rows:e.rows,b=e=>p===void 0?void 0:nG(p,{topicKeyword:f,values:g},e),x=y[0],S=x===void 0?void 0:b(x),C=f!==null&&p?.title.includes(`{{${f}}}`)===!0,w=()=>dG(DQ(e,n).rows,f),T=()=>{let e=w();if(!navigator.clipboard){u(`Couldn't copy the list. Switch to YAML / JSON, select the text and copy it.`);return}navigator.clipboard.writeText(e).then(()=>u(`Copied ${String(y.length)} topics as YAML.`),()=>u(`Couldn't copy the list. Switch to YAML / JSON, select the text and copy it.`))},E=()=>{let e=URL.createObjectURL(new Blob([w()],{type:`application/yaml`})),t=document.createElement(`a`);t.href=e,t.download=`${(o.trim()||`schedule`).replace(/[^\w.-]+/g,`-`)}-topics.yaml`,t.click(),URL.revokeObjectURL(e),u(`Downloaded ${String(y.length)} topics as YAML.`)},D=(0,m.useRef)(null),O=async r=>{let i=jbe(r.name,await r.text(),n);if(!i.ok){u(`${r.name} wasn't imported: ${i.problems.slice(0,3).join(` `)} Fix the file and import it again, or paste its text under YAML / JSON to see every problem.`);return}if(i.rows.length===0){u(`${r.name} has no topics in it. Put one topic per line, or a YAML / JSON list.`);return}t(OQ(e,[...DQ(e,n).rows,...i.rows],f)),u(`Imported ${String(i.rows.length)} ${i.rows.length===1?`topic`:`topics`} from ${r.name}, after the ones already here.`)},k=d.filter(t=>t!==f&&!e.columns.includes(t)),A=[...s,...v.problems];return(0,h.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-3 border-0 border-t border-line p-0 pt-5 min-[700px]:col-span-2`,children:[(0,h.jsxs)(`legend`,{className:`float-left mb-1 flex w-full items-center gap-1 text-title-3 font-semibold`,children:[`Topics (optional)`,(0,h.jsx)(H,{id:`planning.schedule.topics`})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(Iy,{label:`How to write the topics`,tip:`planning.schedule.topic-format`,value:e.mode,options:Object.keys(CQ).map(e=>({value:e,label:CQ[e]})),onChange:r=>{let i=Abe(e,r,n);c(i.problems),t(i.queue)}}),(0,h.jsxs)(z,{variant:`quiet`,size:`small`,disabled:y.length===0||v.problems.length>0,disabledReason:`Add topics, and fix the problems below, first`,onClick:T,children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Copy as YAML`]}),(0,h.jsxs)(z,{variant:`quiet`,size:`small`,disabled:y.length===0||v.problems.length>0,disabledReason:`Add topics, and fix the problems below, first`,onClick:E,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Export as YAML`]}),(0,h.jsxs)(z,{variant:`quiet`,size:`small`,onClick:()=>D.current?.click(),children:[(0,h.jsx)(Cl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Import`]}),(0,h.jsx)(`input`,{ref:D,type:`file`,hidden:!0,accept:`.yaml,.yml,.json,.txt,text/plain,application/json,application/yaml`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&O(t)}}),l===null?null:(0,h.jsx)(`span`,{role:`status`,className:`text-small text-ink-2`,children:l})]}),e.mode===`lines`?(0,h.jsx)(iL,{id:`schedule-topics`,tip:`planning.schedule.topic-lines`,tipLabel:`Topics, one per line`,label:y.length===0?`One per line`:`${String(y.length)} ${y.length===1?`topic`:`topics`} · next: ${x?.title??``}`,children:(0,h.jsx)(oL,{rows:Math.min(16,Math.max(6,y.length+1)),value:e.lines,onChange:n=>t({...e,lines:n.target.value,rows:cG(n.target.value,e.base)}),placeholder:`Pyramids
|
|
272
272
|
Sphinxes
|
|
273
273
|
Obelisks`})}):e.mode===`yaml`?(0,h.jsx)(iL,{id:`schedule-topics-yaml`,label:`Topics as YAML or JSON`,tip:`planning.schedule.topic-yaml`,children:(0,h.jsx)(oL,{rows:10,className:`font-mono`,spellCheck:!1,value:e.yaml,onChange:n=>t({...e,yaml:n.target.value}),placeholder:`- ${f??`Topic`}: Cleopatra\n ${d.find(e=>e!==f)??`Min. Word Count`}: 12000\n- Hypatia`})}):(0,h.jsx)(Mbe,{queue:e,onQueue:t,keyword:f,addable:k,titleOf:b}),v.rows.length===0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,"aria-live":`polite`,children:`${sQ(v.rows.length,500,`topics`)}.`}),A.length===0?null:(0,h.jsx)(fM,{tone:`danger`,title:`These topics can't be saved yet.`,children:(0,h.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[A.slice(0,8).map(e=>(0,h.jsx)(`li`,{children:e},e)),A.length>8?(0,h.jsx)(`li`,{children:`And ${String(A.length-8)} more.`}):null]})}),e.mode===`yaml`&&v.rows.length>0?(0,h.jsxs)(`section`,{"aria-label":`Project titles`,children:[(0,h.jsx)(`p`,{className:`m-0 mb-1 text-small text-ink-2`,children:`Project titles, in order:`}),(0,h.jsxs)(`ol`,{className:`m-0 flex flex-col gap-1 pl-5 text-small`,children:[v.rows.slice(0,20).map((e,t)=>(0,h.jsx)(`li`,{children:b(e)},t)),v.rows.length>20?(0,h.jsx)(`li`,{className:`list-none text-ink-3`,children:`And ${String(v.rows.length-20)} more.`}):null]})]}):null,a?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Reading the template's keywords…`}):d.length===0?(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-3`,children:[`This template has no keywords such as `,`{{Topic}}`,`, so each topic becomes the project's title.`]}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(`div`,{className:`grid gap-4 min-[700px]:grid-cols-2`,children:(0,h.jsx)(iL,{label:`Each topic fills`,id:`schedule-topic-keyword`,tip:`planning.schedule.topic-keyword`,...f===null?{}:{help:xQ({feeds:_(f)})},children:(0,h.jsx)(sL,{value:f??``,onChange:e=>r(e.target.value),children:d.map(e=>(0,h.jsx)(`option`,{value:e,children:`{{${e}}}`},e))})})}),(0,h.jsx)(SQ,{keywords:d.filter(e=>e!==f).map(t=>({name:t,value:g[t]??``,feeds:_(t),...e.columns.includes(t)?{note:`Unless a topic sets its own.`}:{}})),onChange:i,fieldPrefix:`everyRun`,label:e=>`${e} (every run)`,inputLabel:e=>`${e} for every run`,tip:`planning.schedule.every-run`,maxLength:1e4})]}),e.mode===`lines`&&S!==void 0&&x!==void 0?(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Next project: `,(0,h.jsx)(`span`,{className:`font-semibold text-ink`,children:S}),f===null||C?null:(0,h.jsxs)(`span`,{className:`block text-ink-3`,children:[`The template's project title does not use `,`{{${f}}}`,`, so every project gets this title. Edit the template's title to include it.`]})]}):null]})}var Pbe=[[1,`Mon`],[2,`Tue`],[3,`Wed`],[4,`Thu`],[5,`Fri`],[6,`Sat`],[0,`Sun`]];function Fbe({templates:e,pending:t,onCreated:n,onError:r,editing:i,onCancel:a,error:o,onBusy:s}){let{api:c}=B(),[l,u]=(0,m.useState)(i?.name??``),[d,f]=(0,m.useState)(i?.templateId??``),[p,g]=(0,m.useState)(i?.cadence.kind??`daily`),[_,v]=(0,m.useState)(i?.cadence.kind===`once`?Lye(i.cadence.at,i.timezone):``),[y,b]=(0,m.useState)(i&&i.cadence.kind!==`once`?i.cadence.time:`09:00`),[x,S]=(0,m.useState)(i?.cadence.kind===`weekly`?i.cadence.days:[1,3,5]),[C,w]=(0,m.useState)(()=>i?.timezone??(Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`)),[T,E]=(0,m.useState)(i?.missedPolicy??`skip`),[D,O]=(0,m.useState)(Sbe(i?.spendLimitCents)),[k,A]=(0,m.useState)(()=>wQ(i?.items??[])),[j,M]=(0,m.useState)(i?.topicKeyword??null),[ee,N]=(0,m.useState)(i?.values??{}),[te,P]=(0,m.useState)(i?.brief??``),[ne,re]=(0,m.useState)(i?.topicGeneration??yT),[ie,ae]=(0,m.useState)((i?.releases??[]).length===0?null:i?.releases??null),[oe,se]=(0,m.useState)(!1),[ce,le]=(0,m.useState)(!1),[ue,de]=(0,m.useState)(!1),fe=(0,m.useId)(),pe=(0,m.useRef)(!1),me=(0,m.useRef)(null),he=i&&!e.some(e=>e.id===i.templateId)?[...e,{id:i.templateId,version:i.templateVersion,name:`Saved template`}]:e,ge=he.find(e=>e.id===d),_e=F({queryKey:[`project-template`,d],enabled:d!==``,queryFn:async()=>{let e=await jO(c,d);if(!e.ok)throw Error(e.message);return e.value}}),ve=_e.data?.document.form,ye=ve===void 0?void 0:mQ({form:ve,prompts:_e.data?.document.librarySnapshot?.prompts??[],entries:_e.data?.document.librarySnapshot?.entries??[]}),be=ve===void 0?[]:eG(ve),xe=j!==null&&be.includes(j)?j:be.find(e=>ve?.title.includes(`{{${e}}}`))??be[0]??null,Se=Object.fromEntries(be.filter(e=>e!==xe).map(e=>[e,ee[e]??ve?.values[e]??``])),Ce={keywords:be,topicKeyword:xe,everyRun:Se,form:ve,kept:i?.items??[],...ye===void 0?{}:{origins:ye}},we=DQ(k,Ce),Te=p===`weekly`?x:p===`daily`?[0,1,2,3,4,5,6]:[],Ee=ve!==void 0&&ve.sources.audio!==`off`&&ve.shorts?.enabled===!0?Math.max(0,Math.min(10,Number(ve.shorts.count)||0)):0,De=()=>ybe({name:l,templateChosen:ge!==void 0,kind:p,onceAt:_,time:y,days:x,timezone:C,spend:D,topicProblems:we.problems,topicCount:we.rows.length,brief:te,generationLlm:ne.llm}),Oe=ue?De():{};async function ke(e){if(e.preventDefault(),!(pe.current||t)){if(!me.current){let e=De(),t=bbe(e);if(t!==void 0){de(!0),r(xbe(e)),Ibe(_be[t]);return}}pe.current=!0,se(!0),s(!0);try{if(!me.current){if(!ge)throw Error(`Choose a template before saving the schedule.`);let e=C.trim();if(!dT(e))throw Error(`Enter a timezone name like Europe/Tirane or America/New_York.`);let t=p===`once`?{kind:p,at:Rye(_,e)}:p===`weekly`?{kind:p,time:y,days:x}:{kind:p,time:y},n=gQ(D);if(n===void 0)throw Error(`Enter the spend ceiling in US dollars, such as 5 or 2.50, or leave it empty.`);let r={id:i?.id??crypto.randomUUID(),name:l.trim(),templateId:ge.id,templateVersion:ge.version,cadence:t,timezone:e,missedPolicy:T,overlapPolicy:`skip`,spendLimitCents:n,items:we.rows,topicKeyword:xe,values:Se,brief:te.trim()===``?null:te.trim(),topicGeneration:ne,releases:ie===null||p===`once`?[]:yQ(ie,Te,Ee)};me.current=i?{...r,baseVersion:i.version,mutationId:crypto.randomUUID()}:r}let e=me.current,{id:t,...a}=e,o=`mutationId`in a?await AT(c,t,a):await kT(c,e);if(!o.ok){me.current=null,le(!1),r(o.reason===`conflict`?`${o.message} Your inputs are kept here. To load the latest saved version, cancel editing and press Edit again.`:o.message);return}me.current=null,le(!1),de(!1),u(``),A(wQ([])),n()}catch(e){le(me.current!==null),r(e instanceof Error?e.message:`The schedule wasn't saved. Try again.`)}finally{pe.current=!1,se(!1),s(me.current!==null)}}}return(0,h.jsxs)(`section`,{"aria-label":i?`Edit schedule`:`New schedule`,children:[o?(0,h.jsx)(fM,{tone:`danger`,title:`The schedule wasn't saved.`,className:`mb-4`,children:o}):null,(0,h.jsxs)(`form`,{noValidate:!0,onSubmit:e=>void ke(e),children:[(0,h.jsxs)(`fieldset`,{disabled:oe||ce||t,className:`m-0 grid min-w-0 gap-4 border-0 p-0 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(iL,{label:`Name`,id:`schedule-name`,tip:`planning.schedule.name`,error:Oe.name,children:(0,h.jsx)(X,{required:!0,value:l,onChange:e=>u(e.target.value),placeholder:`Monday morning stories`})}),(0,h.jsx)(iL,{label:`Template`,id:`schedule-template`,tip:`planning.schedule.template`,error:Oe.template,children:(0,h.jsxs)(sL,{required:!0,value:d,onChange:e=>f(e.target.value),disabled:he.length===0,children:[(0,h.jsx)(`option`,{value:``,children:`Choose a template`}),he.map(e=>(0,h.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.version]},e.id))]})}),(0,h.jsx)(iL,{label:`Cadence`,id:`schedule-cadence`,tip:`planning.schedule.cadence`,children:(0,h.jsxs)(sL,{value:p,onChange:e=>g(e.target.value===`once`?`once`:e.target.value===`weekly`?`weekly`:`daily`),children:[(0,h.jsx)(`option`,{value:`daily`,children:`Every day`}),(0,h.jsx)(`option`,{value:`weekly`,children:`Selected weekdays`}),(0,h.jsx)(`option`,{value:`once`,children:`One time`})]})}),p===`once`?(0,h.jsx)(iL,{label:`Run at`,id:`schedule-once`,tip:`planning.schedule.once-at`,error:Oe.once,children:(0,h.jsx)(X,{required:!0,type:`datetime-local`,value:_,onChange:e=>v(e.target.value)})}):(0,h.jsx)(iL,{label:`Local time`,id:`schedule-time`,tip:`planning.schedule.time`,error:Oe.time,children:(0,h.jsx)(X,{required:!0,type:`time`,value:y,onChange:e=>b(e.target.value)})}),p===`weekly`?(0,h.jsxs)(`fieldset`,{id:`schedule-weekdays`,className:`m-0 min-w-0 border-0 p-0`,"aria-invalid":Oe.weekdays!==void 0,"aria-describedby":Oe.weekdays===void 0?void 0:`schedule-weekdays-error`,...Py,children:[(0,h.jsxs)(`legend`,{className:`sl-field__label mb-2 flex items-center gap-1`,children:[`Weekdays`,(0,h.jsx)(H,{id:`planning.schedule.weekdays`,className:`-my-1`})]}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:Pbe.map(([e,t])=>(0,h.jsxs)(`label`,{className:`inline-flex items-center gap-1 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:x.includes(e),onChange:t=>S(n=>t.target.checked?[...n,e]:n.filter(t=>t!==e))}),t]},e))}),Oe.weekdays===void 0?null:(0,h.jsx)(`p`,{id:`schedule-weekdays-error`,className:`sl-field__error m-0 mt-1`,children:Oe.weekdays})]}):(0,h.jsx)(`div`,{}),(0,h.jsx)(iL,{label:`Timezone`,id:`schedule-timezone`,tip:p===`once`?`planning.schedule.timezone-once`:`planning.schedule.timezone`,help:`Start typing to pick from the list. This computer uses ${Lbe}.`,error:Oe.timezone,children:(0,h.jsx)(X,{value:C,list:fe,autoComplete:`off`,spellCheck:!1,onChange:e=>w(e.target.value),placeholder:`Europe/Tirane`})}),(0,h.jsx)(`datalist`,{id:fe,children:Cbe().map(e=>(0,h.jsx)(`option`,{value:e},e))}),(0,h.jsx)(iL,{label:`Missed run`,id:`schedule-missed`,tip:`planning.schedule.missed`,children:(0,h.jsxs)(sL,{value:T,onChange:e=>E(e.target.value===`run-once`?`run-once`:`skip`),children:[(0,h.jsx)(`option`,{value:`skip`,children:`Skip if Slopify was closed`}),(0,h.jsx)(`option`,{value:`run-once`,children:`Run once when Slopify reopens`})]})}),(0,h.jsx)(iL,{label:`Spend ceiling per run (US$, optional)`,id:`schedule-spend`,tip:`planning.schedule.spend`,tipLabel:`Spend ceiling`,help:`In dollars, such as 5 or 2.50. Empty means no ceiling.`,error:Oe.spend,children:(0,h.jsx)(X,{inputMode:`decimal`,value:D,onChange:e=>O(e.target.value),placeholder:`10.00`})}),(0,h.jsxs)(`div`,{id:`schedule-topics`,tabIndex:-1,className:`min-w-0 min-[700px]:col-span-2`,children:[(0,h.jsx)(Nbe,{queue:k,onQueue:A,context:Ce,onKeyword:M,onValue:(e,t)=>N(n=>({...n,[e]:t})),loading:d!==``&&_e.isPending,exportName:l}),Oe.topics===void 0?null:(0,h.jsx)(`p`,{className:`sl-field__error m-0 mt-2`,children:Oe.topics})]}),(0,h.jsx)(kbe,{releases:ie,onReleases:ae,runDays:Te,shorts:Ee,once:p===`once`,timezone:C}),(0,h.jsx)(Rbe,{problems:Oe,brief:te,onBrief:P,generation:ne,onGeneration:re,templateLlm:ve?.llm})]}),(0,h.jsxs)(`div`,{className:`sticky bottom-0 z-10 mt-6 flex flex-wrap gap-2 border-t border-line bg-ground py-3 max-md:bottom-[68px]`,children:[(0,h.jsx)(z,{type:`submit`,variant:`primary`,disabled:t||oe||he.length===0&&!ce,children:oe?`Saving…`:ce?`Retry save`:i?`Save changes`:`Save schedule`}),(0,h.jsx)(z,{variant:`quiet`,disabled:oe||ce,onClick:a,children:i?`Cancel editing`:`Cancel`})]})]})]})}function Ibe(e){let t=document.getElementById(e);t!==null&&(((t instanceof HTMLFieldSetElement?t.querySelector(`input, select, textarea`):t)??t).focus(),t.scrollIntoView?.({block:`center`,behavior:`smooth`}))}var Lbe=Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`;function Rbe({problems:e,brief:t,onBrief:n,generation:r,onGeneration:i,templateLlm:a}){let{api:o}=B(),s=F({...xy(o),enabled:r.mode!==`off`}),c=r.llm;return(0,h.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-3 border-0 border-t border-line p-0 pt-5 min-[700px]:col-span-2`,children:[(0,h.jsxs)(`legend`,{className:`float-left mb-1 flex w-full items-center gap-1 text-title-3 font-semibold`,children:[`Topic generation`,(0,h.jsx)(H,{id:`planning.schedule.generation`})]}),(0,h.jsx)(iL,{label:`Series brief (optional)`,id:`schedule-brief`,tip:`planning.schedule.brief`,tipLabel:`Series brief`,help:sQ(t.length,_T,`characters`),error:e.brief,children:(0,h.jsx)(oL,{rows:3,maxLength:_T,value:t,onChange:e=>n(e.target.value),placeholder:`Ancient history, documentary style. Famous rulers and places first.`})}),(0,h.jsxs)(`div`,{className:`grid gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(iL,{label:`New topics`,id:`schedule-generation`,tip:`planning.schedule.new-topics`,error:e.generation,children:(0,h.jsxs)(sL,{value:r.mode,onChange:e=>{let t=e.target.value;i({...r,mode:t===`queue`||t===`hold`?t:`off`})},children:[(0,h.jsx)(`option`,{value:`off`,children:`Off: add topics yourself`}),(0,h.jsx)(`option`,{value:`queue`,children:`Generate and queue directly`}),(0,h.jsx)(`option`,{value:`hold`,children:`Generate and hold for approval`})]})}),r.mode===`off`?null:(0,h.jsx)(iL,{label:`Keep at least this many queued`,id:`schedule-keep`,tip:`planning.schedule.keep-count`,children:(0,h.jsx)(X,{type:`number`,min:1,max:100,value:String(r.keepAtLeast),onChange:e=>{let t=Math.round(Number(e.target.value));i({...r,keepAtLeast:Number.isFinite(t)?Math.min(100,Math.max(1,t)):1})}})})]}),r.mode===`off`?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,...Py,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{className:`inline-flex items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:c===null,onChange:e=>i({...r,llm:e.target.checked?null:{provider:a?.provider??``,model:a?.model??``}})}),`Use the template's LLM`,c===null&&a!==void 0&&a.provider!==``?` (${a.provider} · ${a.model})`:``]}),(0,h.jsx)(H,{id:`planning.schedule.generation-llm`,className:`-my-1`})]}),c===null?null:(0,h.jsxs)(`div`,{className:`grid gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(vL,{label:`Provider`,family:`llm`,providers:s.data?.providers??[],value:c.provider,problem:s.error?.message,onPick:e=>i({...r,llm:{provider:e,model:``}})}),(0,h.jsx)(hL,{label:`Model`,provider:c.provider,value:c.model,problem:void 0,onPick:e=>i({...r,llm:{...c,model:e}})})]})]})]})}function zbe(e,t){let n=new Set(t);for(let t=1;;t+=1){let r=t===1?` (copy)`:` (copy ${String(t)})`,i=`${e.slice(0,200-r.length)}${r}`;if(!n.has(i))return i}}function Bbe(e,t,n){return{id:t,name:n,templateId:e.templateId,templateVersion:e.templateVersion,cadence:e.cadence,timezone:e.timezone,missedPolicy:e.missedPolicy,overlapPolicy:e.overlapPolicy,spendLimitCents:e.spendLimitCents,items:[],topicKeyword:e.topicKeyword,values:e.values,brief:e.brief,topicGeneration:e.topicGeneration,releases:e.releases}}async function Vbe(e,t,n){let r=zbe(t.name,n),i=await kT(e,Bbe(t,crypto.randomUUID(),r));if(!i.ok)return{...i,message:i.reason===`not-due`?`“${t.name}” wasn't duplicated: its one-time run has already passed. Press New schedule and choose a time in the future instead.`:`“${t.name}” wasn't duplicated: ${i.message}`};let a=await jT(e,i.value.id,`pause`,i.value.version);return a.ok?a:{...a,message:`“${r}” was made but couldn't be paused: ${a.message} Press Pause on its row before its first run.`}}var BQ={newest:`Newest first`,next:`Next run first`,name:`Name A–Z`,changed:`Recently changed`},Hbe=e=>Object.hasOwn(BQ,e);function Ube(e,t,n){let r=t.trim().toLowerCase().split(/\s+/).filter(Boolean),i=e.filter(e=>r.every(t=>e.name.toLowerCase().includes(t)));return n===`newest`?i:[...i].sort((e,t)=>n===`name`?e.name.localeCompare(t.name):n===`changed`?t.updatedAt.localeCompare(e.updatedAt):(e.nextRunAt??`~`).localeCompare(t.nextRunAt??`~`))}function Wbe({query:e,sort:t,onQuery:n,onSort:r}){return(0,h.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,...Py,children:[(0,h.jsx)(X,{type:`search`,"aria-label":`Search schedules by name`,placeholder:`Search schedules`,value:e,className:`min-w-0 flex-1`,onChange:e=>n(e.target.value)}),(0,h.jsx)(sL,{"aria-label":`Sort schedules`,value:t,className:`w-auto`,onChange:e=>{let t=e.target.value;Hbe(t)&&r(t)},children:Object.keys(BQ).map(e=>(0,h.jsx)(`option`,{value:e,children:BQ[e]},e))}),(0,h.jsx)(H,{id:`planning.schedules`})]})}function Gbe({rowKey:e,index:t,title:n,count:r,busy:i,selection:a,inputRef:o,onRename:s,onMove:c,onRemove:l,onInsertBelow:u,onDuplicate:d}){let[f,p]=(0,m.useState)(n);return(0,m.useEffect)(()=>p(n),[n]),(0,h.jsx)(qL,{lead:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(bG,{selection:a,value:e,label:n}),(0,h.jsx)(`span`,{className:`w-7 text-right text-small text-ink-3 tabular-nums`,children:t+1})]}),title:(0,h.jsx)(X,{ref:o,"aria-label":`Topic ${String(t+1)}`,"aria-keyshortcuts":jQ,maxLength:200,value:f,className:`min-w-[12rem]`,onChange:e=>p(e.target.value),onBlur:()=>s(f),onKeyDown:e=>{AQ(e,{index:t,count:r,busy:i},c)||(e.key===`Enter`?(e.preventDefault(),s(f)):e.key===`Escape`&&f!==n&&(e.preventDefault(),p(n)))}}),actions:(0,h.jsx)(MQ,{name:n,index:t,count:r,busy:i,onMove:c,onRemove:l,onInsertBelow:u,onDuplicate:d})})}function VQ({label:e,placeholder:t,buttonLabel:n,disabled:r,disabledReason:i,autoFocus:a=!1,className:o,onAdd:s,onCancel:c}){let[l,u]=(0,m.useState)(``),d=async e=>{await s(e)&&u(``)};return(0,h.jsxs)(`form`,{className:R(`flex flex-wrap items-center gap-2`,o),onSubmit:e=>{e.preventDefault(),d(NQ(l))},children:[(0,h.jsx)(X,{"aria-label":e,placeholder:t,maxLength:200,value:l,autoFocus:a,className:`min-w-0 flex-1`,onChange:e=>u(e.target.value),onPaste:e=>{let t=e.clipboardData.getData(`text`);/\r?\n/.test(t.trim())&&(e.preventDefault(),d(NQ(`${l}${t}`)))},onKeyDown:e=>{e.key===`Escape`&&(c===void 0?l!==``&&(e.preventDefault(),u(``)):(e.preventDefault(),c()))}}),(0,h.jsxs)(z,{type:`submit`,size:`small`,disabled:r,disabledReason:i,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),n]}),c===void 0?null:(0,h.jsx)(z,{variant:`quiet`,size:`small`,onClick:c,children:`Cancel`})]})}var HQ=e=>`“${e}”`;function Kbe(e,t){let{api:n}=B(),r=_(),i=Lv(),[a,o]=(0,m.useState)(null),[s,c]=(0,m.useState)(!1),l=(0,m.useRef)(!1),u=(0,m.useRef)(e);e.version>u.current.version&&(u.current=e);let d=(0,m.useRef)({version:e.version,items:e.items,keys:LQ(e.items.length)});if(d.current.version!==u.current.version){let{items:e}=u.current;d.current={version:u.current.version,items:e,keys:RQ(d.current.items,d.current.keys,e)}}let f=(0,m.useRef)(null),p=u.current.items,h=d.current.keys,g=async(e,t,a,s)=>{if(l.current)return!1;l.current=!0;let f=u.current,p=d.current.keys;c(!0),o(null);try{let c=await e(f);return c.ok?(u.current=c.value,d.current={version:c.value.version,items:c.value.items,keys:t.length===c.value.items.length?t:RQ(f.items,p,c.value.items)},r.setQueryData(DT,e=>e?.map(e=>e.id===c.value.id?c.value:e)),r.invalidateQueries({queryKey:BT}),i(a,`success`,s?{label:`Undo`,run:()=>void g(e=>zT(n,e.id,{baseVersion:e.version,items:f.items}),p,`Put the topics back as they were.`,!1)}:void 0),!0):(o(c.reason===`conflict`?`The topics weren't saved: this schedule changed since the page loaded, possibly because a run just took a topic. The list now shows the latest; make your change again.`:`The topics weren't saved: ${c.message}`),await r.invalidateQueries({queryKey:DT}),!1)}catch(e){return o(`The topics weren't saved: ${e instanceof Error?e.message:`Slopify didn't answer.`} Check that Slopify is running, then try again.`),!1}finally{l.current=!1,c(!1)}},v=(e,t,r)=>g(t=>zT(n,t.id,{baseVersion:t.version,items:e}),t,r,!0);return{items:p,keys:h,saving:s,error:a,setError:o,focusKey:f,add:async(e,n=p.length,r=!1)=>{if(e.length===0)return o(`Write the new topic's ${t} first, then press Add topic.`),!1;let i=500-p.length;if(e.length>i)return o(`${CG(e.length,`topic`,`topics`)} didn't fit: a queue holds at most 500 and ${CG(i,`more fits`,`more fit`)}. Remove some topics first, or add fewer lines.`),!1;let a=LQ(e.length),s=a[0];return r&&s!==void 0&&(f.current=s),v(FQ(p,n,e.map(e=>({title:e,values:{}}))),FQ(h,n,a),e.length===1?`Added ${HQ(e[0]??``)}.`:`Added ${CG(e.length,`topic`,`topics`)}.`)},rename:(e,n)=>{let r=p[e],i=n.trim();if(r!==void 0&&i!==r.title){if(i===``){o(`Topic ${String(e+1)} needs a ${t}. Write one, or press its Remove button.`);return}v(p.map((t,n)=>n===e?{...t,title:i}:t),h,`Renamed to ${HQ(i)}.`)}},move:(e,t,r)=>{let i=p[e],a=h[e];i!==void 0&&e!==t&&(a!==void 0&&(f.current=a),g(r=>RT(n,r.id,{baseVersion:r.version,from:e,to:t}),PQ(h,e,t),`Moved ${HQ(i.title)} ${r}.`,!0))},remove:e=>{let t=new Set(e),n=p[e[0]??-1];return n===void 0?Promise.resolve(!1):v(p.filter((e,n)=>!t.has(n)),h.filter((e,n)=>!t.has(n)),t.size===1?`Removed ${HQ(n.title)}.`:`Removed ${CG(t.size,`topic`,`topics`)}.`)},duplicate:e=>{let t=p[e];if(t===void 0)return;if(p.length>=500){o(`${HQ(t.title)} wasn't duplicated: a queue holds at most 500 topics. Remove one first.`);return}let[n]=LQ(1);n!==void 0&&(f.current=n),v(FQ(p,e+1,[t]),FQ(h,e+1,n===void 0?[]:[n]),`Duplicated ${HQ(t.title)}.`)}}}function qbe({schedule:e}){let t=e.topicKeyword===null?`title`:`{{${e.topicKeyword}}}`,n=Kbe(e,t),{items:r,keys:i,saving:a}=n,o=vG(i),[s,c]=(0,m.useState)(null),[l,u]=(0,m.useState)(!1),d=(0,m.useRef)(new Map);(0,m.useEffect)(()=>{let e=n.focusKey.current;if(e!==null&&i.includes(e)){if(!l&&i.indexOf(e)>=100){u(!0);return}n.focusKey.current=null,d.current.get(e)?.focus()}},[i,n.focusKey,l]);let f=r.length>=500,p=a?`Saving the last change`:`A queue holds at most 500 topics`,g=l?r.length:Math.min(r.length,100),_=s===null?-1:i.indexOf(s);return(0,h.jsxs)(`section`,{"aria-label":`Queued topics`,className:`mt-6`,...Py,children:[(0,h.jsx)(U,{as:`h3`,title:`Queued topics · ${String(r.length)}`,info:`planning.schedule.inline-topics`,meta:e.topicKeyword===null?`Each topic becomes the next project's title.`:`Each topic fills ${t}; the next run takes the first.`}),n.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-2 text-small text-danger`,children:n.error}),(0,h.jsx)(VQ,{className:`mt-3`,label:`New topic`,placeholder:`${e.topicKeyword===null?`New topic`:`New ${t}`}, or paste several lines`,buttonLabel:`Add topic`,disabled:a||f,disabledReason:p,onAdd:e=>n.add(e)}),r.length===0?null:(0,h.jsxs)(`div`,{onKeyDown:o.onKeyDown,children:[r.length>1?(0,h.jsx)(SG,{className:`mt-3`,selection:o,total:r.length,noun:[`topic`,`topics`],actions:(0,h.jsx)(z,{size:`small`,variant:`quiet`,disabled:a||o.count===0,disabledReason:a?`Saving the last change`:`Tick the topics to remove`,onClick:()=>void n.remove(o.selected.map(e=>i.indexOf(e))).then(e=>{e&&o.clear()}),children:`Remove selected`})}):null,(0,h.jsx)(KL,{label:`Topics of ${e.name}`,className:`mt-2`,children:r.slice(0,g).flatMap((e,t)=>{let s=i[t]??String(t),l=(0,h.jsx)(Gbe,{rowKey:s,index:t,title:e.title,count:r.length,busy:a,selection:o,inputRef:e=>{e===null?d.current.delete(s):d.current.set(s,e)},onRename:e=>n.rename(t,e),onMove:(e,r)=>n.move(t,e,r),onRemove:()=>void n.remove([t]),onInsertBelow:()=>c(s),onDuplicate:()=>n.duplicate(t)},s);return t===_?[l,(0,h.jsx)(qL,{title:(0,h.jsx)(VQ,{autoFocus:!0,label:`New topic below ${String(t+1)}`,placeholder:`New topic, or paste several lines`,buttonLabel:`Insert`,disabled:a||f,disabledReason:p,onAdd:async e=>{let r=await n.add(e,t+1,!0);return r&&c(null),r},onCancel:()=>c(null)})},`${s}:insert`)]:[l]})}),g<r.length?(0,h.jsx)(z,{variant:`quiet`,size:`small`,className:`mt-2`,onClick:()=>u(!0),children:`Show all ${String(r.length)} topics`}):null]})]})}function Jbe(e){return e.cadence.kind===`once`?`One time`:e.cadence.kind===`daily`?`Daily at ${e.cadence.time}`:`Weekly at ${e.cadence.time}`}function UQ({schedule:e}){return e.deletedAt===null?(0,h.jsx)(tk,{tone:BL[e.status].tone,children:BL[e.status].word}):(0,h.jsx)(tk,{tone:`off`,children:`Deleted`})}function WQ({schedule:e,nextTitle:t,selected:n,pending:r,onSelect:i,onEdit:a,onAction:o,onConfirm:s}){let{api:c}=B(),l=e.deletedAt===null,u=l&&(e.status===`active`||e.status===`paused`),d=e.status===`canceled`||e.status===`completed`;return(0,h.jsx)(qL,{selected:n,onSelect:i,title:e.name,meta:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(UQ,{schedule:e}),` · ${Jbe(e)} · ${e.deletedAt===null?e.nextRunAt===null?`No future run`:`Next: ${WZ(e.nextRunAt,e.timezone)}${t===void 0?``:` · “${t}”`}`:`Deleted: ${WZ(e.deletedAt,e.timezone)}`}${e.topics.held>0?` · ${String(e.topics.held)} waiting for you`:``}`]}),actions:l?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Edit ${e.name}`,disabled:r||!u,disabledReason:u?`Finish or cancel the open form first`:`Only a live schedule can change`,onClick:a,children:`Edit`}),e.status===`paused`?(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Resume ${e.name}`,disabled:r,onClick:()=>o(()=>jT(c,e.id,`resume`,e.version)),children:`Resume`}):(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Pause ${e.name}`,disabled:r||e.status!==`active`,disabledReason:`Only an active schedule can pause`,onClick:()=>o(()=>jT(c,e.id,`pause`,e.version)),children:`Pause`}),(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Delete ${e.name}`,disabled:r||!d,disabledReason:`Cancel the schedule first; a completed or canceled one can be deleted`,onClick:()=>s(`delete`),children:`Delete`})]}):void 0})}function Ybe({schedule:e,pending:t,onAction:n,onConfirm:r,onDuplicate:i}){let{api:a}=B(),o=F({queryKey:[`schedule`,e.id],queryFn:async()=>{let t=await nce(a,e.id);if(!t.ok)throw Error(t.message);return t.value},refetchInterval:3e4}),s=e.deletedAt===null,c=s&&(e.status===`active`||e.status===`paused`),l=e.status===`paused`,u=[[`When`,e.cadence.kind===`once`?`Once, ${WZ(e.cadence.at,e.timezone)}`:e.cadence.kind===`daily`?`Every day at ${e.cadence.time}`:`Selected weekdays at ${e.cadence.time}`],[`Timezone`,e.timezone],[`Next run`,e.deletedAt!==null||e.nextRunAt===null?`None`:WZ(e.nextRunAt,e.timezone)],[`Topics`,e.items.length===0?e.topicGeneration.mode===`off`?`Template as saved`:`No topics queued`:`${String(e.items.length)} ${e.items.length===1?`topic`:`topics`} left`],[`Missed runs`,e.missedPolicy===`skip`?`Skip`:`Run once on reopening`],[`Overlap`,`Skip`],[`Spend ceiling`,e.spendLimitCents===null?`Not set`:`${String(e.spendLimitCents)} cents`]];return(0,h.jsxs)(`section`,{"aria-label":`${e.name} detail`,children:[s&&c?(0,h.jsx)(Xbe,{schedule:e,paused:l,onAction:n}):null,(0,h.jsxs)(U,{kicker:(0,h.jsx)(UQ,{schedule:e}),title:e.name,meta:e.topics.held>0?`${String(e.topics.held)} topics waiting for you`:void 0,children:[s?(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Duplicate ${e.name}`,disabled:t,disabledReason:`Finish or cancel the open change first`,onClick:i,children:`Duplicate`}):null,s?(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Cancel ${e.name}`,disabled:t||!c,disabledReason:`Only an active or paused schedule can be canceled`,onClick:()=>r(`cancel`),children:`Cancel schedule`}):null]}),(0,h.jsx)(`dl`,{className:`m-0 mt-4 grid grid-cols-1 gap-x-6 gap-y-3 text-small min-[600px]:grid-cols-2`,children:u.map(([e,t])=>(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`dt`,{className:`sl-kicker`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 break-words text-ink`,children:t})]},e))}),c?(0,h.jsx)(qbe,{schedule:e}):null,(0,h.jsx)(Zye,{schedule:e}),(0,h.jsx)(_G,{className:`my-6`}),(0,h.jsx)(U,{as:`h3`,title:`Run history`}),(0,h.jsx)(`div`,{className:`mt-3`,children:o.isPending?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Loading history…`}):o.error?(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:`The run history couldn't be loaded: ${o.error.message} It tries again every 30 seconds.`}):o.data.runs.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`No runs yet.`}):(0,h.jsx)(KL,{label:`Runs of ${e.name}`,children:o.data.runs.map(t=>(0,h.jsx)(qL,{title:(0,h.jsx)(`span`,{className:`capitalize`,children:`${t.status} · ${WZ(t.scheduledFor,e.timezone)}`}),meta:t.error?t.error:t.projectIds.length>0?(0,h.jsx)(`span`,{className:`inline-flex flex-wrap gap-x-3`,children:t.projectIds.map((e,t)=>(0,h.jsxs)(pa,{className:`underline hover:text-ink`,to:`/projects/$projectId`,params:{projectId:e},children:[`Project `,t+1]},e))}):`No projects`},t.id))})})]})}function Xbe({schedule:e,paused:t,onAction:n}){let{api:r}=B();return cb({id:`schedules.pause-resume`,title:t?`Resume schedule`:`Pause schedule`,group:`Schedules`,context:e.name,run:()=>n(()=>jT(r,e.id,t?`resume`:`pause`,e.version))}),null}var GQ={llm:`Text model`,audio:`Voice model`,images:`Image model`,animate:`Animation model`},Zbe=RegExp(`Settings → (${uk.map(e=>e.label.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).toSorted((e,t)=>t.length-e.length).join(`|`)})`,`g`);function Qbe(e){let t=[],n=0;for(let r of e.matchAll(Zbe)){let i=r[1],a=uk.find(e=>e.label===i);a!==void 0&&r.index!==void 0&&(r.index>n&&t.push(e.slice(n,r.index)),t.push({label:r[0],section:a.id}),n=r.index+r[0].length)}return n<e.length&&t.push(e.slice(n)),t}function KQ({text:e}){if(hi({warn:!1})==null)return(0,h.jsx)(h.Fragment,{children:e});let t=Qbe(e).map((e,t)=>typeof e==`string`?e:(0,h.jsx)(KO,{to:`/settings`,search:{section:e.section},children:e.label},t));return(0,h.jsx)(h.Fragment,{children:t})}function qQ({kind:e,id:t,name:n}){let{api:r}=B(),i=_(),a=F({queryKey:oz.retired,queryFn:()=>pz(r)}),o=I({mutationFn:e=>mz(r,e),onSuccess:()=>Promise.all([i.invalidateQueries({queryKey:oz.retired}),i.invalidateQueries({queryKey:EO}),i.invalidateQueries({queryKey:DT})])}),s=(a.data??[]).filter(n=>n.kind===e&&n.id===t);return s.length===0?null:(0,h.jsxs)(`li`,{"aria-label":`Retired models in ${n}`,className:`flex flex-col gap-2 px-3 pb-3`,children:[s.map(t=>(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-small`,children:[(0,h.jsxs)(`span`,{className:`text-waiting`,children:[`${GQ[t.slot]} ${t.model} is ${t.why===`retired`?`retired`:`no longer listed`}.`,t.blocked===null?``:` ${t.blocked}`,t.replacement===null&&t.blocked===null?(0,h.jsx)(KQ,{text:` No replacement is suggested: choose another model in Settings → Models, or edit the ${e}.`}):null]}),t.replacement===null?null:(0,h.jsx)(z,{size:`small`,disabled:t.blocked!==null||o.isPending,disabledReason:t.blocked??`Switching…`,onClick:()=>o.mutate(t),children:`Switch to ${t.replacement.name}`})]},t.key)),o.error?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:`The model wasn't switched: ${o.error.message}`}):null]})}function $be({tools:e,loaded:t,live:n,hiddenBySearch:r,channelFiltered:i,deleted:a,selectedId:o,pending:s,nextTitles:c,onPick:l,onEdit:u,onAction:d,onConfirm:f}){return(0,h.jsxs)(h.Fragment,{children:[e,n.length===0&&r>0?(0,h.jsx)(aQ,{title:`No schedule matches this search`,children:`Check the spelling, or clear the search to see all ${String(r)}.`}):t&&n.length===0?(0,h.jsx)(aQ,{title:i?`No schedules run this channel's templates`:a.length===0?`No schedules yet`:`No active schedules`,children:i?`Pick All channels to see the others, or make one from this channel's templates.`:a.length===0?`Your first one can be a one-off run or a recurring series. Press New schedule.`:`Create one with New schedule, or review deleted history below.`}):null,n.length>0?(0,h.jsx)(KL,{label:`Saved schedules`,className:`[&_.sl-row__actions]:flex-wrap`,children:n.map(e=>(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(WQ,{schedule:e,nextTitle:c.get(e.id),selected:o===e.id,pending:s,onSelect:()=>l(e.id),onEdit:()=>u(e),onAction:d,onConfirm:t=>f(t,e)}),(0,h.jsx)(qQ,{kind:`schedule`,id:e.id,name:e.name})]},e.id))}):null,a.length>0?(0,h.jsxs)(`details`,{className:`mt-6`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer text-small font-semibold text-ink-2`,children:[`Deleted schedules · `,a.length]}),(0,h.jsx)(`p`,{className:`m-0 mt-2 mb-2 text-small text-ink-2`,children:`Deleted schedules stay in Settings → Trash for 30 days, where Restore brings one back paused. Pick one to see its run history.`}),(0,h.jsx)(KL,{label:`Deleted schedules`,children:a.map(e=>(0,h.jsx)(WQ,{schedule:e,nextTitle:void 0,selected:o===e.id,pending:!1,onSelect:()=>l(e.id),onEdit:()=>void 0,onAction:d,onConfirm:()=>void 0},e.id))})]}):null]})}function exe({pickedId:e,onPick:t}={}){let{api:n}=B(),r=_(),i=F(OT(n)),a=F(AO(n)),[o,s]=(0,m.useState)(null),c=Lv(),[l,u]=(0,m.useState)(null),[d,f]=(0,m.useState)(!1),[p,g]=(0,m.useState)(!1),[v,y]=(0,m.useState)(null),b=t===void 0?v:e??null,x=e=>{t===void 0?y(e):t(e)},[S,C]=(0,m.useState)(null),w=(0,m.useRef)(!1),T=F(Xy(n)),[E]=(0,m.useState)(()=>{let e=new Date;return{from:e.toISOString(),to:new Date(e.valueOf()+79488e5).toISOString()}}),D=F(VT(n,E.from,E.to)),O=new Map;for(let e of D.data?.runs??[])e.renderedTitle!==null&&!O.has(e.scheduleId)&&O.set(e.scheduleId,e.renderedTitle);let k=ab().channelId,[A,j]=(0,m.useState)(k??``),M=e=>{if(A===``)return!0;let t=a.data?.find(t=>t.id===e.templateId);return(t?oQ(t):Uy)===A},[ee,N]=(0,m.useState)(``),[te,P]=(0,m.useState)(`newest`),ne=i.data?.filter(e=>e.deletedAt===null)??[],re=ne.length>=5,ie=ne.filter(M),ae=re?Ube(ie,ee,te):ie,oe=i.data?.filter(e=>e.deletedAt!==null)??[],se=b!==null&&i.data!==void 0&&!i.data.some(e=>e.id===b),ce=se?null:i.data?.find(e=>e.id===b)??ae[0]??null,le=I({onError:e=>s(e.message),onSettled:async()=>{w.current=!1,await r.invalidateQueries({queryKey:DT})},mutationFn:async e=>e(),onSuccess:async e=>{if(!e.ok){s(e.message);return}s(null)}}),ue=e=>{w.current||(w.current=!0,s(null),le.mutate(e))},de=d||l!==null,fe=()=>{u(null),f(!1),s(null)},pe=a.data?.length===0,me=()=>{de||pe||(u(null),f(!0),s(null))},he=e=>ue(async()=>{let t=await Vbe(n,e,(i.data??[]).map(e=>e.name));if(t.ok){let e=t.value;await r.invalidateQueries({queryKey:DT}),x(e.id),c(`Duplicated as “${e.name}”: paused, with an empty topic queue. Press Edit to change it, then Resume.`,`success`,{label:`Edit`,run:()=>ge(e)})}return t}),ge=e=>{f(!1),x(e.id),u(e),s(null)};cb({id:`schedules.new`,title:`New schedule`,group:`Schedules`,keywords:[`calendar`,`recurring`],run:me}),BO(IO.newSchedule,()=>{pe?c(`A schedule runs a project template, and there is none yet. Open a project, choose Save as template, then run New schedule again.`,`error`):me()},a.data!==void 0);let _e=o?{tone:`error`,text:o}:i.error?{tone:`error`,text:`The schedules couldn't be loaded: ${i.error.message} Reload the page to try again.`}:a.error?{tone:`error`,text:`The templates couldn't be loaded: ${a.error.message} Reload the page to try again.`}:void 0,ve=le.isPending||p||de;return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,h.jsx)(`p`,{className:`m-0 min-w-0 text-small text-ink-2`,children:pe?(0,h.jsxs)(h.Fragment,{children:[`Save a template in`,` `,(0,h.jsx)(pa,{className:`underline`,to:`/templates`,children:`Library → Templates`}),` `,`before creating a schedule.`]}):(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`Runs a saved template on this machine at a local time.`,(0,h.jsx)(H,{id:`planning.schedules`})]})}),(0,h.jsxs)(Fv,{children:[(0,h.jsxs)(sL,{"aria-label":`Filter schedules by channel`,value:A,className:`w-auto min-w-[160px]`,onChange:e=>j(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`All channels`}),(T.data??[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,h.jsxs)(z,{variant:`primary`,onClick:me,disabled:de||pe,disabledReason:pe?`Save a template in Library → Templates first`:`Finish or cancel the open form first`,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`New schedule`]})]})]}),(0,h.jsx)(SR,{tone:de?`info`:_e?.tone??`info`,className:`mb-2`,children:de?void 0:_e?.text}),(0,h.jsx)(gG,{className:`min-[768px]:grid-cols-[minmax(320px,460px)_minmax(0,1fr)]`,list:(0,h.jsx)($be,{tools:re?(0,h.jsx)(Wbe,{query:ee,sort:te,onQuery:N,onSort:P}):null,loaded:i.data!==void 0,live:ae,hiddenBySearch:re?ie.length-ae.length:0,channelFiltered:A!==``,deleted:oe,selectedId:de?void 0:ce?.id,pending:ve,nextTitles:O,onPick:x,onEdit:ge,onAction:ue,onConfirm:(e,t)=>C({kind:e,schedule:t})}),detail:de?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(U,{kicker:l?l.name:void 0,title:l?`Edit schedule`:`New schedule`,className:`mb-4`}),(0,h.jsx)(Fbe,{onBusy:g,editing:l,onCancel:()=>{p||fe()},templates:a.data??[],pending:le.isPending,error:o,onCreated:()=>{c(l?`Schedule updated.`:`Schedule saved. It will run automatically while Slopify is open.`,`success`),fe(),r.invalidateQueries({queryKey:DT})},onError:e=>{s(e),r.invalidateQueries({queryKey:DT})}},l?.id??`new`)]}):se?(0,h.jsx)(aQ,{title:`This schedule wasn't found`,children:`The link names a schedule that is no longer here: a deleted schedule leaves Settings → Trash after 30 days. Pick one from the list, or press New schedule.`}):ce?(0,h.jsx)(Ybe,{schedule:ce,pending:ve,onAction:ue,onConfirm:e=>C({kind:e,schedule:ce}),onDuplicate:()=>he(ce)},ce.id):null}),(0,h.jsx)($v,{open:S!==null,title:S?.kind===`delete`?`Delete schedule?`:`Cancel schedule?`,consequence:(S?.kind===`delete`?`Moves this schedule to the trash for 30 days (Settings → Trash). Its run history is kept.`:`Stops future scheduled runs. Existing projects and run history are kept.`)+(o?` ${o}`:``),confirmLabel:S?.kind===`delete`?`Delete schedule`:`Cancel schedule`,cancelLabel:`Keep schedule`,pending:le.isPending,onCancel:()=>{le.isPending||C(null)},onConfirm:()=>{if(!S)return;let{kind:e,schedule:t}=S;ue(async()=>{let r=e===`delete`?await rce(n,t.id,t.version):await jT(n,t.id,`cancel`,t.version);return r.ok&&C(null),r})}})]})}var JQ=[`studio`,`releases`],YQ=new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`}),txe=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}),XQ=e=>`${YQ.format(new Date(e))}, ${txe.format(new Date(e))}`;function nxe(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${String(t.getFullYear())}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function rxe(e){switch(e.state){case`scheduled`:return e.checks===`ok`?{tone:`neutral`,word:`✓ Scheduled · checks clear`}:e.checks===null?{tone:`info`,word:`✓ Scheduled · checks pending`}:{tone:`failed`,word:`Scheduled · ${e.checks}`};case`filled`:return{tone:`waiting`,word:`Filled in Studio, not scheduled`};case`late`:return{tone:`failed`,word:`Late · upload now`};case`not-ready`:return{tone:`neutral`,word:`Not rendered yet`};default:return{tone:`neutral`,word:`Ready to upload`}}}function ixe(e,t){let n=new Date(e),r=new Date(n.getFullYear(),n.getMonth(),n.getDate()-(n.getDay()+6)%7),i=new Date(t.getFullYear(),t.getMonth(),t.getDate()-(t.getDay()+6)%7),a=Math.round((r.getTime()-i.getTime())/6048e5);return{key:r.toISOString(),label:a<=0?`This week`:a===1?`Next week`:`Week of ${YQ.format(r)}`}}function axe({item:e,projectId:t,onDone:n}){let{api:r}=B(),i=_(),a=Lv(),[o,s]=(0,m.useState)(e.at===null?``:nxe(e.at)),c=I({mutationFn:n=>hs(r,t,{short:e.short,at:n}),onSuccess:()=>{i.invalidateQueries({queryKey:JQ}),n()},onError:e=>a(`The time wasn't changed: ${e.message}`,`error`)}),l=e.short===0?`Long video`:`Short ${String(e.short)}`;return(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1`,children:[(0,h.jsx)(X,{"aria-label":`${l}: release`,type:`datetime-local`,className:`w-[200px]`,value:o,onChange:e=>s(e.currentTarget.value)}),(0,h.jsx)(z,{type:`button`,size:`small`,disabled:o===``||c.isPending,onClick:()=>c.mutate(new Date(o).toISOString()),children:`Save`}),e.short===0?(0,h.jsx)(z,{type:`button`,size:`small`,variant:`quiet`,disabled:c.isPending,onClick:()=>c.mutate(null),children:`Not scheduled`}):null,(0,h.jsx)(z,{type:`button`,size:`small`,variant:`quiet`,onClick:n,children:`Cancel`})]})}function ZQ({item:e,projectId:t,editing:n,onEdit:r}){let i=rxe(e),a=n?.projectId===t&&n.short===e.short,o=e.short===0?`Long video`:`Short ${String(e.short)}`;return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsxs)(`span`,{className:`text-small text-ink-3`,children:[o,e.at===null?``:` · goes public`]}),e.short===0?null:(0,h.jsx)(`span`,{className:`w-full truncate text-small`,title:e.title,children:e.title}),a?(0,h.jsx)(axe,{item:e,projectId:t,onDone:()=>r(void 0)}):(0,h.jsx)(z,{type:`button`,size:`small`,variant:`quiet`,"aria-label":`${o}: move from ${e.at===null?`no time`:XQ(e.at)}`,onClick:()=>r({projectId:t,short:e.short}),children:e.at===null?`Set a time`:XQ(e.at)}),(0,h.jsx)(nk,{tone:i.tone,children:i.word})]})}function oxe({entry:e,candidates:t}){let{api:n}=B(),r=_(),i=Lv(),a=t.filter(t=>e.series===``||t.series===e.series),[o,s]=(0,m.useState)(``),c=I({mutationFn:t=>hs(n,t,{short:0,at:e.at,...e.line===null?{}:{line:e.line}}),onSuccess:()=>void r.invalidateQueries({queryKey:JQ}),onError:e=>i(`The project wasn't put there: ${e.message}`,`error`)});return a.length===0?(0,h.jsxs)(`span`,{className:`text-small text-ink-3`,children:[`Free · no finished project`,e.series===``?``:` of ${e.series}`,` waits for a time`]}):(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(sL,{"aria-label":`Project for ${XQ(e.at)}`,className:`w-[260px]`,value:o,onChange:e=>s(e.currentTarget.value),options:[{value:``,label:`Free · pick a finished project`},...a.map(e=>({value:e.id,label:e.title}))]}),(0,h.jsx)(z,{type:`button`,size:`small`,disabled:o===``||c.isPending,onClick:()=>c.mutate(o),children:`Put it here`})]})}var QQ=6048e5;function sxe(e,t){let n=Math.min(Math.max(0,e),3),r=Math.min(8,(n+1)*2);return{weeks:r,start:n===0?void 0:new Date(t.getTime()+n*2*QQ),end:new Date(t.getTime()+r*QQ),hasEarlier:n>0,hasLater:n<3}}function cxe(e,t){return e.filter(e=>{let n=new Date(e.at).getTime();return(t.start===void 0||n>=t.start.getTime())&&n<t.end.getTime()})}function lxe(){let{api:e}=B(),[t,n]=(0,m.useState)(0),[r]=(0,m.useState)(()=>new Date),i=sxe(t,r),a=F({queryKey:[...JQ,i.weeks],queryFn:()=>fs(e,i.weeks),placeholderData:e=>e}),[o,s]=(0,m.useState)();if(a.isPending)return(0,h.jsx)(`p`,{className:`text-small text-ink-3`,children:`Loading the releases…`});if(a.isError)return(0,h.jsxs)(`p`,{className:`text-small text-danger`,children:[`The releases didn't load: `,a.error.message,` Reload the page to try again.`]});let c=a.data,l=cxe(c.entries,i),u=t===0?`The next two weeks`:`${YQ.format(i.start??r)} to ${YQ.format(i.end)}`,d=new Map;for(let e of l){let t=ixe(e.at,r),n=d.get(t.key)??{label:t.label,entries:[]};n.entries.push(e),d.set(t.key,n)}return(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Every video and short is due `,String(c.leadHours),` hours before its release, so YouTube's copyright and ad checks finish while it is private. Change that, or the weekly times, in`,` `,(0,h.jsx)(pa,{to:`/settings`,search:{section:`studio`},children:`Settings → YouTube Studio`}),`.`]}),(0,h.jsxs)(`nav`,{"aria-label":`Release weeks`,className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsxs)(Fv,{children:[(0,h.jsx)(z,{size:`small`,disabled:!i.hasEarlier,disabledReason:`Releases already public are not listed here; open the project to see its release.`,onClick:()=>n(t-1),children:`Earlier`}),(0,h.jsx)(z,{size:`small`,disabled:!i.hasLater,disabledReason:`Releases are listed up to 8 weeks ahead.`,onClick:()=>n(t+1),children:`Later`}),t===0?null:(0,h.jsx)(z,{size:`small`,variant:`quiet`,onClick:()=>n(0),children:`Back to this week`})]}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,role:`status`,children:u})]}),l.length===0?t===0?(0,h.jsx)(aQ,{title:`No releases in the next two weeks`,children:`Add your week in Settings → YouTube Studio → Posting plan: each finished project then takes its next free time, and its shorts the times after it. Or open a finished project's Prepare upload, or press Later to look further ahead.`}):(0,h.jsx)(aQ,{title:`No releases from ${u}`,children:`Nothing is planned in these weeks yet. Press Back to this week, or Earlier.`}):null,[...d.values()].map(e=>(0,h.jsxs)(`section`,{"aria-label":e.label,className:`flex flex-col gap-3`,children:[(0,h.jsx)(`h2`,{className:`sl-section-head__title m-0`,children:e.label}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.entries.map(e=>{let t=e.items.find(e=>e.short===0),n=e.items.filter(e=>e.short>0);return(0,h.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line pb-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:XQ(e.at)}),e.series===``?null:(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:e.series}),e.project===null?null:(0,h.jsx)(pa,{to:`/projects/$projectId`,params:{projectId:e.project.id},children:e.project.title})]}),e.project===null?(0,h.jsx)(oxe,{entry:e,candidates:c.candidates}):(0,h.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-x-4 gap-y-3`,children:[t===void 0?null:(0,h.jsx)(ZQ,{item:t,projectId:e.project.id,editing:o,onEdit:s}),n.map(t=>(0,h.jsx)(ZQ,{item:t,projectId:e.project?.id??``,editing:o,onEdit:s},t.short))]})]},`${e.at}-${e.project?.id??`free`}`)})})]},e.label))]})}var $Q=4;function uxe(e){return e===`schedules`?`schedules`:e===`releases`?`releases`:`weeks`}var e$=new Intl.DateTimeFormat(void 0,{dateStyle:`full`}),t$=new Intl.DateTimeFormat(void 0,{day:`numeric`,month:`short`}),n$=864e5,r$=`slopify.calendar.view`;function dxe(){try{return window.localStorage.getItem(r$)===`list`?`list`:`weeks`}catch{return`weeks`}}function fxe({tab:e,schedule:t,onTab:n,onSchedule:r}={}){let{api:i}=B(),a=ab(),[o,s]=(0,m.useState)(0),c=(0,m.useMemo)(()=>eR(new Date(Date.now()+o*$Q*7*n$),$Q),[o]),[l,u]=(0,m.useState)(dxe),[d,f]=(0,m.useState)(e??`weeks`),p=n===void 0?d:e??`weeks`,g=e=>{n===void 0?f(e):n(e)},[_,v]=(0,m.useState)(!1),y=F(VT(i,c.from,c.to)),b=F(OT(i)),x=F(AO(i)),S=F(_y(i)),[C,w]=(0,m.useState)(null),[T,E]=(0,m.useState)(null),D=(0,m.useMemo)(()=>new Map((x.data??[]).map(e=>[e.id,e.channelId])),[x.data]),O=(0,m.useMemo)(()=>new Map((S.data?.projects??[]).map(e=>[e.id,e.channelId])),[S.data]),k=(b.data??[]).filter(e=>a.includes(D.get(e.templateId))),A=y.data===void 0?void 0:{...y.data,runs:y.data.runs.filter(e=>a.includes(D.get(e.templateId))),projects:y.data.projects.filter(e=>a.includes(O.get(e.id)))},j=(0,m.useMemo)(()=>A===void 0?new Map:$L(A),[A]),M=A?.runs??[],ee=Ove(A?.projects??[]),N=rbe(VT(i,c.from,c.to).queryKey,w),te=(e,t,n)=>{if(e.kind!==`none`){if(e.kind===`refused`){w(e.message);return}N.mutate({drop:e,title:t,where:n})}},P=(e,t)=>{let n=nR(M,e,t);if(n===void 0){w(t===-1?`${rR(e)} is already the next topic of ${e.scheduleName}.`:`${rR(e)} is the last topic on the calendar for ${e.scheduleName}. Show Later weeks to move it further.`);return}let r=e$.format(new Date(n.at));te(tR(e,n,r),rR(e),r)},ne=e=>{u(e),p!==`weeks`&&g(`weeks`);try{window.localStorage.setItem(r$,e)}catch{}};cb({id:`calendar.add`,title:`Add to calendar`,group:`Calendar`,keywords:[`topics`,`batch`,`queue`],run:()=>v(!0)}),cb({id:`calendar.schedules`,title:`Show the schedules`,group:`Calendar`,keywords:[`edit`,`recurring`,`pause`,`resume`],run:()=>g(`schedules`)}),BO(IO.addToCalendar,()=>v(!0)),cb({id:`calendar.weeks`,title:`Show the calendar as weeks`,group:`Calendar`,run:()=>ne(`weeks`)}),cb({id:`calendar.list`,title:`Show the calendar as a list`,group:`Calendar`,run:()=>ne(`list`)});let re=k.reduce((e,t)=>e+(t.deletedAt===null?t.items.length:0),0),ie=XL(new Date),ae=`${t$.format(new Date(c.from))} to ${t$.format(new Date(Date.parse(c.to)-2*n$))}`,oe=(A?.queued??[]).toSorted((e,t)=>e.position-t.position),se=oe.filter(e=>e.state===`queued`),ce=(b.data??[]).filter(e=>e.deletedAt===null).length;return(0,h.jsxs)(`div`,{"data-tour":`calendar`,children:[(0,h.jsx)(pG,{title:`Calendar`,meta:`${a.channel?.name??`Every channel`} · ${String(M.length)} scheduled ${M.length===1?`run`:`runs`} ${o===0?`in the next ${String($Q)} weeks`:ae} · ${String(re)} ${re===1?`topic`:`topics`} queued`,actions:p===`weeks`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Iy,{label:`Calendar view`,tip:`planning.calendar.view`,value:l,onChange:ne,options:[{value:`weeks`,label:`Weeks`},{value:`list`,label:`List`}]}),(0,h.jsxs)(z,{variant:`primary`,onClick:()=>v(!0),children:[(0,h.jsx)(pl,{"aria-hidden":`true`,strokeWidth:1.75}),`Add to calendar`]})]}):void 0}),(0,h.jsx)(rQ,{items:[{id:`weeks`,label:`Coming weeks`},{id:`releases`,label:`Releases`},{id:`schedules`,label:`Schedules`,...b.data===void 0?{}:{badge:String(ce)}}],value:p,onChange:g,label:`Calendar sections`,idPrefix:`calendar`,className:`mb-6`}),(0,h.jsx)(iQ,{idPrefix:`calendar`,id:`releases`,active:p===`releases`,children:p===`releases`?(0,h.jsx)(lxe,{}):null}),(0,h.jsx)(iQ,{idPrefix:`calendar`,id:`schedules`,active:p===`schedules`,children:p===`schedules`?(0,h.jsx)(exe,{pickedId:t,onPick:r}):null}),(0,h.jsxs)(iQ,{idPrefix:`calendar`,id:`weeks`,active:p===`weeks`,children:[(0,h.jsx)(SR,{tone:C===null?`info`:`error`,className:`mb-3`,children:C??void 0}),y.data===void 0||y.error===null?null:(0,h.jsx)(`div`,{className:`mb-3`,children:(0,h.jsx)(ML,{what:`the calendar`,error:y.error,updatedAt:y.dataUpdatedAt,onRetry:()=>void y.refetch(),retrying:y.isFetching})}),y.data===void 0&&y.error!==null?(0,h.jsx)(jL,{what:`The calendar`,error:y.error,onRetry:()=>void y.refetch(),retrying:y.isFetching}):(0,h.jsxs)(h.Fragment,{children:[A===void 0||ee.length===0?null:(0,h.jsxs)(`p`,{className:`m-0 mb-4 text-small text-ink-2`,children:[Dve(ee),`. `,(0,h.jsx)(KO,{to:`/`,children:`Open Home`}),` to act on them.`]}),b.data!==void 0&&YZ(k).length===0?null:(0,h.jsx)(`section`,{"aria-label":`Suggested topics`,className:`mb-6 min-w-0`,children:b.data===void 0&&b.error!==null?(0,h.jsx)(jL,{compact:!0,what:`Your schedules`,error:b.error,onRetry:()=>void b.refetch(),retrying:b.isFetching}):(0,h.jsx)(Qye,{schedules:k})}),(0,h.jsxs)(`section`,{"aria-label":`Coming weeks`,className:`flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(pxe,{label:ae,shift:o,onShift:e=>s(t=>e===0?0:t+e)}),y.data===void 0?(0,h.jsx)(AL,{label:`Loading the calendar…`,rows:2,rowClassName:`h-40`}):l===`weeks`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Drag a topic by its grip to another day to change when it runs, or onto another schedule's run to move it there. With the keyboard: focus a topic and press Alt+← or Alt+→.`}),QL(new Date(c.from),$Q).map(e=>(0,h.jsx)(`div`,{className:`sl-cal-week`,children:e.map(e=>{let t=XL(e),n=j.get(t);return(0,h.jsx)(sR,{date:e,today:t===ie,day:n,dragging:T,busy:N.isPending,onDragStart:E,onDragEnd:()=>E(null),onDrop:t=>{T!==null&&(te(tR(T,t,e$.format(e)),rR(T),e$.format(e)),E(null))},onStep:P},t)})},XL(e[0]??new Date)))]}):(0,h.jsx)(ZB,{days:j,busy:N.isPending,onStep:P,schedules:k,onMove:(e,t)=>{let n=e$.format(new Date(t.at));te(tR(e,t,n),rR(e),n)},onTransfer:(e,t)=>{e.index!==null&&te({kind:`transfer`,scheduleId:e.scheduleId,baseVersion:e.scheduleVersion,index:e.index,targetId:t,position:void 0},rR(e),`the end of ${k.find(e=>e.id===t)?.name??`the other schedule`}`)}}),A!==void 0&&A.queued.length>0?(0,h.jsxs)(`section`,{"aria-label":`Batch queue`,children:[(0,h.jsx)(U,{title:`Batch queue`,meta:`${String(A.queued.length)} waiting to start`,info:`play.queue`}),(0,h.jsx)(KL,{label:`Batch queue`,children:oe.map((e,t)=>{let n=A.projects.find(t=>t.id===e.projectId)?.state===`paused`;return(0,h.jsx)(qL,{title:(0,h.jsx)(pa,{to:`/projects/$projectId`,params:{projectId:e.projectId},children:e.title}),meta:`${String(t+1)} in line`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(tk,{tone:n?`waiting`:e.state===`active`?`running`:`off`,children:n?`Paused`:e.state===`active`?`Running now`:`Waiting its turn`}),e.state===`queued`?(0,h.jsx)(tQ,{projectId:e.projectId,title:e.title,place:se.indexOf(e),waiting:se.length}):null]})},e.projectId)})})]}):null]})]})]}),(0,h.jsx)(Tve,{open:_,onOpenChange:v,schedules:k})]})}function pxe({label:e,shift:t,onShift:n}){return(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(z,{size:`small`,variant:`secondary`,onClick:()=>n(-1),children:[(0,h.jsx)(Mc,{"aria-hidden":`true`,strokeWidth:1.75}),`Earlier`]}),(0,h.jsx)(`span`,{className:`text-small text-ink-2 tabular-nums`,"aria-live":`polite`,children:e}),(0,h.jsxs)(z,{size:`small`,variant:`secondary`,onClick:()=>n(1),children:[`Later`,(0,h.jsx)(Nc,{"aria-hidden":`true`,strokeWidth:1.75})]}),(0,h.jsx)(z,{size:`small`,variant:`quiet`,disabled:t===0,onClick:()=>n(0),children:`This week`})]})}var mxe=mD.map(e=>({value:e,label:hD[e]}));function hxe({channel:e}){let{api:t}=B(),n=_(),r=Lv(),i=I({mutationFn:n=>Sre(t,e.id,n),onSuccess:async e=>{r(`YouTube AI disclosure set to ${hD[e.aiDisclosure]}.`,`success`),n.setQueryData(qy(e.id),t=>typeof t==`object`&&t&&`channel`in t?{...t,channel:{...t.channel,aiDisclosure:e.aiDisclosure}}:t),await n.invalidateQueries({queryKey:Ky,exact:!0})}});return(0,h.jsxs)(`section`,{"aria-label":`YouTube AI disclosure`,className:`mb-6 max-w-3xl border-b border-line pb-5`,children:[(0,h.jsx)(iL,{label:`YouTube AI disclosure`,tip:`planning.channel.ai-disclosure`,help:`Mark voices in Settings → Voices and Image prompts in Library → Prompts.`,children:(0,h.jsx)(sL,{value:i.isPending?i.variables:e.aiDisclosure,options:mxe,disabled:i.isPending,onChange:e=>{let t=mD.find(t=>t===e.currentTarget.value);t!==void 0&&i.mutate(t)},className:`max-w-[260px]`})}),(0,h.jsx)(SR,{tone:`error`,children:i.error?`Couldn't save the YouTube AI disclosure: ${i.error.message}`:void 0})]})}var gxe=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;function i$(e){let t=gxe.exec(e.trim())?.[1];if(t!==void 0)return`#${(t.length===3?[...t].map(e=>e+e).join(``):t).toLowerCase()}`}var _xe=`Write the colour as # and 3 or 6 hex digits, like #8c1e14 or #fff.`;function a$(e){if(e.trim()!==``)return i$(e)===void 0?_xe:void 0}function o$(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function s$(e){let t=Number.parseInt(e.slice(1,3),16),n=Number.parseInt(e.slice(3,5),16),r=Number.parseInt(e.slice(5,7),16);return .2126*o$(t)+.7152*o$(n)+.0722*o$(r)}function vxe(e,t){let n=i$(e),r=i$(t);if(n===void 0||r===void 0)return;let[i,a]=[s$(n),s$(r)].sort((e,t)=>t-e);return(i+.05)/(a+.05)}function c$(e,t,n,r){let i=vxe(e,t);if(!(i===void 0||i>=r))return`Hard to read on ${n}: contrast ${i.toFixed(1)}:1, below the ${String(r)}:1 text needs. Pick a lighter or darker colour.`}function l$({value:e,onChange:t,pickerLabel:n,className:r,...i}){let a=i$(e),o=(0,m.useRef)(a);a!==void 0&&(o.current=a),e.trim()===``&&(o.current=void 0);let s=a??o.current;return(0,h.jsxs)(`span`,{className:R(`flex min-w-0 items-center gap-2`,r),children:[(0,h.jsx)(`span`,{"data-partial":a===void 0&&s!==void 0?``:void 0,className:`relative size-8 shrink-0 overflow-hidden rounded-control border border-line-strong data-[partial]:opacity-40`,style:{background:s??`repeating-linear-gradient(45deg, transparent 0 4px, var(--color-line) 4px 5px)`},children:(0,h.jsx)(`input`,{type:`color`,"aria-label":n,value:s??`#ffffff`,className:`absolute inset-0 size-full cursor-pointer opacity-0`,onChange:e=>t(e.target.value)})}),(0,h.jsx)(X,{...i,className:`w-28 font-mono`,spellCheck:!1,autoComplete:`off`,value:e,onChange:e=>t(e.target.value)})]})}function u$({value:e,onChange:t,inherited:n,label:r=`Language`,error:i,disabled:a=!1,tip:o=`play.language`}){let s=e??n?.language;return(0,h.jsx)(iL,{label:r,tip:o,help:yxe(s),error:i,children:(0,h.jsxs)(sL,{"data-play-field":`language`,value:e??(n===void 0?`en`:``),disabled:a,onChange:e=>t(e.target.value===``?void 0:UT.parse(e.target.value)),children:[n===void 0?null:(0,h.jsxs)(`option`,{value:``,children:[n.label,` (`,WT(n.language).name,`)`]}),HT.map(e=>(0,h.jsx)(`option`,{value:e.code,children:e.native===e.name?e.name:`${e.native} · ${e.name}`},e.code))]})})}function yxe(e){let t=WT(e);if(t.code===`en`)return`Everything is written and timed in English.`;let n=`The article, narration, YouTube description and Shorts titles are written in ${t.name}; pick a voice that speaks it.`,r=GT(t.code);return r===void 0?`${n} Captions are timed word by word with a free 248 MB model, downloaded the first time a ${t.name} project makes captions.`:`${n} ${r}`}function bxe({rows:e,onChange:t}){let n=(n,r)=>t(e.map((e,t)=>t===n?{...e,...r}:e));return(0,h.jsxs)(`section`,{"aria-label":`Channel links`,...Py,children:[(0,h.jsx)(U,{title:`Channel links`,meta:`Write a link's name in braces in a description, such as {{Patreon}}.`,info:`planning.links.named`}),e.length===0?(0,h.jsx)(`p`,{className:`m-0 border-y border-line py-4 text-ink-2`,children:`No channel links yet. Add one, then write its name in braces in a description.`}):(0,h.jsxs)(`ul`,{"aria-label":`Channel links`,className:`sl-list m-0 list-none p-0`,children:[(0,h.jsxs)(`li`,{"aria-hidden":`true`,className:`hidden grid-cols-[220px_minmax(0,1fr)_auto] gap-2 border-b border-line pt-1 pb-2 text-label text-ink-2 md:grid`,children:[(0,h.jsxs)(`span`,{children:[`Name, used as `,`{{Name}}`]}),(0,h.jsx)(`span`,{children:`Address`})]}),e.map((r,i)=>(0,h.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)] items-center gap-2 border-b border-line py-3 md:grid-cols-[220px_minmax(0,1fr)_auto]`,children:[(0,h.jsxs)(`span`,{className:`grid gap-1`,children:[(0,h.jsxs)(`span`,{"aria-hidden":`true`,className:`text-label text-ink-2 md:hidden`,children:[`Name, used as `,`{{Name}}`]}),(0,h.jsx)(X,{"aria-label":`Name of link ${String(i+1)}`,placeholder:`Patreon`,value:r.name,onChange:e=>n(i,{name:e.currentTarget.value})})]}),(0,h.jsxs)(`span`,{className:`grid gap-1`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`text-label text-ink-2 md:hidden`,children:`Address`}),(0,h.jsx)(X,{"aria-label":`Address of link ${String(i+1)}`,type:`url`,placeholder:`https://`,value:r.url,onChange:e=>n(i,{url:e.currentTarget.value})})]}),(0,h.jsxs)(z,{variant:`quiet`,size:`small`,className:`justify-self-start`,"aria-label":`Remove link ${String(i+1)}`,onClick:()=>t(e.filter((e,t)=>t!==i)),children:[(0,h.jsx)(xl,{"aria-hidden":`true`,className:`size-[14px]`}),`Remove`]})]},i))]}),(0,h.jsx)(`div`,{className:`mt-3`,children:(0,h.jsxs)(z,{onClick:()=>t([...e,{name:``,url:``}]),children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-[14px]`}),`Add link`]})})]})}function xxe(){return(0,h.jsxs)(`div`,{...Py,children:[(0,h.jsx)(U,{title:`Named links`,info:`planning.links.named`}),(0,h.jsx)(`p`,{className:`m-0 max-w-[60ch] text-ink-2`,children:`Each channel keeps its own links now, on its Brand tab under Channel links. Links saved here before fill the default channel's descriptions until you save its Brand tab.`}),(0,h.jsx)(`div`,{className:`mt-3`,children:(0,h.jsx)(GO,{to:`/channels/$channelId`,params:{channelId:Uy},children:`Open the default channel's links`})})]})}function d$({changed:e,defaultText:t,label:n,onReset:r}){return(0,h.jsxs)(`span`,{className:`mt-1 flex min-h-7 items-center gap-2 text-label text-ink-2`,children:[(0,h.jsx)(`span`,{children:e?`Changed · default ${t}`:`Default`}),(0,h.jsx)(z,{variant:`quiet`,size:`small`,disabled:!e,"aria-label":`Reset ${n} to ${t}`,onClick:r,children:`Reset`})]})}function f$({value:e,inherit:t,sources:n,offerNone:r,problem:i,file:a,fieldPrefix:o=`ambientBed`,onChange:s}){let c=e!==void 0&&e.source!==`none`,l={level:e?.level??String(SE.levelDb),fadeIn:e?.fadeIn??String(SE.fadeInSeconds),tail:e?.tail??String(SE.tailSeconds)},u=e=>{if(e===``)s(void 0);else if(e===`none`)s({source:`none`,...l});else{let t=n.find(t=>t===e);t!==void 0&&s({source:t,...l})}},d=(t,n,r,a)=>e===void 0||!c?null:(0,h.jsxs)(iL,{label:n,help:r,tip:a,error:i(t),children:[(0,h.jsx)(X,{"data-play-field":`${o}.${t}`,type:`text`,inputMode:`decimal`,className:`sl-input--number`,value:e[t],onChange:n=>s({...e,[t]:n.target.value})}),t===`level`?(0,h.jsx)(d$,{changed:e.level.trim()!==String(SE.levelDb),defaultText:`${String(SE.levelDb)} dB`,label:`ambient level`,onReset:()=>s({...e,level:String(SE.levelDb)})}):null]});return(0,h.jsxs)(`div`,{className:`sl-fields`,children:[(0,h.jsx)(iL,{label:`Ambient sound`,tip:`project.ambient.source`,error:i(`source`),children:(0,h.jsxs)(sL,{"data-play-field":`${o}.source`,value:e?.source??``,onChange:e=>u(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:t}),r?(0,h.jsx)(`option`,{value:`none`,children:`None`}):null,n.map(e=>(0,h.jsx)(`option`,{value:e,children:Kce[e]},e))]})}),e?.source===`upload`?a:null,c?(0,h.jsxs)(`div`,{className:`contents`,children:[d(`level`,`Level (dB)`,`-40 to -6; 0 is about as loud as the voice.`,`project.ambient.level`),d(`fadeIn`,`Fade in (seconds)`,`0 to 30.`,`project.ambient.fade-in`),d(`tail`,`Tail after the narration (seconds)`,`0 to 30, fading out.`,`project.ambient.tail`)]}):null]})}function Sxe({value:e,onChange:t}){let n=EE(e),r=n===void 0?[]:CE(n);return(0,h.jsx)(f$,{value:e,inherit:`Not set`,sources:bE,offerNone:!1,fieldPrefix:`brand.ambientBed`,problem:e=>r.find(t=>t.field===e)?.message,onChange:t})}function Cxe(e){return e.ambientBed===void 0?void 0:TE(e.ambientBed)}function wxe(e){let t=EE(e);return t===void 0||t.source===`upload`?{brand:{},blocked:!1}:{brand:{ambientBed:{...t,source:t.source}},blocked:CE(t).length>0}}var p$=[`captionFontId`,`captionColor`,`captionOutlineColor`,`titleFontId`,`titleColor`,`intro`,`outro`,`endScreenText`,`documentTheme`,`language`],m$=1e4;function Txe(e){return Object.fromEntries(p$.map(t=>[t,e[t]??``]))}function Exe({channel:e}){let{api:t}=B(),n=_(),r=Lv(),i=F({queryKey:Lk,queryFn:()=>Rk(t)}),a=F(wy(t)),o=F(Ty(t)),[s,c]=(0,m.useState)(e.name),[l,u]=(0,m.useState)(e.seriesBrief),[d,f]=(0,m.useState)(Txe(e.brand)),[p,g]=(0,m.useState)(Cxe(e.brand)),v=wxe(p),y=F({queryKey:V.channelLinks,queryFn:()=>Vs(t),enabled:e.isDefault&&e.brand.links===void 0}),[b,x]=(0,m.useState)(),S=b??e.brand.links??y.data??[],C=b!==void 0||e.brand.links!==void 0||(y.data?.length??0)>0,w=I({mutationFn:()=>Qy(t,e.id,{name:s,seriesBrief:l,brand:{...Object.fromEntries(p$.flatMap(e=>d[e].trim()===``?[]:[[e,Dxe(e,d[e])]])),...v.brand,...C?{links:S}:{}},baseVersion:e.version}),onSuccess:async e=>{r(`Channel saved.`,`success`),n.setQueryData(qy(e.id),t=>typeof t==`object`&&t?{...t,channel:e}:t),await Promise.all([n.invalidateQueries({queryKey:Ky}),n.invalidateQueries({queryKey:V.channelLinks})])}}),T=e=>t=>f({...d,[e]:t}),E=_$.some(e=>a$(d[e])!==void 0),D=(i.data?.fonts??[]).map(e=>({value:e.id,label:e.name})),O=e=>(a.data?.entries??[]).filter(t=>t.category===e).map(e=>({value:e.name,label:e.name})),k=[...(o.data?.builtIns??[]).map(e=>({value:e.name,label:e.label})),...(o.data?.themes??[]).map(e=>({value:e.id,label:e.name}))];return(0,h.jsxs)(`form`,{"aria-label":`Brand kit`,onSubmit:e=>{e.preventDefault(),w.mutate()},children:[(0,h.jsxs)(`div`,{className:`grid max-w-3xl grid-cols-1 gap-5`,children:[(0,h.jsx)(iL,{label:`Channel name`,tip:`planning.channel.name`,children:(0,h.jsx)(X,{value:s,maxLength:200,required:!0,onChange:e=>c(e.target.value)})}),(0,h.jsx)(iL,{label:`Series brief`,tip:`planning.channel.brief`,help:`Topic generation reads it for this channel's schedules. ${sQ(l.length,m$,`characters`)}.`,children:(0,h.jsx)(oL,{rows:4,value:l,maxLength:m$,onChange:e=>u(e.target.value)})}),(0,h.jsx)(U,{title:`Brand kit`,meta:`Fills what a template leaves at its default. Blank fields add nothing.`,info:`planning.channel.brand-kit`,className:`mt-2 border-t border-line pt-6`}),(0,h.jsx)(`section`,{"aria-label":`Language`,className:`max-w-md`,children:(0,h.jsx)(u$,{label:`Language of new projects`,tip:`planning.channel.language`,value:d.language===``?void 0:d.language,inherited:{label:`Not set`,language:void 0},onChange:e=>T(`language`)(e??``)})}),(0,h.jsxs)(`section`,{"aria-label":`Captions`,className:`grid grid-cols-1 gap-4 min-[700px]:grid-cols-3`,children:[(0,h.jsx)(h$,{label:`Caption font`,tip:`planning.channel.brand.caption-font`,value:d.captionFontId,options:D,onPick:T(`captionFontId`)}),(0,h.jsx)(g$,{label:`Caption colour`,tip:`planning.channel.brand.caption-colour`,value:d.captionColor,onChange:T(`captionColor`)}),(0,h.jsx)(g$,{label:`Caption outline`,tip:`planning.channel.brand.caption-outline`,value:d.captionOutlineColor,onChange:T(`captionOutlineColor`),contrast:c$(d.captionColor,d.captionOutlineColor,`the caption colour`,3)})]}),(0,h.jsxs)(`section`,{"aria-label":`Chapter cards and end screen`,className:`grid grid-cols-1 gap-4 min-[700px]:grid-cols-3`,children:[(0,h.jsx)(h$,{label:`Title font`,tip:`planning.channel.brand.font`,value:d.titleFontId,options:D,onPick:T(`titleFontId`)}),(0,h.jsx)(g$,{label:`Title colour`,tip:`planning.channel.brand.title-colour`,value:d.titleColor,onChange:T(`titleColor`)}),(0,h.jsx)(iL,{label:`End screen text`,tip:`planning.channel.brand.end-screen`,help:`Shown over the last 5 seconds.`,children:(0,h.jsx)(X,{value:d.endScreenText,maxLength:200,placeholder:`Subscribe for more`,onChange:e=>T(`endScreenText`)(e.target.value)})})]}),(0,h.jsxs)(`section`,{"aria-label":`Intro, outro and document`,className:`grid grid-cols-1 gap-4 min-[700px]:grid-cols-3`,children:[(0,h.jsx)(h$,{label:`Intro`,tip:`planning.channel.brand.intro`,value:d.intro,options:O(`intro`),onPick:T(`intro`)}),(0,h.jsx)(h$,{label:`Outro`,tip:`planning.channel.brand.outro`,value:d.outro,options:O(`outro`),onPick:T(`outro`)}),(0,h.jsx)(h$,{label:`PDF theme`,tip:`planning.channel.brand.document-theme`,value:d.documentTheme,options:k,onPick:T(`documentTheme`)})]}),(0,h.jsx)(Sxe,{value:p,onChange:g}),(0,h.jsx)(`div`,{className:`border-t border-line pt-6`,children:(0,h.jsx)(bxe,{rows:S,onChange:x})})]}),(0,h.jsx)(CR,{status:(0,h.jsx)(SR,{tone:w.error?`error`:`info`,children:w.error?.message??(w.isPending?`Saving…`:void 0)}),children:(0,h.jsx)(z,{type:`submit`,variant:`primary`,disabled:w.isPending||s.trim()===``||v.blocked||E,disabledReason:s.trim()===``?`Give the channel a name`:E?`Fix the colour marked above`:`Fix the ambient sound settings above`,children:`Save channel`})})]})}function h$({label:e,tip:t,value:n,options:r,onPick:i}){return(0,h.jsx)(iL,{label:e,tip:t,children:(0,h.jsxs)(sL,{value:n,onChange:e=>i(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`Not set`}),n!==``&&!r.some(e=>e.value===n)?(0,h.jsxs)(`option`,{value:n,children:[n,` (no longer in the library)`]}):null,r.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))]})})}function g$({label:e,tip:t,value:n,onChange:r,contrast:i}){let a=a$(n);return(0,h.jsx)(iL,{label:e,tip:t,...a===void 0?{}:{error:a},...a===void 0&&i!==void 0?{help:i}:{},children:(0,h.jsx)(l$,{value:n,placeholder:`#FFFFFF`,maxLength:7,pickerLabel:`${e} picker`,onChange:r})})}var _$=[`captionColor`,`captionOutlineColor`,`titleColor`];function Dxe(e,t){let n=t.trim();return _$.includes(e)?i$(n)?.toUpperCase()??n:n}function v$(e,t){return e.languages===void 0||e.languages.includes(WT(t).code)}function Oxe(e,t,n,r){return n?e:e.filter(e=>v$(e,t)||e.voiceId===r)}function kxe(e,t){if(e===void 0||v$(e,t))return;let n=WT(t).name,r=(e.languages??[]).map(e=>WT(e).code===e?WT(e).name:e);return`${e.name} is listed for ${r.join(`, `)}, not ${n}, so it may read the ${n} narration with the wrong accent. Pick a ${n} voice under Narration, or correct the voice's languages in Settings → Voices.`}function y$(e,t,n){let[r,i]=(0,m.useState)(!1),a=Oxe(e,t,r,n);return{listed:a,hidden:e.length-a.length,showAll:r,setShowAll:i}}function b$({language:e,voice:t,hidden:n,showAll:r,onShowAll:i}){let a=(0,m.useId)(),o=kxe(t,e);return n===0&&!r&&o===void 0?null:(0,h.jsxs)(`div`,{className:`col-span-full grid gap-1`,children:[n>0||r?(0,h.jsxs)(`span`,{className:`flex min-h-8 items-center gap-1`,...Py,children:[(0,h.jsxs)(`label`,{htmlFor:a,className:`flex items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{id:a,type:`checkbox`,checked:r,onChange:e=>i(e.target.checked)}),`Show all voices`,r?``:` (${String(n)} listed for other languages than ${WT(e).name})`]}),(0,h.jsx)(H,{id:`play.show-all-voices`})]}):null,o===void 0?null:(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:o})]})}function x$(e,t,n){let r=t+n,i=e[t];if(i===void 0||r<0||r>=e.length)return[...e];let a=e.filter((e,n)=>n!==t);return a.splice(r,0,i),a}function S$(e,t,n){let r=`${e.trim()||`Untitled`} copy`,i=new Set(t.map(e=>e.trim().toLowerCase())),a=1,o=r;for(;i.has(o.slice(0,n).toLowerCase());)a+=1,o=`${r} ${String(a)}`;return o.slice(0,n)}var Axe=200;function jxe({channelId:e,member:t,onCreated:n}){let{api:r}=B(),i=_(),a=Lv(),o=F(Zy(r,e)),s=I({mutationFn:()=>eb(r,e,crypto.randomUUID(),{kind:t.kind,name:S$(t.name,(o.data?.cast??[]).map(e=>e.name),Axe),aliases:[],description:t.description,voice:t.voice??null,host:!1}),onSuccess:async t=>{await Promise.all([i.invalidateQueries({queryKey:qy(e)}),i.invalidateQueries({queryKey:Ky})]),a(`Made “${t.name}”. Its pictures are not copied: upload or generate them under Reference pictures.`,`success`),n(t.id)},onError:e=>a(`Couldn't duplicate ${t.name}: ${e.message} Press Duplicate in its editor to try again.`,`error`)});return(0,h.jsx)(z,{variant:`quiet`,size:`small`,disabled:s.isPending||o.data===void 0,disabledReason:s.isPending?`Making the copy`:`Loading the cast`,onClick:()=>s.mutate(),children:`Duplicate`})}var C$=4e3;function Mxe({channelId:e,member:t,open:n,onClose:r,onCreated:i}){let{api:a}=B(),o=_(),[s,c]=(0,m.useState)(t?.kind??`character`),[l,u]=(0,m.useState)(t?.name??``),[d,f]=(0,m.useState)(t?.aliases??[]),[p,g]=(0,m.useState)(``),[v,y]=(0,m.useState)(t?.description??``),[b,x]=(0,m.useState)(t?.voice),[S,C]=(0,m.useState)(t?.host===!0),w=()=>Promise.all([o.invalidateQueries({queryKey:qy(e)}),o.invalidateQueries({queryKey:Ky})]),T=I({mutationFn:async()=>{let n={kind:s,name:l.trim(),aliases:d,description:v,voice:b!==void 0&&b.provider!==``&&b.model!==``&&b.voice!==``?b:null,host:S};return t===void 0?eb(a,e,crypto.randomUUID(),n):hre(a,t.id,{...n,baseVersion:t.version})},onSuccess:async e=>{await w(),t===void 0&&i(e.id)}}),E=()=>{let e=p.trim();e===``||d.some(t=>t.toLowerCase()===e.toLowerCase())||(f([...d,e]),g(``))};return n?(0,h.jsxs)(`section`,{"aria-label":t===void 0?`Add to cast`:`Edit ${t.name}`,children:[(0,h.jsxs)(U,{kicker:t===void 0?`New cast member`:Gy[t.kind],title:t===void 0?`Add to cast`:t.name,meta:t===void 0?`Name it first, then give it reference pictures.`:`Used whenever a title or an image brief names it or one of its aliases.`,children:[t===void 0?null:(0,h.jsx)(jxe,{channelId:e,member:t,onCreated:i}),(0,h.jsx)(z,{variant:`quiet`,size:`small`,onClick:r,children:`Close`})]}),t!==void 0&&!t.images.some(e=>e.state===`ready`)?(0,h.jsx)(`p`,{className:`m-0 mt-2 text-small text-waiting`,children:`No picture yet, so it is not sent with any image. Upload or generate one below.`}):null,(0,h.jsxs)(`form`,{id:`cast-member-form`,"aria-label":`Cast member`,className:`mt-4 flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),l.trim()!==``&&T.mutate()},children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 min-[600px]:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,h.jsx)(iL,{label:`Kind`,tip:`planning.cast.kind`,children:(0,h.jsx)(sL,{value:s,onChange:e=>c(Wy.find(t=>t===e.target.value)??`character`),options:Wy.map(e=>({value:e,label:Gy[e]}))})}),(0,h.jsx)(iL,{label:`Name`,tip:`planning.cast.name`,children:(0,h.jsx)(X,{value:l,maxLength:200,required:!0,onChange:e=>u(e.target.value)})})]}),(0,h.jsx)(iL,{label:`Aliases`,tip:`planning.cast.aliases`,help:`Press Enter to add each one.`,children:(0,h.jsxs)(`div`,{className:`flex gap-2`,children:[(0,h.jsx)(X,{value:p,maxLength:200,placeholder:`Another name, such as the Last Pharaoh`,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),E())}}),(0,h.jsxs)(z,{onClick:E,disabled:p.trim()===``,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add alias`]})]})}),d.length>0?(0,h.jsx)(`ul`,{"aria-label":`Aliases added`,className:`m-0 flex list-none flex-wrap gap-2 p-0`,children:d.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsx)(rk,{removeLabel:`Remove alias ${e}`,onRemove:()=>f(d.filter(t=>t!==e)),children:e})},e))}):null,(0,h.jsx)(iL,{label:`Description for the image model`,tip:`planning.cast.description`,children:(0,h.jsx)(oL,{rows:3,value:v,maxLength:2e3,placeholder:`What they look like, in a sentence.`,onChange:e=>y(e.target.value)})}),(0,h.jsx)(Pxe,{channelId:e,value:b,onChange:x}),(0,h.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,h.jsx)(Fy,{label:`One of the channel's hosts`,tip:`planning.cast.host`,checked:S,onChange:C}),S&&(b===void 0||b.voice===``)?(0,h.jsx)(`p`,{className:`m-0 text-small text-waiting`,children:`A host joins new podcasts and interviews only with a voice. Pick one under Voice above.`}):null]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(SR,{tone:T.error?`error`:`info`,children:T.error?.message??(T.isPending?`Saving…`:T.isSuccess?`Saved.`:void 0)}),(0,h.jsx)(z,{type:`submit`,form:`cast-member-form`,variant:t===void 0?`primary`:`secondary`,disabled:T.isPending||l.trim()===``,children:t===void 0?`Add to cast`:`Save`})]})]}),t===void 0?null:(0,h.jsx)(Nxe,{channelId:e,member:t})]}):null}function Nxe({channelId:e,member:t}){let{api:n}=B(),r=_(),i=F(xy(n)),a=(0,m.useRef)(null),o=(0,m.useRef)(null),[s,c]=(0,m.useState)(``),[l,u]=(0,m.useState)(``),[d,f]=(0,m.useState)(`${t.name}${t.description.trim()?`, ${t.description.trim()}`:``}. A clear reference picture on a plain background, the whole ${t.kind===`place`?`place`:t.kind===`object`?`object`:`figure`} in view.`),p=()=>Promise.all([r.invalidateQueries({queryKey:qy(e)}),r.invalidateQueries({queryKey:Ky})]),g=I({mutationFn:e=>vre(n,t.id,e),onSettled:p}),v=I({mutationFn:()=>yre(n,t.id,{prompt:d,provider:s,model:l}),onSettled:p}),y=I({mutationFn:e=>bre(n,t.id,e),onSettled:p}),b=g.error??v.error??y.error,x=t.images.flatMap((e,t)=>e.state===`ready`&&e.sha256!==null?[{id:e.id,number:t+1,src:tb(n,e.sha256)}]:[]),[S,C]=(0,m.useState)(null);return(0,h.jsxs)(`section`,{"aria-label":`Reference pictures`,className:`mt-6`,children:[(0,h.jsx)(_G,{className:`mb-6`}),(0,h.jsx)(U,{as:`h3`,title:`Reference pictures`,meta:`Sent with every image whose brief, or the video's title, names ${t.name}.`,info:`planning.cast.pictures`}),t.images.length>0?(0,h.jsx)(nz,{list:!0,density:`compact`,label:`Pictures of ${t.name}`,className:`mt-3`,children:t.images.map((e,r)=>(0,h.jsxs)(`li`,{className:`min-w-0`,children:[(0,h.jsx)(tz,{aspect:`square`,alt:`${t.name}, reference ${String(r+1)}`,...e.state===`ready`&&e.sha256!==null?{src:tb(n,e.sha256)}:{},...e.state===`generating`?{generating:`Making the picture…`}:{},onOpen:()=>C(x.findIndex(t=>t.id===e.id)),openLabel:`Open picture ${String(r+1)} of ${t.name} full size`,...e.state===`failed`?{badge:(0,h.jsx)(nk,{tone:`failed`,children:`Failed`})}:{},actionsShown:!0,actions:(0,h.jsx)(z,{variant:`secondary`,size:`small`,"aria-label":`Delete picture ${String(r+1)} of ${t.name}`,disabled:y.isPending||e.state===`generating`,disabledReason:`Wait until the picture is made`,onClick:()=>y.mutate(e.id),children:`Delete`})}),e.state===`failed`&&e.error?(0,h.jsx)(Fxe,{error:e.error,retry:s===``||l===``||d.trim()===``?void 0:{run:()=>v.mutate(),busy:v.isPending},onReword:()=>o.current?.focus()}):null]},e.id))}):(0,h.jsx)(`p`,{className:`m-0 mt-3 text-small text-ink-3`,children:`No pictures yet.`}),(0,h.jsx)(rz,{items:x.map(e=>({src:e.src,alt:`${t.name}, reference ${String(e.number)}`})),index:S,onIndex:C,onClose:()=>C(null),actions:(e,n)=>{let r=x[n];return r===void 0?null:(0,h.jsx)(qO,{href:r.src,download:!0,size:`small`,"aria-label":`Download picture ${String(r.number)} of ${t.name}`,children:`Download`})}}),(0,h.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(`input`,{ref:a,type:`file`,accept:`image/png,image/jpeg`,className:`sr-only`,tabIndex:-1,"aria-hidden":`true`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&g.mutate(t)}}),(0,h.jsx)(z,{disabled:g.isPending,onClick:()=>a.current?.click(),children:`Upload a picture`}),(0,h.jsx)(`span`,{className:`text-small text-ink-3`,children:`PNG or JPEG, up to 10 MB.`})]}),(0,h.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,...Py,children:[(0,h.jsxs)(`p`,{className:`sl-kicker m-0 flex items-center gap-1`,children:[`Make a picture`,(0,h.jsx)(H,{id:`planning.cast.generate`,className:`-my-1`})]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 min-[600px]:grid-cols-2`,children:[(0,h.jsx)(vL,{label:`Image provider`,family:`image`,providers:i.data?.providers??[],value:s,problem:void 0,onPick:e=>{c(e),u(``)}}),(0,h.jsx)(hL,{label:`Image model`,provider:s,value:l,problem:void 0,onPick:u})]})]}),(0,h.jsx)(iL,{label:`Picture to make`,tip:`planning.cast.picture-prompt`,help:sQ(d.length,C$,`characters`),children:(0,h.jsx)(oL,{ref:o,rows:3,value:d,maxLength:C$,onChange:e=>f(e.target.value)})}),(0,h.jsx)(`div`,{children:(0,h.jsx)(z,{disabled:v.isPending||s===``||l===``||d.trim()===``,disabledReason:`Pick an image provider and model, and describe the picture`,onClick:()=>v.mutate(),children:`Generate a picture`})})]}),(0,h.jsx)(SR,{tone:b?`error`:`info`,className:`mt-2`,children:b?.message??(g.isPending?`Uploading…`:v.isSuccess?`The picture is being made; it appears here when it is ready.`:void 0)})]})}function Pxe({channelId:e,value:t,onChange:n}){let{api:r}=B(),i=F(xy(r)),a=F(Sy(r)),o=F(Zy(r,e)).data?.channel.brand.language??`en`,s=t??{provider:``,model:``,voice:``},c=(a.data?.voices??[]).filter(e=>e.provider===s.provider),l=y$(c,o,s.voice||void 0),u=l.listed;return(0,h.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-3 border-0 border-t border-line p-0 pt-4`,...Py,children:[(0,h.jsxs)(`legend`,{className:`sl-kicker flex items-center gap-1`,children:[`Voice`,(0,h.jsx)(H,{id:`planning.cast.voice`,label:`Cast voice`,className:`-my-1`})]}),(0,h.jsx)(`p`,{className:`text-small text-ink-2`,children:`For multi-voice runs: pick this member under Speakers on Play.`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 min-[600px]:grid-cols-2`,children:[(0,h.jsx)(vL,{label:`Voice provider`,family:`tts`,providers:i.data?.providers??[],value:s.provider,problem:void 0,onPick:e=>n(e===``?void 0:{provider:e,model:``,voice:``})}),(0,h.jsx)(hL,{label:`Voice model`,provider:s.provider,value:s.model,problem:void 0,onPick:e=>n({...s,model:e})}),(0,h.jsx)(_L,{label:`Voice`,value:s.voice,placeholder:u.length===0?`No voices. Add one in Settings.`:`Pick a voice`,options:u.map(e=>({value:e.voiceId,label:e.name})),problem:void 0,onPick:e=>n({...s,voice:e})}),(0,h.jsx)(b$,{language:o,voice:c.find(e=>e.voiceId===s.voice),hidden:l.hidden,showAll:l.showAll,onShowAll:l.setShowAll}),(0,h.jsx)(_L,{label:`Pace`,value:String(s.pace??1),placeholder:`Pick a pace`,options:KE.map(e=>({value:String(e),label:e===1?`Normal`:`${String(e)}×`})),problem:void 0,onPick:e=>{let{pace:t,...r}=s;n(Number(e)===1?r:{...r,pace:Number(e)})}})]}),t===void 0?null:(0,h.jsx)(z,{variant:`quiet`,onClick:()=>n(void 0),children:`Remove the voice`})]})}function Fxe({error:e,retry:t,onReword:n}){let r=KZ({stage:`images`,reason:e});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`m-0 mt-1 text-small text-danger`,children:e}),r===void 0?null:(0,h.jsx)(Fv,{className:`mt-2`,children:(0,h.jsx)(Sz,{fix:r,retry:t,variant:`secondary`,size:`small`,edit:r.kind===`refused`?(0,h.jsx)(z,{variant:`secondary`,size:`small`,onClick:n,children:`Reword the picture`}):void 0})})]})}var w$=`Alt+ArrowUp Alt+ArrowDown`;function Ixe(e,t){let{api:n}=B(),r=_(),i=Lv(),a=(0,m.useRef)(t);a.current=t;let o=I({mutationFn:t=>_re(n,e,t.member.id,t.to),onSuccess:async t=>{r.setQueryData(qy(e),e=>e===void 0?e:{...e,cast:t}),await r.invalidateQueries({queryKey:qy(e)})}}),s=(e,t,n,r=!0)=>{let c=a.current,l=c.findIndex(t=>t.id===e.id);l<0||t===l||t<0||t>=c.length||o.mutate({member:e,to:t},{onSuccess:()=>i(`Moved ${e.name} ${n}: ${String(t+1)} of ${String(c.length)}.`,`success`,r?{label:`Undo`,run:()=>s(e,l,`back`,!1)}:void 0),onError:t=>i(`Couldn't move ${e.name}: ${t.message} Try Move up or Move down in its More menu again.`,`error`)})};return{busy:o.isPending,move:s,onKeyDown:e=>t=>{if(!t.altKey||t.key!==`ArrowUp`&&t.key!==`ArrowDown`||(t.preventDefault(),o.isPending))return;let n=a.current.findIndex(t=>t.id===e.id),r=t.key===`ArrowUp`;s(e,n+(r?-1:1),r?`up`:`down`)}}}function Lxe({member:e,index:t,count:n,order:r}){let i=t===0,a=t===n-1;return(0,h.jsxs)(YO,{modal:!1,children:[(0,h.jsx)(XO,{asChild:!0,children:(0,h.jsx)(Nv,{size:`small`,label:`More for ${e.name}`,"aria-keyshortcuts":w$,disabled:n<2,disabledReason:`Add another member to change the order`,onKeyDown:r.onKeyDown(e),children:(0,h.jsx)(Hc,{"aria-hidden":`true`,strokeWidth:1.75})})}),(0,h.jsxs)(ZO,{children:[(0,h.jsx)(QO,{disabled:i||r.busy,onSelect:()=>r.move(e,t-1,`up`),children:`Move up`}),(0,h.jsx)(QO,{disabled:a||r.busy,onSelect:()=>r.move(e,t+1,`down`),children:`Move down`}),(0,h.jsx)(QO,{disabled:i||r.busy,onSelect:()=>r.move(e,0,`to the top`),children:`Move to top`}),(0,h.jsx)(QO,{disabled:a||r.busy,onSelect:()=>r.move(e,n-1,`to the bottom`),children:`Move to bottom`})]})]})}var T$=e=>`It is deleted permanently: ${e} do not go to Settings → Trash, so it cannot be restored.`,E$=e=>e===void 0?`Delete this channel?`:`Delete the channel “${e}”?`,D$=`${T$(`channels`)} Its cast and their reference pictures, its episode summaries, its video memory and its brand settings go with it. Its projects move to the default channel and keep what they were made with.`,Rxe=e=>e===void 0?`Delete this cast member?`:`Delete “${e}” from the cast?`,zxe=`${T$(`cast members`)} Its reference pictures go with it, and new videos stop using them. Videos already made keep the pictures they were started with.`,Bxe=e=>e===void 0?`Delete this episode summary?`:`Delete the episode summary of “${e}”?`,Vxe=`${T$(`episode summaries`)} New episodes stop being reminded of it. The video itself is not changed.`,Hxe=8;function Uxe({channelId:e,cast:t,selected:n,onSelect:r}){let{api:i}=B(),a=_(),[o,s]=(0,m.useState)(null),c=n===void 0?o:n,l=r??s,[u,d]=(0,m.useState)(null),f=I({mutationFn:e=>gre(i,e),onSuccess:async(t,n)=>{d(null),c===n&&l(null),await Promise.all([a.invalidateQueries({queryKey:qy(e)}),a.invalidateQueries({queryKey:Ky})])}}),p=t.find(e=>e.id===c),g=Ixe(e,t),v=t.flatMap(e=>{let t=e.images.find(e=>e.state===`ready`)?.sha256;return t?[{member:e,src:tb(i,t)}]:[]}),y=v.map(e=>({src:e.src,alt:e.member.name,caption:`${Gy[e.member.kind]} · ${e.member.description||`No description yet`}`})),[b,x]=(0,m.useState)(null),[S,C]=(0,m.useState)(``),w=S.trim().toLowerCase(),T=w===``?t:t.filter(e=>e.id===c||[e.name,...e.aliases,Gy[e.kind],e.description].join(` `).toLowerCase().includes(w)),E=c===`new`||p!==void 0;return(0,h.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-8 min-[1024px]:grid-cols-[minmax(0,1fr)_440px]`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`p`,{className:`m-0 mb-4 max-w-[68ch] text-small text-ink-2`,children:`When a video's title or an image's brief names a member, its pictures go with that image as references, so it looks the same in every video.`}),t.length===0?(0,h.jsx)(aQ,{title:`No cast yet`,actions:(0,h.jsx)(z,{variant:`secondary`,onClick:()=>l(`new`),children:`Add to cast`}),children:`Add the characters, creatures, places and objects this channel keeps coming back to.`}):(0,h.jsxs)(h.Fragment,{children:[t.length>Hxe?(0,h.jsx)(X,{type:`search`,"aria-label":`Search the cast`,placeholder:`Search ${String(t.length)} members by name, kind or description`,value:S,onChange:e=>C(e.target.value),className:`mb-4 max-w-[420px]`}):null,T.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No member's name, kind or description contains "${S.trim()}".`}):null,(0,h.jsx)(nz,{label:`Cast`,children:T.map(e=>{let n=e.images.filter(e=>e.state===`ready`),r=n[0]?.sha256;return(0,h.jsx)(tz,{className:R(e.id===c&&`rounded-media outline-2 outline-accent outline-offset-4 outline-solid`),...r?{src:tb(i,r)}:{},alt:e.name,onOpen:()=>x(v.findIndex(t=>t.member.id===e.id)),openLabel:`Open ${e.name}'s picture full size`,title:e.name,meta:`${Gy[e.kind]}${e.host===!0?` · Host`:``} · ${String(n.length)} ${n.length===1?`picture`:`pictures`}`,...n.length===0?{badge:(0,h.jsx)(nk,{tone:`waiting`,children:`No picture`})}:{},actionsShown:!0,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{variant:`secondary`,size:`small`,"aria-label":`Edit ${e.name}`,"aria-pressed":e.id===c,"aria-keyshortcuts":w$,onKeyDown:g.onKeyDown(e),onClick:()=>l(e.id),children:`Edit`}),(0,h.jsx)(z,{variant:`secondary`,size:`small`,"aria-label":`Delete ${e.name}`,onClick:()=>{f.reset(),d(e)},children:`Delete`}),(0,h.jsx)(Lxe,{member:e,index:t.indexOf(e),count:t.length,order:g})]})},e.id)})})]}),(0,h.jsx)(rz,{items:y,index:b,onIndex:x,onClose:()=>x(null),actions:(e,t)=>{let n=v[t];return n===void 0?null:(0,h.jsx)(z,{size:`small`,onClick:()=>{x(null),l(n.member.id)},children:`Edit ${n.member.name}`})}}),(0,h.jsx)(SR,{tone:`error`,className:`mt-2`,children:u?void 0:f.error?.message})]}),(0,h.jsx)(`aside`,{"aria-label":`Cast member editor`,className:`min-w-0`,children:E?(0,h.jsx)(Mxe,{channelId:e,member:p,open:!0,onClose:()=>l(null),onCreated:e=>l(e)},c??`closed`):t.length===0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Pick a member's Edit to change its names, description and pictures here.`})}),(0,h.jsx)($v,{open:u!==null,title:Rxe(u?.name),consequence:f.error?.message??zxe,confirmLabel:`Delete from cast`,cancelLabel:`Keep it`,pending:f.isPending,onConfirm:()=>{u&&f.mutate(u.id)},onCancel:()=>d(null)})]})}var O$=e=>[`channels`,e,`episodes`],k$=e=>[`channels`,e,`videos`],A$=(e,t)=>`${e.origin}/api/channels/${t}`,j$=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)});function Wxe(e,t){return ot({queryKey:O$(t),queryFn:async()=>L(await e.fetch(`${A$(e,t)}/episodes`))})}async function Gxe(e,t,n){return L(await e.fetch(`${A$(e,t)}/episodes/setting`,j$(`PUT`,{enabled:n})))}async function Kxe(e,t,n,r){return L(await e.fetch(`${A$(e,t)}/episodes/${encodeURIComponent(n)}`,j$(`PUT`,{summary:r})))}async function qxe(e,t,n){let r=await e.fetch(`${A$(e,t)}/episodes/${encodeURIComponent(n)}`,{method:`DELETE`});r.ok||await L(r)}function M$(e,t){return ot({queryKey:k$(t),queryFn:async()=>(await L(await e.fetch(`${A$(e,t)}/videos`))).videos})}async function N$(e,t,n){return L(await e.fetch(`${A$(e,t)}/videos`,j$(`POST`,n)))}async function Jxe(e,t,n){return L(await e.fetch(`${A$(e,t)}/videos/preview`,j$(`POST`,{format:`csv`,text:n})))}async function Yxe(e,t,n){let r=await e.fetch(`${A$(e,t)}/videos/${n}`,{method:`DELETE`});r.ok||await L(r)}async function Xxe(e,t){await L(await e.fetch(`${A$(e,t)}/videos`,{method:`DELETE`}))}function Zxe(e,t){let n=t.trim().toLowerCase().split(/\s+/u).filter(Boolean);return n.length===0?e:e.filter(e=>{let t=[e.title,e.summary,...e.cast].join(` `).toLowerCase();return n.every(e=>t.includes(e))})}var Qxe=e=>e.length>160?`${e.slice(0,160)}…`:e;function $xe({channelId:e}){let{api:t}=B(),n=_(),r=F(Wxe(t,e)),[i,a]=(0,m.useState)(null),[o,s]=(0,m.useState)(null),c=()=>n.invalidateQueries({queryKey:O$(e)}),l=I({mutationFn:n=>Gxe(t,e,n),onSuccess:t=>n.setQueryData(O$(e),t)}),u=I({mutationFn:n=>qxe(t,e,n),onSuccess:async()=>{s(null),await c()}}),d=r.data?.enabled??!1,f=r.data?.memories??[],[p,g]=(0,m.useState)(``),v=Zxe(f,p);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Fy,{checked:d,disabled:r.data===void 0||l.isPending,onChange:e=>l.mutate(e),label:`Episode memory`,tip:`planning.channel.episode-memory`,describedBy:`${e}-memory-help`}),(0,h.jsx)(`p`,{id:`${e}-memory-help`,className:`mt-1 mb-3 text-small text-ink-2`,children:`Finished episodes leave a short summary that new related episodes are written with.`}),(0,h.jsx)(SR,{tone:r.error||l.error||u.error?`error`:`info`,children:r.error?.message??l.error?.message??(o?void 0:u.error?.message)??(r.isPending?`Loading the episodes…`:void 0)}),r.data&&f.length===0?(0,h.jsx)(aQ,{title:`No episodes remembered yet`,children:d?`When a video on this channel finishes, its summary appears here.`:`Turn on episode memory, and the next finished video's summary appears here.`}):null,f.length>0?(0,h.jsxs)(`div`,{className:`mt-2 mb-2 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(X,{type:`search`,"aria-label":`Search episode summaries`,placeholder:`Search episode summaries`,value:p,className:`w-full min-w-0 sm:w-64`,onChange:e=>g(e.target.value)}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,role:`status`,children:p.trim()===``?`${String(f.length)} ${f.length===1?`episode`:`episodes`}`:`${String(v.length)} of ${String(f.length)} match`})]}):null,f.length>0&&v.length===0?(0,h.jsx)(aQ,{title:`No episode matches`,children:`No title, cast member or summary contains “${p.trim()}”. Clear the search to see every episode.`}):null,v.length>0?(0,h.jsx)(KL,{label:`Episode summaries`,children:v.map(e=>(0,h.jsx)(qL,{title:e.title,meta:(0,h.jsxs)(h.Fragment,{children:[e.source===`edited`?`Edited · `:``,e.cast.length>0?`${e.cast.join(`, `)} · `:``,Qxe(e.summary)]}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{size:`small`,"aria-label":`Open the summary of ${e.title}`,onClick:()=>a(e),children:`Open`}),(0,h.jsx)(z,{size:`small`,variant:`quiet`,"aria-label":`Delete the summary of ${e.title}`,onClick:()=>{u.reset(),s(e)},children:`Delete`})]})},e.id))}):null,i?(0,h.jsx)(eSe,{channelId:e,memory:i,onClose:()=>a(null)},i.id):null,(0,h.jsx)($v,{open:o!==null,title:Bxe(o?.title),consequence:u.error?.message??Vxe,confirmLabel:`Delete summary`,pending:u.isPending,onConfirm:()=>{o&&u.mutate(o.id)},onCancel:()=>s(null)})]})}function eSe({channelId:e,memory:t,onClose:n}){let{api:r}=B(),i=_(),[a,o]=(0,m.useState)(t.summary),s=I({mutationFn:()=>Kxe(r,e,t.id,a),onSuccess:async()=>{await i.invalidateQueries({queryKey:O$(e)}),n()}}),c=a.trim()!==t.summary.trim();return(0,h.jsx)(Qv,{open:!0,onOpenChange:e=>{e||n()},title:t.title,description:t.source===`edited`?`You edited this summary; finishing the video again keeps your text.`:`Written by the text model when the video finished. An edit here is kept.`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(z,{onClick:n,children:`Close`}),(0,h.jsx)(z,{variant:`primary`,disabled:!c||s.isPending,onClick:()=>s.mutate(),children:`Save summary`})]}),children:(0,h.jsx)(iL,{label:`Summary`,error:s.error?.message,tip:`planning.channel.episode-summary`,children:(0,h.jsx)(oL,{rows:8,value:a,onChange:e=>o(e.target.value)})})})}function P$(e,t){let[n,r]=(0,m.useState)({limit:200,resetOn:t}),i=Object.is(n.resetOn,t)?n.limit:200;return Object.is(n.resetOn,t)||r({limit:200,resetOn:t}),{shown:e.length>i?e.slice(0,i):e,hidden:Math.max(0,e.length-i),more:()=>r({limit:i+200,resetOn:t})}}function F$({hidden:e,onMore:t}){return e===0?null:(0,h.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(z,{size:`small`,onClick:t,children:`Show ${Math.min(e,200).toLocaleString(`en`)} more`}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`${e.toLocaleString(`en`)} not shown`})]})}var I$=(e,t,n)=>`${e.toLocaleString(`en`)} ${e===1?t:n}`;function L$(e,t){let n=t.trim().toLowerCase();return e.map(e=>n===``||e.toLowerCase().includes(n))}function tSe(e,t,n,r){let i=t===void 0?n:Math.min(t,n),a=t===void 0?n:Math.max(t,n);return e.map((e,t)=>t>=i&&t<=a?r:e)}function nSe({preview:e,filter:t,busy:n,onFilter:r,onTick:i,onSave:a,onCancel:o}){let s=(0,m.useId)(),c=(0,m.useRef)(void 0),l=(0,m.useRef)(!1),u=e.ticked.filter(Boolean).length,d=P$(e.titles,e.titles);return(0,h.jsxs)(`section`,{"aria-label":`Titles in the CSV`,className:`mt-4`,...Py,children:[(0,h.jsxs)(U,{as:`h3`,title:`Titles in the CSV`,info:`planning.channel.videos-ticks`,meta:`${u.toLocaleString(`en`)} of ${I$(e.titles.length,`title`,`titles`)} ticked · Shift+click ticks a range`,children:[(0,h.jsxs)(z,{variant:`primary`,disabled:n||u===0,onClick:a,children:[`Add `,I$(u,`ticked title`,`ticked titles`)]}),(0,h.jsx)(z,{variant:`quiet`,disabled:n,onClick:o,children:`Cancel`})]}),(0,h.jsx)(iL,{label:`Keep only titles containing…`,tip:`planning.channel.videos-filter`,tipLabel:`Keep only titles containing`,children:(0,h.jsx)(X,{value:t,maxLength:200,onChange:e=>r(e.target.value)})}),(0,h.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(z,{size:`small`,disabled:n,onClick:()=>i(e.titles.map(()=>!0)),children:`Tick all`}),(0,h.jsx)(z,{size:`small`,disabled:n,onClick:()=>i(e.titles.map(()=>!1)),children:`Untick all`})]}),(0,h.jsx)(KL,{label:`Titles in the CSV`,className:`mt-2`,children:d.shown.map((t,r)=>(0,h.jsx)(qL,{lead:(0,h.jsx)(`input`,{id:`${s}-${r}`,type:`checkbox`,checked:e.ticked[r]===!0,disabled:n,className:`size-4 shrink-0 accent-accent`,onClick:e=>{l.current=e.shiftKey},onChange:t=>{let n=l.current?c.current:void 0;l.current=!1,c.current=r,i(tSe(e.ticked,n,r,t.target.checked))}}),title:(0,h.jsx)(`label`,{htmlFor:`${s}-${r}`,children:t})},r))}),(0,h.jsx)(F$,{hidden:d.hidden,onMore:d.more})]})}var R$=(e,t,n)=>`${e.toLocaleString(`en`)} ${e===1?t:n}`;function z$({channelId:e}){let{api:t}=B(),n=_(),r=F(M$(t,e)),[i,a]=(0,m.useState)(``),[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(void 0),u=(0,m.useRef)(null),d=()=>n.invalidateQueries({queryKey:k$(e)}),[f,p]=(0,m.useState)(void 0),[g,v]=(0,m.useState)(``),y=I({mutationFn:n=>N$(t,e,{format:`lines`,...n}),onSuccess:async(e,t)=>{t.filter===void 0?a(``):p(void 0),l(`Added ${R$(e.added,`title`,`titles`)}${e.skipped>0?`; skipped ${e.skipped.toLocaleString(`en`)} already listed`:``}.`),await d()}}),b=I({mutationFn:n=>Jxe(t,e,n),onSuccess:e=>{v(e.filter),p({titles:e.titles,ticked:L$(e.titles,e.filter)})}}),x=Lv(),S=I({mutationFn:n=>Yxe(t,e,n.id),onSuccess:async(e,t)=>{x(`Removed “${t.title}”.`,`info`,{label:`Undo`,run:()=>C.mutate(t.title)}),await d()}}),C=I({mutationFn:n=>N$(t,e,{format:`lines`,text:n}),onSuccess:d,onError:(e,t)=>x(`Couldn't put “${t}” back: ${e.message} Paste it into Paste titles and press Add titles.`,`error`)}),[w,T]=(0,m.useState)(``),E=I({mutationFn:()=>Xxe(t,e),onSuccess:async()=>{s(!1),await d()}}),D=r.data??[],O=w.trim().toLowerCase(),k=O===``?D:D.filter(e=>e.title.toLowerCase().includes(O)),A=P$(k,O),j=y.isPending||b.isPending||S.isPending||C.isPending||E.isPending,M=r.error??b.error??y.error??S.error;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`p`,{className:`mb-3 text-small text-ink-2`,children:`Topic suggestions and duplicate checks skip these titles, as they skip the videos made here.`}),(0,h.jsx)(iL,{label:`Paste titles`,tip:`planning.channel.videos-paste`,help:`One title per line.`,children:(0,h.jsx)(oL,{rows:5,value:i,onChange:e=>a(e.target.value)})}),(0,h.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(z,{variant:`primary`,disabled:j||i.trim()===``,onClick:()=>{l(void 0),y.mutate({text:i})},children:`Add titles`}),(0,h.jsx)(z,{disabled:j,onClick:()=>{u.current?.click()},children:`Import a YouTube Studio CSV…`}),(0,h.jsx)(H,{id:`planning.channel.videos-csv`}),(0,h.jsx)(`input`,{ref:u,type:`file`,accept:`.csv,text/csv`,className:`hidden`,"aria-label":`YouTube Studio CSV file`,onChange:async e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&(l(void 0),y.reset(),b.mutate(await t.text()))}}),(0,h.jsx)(z,{variant:`quiet`,disabled:j||D.length===0,onClick:()=>{E.reset(),s(!0)},children:`Remove all`})]}),(0,h.jsx)(SR,{tone:M?`error`:c?`success`:`info`,className:`mt-1`,children:M?.message??c??(r.isPending?`Loading the titles…`:b.isPending?`Reading the CSV…`:void 0)}),f===void 0?null:(0,h.jsx)(nSe,{preview:f,filter:g,busy:j,onFilter:e=>{v(e),p({...f,ticked:L$(f.titles,e)})},onTick:e=>p({...f,ticked:e}),onSave:()=>{l(void 0);let e=f.titles.filter((e,t)=>f.ticked[t]);y.mutate({text:e.join(`
|
|
274
|
-
`),filter:g})},onCancel:()=>{y.reset(),p(void 0)}}),r.data&&D.length===0?(0,h.jsx)(aQ,{title:`No existing videos listed`,children:`In YouTube Studio open Analytics → Content → Advanced mode, export the table as a CSV, and import it here; or paste the titles above.`}):null,D.length>0?(0,h.jsxs)(`section`,{"aria-label":`Existing videos`,className:`mt-4`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(X,{type:`search`,"aria-label":`Search existing videos`,placeholder:`Search existing videos`,value:w,className:`w-full min-w-0 sm:w-64`,onChange:e=>T(e.target.value)}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,role:`status`,children:O===``?R$(D.length,`title`,`titles`):`${k.length.toLocaleString(`en`)} of ${R$(D.length,`title`,`titles`)} match`})]}),k.length===0?(0,h.jsx)(aQ,{title:`No title matches`,children:`None of the titles contains “${w.trim()}”. Clear the search to see them all.`}):(0,h.jsx)(KL,{label:`Existing videos`,children:A.shown.map(e=>(0,h.jsx)(qL,{title:e.title,actions:(0,h.jsx)(z,{size:`small`,variant:`quiet`,disabled:j,"aria-label":`Remove ${e.title}`,onClick:()=>S.mutate(e),children:`Remove`})},e.id))}),(0,h.jsx)(F$,{hidden:A.hidden,onMore:A.more})]}):null,(0,h.jsx)($v,{open:o,title:`Remove all ${R$(D.length,`title`,`titles`)}?`,consequence:E.error?.message??`Topic suggestions and duplicate checks stop skipping them. Your videos on YouTube are not touched.`,confirmLabel:`Remove all`,cancelLabel:`Keep them`,pending:E.isPending,onConfirm:()=>E.mutate(),onCancel:()=>s(!1)})]})}function B$({className:e,children:t}){return(0,h.jsx)(`dl`,{className:R(`sl-stats m-0`,e),children:t})}function V$({value:e,label:t,children:n}){return(0,h.jsxs)(`div`,{className:`sl-stat`,children:[(0,h.jsx)(`dt`,{className:`sl-stat__label order-2`,children:t}),(0,h.jsx)(`dd`,{className:`sl-stat__value order-1 m-0`,children:e}),n===void 0?null:(0,h.jsx)(`dd`,{className:`order-3 m-0 mt-1`,children:n})]})}function H$({value:e,label:t,valueText:n,tone:r=`accent`,progress:i=!1,className:a}){let o=Math.round(Math.min(1,Math.max(0,Number.isFinite(e)?e:0))*100),s=n??`${String(o)}%`,c=R(`sl-meter`,r===`waiting`&&`sl-meter--waiting`,a),l=(0,h.jsx)(`span`,{style:{width:`${String(o)}%`}});return i?(0,h.jsx)(`div`,{role:`progressbar`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-valuetext":s,className:c,children:l}):(0,h.jsx)(`div`,{role:`meter`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-valuetext":s,className:c,children:l})}function U$({columns:e,rows:t,rowKey:n,caption:r,empty:i,className:a}){return(0,h.jsxs)(`table`,{className:R(`sl-table`,a),children:[(0,h.jsx)(`caption`,{className:`sr-only`,children:r}),(0,h.jsx)(`thead`,{children:(0,h.jsx)(`tr`,{children:e.map(e=>(0,h.jsx)(`th`,{scope:`col`,className:e.numeric?`num`:void 0,children:e.header},e.id))})}),(0,h.jsx)(`tbody`,{children:t.length===0&&i!==void 0?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:e.length,className:`text-ink-2`,children:i})}):t.map(t=>(0,h.jsx)(`tr`,{children:e.map(e=>(0,h.jsx)(`td`,{className:e.numeric?`num`:void 0,children:e.cell(t)},e.id))},n(t)))})]})}var W$=56,G$=12,K$=12,rSe=28;function iSe(e,t){let n=e/t,r=10**Math.floor(Math.log10(n)),i=n/r;return(i<=1?1:i<=2?2:i<=5?5:10)*r}function q$({series:e,xLabels:t,formatValue:n,label:r,height:i=260,legend:a=!0,className:o}){let s=(0,m.useRef)(null),[c,l]=(0,m.useState)(800),[u,d]=(0,m.useState)();(0,m.useEffect)(()=>{let e=s.current;if(e===null||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(([e])=>{e!==void 0&&l(Math.max(320,Math.round(e.contentRect.width)))});return t.observe(e),()=>t.disconnect()},[]);let f=t.length,p=Math.max(0,...e.flatMap(e=>e.values.filter(e=>e!==null))),g=iSe(p>0?p:1,4),_=Math.max(g,Math.ceil((p>0?p:1)/g)*g),v=c-W$-G$,y=e=>W$+(f<=1?0:e/(f-1)*v),b=e=>K$+i-e/_*i,x=Array.from({length:Math.round(_/g)+1},(e,t)=>t*g),S=Math.min(f,Math.max(2,Math.floor(v/90))),C=Array.from({length:S},(e,t)=>Math.round(t/Math.max(1,S-1)*(f-1))),w=e=>{let t=``,n=!1;return e.forEach((e,r)=>{if(e===null){n=!1;return}t+=`${n?`L`:`M`}${y(r).toFixed(1)},${b(e).toFixed(1)}`,n=!0}),t},T=K$+i+rSe,E=u===void 0?[]:e.map(e=>({one:e,value:e.values[u]??null})).filter(e=>e.value!==null).toSorted((e,t)=>t.value-e.value);return(0,h.jsxs)(`figure`,{className:R(`m-0 flex flex-col gap-2`,o),children:[(0,h.jsxs)(`div`,{ref:s,className:`relative w-full`,children:[(0,h.jsxs)(`svg`,{role:`img`,"aria-label":r,width:c,height:T,viewBox:`0 0 ${String(c)} ${String(T)}`,className:`block select-none`,onMouseLeave:()=>d(void 0),onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=Math.round((e.clientX-t.left-W$)/v*(f-1));d(n<0||n>=f?void 0:n)},children:[x.map(e=>(0,h.jsxs)(`g`,{children:[(0,h.jsx)(`line`,{x1:W$,x2:c-G$,y1:b(e),y2:b(e),stroke:`currentColor`,className:`text-line`,strokeWidth:`1`}),(0,h.jsx)(`text`,{x:48,y:b(e),textAnchor:`end`,dominantBaseline:`middle`,className:`fill-ink-3 text-[11px]`,children:n(e)})]},e)),C.map(e=>(0,h.jsx)(`text`,{x:y(e),y:K$+i+18,textAnchor:e===0?`start`:e===f-1?`end`:`middle`,className:`fill-ink-3 text-[11px]`,children:t[e]},e)),e.map(e=>(0,h.jsx)(`path`,{d:w(e.values),fill:`none`,stroke:e.color,strokeWidth:`1.75`,strokeLinejoin:`round`},e.id)),u===void 0?null:(0,h.jsxs)(`g`,{children:[(0,h.jsx)(`line`,{x1:y(u),x2:y(u),y1:K$,y2:K$+i,stroke:`currentColor`,className:`text-ink-3`,strokeDasharray:`3 3`}),E.map(({one:e,value:t})=>(0,h.jsx)(`circle`,{cx:y(u),cy:b(t),r:`3.5`,fill:e.color},e.id))]})]}),u===void 0||E.length===0?null:(0,h.jsxs)(`div`,{className:`pointer-events-none absolute top-2 z-10 w-[340px] rounded-control border border-line bg-surface p-2 text-small shadow-md`,style:y(u)>c/2?{right:c-y(u)+12}:{left:y(u)+12},children:[(0,h.jsx)(`div`,{className:`mb-1 font-semibold`,children:t[u]}),E.map(({one:e,value:t})=>(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block size-2 shrink-0 rounded-full`,style:{background:e.color}}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),(0,h.jsx)(`span`,{className:`tabular-nums`,children:n(t)})]},e.id))]})]}),a?(0,h.jsx)(`figcaption`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-small text-ink-2`,children:e.map(e=>(0,h.jsxs)(`span`,{className:`flex max-w-[320px] items-center gap-2`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-[3px] w-4 shrink-0 rounded`,style:{background:e.color}}),(0,h.jsx)(`span`,{className:`truncate`,children:e.label})]},e.id))}):null]})}var J$=(e,t)=>`${e.origin}/api/studio/channels/${t}/report`;async function aSe(e,t){return L(await e.fetch(J$(e,t)))}async function oSe(e,t,n){return L(await e.fetch(J$(e,t),{method:`POST`,headers:{"content-type":n.type||`application/zip`},body:n}))}async function sSe(e,t,n){return L(await e.fetch(`${e.origin}/api/studio/channels/${t}/export-view`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({url:n})}))}function cSe({channelId:e,saved:t}){let{api:n}=B(),r=_(),i=Lv(),[a,o]=(0,m.useState)(),s=a??t??``,c=I({mutationFn:t=>sSe(n,e,t),onSuccess:t=>{r.setQueryData([`studio`,`report`,e],t),o(void 0),i(t.exportView?`The extension exports this view every day.`:`The extension no longer exports a view for this channel.`,`success`)},onError:e=>i(`The view wasn't saved: ${e.message}`,`error`)});return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(X,{"aria-label":`Studio Analytics view to export every day`,placeholder:`https://studio.youtube.com/channel/…/analytics/…/explore?…`,className:`min-w-0 flex-1 basis-[320px]`,value:s,onChange:e=>o(e.currentTarget.value)}),(0,h.jsx)(z,{type:`button`,disabled:c.isPending||s.trim()===(t??``),onClick:()=>c.mutate(s.trim()===``?null:s.trim()),children:`Save view`})]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`The Studio extension opens this view once a day, exports it and brings it in here: every column, and each video's numbers on its project. Paste the address of Analytics → Advanced mode as you set it up; the start date stays, the end moves to today.`})]})}function Y$(e,t,n){if(e===null)return`–`;if(typeof e==`string`)return e;if(t===`duration`){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=String(Math.round(e%60)).padStart(2,`0`);return t>0?`${String(t)}:${String(n).padStart(2,`0`)}:${r}`:`${String(n)}:${r}`}let r=/%|\(|rpm|revenue|hours/i.test(n)&&!Number.isInteger(e)?1:0;return e.toLocaleString(`en`,{minimumFractionDigits:r,maximumFractionDigits:r})}var X$=[`#7cb342`,`#42a5f5`,`#ef6c00`,`#ab47bc`,`#26a69a`,`#ec407a`,`#fdd835`,`#8d6e63`,`#5c6bc0`,`#78909c`],Z$=new Intl.DateTimeFormat(void 0,{day:`numeric`,month:`short`}),Q$=new Intl.DateTimeFormat(void 0,{month:`short`,year:`numeric`});function $$(e,t){if(t===`total`){let t=0;return e.map(e=>t+=e)}return t===`average`?e.map((t,n)=>{let r=e.slice(Math.max(0,n-6),n+1);return r.reduce((e,t)=>e+t,0)/r.length}):[...e]}function lSe({report:e,rows:t,picked:n,colorOf:r,shape:i,setShape:a,timeline:o,setTimeline:s,range:c,setRange:l}){let u=e.chartMetric??`Views`,[d,f]=(0,m.useState)(!1),p=t.filter(e=>n.includes(e.videoId)),g=e.from===null?new Date:new Date(`${e.from}T00:00:00`),_=Math.max(0,...t.map(e=>e.daily.length)),v,y;if(o===`dates`){let t=c===`all`?0:Math.max(0,_-Number(c)),n=_-t>200;v=Array.from({length:_-t},(e,r)=>{let i=new Date(g);return i.setDate(i.getDate()+t+r),(n?Q$:Z$).format(i)}),y=p.map(e=>{let n=e.daily.findIndex(e=>e>0),a=$$(e.daily,i).map((e,t)=>n<0||t<n?null:e);return{id:e.videoId,label:e.title,color:r(e.videoId),values:a.slice(t)}}),d&&e.dailyTotals!==void 0&&(y=[{id:`channel-total`,label:`Channel total`,color:`var(--color-ink-2)`,values:$$(e.dailyTotals,i).slice(t)},...y])}else{let e=Math.max(1,...p.map(e=>{let t=e.daily.findIndex(e=>e>0);return t<0?0:e.daily.length-t})),t=c===`all`?e:Math.min(e,Number(c));v=Array.from({length:t},(e,t)=>`Day ${String(t+1)}`),y=p.map(e=>{let n=Math.max(0,e.daily.findIndex(e=>e>0)),a=$$(e.daily.slice(n),i).slice(0,t);return{id:e.videoId,label:e.title,color:r(e.videoId),values:Array.from({length:t},(e,t)=>a[t]??null)}})}let b=i===`daily`?`${u} per day`:i===`average`?`${u} per day, 7-day average`:`${u}, running total`;return(0,h.jsxs)(`section`,{"aria-label":`Over time`,className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:b}),(0,h.jsx)(`span`,{className:`flex-1`}),e.dailyTotals===void 0||o!==`dates`?null:(0,h.jsxs)(`label`,{className:`flex items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.currentTarget.checked)}),`Channel total`]}),(0,h.jsx)(sL,{"aria-label":`Show`,className:`w-[200px]`,value:i,onChange:e=>a(e.currentTarget.value),options:[{value:`average`,label:`7-day average`},{value:`daily`,label:`Per day`},{value:`total`,label:`Running total`}]}),(0,h.jsx)(sL,{"aria-label":`Timeline`,className:`w-[220px]`,value:o,onChange:e=>s(e.currentTarget.value),options:[{value:`dates`,label:`By date`},{value:`since`,label:`Days since release`}]}),(0,h.jsx)(sL,{"aria-label":`Period`,className:`w-[170px]`,value:c,onChange:e=>l(e.currentTarget.value),options:[{value:`all`,label:o===`dates`?`All time`:`Whole life`},{value:`90`,label:o===`dates`?`Last 90 days`:`First 90 days`},{value:`30`,label:o===`dates`?`Last 30 days`:`First 30 days`}]})]}),p.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Tick videos in the Chart column below to compare them here.`}):(0,h.jsx)(q$,{series:y,xLabels:v,label:`${b} for ${String(p.length)} videos`,formatValue:e1})]})}var e1=e=>e>=1e4?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:Math.round(e).toLocaleString(`en`);function uSe({report:e,row:t,shape:n,range:r,colorOf:i}){let a=e.chartMetric??`Views`,o=e.from===null?new Date:new Date(`${e.from}T00:00:00`),s=t.daily.findIndex(e=>e>0);if(s<0)return(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Studio's export holds daily figures only for the videos drawn in its own chart. To chart this one, tick it in Advanced mode's chart before you export.`});let c=$$(t.daily.slice(s),n),l=r===`all`?0:Math.max(0,c.length-Number(r)),u=c.slice(l),d=u.map((e,t)=>{let n=new Date(o);return n.setDate(n.getDate()+s+l+t),(u.length>200?Q$:Z$).format(n)}),f=t.daily.reduce((e,t)=>e+t,0);return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`${a} · ${f.toLocaleString(`en`)} total`}),(0,h.jsx)(q$,{height:180,legend:!1,label:`${a} for ${t.title}`,xLabels:d,formatValue:e1,series:[{id:t.videoId,label:t.title,color:i(t.videoId),values:u}]})]})}var t1=e=>`slopify.studioReport.hidden.${e}`;function dSe(e){try{let t=window.localStorage.getItem(t1(e));return t===null?void 0:JSON.parse(t)}catch{return}}function n1({channelId:e}){let{api:t}=B(),n=_(),r=Lv(),i=(0,m.useRef)(null),a=[`studio`,`report`,e],o=F({queryKey:a,queryFn:()=>aSe(t,e)}),[s,c]=(0,m.useState)(0),[l,u]=(0,m.useState)(),[d,f]=(0,m.useState)(`average`),[p,g]=(0,m.useState)(`dates`),[v,y]=(0,m.useState)(`all`),[b,x]=(0,m.useState)(),[S,C]=(0,m.useState)(()=>dSe(e)),w=I({mutationFn:n=>oSe(t,e,n),onSuccess:e=>{n.setQueryData(a,e),r(`Imported ${String(e.report?.rows.length??0)} videos from Studio's export.`,`success`)},onError:e=>r(`The export wasn't imported: ${e.message}`,`error`)}),T=o.data?.report??null,E=T?.columns??[],D=E.filter((e,t)=>(T?.rows??[]).every(e=>e.values[t]===null)).map(e=>e.label),O=S??D,k=t=>{C(t);try{window.localStorage.setItem(t1(e),JSON.stringify(t))}catch{}},A=E.map((e,t)=>({column:e,index:t})).filter(({column:e})=>!O.includes(e.label)),j=(e,t)=>{let n=e.values[t];return typeof n==`number`?n:-1},M=[...T?.rows??[]].toSorted((e,t)=>j(t,s)-j(e,s)),ee=[...T?.rows??[]].toSorted((e,t)=>t.daily.reduce((e,t)=>e+t,0)-e.daily.reduce((e,t)=>e+t,0)),N=l??ee.slice(0,5).map(e=>e.videoId),te=e=>{let t=(T?.rows??[]).findIndex(t=>t.videoId===e);return X$[(t<0?0:t)%X$.length]??`#7cb342`};return(0,h.jsxs)(`section`,{"aria-label":`From Studio`,className:`flex flex-col gap-3`,children:[(0,h.jsxs)(U,{as:`h3`,title:`From Studio's export`,meta:T===null?void 0:`${String(T.rows.length)} videos · ${T.from??`?`} to ${T.to??`?`} · imported ${new Date(T.importedAt).toLocaleDateString()}`,children:[(0,h.jsx)(`input`,{ref:i,type:`file`,accept:`.zip,.csv,application/zip,text/csv`,hidden:!0,"aria-label":`Studio export file`,onChange:e=>{let t=e.currentTarget.files?.[0];t!==void 0&&w.mutate(t),e.currentTarget.value=``}}),(0,h.jsxs)(z,{type:`button`,variant:`secondary`,disabled:w.isPending,onClick:()=>i.current?.click(),children:[(0,h.jsx)(Cl,{"aria-hidden":`true`,strokeWidth:1.75}),w.isPending?`Importing…`:`Import from Studio`]})]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`In YouTube Studio, open Analytics → Advanced mode, choose the metrics as columns, press the Export arrow → Comma-separated values, and import the zip it downloads here. Every column comes along; a new import replaces the old one.`}),(0,h.jsx)(cSe,{channelId:e,saved:o.data?.exportView??null}),T===null?null:(0,h.jsxs)(h.Fragment,{children:[T.chartMetric===null?null:(0,h.jsx)(lSe,{report:T,rows:M,picked:N,colorOf:te,shape:d,setShape:f,timeline:p,setTimeline:g,range:v,setRange:y}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(sL,{"aria-label":`Order by`,className:`w-[280px]`,value:String(s),onChange:e=>c(Number(e.currentTarget.value)),options:E.map((e,t)=>({value:String(t),label:`Most ${e.label}`}))}),(0,h.jsxs)(`details`,{className:`text-small`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Columns (`,String(A.length),` of `,String(E.length),`)`]}),(0,h.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 sm:grid-cols-3`,children:E.map(e=>(0,h.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:!O.includes(e.label),onChange:t=>k(t.currentTarget.checked?O.filter(t=>t!==e.label):[...O,e.label])}),e.label]},e.label))})]})]}),(0,h.jsx)(`div`,{className:`overflow-x-auto`,children:(0,h.jsxs)(`table`,{className:`sl-table [&_td]:px-3 [&_th]:px-3 [&_td.num]:whitespace-nowrap`,children:[(0,h.jsx)(`caption`,{className:`sr-only`,children:`Studio's numbers for every video`}),(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{children:[T.chartMetric===null?null:(0,h.jsx)(`th`,{scope:`col`,children:`Chart`}),(0,h.jsx)(`th`,{scope:`col`,children:`Video`}),A.map(({column:e})=>(0,h.jsx)(`th`,{scope:`col`,className:`num`,children:e.label},e.label))]})}),(0,h.jsxs)(`tbody`,{children:[(0,h.jsxs)(`tr`,{className:`font-semibold`,children:[T.chartMetric===null?null:(0,h.jsx)(`td`,{}),(0,h.jsx)(`td`,{children:`Total`}),A.map(({column:e,index:t})=>(0,h.jsx)(`td`,{className:`num`,children:Y$(T.totals[t]??null,e.kind,e.label)},e.label))]}),M.map(e=>{let t=o.data?.projects[e.videoId],n=b===e.videoId;return(0,h.jsxs)(m.Fragment,{children:[(0,h.jsxs)(`tr`,{children:[T.chartMetric===null?null:(0,h.jsx)(`td`,{children:(0,h.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,disabled:!e.daily.some(e=>e>0),"aria-label":`Compare ${e.title} in the chart`,checked:N.includes(e.videoId),onChange:t=>u(t.currentTarget.checked?[...N,e.videoId]:N.filter(t=>t!==e.videoId))}),(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block size-2.5 rounded-full`,style:{background:N.includes(e.videoId)?te(e.videoId):`transparent`}})]})}),(0,h.jsxs)(`td`,{className:`max-w-[320px]`,children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[T.chartMetric===null?null:(0,h.jsx)(Nv,{size:`small`,"aria-expanded":n,label:`${n?`Hide`:`Show`} the chart of ${e.title}`,onClick:()=>x(n?void 0:e.videoId),children:n?(0,h.jsx)(jc,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(Nc,{"aria-hidden":`true`,strokeWidth:1.75})}),t===void 0?(0,h.jsx)(`span`,{className:`block truncate`,title:e.title,children:e.title}):(0,h.jsx)(pa,{to:`/projects/$projectId`,params:{projectId:t.projectId},className:`block truncate`,title:e.title,children:e.title})]}),(0,h.jsx)(`span`,{className:`text-label text-ink-3`,children:e.published??``})]}),A.map(({column:t,index:n})=>(0,h.jsx)(`td`,{className:`num`,children:Y$(e.values[n]??null,t.kind,t.label)},t.label))]}),n?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:A.length+2,children:(0,h.jsx)(uSe,{report:T,row:e,shape:d,range:v,colorOf:te})})}):null]},e.videoId)})]})]})})]})]})}var r1=e=>e==null?`–`:Math.round(e).toLocaleString(`en`),i1=e=>e==null?`–`:`${e.toFixed(1)}%`;function a1(e){if(e==null)return`–`;let t=Math.round(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${String(n)}:${String(r).padStart(2,`0`)}:${i}`:`${String(r)}:${i}`}var fSe=new Intl.DateTimeFormat(void 0,{day:`numeric`,month:`short`,year:`numeric`}),o1=e=>e===null?`–`:fSe.format(new Date(e));function s1({label:e,totals:t}){return(0,h.jsxs)(`section`,{"aria-label":e,className:`flex flex-col gap-2`,children:[(0,h.jsx)(U,{as:`h3`,title:e,meta:`${String(t.videos)} on YouTube`}),(0,h.jsxs)(B$,{children:[(0,h.jsx)(V$,{value:r1(t.views),label:`Views`}),(0,h.jsx)(V$,{value:r1(t.impressions),label:`Impressions`}),(0,h.jsx)(V$,{value:i1(t.ctr),label:`Click-through rate`}),(0,h.jsx)(V$,{value:a1(t.averageViewSeconds),label:`Average view duration`}),(0,h.jsx)(V$,{value:r1(t.watchHours),label:`Watch hours`})]})]})}var c1=(e,t)=>{let n=e.long?.stats??null;return t===`views`?(n?.views??0)+e.shorts.reduce((e,t)=>e+(t.stats?.views??0),0):t===`ctr`?n?.ctr??-1:t===`duration`?n?.averageViewSeconds??-1:Date.parse(e.long?.releasedAt??e.shorts[0]?.releasedAt??``)||0};function pSe({channelId:e}){let{api:t}=B(),[n,r]=(0,m.useState)(`newest`),i=F({queryKey:[`studio`,`performance`,e],queryFn:()=>ys(t,e)});if(i.isPending)return(0,h.jsx)(`p`,{className:`text-small text-ink-3`,children:`Loading the numbers…`});if(i.isError)return(0,h.jsxs)(`p`,{className:`text-small text-danger`,children:[`The numbers didn't load: `,i.error.message,` Reload the page to try again.`]});let a=i.data;if(a.projects.length===0)return(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,h.jsx)(n1,{channelId:e}),(0,h.jsx)(aQ,{title:`No video of this channel is known on YouTube yet`,children:`Upload with the Slopify Studio extension, or open YouTube Studio's Content list once so the extension links your videos. Their numbers then arrive daily, or at once with Read Studio numbers now in the extension's popup.`})]});let o=a.projects.toSorted((e,t)=>c1(t,n)-c1(e,n)).flatMap(e=>[...e.long===null?[]:[{key:`${e.projectId}-0`,projectId:e.projectId,row:e.long,isShort:!1}],...e.shorts.map(t=>({key:`${e.projectId}-${String(t.short??0)}`,projectId:e.projectId,row:t,isShort:!0}))]);return(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Studio's numbers as the Slopify Studio extension last read them`,a.readAt===null?``:` (newest ${o1(a.readAt)})`,`: daily while Chrome is open, or at once with Read Studio numbers now in the extension's popup. "–" is a number Studio doesn't show for that video (most shorts have no click-through rate).`]}),(0,h.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:[(0,h.jsx)(s1,{label:`Long videos`,totals:a.long}),(0,h.jsx)(s1,{label:`Shorts`,totals:a.shorts})]}),(0,h.jsx)(n1,{channelId:e}),(0,h.jsxs)(`section`,{"aria-label":`Every video`,className:`flex flex-col gap-2`,children:[(0,h.jsx)(U,{as:`h3`,title:`Every video`,children:(0,h.jsx)(sL,{"aria-label":`Order`,value:n,onChange:e=>r(e.currentTarget.value),options:[{value:`newest`,label:`Newest first`},{value:`views`,label:`Most views`},{value:`ctr`,label:`Best click-through rate`},{value:`duration`,label:`Longest average view`}]})}),(0,h.jsx)(`div`,{className:`overflow-x-auto`,children:(0,h.jsx)(U$,{columns:[{id:`title`,header:`Video`,cell:e=>e.isShort?(0,h.jsx)(`span`,{className:`block pl-5 text-small text-ink-2`,children:`Short ${String(e.row.short??``)} · ${e.row.title}`}):(0,h.jsx)(pa,{to:`/projects/$projectId`,params:{projectId:e.projectId},children:e.row.title})},{id:`out`,header:`Released`,cell:e=>o1(e.row.releasedAt)},{id:`impressions`,header:`Impressions`,numeric:!0,cell:e=>r1(e.row.stats?.impressions)},{id:`ctr`,header:`CTR`,numeric:!0,cell:e=>i1(e.row.stats?.ctr)},{id:`views`,header:`Views`,numeric:!0,cell:e=>r1(e.row.stats?.views)},{id:`duration`,header:`Avg view`,numeric:!0,cell:e=>a1(e.row.stats?.averageViewSeconds)},{id:`hours`,header:`Watch hours`,numeric:!0,cell:e=>e.row.stats?.watchHours===null||e.row.stats?.watchHours===void 0?`–`:e.row.stats.watchHours.toFixed(1)}],rows:o,rowKey:e=>e.key,caption:`The channel's videos and shorts with Studio's numbers`})})]})]})}var l1=[`brand`,`cast`,`templates`,`schedules`,`episodes`,`videos`,`youtube`],u1={brand:`Brand`,cast:`Cast`,templates:`Templates`,schedules:`Schedules`,episodes:`Episodes`,videos:`Existing videos`,youtube:`YouTube numbers`};function mSe(e){return l1.find(t=>t===e)??`brand`}function hSe({channelId:e,tab:t,onTab:n}){let{api:r}=B(),i=_(),a=Yi(),o=F(Zy(r,e)),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(null),d=I({mutationFn:()=>$y(r,e),onSuccess:async()=>{c(!1),await i.invalidateQueries({queryKey:Ky}),await a({to:`/channels`})}}),f=o.data?.channel,p=o.data?.cast??[];Wv(f===void 0?void 0:`${f.name} · ${u1[t]}`);let g=()=>{n(`cast`),u(`new`)};return cb({id:`channel.add-to-cast`,title:`Add to cast`,group:`Channel`,...f===void 0?{}:{context:f.name},keywords:[`character`,`creature`,`place`,`object`],run:g}),o.error!==null&&o.data===void 0?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(pG,{crumb:(0,h.jsx)(pa,{to:`/channels`,children:`Channels`}),title:`Channel not opened`}),(0,h.jsx)(aQ,{title:`This channel could not be opened`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(GO,{to:`/channels`,variant:`primary`,children:`Open Channels`}),(0,h.jsx)(z,{disabled:o.isFetching,disabledReason:`Trying again…`,onClick:()=>void o.refetch(),children:`Try again`})]}),children:`${o.error.message} A deleted channel is gone for good (its videos moved to the default channel). Pick a channel from Channels, or press Try again.`})]}):(0,h.jsxs)(`div`,{children:[(0,h.jsx)(pG,{crumb:(0,h.jsx)(pa,{to:`/channels`,children:`Channels`}),title:f?.name??`Channel`,meta:f?.isDefault?`Default channel`:void 0,actions:(0,h.jsxs)(h.Fragment,{children:[t===`cast`&&f?(0,h.jsxs)(z,{variant:`primary`,onClick:g,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add to cast`]}):null,f&&!f.isDefault?(0,h.jsx)(z,{variant:`quiet`,onClick:()=>{d.reset(),c(!0)},children:`Delete channel`}):null]})}),(0,h.jsx)(rQ,{items:l1.map(e=>({id:e,label:u1[e],...e===`cast`?{badge:String(p.length)}:{}})),value:t,onChange:n,label:`Channel sections`,idPrefix:`channel`,className:`mb-6`}),(0,h.jsx)(SR,{tone:o.error?`error`:`info`,className:`mb-2`,children:o.error?`The channel couldn't be read again: ${o.error.message} What is shown may be out of date; reload the page to try again.`:o.isPending?`Loading the channel…`:void 0}),f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(iQ,{idPrefix:`channel`,id:`brand`,active:t===`brand`,children:[(0,h.jsx)(hxe,{channel:f}),(0,h.jsx)(Exe,{channel:f},`${f.id}:${String(f.version)}`)]}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`cast`,active:t===`cast`,children:(0,h.jsx)(Uxe,{channelId:f.id,cast:p,selected:l,onSelect:u})}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`templates`,active:t===`templates`,children:t===`templates`?(0,h.jsx)(ube,{channelId:f.id}):null}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`schedules`,active:t===`schedules`,children:t===`schedules`?(0,h.jsx)(dbe,{channelId:f.id}):null}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`episodes`,active:t===`episodes`,children:t===`episodes`?(0,h.jsx)($xe,{channelId:f.id}):null}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`videos`,active:t===`videos`,children:t===`videos`?(0,h.jsx)(z$,{channelId:f.id}):null}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`youtube`,active:t===`youtube`,children:t===`youtube`?(0,h.jsx)(pSe,{channelId:f.id}):null})]}):null,(0,h.jsx)($v,{open:s,title:E$(f?.name),consequence:d.error?.message??D$,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:d.isPending,onConfirm:()=>d.mutate(),onCancel:()=>c(!1)})]})}function gSe(){let{api:e}=B(),t=_(),n=Yi(),r=F(Xy(e)),[i,a]=(0,m.useState)(null),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(null),f=r.data?.find(e=>e.id===u)??r.data?.[0],p=I({mutationFn:()=>mre(e,crypto.randomUUID(),c.trim()),onSuccess:async e=>{await t.invalidateQueries({queryKey:Ky}),a(null),l(``),await n({to:`/channels/$channelId`,params:{channelId:e.id}})}}),g=I({mutationFn:t=>Qy(e,t.id,{name:c.trim(),brand:t.brand,seriesBrief:t.seriesBrief,baseVersion:t.version}),onSuccess:async()=>{await t.invalidateQueries({queryKey:Ky}),a(null)}}),v=I({mutationFn:t=>$y(e,t.id),onSuccess:async()=>{s(null),await t.invalidateQueries({queryKey:Ky})}}),y=()=>{p.reset(),l(``),a(`new`)};cb({id:`channels.new`,title:`New channel`,group:`Channels`,run:y});let b=i===`new`?p:g,x=()=>{c.trim()!==``&&i!==null&&(i===`new`?p.mutate():g.mutate(i))};return(0,h.jsxs)(`div`,{"data-tour":`channels`,children:[(0,h.jsx)(pG,{title:`Channels`,meta:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`A channel keeps its brand kit, cast, series brief, templates and schedules together.`,(0,h.jsx)(H,{id:`planning.channels`})]}),actions:(0,h.jsxs)(z,{variant:`primary`,"aria-expanded":i===`new`,onClick:y,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`New channel`]})}),(0,h.jsx)(SR,{tone:r.error||v.error?`error`:`info`,className:`mb-2`,children:r.error?`The channels couldn't be loaded: ${r.error.message} Reload the page to try again.`:o===null&&v.error?v.error.message:r.isPending?`Loading channels…`:void 0}),r.data?.length===0?(0,h.jsx)(aQ,{title:`No channels yet`,actions:(0,h.jsx)(z,{variant:`primary`,onClick:y,children:`New channel`}),children:`Make one for each series you run; it keeps that series' look and cast.`}):null,r.data?.length?(0,h.jsx)(gG,{list:(0,h.jsx)(KL,{label:`Channels`,className:`[&_.sl-row__actions]:flex-wrap`,children:r.data.map(e=>(0,h.jsx)(qL,{selected:e.id===f?.id,onSelect:()=>d(e.id),title:e.name,meta:`${e.isDefault?`Default · `:``}${String(e.templates)} ${e.templates===1?`template`:`templates`} · ${String(e.cast)} in the cast`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(KO,{to:`/channels/$channelId`,params:{channelId:e.id},"aria-label":`Open ${e.name}`,className:`px-2 text-small`,children:`Open`}),(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Rename ${e.name}`,onClick:()=>{g.reset(),l(e.name),a(e)},children:`Rename`}),e.isDefault?null:(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Delete ${e.name}`,onClick:()=>{v.reset(),s(e)},children:`Delete`})]})},e.id))}),detail:f===void 0?null:(0,h.jsx)(_Se,{channel:f})}):null,(0,h.jsx)(Qv,{open:i!==null,onOpenChange:e=>{!e&&!b.isPending&&a(null)},title:i===`new`||i===null?`New channel`:`Rename ${i.name}`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(SR,{tone:b.error?`error`:`info`,children:b.error?.message??(b.isPending?`Saving…`:void 0)}),(0,h.jsx)(z,{disabled:b.isPending,onClick:()=>a(null),children:`Cancel`}),(0,h.jsx)(z,{type:`submit`,form:`channel-name-form`,variant:`primary`,disabled:b.isPending||c.trim()===``,children:i===`new`?`Create channel`:`Rename channel`})]}),children:(0,h.jsx)(`form`,{id:`channel-name-form`,"aria-label":i===`new`?`New channel`:`Rename channel`,onSubmit:e=>{e.preventDefault(),x()},children:(0,h.jsx)(iL,{label:`Channel name`,tip:`planning.channel.name`,children:(0,h.jsx)(X,{value:c,maxLength:200,required:!0,disabled:b.isPending,onChange:e=>l(e.target.value)})})})}),(0,h.jsx)($v,{open:o!==null,title:E$(o?.name),consequence:v.error?.message??D$,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:v.isPending,onConfirm:()=>{o&&v.mutate(o)},onCancel:()=>s(null)})]})}function _Se({channel:e}){let t=e.brand,n=[[`Intro`,t.intro??`None`],[`Outro`,t.outro??`None`],[`PDF theme`,t.documentTheme??`Default`],[`End screen text`,t.endScreenText??`None`]];return(0,h.jsxs)(`section`,{"aria-label":`About ${e.name}`,children:[(0,h.jsx)(U,{title:`About ${e.name}`,meta:e.isDefault?`The default channel`:void 0,children:(0,h.jsx)(GO,{to:`/channels/$channelId`,params:{channelId:e.id},children:`Open channel`})}),(0,h.jsxs)(B$,{className:`mb-6`,children:[(0,h.jsx)(V$,{value:String(e.templates),label:`Templates`}),(0,h.jsx)(V$,{value:String(e.cast),label:`In the cast`})]}),(0,h.jsx)(U,{as:`h3`,title:`Series brief`,className:`pb-2`}),(0,h.jsx)(`p`,{className:`m-0 mb-6 whitespace-pre-wrap text-body text-ink-2`,children:e.seriesBrief.trim()===``?`No series brief yet. Open the channel to say what it covers.`:e.seriesBrief}),(0,h.jsx)(U,{as:`h3`,title:`Brand kit`,className:`pb-2`}),(0,h.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-small`,children:n.map(([e,t])=>(0,h.jsxs)(`div`,{className:`contents`,children:[(0,h.jsx)(`dt`,{className:`text-ink-2`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 truncate`,children:t})]},e))})]})}var d1=2e3;function f1(e,t){let n=(0,m.useRef)(t);(0,m.useEffect)(()=>{n.current=t}),(0,m.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{n.current()},d1);return()=>{clearTimeout(t)}},[e])}function p1(){return(0,h.jsxs)(`span`,{className:`inline-flex animate-tick-in items-center gap-1 text-label text-accent-ink motion-reduce:animate-none`,children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,className:`size-[14px]`}),`Saved`]})}function m1({onDelete:e,blocked:t,blockedId:n,pending:r,saved:i,cancel:a,errors:o,onSave:s}){let c=t!==void 0||r||i,l=Lv();cb({id:`editor.save`,title:`Save`,group:`This editor`,keywords:[`save`,`keep`],shortcut:lk.save,run:()=>{c?t!==void 0&&l(`Not saved yet: ${t}`,`error`):s()}});let u=o.join(` `);return(0,h.jsxs)(`div`,{"data-slot":`editor-actions`,className:`sticky bottom-0 z-10 flex flex-wrap items-center gap-3 border-t border-line bg-ground py-3 max-md:bottom-[calc(48px+max(12px,env(safe-area-inset-bottom)))]`,children:[(0,h.jsx)(z,{variant:`destructive`,onClick:e,disabled:e===void 0,"aria-hidden":e===void 0||void 0,tabIndex:e===void 0?-1:void 0,style:e===void 0?{visibility:`hidden`}:void 0,children:`Delete`}),(0,h.jsx)(SR,{tone:u?`error`:`info`,id:u?void 0:n,children:u||(i?(0,h.jsx)(p1,{}):t)}),a,(0,h.jsx)(z,{variant:`primary`,"aria-disabled":c,"aria-describedby":t===void 0?void 0:n,"aria-keyshortcuts":bb(lk.save),onClick:()=>{c||s()},children:`Save`})]})}var vSe=`rounded-media border border-line bg-surface p-4`;function h1(){return(0,h.jsxs)(`div`,{className:`mx-auto grid max-w-[1440px] grid-cols-[minmax(0,1fr)] gap-6 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,h.jsxs)(`div`,{className:`${vSe} flex flex-col gap-4`,children:[(0,h.jsx)(`span`,{className:`h-8 w-64 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-[520px] rounded-control bg-sunken`})]}),(0,h.jsx)(`div`,{className:`flex flex-col gap-3 pt-1`,children:(0,h.jsx)(`span`,{className:`h-3 w-28 rounded-control bg-sunken`})})]})}var ySe=`modulepreload`,bSe=function(e){return`/`+e},g1={},_1=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=bSe(t,n),t=s(t),t in g1)return;g1[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ySe,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function v1({data:e,label:t,onDrawn:n}){let r=(0,m.useRef)(null),[i,a]=(0,m.useState)(0);return(0,m.useEffect)(()=>{let e=r.current;if(e===null)return;let t=new ResizeObserver(([e])=>{a(Math.floor(e?.contentRect.width??0))});return t.observe(e),()=>{t.disconnect()}},[]),(0,m.useEffect)(()=>{let t=r.current;if(t===null||e===void 0||i===0)return;let a=!1;return xSe(e,i).then(e=>{a||(t.replaceChildren(...e),n?.(void 0))},e=>{a||n?.(e instanceof Error?e:Error(String(e)))}),()=>{a=!0}},[e,i,n]),(0,h.jsx)(`div`,{ref:r,role:`img`,"aria-label":t,className:`flex flex-col gap-3 [&>canvas]:w-full [&>canvas]:shadow-[var(--shadow-pop)]`})}async function xSe(e,t){let n=await _1(()=>import(`./pdf-Bw4akucO.js`),[]),r=await _1(()=>import(`./pdf.worker.min-zC6nfbxG.js`),[]);n.GlobalWorkerOptions.workerSrc=r.default;let i=n.getDocument({data:e.slice()}),a=await i.promise;try{let e=window.devicePixelRatio||1,n=[];for(let r=1;r<=a.numPages;r+=1){let i=await a.getPage(r),o=i.getViewport({scale:t*e/i.getViewport({scale:1}).width}),s=window.document.createElement(`canvas`);s.width=Math.floor(o.width),s.height=Math.floor(o.height),await i.render({canvas:s,viewport:o}).promise,n.push(s)}return n}finally{await i.destroy()}}var y1=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`mm`,step:1,...n===void 0?{}:{help:n}}),b1=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`pt`,step:.5,...n===void 0?{}:{help:n}}),x1=(e,t,n,r)=>({kind:`number`,path:e,label:t,unit:n,step:.05,...r===void 0?{}:{help:r}}),S1=(e,t,n)=>({kind:`toggle`,path:e,label:t,...n===void 0?{}:{help:n}}),C1=(e,t,n)=>({kind:`text`,path:e,label:t,...n===void 0?{}:{help:n}}),w1=(e,t,n)=>({kind:`optional-text`,path:e,label:t,...n===void 0?{}:{help:n}}),T1=(e,t,n)=>({kind:`face`,path:[`fonts`,e],label:t,...n===void 0?{}:{help:n}}),E1=[{title:`Page`,fields:[{kind:`choice`,path:[`page`,`format`],label:`Paper size`,options:[{value:`a4`,label:`A4`},{value:`letter`,label:`US Letter`}]},y1([`page`,`margin`],`Margins`),y1([`page`,`contentTop`],`Text starts at`,`From the top, on pages with the header.`),{kind:`choice`,path:[`background`,`image`],label:`Background`,options:[{value:`parchment`,label:`Parchment texture`},{value:null,label:`Flat colour`}]},{kind:`color`,path:[`background`,`color`],label:`Page colour`,help:`Used when the background is a flat colour.`}]},{title:`Colours`,fields:[{kind:`color`,path:[`colors`,`heading`],label:`Headings`,help:`Also drop caps, the brand name and links.`},{kind:`color`,path:[`colors`,`text`],label:`Body text`},{kind:`color`,path:[`colors`,`muted`],label:`Muted`,help:`Dates, bullets, quotes and the dots in the contents.`},{kind:`color`,path:[`colors`,`faint`],label:`Faint`,help:`Running header and page numbers.`}]},{title:`Fonts`,fields:[T1(`body`,`Body`),T1(`strong`,`Bold text`),T1(`emphasis`,`Italic text`),T1(`heading`,`Headings`),T1(`dramatic`,`Chapter numbers and brand`,`The big number of a "Chapter 3:" heading.`),T1(`decorative`,`Tagline and title-page link`),T1(`dropCap`,`Drop caps`),T1(`footer`,`Header and page numbers`)]},{title:`Text sizes`,fields:[b1([`sizes`,`title`],`Title`),b1([`sizes`,`brand`],`Brand`),b1([`sizes`,`section`],`Top-level headings`,`Also the titles of the contents, sources and closing pages.`),b1([`sizes`,`heading`],`Second-level headings`),b1([`sizes`,`subheading`],`Third-level headings`),b1([`sizes`,`body`],`Body`),b1([`sizes`,`meta`],`Date and word count`),b1([`sizes`,`footer`],`Header and page numbers`)]},{title:`Spacing`,fields:[y1([`spacing`,`bodyLine`],`Body line height`),y1([`spacing`,`headingLine`],`Heading line height`),y1([`spacing`,`subheadingLine`],`Subheading line height`),x1([`spacing`,`paragraphGap`],`After a paragraph`,`× line`),x1([`spacing`,`headingGap`],`Before a heading`,`× line`),x1([`spacing`,`itemGap`],`After a list item`,`× line`),y1([`spacing`,`listIndent`],`List indent`),y1([`spacing`,`quoteIndent`],`Quote indent`),y1([`spacing`,`ruleWidth`],`Divider width`,`The short centred line a --- becomes.`)]},{title:`Drop caps`,fields:[S1([`dropCap`,`enabled`],`Drop caps`,`A large first letter after each heading.`),{kind:`choice`,path:[`dropCap`,`lines`],label:`Lines tall`,options:[{value:2,label:`2 lines`},{value:3,label:`3 lines`},{value:4,label:`4 lines`}]},x1([`dropCap`,`scale`],`Letter size`,`× lines`),y1([`dropCap`,`gap`],`Gap beside it`),{kind:`number`,path:[`dropCap`,`minLength`],label:`Shortest paragraph`,unit:`chars`,step:10,help:`Shorter paragraphs start plainly.`},x1([`dropCap`,`minRoom`],`Room needed`,`of page`,`With less room left, the paragraph starts on the next page.`)]},{title:`Title page`,fields:[y1([`titlePage`,`brandY`],`Brand from top`),y1([`titlePage`,`taglineOffset`],`Tagline below brand`),y1([`titlePage`,`titleY`],`Title from top`),y1([`titlePage`,`titleLine`],`Title line height`),y1([`titlePage`,`metaOffset`],`Details below title`),y1([`titlePage`,`metaLine`],`Details line height`),S1([`titlePage`,`showDate`],`Show the date`),S1([`titlePage`,`showWordCount`],`Show the word count`),S1([`titlePage`,`cover`,`enabled`],`Thumbnail as cover`,`When the project has a thumbnail.`),y1([`titlePage`,`cover`,`gap`],`Space around cover`),y1([`titlePage`,`cover`,`maxHeight`],`Cover height at most`)]},{title:`Branding`,fields:[w1([`brand`,`name`],`Brand name`,`Leave empty to hide the brand.`),w1([`brand`,`tagline`],`Tagline`),w1([`brand`,`url`],`Website`,`Where the brand and its link go.`),w1([`brand`,`linkLabel`],`Link text`,`The linked line under the word count.`)]},{title:`Contents page`,fields:[S1([`contents`,`enabled`],`Contents page`),C1([`contents`,`title`],`Title`),{kind:`choice`,path:[`contents`,`depth`],label:`Lists headings down to`,options:[{value:1,label:`Top level`},{value:2,label:`Second level`},{value:3,label:`Third level`}]},y1([`contents`,`titleOffset`],`Title from top margin`),y1([`contents`,`firstEntryOffset`],`First entry from top margin`),y1([`contents`,`line`],`Line height`),y1([`contents`,`indent`],`Indent per level`)]},{title:`Header and footer`,fields:[S1([`header`,`enabled`],`Running header`,`The title at the top of each page.`),y1([`header`,`top`],`Header from top`),{kind:`number`,path:[`header`,`maxTitleCharacters`],label:`Header title at most`,unit:`chars`,step:1},S1([`footer`,`enabled`],`Page numbers`),C1([`footer`,`text`],`Page number text`,`{page} becomes the page number.`),y1([`footer`,`bottom`],`From the bottom`),y1([`footer`,`reserve`],`Space kept above it`)]},{title:`Sources page`,fields:[S1([`sources`,`enabled`],`Sources page`,`The links the article and research used.`),C1([`sources`,`title`],`Title`),y1([`sources`,`titleOffset`],`Title from top margin`),y1([`sources`,`bodyOffset`],`List from top margin`),y1([`sources`,`line`],`Line height`),y1([`sources`,`gap`],`Gap between sources`)]},{title:`Closing page`,fields:[S1([`endPage`,`enabled`],`Closing page`),C1([`endPage`,`title`],`Title`),{kind:`lines`,path:[`endPage`,`lines`],label:`Text`,help:`One line each. Start with "•" for a bullet, end with ":" for a bold label, leave a line empty for a gap.`},S1([`endPage`,`showDocumentDetails`],`Add date, word and page counts`),{kind:`link`,path:[`endPage`,`link`],label:`Link`},w1([`endPage`,`closing`],`Closing line`),y1([`endPage`,`titleOffset`],`Title from top margin`),y1([`endPage`,`bodyOffset`],`Text from top margin`)]},{title:`PDF details`,fields:[C1([`metadata`,`author`],`Author`,`Shown in a PDF reader's document properties. {title} becomes the title.`),C1([`metadata`,`subject`],`Subject`),C1([`metadata`,`keywords`],`Keywords`),C1([`metadata`,`creator`],`Creator`)]}],D1=zD.map(e=>({value:e,label:{Cinzel:`Cinzel`,Literata:`Literata`,times:`Times`,helvetica:`Helvetica`,courier:`Courier`}[e]}));function O1(e){let t={normal:`Regular`,medium:`Medium`,bold:`Bold`,black:`Black`,italic:`Italic`,bolditalic:`Bold italic`};return(e===`Cinzel`?[`normal`,`medium`,`bold`,`black`]:[`normal`,`bold`,`italic`,`bolditalic`]).map(e=>({value:e,label:t[e]}))}function k1(e,t){let n=e;for(let e of t)n=n?.[e];return n}function A1(e,t,n){let[r,...i]=t;if(r===void 0)return n;let a=e[r];return{...e,[r]:i.length===0?n:A1(a,i,n)}}function SSe(e){let t=KD;for(let n of e)t=t?.shape?.[n];return{min:t?.minValue??0,max:t?.maxValue??1e3}}function j1(e){return`values.${e.join(`.`)}`}var M1=`pt-1`,N1=`flex min-w-0 flex-col gap-3 pt-1 lg:sticky lg:top-16`;function P1({children:e}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{children:`Library`}),(0,h.jsx)(Nc,{"aria-hidden":`true`}),e]})}function F1({children:e,back:t}){return(0,h.jsxs)(`div`,{className:`mx-auto flex max-w-[1440px] flex-col gap-3`,children:[(0,h.jsx)(fM,{tone:`danger`,title:`This can't be opened.`,children:e}),(0,h.jsx)(`p`,{className:`m-0 text-small text-accent-ink underline underline-offset-[3px]`,children:t})]})}function I1(e){return`theme-group-${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`)}`}function CSe({problems:e,changed:t}){return e===0&&t===0?null:(0,h.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-small font-normal`,children:[e===0?null:(0,h.jsx)(nk,{tone:`failed`,children:`${String(e)} to fix`}),t===0?null:(0,h.jsx)(nk,{children:`${String(t)} changed`})]})}function wSe({groups:e,onJump:t}){return(0,h.jsx)(`nav`,{"aria-label":`Theme groups`,className:`flex flex-wrap gap-1 border-t border-line pt-3`,children:e.map(e=>{let n=[e.problems===0?``:`${String(e.problems)} to fix`,e.changed===0?``:`${String(e.changed)} changed`].filter(e=>e!==``);return(0,h.jsx)(z,{variant:`quiet`,size:`small`,className:e.problems===0?void 0:`text-danger`,onClick:()=>t(e.title),children:n.length===0?e.title:`${e.title} · ${n.join(` · `)}`},e.title)})})}var TSe={"values.page.format":`library.theme.page.format`,"values.page.margin":`library.theme.page.margin`,"values.page.contentTop":`library.theme.page.content-top`,"values.background.image":`library.theme.background.image`,"values.background.color":`library.theme.background.color`,"values.colors.heading":`library.theme.colors.heading`,"values.colors.text":`library.theme.colors.text`,"values.colors.muted":`library.theme.colors.muted`,"values.colors.faint":`library.theme.colors.faint`,"values.fonts.body":`library.theme.fonts.body`,"values.fonts.strong":`library.theme.fonts.strong`,"values.fonts.emphasis":`library.theme.fonts.emphasis`,"values.fonts.heading":`library.theme.fonts.heading`,"values.fonts.dramatic":`library.theme.fonts.dramatic`,"values.fonts.decorative":`library.theme.fonts.decorative`,"values.fonts.dropCap":`library.theme.fonts.drop-cap`,"values.fonts.footer":`library.theme.fonts.footer`,"values.sizes.title":`library.theme.sizes.title`,"values.sizes.brand":`library.theme.sizes.brand`,"values.sizes.section":`library.theme.sizes.section`,"values.sizes.heading":`library.theme.sizes.heading`,"values.sizes.subheading":`library.theme.sizes.subheading`,"values.sizes.body":`library.theme.sizes.body`,"values.sizes.meta":`library.theme.sizes.meta`,"values.sizes.footer":`library.theme.sizes.footer`,"values.spacing.bodyLine":`library.theme.spacing.body-line`,"values.spacing.headingLine":`library.theme.spacing.heading-line`,"values.spacing.subheadingLine":`library.theme.spacing.subheading-line`,"values.spacing.paragraphGap":`library.theme.spacing.paragraph-gap`,"values.spacing.headingGap":`library.theme.spacing.heading-gap`,"values.spacing.itemGap":`library.theme.spacing.item-gap`,"values.spacing.listIndent":`library.theme.spacing.list-indent`,"values.spacing.quoteIndent":`library.theme.spacing.quote-indent`,"values.spacing.ruleWidth":`library.theme.spacing.rule-width`,"values.dropCap.enabled":`library.theme.drop-cap.enabled`,"values.dropCap.lines":`library.theme.drop-cap.lines`,"values.dropCap.scale":`library.theme.drop-cap.scale`,"values.dropCap.gap":`library.theme.drop-cap.gap`,"values.dropCap.minLength":`library.theme.drop-cap.min-length`,"values.dropCap.minRoom":`library.theme.drop-cap.min-room`,"values.titlePage.brandY":`library.theme.title-page.brand-y`,"values.titlePage.taglineOffset":`library.theme.title-page.tagline-offset`,"values.titlePage.titleY":`library.theme.title-page.title-y`,"values.titlePage.titleLine":`library.theme.title-page.title-line`,"values.titlePage.metaOffset":`library.theme.title-page.meta-offset`,"values.titlePage.metaLine":`library.theme.title-page.meta-line`,"values.titlePage.showDate":`library.theme.title-page.show-date`,"values.titlePage.showWordCount":`library.theme.title-page.show-word-count`,"values.titlePage.cover.enabled":`library.theme.title-page.cover`,"values.titlePage.cover.gap":`library.theme.title-page.cover-gap`,"values.titlePage.cover.maxHeight":`library.theme.title-page.cover-height`,"values.brand.name":`library.theme.brand.name`,"values.brand.tagline":`library.theme.brand.tagline`,"values.brand.url":`library.theme.brand.url`,"values.brand.linkLabel":`library.theme.brand.link-label`,"values.contents.enabled":`library.theme.contents.enabled`,"values.contents.title":`library.theme.contents.title`,"values.contents.depth":`library.theme.contents.depth`,"values.contents.titleOffset":`library.theme.contents.title-offset`,"values.contents.firstEntryOffset":`library.theme.contents.first-entry-offset`,"values.contents.line":`library.theme.contents.line`,"values.contents.indent":`library.theme.contents.indent`,"values.header.enabled":`library.theme.header.enabled`,"values.header.top":`library.theme.header.top`,"values.header.maxTitleCharacters":`library.theme.header.max-title`,"values.footer.enabled":`library.theme.footer.enabled`,"values.footer.text":`library.theme.footer.text`,"values.footer.bottom":`library.theme.footer.bottom`,"values.footer.reserve":`library.theme.footer.reserve`,"values.sources.enabled":`library.theme.sources.enabled`,"values.sources.title":`library.theme.sources.title`,"values.sources.titleOffset":`library.theme.sources.title-offset`,"values.sources.bodyOffset":`library.theme.sources.body-offset`,"values.sources.line":`library.theme.sources.line`,"values.sources.gap":`library.theme.sources.gap`,"values.endPage.enabled":`library.theme.end-page.enabled`,"values.endPage.title":`library.theme.end-page.title`,"values.endPage.lines":`library.theme.end-page.lines`,"values.endPage.showDocumentDetails":`library.theme.end-page.details`,"values.endPage.link":`library.theme.end-page.link`,"values.endPage.closing":`library.theme.end-page.closing`,"values.endPage.titleOffset":`library.theme.end-page.title-offset`,"values.endPage.bodyOffset":`library.theme.end-page.body-offset`,"values.metadata.author":`library.theme.metadata.author`,"values.metadata.subject":`library.theme.metadata.subject`,"values.metadata.keywords":`library.theme.metadata.keywords`,"values.metadata.creator":`library.theme.metadata.creator`};function L1(e,t){let n=j1(t),r=e.filter(e=>e.field===n||e.field.startsWith(`${n}.`));return r.length===0?void 0:r.map(e=>e.message).join(` `)}function ESe({field:e,theme:t,original:n,problem:r,onChange:i}){let a=(0,m.useId)(),o=k1(t,e.path),s=k1(n,e.path),c=z1(t,n,e.path),l=TSe[j1(e.path)],u=n=>{i(A1(t,e.path,n))},d=(0,h.jsxs)(h.Fragment,{children:[l===void 0?null:(0,h.jsx)(H,{id:l,label:e.label,className:`-my-1`}),c?(0,h.jsx)(Nv,{label:`Reset ${e.label} to ${B1(s)}`,tip:`Changed. Reset to ${B1(s)}`,className:`-my-1 size-6`,onClick:()=>u(s),children:(0,h.jsx)(gl,{"aria-hidden":`true`,className:`size-[13px]`})}):null]}),f=e.kind===`color`&&r===void 0?OSe(t,e.path):void 0,p=[e.help===void 0?``:`${a}-help`,r===void 0?``:`${a}-error`,f===void 0?``:`${a}-contrast`].filter(e=>e!==``).join(` `),g=(0,h.jsxs)(h.Fragment,{children:[e.help===void 0?null:(0,h.jsx)(`p`,{id:`${a}-help`,className:`sl-field__help m-0`,children:e.help}),r===void 0?null:(0,h.jsx)(`p`,{id:`${a}-error`,className:`sl-field__error m-0`,children:r}),f===void 0?null:(0,h.jsx)(`p`,{id:`${a}-contrast`,className:`m-0 text-small text-waiting`,children:f})]}),_={id:a,"aria-invalid":r!==void 0,"aria-describedby":p===``?void 0:p};switch(e.kind){case`toggle`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...Py,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:a,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{..._,type:`checkbox`,checked:o===!0,className:`size-4 accent-accent`,onChange:e=>{u(e.currentTarget.checked)}}),e.label]}),d]}),g]});case`number`:{let{min:t,max:n}=SSe(e.path);return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(X,{..._,type:`number`,inputMode:`decimal`,min:t,max:n,step:e.step,className:`w-28`,value:typeof o==`number`&&Number.isFinite(o)?o:``,onChange:e=>{u(e.target.value===``?NaN:Number(e.target.value))}}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:e.unit})]})})}case`color`:return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(l$,{..._,pickerLabel:`${e.label} colour`,value:typeof o==`string`?o:``,onChange:u})});case`text`:return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(X,{..._,value:typeof o==`string`?o:``,onChange:e=>{u(e.target.value)}})});case`optional-text`:return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(X,{..._,value:typeof o==`string`?o:``,onChange:e=>{u(e.target.value===``?null:e.target.value)}})});case`choice`:{let t=e.options.findIndex(e=>e.value===o);return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(sL,{..._,value:String(t),onChange:t=>{let n=e.options[Number(t.target.value)];n!==void 0&&u(n.value)},children:e.options.map((e,t)=>(0,h.jsx)(`option`,{value:String(t),children:e.label},e.label))})})}case`face`:{let t=o,n=O1(t.family);return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(sL,{..._,"aria-label":`${e.label} font`,value:t.family,onChange:e=>{let n=D1.find(t=>t.value===e.target.value);if(n===void 0)return;let r=O1(n.value).some(e=>e.value===t.style);u({...t,family:n.value,style:r?t.style:`normal`})},children:D1.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(sL,{"aria-label":`${e.label} style`,value:t.style,onChange:e=>{u({...t,style:e.target.value})},children:n.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(X,{type:`number`,"aria-label":`${e.label} letter spacing in millimetres`,title:`Letter spacing (mm)`,step:.01,className:`w-20`,value:Number.isFinite(t.letterSpacing)?t.letterSpacing:``,onChange:e=>{u({...t,letterSpacing:e.target.value===``?NaN:Number(e.target.value)})}})]})})}case`lines`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...Py,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:a,className:`sl-field__label`,children:e.label}),d]}),(0,h.jsx)(oL,{..._,rows:8,value:Array.isArray(o)?o.join(`
|
|
274
|
+
`),filter:g})},onCancel:()=>{y.reset(),p(void 0)}}),r.data&&D.length===0?(0,h.jsx)(aQ,{title:`No existing videos listed`,children:`In YouTube Studio open Analytics → Content → Advanced mode, export the table as a CSV, and import it here; or paste the titles above.`}):null,D.length>0?(0,h.jsxs)(`section`,{"aria-label":`Existing videos`,className:`mt-4`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(X,{type:`search`,"aria-label":`Search existing videos`,placeholder:`Search existing videos`,value:w,className:`w-full min-w-0 sm:w-64`,onChange:e=>T(e.target.value)}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,role:`status`,children:O===``?R$(D.length,`title`,`titles`):`${k.length.toLocaleString(`en`)} of ${R$(D.length,`title`,`titles`)} match`})]}),k.length===0?(0,h.jsx)(aQ,{title:`No title matches`,children:`None of the titles contains “${w.trim()}”. Clear the search to see them all.`}):(0,h.jsx)(KL,{label:`Existing videos`,children:A.shown.map(e=>(0,h.jsx)(qL,{title:e.title,actions:(0,h.jsx)(z,{size:`small`,variant:`quiet`,disabled:j,"aria-label":`Remove ${e.title}`,onClick:()=>S.mutate(e),children:`Remove`})},e.id))}),(0,h.jsx)(F$,{hidden:A.hidden,onMore:A.more})]}):null,(0,h.jsx)($v,{open:o,title:`Remove all ${R$(D.length,`title`,`titles`)}?`,consequence:E.error?.message??`Topic suggestions and duplicate checks stop skipping them. Your videos on YouTube are not touched.`,confirmLabel:`Remove all`,cancelLabel:`Keep them`,pending:E.isPending,onConfirm:()=>E.mutate(),onCancel:()=>s(!1)})]})}function B$({className:e,children:t}){return(0,h.jsx)(`dl`,{className:R(`sl-stats m-0`,e),children:t})}function V$({value:e,label:t,children:n}){return(0,h.jsxs)(`div`,{className:`sl-stat`,children:[(0,h.jsx)(`dt`,{className:`sl-stat__label order-2`,children:t}),(0,h.jsx)(`dd`,{className:`sl-stat__value order-1 m-0`,children:e}),n===void 0?null:(0,h.jsx)(`dd`,{className:`order-3 m-0 mt-1`,children:n})]})}function H$({value:e,label:t,valueText:n,tone:r=`accent`,progress:i=!1,className:a}){let o=Math.round(Math.min(1,Math.max(0,Number.isFinite(e)?e:0))*100),s=n??`${String(o)}%`,c=R(`sl-meter`,r===`waiting`&&`sl-meter--waiting`,a),l=(0,h.jsx)(`span`,{style:{width:`${String(o)}%`}});return i?(0,h.jsx)(`div`,{role:`progressbar`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-valuetext":s,className:c,children:l}):(0,h.jsx)(`div`,{role:`meter`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-valuetext":s,className:c,children:l})}function U$({columns:e,rows:t,rowKey:n,caption:r,empty:i,className:a}){return(0,h.jsxs)(`table`,{className:R(`sl-table`,a),children:[(0,h.jsx)(`caption`,{className:`sr-only`,children:r}),(0,h.jsx)(`thead`,{children:(0,h.jsx)(`tr`,{children:e.map(e=>(0,h.jsx)(`th`,{scope:`col`,className:e.numeric?`num`:void 0,children:e.header},e.id))})}),(0,h.jsx)(`tbody`,{children:t.length===0&&i!==void 0?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:e.length,className:`text-ink-2`,children:i})}):t.map(t=>(0,h.jsx)(`tr`,{children:e.map(e=>(0,h.jsx)(`td`,{className:e.numeric?`num`:void 0,children:e.cell(t)},e.id))},n(t)))})]})}var W$=56,G$=12,K$=12,rSe=28;function iSe(e,t){let n=e/t,r=10**Math.floor(Math.log10(n)),i=n/r;return(i<=1?1:i<=2?2:i<=5?5:10)*r}function q$({series:e,xLabels:t,formatValue:n,label:r,height:i=260,legend:a=!0,className:o}){let s=(0,m.useRef)(null),[c,l]=(0,m.useState)(800),[u,d]=(0,m.useState)();(0,m.useEffect)(()=>{let e=s.current;if(e===null||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(([e])=>{e!==void 0&&l(Math.max(320,Math.round(e.contentRect.width)))});return t.observe(e),()=>t.disconnect()},[]);let f=t.length,p=Math.max(0,...e.flatMap(e=>e.values.filter(e=>e!==null))),g=iSe(p>0?p:1,4),_=Math.max(g,Math.ceil((p>0?p:1)/g)*g),v=c-W$-G$,y=e=>W$+(f<=1?0:e/(f-1)*v),b=e=>K$+i-e/_*i,x=Array.from({length:Math.round(_/g)+1},(e,t)=>t*g),S=Math.min(f,Math.max(2,Math.floor(v/90))),C=Array.from({length:S},(e,t)=>Math.round(t/Math.max(1,S-1)*(f-1))),w=e=>{let t=``,n=!1;return e.forEach((e,r)=>{if(e===null){n=!1;return}t+=`${n?`L`:`M`}${y(r).toFixed(1)},${b(e).toFixed(1)}`,n=!0}),t},T=K$+i+rSe,E=u===void 0?[]:e.map(e=>({one:e,value:e.values[u]??null})).filter(e=>e.value!==null).toSorted((e,t)=>t.value-e.value);return(0,h.jsxs)(`figure`,{className:R(`m-0 flex flex-col gap-2`,o),children:[(0,h.jsxs)(`div`,{ref:s,className:`relative w-full`,children:[(0,h.jsxs)(`svg`,{role:`img`,"aria-label":r,width:c,height:T,viewBox:`0 0 ${String(c)} ${String(T)}`,className:`block select-none`,onMouseLeave:()=>d(void 0),onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=Math.round((e.clientX-t.left-W$)/v*(f-1));d(n<0||n>=f?void 0:n)},children:[x.map(e=>(0,h.jsxs)(`g`,{children:[(0,h.jsx)(`line`,{x1:W$,x2:c-G$,y1:b(e),y2:b(e),stroke:`currentColor`,className:`text-line`,strokeWidth:`1`}),(0,h.jsx)(`text`,{x:48,y:b(e),textAnchor:`end`,dominantBaseline:`middle`,className:`fill-ink-3 text-[11px]`,children:n(e)})]},e)),C.map(e=>(0,h.jsx)(`text`,{x:y(e),y:K$+i+18,textAnchor:e===0?`start`:e===f-1?`end`:`middle`,className:`fill-ink-3 text-[11px]`,children:t[e]},e)),e.map(e=>(0,h.jsx)(`path`,{d:w(e.values),fill:`none`,stroke:e.color,strokeWidth:`1.75`,strokeLinejoin:`round`},e.id)),u===void 0?null:(0,h.jsxs)(`g`,{children:[(0,h.jsx)(`line`,{x1:y(u),x2:y(u),y1:K$,y2:K$+i,stroke:`currentColor`,className:`text-ink-3`,strokeDasharray:`3 3`}),E.map(({one:e,value:t})=>(0,h.jsx)(`circle`,{cx:y(u),cy:b(t),r:`3.5`,fill:e.color},e.id))]})]}),u===void 0||E.length===0?null:(0,h.jsxs)(`div`,{className:`pointer-events-none absolute top-2 z-10 w-[340px] rounded-control border border-line bg-surface p-2 text-small shadow-md`,style:y(u)>c/2?{right:c-y(u)+12}:{left:y(u)+12},children:[(0,h.jsx)(`div`,{className:`mb-1 font-semibold`,children:t[u]}),E.map(({one:e,value:t})=>(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block size-2 shrink-0 rounded-full`,style:{background:e.color}}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),(0,h.jsx)(`span`,{className:`tabular-nums`,children:n(t)})]},e.id))]})]}),a?(0,h.jsx)(`figcaption`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-small text-ink-2`,children:e.map(e=>(0,h.jsxs)(`span`,{className:`flex max-w-[320px] items-center gap-2`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-[3px] w-4 shrink-0 rounded`,style:{background:e.color}}),(0,h.jsx)(`span`,{className:`truncate`,children:e.label})]},e.id))}):null]})}var J$=(e,t)=>`${e.origin}/api/studio/channels/${t}/report`;async function aSe(e,t){return L(await e.fetch(J$(e,t)))}async function oSe(e,t,n){return L(await e.fetch(J$(e,t),{method:`POST`,headers:{"content-type":n.type||`application/zip`},body:n}))}async function sSe(e,t,n){return L(await e.fetch(`${e.origin}/api/studio/channels/${t}/export-view`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({url:n})}))}function cSe({channelId:e,saved:t}){let{api:n}=B(),r=_(),i=Lv(),[a,o]=(0,m.useState)(),s=a??t??``,c=I({mutationFn:t=>sSe(n,e,t),onSuccess:t=>{r.setQueryData([`studio`,`report`,e],t),o(void 0),i(t.exportView?`The extension exports this view every day.`:`The extension no longer exports a view for this channel.`,`success`)},onError:e=>i(`The view wasn't saved: ${e.message}`,`error`)});return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(X,{"aria-label":`Studio Analytics view to export every day`,placeholder:`https://studio.youtube.com/channel/…/analytics/…/explore?…`,className:`min-w-0 flex-1 basis-[320px]`,value:s,onChange:e=>o(e.currentTarget.value)}),(0,h.jsx)(z,{type:`button`,disabled:c.isPending||s.trim()===(t??``),onClick:()=>c.mutate(s.trim()===``?null:s.trim()),children:`Save view`})]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`The Studio extension opens this view once a day, exports it and brings it in here: every column, and each video's numbers on its project. Paste the address of Analytics → Advanced mode as you set it up; the start date stays, the end moves to today.`})]})}function Y$(e,t,n){if(e===null)return`–`;if(typeof e==`string`)return e;if(t===`duration`){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=String(Math.round(e%60)).padStart(2,`0`);return t>0?`${String(t)}:${String(n).padStart(2,`0`)}:${r}`:`${String(n)}:${r}`}let r=/%|\(|rpm|revenue|hours/i.test(n)&&!Number.isInteger(e)?1:0;return e.toLocaleString(`en`,{minimumFractionDigits:r,maximumFractionDigits:r})}var X$=[`#7cb342`,`#42a5f5`,`#ef6c00`,`#ab47bc`,`#26a69a`,`#ec407a`,`#fdd835`,`#8d6e63`,`#5c6bc0`,`#78909c`],Z$=new Intl.DateTimeFormat(void 0,{day:`numeric`,month:`short`}),Q$=new Intl.DateTimeFormat(void 0,{month:`short`,year:`numeric`});function $$(e,t){if(t===`total`){let t=0;return e.map(e=>t+=e)}return t===`average`?e.map((t,n)=>{let r=e.slice(Math.max(0,n-6),n+1);return r.reduce((e,t)=>e+t,0)/r.length}):[...e]}function lSe({report:e,rows:t,picked:n,colorOf:r,shape:i,setShape:a,timeline:o,setTimeline:s,range:c,setRange:l}){let u=e.chartMetric??`Views`,[d,f]=(0,m.useState)(!1),p=t.filter(e=>n.includes(e.videoId)),g=e.from===null?new Date:new Date(`${e.from}T00:00:00`),_=Math.max(0,...t.map(e=>e.daily.length)),v,y;if(o===`dates`){let t=c===`all`?0:Math.max(0,_-Number(c)),n=_-t>200;v=Array.from({length:_-t},(e,r)=>{let i=new Date(g);return i.setDate(i.getDate()+t+r),(n?Q$:Z$).format(i)}),y=p.map(e=>{let n=e.daily.findIndex(e=>e>0),a=$$(e.daily,i).map((e,t)=>n<0||t<n?null:e);return{id:e.videoId,label:e.title,color:r(e.videoId),values:a.slice(t)}}),d&&e.dailyTotals!==void 0&&(y=[{id:`channel-total`,label:`Channel total`,color:`var(--color-ink-2)`,values:$$(e.dailyTotals,i).slice(t)},...y])}else{let e=Math.max(1,...p.map(e=>{let t=e.daily.findIndex(e=>e>0);return t<0?0:e.daily.length-t})),t=c===`all`?e:Math.min(e,Number(c));v=Array.from({length:t},(e,t)=>`Day ${String(t+1)}`),y=p.map(e=>{let n=Math.max(0,e.daily.findIndex(e=>e>0)),a=$$(e.daily.slice(n),i).slice(0,t);return{id:e.videoId,label:e.title,color:r(e.videoId),values:Array.from({length:t},(e,t)=>a[t]??null)}})}let b=i===`daily`?`${u} per day`:i===`average`?`${u} per day, 7-day average`:`${u}, running total`;return(0,h.jsxs)(`section`,{"aria-label":`Over time`,className:`flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(`span`,{className:`font-semibold`,children:b}),(0,h.jsx)(`span`,{className:`flex-1`}),e.dailyTotals===void 0||o!==`dates`?null:(0,h.jsxs)(`label`,{className:`flex items-center gap-2 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.currentTarget.checked)}),`Channel total`]}),(0,h.jsx)(sL,{"aria-label":`Show`,className:`w-[200px]`,value:i,onChange:e=>a(e.currentTarget.value),options:[{value:`average`,label:`7-day average`},{value:`daily`,label:`Per day`},{value:`total`,label:`Running total`}]}),(0,h.jsx)(sL,{"aria-label":`Timeline`,className:`w-[220px]`,value:o,onChange:e=>s(e.currentTarget.value),options:[{value:`dates`,label:`By date`},{value:`since`,label:`Days since release`}]}),(0,h.jsx)(sL,{"aria-label":`Period`,className:`w-[170px]`,value:c,onChange:e=>l(e.currentTarget.value),options:[{value:`all`,label:o===`dates`?`All time`:`Whole life`},{value:`90`,label:o===`dates`?`Last 90 days`:`First 90 days`},{value:`30`,label:o===`dates`?`Last 30 days`:`First 30 days`}]})]}),p.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Tick videos in the Chart column below to compare them here.`}):(0,h.jsx)(q$,{series:y,xLabels:v,label:`${b} for ${String(p.length)} videos`,formatValue:e1})]})}var e1=e=>e>=1e4?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:Math.round(e).toLocaleString(`en`);function uSe({report:e,row:t,shape:n,range:r,colorOf:i}){let a=e.chartMetric??`Views`,o=e.from===null?new Date:new Date(`${e.from}T00:00:00`),s=t.daily.findIndex(e=>e>0);if(s<0)return(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Studio's export holds daily figures only for the videos drawn in its own chart. To chart this one, tick it in Advanced mode's chart before you export.`});let c=$$(t.daily.slice(s),n),l=r===`all`?0:Math.max(0,c.length-Number(r)),u=c.slice(l),d=u.map((e,t)=>{let n=new Date(o);return n.setDate(n.getDate()+s+l+t),(u.length>200?Q$:Z$).format(n)}),f=t.daily.reduce((e,t)=>e+t,0);return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`${a} · ${f.toLocaleString(`en`)} total`}),(0,h.jsx)(q$,{height:180,legend:!1,label:`${a} for ${t.title}`,xLabels:d,formatValue:e1,series:[{id:t.videoId,label:t.title,color:i(t.videoId),values:u}]})]})}var t1=e=>`slopify.studioReport.hidden.${e}`;function dSe(e){try{let t=window.localStorage.getItem(t1(e));return t===null?void 0:JSON.parse(t)}catch{return}}function n1({channelId:e}){let{api:t}=B(),n=_(),r=Lv(),i=(0,m.useRef)(null),a=[`studio`,`report`,e],o=F({queryKey:a,queryFn:()=>aSe(t,e)}),[s,c]=(0,m.useState)(0),[l,u]=(0,m.useState)(),[d,f]=(0,m.useState)(`average`),[p,g]=(0,m.useState)(`dates`),[v,y]=(0,m.useState)(`all`),[b,x]=(0,m.useState)(),[S,C]=(0,m.useState)(()=>dSe(e)),w=I({mutationFn:n=>oSe(t,e,n),onSuccess:e=>{n.setQueryData(a,e),r(`Imported ${String(e.report?.rows.length??0)} videos from Studio's export.`,`success`)},onError:e=>r(`The export wasn't imported: ${e.message}`,`error`)}),T=o.data?.report??null,E=T?.columns??[],D=E.filter((e,t)=>(T?.rows??[]).every(e=>e.values[t]===null)).map(e=>e.label),O=S??D,k=t=>{C(t);try{window.localStorage.setItem(t1(e),JSON.stringify(t))}catch{}},A=E.map((e,t)=>({column:e,index:t})).filter(({column:e})=>!O.includes(e.label)),j=(e,t)=>{let n=e.values[t];return typeof n==`number`?n:-1},M=[...T?.rows??[]].toSorted((e,t)=>j(t,s)-j(e,s)),ee=[...T?.rows??[]].toSorted((e,t)=>t.daily.reduce((e,t)=>e+t,0)-e.daily.reduce((e,t)=>e+t,0)),N=l??ee.slice(0,5).map(e=>e.videoId),te=e=>{let t=(T?.rows??[]).findIndex(t=>t.videoId===e);return X$[(t<0?0:t)%X$.length]??`#7cb342`};return(0,h.jsxs)(`section`,{"aria-label":`From Studio`,className:`flex flex-col gap-3`,children:[(0,h.jsxs)(U,{as:`h3`,title:`From Studio's export`,meta:T===null?void 0:`${String(T.rows.length)} videos · ${T.from??`?`} to ${T.to??`?`} · imported ${new Date(T.importedAt).toLocaleDateString()}`,children:[(0,h.jsx)(`input`,{ref:i,type:`file`,accept:`.zip,.csv,application/zip,text/csv`,hidden:!0,"aria-label":`Studio export file`,onChange:e=>{let t=e.currentTarget.files?.[0];t!==void 0&&w.mutate(t),e.currentTarget.value=``}}),(0,h.jsxs)(z,{type:`button`,variant:`secondary`,disabled:w.isPending,onClick:()=>i.current?.click(),children:[(0,h.jsx)(Cl,{"aria-hidden":`true`,strokeWidth:1.75}),w.isPending?`Importing…`:`Import from Studio`]})]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`In YouTube Studio, open Analytics → Advanced mode, choose the metrics as columns, press the Export arrow → Comma-separated values, and import the zip it downloads here. Every column comes along; a new import replaces the old one.`}),(0,h.jsx)(cSe,{channelId:e,saved:o.data?.exportView??null}),T===null?null:(0,h.jsxs)(h.Fragment,{children:[T.chartMetric===null?null:(0,h.jsx)(lSe,{report:T,rows:M,picked:N,colorOf:te,shape:d,setShape:f,timeline:p,setTimeline:g,range:v,setRange:y}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(sL,{"aria-label":`Order by`,className:`w-[280px]`,value:String(s),onChange:e=>c(Number(e.currentTarget.value)),options:E.map((e,t)=>({value:String(t),label:`Most ${e.label}`}))}),(0,h.jsxs)(`details`,{className:`text-small`,children:[(0,h.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Columns (`,String(A.length),` of `,String(E.length),`)`]}),(0,h.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 sm:grid-cols-3`,children:E.map(e=>(0,h.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,checked:!O.includes(e.label),onChange:t=>k(t.currentTarget.checked?O.filter(t=>t!==e.label):[...O,e.label])}),e.label]},e.label))})]})]}),(0,h.jsx)(`div`,{className:`overflow-x-auto`,children:(0,h.jsxs)(`table`,{className:`sl-table [&_td]:px-3 [&_th]:px-3 [&_td.num]:whitespace-nowrap`,children:[(0,h.jsx)(`caption`,{className:`sr-only`,children:`Studio's numbers for every video`}),(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{children:[T.chartMetric===null?null:(0,h.jsx)(`th`,{scope:`col`,children:`Chart`}),(0,h.jsx)(`th`,{scope:`col`,children:`Video`}),A.map(({column:e})=>(0,h.jsx)(`th`,{scope:`col`,className:`num`,children:e.label},e.label))]})}),(0,h.jsxs)(`tbody`,{children:[(0,h.jsxs)(`tr`,{className:`font-semibold`,children:[T.chartMetric===null?null:(0,h.jsx)(`td`,{}),(0,h.jsx)(`td`,{children:`Total`}),A.map(({column:e,index:t})=>(0,h.jsx)(`td`,{className:`num`,children:Y$(T.totals[t]??null,e.kind,e.label)},e.label))]}),M.map(e=>{let t=o.data?.projects[e.videoId],n=b===e.videoId;return(0,h.jsxs)(m.Fragment,{children:[(0,h.jsxs)(`tr`,{children:[T.chartMetric===null?null:(0,h.jsx)(`td`,{children:(0,h.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`input`,{type:`checkbox`,disabled:!e.daily.some(e=>e>0),"aria-label":`Compare ${e.title} in the chart`,checked:N.includes(e.videoId),onChange:t=>u(t.currentTarget.checked?[...N,e.videoId]:N.filter(t=>t!==e.videoId))}),(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block size-2.5 rounded-full`,style:{background:N.includes(e.videoId)?te(e.videoId):`transparent`}})]})}),(0,h.jsxs)(`td`,{className:`max-w-[320px]`,children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[T.chartMetric===null?null:(0,h.jsx)(Nv,{size:`small`,"aria-expanded":n,label:`${n?`Hide`:`Show`} the chart of ${e.title}`,onClick:()=>x(n?void 0:e.videoId),children:n?(0,h.jsx)(jc,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(Nc,{"aria-hidden":`true`,strokeWidth:1.75})}),t===void 0?(0,h.jsx)(`span`,{className:`block truncate`,title:e.title,children:e.title}):(0,h.jsx)(pa,{to:`/projects/$projectId`,params:{projectId:t.projectId},className:`block truncate`,title:e.title,children:e.title})]}),(0,h.jsx)(`span`,{className:`text-label text-ink-3`,children:e.published??``})]}),A.map(({column:t,index:n})=>(0,h.jsx)(`td`,{className:`num`,children:Y$(e.values[n]??null,t.kind,t.label)},t.label))]}),n?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:A.length+2,children:(0,h.jsx)(uSe,{report:T,row:e,shape:d,range:v,colorOf:te})})}):null]},e.videoId)})]})]})})]})]})}var r1=e=>e==null?`–`:Math.round(e).toLocaleString(`en`),i1=e=>e==null?`–`:`${e.toFixed(1)}%`;function a1(e){if(e==null)return`–`;let t=Math.round(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${String(n)}:${String(r).padStart(2,`0`)}:${i}`:`${String(r)}:${i}`}var fSe=new Intl.DateTimeFormat(void 0,{day:`numeric`,month:`short`,year:`numeric`}),o1=e=>e===null?`–`:fSe.format(new Date(e));function s1({label:e,totals:t}){return(0,h.jsxs)(`section`,{"aria-label":e,className:`flex flex-col gap-2`,children:[(0,h.jsx)(U,{as:`h3`,title:e,meta:`${String(t.videos)} on YouTube`}),(0,h.jsxs)(B$,{children:[(0,h.jsx)(V$,{value:r1(t.views),label:`Views`}),(0,h.jsx)(V$,{value:r1(t.impressions),label:`Impressions`}),(0,h.jsx)(V$,{value:i1(t.ctr),label:`Click-through rate`}),(0,h.jsx)(V$,{value:a1(t.averageViewSeconds),label:`Average view duration`}),(0,h.jsx)(V$,{value:r1(t.watchHours),label:`Watch hours`})]})]})}var c1=(e,t)=>{let n=e.long?.stats??null;return t===`views`?(n?.views??0)+e.shorts.reduce((e,t)=>e+(t.stats?.views??0),0):t===`ctr`?n?.ctr??-1:t===`duration`?n?.averageViewSeconds??-1:Date.parse(e.long?.releasedAt??e.shorts[0]?.releasedAt??``)||0};function pSe({channelId:e}){let{api:t}=B(),[n,r]=(0,m.useState)(`newest`),i=F({queryKey:[`studio`,`performance`,e],queryFn:()=>ys(t,e)});if(i.isPending)return(0,h.jsx)(`p`,{className:`text-small text-ink-3`,children:`Loading the numbers…`});if(i.isError)return(0,h.jsxs)(`p`,{className:`text-small text-danger`,children:[`The numbers didn't load: `,i.error.message,` Reload the page to try again.`]});let a=i.data;if(a.projects.length===0)return(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,h.jsx)(n1,{channelId:e}),(0,h.jsx)(aQ,{title:`No video of this channel is known on YouTube yet`,children:`Upload with the Slopify Studio extension, or open YouTube Studio's Content list once so the extension links your videos. Their numbers then arrive daily, or at once with Read Studio numbers now in the extension's popup.`})]});let o=a.projects.toSorted((e,t)=>c1(t,n)-c1(e,n)).flatMap(e=>[...e.long===null?[]:[{key:`${e.projectId}-0`,projectId:e.projectId,row:e.long,isShort:!1}],...e.shorts.map(t=>({key:`${e.projectId}-${String(t.short??0)}`,projectId:e.projectId,row:t,isShort:!0}))]);return(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[`Studio's numbers as the Slopify Studio extension last read them`,a.readAt===null?``:` (newest ${o1(a.readAt)})`,`: daily while Chrome is open, or at once with Read Studio numbers now in the extension's popup. "–" is a number Studio doesn't show for that video (most shorts have no click-through rate).`]}),(0,h.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:[(0,h.jsx)(s1,{label:`Long videos`,totals:a.long}),(0,h.jsx)(s1,{label:`Shorts`,totals:a.shorts})]}),(0,h.jsx)(n1,{channelId:e}),(0,h.jsxs)(`section`,{"aria-label":`Every video`,className:`flex flex-col gap-2`,children:[(0,h.jsx)(U,{as:`h3`,title:`Every video`,children:(0,h.jsx)(sL,{"aria-label":`Order`,value:n,onChange:e=>r(e.currentTarget.value),options:[{value:`newest`,label:`Newest first`},{value:`views`,label:`Most views`},{value:`ctr`,label:`Best click-through rate`},{value:`duration`,label:`Longest average view`}]})}),(0,h.jsx)(`div`,{className:`overflow-x-auto`,children:(0,h.jsx)(U$,{columns:[{id:`title`,header:`Video`,cell:e=>e.isShort?(0,h.jsx)(`span`,{className:`block pl-5 text-small text-ink-2`,children:`Short ${String(e.row.short??``)} · ${e.row.title}`}):(0,h.jsx)(pa,{to:`/projects/$projectId`,params:{projectId:e.projectId},children:e.row.title})},{id:`out`,header:`Released`,cell:e=>o1(e.row.releasedAt)},{id:`impressions`,header:`Impressions`,numeric:!0,cell:e=>r1(e.row.stats?.impressions)},{id:`ctr`,header:`CTR`,numeric:!0,cell:e=>i1(e.row.stats?.ctr)},{id:`views`,header:`Views`,numeric:!0,cell:e=>r1(e.row.stats?.views)},{id:`duration`,header:`Avg view`,numeric:!0,cell:e=>a1(e.row.stats?.averageViewSeconds)},{id:`hours`,header:`Watch hours`,numeric:!0,cell:e=>e.row.stats?.watchHours===null||e.row.stats?.watchHours===void 0?`–`:e.row.stats.watchHours.toFixed(1)}],rows:o,rowKey:e=>e.key,caption:`The channel's videos and shorts with Studio's numbers`})})]})]})}var l1=[`brand`,`cast`,`templates`,`schedules`,`episodes`,`videos`,`youtube`],u1={brand:`Brand`,cast:`Cast`,templates:`Templates`,schedules:`Schedules`,episodes:`Episodes`,videos:`Existing videos`,youtube:`YouTube numbers`};function mSe(e){return l1.find(t=>t===e)??`brand`}function hSe({channelId:e,tab:t,onTab:n}){let{api:r}=B(),i=_(),a=Yi(),o=F(Zy(r,e)),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(null),d=I({mutationFn:()=>$y(r,e),onSuccess:async()=>{c(!1),await i.invalidateQueries({queryKey:Ky}),await a({to:`/channels`})}}),f=o.data?.channel,p=o.data?.cast??[];Wv(f===void 0?void 0:`${f.name} · ${u1[t]}`);let g=()=>{n(`cast`),u(`new`)};return cb({id:`channel.add-to-cast`,title:`Add to cast`,group:`Channel`,...f===void 0?{}:{context:f.name},keywords:[`character`,`creature`,`place`,`object`],run:g}),o.error!==null&&o.data===void 0?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(pG,{crumb:(0,h.jsx)(pa,{to:`/channels`,children:`Channels`}),title:`Channel not opened`}),(0,h.jsx)(aQ,{title:`This channel could not be opened`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(GO,{to:`/channels`,variant:`primary`,children:`Open Channels`}),(0,h.jsx)(z,{disabled:o.isFetching,disabledReason:`Trying again…`,onClick:()=>void o.refetch(),children:`Try again`})]}),children:`${o.error.message} A deleted channel is gone for good (its videos moved to the default channel). Pick a channel from Channels, or press Try again.`})]}):(0,h.jsxs)(`div`,{children:[(0,h.jsx)(pG,{crumb:(0,h.jsx)(pa,{to:`/channels`,children:`Channels`}),title:f?.name??`Channel`,meta:f?.isDefault?`Default channel`:void 0,actions:(0,h.jsxs)(h.Fragment,{children:[t===`cast`&&f?(0,h.jsxs)(z,{variant:`primary`,onClick:g,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add to cast`]}):null,f&&!f.isDefault?(0,h.jsx)(z,{variant:`quiet`,onClick:()=>{d.reset(),c(!0)},children:`Delete channel`}):null]})}),(0,h.jsx)(rQ,{items:l1.map(e=>({id:e,label:u1[e],...e===`cast`?{badge:String(p.length)}:{}})),value:t,onChange:n,label:`Channel sections`,idPrefix:`channel`,className:`mb-6`}),(0,h.jsx)(SR,{tone:o.error?`error`:`info`,className:`mb-2`,children:o.error?`The channel couldn't be read again: ${o.error.message} What is shown may be out of date; reload the page to try again.`:o.isPending?`Loading the channel…`:void 0}),f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(iQ,{idPrefix:`channel`,id:`brand`,active:t===`brand`,children:[(0,h.jsx)(hxe,{channel:f}),(0,h.jsx)(Exe,{channel:f},`${f.id}:${String(f.version)}`)]}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`cast`,active:t===`cast`,children:(0,h.jsx)(Uxe,{channelId:f.id,cast:p,selected:l,onSelect:u})}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`templates`,active:t===`templates`,children:t===`templates`?(0,h.jsx)(ube,{channelId:f.id}):null}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`schedules`,active:t===`schedules`,children:t===`schedules`?(0,h.jsx)(dbe,{channelId:f.id}):null}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`episodes`,active:t===`episodes`,children:t===`episodes`?(0,h.jsx)($xe,{channelId:f.id}):null}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`videos`,active:t===`videos`,children:t===`videos`?(0,h.jsx)(z$,{channelId:f.id}):null}),(0,h.jsx)(iQ,{idPrefix:`channel`,id:`youtube`,active:t===`youtube`,children:t===`youtube`?(0,h.jsx)(pSe,{channelId:f.id}):null})]}):null,(0,h.jsx)($v,{open:s,title:E$(f?.name),consequence:d.error?.message??D$,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:d.isPending,onConfirm:()=>d.mutate(),onCancel:()=>c(!1)})]})}function gSe(){let{api:e}=B(),t=_(),n=Yi(),r=F(Xy(e)),[i,a]=(0,m.useState)(null),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(null),f=r.data?.find(e=>e.id===u)??r.data?.[0],p=I({mutationFn:()=>mre(e,crypto.randomUUID(),c.trim()),onSuccess:async e=>{await t.invalidateQueries({queryKey:Ky}),a(null),l(``),await n({to:`/channels/$channelId`,params:{channelId:e.id}})}}),g=I({mutationFn:t=>Qy(e,t.id,{name:c.trim(),brand:t.brand,seriesBrief:t.seriesBrief,baseVersion:t.version}),onSuccess:async()=>{await t.invalidateQueries({queryKey:Ky}),a(null)}}),v=I({mutationFn:t=>$y(e,t.id),onSuccess:async()=>{s(null),await t.invalidateQueries({queryKey:Ky})}}),y=()=>{p.reset(),l(``),a(`new`)};cb({id:`channels.new`,title:`New channel`,group:`Channels`,run:y});let b=i===`new`?p:g,x=()=>{c.trim()!==``&&i!==null&&(i===`new`?p.mutate():g.mutate(i))};return(0,h.jsxs)(`div`,{"data-tour":`channels`,children:[(0,h.jsx)(pG,{title:`Channels`,meta:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`A channel keeps its brand kit, cast, series brief, templates and schedules together.`,(0,h.jsx)(H,{id:`planning.channels`})]}),actions:(0,h.jsxs)(z,{variant:`primary`,"aria-expanded":i===`new`,onClick:y,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`New channel`]})}),(0,h.jsx)(SR,{tone:r.error||v.error?`error`:`info`,className:`mb-2`,children:r.error?`The channels couldn't be loaded: ${r.error.message} Reload the page to try again.`:o===null&&v.error?v.error.message:r.isPending?`Loading channels…`:void 0}),r.data?.length===0?(0,h.jsx)(aQ,{title:`No channels yet`,actions:(0,h.jsx)(z,{variant:`primary`,onClick:y,children:`New channel`}),children:`Make one for each series you run; it keeps that series' look and cast.`}):null,r.data?.length?(0,h.jsx)(gG,{list:(0,h.jsx)(KL,{label:`Channels`,className:`[&_.sl-row__actions]:flex-wrap`,children:r.data.map(e=>(0,h.jsx)(qL,{selected:e.id===f?.id,onSelect:()=>d(e.id),title:e.name,meta:`${e.isDefault?`Default · `:``}${String(e.templates)} ${e.templates===1?`template`:`templates`} · ${String(e.cast)} in the cast`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(KO,{to:`/channels/$channelId`,params:{channelId:e.id},"aria-label":`Open ${e.name}`,className:`px-2 text-small`,children:`Open`}),(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Rename ${e.name}`,onClick:()=>{g.reset(),l(e.name),a(e)},children:`Rename`}),e.isDefault?null:(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Delete ${e.name}`,onClick:()=>{v.reset(),s(e)},children:`Delete`})]})},e.id))}),detail:f===void 0?null:(0,h.jsx)(_Se,{channel:f})}):null,(0,h.jsx)(Qv,{open:i!==null,onOpenChange:e=>{!e&&!b.isPending&&a(null)},title:i===`new`||i===null?`New channel`:`Rename ${i.name}`,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(SR,{tone:b.error?`error`:`info`,children:b.error?.message??(b.isPending?`Saving…`:void 0)}),(0,h.jsx)(z,{disabled:b.isPending,onClick:()=>a(null),children:`Cancel`}),(0,h.jsx)(z,{type:`submit`,form:`channel-name-form`,variant:`primary`,disabled:b.isPending||c.trim()===``,children:i===`new`?`Create channel`:`Rename channel`})]}),children:(0,h.jsx)(`form`,{id:`channel-name-form`,"aria-label":i===`new`?`New channel`:`Rename channel`,onSubmit:e=>{e.preventDefault(),x()},children:(0,h.jsx)(iL,{label:`Channel name`,tip:`planning.channel.name`,children:(0,h.jsx)(X,{value:c,maxLength:200,required:!0,disabled:b.isPending,onChange:e=>l(e.target.value)})})})}),(0,h.jsx)($v,{open:o!==null,title:E$(o?.name),consequence:v.error?.message??D$,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:v.isPending,onConfirm:()=>{o&&v.mutate(o)},onCancel:()=>s(null)})]})}function _Se({channel:e}){let t=e.brand,n=[[`Intro`,t.intro??`None`],[`Outro`,t.outro??`None`],[`PDF theme`,t.documentTheme??`Default`],[`End screen text`,t.endScreenText??`None`]];return(0,h.jsxs)(`section`,{"aria-label":`About ${e.name}`,children:[(0,h.jsx)(U,{title:`About ${e.name}`,meta:e.isDefault?`The default channel`:void 0,children:(0,h.jsx)(GO,{to:`/channels/$channelId`,params:{channelId:e.id},children:`Open channel`})}),(0,h.jsxs)(B$,{className:`mb-6`,children:[(0,h.jsx)(V$,{value:String(e.templates),label:`Templates`}),(0,h.jsx)(V$,{value:String(e.cast),label:`In the cast`})]}),(0,h.jsx)(U,{as:`h3`,title:`Series brief`,className:`pb-2`}),(0,h.jsx)(`p`,{className:`m-0 mb-6 whitespace-pre-wrap text-body text-ink-2`,children:e.seriesBrief.trim()===``?`No series brief yet. Open the channel to say what it covers.`:e.seriesBrief}),(0,h.jsx)(U,{as:`h3`,title:`Brand kit`,className:`pb-2`}),(0,h.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-2 text-small`,children:n.map(([e,t])=>(0,h.jsxs)(`div`,{className:`contents`,children:[(0,h.jsx)(`dt`,{className:`text-ink-2`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 truncate`,children:t})]},e))})]})}var d1=2e3;function f1(e,t){let n=(0,m.useRef)(t);(0,m.useEffect)(()=>{n.current=t}),(0,m.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{n.current()},d1);return()=>{clearTimeout(t)}},[e])}function p1(){return(0,h.jsxs)(`span`,{className:`inline-flex animate-tick-in items-center gap-1 text-label text-accent-ink motion-reduce:animate-none`,children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,className:`size-[14px]`}),`Saved`]})}function m1({onDelete:e,blocked:t,blockedId:n,pending:r,saved:i,cancel:a,errors:o,onSave:s}){let c=t!==void 0||r||i,l=Lv();cb({id:`editor.save`,title:`Save`,group:`This editor`,keywords:[`save`,`keep`],shortcut:lk.save,run:()=>{c?t!==void 0&&l(`Not saved yet: ${t}`,`error`):s()}});let u=o.join(` `);return(0,h.jsxs)(`div`,{"data-slot":`editor-actions`,className:`sticky bottom-0 z-10 flex flex-wrap items-center gap-3 border-t border-line bg-ground py-3 max-md:bottom-[calc(48px+max(12px,env(safe-area-inset-bottom)))]`,children:[(0,h.jsx)(z,{variant:`destructive`,onClick:e,disabled:e===void 0,"aria-hidden":e===void 0||void 0,tabIndex:e===void 0?-1:void 0,style:e===void 0?{visibility:`hidden`}:void 0,children:`Delete`}),(0,h.jsx)(SR,{tone:u?`error`:`info`,id:u?void 0:n,children:u||(i?(0,h.jsx)(p1,{}):t)}),a,(0,h.jsx)(z,{variant:`primary`,"aria-disabled":c,"aria-describedby":t===void 0?void 0:n,"aria-keyshortcuts":bb(lk.save),onClick:()=>{c||s()},children:`Save`})]})}var vSe=`rounded-media border border-line bg-surface p-4`;function h1(){return(0,h.jsxs)(`div`,{className:`mx-auto grid max-w-[1440px] grid-cols-[minmax(0,1fr)] gap-6 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,h.jsxs)(`div`,{className:`${vSe} flex flex-col gap-4`,children:[(0,h.jsx)(`span`,{className:`h-8 w-64 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-[520px] rounded-control bg-sunken`})]}),(0,h.jsx)(`div`,{className:`flex flex-col gap-3 pt-1`,children:(0,h.jsx)(`span`,{className:`h-3 w-28 rounded-control bg-sunken`})})]})}var ySe=`modulepreload`,bSe=function(e){return`/`+e},g1={},_1=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=bSe(t,n),t=s(t),t in g1)return;g1[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ySe,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function v1({data:e,label:t,onDrawn:n}){let r=(0,m.useRef)(null),[i,a]=(0,m.useState)(0);return(0,m.useEffect)(()=>{let e=r.current;if(e===null)return;let t=new ResizeObserver(([e])=>{a(Math.floor(e?.contentRect.width??0))});return t.observe(e),()=>{t.disconnect()}},[]),(0,m.useEffect)(()=>{let t=r.current;if(t===null||e===void 0||i===0)return;let a=!1;return xSe(e,i).then(e=>{a||(t.replaceChildren(...e),n?.(void 0))},e=>{a||n?.(e instanceof Error?e:Error(String(e)))}),()=>{a=!0}},[e,i,n]),(0,h.jsx)(`div`,{ref:r,role:`img`,"aria-label":t,className:`flex flex-col gap-3 [&>canvas]:w-full [&>canvas]:shadow-[var(--shadow-pop)]`})}async function xSe(e,t){let n=await _1(()=>import(`./pdf-BYQLQv5-.js`),[]),r=await _1(()=>import(`./pdf.worker.min-zC6nfbxG.js`),[]);n.GlobalWorkerOptions.workerSrc=r.default;let i=n.getDocument({data:e.slice()}),a=await i.promise;try{let e=window.devicePixelRatio||1,n=[];for(let r=1;r<=a.numPages;r+=1){let i=await a.getPage(r),o=i.getViewport({scale:t*e/i.getViewport({scale:1}).width}),s=window.document.createElement(`canvas`);s.width=Math.floor(o.width),s.height=Math.floor(o.height),await i.render({canvas:s,viewport:o}).promise,n.push(s)}return n}finally{await i.destroy()}}var y1=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`mm`,step:1,...n===void 0?{}:{help:n}}),b1=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`pt`,step:.5,...n===void 0?{}:{help:n}}),x1=(e,t,n,r)=>({kind:`number`,path:e,label:t,unit:n,step:.05,...r===void 0?{}:{help:r}}),S1=(e,t,n)=>({kind:`toggle`,path:e,label:t,...n===void 0?{}:{help:n}}),C1=(e,t,n)=>({kind:`text`,path:e,label:t,...n===void 0?{}:{help:n}}),w1=(e,t,n)=>({kind:`optional-text`,path:e,label:t,...n===void 0?{}:{help:n}}),T1=(e,t,n)=>({kind:`face`,path:[`fonts`,e],label:t,...n===void 0?{}:{help:n}}),E1=[{title:`Page`,fields:[{kind:`choice`,path:[`page`,`format`],label:`Paper size`,options:[{value:`a4`,label:`A4`},{value:`letter`,label:`US Letter`}]},y1([`page`,`margin`],`Margins`),y1([`page`,`contentTop`],`Text starts at`,`From the top, on pages with the header.`),{kind:`choice`,path:[`background`,`image`],label:`Background`,options:[{value:`parchment`,label:`Parchment texture`},{value:null,label:`Flat colour`}]},{kind:`color`,path:[`background`,`color`],label:`Page colour`,help:`Used when the background is a flat colour.`}]},{title:`Colours`,fields:[{kind:`color`,path:[`colors`,`heading`],label:`Headings`,help:`Also drop caps, the brand name and links.`},{kind:`color`,path:[`colors`,`text`],label:`Body text`},{kind:`color`,path:[`colors`,`muted`],label:`Muted`,help:`Dates, bullets, quotes and the dots in the contents.`},{kind:`color`,path:[`colors`,`faint`],label:`Faint`,help:`Running header and page numbers.`}]},{title:`Fonts`,fields:[T1(`body`,`Body`),T1(`strong`,`Bold text`),T1(`emphasis`,`Italic text`),T1(`heading`,`Headings`),T1(`dramatic`,`Chapter numbers and brand`,`The big number of a "Chapter 3:" heading.`),T1(`decorative`,`Tagline and title-page link`),T1(`dropCap`,`Drop caps`),T1(`footer`,`Header and page numbers`)]},{title:`Text sizes`,fields:[b1([`sizes`,`title`],`Title`),b1([`sizes`,`brand`],`Brand`),b1([`sizes`,`section`],`Top-level headings`,`Also the titles of the contents, sources and closing pages.`),b1([`sizes`,`heading`],`Second-level headings`),b1([`sizes`,`subheading`],`Third-level headings`),b1([`sizes`,`body`],`Body`),b1([`sizes`,`meta`],`Date and word count`),b1([`sizes`,`footer`],`Header and page numbers`)]},{title:`Spacing`,fields:[y1([`spacing`,`bodyLine`],`Body line height`),y1([`spacing`,`headingLine`],`Heading line height`),y1([`spacing`,`subheadingLine`],`Subheading line height`),x1([`spacing`,`paragraphGap`],`After a paragraph`,`× line`),x1([`spacing`,`headingGap`],`Before a heading`,`× line`),x1([`spacing`,`itemGap`],`After a list item`,`× line`),y1([`spacing`,`listIndent`],`List indent`),y1([`spacing`,`quoteIndent`],`Quote indent`),y1([`spacing`,`ruleWidth`],`Divider width`,`The short centred line a --- becomes.`)]},{title:`Drop caps`,fields:[S1([`dropCap`,`enabled`],`Drop caps`,`A large first letter after each heading.`),{kind:`choice`,path:[`dropCap`,`lines`],label:`Lines tall`,options:[{value:2,label:`2 lines`},{value:3,label:`3 lines`},{value:4,label:`4 lines`}]},x1([`dropCap`,`scale`],`Letter size`,`× lines`),y1([`dropCap`,`gap`],`Gap beside it`),{kind:`number`,path:[`dropCap`,`minLength`],label:`Shortest paragraph`,unit:`chars`,step:10,help:`Shorter paragraphs start plainly.`},x1([`dropCap`,`minRoom`],`Room needed`,`of page`,`With less room left, the paragraph starts on the next page.`)]},{title:`Title page`,fields:[y1([`titlePage`,`brandY`],`Brand from top`),y1([`titlePage`,`taglineOffset`],`Tagline below brand`),y1([`titlePage`,`titleY`],`Title from top`),y1([`titlePage`,`titleLine`],`Title line height`),y1([`titlePage`,`metaOffset`],`Details below title`),y1([`titlePage`,`metaLine`],`Details line height`),S1([`titlePage`,`showDate`],`Show the date`),S1([`titlePage`,`showWordCount`],`Show the word count`),S1([`titlePage`,`cover`,`enabled`],`Thumbnail as cover`,`When the project has a thumbnail.`),y1([`titlePage`,`cover`,`gap`],`Space around cover`),y1([`titlePage`,`cover`,`maxHeight`],`Cover height at most`)]},{title:`Branding`,fields:[w1([`brand`,`name`],`Brand name`,`Leave empty to hide the brand.`),w1([`brand`,`tagline`],`Tagline`),w1([`brand`,`url`],`Website`,`Where the brand and its link go.`),w1([`brand`,`linkLabel`],`Link text`,`The linked line under the word count.`)]},{title:`Contents page`,fields:[S1([`contents`,`enabled`],`Contents page`),C1([`contents`,`title`],`Title`),{kind:`choice`,path:[`contents`,`depth`],label:`Lists headings down to`,options:[{value:1,label:`Top level`},{value:2,label:`Second level`},{value:3,label:`Third level`}]},y1([`contents`,`titleOffset`],`Title from top margin`),y1([`contents`,`firstEntryOffset`],`First entry from top margin`),y1([`contents`,`line`],`Line height`),y1([`contents`,`indent`],`Indent per level`)]},{title:`Header and footer`,fields:[S1([`header`,`enabled`],`Running header`,`The title at the top of each page.`),y1([`header`,`top`],`Header from top`),{kind:`number`,path:[`header`,`maxTitleCharacters`],label:`Header title at most`,unit:`chars`,step:1},S1([`footer`,`enabled`],`Page numbers`),C1([`footer`,`text`],`Page number text`,`{page} becomes the page number.`),y1([`footer`,`bottom`],`From the bottom`),y1([`footer`,`reserve`],`Space kept above it`)]},{title:`Sources page`,fields:[S1([`sources`,`enabled`],`Sources page`,`The links the article and research used.`),C1([`sources`,`title`],`Title`),y1([`sources`,`titleOffset`],`Title from top margin`),y1([`sources`,`bodyOffset`],`List from top margin`),y1([`sources`,`line`],`Line height`),y1([`sources`,`gap`],`Gap between sources`)]},{title:`Closing page`,fields:[S1([`endPage`,`enabled`],`Closing page`),C1([`endPage`,`title`],`Title`),{kind:`lines`,path:[`endPage`,`lines`],label:`Text`,help:`One line each. Start with "•" for a bullet, end with ":" for a bold label, leave a line empty for a gap.`},S1([`endPage`,`showDocumentDetails`],`Add date, word and page counts`),{kind:`link`,path:[`endPage`,`link`],label:`Link`},w1([`endPage`,`closing`],`Closing line`),y1([`endPage`,`titleOffset`],`Title from top margin`),y1([`endPage`,`bodyOffset`],`Text from top margin`)]},{title:`PDF details`,fields:[C1([`metadata`,`author`],`Author`,`Shown in a PDF reader's document properties. {title} becomes the title.`),C1([`metadata`,`subject`],`Subject`),C1([`metadata`,`keywords`],`Keywords`),C1([`metadata`,`creator`],`Creator`)]}],D1=zD.map(e=>({value:e,label:{Cinzel:`Cinzel`,Literata:`Literata`,times:`Times`,helvetica:`Helvetica`,courier:`Courier`}[e]}));function O1(e){let t={normal:`Regular`,medium:`Medium`,bold:`Bold`,black:`Black`,italic:`Italic`,bolditalic:`Bold italic`};return(e===`Cinzel`?[`normal`,`medium`,`bold`,`black`]:[`normal`,`bold`,`italic`,`bolditalic`]).map(e=>({value:e,label:t[e]}))}function k1(e,t){let n=e;for(let e of t)n=n?.[e];return n}function A1(e,t,n){let[r,...i]=t;if(r===void 0)return n;let a=e[r];return{...e,[r]:i.length===0?n:A1(a,i,n)}}function SSe(e){let t=KD;for(let n of e)t=t?.shape?.[n];return{min:t?.minValue??0,max:t?.maxValue??1e3}}function j1(e){return`values.${e.join(`.`)}`}var M1=`pt-1`,N1=`flex min-w-0 flex-col gap-3 pt-1 lg:sticky lg:top-16`;function P1({children:e}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{children:`Library`}),(0,h.jsx)(Nc,{"aria-hidden":`true`}),e]})}function F1({children:e,back:t}){return(0,h.jsxs)(`div`,{className:`mx-auto flex max-w-[1440px] flex-col gap-3`,children:[(0,h.jsx)(fM,{tone:`danger`,title:`This can't be opened.`,children:e}),(0,h.jsx)(`p`,{className:`m-0 text-small text-accent-ink underline underline-offset-[3px]`,children:t})]})}function I1(e){return`theme-group-${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`)}`}function CSe({problems:e,changed:t}){return e===0&&t===0?null:(0,h.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-small font-normal`,children:[e===0?null:(0,h.jsx)(nk,{tone:`failed`,children:`${String(e)} to fix`}),t===0?null:(0,h.jsx)(nk,{children:`${String(t)} changed`})]})}function wSe({groups:e,onJump:t}){return(0,h.jsx)(`nav`,{"aria-label":`Theme groups`,className:`flex flex-wrap gap-1 border-t border-line pt-3`,children:e.map(e=>{let n=[e.problems===0?``:`${String(e.problems)} to fix`,e.changed===0?``:`${String(e.changed)} changed`].filter(e=>e!==``);return(0,h.jsx)(z,{variant:`quiet`,size:`small`,className:e.problems===0?void 0:`text-danger`,onClick:()=>t(e.title),children:n.length===0?e.title:`${e.title} · ${n.join(` · `)}`},e.title)})})}var TSe={"values.page.format":`library.theme.page.format`,"values.page.margin":`library.theme.page.margin`,"values.page.contentTop":`library.theme.page.content-top`,"values.background.image":`library.theme.background.image`,"values.background.color":`library.theme.background.color`,"values.colors.heading":`library.theme.colors.heading`,"values.colors.text":`library.theme.colors.text`,"values.colors.muted":`library.theme.colors.muted`,"values.colors.faint":`library.theme.colors.faint`,"values.fonts.body":`library.theme.fonts.body`,"values.fonts.strong":`library.theme.fonts.strong`,"values.fonts.emphasis":`library.theme.fonts.emphasis`,"values.fonts.heading":`library.theme.fonts.heading`,"values.fonts.dramatic":`library.theme.fonts.dramatic`,"values.fonts.decorative":`library.theme.fonts.decorative`,"values.fonts.dropCap":`library.theme.fonts.drop-cap`,"values.fonts.footer":`library.theme.fonts.footer`,"values.sizes.title":`library.theme.sizes.title`,"values.sizes.brand":`library.theme.sizes.brand`,"values.sizes.section":`library.theme.sizes.section`,"values.sizes.heading":`library.theme.sizes.heading`,"values.sizes.subheading":`library.theme.sizes.subheading`,"values.sizes.body":`library.theme.sizes.body`,"values.sizes.meta":`library.theme.sizes.meta`,"values.sizes.footer":`library.theme.sizes.footer`,"values.spacing.bodyLine":`library.theme.spacing.body-line`,"values.spacing.headingLine":`library.theme.spacing.heading-line`,"values.spacing.subheadingLine":`library.theme.spacing.subheading-line`,"values.spacing.paragraphGap":`library.theme.spacing.paragraph-gap`,"values.spacing.headingGap":`library.theme.spacing.heading-gap`,"values.spacing.itemGap":`library.theme.spacing.item-gap`,"values.spacing.listIndent":`library.theme.spacing.list-indent`,"values.spacing.quoteIndent":`library.theme.spacing.quote-indent`,"values.spacing.ruleWidth":`library.theme.spacing.rule-width`,"values.dropCap.enabled":`library.theme.drop-cap.enabled`,"values.dropCap.lines":`library.theme.drop-cap.lines`,"values.dropCap.scale":`library.theme.drop-cap.scale`,"values.dropCap.gap":`library.theme.drop-cap.gap`,"values.dropCap.minLength":`library.theme.drop-cap.min-length`,"values.dropCap.minRoom":`library.theme.drop-cap.min-room`,"values.titlePage.brandY":`library.theme.title-page.brand-y`,"values.titlePage.taglineOffset":`library.theme.title-page.tagline-offset`,"values.titlePage.titleY":`library.theme.title-page.title-y`,"values.titlePage.titleLine":`library.theme.title-page.title-line`,"values.titlePage.metaOffset":`library.theme.title-page.meta-offset`,"values.titlePage.metaLine":`library.theme.title-page.meta-line`,"values.titlePage.showDate":`library.theme.title-page.show-date`,"values.titlePage.showWordCount":`library.theme.title-page.show-word-count`,"values.titlePage.cover.enabled":`library.theme.title-page.cover`,"values.titlePage.cover.gap":`library.theme.title-page.cover-gap`,"values.titlePage.cover.maxHeight":`library.theme.title-page.cover-height`,"values.brand.name":`library.theme.brand.name`,"values.brand.tagline":`library.theme.brand.tagline`,"values.brand.url":`library.theme.brand.url`,"values.brand.linkLabel":`library.theme.brand.link-label`,"values.contents.enabled":`library.theme.contents.enabled`,"values.contents.title":`library.theme.contents.title`,"values.contents.depth":`library.theme.contents.depth`,"values.contents.titleOffset":`library.theme.contents.title-offset`,"values.contents.firstEntryOffset":`library.theme.contents.first-entry-offset`,"values.contents.line":`library.theme.contents.line`,"values.contents.indent":`library.theme.contents.indent`,"values.header.enabled":`library.theme.header.enabled`,"values.header.top":`library.theme.header.top`,"values.header.maxTitleCharacters":`library.theme.header.max-title`,"values.footer.enabled":`library.theme.footer.enabled`,"values.footer.text":`library.theme.footer.text`,"values.footer.bottom":`library.theme.footer.bottom`,"values.footer.reserve":`library.theme.footer.reserve`,"values.sources.enabled":`library.theme.sources.enabled`,"values.sources.title":`library.theme.sources.title`,"values.sources.titleOffset":`library.theme.sources.title-offset`,"values.sources.bodyOffset":`library.theme.sources.body-offset`,"values.sources.line":`library.theme.sources.line`,"values.sources.gap":`library.theme.sources.gap`,"values.endPage.enabled":`library.theme.end-page.enabled`,"values.endPage.title":`library.theme.end-page.title`,"values.endPage.lines":`library.theme.end-page.lines`,"values.endPage.showDocumentDetails":`library.theme.end-page.details`,"values.endPage.link":`library.theme.end-page.link`,"values.endPage.closing":`library.theme.end-page.closing`,"values.endPage.titleOffset":`library.theme.end-page.title-offset`,"values.endPage.bodyOffset":`library.theme.end-page.body-offset`,"values.metadata.author":`library.theme.metadata.author`,"values.metadata.subject":`library.theme.metadata.subject`,"values.metadata.keywords":`library.theme.metadata.keywords`,"values.metadata.creator":`library.theme.metadata.creator`};function L1(e,t){let n=j1(t),r=e.filter(e=>e.field===n||e.field.startsWith(`${n}.`));return r.length===0?void 0:r.map(e=>e.message).join(` `)}function ESe({field:e,theme:t,original:n,problem:r,onChange:i}){let a=(0,m.useId)(),o=k1(t,e.path),s=k1(n,e.path),c=z1(t,n,e.path),l=TSe[j1(e.path)],u=n=>{i(A1(t,e.path,n))},d=(0,h.jsxs)(h.Fragment,{children:[l===void 0?null:(0,h.jsx)(H,{id:l,label:e.label,className:`-my-1`}),c?(0,h.jsx)(Nv,{label:`Reset ${e.label} to ${B1(s)}`,tip:`Changed. Reset to ${B1(s)}`,className:`-my-1 size-6`,onClick:()=>u(s),children:(0,h.jsx)(gl,{"aria-hidden":`true`,className:`size-[13px]`})}):null]}),f=e.kind===`color`&&r===void 0?OSe(t,e.path):void 0,p=[e.help===void 0?``:`${a}-help`,r===void 0?``:`${a}-error`,f===void 0?``:`${a}-contrast`].filter(e=>e!==``).join(` `),g=(0,h.jsxs)(h.Fragment,{children:[e.help===void 0?null:(0,h.jsx)(`p`,{id:`${a}-help`,className:`sl-field__help m-0`,children:e.help}),r===void 0?null:(0,h.jsx)(`p`,{id:`${a}-error`,className:`sl-field__error m-0`,children:r}),f===void 0?null:(0,h.jsx)(`p`,{id:`${a}-contrast`,className:`m-0 text-small text-waiting`,children:f})]}),_={id:a,"aria-invalid":r!==void 0,"aria-describedby":p===``?void 0:p};switch(e.kind){case`toggle`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...Py,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:a,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{..._,type:`checkbox`,checked:o===!0,className:`size-4 accent-accent`,onChange:e=>{u(e.currentTarget.checked)}}),e.label]}),d]}),g]});case`number`:{let{min:t,max:n}=SSe(e.path);return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(X,{..._,type:`number`,inputMode:`decimal`,min:t,max:n,step:e.step,className:`w-28`,value:typeof o==`number`&&Number.isFinite(o)?o:``,onChange:e=>{u(e.target.value===``?NaN:Number(e.target.value))}}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:e.unit})]})})}case`color`:return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(l$,{..._,pickerLabel:`${e.label} colour`,value:typeof o==`string`?o:``,onChange:u})});case`text`:return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(X,{..._,value:typeof o==`string`?o:``,onChange:e=>{u(e.target.value)}})});case`optional-text`:return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(X,{..._,value:typeof o==`string`?o:``,onChange:e=>{u(e.target.value===``?null:e.target.value)}})});case`choice`:{let t=e.options.findIndex(e=>e.value===o);return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(sL,{..._,value:String(t),onChange:t=>{let n=e.options[Number(t.target.value)];n!==void 0&&u(n.value)},children:e.options.map((e,t)=>(0,h.jsx)(`option`,{value:String(t),children:e.label},e.label))})})}case`face`:{let t=o,n=O1(t.family);return(0,h.jsx)(R1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(sL,{..._,"aria-label":`${e.label} font`,value:t.family,onChange:e=>{let n=D1.find(t=>t.value===e.target.value);if(n===void 0)return;let r=O1(n.value).some(e=>e.value===t.style);u({...t,family:n.value,style:r?t.style:`normal`})},children:D1.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(sL,{"aria-label":`${e.label} style`,value:t.style,onChange:e=>{u({...t,style:e.target.value})},children:n.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(X,{type:`number`,"aria-label":`${e.label} letter spacing in millimetres`,title:`Letter spacing (mm)`,step:.01,className:`w-20`,value:Number.isFinite(t.letterSpacing)?t.letterSpacing:``,onChange:e=>{u({...t,letterSpacing:e.target.value===``?NaN:Number(e.target.value)})}})]})})}case`lines`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...Py,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:a,className:`sl-field__label`,children:e.label}),d]}),(0,h.jsx)(oL,{..._,rows:8,value:Array.isArray(o)?o.join(`
|
|
275
275
|
`):``,onChange:e=>{u(e.target.value.split(`
|
|
276
276
|
`))}}),g]});case`link`:{let t=o;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...Py,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:a,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{id:a,type:`checkbox`,checked:t!==null,className:`size-4 accent-accent`,onChange:e=>{u(e.currentTarget.checked?{text:`Visit the website`,url:null}:null)}}),e.label]}),d]}),t===null?null:(0,h.jsxs)(`span`,{className:`grid grid-cols-[minmax(0,1fr)] gap-2 sm:grid-cols-2`,children:[(0,h.jsx)(X,{"aria-label":`Link text`,placeholder:`Link text`,value:t.text,onChange:e=>{u({...t,text:e.target.value})}}),(0,h.jsx)(X,{"aria-label":`Link address`,placeholder:`https://`,value:t.url??``,onChange:e=>{u({...t,url:e.target.value===``?null:e.target.value})}})]}),g]})}}}function R1({id:e,label:t,notes:n,info:r,children:i}){return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,...Py,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:e,className:`sl-field__label`,children:t}),r]}),i,n]})}function z1(e,t,n){return JSON.stringify(k1(e,n))!==JSON.stringify(k1(t,n))}function B1(e){return e==null||e===``?`empty`:typeof e==`boolean`?e?`on`:`off`:typeof e==`string`||typeof e==`number`?String(e):`the starting value`}var DSe={"colors.text":4.5,"colors.heading":3,"colors.muted":3,"colors.faint":3};function OSe(e,t){let n=DSe[t.join(`.`)];if(n===void 0||e.background.image!==null)return;let r=k1(e,t);if(typeof r==`string`)return c$(r,e.background.color,`the page colour`,n)}function V1({themeId:e,from:t,onLeave:n}){let{api:r}=B(),i=_(),a=F(Ty(r)),o=(0,m.useId)(),[s,c]=(0,m.useState)(void 0),[l,u]=(0,m.useState)([]),[d,f]=(0,m.useState)(!1),[p,g]=(0,m.useState)(!1),v=a.data,y=e===void 0?void 0:v?.themes.find(t=>t.id===e),b=e===void 0?v?.themes.find(e=>e.id===t)??v?.builtIns.find(e=>e.name===(t??`plain`))??v?.builtIns[0]:y,x=b===void 0?void 0:{name:e===void 0?`${`label`in b?b.label:b.name} copy`:b.name,values:b.values},S=s??x,C=I({mutationFn:t=>Qs(r,t,e),onSuccess:async e=>{if(!e.ok){u(e.fields);return}f(!0),await i.invalidateQueries({queryKey:Ty(r).queryKey})}}),w=I({mutationFn:e=>$s(r,e),onSuccess:async()=>{g(!1),await i.invalidateQueries({queryKey:Ty(r).queryKey}),n()}});f1(d,n);let T=(0,m.useMemo)(()=>S===void 0?void 0:KD.safeParse(S.values),[S]),E=[...S===void 0||S.name.trim()===``?[]:Ile(S.name),...T===void 0||T.success?[]:T.error.issues.map(e=>({field:`values.${e.path.join(`.`)}`,message:e.message})),...l];if(a.error!==null)return(0,h.jsx)(H1,{children:a.error.message});if(v===void 0)return(0,h.jsx)(h1,{});if(S===void 0)return(0,h.jsx)(H1,{children:`That theme is gone. It may have been deleted in another tab.`});let D=(e,t)=>{c(e),u(e=>e.filter(e=>e.field!==t))},O=E1.map(e=>({title:e.title,problems:e.fields.filter(e=>L1(E,e.path)!==void 0).length,changed:x===void 0?0:e.fields.filter(e=>z1(S.values,x.values,e.path)).length})),k=O.filter(e=>e.problems>0).map(e=>e.title),A=S.name.trim()===``?`Give the theme a name.`:E.length>0?k.length===0?`Fix the highlighted settings first.`:`Fix the highlighted settings first, in ${k.join(`, `)}.`:void 0,j=E.filter(e=>e.field===`name`);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(pG,{crumb:(0,h.jsx)(P1,{children:(0,h.jsx)(pa,{to:`/document-themes`,children:`Documents`})}),title:e===void 0?`New PDF theme`:`Edit PDF theme`,meta:`How a project's PDF looks`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(320px,440px)]`,children:[(0,h.jsxs)(`div`,{className:`${M1} flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(iL,{label:`Name`,tip:`library.theme.name`,...j.length===0?{}:{error:j.map(e=>e.message).join(` `)},children:(0,h.jsx)(X,{value:S.name,onChange:e=>{D({...S,name:e.target.value},`name`)}})}),(0,h.jsx)(wSe,{groups:O,onJump:e=>{let t=document.getElementById(I1(e));t instanceof HTMLDetailsElement&&(t.open=!0,t.scrollIntoView?.({block:`start`,behavior:`smooth`}),t.querySelector(`summary`)?.focus())}}),E1.map((e,t)=>{let n=O[t];return(0,h.jsxs)(`details`,{id:I1(e.title),open:t<2||(n?.problems??0)>0,className:`group border-t border-line`,children:[(0,h.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 py-3 text-title-3 font-semibold`,onClick:e=>{let t=e.currentTarget.parentElement;requestAnimationFrame(()=>{t instanceof HTMLDetailsElement&&t.open&&t.scrollIntoView?.({block:`nearest`,behavior:`smooth`})})},children:[(0,h.jsx)(Nc,{"aria-hidden":`true`,className:`size-[14px] text-ink-2 transition-transform group-open:rotate-90 motion-reduce:transition-none`}),e.title,(0,h.jsx)(CSe,{problems:n?.problems??0,changed:n?.changed??0})]}),(0,h.jsx)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] gap-x-5 gap-y-4 pb-4 sm:grid-cols-2`,children:e.fields.map(e=>(0,h.jsx)(ESe,{field:e,theme:S.values,original:x?.values??S.values,problem:L1(E,e.path),onChange:t=>{D({...S,values:t},j1(e.path))}},e.path.join(`.`)))})]},e.title)}),(0,h.jsx)(m1,{onDelete:e===void 0?void 0:()=>{g(!0)},blocked:A,blockedId:o,pending:C.isPending,saved:d,cancel:(0,h.jsx)(GO,{to:`/document-themes`,variant:`secondary`,children:`Cancel`}),errors:[C.error,w.error].flatMap(e=>e===null?[]:[e.message]),onSave:()=>{C.mutate(S)}})]}),(0,h.jsx)(kSe,{values:T?.success===!0?S.values:void 0})]}),(0,h.jsx)($v,{open:p,title:`Delete "${S.name}"?`,consequence:`Projects that used it keep their own copy of its settings.`,confirmLabel:`Delete theme`,pending:w.isPending,onConfirm:()=>{e!==void 0&&w.mutate(e)},onCancel:()=>{g(!1)}})]})}function kSe({values:e}){let{api:t}=B(),[n,r]=(0,m.useState)(),[i,a]=(0,m.useState)(`busy`),[o,s]=(0,m.useState)(void 0),c=e===void 0?void 0:JSON.stringify(e);(0,m.useEffect)(()=>{if(c===void 0)return;let e=new AbortController,n=window.setTimeout(()=>{a(`busy`),ec(t,JSON.parse(c),e.signal).then(async e=>({bytes:new Uint8Array(await e.arrayBuffer()),blob:e})).then(({bytes:t,blob:n})=>{e.signal.aborted||r({bytes:t,url:URL.createObjectURL(n)})},t=>{e.signal.aborted||(s(t instanceof Error?t.message:String(t)),a(`failed`))})},450);return()=>{window.clearTimeout(n),e.abort()}},[t,c]),(0,m.useEffect)(()=>()=>{n!==void 0&&URL.revokeObjectURL(n.url)},[n]);let l=(0,m.useCallback)(e=>{if(e===void 0){a(`idle`);return}s(e.message),a(`failed`)},[]),u=e===void 0?`Paused until the highlighted settings are fixed.`:i===`busy`?`Updating…`:i===`failed`?`The preview couldn't be made: ${o??`unknown error`}`:`A sample article with this theme. Your projects use their own text and thumbnail.`;return(0,h.jsxs)(`div`,{className:N1,children:[(0,h.jsx)(U,{title:`Preview`,info:`library.theme.preview`,size:`small`,className:`pb-0`,children:n===void 0?null:(0,h.jsxs)(qO,{href:n.url,target:`_blank`,rel:`noreferrer`,variant:`secondary`,size:`small`,children:[(0,h.jsx)(Uc,{"aria-hidden":`true`,strokeWidth:1.75}),`Open full size`]})}),(0,h.jsx)(`div`,{className:`max-h-[calc(100vh-220px)] min-h-[320px] overflow-y-auto rounded-media bg-sunken p-3`,children:(0,h.jsx)(v1,{data:n?.bytes,label:`The sample article laid out with this theme`,onDrawn:l})}),(0,h.jsx)(`p`,{role:`status`,className:i===`failed`?`m-0 text-small text-danger`:`m-0 text-small text-ink-2`,children:u})]})}function H1({children:e}){return(0,h.jsx)(F1,{back:(0,h.jsx)(pa,{to:`/document-themes`,children:`Back to Documents`}),children:e})}function U1({selection:e,total:t,noun:n,scope:r,busy:i,onDuplicate:a,onExport:o,onDelete:s,deleteLabel:c=`Delete selected`}){return e.count===0?null:(0,h.jsx)(SG,{selection:e,total:t,noun:n,className:`mb-2`,...r===void 0?{}:{scope:r},actions:(0,h.jsxs)(h.Fragment,{children:[a===void 0?null:(0,h.jsxs)(z,{size:`small`,disabled:i,disabledReason:`Working on the last press`,onClick:a,children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-[14px]`}),`Duplicate selected`]}),o===void 0?null:(0,h.jsxs)(z,{size:`small`,onClick:o,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,className:`size-[14px]`}),`Export selected`]}),(0,h.jsxs)(z,{size:`small`,variant:`destructive`,disabled:i,disabledReason:`Working on the last press`,onClick:s,children:[(0,h.jsx)(xl,{"aria-hidden":`true`,className:`size-[14px]`}),c]})]})})}function W1({selection:e,children:t}){return(0,h.jsx)(`div`,{onKeyDown:e.onKeyDown,children:t})}function G1(e){return`${e.page.format===`a4`?`A4`:`Letter`} · ${K1(e.fonts.body.family)} body`}function K1(e){return D1.find(t=>t.value===e)?.label??e}function q1(e){return e.startsWith(`#`)?e:`#${e}`}function J1({name:e,kicker:t,meta:n,values:r,action:i}){let a=[[`Headings`,r.colors.heading],[`Text`,r.colors.text],[`Muted`,r.colors.muted],[`Header and page numbers`,r.colors.faint]],o=[[`Body`,r.fonts.body],[`Headings`,r.fonts.heading],[`Drop cap`,r.fonts.dropCap]];return(0,h.jsxs)(`section`,{"aria-label":`${e} details`,className:`flex min-w-0 flex-col gap-6`,children:[(0,h.jsx)(U,{title:e,kicker:t,meta:n,className:`pb-0`,children:i}),(0,h.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-[max-content_minmax(0,1fr)]`,children:[a.map(([e,t])=>(0,h.jsx)(Y1,{label:e,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`size-4 rounded-full border border-line`,style:{backgroundColor:q1(t)}}),(0,h.jsx)(`span`,{className:`font-mono text-small`,children:q1(t)})]})},e)),o.map(([e,t])=>(0,h.jsx)(Y1,{label:`${e} font`,children:`${K1(t.family)}, ${t.style}`},`font-${e}`)),(0,h.jsx)(Y1,{label:`Page`,children:`${r.page.format===`a4`?`A4`:`Letter`}, ${r.background.image===`parchment`?`parchment`:`flat ${q1(r.background.color)}`} background`})]})]})}function Y1({label:e,children:t}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`text-small text-ink-2`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 min-w-0 text-body text-ink`,children:t})]})}function X1({colors:e}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`flex shrink-0 gap-1`,children:[e.heading,e.text,e.muted].map((e,t)=>(0,h.jsx)(`span`,{className:`size-3 rounded-full border border-line`,style:{backgroundColor:q1(e)}},t))})}var Z1=`min-[1180px]:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,Q1=`grid-cols-1 2xl:grid-cols-[minmax(0,1fr)_auto]`;function $1({label:e}){return(0,h.jsx)(`ul`,{"aria-label":`${e}, loading`,"aria-busy":`true`,className:`sl-list m-0 list-none p-0`,children:[0,1,2].map(e=>(0,h.jsx)(`li`,{className:`sl-row`,"aria-hidden":`true`,children:(0,h.jsxs)(`span`,{className:`flex flex-col gap-2 py-0.5`,children:[(0,h.jsx)(`span`,{className:`h-3 w-40 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-3 w-56 rounded-control bg-sunken`})]})},e))})}function e0({what:e,message:t,onRetry:n}){return(0,h.jsx)(fM,{tone:`danger`,title:`The ${e} couldn't be loaded.`,actions:(0,h.jsx)(z,{size:`small`,onClick:n,children:`Try again`}),children:t})}function t0({name:e,edit:t,duplicate:n,play:r,onHistory:i,onDelete:a,className:o}){return(0,h.jsxs)(`div`,{role:`group`,"aria-label":`Actions for ${e}`,className:R(`flex flex-wrap items-center gap-0.5`,o),children:[t,r===void 0?null:(0,h.jsx)(z,{variant:`quiet`,size:`small`,"aria-label":`Use ${e} in Play`,title:r.blocked,disabled:r.run===void 0||r.blocked!==void 0,onClick:r.run,children:`Use in Play`}),(0,h.jsxs)(YO,{children:[(0,h.jsx)(XO,{asChild:!0,children:(0,h.jsx)(Nv,{size:`small`,label:`More actions for ${e}`,children:(0,h.jsx)(Hc,{"aria-hidden":`true`})})}),(0,h.jsxs)(ZO,{children:[(0,h.jsx)(QO,{asChild:!0,children:n}),i===void 0?null:(0,h.jsxs)(QO,{"aria-label":`History of ${e}`,onSelect:i,children:[(0,h.jsx)(hl,{"aria-hidden":`true`,className:`size-4`}),`History`]}),(0,h.jsx)($O,{}),(0,h.jsxs)(QO,{"aria-label":`Delete ${e}`,onSelect:a,children:[(0,h.jsx)(xl,{"aria-hidden":`true`,className:`size-4`}),`Delete`]})]})]})]})}var n0=[{value:`name`,label:`Name`},{value:`changed`,label:`Last changed`}];function r0(e,t){return[...e].sort((e,n)=>t===`changed`?n.updatedAt.localeCompare(e.updatedAt)||e.name.localeCompare(n.name):e.name.localeCompare(n.name,void 0,{sensitivity:`base`}))}var i0=e=>`slopify.library.sort.${e}`;function ASe(e){try{return globalThis.localStorage?.getItem(i0(e))===`changed`?`changed`:`name`}catch{return`name`}}function a0(e){let[t,n]=(0,m.useState)(()=>ASe(e));return[t,t=>{n(t);try{globalThis.localStorage?.setItem(i0(e),t)}catch{}}]}function o0({what:e,sort:t,onSort:n}){let r=n0.find(e=>e.value===t)?.label??`Name`;return(0,h.jsxs)(YO,{children:[(0,h.jsx)(XO,{asChild:!0,children:(0,h.jsxs)(z,{variant:`quiet`,size:`small`,"aria-label":`Sort ${e}: ${r}`,children:[(0,h.jsx)(yc,{"aria-hidden":`true`}),r]})}),(0,h.jsx)(ZO,{align:`start`,children:n0.map(e=>(0,h.jsxs)(QO,{"aria-label":`Sort by ${e.label.toLowerCase()}${e.value===t?` (current)`:``}`,onSelect:()=>n(e.value),children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,className:e.value===t?`size-4`:`size-4 opacity-0`}),e.value===`changed`?`Last changed first`:`Name, A to Z`]},e.value))})]})}var jSe=4e3;function s0(e){return e.match(/\s+|[^\s]+/gu)??[]}function MSe(e,t){let n=s0(e),r=s0(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i+=1;let a=0;for(;a<n.length-i&&a<r.length-i&&n[n.length-1-a]===r[r.length-1-a];)a+=1;let o=[];l0(o,`same`,n.slice(0,i).join(``));let s=n.slice(i,n.length-a),c=r.slice(i,r.length-a);for(let e of PSe(s,c))l0(o,e.op,e.text);return l0(o,`same`,n.slice(n.length-a).join(``)),o}function c0(e,t){let n=t===`before`?`added`:`removed`;return e.filter(e=>e.op!==n)}function NSe(e){let t=t=>e.filter(e=>e.op===t).reduce((e,t)=>e+s0(t.text).filter(e=>e.trim()!==``).length,0);return{added:t(`added`),removed:t(`removed`)}}function l0(e,t,n){if(n===``)return;let r=e.at(-1);r!==void 0&&r.op===t?e[e.length-1]={op:t,text:r.text+n}:e.push({op:t,text:n})}function PSe(e,t){if(e.length===0&&t.length===0)return[];if(e.length===0)return[{op:`added`,text:t.join(``)}];if(t.length===0)return[{op:`removed`,text:e.join(``)}];let n=e.length,r=t.length,i=Math.min(n+r,jSe),a=i+1,o=new Int32Array(2*i+3),s=[],c=!1;for(let l=0;l<=i&&!c;l+=1){s.push(o.slice());let i=o.slice();for(let s=-l;s<=l;s+=2){let u=s===-l||s!==l&&(o[a+s-1]??0)<(o[a+s+1]??0)?o[a+s+1]??0:(o[a+s-1]??0)+1,d=u-s;for(;u<n&&d<r&&e[u]===t[d];)u+=1,d+=1;if(i[a+s]=u,u>=n&&d>=r){c=!0;break}}o=i}if(!c)return[{op:`removed`,text:e.join(``)},{op:`added`,text:t.join(``)}];let l=[],u=n,d=r;for(let n=s.length-1;n>=0;--n){let r=s[n]??new Int32Array,i=u-d,o=i===-n||i!==n&&(r[a+i-1]??0)<(r[a+i+1]??0),c=o?i+1:i-1,f=r[a+c]??0,p=f-c;for(;u>f&&d>p;)l.push({op:`same`,text:e[u-1]??``}),--u,--d;n>0&&(o?l.push({op:`added`,text:t[d-1]??``}):l.push({op:`removed`,text:e[u-1]??``}),u=f,d=p)}let f=[];for(let e of l.reverse())l0(f,e.op,e.text);return f}function u0({before:e,after:t,beforeLabel:n,afterLabel:r}){let i=(0,m.useMemo)(()=>MSe(e,t),[e,t]),a=NSe(i);return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:a.added===0&&a.removed===0?`The two texts are the same.`:`${String(a.added)} ${a.added===1?`word`:`words`} added, ${String(a.removed)} removed.`}),(0,h.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,h.jsx)(d0,{label:n,parts:c0(i,`before`)}),(0,h.jsx)(d0,{label:r,parts:c0(i,`after`)})]})]})}function d0({label:e,parts:t}){return(0,h.jsxs)(`section`,{"aria-label":e,className:`flex min-w-0 flex-col gap-1`,children:[(0,h.jsx)(`h4`,{className:`sl-kicker m-0`,children:e}),(0,h.jsx)(`div`,{className:`min-w-0 whitespace-pre-wrap break-words border-l-2 border-line pl-3 text-small leading-relaxed text-ink`,children:FSe(t).map(({key:e,part:t})=>t.op===`removed`?(0,h.jsx)(`del`,{className:`rounded-[2px] bg-danger-tint text-danger line-through`,children:t.text},e):t.op===`added`?(0,h.jsx)(`ins`,{className:`rounded-[2px] bg-accent-tint text-accent-ink no-underline`,children:t.text},e):(0,h.jsx)(`span`,{children:t.text},e))})]})}function FSe(e){let t=0;return e.map(e=>{let n=`${e.op}-${String(t)}`;return t+=e.text.length,{key:n,part:e}})}var f0={versions:(e,t)=>[`library-history`,e,t],usedBy:(e,t)=>[`library-used-by`,e,t]};function p0(e,t){let{api:n}=B();return F({queryKey:f0.versions(e,t),queryFn:()=>Ks(n,e,t)})}function ISe(e,t){let{api:n}=B();return F({queryKey:f0.usedBy(e,t),queryFn:()=>qs(n,e,t)})}function m0({item:e,id:t,name:n,onClose:r}){let{api:i}=B(),a=_(),o=p0(e,t),s=o.data?.versions??[],[c,l]=(0,m.useState)({}),u=c.after??s[0]?.version,d=c.before??s[1]?.version??u,f=s.find(e=>e.version===d),p=s.find(e=>e.version===u),[g,v]=(0,m.useState)(),y=I({mutationFn:n=>Js(i,e,t,n),onSuccess:async(n,r)=>{v(`Restored version ${String(r)} as a new version.`),l({}),await Promise.all([a.invalidateQueries({queryKey:f0.versions(e,t)}),a.invalidateQueries({queryKey:e===`prompt`?V.prompts:V.entries})])},onError:()=>v(void 0)}),b=s[0]?.version;return(0,h.jsx)(eM,{open:!0,title:`History of ${n}`,onClose:r,className:`sm:w-[min(1080px,100vw)]`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[o.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-body text-danger`,children:`The history couldn't be read: ${o.error.message}`}),(0,h.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(U,{title:`Compare`,as:`h3`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:[(0,h.jsx)(iL,{label:`Older`,tip:`library.history.compare`,children:(0,h.jsx)(sL,{value:d===void 0?``:String(d),disabled:s.length===0,onChange:e=>l(t=>({...t,before:Number(e.currentTarget.value)})),children:s.map(e=>(0,h.jsx)(`option`,{value:e.version,children:g0(e,b)},e.version))})}),(0,h.jsx)(iL,{label:`Newer`,tip:`library.history.compare`,children:(0,h.jsx)(sL,{value:u===void 0?``:String(u),disabled:s.length===0,onChange:e=>l(t=>({...t,after:Number(e.currentTarget.value)})),children:s.map(e=>(0,h.jsx)(`option`,{value:e.version,children:g0(e,b)},e.version))})})]}),f===void 0||p===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:o.isPending?`Loading the versions…`:`No versions to compare.`}):(0,h.jsxs)(h.Fragment,{children:[f.name===p.name?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Renamed from "${f.name}" to "${p.name}".`}),(0,h.jsx)(u0,{before:f.body,after:p.body,beforeLabel:`Version ${String(f.version)}`,afterLabel:`Version ${String(p.version)}`})]})]}),(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(U,{title:`Versions`,as:`h3`,info:`library.history.versions`}),(0,h.jsx)(KL,{label:`Versions of ${n}`,children:s.map(e=>(0,h.jsx)(qL,{title:`Version ${String(e.version)}`,meta:h0(e),actions:e.version===b?(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Current`}):(0,h.jsx)(z,{size:`small`,"aria-label":`Restore version ${String(e.version)}`,disabled:y.isPending,disabledReason:`Restoring a version`,onClick:()=>{v(void 0),y.mutate(e.version)},children:`Restore`})},e.version))}),(0,h.jsx)(SR,{tone:y.error===null?`success`:`error`,children:y.error?.message??g})]})]})})}function h0(e){return`${e.author} · ${_0(e.createdAt)}${e.restoredFrom===null?``:` · restored from version ${String(e.restoredFrom)}`}`}function g0(e,t){return`Version ${String(e.version)}${e.version===t?` (current)`:``} · ${_0(e.createdAt)}`}function _0(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function v0({item:e,id:t,name:n,kicker:r,meta:i,body:a,slots:o,actions:s,onOpenHistory:c}){return(0,h.jsxs)(`section`,{"aria-label":`${n} details`,className:`flex min-w-0 flex-col gap-6`,children:[(0,h.jsx)(U,{title:n,kicker:r,meta:i,className:`pb-0`,children:s}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(`div`,{className:`m-0 max-h-[420px] min-w-0 overflow-y-auto whitespace-pre-wrap break-words rounded-media bg-sunken p-4 font-mono text-small text-ink-2`,children:a}),o.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No keywords. It runs as written.`}):(0,h.jsx)(`ul`,{"aria-label":`Keywords`,className:`m-0 flex list-none flex-wrap gap-2 p-0`,children:o.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsx)(cL,{children:`{{${e}}}`})},e))})]}),(0,h.jsx)(LSe,{item:e,id:t}),(0,h.jsx)(RSe,{item:e,id:t,name:n,onOpenHistory:c})]})}function LSe({item:e,id:t}){let n=ISe(e,t),r=n.data;return(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(U,{title:`Used by`,as:`h3`,className:`pb-0`,info:`library.used-by`,...r===void 0?{}:{meta:zSe(r)}}),n.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:`What uses it couldn't be read: ${n.error.message}`}),r===void 0?null:r.templates.length+r.schedules.length+r.projects.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Nothing uses it yet.`}):(0,h.jsxs)(KL,{label:`Used by`,children:[r.templates.map(e=>(0,h.jsx)(qL,{title:(0,h.jsx)(pa,{to:`/templates`,children:e.name}),meta:`Template`},`t-${e.id}`)),r.schedules.map(e=>(0,h.jsx)(qL,{title:(0,h.jsx)(pa,{to:`/calendar`,search:{tab:`schedules`,schedule:e.id},children:e.name}),meta:e.status===`paused`?`Schedule · paused`:`Schedule`},`s-${e.id}`)),r.projects.map(e=>(0,h.jsx)(qL,{title:(0,h.jsx)(pa,{to:`/projects/$projectId`,params:{projectId:e.id},children:e.title}),meta:`Project${e.totalRevisions===0?``:` · ${String(e.revisions)} of ${String(e.totalRevisions)} ${e.totalRevisions===1?`revision`:`revisions`}${e.current?`, including the current one`:`, not the current one`}`}`},`p-${e.id}`))]})]})}function RSe({item:e,id:t,name:n,onOpenHistory:r}){let i=p0(e,t),a=i.data?.versions??[],[o,s]=a;return(0,h.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(U,{title:`History`,as:`h3`,className:`pb-0`,info:`library.history`,...o===void 0?{}:{meta:(0,h.jsx)(`span`,{title:b0(o.createdAt),children:`${y0(a.length,`version`)} · latest ${h0(o)}`})},children:(0,h.jsx)(z,{size:`small`,"aria-label":`Compare versions of ${n}`,onClick:r,children:`Compare versions`})}),i.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:`The history couldn't be read: ${i.error.message}`}),o===void 0?null:s===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Only one version so far.`}):(0,h.jsx)(u0,{before:s.body,after:o.body,beforeLabel:`Version ${String(s.version)}`,afterLabel:`Version ${String(o.version)}`})]})}function zSe(e){return[y0(e.templates.length,`template`),y0(e.schedules.length,`schedule`),y0(e.projects.length,`project`)].join(`, `)}function y0(e,t){return`${String(e)} ${t}${e===1?``:`s`}`}function BSe(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{dateStyle:`medium`})}function b0(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`})}function x0({iso:e,children:t}){return(0,h.jsx)(`time`,{dateTime:e,title:b0(e),children:t??BSe(e)})}function S0({what:e,exports:t,accept:n,onFile:r,disabled:i=!1}){let a=(0,m.useRef)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(YO,{children:[(0,h.jsx)(XO,{asChild:!0,children:(0,h.jsxs)(z,{variant:`quiet`,disabled:i,disabledReason:`Still loading`,children:[(0,h.jsx)(yc,{"aria-hidden":`true`,className:`size-[14px]`}),`Import or export`]})}),(0,h.jsxs)(ZO,{children:[t.map(e=>(0,h.jsxs)(QO,{disabled:e.disabled===!0,onSelect:e.run,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,className:`size-4`}),e.label]},e.label)),(0,h.jsx)($O,{}),(0,h.jsxs)(QO,{onSelect:()=>a.current?.click(),children:[(0,h.jsx)(Cl,{"aria-hidden":`true`,className:`size-4`}),`Import from a file…`]})]})]}),(0,h.jsx)(`input`,{ref:a,type:`file`,hidden:!0,accept:n,"aria-label":`Import ${e} from a file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&r(t)}})]})}var C0=`slopify-library`,VSe=20971520,w0=1e4,HSe={prompts:`prompts`,entries:`intros or outros`,documentThemes:`PDF themes`,aliases:`narration aliases`},T0={prompts:e=>({kind:e.kind,name:e.name,body:e.body}),entries:e=>({category:e.category,mode:e.mode,name:e.name,body:e.body}),documentThemes:e=>({name:e.name,values:e.values}),aliases:e=>({written:e.written,spoken:e.spoken,wholeWord:e.wholeWord,caseSensitive:e.caseSensitive})};function E0(e,t){return{format:C0,version:1,exportedAt:t.toISOString(),...e.prompts===void 0?{}:{prompts:e.prompts.map(T0.prompts)},...e.entries===void 0?{}:{entries:e.entries.map(T0.entries)},...e.documentThemes===void 0?{}:{documentThemes:e.documentThemes.map(T0.documentThemes)},...e.aliases===void 0?{}:{aliases:e.aliases.map(T0.aliases)}}}var D0=e=>G({error:`it has no name.`}).trim().min(1,{error:`it has no name.`}).max(e,{error:`its name is longer than ${String(e)} characters.`}),O0=G({error:`it has no text.`}).max(Bb,{error:`its text is longer than ${String(Bb)} characters.`}),USe={prompts:J({kind:Y(Rb,{error:`its kind isn't one of ${Rb.join(`, `)}.`}),name:D0(200),body:O0}),entries:J({category:Y(zb,{error:`it is neither an intro nor an outro.`}),mode:Y(Nb,{error:`its mode isn't one of ${Nb.join(`, `)}.`}),name:D0(200),body:O0}),documentThemes:J({name:D0(80),values:KD}),aliases:XD},WSe=J({format:tT(C0),version:K().int().positive()}).loose();function k0(e,t){let n=HSe[t],r;try{r=JSON.parse(e)}catch{return{ok:!1,message:`it isn't a Slopify library file (the text isn't JSON). Pick a .json file made by Export.`}}let i=WSe.safeParse(r);if(!i.success)return{ok:!1,message:`it isn't a Slopify library file. Pick a .json file made by Export on a Library tab.`};if(i.data.version>1)return{ok:!1,message:`it was made by a newer Slopify. Update Slopify (Settings → Updates), then import it again.`};let a=i.data[t];if(!Array.isArray(a)||a.length===0)return{ok:!1,message:`it holds no ${n}. Import it on the Library tab it was exported from.`};if(a.length>w0)return{ok:!1,message:`it holds more than ${String(w0)} ${n}. Split it into smaller files.`};let o=[],s=[],c=USe[t];for(let[e,t]of a.entries()){let n=c.safeParse(t);n.success?o.push(n.data):s.push({item:GSe(t,e),reason:KSe(n.error)})}return{ok:!0,items:o,skipped:s}}function GSe(e,t){let n=J({name:G().trim().min(1)}).safeParse(e);if(n.success)return n.data.name;let r=J({written:G().trim().min(1)}).safeParse(e);return r.success?r.data.written:`Item ${String(t+1)}`}function KSe(e){let t=e.issues[0];if(t===void 0)return`it doesn't fit.`;let[n]=t.path;return n===`values`?`its setting ${t.path.slice(1).join(`.`)}: ${t.message}`:n===`written`||n===`spoken`?`its ${n===`written`?`written form`:`spoken form`} is empty or too long.`:typeof n==`string`&&/^it/u.test(t.message)?t.message:n===void 0?`it isn't an item.`:`its ${String(n)} is missing or wrong.`}function qSe(e,t,n){return A0(e,t,n,e=>e===1?` (imported)`:` (imported ${String(e)})`)}function JSe(e,t,n){return A0(e,t,n,e=>e===1?` copy`:` copy ${String(e)}`,!1)}function A0(e,t,n,r,i=!0){let a=e.trim();if(i&&!t.has(a.toLowerCase()))return a;for(let e=1;;e+=1){let i=r(e),o=`${a.slice(0,Math.max(0,n-i.length)).trimEnd()}${i}`;if(!t.has(o.toLowerCase()))return o}}var j0=e=>e instanceof Error?e.message:String(e);function M0({noun:e,listKey:t,all:n,groupOf:r=()=>``,nameMax:i,duplicate:a,remove:o,trash:s,selection:c}){let{api:l}=B(),u=_(),d=Lv(),f=t=>CG(t,e[0],e[1]),p=async()=>{await Promise.all([u.invalidateQueries({queryKey:t}),...s===void 0?[]:[u.invalidateQueries({queryKey:XZ})]])},m=(e,t,n)=>{let r=e[0];r!==void 0&&d(`${f(e.length)} ${e.length===1?`wasn't`:`weren't`} ${t}: “${r.item.name}”: ${r.reason} ${n}`,`error`)},h=I({mutationFn:async e=>{let t=new Map;for(let e of n){let n=t.get(r(e))??new Set;n.add(e.name.trim().toLowerCase()),t.set(r(e),n)}let o=[],s=[];for(let n of e){let e=t.get(r(n))??new Set;t.set(r(n),e);let c=JSe(n.name,e,i);try{let t=await a(n,c);t===null?(e.add(c.toLowerCase()),o.push(c)):s.push({item:n,reason:t})}catch(e){s.push({item:n,reason:j0(e)})}}return{made:o,refused:s}},onSuccess:({made:e,refused:t})=>{let[n]=e;e.length===1&&n!==void 0?d(`Duplicated as “${n}”.`,`success`):e.length>1&&d(`Duplicated ${f(e.length)}.`,`success`),m(t,`duplicated`,`Press Duplicate selected again.`)},onError:e=>d(`Nothing was duplicated: ${j0(e)} Press Duplicate selected again.`,`error`),onSettled:async()=>{c.clear(),await p()}}),g=async(t,n)=>{try{let e=await $Z(l,t.map(e=>({kind:n,id:e.id})));e.failed.length>0?d(`${f(e.failed.length)} couldn't be restored: ${e.failed[0]?.detail??``} Restore ${e.failed.length===1?`it`:`them`} in Settings → Backup & storage → Trash.`,`error`):d(`Restored ${f(e.restored.length)}.`,`success`)}catch(t){d(`The ${e[1]} weren't restored: ${j0(t)} Restore them in Settings → Backup & storage → Trash.`,`error`)}finally{await p()}},v=I({mutationFn:async e=>{let t=[],n=[];for(let r of e)try{await o(r),t.push(r)}catch(e){n.push({item:r,reason:j0(e)})}return{done:t,refused:n}},onSuccess:({done:e,refused:t})=>{e.length>0&&(s===void 0?d(`Deleted ${f(e.length)} permanently.`,`success`):d(`Moved ${f(e.length)} to the trash.`,`success`,{label:`Undo`,run:()=>void g(e,s)})),m(t,`deleted`,`Press Delete selected again.`)},onError:e=>d(`Nothing was deleted: ${j0(e)} Press Delete selected again.`,`error`),onSettled:async()=>{c.clear(),await p()}});return{duplicate:e=>h.mutate(e),remove:e=>v.mutate(e),busy:h.isPending||v.isPending}}function N0(e){return e.ok?null:(e.fields??[]).map(e=>e.message).join(` `)}function P0(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function F0(e,t){P0(`slopify-${e}-${t.exportedAt.slice(0,10)}.json`,`${JSON.stringify(t,null,2)}\n`,`application/json`)}async function I0(e){if(e.size>20971520)return{ok:!1,message:`it is larger than ${String(VSe/1024/1024)} MB, far more than a Library export. Pick the .json file Export made.`};try{return{ok:!0,text:await e.text()}}catch(e){return{ok:!1,message:`the file couldn't be read (${e instanceof Error?e.message:String(e)}). Pick it again.`}}}var YSe=3;async function XSe(e,t){let n=new Map,r=e=>{let t=n.get(e);if(t!==void 0)return t;let r=new Set;return n.set(e,r),r};for(let e of t.existing)r(e.group).add(e.name.trim().toLowerCase());let i=0,a=0,o=[];for(let n of e){let e=r(t.groupOf(n)),s=``;for(let r=0;r<YSe;r+=1){let r=qSe(n.name,e,t.max);try{let o=await t.save({...n,name:r});if(e.add(r.toLowerCase()),o.ok){i+=1,r!==n.name.trim()&&(a+=1),s=``;break}if(s=o.fields.map(e=>e.message).join(` `),!o.fields.some(e=>e.field===`name`))break}catch(e){s=e instanceof Error?e.message:String(e);break}}s!==``&&o.push({item:n.name.trim()||`An item`,reason:s})}return{added:i,renamed:a,skipped:o}}function L0(e){if(e.length===0)return``;let t=e.slice(0,3).map(e=>`“${e.item}”: ${e.reason}`).join(` `),n=e.length>3?` And ${String(e.length-3)} more.`:``;return`Skipped ${String(e.length)}: ${t}${n}`}function ZSe(e,t,n){let r=L0(n.skipped);if(n.added===0)return{text:`Nothing was imported from ${e}. ${r} Fix the file and import it again.`,tone:`error`};let i=n.renamed===0?``:` ${CG(n.renamed,`was`,`were`)} renamed “(imported)” because the name was taken.`;return{text:`Imported ${CG(n.added,t[0],t[1])} from ${e}.${i}${r===``?``:` ${r}`}`,tone:`success`}}var R0=(e,t)=>`${e} wasn't imported: ${t}`;function z0({section:e,pack:t,stem:n,noun:r,listKey:i,existing:a,groupOf:o,nameMax:s,save:c}){let l=_(),u=Lv(),d=I({mutationFn:async t=>{let n=await I0(t);if(!n.ok)return{refused:n.message};let r=k0(n.text,e);if(!r.ok)return{refused:r.message};let i=await XSe(r.items,{existing:a.map(e=>({group:o(e),name:e.name})),groupOf:o,max:s,save:c});return{outcome:{...i,skipped:[...r.skipped,...i.skipped]}}},onSuccess:(e,t)=>{if(`refused`in e){u(R0(t.name,e.refused),`error`);return}let n=ZSe(t.name,r,e.outcome);u(n.text,n.tone)},onError:(e,t)=>u(R0(t.name,`${e.message} Press Import or export, then Import from a file, to try again.`),`error`),onSettled:()=>l.invalidateQueries({queryKey:i})});return{exportItems:e=>{F0(n,E0(t(e),new Date)),u(`Exported ${CG(e.length,r[0],r[1])}.`,`success`)},importFile:e=>d.mutate(e),importing:d.isPending}}var QSe=[{label:`Setups`,tabs:[{to:`/templates`,label:`Templates`}]},{label:`Building blocks`,tabs:[{to:`/prompts`,label:`Prompts`},{to:`/entries`,label:`Intros & outros`},{to:`/document-themes`,label:`PDF themes`},{to:`/narration-aliases`,label:`Narration aliases`}]},{label:`Results`,tabs:[{to:`/ab-results`,label:`A/B results`}]}];function $Se(){return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(pG,{title:`Library`,meta:`Templates to start from, and the prompts, intros and outros, PDF themes and narration aliases they use`}),(0,h.jsx)(`div`,{className:`mb-6 flex min-w-0 flex-wrap items-end gap-x-8 gap-y-3 border-b border-line`,children:QSe.map(e=>(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`div`,{className:`sl-kicker`,children:e.label}),(0,h.jsx)(lbe,{items:e.tabs,label:e.label,className:`border-b-0`})]},e.label))}),(0,h.jsx)(eCe,{}),(0,h.jsx)(ka,{})]})}function eCe(){let e=Yi(),t=Va({select:e=>e.location}),n=t.search,r=Xb(t.pathname===`/prompts`?n.kind:void 0),i=qb(t.pathname===`/entries`?n.category:void 0);return cb({id:`library.new-prompt`,title:`New prompt`,group:`Library`,keywords:[`create`,`article`,`image`,`thumbnail`],run:()=>{e({to:`/prompts/new`,search:{kind:r}})}}),cb({id:`library.new-entry`,title:`New intro or outro`,group:`Library`,keywords:[`create`,`entry`],run:()=>{e({to:`/entries/new`,search:{category:i}})}}),cb({id:`library.new-document-theme`,title:`New PDF theme`,group:`Library`,keywords:[`create`,`pdf`,`theme`,`document`],run:()=>{e({to:`/document-themes/new`,search:{from:`plain`}})}}),cb({id:`library.open-prompts`,title:`Open prompts`,group:`Library`,run:()=>{e({to:`/prompts`,search:{kind:`article`}})}}),cb({id:`library.open-entries`,title:`Open intros and outros`,group:`Library`,keywords:[`entries`],run:()=>{e({to:`/entries`,search:{category:`intro`}})}}),cb({id:`library.open-templates`,title:`Open templates`,group:`Library`,keywords:[`setups`],run:()=>{e({to:`/templates`})}}),cb({id:`library.open-document-themes`,title:`Open PDF themes`,group:`Library`,keywords:[`pdf`,`documents`,`document themes`],run:()=>{e({to:`/document-themes`})}}),null}function B0({children:e,action:t,className:n}){return(0,h.jsxs)(`div`,{"data-slot":`library-toolbar`,className:R(`mb-5 flex min-h-9 flex-wrap items-center gap-x-4 gap-y-3`,n),children:[(0,h.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-3`,children:e}),t===void 0?null:(0,h.jsx)(Fv,{className:`ml-auto shrink-0`,children:t})]})}function tCe(){let{api:e}=B(),t=_(),n=F(Ty(e)),[r,i]=eL(),[a,o]=a0(`document-theme`),[s,c]=(0,m.useState)(void 0),l=I({mutationFn:t=>$s(e,t),onSettled:async()=>{c(void 0),await t.invalidateQueries({queryKey:V.documentThemes})}}),u=n.data,d=u===void 0?[]:r0(u.themes,a),f=d.find(e=>e.id===r),p=f===void 0?u?.builtIns.find(e=>e.name===r):void 0,g=f===void 0&&p===void 0?d[0]:void 0,v=f??g,y=v===void 0?p??u?.builtIns[0]:void 0,b=vG(d.map(e=>e.id)),x=d.filter(e=>b.has(e.id)),[S,C]=(0,m.useState)(!1),w=M0({noun:V0,listKey:V.documentThemes,all:d,nameMax:80,duplicate:async(t,n)=>N0(await Qs(e,{name:n,values:t.values},void 0)),remove:t=>$s(e,t.id),trash:void 0,selection:b}),T=z0({section:`documentThemes`,pack:e=>({documentThemes:e}),stem:`pdf-themes`,noun:V0,listKey:V.documentThemes,existing:d,groupOf:()=>``,nameMax:80,save:t=>Qs(e,t,void 0)});return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(B0,{action:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(S0,{what:`PDF themes`,disabled:u===void 0||T.importing,exports:[{label:`Export all ${CG(d.length,`theme`,`themes`)} of yours`,run:()=>T.exportItems(d),disabled:d.length===0}],accept:`.json,application/json`,onFile:T.importFile}),(0,h.jsx)(GO,{to:`/document-themes/new`,search:{from:`plain`},variant:`primary`,children:`New theme`})]}),children:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`How a project's PDF looks. Pick one on the Document row in Play or in Edit project.`})}),n.error===null?null:(0,h.jsx)(e0,{what:`PDF themes`,message:n.error.message,onRetry:()=>void n.refetch()}),u===void 0?n.error===null?(0,h.jsx)($1,{label:`PDF themes`}):null:(0,h.jsx)(gG,{className:Z1,list:(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(U,{title:`Your themes`,as:`h3`,className:`pb-0`,info:`library.themes.yours`,children:d.length>1?(0,h.jsx)(o0,{what:`your themes`,sort:a,onSort:o}):null}),u.themes.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No themes of your own yet. Copy a built-in below to start one.`}):(0,h.jsxs)(W1,{selection:b,children:[(0,h.jsx)(U1,{selection:b,total:d.length,noun:V0,busy:w.busy,onDuplicate:()=>w.duplicate(x),onExport:()=>T.exportItems(x),onDelete:()=>C(!0)}),(0,h.jsx)(KL,{label:`Your themes`,children:d.map(e=>(0,h.jsx)(qL,{className:Q1,lead:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bG,{selection:b,value:e.id,label:e.name}),(0,h.jsx)(X1,{colors:e.values.colors})]}),title:e.name,meta:(0,h.jsxs)(h.Fragment,{children:[`${G1(e.values)} · updated `,(0,h.jsx)(x0,{iso:e.updatedAt})]}),selected:e.id===v?.id,onSelect:()=>i(e.id),actions:(0,h.jsx)(t0,{name:e.name,edit:(0,h.jsx)(GO,{to:`/document-themes/$themeId`,params:{themeId:e.id},"aria-label":`Edit ${e.name}`,variant:`quiet`,size:`small`,children:`Edit`}),duplicate:(0,h.jsx)(GO,{to:`/document-themes/new`,search:{from:e.id},"aria-label":`Duplicate ${e.name}`,variant:`quiet`,size:`small`,children:`Duplicate`}),onDelete:()=>c(e)})},e.id))})]})]}),(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(U,{title:`Built in`,as:`h3`,className:`pb-0`,info:`library.themes.built-in`}),(0,h.jsx)(KL,{label:`Built-in themes`,children:u.builtIns.map(e=>(0,h.jsx)(qL,{className:Q1,lead:(0,h.jsx)(X1,{colors:e.values.colors}),title:e.label,meta:G1(e.values),selected:e.name===y?.name,onSelect:()=>i(e.name),actions:(0,h.jsx)(GO,{to:`/document-themes/new`,search:{from:e.name},"aria-label":`Copy ${e.label}`,variant:`quiet`,size:`small`,children:`Copy`})},e.name))})]})]}),detail:v===void 0?y===void 0?null:(0,h.jsx)(J1,{name:y.label,kicker:`Built in`,meta:`Built-in themes can't be changed. Copy one to make it yours.`,values:y.values,action:(0,h.jsx)(GO,{to:`/document-themes/new`,search:{from:y.name},size:`small`,children:`Copy theme`})}):(0,h.jsx)(J1,{name:v.name,kicker:`Your theme`,meta:(0,h.jsxs)(h.Fragment,{children:[`Updated `,(0,h.jsx)(x0,{iso:v.updatedAt})]}),values:v.values,action:(0,h.jsx)(GO,{to:`/document-themes/$themeId`,params:{themeId:v.id},size:`small`,children:`Edit theme`})})}),l.error===null?null:(0,h.jsx)(fM,{tone:`danger`,title:`The theme wasn't deleted.`,className:`mt-4`,children:l.error.message}),(0,h.jsx)($v,{open:s!==void 0,title:`Delete the PDF theme “${s?.name??``}”?`,consequence:nCe,confirmLabel:`Delete theme permanently`,pending:l.isPending,onConfirm:()=>{s!==void 0&&l.mutate(s.id)},onCancel:()=>c(void 0)}),(0,h.jsx)($v,{open:S,title:`Delete ${CG(x.length,`PDF theme`,`PDF themes`)} permanently?`,consequence:`${x.length===1?`“${x[0]?.name??``}” is`:`These ${String(x.length)} themes are`} deleted permanently: PDF themes do not go to Settings → Trash, so they cannot be restored. Projects that used them keep their own copy of the settings.`,confirmLabel:`Delete ${CG(x.length,`theme`,`themes`)} permanently`,cancelLabel:`Keep them`,pending:w.busy,onConfirm:()=>{w.remove(x),C(!1)},onCancel:()=>C(!1)})]})}var V0=[`PDF theme`,`PDF themes`],nCe=`It is deleted permanently: PDF themes do not go to Settings → Trash, so it cannot be restored. Projects that used it keep their own copy of its settings.`;function H0(e){let t=e.map(e=>e.message).join(` `);return`The name wasn't saved. ${t===``?`Pick another name and press Save name again.`:t}`}function U0({name:e,onSelect:t,onRename:n,tip:r=`library.inline-rename`,maxLength:i=200}){let a=Lv(),[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(e),[u,d]=(0,m.useState)(null),[f,p]=(0,m.useState)(!1),g=(0,m.useRef)(!1),_=async e=>{try{return await n(e)}catch(e){return`The name wasn't saved: ${e instanceof Error?e.message:`Slopify didn't answer.`} Check that Slopify is running, then press Save name again.`}},v=async()=>{let t=c.trim();if(t===e){s(!1),d(null);return}if(t===``){d(`Write a name first, or press Cancel to keep the old one.`);return}if(g.current)return;g.current=!0,p(!0);let n=await _(t);if(g.current=!1,p(!1),n!==null){d(n);return}s(!1),d(null),a(`Renamed “${e}” to “${t}”.`,`success`,{label:`Undo`,run:()=>void _(e).then(t=>{t===null?a(`Renamed back to “${e}”.`,`success`):a(t,`error`)})})},y=()=>{s(!1),l(e),d(null)};return o?(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,...Py,children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,h.jsx)(X,{autoFocus:!0,"aria-label":`New name for ${e}`,"aria-invalid":u!==null,maxLength:i,value:c,className:`min-w-0 flex-1`,onChange:e=>{l(e.target.value),d(null)},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),v()):e.key===`Escape`&&(e.preventDefault(),y())}}),(0,h.jsx)(z,{size:`small`,variant:`primary`,disabled:f,onClick:()=>void v(),children:f?`Saving…`:`Save name`}),(0,h.jsx)(z,{size:`small`,variant:`quiet`,disabled:f,onClick:y,children:`Cancel`}),(0,h.jsx)(H,{id:r,label:`Rename`})]}),u===null?null:(0,h.jsx)(`span`,{role:`alert`,className:`text-small font-normal text-danger`,children:u})]}):(0,h.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[t===void 0?(0,h.jsx)(`span`,{className:`min-w-0 break-words`,children:e}):(0,h.jsx)(JL,{onSelect:t,className:`min-w-0`,children:e}),(0,h.jsx)(Nv,{size:`small`,label:`Rename ${e}`,onClick:()=>{l(e),s(!0)},children:(0,h.jsx)(ul,{"aria-hidden":`true`,strokeWidth:1.75})})]})}function rCe({category:e,onCategory:t,onUseInPlay:n,playBlocked:r}){let{api:i}=B(),a=_(),o=F(wy(i)),[s,c]=(0,m.useState)(``),l=(0,m.useRef)(null),u=lb(l,`intros and outros`),[d,f]=eL(),[p,g]=a0(`entry`),[v,y]=(0,m.useState)(void 0),[b,x]=(0,m.useState)(void 0),S=I({mutationFn:e=>ic(i,e),onSettled:async()=>{y(void 0),await a.invalidateQueries({queryKey:V.entries})}}),C=async(e,t)=>{let n=await Xs(i,{category:e.category,mode:e.mode,name:t,body:e.body},e.id);return await a.invalidateQueries({queryKey:V.entries}),n.ok?null:H0(n.fields)},w=o.data?.entries.filter(t=>t.category===e),T=s.trim().toLowerCase(),E=T===``?w:w?.filter(e=>e.name.toLowerCase().includes(T)||e.body.toLowerCase().includes(T)),D=E===void 0?void 0:r0(E,p),O=D?.find(e=>e.id===d)??D?.[0],k=o.data?.entries??[],A=vG(D?.map(e=>e.id)??[]),j=D?.filter(e=>A.has(e.id))??[],M=[e,`${e}s`],ee=M0({noun:M,listKey:V.entries,all:k,groupOf:e=>e.category,nameMax:200,duplicate:async(e,t)=>N0(await Xs(i,{category:e.category,mode:e.mode,name:t,body:e.body},void 0)),remove:e=>ic(i,e.id),trash:`entry`,selection:A}),N=z0({section:`entries`,pack:e=>({entries:e}),stem:`intros-and-outros`,noun:[`intro or outro`,`intros and outros`],listKey:V.entries,existing:k,groupOf:e=>e.category,nameMax:200,save:e=>Xs(i,e,void 0)});return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(B0,{action:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(S0,{what:`intros and outros`,disabled:o.data===void 0||N.importing,exports:[{label:`Export all ${String(k.length)} intros and outros`,run:()=>N.exportItems(k),disabled:k.length===0}],accept:`.json,application/json`,onFile:N.importFile}),(0,h.jsx)(GO,{to:`/entries/new`,search:{category:e},variant:`primary`,children:`New intro or outro`})]}),children:[(0,h.jsx)(X,{type:`search`,ref:l,"aria-label":`Search intros and outros`,"aria-keyshortcuts":bb(u),placeholder:`Search intros and outros`,value:s,className:`w-full min-w-0 sm:w-64`,onChange:e=>c(e.target.value)}),(0,h.jsx)(Iy,{label:`Entry category`,value:e,options:Vb.map(e=>({...e,label:`${e.label}s`})),onChange:t,tip:`library.entry.category`}),(0,h.jsx)(o0,{what:`intros and outros`,sort:p,onSort:g})]}),o.error===null?null:(0,h.jsx)(e0,{what:`intros and outros`,message:o.error.message,onRetry:()=>void o.refetch()}),D===void 0||w===void 0?o.error===null?(0,h.jsx)($1,{label:`Intros and outros`}):null:w.length===0?(0,h.jsx)(aCe,{category:e}):(0,h.jsx)(gG,{className:Z1,list:D.length===0?(0,h.jsx)(`p`,{className:`m-0 py-3 text-small text-ink-2`,children:`No ${e}s match "${s.trim()}".`}):(0,h.jsxs)(W1,{selection:A,children:[(0,h.jsx)(U1,{selection:A,total:D.length,noun:M,scope:T===``?void 0:`Select all ${String(D.length)} shown`,busy:ee.busy,onDuplicate:()=>ee.duplicate(j),onExport:()=>N.exportItems(j),onDelete:()=>ee.remove(j)}),(0,h.jsx)(KL,{label:`${Ub(e)}s`,children:D.map(e=>(0,h.jsx)(qL,{className:Q1,lead:(0,h.jsx)(bG,{selection:A,value:e.id,label:e.name}),title:(0,h.jsx)(U0,{name:e.name,onSelect:()=>f(e.id),onRename:t=>C(e,t)}),meta:iCe(e),selected:e.id===O?.id,actions:(0,h.jsx)(t0,{name:e.name,edit:(0,h.jsx)(GO,{to:`/entries/$entryId`,params:{entryId:e.id},"aria-label":`Edit ${e.name}`,variant:`quiet`,size:`small`,children:`Edit`}),duplicate:(0,h.jsx)(GO,{to:`/entries/new`,search:{category:e.category,from:e.id},"aria-label":`Duplicate ${e.name}`,variant:`quiet`,size:`small`,children:`Duplicate`}),play:{run:n===void 0?void 0:()=>n(e),blocked:r},onHistory:()=>x(e),onDelete:()=>y(e)})},e.id))})]}),detail:O===void 0?null:(0,h.jsx)(v0,{item:`entry`,id:O.id,name:O.name,kicker:`${Ub(O.category)} · ${Wb(O.mode)}`,meta:(0,h.jsxs)(h.Fragment,{children:[`Updated `,(0,h.jsx)(x0,{iso:O.updatedAt})]}),body:O.body,slots:O.slots,actions:(0,h.jsx)(GO,{to:`/entries/$entryId`,params:{entryId:O.id},size:`small`,children:`Edit ${O.category}`}),onOpenHistory:()=>x(O)},O.id)}),S.error===null?null:(0,h.jsx)(fM,{tone:`danger`,title:`The ${e} wasn't deleted.`,className:`mt-4`,children:S.error.message}),b===void 0?null:(0,h.jsx)(m0,{item:`entry`,id:b.id,name:b.name,onClose:()=>x(void 0)},b.id),(0,h.jsx)($v,{open:v!==void 0,title:v===void 0?``:`Delete "${v.name}"?`,consequence:`Moves it to the trash for 30 days (Settings → Trash). Projects that used it keep their text.`,confirmLabel:`Delete ${v?.category??e}`,pending:S.isPending,onConfirm:()=>{v!==void 0&&S.mutate(v.id)},onCancel:()=>y(void 0)})]})}function iCe(e){return(0,h.jsxs)(h.Fragment,{children:[`${Wb(e.mode)} · ${y0(e.slots.length,`keyword`)} · updated `,(0,h.jsx)(x0,{iso:e.updatedAt})]})}function aCe({category:e}){let t=e===`intro`?`before`:`after`;return(0,h.jsx)(aQ,{title:`No ${e}s yet`,children:`An ${e} is narrated ${t} the body in the run's voice.`})}function oCe({name:e,className:t}){return(0,h.jsx)(`span`,{"data-slot-chip":e,className:R(`animate-tick-in rounded-control border border-line-strong bg-sunken px-2 py-0.5 font-mono text-label text-ink-2 motion-reduce:animate-none`,t),children:e})}function W0({slots:e,body:t,lint:n,lintId:r,noSlots:i=`No slots. This prompt runs as written.`}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(U,{title:`Detected slots`,info:`library.slots`,size:`small`,className:`pb-0`}),e.length>0?(0,h.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,h.jsx)(oCe,{name:e,className:`px-2 py-1`},e))}):t.trim()===``?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Slots appear here as you type {{name}}.`}):(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:i}),n.length===0?null:(0,h.jsxs)(`div`,{id:r,className:`flex flex-col gap-2 border-t border-line pt-3`,children:[(0,h.jsx)(`span`,{className:`sl-kicker text-danger`,children:n.length===1?`1 slot error`:`${String(n.length)} slot errors`}),n.map(e=>{let n=cCe(t,e.message);return(0,h.jsxs)(`span`,{className:`flex flex-col items-start gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small text-danger`,children:e.message}),n===void 0?null:(0,h.jsx)(z,{variant:`quiet`,size:`small`,onClick:()=>lCe(r,n),children:`Go to ${sCe(e.message)??`it`}`})]},e.message)})]})]})}var G0=/line (\d+), column (\d+)/;function sCe(e){return G0.exec(e)?.[0]}function cCe(e,t){let n=G0.exec(t);if(n===null)return;let r=e.split(`
|
|
277
277
|
`),i=Number(n[1]),a=Number(n[2]);if(!(i<1||i>r.length))return r.slice(0,i-1).reduce((e,t)=>e+t.length+1,0)+a-1}function lCe(e,t){let n=document.querySelector(`textarea[aria-describedby~="${e}"]`);n instanceof HTMLTextAreaElement&&(n.focus(),n.setSelectionRange(t,Math.min(t+2,n.value.length)))}function K0({className:e,...t}){return(0,h.jsx)(vne,{"data-slot":`label`,className:R(`engraved block select-none text-ink-3`,e),...t})}function q0({className:e,...t}){return(0,h.jsx)(Mne,{"data-slot":`toggle-group`,className:R(`inline-flex w-fit items-stretch overflow-hidden rounded-control border border-line-strong`,e),...t})}function J0({className:e,...t}){return(0,h.jsx)(Lne,{"data-slot":`toggle-group-item`,className:R(`min-h-8 shrink-0 border-r border-line-strong px-3 py-1 text-label text-ink-2 last:border-r-0`,`transition-colors duration-150 ease-out motion-reduce:transition-none hover:bg-raised hover:text-ink`,`data-[state=on]:bg-raised data-[state=on]:text-ink data-[state=on]:shadow-[inset_0_-2px_0_var(--color-accent)]`,`disabled:cursor-not-allowed disabled:opacity-40`,e),...t})}function Y0({label:e,value:t,options:n,describedBy:r,tip:i,onPick:a}){let o=(0,m.useId)();return(0,h.jsxs)(`div`,{...Py,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(K0,{id:o,children:e}),i===void 0?null:(0,h.jsx)(H,{id:i,label:e,className:`-my-1`})]}),(0,h.jsx)(q0,{type:`single`,value:t,"aria-labelledby":o,"aria-describedby":r,onValueChange:e=>{let t=n.find(t=>t.value===e);t!==void 0&&a(t.value)},children:n.map(e=>(0,h.jsx)(J0,{value:e.value,children:e.label},e.value))})]})}function X0(e){return Z0(e.name,e.body)}function uCe(e){return Z0(e.name,e.body)}function Z0(e,t){let n=[],r=e.trim();if(r===``?n.push({field:`name`,message:`Enter a name.`}):r.length>200&&n.push({field:`name`,message:`Keep the name to 200 characters or fewer.`}),t.trim()===``)return n.push({field:`body`,message:`Enter the text.`}),n;if(t.length>1e5)return n.push({field:`body`,message:`The text is too long. Keep it to ${String(Bb)} characters or fewer.`}),n;for(let e of JW(t).errors)n.push({field:`body`,message:dCe(e,t)});return n}function dCe(e,t){let n=fCe(t,e.at);switch(e.kind){case`unclosed`:return`The \`{{\` at ${n} is never closed. Add \`}}\` after the keyword name.`;case`empty`:return`The keyword at ${n} has no name. Write a name between \`{{\` and \`}}\`.`;case`nested`:return`The keyword at ${n} contains a brace. Keywords cannot be placed inside other keywords.`}}function fCe(e,t){let n=e.slice(0,t),r=n.lastIndexOf(`
|