1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9964],{32697:(e,t,i)=>{"use strict";i.d(t,{A4:()=>r,Ei:()=>o,Ke:()=>l,bx:()=>d,p8:()=>s});let n=/[\u200e\u200f\u202a-\u202e\u2066-\u2069\ufeff]/gu;function a(e){let t=String(e||"").trim().replace(/_/gu,"-");if(t)try{return new Intl.Locale(t).toString()}catch{return}}function r(e,t){let i=String(e??"").normalize("NFKC").replace(n,"").trim(),r=a(t);try{return r?i.toLocaleLowerCase(r):i.toLocaleLowerCase("und")}catch{return i.toLowerCase()}}function o(e,t,i){let n=r(t,i);return!n||r(e,i).includes(n)}function l(e){return"function"==typeof Intl.Segmenter?Array.from(new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e),({segment:e})=>e):Array.from(e)}function s(e,t,i=""){let n=Math.max(0,Math.floor(t)),a=l(String(e||""));return a.length<=n?a.join(""):`${a.slice(0,n).join("")}${i}`}function d(e,t){let i=l(String(e||"")),n=i.shift();if(!n)return"";let r=a(t);try{return`${r?n.toLocaleUpperCase(r):n.toLocaleUpperCase("und")}${i.join("")}`}catch{return`${n.toUpperCase()}${i.join("")}`}}new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"})},42634:()=>{},46291:(e,t,i)=>{"use strict";let n,a,r;i.r(t),i.d(t,{default:()=>t$});var o=i(95155);let l=["<p> cannot contain a nested <div>","In HTML, <div> cannot be a descendant of <p>","cannot appear as a descendant of <p>","validateDOMNesting","This will cause a hydration error","See this log for the ancestor stack trace"],s="u">typeof console,d=RegExp("\\\x1b\\[[0-9;]*m","g");function u(e){for(let t of e)for(let e of function(e){let t=[],i=e=>{"string"==typeof e?t.push(e):e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message&&t.push(e.message)};if(Array.isArray(e))for(let t of e)i(t);else i(e);return t}(t))for(let t of e.split(/\n+/)){let e=function(e){let t=e.replace(d,"").trim();return t.endsWith(".")&&(t=t.slice(0,-1)),t=t.replace(/\s+/g," ")}(t);if(l.some(t=>e.includes(t)))return!0}return!1}if(s&&!window.__SANITY_NESTING_FILTER_INSTALLED__){window.__SANITY_NESTING_FILTER_INSTALLED__=!0;let e=console.error.bind(console),t=console.warn.bind(console);console.error=(...t)=>{u(t)||e(...t)},console.warn=(...e)=>{u(e)||t(...e)}}var c=i(35423),p=i(2362),m=i(91804),f=i(23106),h=i(3776),y=i(62689),g=i(52283),b=i(61365),v=i(27948),w=i(75012),x=i(50333),S=i(12115),I=i(32697),A=i(62730);function k(e){return e&&(0,A.V)(e).replace(/\.[a-z0-9]+$/iu,"")||"Untitled"}let M={name:"jw-cdn-gallery",title:"JW CDN Gallery",component:function(e){let t=(0,f.tH7)({apiVersion:"2024-01-01"}),[i,n]=(0,S.useState)([]),[a,r]=(0,S.useState)(""),[l,s]=(0,S.useState)(!1),[d,u]=(0,S.useState)(null),c=(0,S.useMemo)(()=>(function(e){if("image"===e.assetType)return["imageLibrary"];let t=String(e.accept||"").toLowerCase(),i=t.includes("*/*")||""===t.trim(),n=t.includes("audio/"),a=t.includes("image/");return n&&!a?["audioLibrary"]:a&&!n?["imageLibrary"]:n||a||i?["imageLibrary","audioLibrary"]:[]})(e),[e]),p=(0,S.useCallback)(async()=>{s(!0),u(null);try{let e=await t.fetch("*[_type in $types && archived != true]{_id,_type,_updatedAt,title,imageUrl,audioUrl}",{types:c});n(function(e){let t=[];for(let i of e){let e="audioLibrary"===i._type?i.audioUrl||"":i.imageUrl||"";e&&t.push({id:i._id,type:i._type,title:i.title||"",url:e,updatedAt:i._updatedAt})}return t.sort((e,t)=>{let i=e.updatedAt?Date.parse(e.updatedAt):0;return(t.updatedAt?Date.parse(t.updatedAt):0)-i}),t}(e))}catch(e){u((e&&"object"==typeof e&&"message"in e?String(e.message||""):"")||"Failed to load JW CDN assets.")}finally{s(!1)}},[t,c]);(0,S.useEffect)(()=>{p()},[p]);let m=(0,S.useMemo)(()=>{let e=a.trim();return e?i.filter(t=>{let i=t.title.trim()||k(t.url);return(0,I.Ei)([i,t.url,t.id].join(" "),e)}):i},[i,a]),h=(0,S.useCallback)(t=>{e.onSelect([{kind:"url",value:t.url}]),e.onClose()},[e]);return(0,o.jsx)(w.R,{padding:4,radius:2,tone:"transparent",children:(0,o.jsxs)(w.p,{space:3,children:[(0,o.jsx)(w.U,{size:2,weight:"semibold",children:"JW CDN Gallery"}),(0,o.jsx)(w.U,{size:1,muted:!0,children:"Select from JW CDN image/audio library records and insert by URL."}),(0,o.jsxs)(w.H,{align:"center",gap:2,children:[(0,o.jsx)(w.f,{dir:"auto",value:a,onChange:e=>r(e.currentTarget.value),placeholder:"Search title or URL"}),(0,o.jsx)(w.z,{text:"Refresh",mode:"ghost",onClick:()=>void p()})]}),d?(0,o.jsx)(w.R,{padding:2,radius:2,tone:"critical",children:(0,o.jsx)(w.U,{size:1,children:d})}):null,l?(0,o.jsx)(w.U,{size:1,muted:!0,children:"Loading assets..."}):0===m.length?(0,o.jsx)(w.U,{size:1,muted:!0,children:"No matching JW CDN assets."}):(0,o.jsx)(w.p,{space:2,style:{maxHeight:420,overflow:"auto"},children:m.map(e=>{let t=e.title.trim()||k(e.url),i=function(e){if(!e)return"";let t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"2-digit"}).format(new Date(t)):""}(e.updatedAt);return(0,o.jsx)(w.R,{padding:2,radius:2,tone:"transparent",children:(0,o.jsxs)(w.p,{space:2,children:[(0,o.jsxs)(w.H,{align:"center",justify:"space-between",gap:2,children:[(0,o.jsx)(w.U,{size:1,weight:"semibold",dir:"auto",style:{overflowWrap:"anywhere"},children:t}),(0,o.jsxs)(w.H,{align:"center",gap:2,children:[(0,o.jsx)(x.Ex,{children:"audioLibrary"===e.type?"Audio":"Image"}),i?(0,o.jsx)(x.Ex,{children:i}):null]})]}),"imageLibrary"===e.type?(0,o.jsx)(w.W,{style:{border:"1px solid var(--card-border-color)",borderRadius:8,height:110,backgroundImage:`url(${e.url})`,backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"contain"}}):(0,o.jsx)("audio",{controls:!0,preload:"none",src:e.url,style:{width:"100%"}}),(0,o.jsx)(w.U,{size:1,muted:!0,dir:"ltr",style:{overflowWrap:"anywhere"},children:(0,A.e)(e.url)}),(0,o.jsx)(w.H,{justify:"flex-end",children:(0,o.jsx)(w.z,{text:"Use Asset",tone
1:"primary",onClick:()=>h(e)})})]})},e.id)})}),(0,o.jsx)(w.H,{justify:"flex-end",gap:2,children:(0,o.jsx)(w.z,{text:"Cancel",mode:"ghost",onClick:e.onClose})})]})})},icon:v.sYc};function C(){return(0,o.jsx)("div",{style:{display:"grid",placeItems:"center",width:"100%",height:"100%"},children:(0,o.jsx)("img",{src:"/assets/icons/logo/logoDark.svg",alt:"JWPUBS⢠Studio Logo",style:{display:"block",width:"100%",height:"100%",maxWidth:28,maxHeight:28,objectFit:"contain"}})})}var T=i(77946),U=i(4137),j=i(86685),D=i(24881),O=i(62670),L=i(32006),_=i(74961);function N(e,t=96){let i=String(e||"").normalize("NFKC").toLocaleLowerCase("und").replace(/[\u200e\u200f\u202a-\u202e\u2066-\u2069\ufeff]/gu,"").replace(/[â'`\u201c\u201d\u2033]/gu,"").replace(/[^\p{L}\p{M}\p{N}]+/gu,"-").replace(/^-+|-+$/gu,"");return(0,I.p8)(i,t).replace(/^-+|-+$/gu,"").normalize("NFC")}var E=i(30764);async function $(e){let t=new E.I;for(let i=0;i<e.size;i+=4194304){let n=await e.slice(i,Math.min(e.size,i+4194304)).arrayBuffer();t.update(new Uint8Array(n))}let i=await t.digest(),n="";for(let e of i)n+=String.fromCharCode(e);return btoa(n)}async function P(e,t){let i=await $(e);if(!("image/svg+xml"===t.toLowerCase()||e.name.toLowerCase().endsWith(".svg")))return{fileSize:e.size,checksumSha256:i};let n=new Uint8Array(await e.arrayBuffer());return{fileSize:e.size,checksumSha256:i,svgSourceBase64:function(e){let t="";for(let i=0;i<e.length;i+=32768)t+=String.fromCharCode(...e.subarray(i,i+32768));return btoa(t)}(n)}}async function R(e,t){let i=t.requiredHeaders["Content-Type"]||t.requiredHeaders["content-type"]||e.type||"application/octet-stream",n=t.uploadBodyBase64?new Blob([function(e){let t=atob(e),i=new ArrayBuffer(t.length),n=new Uint8Array(i);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return i}(t.uploadBodyBase64)],{type:i}):e;if(!Number.isSafeInteger(t.contentLength)||t.contentLength!==n.size)throw Error("Upload body does not match the signed content length.");return fetch(t.uploadUrl,{method:"PUT",headers:t.requiredHeaders,body:n})}var F=i(41463);let q={"Content-Type":"application/json","X-JWPUBS-API-Request":"1","X-S3Uploader-Studio":"1"},W="media.tag",Y={aac:"audio/aac",avif:"image/avif",flac:"audio/flac",gif:"image/gif",heic:"image/heic",heif:"image/heif",jpeg:"image/jpeg",jpg:"image/jpeg",m4a:"audio/mp4",mp3:"audio/mpeg",oga:"audio/ogg",ogg:"audio/ogg",opus:"audio/opus",png:"image/png",svg:"image/svg+xml",wav:"audio/wav",weba:"audio/webm",webp:"image/webp"};function V(){let e="abcdefghijklmnopqrstuvwxyz0123456789",t="";for(let i=0;i<8;i++)t+=e.charAt(Math.floor(Math.random()*e.length));return t}async function z(e){let t=`${Date.now().toString(36)}${V()}`;try{if("u"<typeof globalThis||!globalThis.crypto?.subtle||"function"!=typeof e.arrayBuffer)return t;let n=await e.arrayBuffer();var i=await globalThis.crypto.subtle.digest("SHA-1",n);let a=new Uint8Array(i),r="";for(let e of a)r+=e.toString(16).padStart(2,"0");return r}catch{return t}}function B(e,t){let i=Math.floor(Number(e||0)),n=Math.floor(Number(t||0));return i>0&&n>0?{width:i,height:n,aspectRatio:i/n}:null}function H(e,t,i=0){if(e.length<i+t.length)return!1;for(let n=0;n<t.length;n++)if((e[i+n]??-1)!==t[n])return!1;return!0}function J(e,t){return e[t]??0}async function G(e){try{if("function"!=typeof e.arrayBuffer)return null;let t=new Uint8Array(await e.arrayBuffer());return function(e,t){let i=String(t||"").toLowerCase();if(i.includes("png")||H(e,[137,80,78,71])){if(!H(e,[137,80,78,71,13,10,26,10])||e.length<24)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return B(t.getUint32(16),t.getUint32(20))}if(i.includes("jpeg")||i.includes("jpg")||H(e,[255,216])){if(!H(e,[255,216]))return null;let t=2;for(;t+9<e.length;){if(255!==J(e,t)){t+=1;continue}for(;t<e.length&&255===J(e,t);)t+=1;if(t>=e.length)break;let i=J(e,t);if(t+=1,217===i||218===i||t+1>=e.length)break;let n=J(e,t)<<8|J(e,t+1);if(n<2||t+n>e.length)break;if((i>=192&&i<=195||i>=197&&i<=199||i>=201&&i<=203||i>=205&&i<=207)&&n>=7){let i=J(e,t+3)<<8|J(e,t+4);return B(J(e,t+5)<<8|J(e,t+6),i)}t+=n}return null}if(i.includes("gif")||H(e,[71,73,70,56])){if(e.length<10||!(H(e,[71,73,70,56,55,97])||H(e,[71,73,70,56,57,97])))return null;let t=J(e,6)|J(e,7)<<8;return B(t,J(e,8)|J(e,9)<<8)}if(i.includes("webp")||H(e,[82,73,70,70])&&H(e,[87,69,66,80],8))return function(e){if(e.length<30||
1!H(e,[82,73,70,70],0)||!H(e,[87,69,66,80],8))return null;let t=String.fromCharCode(J(e,12),J(e,13),J(e,14),J(e,15));if("VP8X"===t){let t=1+J(e,24)+(J(e,25)<<8)+(J(e,26)<<16);return B(t,1+J(e,27)+(J(e,28)<<8)+(J(e,29)<<16))}if("VP8 "===t&&e.length>=30){if(157===J(e,23)&&1===J(e,24)&&42===J(e,25)){let t=(J(e,26)|J(e,27)<<8)&16383;return B(t,(J(e,28)|J(e,29)<<8)&16383)}return null}if("VP8L"===t&&e.length>=25&&47===J(e,20)){let t=J(e,21),i=J(e,22),n=J(e,23),a=J(e,24);return B(1+(t|(63&i)<<8),1+((192&i)>>6|n<<2|(15&a)<<10))}return null}(e);if(i.includes("bmp")||H(e,[66,77])){if(e.length<26||!H(e,[66,77]))return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=t.getInt32(18,!0);return B(i,Math.abs(t.getInt32(22,!0)))}return i.includes("svg")||60===J(e,0)?function(e){if("u"<typeof TextDecoder)return null;try{let t=new TextDecoder().decode(e.slice(0,8192));if(!/<svg[\s>]/i.test(t))return null;let i=t.match(/\bwidth\s*=\s*["']\s*([0-9.]+)(?:px)?\s*["']/i),n=t.match(/\bheight\s*=\s*["']\s*([0-9.]+)(?:px)?\s*["']/i);if(i?.[1]&&n?.[1]){let e=B(Number.parseFloat(i[1]),Number.parseFloat(n[1]));if(e)return e}let a=t.match(/\bviewBox\s*=\s*["']\s*([-+0-9.eE]+)[\s,]+([-+0-9.eE]+)[\s,]+([-+0-9.eE]+)[\s,]+([-+0-9.eE]+)\s*["']/i);if(a?.[3]&&a?.[4])return B(Number.parseFloat(a[3]),Number.parseFloat(a[4]))}catch{}return null}(e):null}(t,String(e.type||""))}catch{return null}}async function K(e,t){let i,n=(0,_.GA)(e.name||`${V()}.bin`),a=(i=String(n||"").toLowerCase().match(/\.([a-z0-9]+)$/i),i?.[1]||""),r=function(e,t,i){let n=String(e.type||"").trim().toLowerCase();if(n)return n;let a=Y[i]||"";return a||("image"===t?"image/*":"audio/*")}(e,t,a),o=Number(e.size||0);return{originalFilename:n,extension:a,mimeType:r,size:o,sha1hash:await z(e),dimensions:"image"===t?await G(e):null}}function Z(e){return`${e.name}::${e.size}::${e.lastModified}`}function X(e){return e.trim().replace(/\s+/g," ")}function Q(e){return N(e,64)||`tag-${V()}`}function ee(e){return e.replace(/\.[a-z0-9]+$/i,"").trim()}function et(e){return e&&"object"==typeof e&&"message"in e?String(e.message||"Upload failed"):"Upload failed"}function ei(e){let t=String(e.type||"").toLowerCase(),i=String(e.name||"").toLowerCase();return"image/svg+xml"===t||i.endsWith(".svg")?null:t.startsWith("image/")?"image":t.startsWith("audio/")?"audio":/\.(png|jpe?g|gif|webp|avif|heic|heif)$/i.test(i)?"image":/\.(mp3|m4a|aac|wav|ogg|oga|flac|opus|weba)$/i.test(i)?"audio":null}function en(e){let t=ei(e);return"image"===t?{kind:t,fileType:"p",domain:"cms",destination:"Image Gallery"}:"audio"===t?{kind:t,fileType:"a",domain:"cfp",destination:"Audio Gallery"}:null}function ea(){let e=(0,f.tH7)({apiVersion:"2024-01-01"}),t=(0,x.dj)(),i=(0,S.useRef)(null),n=(0,S.useRef)(0),[a,r]=(0,S.useState)([]),[l,s]=(0,S.useState)({}),[d,u]=(0,S.useState)(""),[c,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(!1),[y,g]=(0,S.useState)(null),[b,A]=(0,S.useState)(null),k=void 0!==F?F.env.SANITY_STUDIO_API_BASE_URL:void 0,M=void 0!==F?"https://www.jwpubs.org":void 0,C=(k||"").replace(/\/$/,""),T=(M||"").replace(/\/$/,"");if(!C){let e=window.location.hostname||"";/\.sanity\.studio$/.test(e)&&(C=T)}let U=(0,S.useCallback)(e=>C?`${C}${e}`:e,[C]),j=(0,S.useMemo)(()=>(function(e){let t=new Set,i=[];for(let n of e.split(/[\n,]+/g)){let e=X(n);if(!e)continue;let a=(0,I.A4)(e);t.has(a)||(t.add(a),i.push((0,I.p8)(e,60)))}return i})(d),[d]),D=(0,S.useCallback)(e=>{let t=e?.types;return!!t&&Array.prototype.indexOf.call(t,"Files")>=0},[]),O=(0,S.useCallback)(e=>{let i=Array.from(e||[]);if(0===i.length)return;let n=i.filter(e=>!!en(e));n.length!==i.length&&t.push({closable:!0,status:"warning",title:"Only image and audio files can be added to this queue."}),r(e=>{let t=new Set(e.map(e=>Z(e))),i=[...e];for(let e of n){let n=Z(e);t.has(n)||(t.add(n),i.push(e))}return i}),s(e=>{let t=!1,i={...e};for(let e of n){let n=Z(e);
1Object.prototype.hasOwnProperty.call(i,n)||(i[n]=ee(e.name),t=!0)}return t?i:e})},[t]),L=(0,S.useCallback)(()=>{i.current?.click()},[]),_=(0,S.useCallback)(e=>{O(e.currentTarget.files),e.currentTarget.value=""},[O]),N=(0,S.useCallback)(e=>{r(t=>t.filter(t=>Z(t)!==e)),s(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let i={...t};return delete i[e],i})},[]),E=(0,S.useCallback)(()=>{r([]),s({})},[]),$=(0,S.useCallback)((e,t)=>{A({type:"single",signature:e,name:t})},[]),Y=(0,S.useCallback)(()=>{0!==a.length&&A({type:"all",count:a.length})},[a.length]),z=(0,S.useCallback)(()=>{b&&("single"===b.type?N(b.signature):E(),A(null))},[b,N,E]),B=(0,S.useCallback)((e,t)=>{s(i=>({...i,[e]:t.slice(0,120)}))},[]),H=(0,S.useCallback)(async(e,t,i)=>{let n=V(),a=i.originalFilename,r=String(e.type||"").trim()||i.mimeType||"application/octet-stream",o=`f/${n}/${t.fileType}/1/${a}`,l=await P(e,r),s=await fetch(U("/api/cdn/"),{method:"POST",headers:q,body:JSON.stringify({filename:a,contentType:r,...l,customKey:o})});if(!s.ok){let e=await s.text().catch(()=>""),t=`${s.status}${s.statusText?` ${s.statusText}`:""}`;throw Error(e?`Failed to request upload URL (${t}) - ${e}`:`Failed to request upload URL (${t})`)}let d=await s.json();if(!d.uploadUrl||!d.requiredHeaders)throw Error("Missing presigned upload URL.");let u=await R(e,d);if(!u.ok){let e=await u.text().catch(()=>""),t=`${u.status}${u.statusText?` ${u.statusText}`:""}`;throw Error(e?`Upload failed (${t}) - ${e}`:`Upload failed (${t})`)}return`https://${t.domain}.jwcdn.org/f/${n}/${t.fileType}/1/${encodeURIComponent(a)}`},[U]),J=(0,S.useCallback)(async e=>{try{await fetch(U("/api/cdn/delete/"),{method:"POST",headers:q,body:JSON.stringify({url:e})})}catch{}},[U]),G=(0,S.useCallback)(async t=>{if(0===t.length)return[];let i=[];for(let n of t){let t=(0,I.p8)(X(n),60),a=Q(t),r=await e.fetch("*[_type == $type && (name.current == $exact || name.current == $slug)][0]{_id}",{type:W,exact:t,slug:a});if(r?._id){i.push(r._id);continue}try{let n=await e.create({_type:W,name:{_type:"slug",current:t}});n?._id&&i.push(n._id)}catch{try{let t=await e.create({_type:W,name:{_type:"slug",current:a}});if(t?._id){i.push(t._id);continue}}catch{}let n=await e.fetch("*[_type == $type && (name.current == $exact || name.current == $slug)][0]{_id}",{type:W,exact:t,slug:a});n?._id&&i.push(n._id)}}return Array.from(new Set(i))},[e]),ea=(0,S.useCallback)(async()=>{if(c||0===a.length)return;let i=a.map(e=>{let t=en(e);return t?{file:e,target:t}:null}).filter(e=>!!e);if(0===i.length)return void t.push({closable:!0,status:"warning",title:"No valid image or audio files found in the queue."});p(!0),g(null);let n=[];if(j.length>0)try{if(n=await G(j),0===n.length){p(!1),g(null),t.push({closable:!0,status:"error",title:"Failed to create or find Media Browser tags. Upload cancelled."});return}}catch(e){p(!1),g(null),t.push({closable:!0,status:"error",title:`Failed to prepare media tags: ${et(e)}. Upload cancelled.`});return}let o=new Set,d=[];for(let t=0;t<i.length;t++){let a=i[t];if(!a)continue;let{file:r,target:s}=a;g({current:t+1,total:i.length,name:r.name});let u=null;try{let t=await K(r,s.kind);u=await H(r,s,t);let i={dimensions:t.dimensions,exif:null,isOpaque:null},a=(l[Z(r)]||"").trim()||ee(r.name),o=j.length>0?j.map(e=>(function(e){let t=(0,I.p8)(X(e),60),i=Q(t);return{_key:`tag-${V()}`,_type:"tag",label:t,value:i}})(e)):null,d=n.length>0?n.map(e=>({_key:`${V()}${Date.now().toString(36)}`.slice(0,16),_ref:e,_type:"reference",_weak:!0})):null;if("image"===s.kind){let n={_type:"imageLibrary",imageUrl:u,originalFilename:t.originalFilename,extension:t.extension,mimeType:t.mimeType,size:t.size,sha1hash:t.sha1hash,metadata:i,...t.dimensions?{width:t.dimensions.width,height:t.dimensions.height,aspectRatio:t.dimensions.aspectRatio}:{}};a&&(n.title=a),o&&(n.tags=o),d&&(n.opt={media:{tags:d}}),await e.create(n)}else{let n={_type:"audioLibrary",audioUrl:u,originalFilename:t.originalFilename,extension:t.extension,mimeType:t.mimeType,size:t.size,sha1hash:t.sha1hash,metadata:i};a&&(n.title=a),o&&(n.tags=o),d&&(n.opt={media:{tags:d}}),await e.create(n)}}catch(e){u&&await J(u),o.add(Z(r)),d.push(`${r.name}: ${et(e)}`)}}if(g(null),p(!1),o.size>0){r(e=>e.filter(e=>o.has(Z(e)))),s(e=>{let t={};for(let i of o)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]||"");return t});let e=i.length-o.size,n=d.slice(0,2).join(" | ");t.push({closable:!0,status:"warning",title:`${e} uploaded, ${o.size} failed. Failed files remain in queue.`,description:n||void 0})}else E(),t.push({closable:!0,status:"success",title:`Uploaded ${i.length} file${1===i.length?"":"s"} successfully.`})},[l,c,E,J,e,a,j,H,G,t]);return(0,o.jsxs)(w.p,{space:4,children:[(0,o.jsx)(w.R,{padding:4,radius:2,tone:"transparent",children:(0,o.jsxs)(w.p,{space:3,children:[(0,o.jsx)(w.U,{size:2,weight:"semibold",children:"Bulk Upload Media to Galleries"}),(0,o.jsx)(w.U,{size:1,muted:!0,children:"Upload mixed image and audio files to JW CDN and automatically save each file to the correct gallery."}),(0,o.jsx)(w.R,{padding:2,radius:2,tone:"transparent",children:(0,o.jsx)(w.U,{size:1,muted:!0,children:"Image files appear in Content > Image Gallery. Audio files appear in Content > Audio Gallery."})}),(0,o.jsx)(w.R,{padding:2,radius:2,tone:"transparent",children:(0,o.jsxs)(w.p,{space:2,children:[(0,o.jsx)(w.U,{size:1,muted:!0,children:"Bulk tags (optional) are applied to every uploaded file and are also attached to Media Browser tags."}),(0,o.jsx)(w.f,{dir:"auto",value:d,onChange:e=>u(e.currentTarget.value),placeholder:"Enter tags separated by commas (for example: add
1on, hero, promo)",disabled:c,"aria-label":"Bulk tags"}),j.length>0?(0,o.jsxs)(w.U,{size:1,muted:!0,style:{overflowWrap:"anywhere"},children:["Applying tags: ",j.join(", ")]}):null]})}),(0,o.jsx)(w.R,{padding:3,radius:2,tone:"transparent",className:`media-bulk-dropzone${m?" is-dragging":""}${c?" is-busy":""}`,onDragEnter:e=>{!c&&D(e.dataTransfer)&&(e.preventDefault(),n.current+=1,h(!0))},onDragOver:e=>{!c&&D(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",h(!0))},onDragLeave:e=>{D(e.dataTransfer)&&(e.preventDefault(),n.current=Math.max(0,n.current-1),0===n.current&&h(!1))},onDrop:e=>{e.preventDefault(),n.current=0,h(!1),c||O(e.dataTransfer.files)},tabIndex:0,"aria-label":"Drop image or audio files to queue",children:(0,o.jsxs)(w.H,{align:"center",justify:"space-between",gap:3,children:[(0,o.jsx)(w.U,{size:1,muted:!0,children:m?"Drop image or audio files to queue":"Drag image or audio files here or choose files"}),(0,o.jsx)(w.z,{text:"Select Files",icon:v.JMY,mode:"ghost",onClick:L,disabled:c})]})}),(0,o.jsx)(w.H,{align:"center",gap:2,wrap:"wrap",children:(0,o.jsx)(w.z,{text:y?`Uploading ${y.current}/${y.total}`:`Upload ${a.length} File${1===a.length?"":"s"}`,tone:"primary",onClick:ea,disabled:c||0===a.length})}),y?(0,o.jsxs)(w.U,{size:1,muted:!0,children:["Uploading: ",y.name]}):null]})}),a.length>0?(0,o.jsx)(w.R,{padding:3,radius:2,tone:"transparent",children:(0,o.jsxs)(w.p,{space:2,children:[(0,o.jsxs)(w.H,{align:"center",justify:"space-between",gap:2,children:[(0,o.jsxs)(w.U,{size:1,weight:"semibold",children:["Queue (",a.length,")"]}),(0,o.jsx)(w.z,{icon:v.ucK,text:"Clear Queue",mode:"ghost",tone:"critical",disabled:c||0===a.length,onClick:Y})]}),(0,o.jsx)(w.U,{size:1,muted:!0,children:"You can change each asset title before upload. File names stay unchanged."}),(0,o.jsx)(w.p,{space:1,children:a.map((e,t)=>(0,o.jsx)(w.R,{padding:2,radius:2,children:(0,o.jsxs)(w.p,{space:2,children:[(0,o.jsxs)(w.H,{align:"center",justify:"space-between",gap:2,children:[(0,o.jsx)(w.U,{size:1,style:{overflowWrap:"anywhere"},children:e.name}),(0,o.jsxs)(w.H,{align:"center",gap:2,children:[(0,o.jsx)(x.Ex,{children:"audio"===ei(e)?"Audio":"Image"}),(0,o.jsx)(x.Ex,{children:function(e){if(!Number.isFinite(e)||e<0)return"--";if(0===e)return"0 B";let t=["B","KB","MB","GB","TB","PB"],i=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),n=e/1024**i,a=0===i||n>=100?0:n>=10?1:2,r=new Intl.NumberFormat("en-US",{minimumFractionDigits:a,maximumFractionDigits:a}).format(n);return`${r} ${t[i]}`}(e.size)}),(0,o.jsx)(w.z,{icon:v.ucK,mode:"bleed",tone:"critical",disabled:c,"aria-label":`Remove ${e.name} from queue`,onClick:()=>{$(Z(e),e.name)}})]})]}),(0,o.jsx)(w.f,{dir:"auto",value:l[Z(e)]||"",onChange:t=>B(Z(e),t.currentTarget.value),readOnly:c,placeholder:"Asset title","aria-label":`Title for ${e.name}`})]})},`${Z(e)}-${t}`))})]})}):null,b?(0,o.jsx)(x.lG,{id:"media-queue-delete-confirmation",header:"all"===b.type?"Clear entire queue?":"Remove file from queue?",onClose:()=>A(null),width:1,children:(0,o.jsx)(w.W,{padding:4,children:(0,o.jsxs)(w.p,{space:4,children:[(0,o.jsx)(w.U,{children:"all"===b.type?`Remove all ${b.count} queued file${1===b.count?"":"s"}
1?`:`Remove ${b.name} from the queue?`}),(0,o.jsxs)(w.H,{align:"center",justify:"flex-end",gap:2,children:[(0,o.jsx)(w.z,{text:"Cancel",mode:"ghost",onClick:()=>A(null)}),(0,o.jsx)(w.z,{text:"Delete",tone:"critical",onClick:z})]})]})})}):null,(0,o.jsx)("input",{ref:i,type:"file",accept:"image/*,audio/*",multiple:!0,onChange:_,disabled:c,hidden:!0,"aria-hidden":!0}),(0,o.jsx)("style",{children:` 2 .media-bulk-dropzone { 3 border: 1px dashed #6d6d6d; 4 transition: background-color 120ms ease, border-color 120ms ease; 5 } 6 .media-bulk-dropzone.is-dragging { 7 background: #1a2123; 8 border-color: #99a9ae; 9 } 10 .media-bulk-dropzone.is-busy { 11 opacity: 0.75; 12 } 13 `})]})}let er="v2025-02-19",eo=e=>`drafts.${e.replace(/^drafts\./,"")}`;async function el(e,t){let i=t.archivedAt||new Date().toISOString(),n=eo(t.documentId),a=t.documentId.replace(/^drafts\./,""),r=(({documentId:e,documentType:t,draft:i,published:n,archivedAt:a})=>{let r={...i||n||{}};return delete r._rev,delete r._createdAt,delete r._updatedAt,delete r._originalId,{...r,_id:eo(e),_type:t,archived:!0,archivedAt:a}})({...t,archivedAt:i});await e.transaction().createIfNotExists(r).patch(n,{set:{archived:!0,archivedAt:i}}).commit(),t.published&&await e.action({actionType:"sanity.action.document.unpublish",draftId:n,publishedId:a})}let es={"Content-Type":"application/json","X-JWPUBS-API-Request":"1","X-S3Uploader-Studio":"1"};async function ed(e){let t=await e.text().catch(()=>"");if(!t)return"";try{let e=JSON.parse(t),i=e.detail||e.error;return"string"==typeof i?i:""}catch{return t.slice(0,300)}}async function eu(e,t){let i=await fetch(e,{method:"POST",headers:es,body:JSON.stringify({capability:t})});if(i.ok)return;let n=await ed(i);throw Error(`CDN delete failed (${i.status})${n?`: ${n}`:""}`)}async function ec(e,t){let i=await fetch(e,{method:"POST",headers:es,body:JSON.stringify(t)});if(!i.ok){let e=await ed(i);throw Error(`CDN delete authorization failed (${i.status})${e?`: ${e}`:""}`)}let n=await i.json();if(!Array.isArray(n.capabilities))throw Error("CDN delete authorization returned no capabilities.");let a=n.capabilities.filter(e=>"string"==typeof e?.url&&"string"==typeof e?.capability&&!!e.capability);if(a.length!==t.items.length)throw Error("CDN delete authorization response was incomplete.");return a}async function ep(e,t){return(await Promise.allSettled(t.map(({capability:t})=>eu(e,t)))).filter(e=>"rejected"===e.status).length}async function em(e,t,i=8){let n;for(let a=1;a<=i;a+=1)try{await eu(e,t);return}catch(t){n=t;let e=t&&"object"==typeof t&&"message"in t?String(t.message||""):"";if(!/\(409\)/u.test(e)||a===i)throw t;await new Promise(e=>setTimeout(e,750))}throw n}let ef=new Set(["cms.jwcdn.org","cfp.jwcdn.org","cfs.jwcdn.org","be.jwcdn.org"]);function eh(e){return JSON.stringify({exclusive:e.exclusiveAssets.map(e=>e.key).sort(),shared:e.sharedAssets.map(e=>({key:e.key,documentIds:e.referencedBy.map(e=>e.id).sort()})).sort((e,t)=>e.key.localeCompare(t.key))})}let ey=/https:\/\/(?:cms|cfp|cfs|be)\.jwcdn\.org\/[^\s<>"']+/giu;function eg(e){return e.startsWith("drafts.")?e.slice(7):e}function eb(e){try{let t=new URL(e);if("https:"!==t.protocol||!ef.has(t.host.toLowerCase()))return null;let i=t.pathname.replace(/^\/+/,"");try{i=decodeURIComponent(i)}catch{}if(!i)return null;return{key:i,url:`${t.protocol}//${t.host}${t.pathname}${t.search}`}}catch{return null}}function ev(e){let t=new Map;return!function e(t,i,n){if("string"==typeof t)return void function(e,t){let i=eb(e);if(i)return t.set(i.key,i);for(let i of e.matchAll(ey)){let e=eb(i[0]);e&&t.set(e.key,e)}}(t,i);if(!(!t||"object"!=typeof t||n.has(t))){if(n.add(t),Array.isArray(t)){for(let a of t)e(a,i,n);return}for(let a of Object.values(t))e(a,i,n)}}(e,t,new WeakSet),Array.from(t.values())}function ew(e){return"string"==typeof e.title&&e.title.trim()?e.title.trim():"string"==typeof e.name&&e.name.trim()?e.name.trim():e._id}function ex(e,t){let i=new Set(e.map(e=>eg(e._id))),n=new Map;for(let t of e)for(let e of ev(t))n.set(e.key,e);let a=function(e){let t=new Map;for(let i of e){if(!i?._id)continue;let e=eg(i._id),n=t.get(e)||{info:{id:e,type:i._type||"document",title:ew(i)},assetKeys:new Set};for(let t of(i._id.startsWith("drafts.")&&(n.info={id:e,type:i._type||n.info.type,title:ew(i)}),ev(i)))n.assetKeys.add(t.key);t.set(e,n)}return t}(t.filter(e=>!i.has(eg(e._id)))),r=new Map;for(let{info:e,assetKeys:t}of a.values())for(let i of t){if(!n.has(i))continue;let t=r.get(i)||[];t.push(e),r.set(i,t)}let o=[],l=[],s=new Map;for(let e of n.values()){let t=(r.get(e.key)||[]).sort((e,t)=>
13e.title.localeCompare(t.title)),i={...e,referencedBy:t};if(0===t.length){o.push(i);continue}for(let e of(l.push(i),t))s.set(e.id,e)}return{exclusiveAssets:o,sharedAssets:l,affectedDocuments:Array.from(s.values()).sort((e,t)=>e.title.localeCompare(t.title))}}var eS=i(41463);function eI(e){let t=void 0!==eS?eS.env.SANITY_STUDIO_API_BASE_URL:void 0,i=void 0!==eS?"https://www.jwpubs.org":void 0,n=(t||"").replace(/\/$/,"");return!n&&/\.sanity\.studio$/u.test(window.location.hostname||"")&&(n=(i||"").replace(/\/$/,"")),n?`${n}${e}`:e}let eA='*[!(_id in path("_.**"))]{...}';function ek(e,t){if(e&&"object"==typeof e&&"message"in e){let t=String(e.message||"");if(t)return t}return t}let eM=e=>{let{draft:t,published:i,id:n}=e,a=(0,f.tH7)({apiVersion:"2024-01-01"}),r=(0,x.dj)(),l=t||i,s=[t,i].filter(e=>!!e),[d,u]=(0,S.useState)("idle"),[c,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(null),[y,g]=(0,S.useState)(!1),[b,I]=(0,S.useState)(null),A="analyzing"===d||"deleting-media"===d||"deleting-doc"===d,k=async()=>{p(!0),u("analyzing"),h(null),g(!1),I(null);try{let e=await a.fetch(eA);h(ex(s,e))}catch(e){I(`Could not check whether the linked files are used elsewhere. ${ek(e,"Reference check failed.")}`)}finally{u("ready")}},M=async()=>{let t;if(!m||A)return;I(null),u("analyzing");try{let e=await a.fetch(eA);t=ex(s,e)}catch(e){I("The final reference check failed, so nothing was deleted. "+ek(e,"Reference check failed.")),u("ready");return}if(eh(t)!==eh(m)){h(t),g(!1),I("File references changed while this dialog was open. Review the updated warning, then click Delete Permanently again."),u("ready");return}let i=[...t.exclusiveAssets,...y?t.sharedAssets:[]];u("deleting-media");let o=[];try{i.length>0&&(o=await ec(eI("/api/cdn/delete/authorize/"),{operation:"document-cleanup",allowShared:y,items:i.map(e=>({url:e.url,documentIds:[eg(n)]}))}))}catch(e){I(`The server could not authorize the linked CDN cleanup, so nothing was deleted. ${ek(e,"Authorization failed.")}`),u("ready");return}u("deleting-doc");let l=eg(n);try{await a.transaction().delete(l).delete(`drafts.${l}`).commit(),u("deleting-media");let t=await ep(eI("/api/cdn/delete/"),o);t>0&&r.push({status:"warning",title:"Document deleted; CDN cleanup incomplete",description:`${t} linked file${1===t?" was":"s were"} retained safely because the final server-side reference check or object removal failed.`}),p(!1),u("idle"),e.onComplete()}catch(e){I(`The linked files were processed, but the Sanity document could not be deleted. ${ek(e,"Document deletion failed.")}`),u("ready")}},C=m?.sharedAssets.length||0,T=m?.affectedDocuments||[],U=m?.exclusiveAssets.length||0,j=U+C,D=(0,o.jsxs)(w.p,{paddingX:3,space:4,children:[(0,o.jsxs)(w.U,{children:["Are you sure you want to permanently delete"," ",(0,o.jsx)("strong",{children:function(e){if(!e)return"this document";let t=e.title;return"string"==typeof t&&t.trim()?t.trim():e._id||"this document"}(l)}),"?"]}),"analyzing"===d?(0,o.jsx)(w.U,{size:1,muted:!0,children:"Checking linked JW CDN files and other Sanity documentsâ¦"}):null,m?(0,o.jsxs)(w.p,{space:3,children:[j>0?(0,o.jsx)(w.U,{size:1,children:U>0?`${U} file${1===U?"":"s"} used only by this document will be deleted.`:"This document has no exclusive JW CDN files."}):(0,o.jsx)(w.U,{size:1,children:"No linked JW CDN files were found."}),C>0?(0,o.jsx)(w.R,{padding:3,radius:2,tone:"caution",children:(0,o.jsxs)(w.p,{space:3,children:[(0,o.jsxs)(w.U,{weight:"semibold",children:[C," linked file",1===C?" is":"s are"," also used by"," ",T.length," other document",1===T.length?"":"s","."]}),(0,o.jsxs)(w.p,{space:2,children:[T.slice(0,8).map(e=>(0,o.jsxs)(w.U,{size:1,children:["⢠",e.title," (",e.type,")"]},e.id)),T.length>8?(0,o.jsxs)(w.U,{size:1,muted:!0,children:["â¦and ",T.length-8," more"]}):null]}),(0,o.jsxs)(w.H,{align:"center",gap:2,children:[(0,o.jsx)(x.Sc,{id:`delete-shared-cdn-files-${n}`,checked:y,onChange:e=>g(e.currentTarget.checked),disabled:A}),(0,o.jsx)(w.U,{size:1,children:"Delete shared files too (the documents above will have broken file links)"})]}),y?null:(0,o.jsx)(w.U,{size:1,muted:!0,children:"Shared files will be kept by default."})]})}):null]}):null,b?(0,o.jsx)(w.R,{padding:3,radius:2,tone:"critical",children:(0,o.jsx)(w.U,{size:1,children:b})}):null,(0,o.jsx)(w.U,{size:1,children:"Archiving or unpublishing does not delete CDN files. Permanent deleti
13on cannot be undone."})]}),O=(0,o.jsxs)(w.H,{gap:3,justify:"flex-end",children:[(0,o.jsx)(w.z,{text:"Cancel",mode:"ghost",onClick:()=>{A||(p(!1),u("idle"))},disabled:A}),m||"ready"!==d?null:(0,o.jsx)(w.z,{text:"Retry Check",onClick:()=>void k()}),(0,o.jsx)(w.z,{text:"analyzing"===d?"Checkingâ¦":"deleting-media"===d?"Removing Filesâ¦":"deleting-doc"===d?"Deleting Documentâ¦":"Delete Permanently",tone:"critical",onClick:()=>void M(),disabled:A||!m})]});return{label:"analyzing"===d?"Checking filesâ¦":"deleting-media"===d?"Removing filesâ¦":"deleting-doc"===d?"Deletingâ¦":"Delete",icon:v.ucK,tone:"critical",disabled:A,dialog:c?{type:"dialog",header:"Delete document?",content:D,footer:O,onClose:()=>{A||(p(!1),u("idle"))}}:void 0,onHandle:()=>void k()}},eC=e=>{let{unpublish:t}=(0,f.QSs)(e.id,e.type),i=(0,f.tH7)({apiVersion:"2024-01-01"});return e.published?{label:"Unpublish",tone:"critical",icon:v.wvk,onHandle:async()=>{if(!e.draft&&e.published){let t=e.published,n=e.id.startsWith("drafts.")?e.id:`drafts.${e.id}`,a={...t};delete a._rev,await i.createOrReplace({...a,_id:n,_type:e.type})}t.execute(),e.onComplete()}}:null},eT="#344446",eU="#39d25f",ej="#ffd90d",eD="#e53243",eO=(0,f.jF4)({"--black":"#0a0a0a","--white":"#ffffff","--gray":"#a9bec9","--gray-base":"#a9bec9","--component-bg":"#111111","--component-text-color":"#fff","--brand-primary":eT,"--default-button-color":"#344446","--default-button-primary-color":eT,"--default-button-success-color":eU,"--default-button-warning-color":ej,"--default-button-danger-color":eD,"--state-info-color":"#c4d1d4","--state-success-color":eU,"--state-warning-color":ej,"--state-danger-color":eD,"--main-navigation-color":"#1f1f1f","--main-navigation-color--inverted":"#ffffff","--focus-color":"#344446"});var eL=i(38248);function e_(e){let{value:t,onChange:i,schemaType:n}=e,a=(0,S.useRef)(t?.mode);return(0,S.useEffect)(()=>{let e=n?.name;("imageSource"===e||"imageUploadOrLinkSource"===e)&&t?.mode==="none"&&i(f.NJ$.from((0,f.wCX)(["mode"])))},[t?.mode,n,i]),(0,S.useEffect)(()=>{let e=t?.mode,i=a.current;e&&i!==e&&(a.current=e)},[t?.mode]),e.renderDefault(e)}var eN=i(68048),eE=i(85390),e$=i(41463);let eP={"Content-Type":"application/json","X-JWPUBS-API-Request":"1","X-S3Uploader-Studio":"1"};function eR(e){let{value:t,onChange:i,id:n,readOnly:a,path:r}=e,l=(0,f.FlV)(["_id"]),s=void 0!==e$?e$.env.SANITY_STUDIO_API_BASE_URL:void 0,d=void 0!==e$?"https://www.jwpubs.org":void 0,u=(s||"").replace(/\/$/,""),c=(d||"").replace(/\/$/,"");if(!u){let e=window.location.hostname||"";/\.sanity\.studio$/.test(e)&&(u=c)}let p=(0,S.useCallback)(e=>u?`${u}${e}`:e,[u]),m=e.options||{},h=m.PHOTO_ONLY?"image/*":m.accept,y=!0===m.allowManual,[g,b]=(0,S.useState)(!1),[v,x]=(0,S.useState)(null),[I,k]=(0,S.useState)(!1),[M,C]=(0,S.useState)(null),T=(0,S.useRef)(null),[U,j]=(0,S.useState)(!1),D=(0,S.useRef)(0),O=(0,S.useCallback)(e=>{let t=e.dataTransfer?.types;return!!t&&Array.prototype.indexOf.call(t,"Files")>=0},[]),L=(0,S.useCallback)(e=>{if(!e)return!1;if(m.PHOTO_ONLY)return e.type.startsWith("image/");if(!h||"*/*"===h)return!0;let t=h.split(/\s*,\s*/).filter(Boolean),i=e.type.toLowerCase();return t.some(e=>{if((e=e.toLowerCase())===i)return!0;if(e.endsWith("/*")){let t=e.slice(0,-2);return i.startsWith(t+"/")}return!1})},[h,m.PHOTO_ONLY]),N=(0,S.useMemo)(()=>t?(0,A.V)(String(t)):"",[t]),E=(0,S.useMemo)(()=>{if(!t)return!1;let e=String(t).toLowerCase();return/(\.(png|jpe?g|gif|webp|svg)(\?|$))|([?&](format|ext)=(png|jpg|jpeg|gif|webp|svg))/i.test(e)},[t]),$=(0,S.useMemo)(()=>{if(!t)return!1;let e=String(t).toLowerCase();return/(\.(mp3|wav|ogg|m4a|flac)(\?|$))|([?&](format|ext)=(mp3|wav|ogg|m4a|flac))/i.test(e)},[t]),F=(0,S.useCallback)(async e=>{x(null),b(!0);try{var n;let a=m.fileType||((n=e.type).startsWith("image/")?"p":n.startsWith("audio/")?"a":n.startsWith("video/")?"v":"application/pdf"===n||n.startsWith("application/msword")||n.startsWith("application/vnd")?"d":"application/zip"===n||"application/x-7z-compressed"===n||"application/x-rar-compressed"===n?"f":"m"),o=function(){let e="abcdefghijklmnopqrstuvwxyz0123456789",t="";for(let i=0;i<8;i++)t+=e.charAt(Math.floor(Math.random()*e.length));return t}(),s=(0,_.GA)(e.name),d=`f/${o}/${a}/1/${s}`,u=e.type||"application/octet-stream",c=await P(e,u),h=await fetch(p("/api/cdn/"),{method:"POST",headers:eP,body:JSON.stringify({filename:s,contentType:u,...c,customKey:d})});if(!h.ok){let e=await h.text().catch(()=>""),t="";try{let i=JSON.parse(e);(i?.detail||i?.error)&&(t=(i.detail||i.error||"").trim())}catch{}let i=`${h.status}${h.statusText?` ${h.statusText}`:""}`,n=t?`Failed to request upload URL (${i}) â ${t}`:`Failed to request upload URL (${i})`;throw Error(e?`${n} 14 15${e}`:n)}let y=await h.json();if(!y.uploadUrl||!y.requiredHeaders||!y.orphanDeleteCapability)throw Error("Missing presigned URL");let g=await R(e,y);if(!g.ok){let e=await g.text().catch(()=>""),t=`${g.status}`,i=`Upload failed (${t})`;throw Error(e?`${i} 16 17${e}`:i)}let b=m.domain||"cms",v=`https://${b}.jwcdn.org/f/${o}/${a}/1/${encodeURIComponent(s)}`,w=null;
17if(t&&eb(String(t)))try{if(!l)throw Error("The current Sanity document ID is unavailable.");let e=await ec(p("/api/cdn/delete/authorize/"),{operation:"field-cleanup",allowShared:!1,items:[{url:String(t),documentIds:[l],fieldPath:r}]});if(!(w=e[0]?.capability||null))throw Error("The previous file cleanup was not authorized.")}catch(i){let e=!1;try{await eu(p("/api/cdn/delete/"),y.orphanDeleteCapability)}catch{e=!0}let t=i&&"object"==typeof i&&"message"in i?String(i.message||""):"";throw Error(`The replacement was not saved because cleanup could not be authorized${t?`: ${t}`:"."}${e?" The newly uploaded file also could not be cleaned up automatically.":" The newly uploaded file was cleaned up."}`)}if(i((0,f.hZp)(v)),w)try{await em(p("/api/cdn/delete/"),w)}catch(t){let e=t&&"object"==typeof t&&"message"in t?String(t.message||""):"";throw Error(`The replacement was saved, but the previous CDN file was retained safely because final cleanup failed${e?`: ${e}`:"."}`)}C(Number.isSafeInteger(y.contentLength)?y.contentLength:null)}catch(e){x(e&&"object"==typeof e&&"message"in e?String(e.message):"Upload failed"),k(!0)}finally{b(!1)}},[i,t,p,m.domain,m.fileType,l,r]),q=(0,S.useCallback)(async e=>{let t=e.target.files?.[0];if(t){if(!L(t)){x(m.PHOTO_ONLY?"Only supported image files are allowed.":h?`File type not allowed. Allowed: ${h}`:"File type not allowed."),e.target.value="";return}await F(t),e.target.value=""}},[F,L,m.PHOTO_ONLY,h]),W=(0,S.useCallback)(e=>{let t=e.currentTarget.value;t?i((0,f.hZp)(t)):i((0,f.wCX)())},[i]),Y=(0,S.useCallback)(()=>T.current?.click(),[]),[V,z]=(0,S.useState)(!1),[B,H]=(0,S.useState)("top"),J=(0,S.useRef)(null),G=(0,S.useRef)(null),K=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(K.current)try{K.current.setAttribute("controlsList","nodownload noplaybackrate noremoteplayback");try{K.current.disableRemotePlayback=!0}catch{}}catch{}},[t]);let Z=(0,S.useCallback)(()=>z(!1),[]),X=(0,S.useCallback)(()=>{z(e=>{let t=!e;if(t&&1)try{let e=J.current?.getBoundingClientRect();if(e){let t=(window.innerHeight||document.documentElement.clientHeight)-e.bottom,i=e.top;H(t>=i?"bottom":"top")}}catch{}return t})},[]),Q=(0,S.useCallback)(async e=>{if(t)try{let i=String(t),n=i;"download"===e?n=i.replace("https://cms.","https://cfp."):"assets"===e&&(n=i.replace("https://cfp.","https://cms.")),await navigator.clipboard.writeText(n)}catch{}finally{Z()}},[t,Z]);(0,S.useEffect)(()=>{if(V)return document.addEventListener("mousedown",e,!0),document.addEventListener("keydown",t,!0),document.addEventListener("focusin",i,!0),()=>{document.removeEventListener("mousedown",e,!0),document.removeEventListener("keydown",t,!0),document.removeEventListener("focusin",i,!0)};function e(e){let t=e.target;t&&(G.current?.contains(t)||J.current?.contains(t))||z(!1)}function t(e){"Escape"===e.key&&z(!1)}function i(e){let t=e.target;t&&(G.current?.contains(t)||J.current?.contains(t))||setTimeout(()=>{if(!document.activeElement)return;let e=document.activeElement;G.current?.contains(e)||J.current?.contains(e)||z(!1)},10)}},[V]);let ee=(0,S.useCallback)(async()=>{if(!t)return i((0,f.wCX)());b(!0),x(null);
17try{if(eb(String(t))){if(!l)throw Error("The current Sanity document ID is unavailable.");let e=await ec(p("/api/cdn/delete/authorize/"),{operation:"field-cleanup",allowShared:!1,items:[{url:String(t),documentIds:[l],fieldPath:r}]}),n=e[0]?.capability;if(!n)throw Error("CDN cleanup was not authorized.");i((0,f.wCX)()),await em(p("/api/cdn/delete/"),n)}else i((0,f.wCX)());C(null)}catch(e){x(e&&"object"==typeof e&&"message"in e?String(e.message):"Delete failed")}finally{b(!1)}},[t,i,p,l,r]);(0,S.useEffect)(()=>{let e=!1;async function i(t){try{let i=await fetch(t,{method:"HEAD"});if(i.ok){let t=i.headers.get("content-length");if(!e&&t)return void C(Number(t))}}catch{}try{let i=await fetch(p("/api/cdn/stat/"),{method:"POST",headers:eP,body:JSON.stringify({url:t})});if(i.ok){let t=await i.json();e||"number"!=typeof t.size||C(t.size)}}catch{}}return t&&null==M&&i(String(t)),()=>{e=!0}},[t,M,p]);let et=(0,S.useCallback)(e=>{if(!e||e<=0)return"";if(e<1024)return`${e} B`;let t=["KB","MB","GB","TB"],i=-1,n=e;do n/=1024,++i;while(n>=1024&&i<t.length-1);return`${n.toFixed(n<10?2:1)} ${t[i]}`},[]);return(0,o.jsxs)(f.zBI,{inputId:n,path:r,children:[(0,o.jsxs)(w.p,{space:3,children:[t?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(w.R,{padding:3,radius:2,tone:"transparent",className:"s3uploader-preview",children:E?(0,o.jsxs)(w.p,{space:3,children:[(0,o.jsx)("div",{className:"s3uploader-imagebox",children:(0,o.jsx)("img",{src:String(t),alt:N||"Image",style:{objectFit:"contain",width:"100%",height:"100%"},loading:"lazy"})}),(0,o.jsxs)(w.H,{align:"center",justify:"space-between",gap:3,children:[(0,o.jsx)(w.H,{align:"center",gap:3,style:{minWidth:0,flex:1},children:y?(0,o.jsx)(w.f,{dir:"ltr",id:n,type:"url",inputMode:"url",value:(0,A.e)(String(t||"")),onChange:W,readOnly:!!a||g,"aria-label":"File URL",style:{width:"100%"}}):(0,o.jsx)(w.U,{weight:"semibold",title:N||void 0,style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:N||"File"})}),(0,o.jsx)(w.U,{size:1,muted:!0,children:et(M)})]})]}):$?(0,o.jsxs)(w.p,{space:3,children:[(0,o.jsx)(w.H,{direction:"column",gap:3,children:(0,o.jsx)("audio",{ref:K,controls:!0,style:{width:"100%"},src:String(t),controlsList:"nodownload noplaybackrate noremoteplayback",children:"Your browser does not support the audio element."})}),(0,o.jsxs)(w.H,{align:"center",justify:"space-between",gap:3,children:[(0,o.jsx)(w.H,{align:"center",gap:3,style:{minWidth:0,flex:1},children:y?(0,o.jsx)(w.f,{dir:"ltr",id:n,type:"url",inputMode:"url",value:(0,A.e)(String(t||"")),onChange:W,readOnly:!!a||g,"aria-label":"File URL",style:{width:"100%"}}):(0,o.jsx)(w.U,{weight:"semibold",title:N||void 0,style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:N||"Audio File"})}),(0,o.jsx)(w.U,{size:1,muted:!0,children:et(M)})]})]}):(0,o.jsxs)(w.H,{align:"center",justify:"space-between",gap:3,children:[(0,o.jsxs)(w.H,{align:"center",gap:3,style:{minWidth:0,flex:1},children:[(0,o.jsx)(eE.A,{}),y?(0,o.jsx)(w.f,{dir:"ltr",id:n,type:"url",inputMode:"url",value:(0,A.e)(String(t||"")),onChange:W,readOnly:!!a||g,"aria-label":"File URL",style:{width:"100%"}}):(0,o.jsx)(w.U,{weight:"semibold",title:N||void 0,style:{overflowWrap:"anywhere",wordBreak:"break-word"},children:N||"File"})]}),(0,o.jsx)(w.U,{size:1,muted:!0,children:et(M)})]})}),(0,o.jsxs)(w.H,{align:"center",gap:2,children:[(0,o.jsx)(w.m,{content:(0,o.jsx)(w.R,{padding:2,radius:2,tone:"transparent",ref:G,style:{maxWidth:260},children:(0,o.jsx)(w.p,{space:2,children:(0,o.jsxs)(w.H,{direction:"column",gap:1,children:[(0,o.jsx)(w.z,{text:"Assets URL (CMS)",tone:"default",mode:"ghost",onClick:()=>Q("assets"),disabled:!t,className:"s3uploader-success-ghost"}),(0,o.jsx)(w.z,{text:"Download URL (CFP)",tone:"default",mode:"ghost",onClick:()=>Q("download"),disabled:!t,className:"s3uploader-success-ghost"})]})})}),placement:B,open:V,children:(0,o.jsx)(w.W,{children:(0,o.jsx)(w.z,{text:"Copy File URL",tone:"default",mode:"ghost",className:"s3uploader-success-ghost",disabled:!t||g,onClick:X,ref:J,"aria-haspopup":"dialog","aria-expanded":V})})}),(0,o.jsx)(w.z,{text:"Replace File",tone:"default",mode:"ghost",className:"s3uploader-success-ghost",disabled:!!a||g,onClick:Y}),(0,o.jsx)(w.z,{text:"Delete File",tone:"default",mode:"ghost",className:"s3uploader-danger-ghost",disabled:!!a||g,onClick:ee}),g?(0,o.jsxs)(w.H,{gap:2,align:"center",className:"s3uploader-working",children:[(0,o.jsx)(w.V,{muted:!0}
17),(0,o.jsx)(w.U,{size:1,children:"Workingâ¦"})]}):null]})]}):(0,o.jsxs)(w.p,{space:3,children:[(0,o.jsx)(w.R,{padding:3,radius:2,tone:"transparent",className:`s3uploader-dropzone${U?" is-dragging":""}${g?" is-busy":""}`,onDragEnter:e=>{a||g||O(e)&&(e.preventDefault(),D.current+=1,j(!0))},onDragOver:e=>{a||g||O(e)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",j(!0))},onDragLeave:e=>{O(e)&&(e.preventDefault(),D.current=Math.max(0,D.current-1),0===D.current&&j(!1))},onDrop:async e=>{if(e.preventDefault(),D.current=0,j(!1),a||g)return;let t=e.dataTransfer?.files,i=t&&t[0];i&&(L(i)?await F(i):x(m.PHOTO_ONLY?"Only image files are allowed.":h?`File type not allowed. Allowed: ${h}`:"File type not allowed."))},onPaste:async e=>{if(a||g)return;let t=e.clipboardData?.files,i=t&&t[0];i&&(L(i)?await F(i):x(m.PHOTO_ONLY?"Only image files are allowed.":h?`File type not allowed. Allowed: ${h}`:"File type not allowed."))},tabIndex:0,"aria-label":"Drag or paste file here",children:(0,o.jsxs)(w.H,{align:"center",justify:"space-between",gap:3,children:[(0,o.jsxs)(w.H,{align:"center",gap:3,style:{minWidth:0,flex:1},children:[(0,o.jsx)(eN.A,{}),(0,o.jsx)(w.U,{muted:!0,className:"s3uploader-noselect","aria-live":"polite",children:U?"Drop file to upload":"Drag or paste file here"})]}),(0,o.jsx)(w.H,{align:"center",gap:2,children:g?(0,o.jsxs)(w.H,{gap:2,align:"center",className:"s3uploader-working",children:[(0,o.jsx)(w.V,{muted:!0}),(0,o.jsx)(w.U,{size:1,children:"Workingâ¦"})]}):(0,o.jsx)(w.z,{text:"Upload",tone:"default",mode:"ghost",disabled:!!a,onClick:Y,className:"s3uploader-success-ghost"})})]})}),y?(0,o.jsx)(w.f,{dir:"ltr",id:n,type:"url",inputMode:"url",value:(0,A.e)(String(t||"")),onChange:W,readOnly:!!a||g,"aria-label":"File URL",placeholder:"Or paste a file URL"}):null]}),v?(0,o.jsx)(w.R,{padding:2,tone:"critical",radius:2,children:(0,o.jsxs)(w.p,{space:2,children:[(0,o.jsx)(w.U,{size:1,weight:"semibold",children:"Upload failed"}),(0,o.jsx)(w.U,{size:1,children:String(v).split(/\r?\n/)[0]}),/(\(|\b)401(\)|\b)/.test(String(v))&&/unauthorized|studio access required/i.test(String(v))?(0,o.jsx)(w.U,{size:1,muted:!0,children:"Hint: Studio access was denied. If you are using the hosted Studio, ensure it calls your site API (SANITY_STUDIO_API_BASE_URL / NEXT_PUBLIC_BASE_URL) and that the site is configured to trust the Studio origin with header X-S3Uploader-Studio: 1. Check your server logs for studio access denied to see the exact reason."}):null,(0,o.jsx)(w.z,{text:I?"Hide details":"Show details",mode:"bleed",tone:"default",onClick:()=>k(e=>!e)}),I?(0,o.jsx)(w.R,{padding:2,radius:2,tone:"transparent",children:(0,o.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},children:v})}):null]})}):null,(0,o.jsx)("input",{ref:T,title:"Select file to upload",type:"file",accept:h,disabled:!!a||g,onChange:q,hidden:!0,"aria-hidden":!0})]}),(0,o.jsx)("style",{children:` 18 /* Utility: add horizontal spacing around working indicator */ 19 .s3uploader-working { margin-left: 8px !important; margin-right: 8px !important; } 20 /* Dropzone visual */ 21 .s3uploader-dropzone { 22 background: transparent !important; 23 border: 1px dashed #6d6d6d !important; 24 box-shadow: none !important; 25 transition: background-color 120ms ease, border-color 120ms ease, border-style 120ms ease; 26 } 27 .s3uploader-dropzone.is-dragging { 28 background: #1a2123 !important; 29 border-style: solid !important; 30 border-color: #6d6d6d !important; 31 } 32 .s3uploader-dropzone.is-busy { 33 border-style: solid !important; 34 border-color: #6d6d6d !important; 35 } 36 .s3uploader-preview { 37 background: #1a2123 !important; 38 box-shadow: inset 0 0 0 1px #6d6d6d !important; 39 } 40 .s3uploader-imagebox { 41 width: 100%; 42 max-width: 100%; 43 max-height: 360px; 44 min-height: 160px; 45 aspect-ratio: 16/9; 46 position: relative; 47 display: flex; 48 align-items: center; 49 justify-content: center; 50 overflow: hidden; 51 background: #111111; 52 } 53 .s3uploader-imagebox img { 54 max-width: 100% !important; 55 max-height: 100% !important; 56 width: 100% !important; 57 height: 100% !important; 58 object-fit: contain !important; 59 display: block; 60 background: transparent; 61 } 62 .s3uploader-noselect { 63 -webkit-user-select: none !important; 64 -moz-user-select: none !important;
65 -ms-user-select: none !important; 66 user-select: none !important; 67 } 68 .s3uploader-success-ghost { 69 background: #475c61 !important; 70 color: #fff !important; 71 border-color: transparent !important; 72 box-shadow: none !important; 73 outline: none !important; 74 transition: background 120ms, color 120ms; 75 } 76 .s3uploader-success-ghost span, .s3uploader-success-ghost svg { color: inherit !important; } 77 .s3uploader-success-ghost:hover, 78 .s3uploader-success-ghost:active, 79 .s3uploader-success-ghost[data-pressed="true"] { 80 background: #344446 !important; 81 color: #fff !important; 82 border-color: transparent !important; 83 box-shadow: none !important; 84 outline: none !important; 85 } 86 .s3uploader-success-ghost:disabled, 87 .s3uploader-success-ghost:disabled:hover, 88 .s3uploader-success-ghost:disabled:active { 89 background: #6d6d6d !important; 90 color: #475c61 !important; 91 border-color: transparent !important; 92 box-shadow: none !important; 93 outline: none !important; 94 } 95 .s3uploader-danger-ghost { 96 background: transparent !important; 97 color: #bb1827 !important; 98 border-color: transparent !important; 99 box-shadow: inset 0 0 0 1px #6d6d6d !important; 100 outline: none !important; 101 } 102 button[data-ui="Button"].s3uploader-danger-ghost *, 103 [data-ui="Button"].s3uploader-danger-ghost *, 104 .s3uploader-danger-ghost span, .s3uploader-danger-ghost svg { 105 color: var(--text-red, #bb1827) !important; 106 } 107 .s3uploader-danger-ghost:hover, 108 .s3uploader-danger-ghost:active, 109 .s3uploader-danger-ghost[data-pressed="true"] { 110 background: var(--text-red, #bb1827) !important; 111 color: var(--text-white, #fff) !important; 112 border-color: transparent !important; 113 box-shadow: none !important; 114 outline: none !important; 115 } 116 button[data-ui="Button"].s3uploader-danger-ghost:hover *, 117 button[data-ui="Button"].s3uploader-danger-ghost:active *, 118 button[data-ui="Button"].s3uploader-danger-ghost[data-pressed="true"] *, 119 [data-ui="Button"].s3uploader-danger-ghost:hover *, 120 [data-ui="Button"].s3uploader-danger-ghost:active *, 121 [data-ui="Button"].s3uploader-danger-ghost[data-pressed="true"] * { 122 color: var(--text-white, #fff) !important; 123 } 124 .s3uploader-danger-ghost:disabled, 125 .s3uploader-danger-ghost:disabled:hover, 126 .s3uploader-danger-ghost:disabled:active { 127 background: var(--color-gray-2, #d1d1d1) !important; 128 color: var(--text-red, #bb1827) !important; 129 border-color: transparent !important; 130 box-shadow: none !important; 131 outline: none !important; 132 } 133 `})]})}function eF(e){let{allowNone:t,titles:i}=e,n={none:i?.none??"No File Chosen",external:i?.external??"External File URL",cdn:i?.cdn??"JWPUBS⢠CDN File Upload",file:i?.file??"Sanity CDN File Upload"};return[t?{title:n.none,value:"none"}:null,{title:n.external,value:"external"},{title:n.cdn,value:"cdn"},{title:n.file,value:"file"}].filter(Boolean)}let eq=(0,eL.U8)({name:"audioSource",title:"Audio Source",type:"object",components:{input:e_},fields:[(0,eL.MI)({name:"mode",type:"string",title:"Source",description:"Choose how to provide the Audio.",options:{list:eF({allowNone:!1})},initialValue:"cdn",validation:e=>e.required()}),(0,eL.MI)({name:"url",type:"url",title:"External Audio URL",description:"Audio URL (must be publicly accessible over HTTPS).",hidden:({parent:e})=>e?.mode!=="external"}),(0,eL.MI)({name:"cdnUrl",type:"string",title:"JW CDN File Upload",description:"Upload the audio file to JW CDN.",hidden:({parent:e})=>e?.mode!=="cdn",components:{input:function(e){let t={...e,options:{...e?.options||{},accept:"audio/*",fileType:"a",domain:"cfp"}};return S.createElement(eR,t)}}}),(0,eL.MI)({name:"file",type:"file",title:"Sanity CDN File Upload",description:"Upload the audio to host in Sanity CDN.",options:{accept:"audio/*"},hidden:({parent:e})=>e?.mode!=="file"})],validation:e=>e.custom(e=>{if(!e)return!0;let t=e?.mode;return t?"external"!==t||e?.url?"cdn"!==t||e?.cdnUrl?"file"!==t||!!e?.file?.asset?._ref||"Audio file is required.":"Audio file (JW CDN) is required.":"Audio URL is required.":"Choose an audio source."})}),eW=(0,eL.U8)({name:"docxSource",title:"DOCX Source",type:"object",components:{input:e_},fields:[(0,eL.MI)({name:"mode",type:"string",title:"Source",description:"Choose how to provide the document.",options:{list:eF({allowNone:!1})},initialValue:"cdn",validation:e=>e.required()}),(0,eL.MI)({name:"url",type:"url",title:"External Document URL",description:"Document URL (must be publicly accessible over HTTPS).",hidden:({parent:e})=>e?.mode!=="external"}),(0,eL.MI)({name:"cdnUrl",type:"string",title:"JW CDN File Upload",description:"Upload the document to JW CDN.",hidden:({parent:e})=>e?.mode!=="cdn",components:{input:function(e){let t={...e,options:{...e?.options||{},accept:"application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document",fileType:"d"}};return S.createElement(eR,t)}}}),(0,eL.MI)({name:"file",type:"file",title:"Sanity CDN File Upload",description:"Upload the document to host in Sanity CDN.",options:{accept:"application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document"},hidden:({parent:e})=>e?.mode!=="file"})],validation:e=>e.custom(e=>{if(!e)return!0;let t=e?.mode;return t?"external"!==t||e?.url?"cdn"!==t||e?.cdnUrl?"file"!==t||!!e?.file?.asset?._ref||"Document file is required.":"Document file (JW CDN) is required.":"Document URL is required.":"Choose a document source."})}),eY=(0,eL.U8)({name:"imageSource",title:"Image Source",type:"object",components:{input:e_},fields:[(0,eL.MI)({name:"mode",type:"string",title:"Source",description:"Choose how to provide the Image.",options:{list:eF({allowNone:!1})}}),(0,eL.MI)({name:"url",type:"url",title:"External Image URL",description:"Image URL (must be publicly accessible over HTTPS).",hidden:({parent:e})=>e?.mode!=="external"}),(0,eL.MI)({name:"cdnUrl",type:"string",title:"JW CDN File Upload",description:"Upload the image to host in JW CDN.",hidden:({parent:e})=>e?.mode!=="cdn",components:{input:function(e){let t={...e,options:{...e?.options||{},PHOTO_ONLY:!0}};return S.createElement(eR,t)}}}),(0,eL.MI)({name:"file",type:"image",title:"Sanity CDN File Upload",description:"Upload the image to host in Sanity CDN.",options:{hotspot:!0},hidden:({parent:e})=>e?.mode!=="file"}),(0,eL.MI)({name:"alt",type:"string",title:"Alt text",description:"Short description for accessibility and previews."})],validation:e=>e.custom(e=>{if(!e)return!0;let t=e?.mode;return!t||"none"===t||("external"!==t||e?.url?("cdn"!==t||!!e?.cdnUrl)&&("file"!==t||!!e?.file?.asset?._ref)||"File image is required.":"Image URL is required.")})});function eV(e){let t={...e,options:{PHOTO_ONLY:!0,domain:"cms",fileType:"p"}};return(0,o.jsx)(eR,{...t})}let ez="Enter a valid image link starting with https://, /, or #.",eB=e=>{let t=e.trim();if(!t)return!1;if(t.startsWith("/")||t.startsWith("#"))return!0;
133if(/^https?:\/\//i.test(t))try{let e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol}catch{}return!1},eH=(0,eL.U8)({name:"imageUploadOrLinkSource",title:"Image Upload Or Link Source",type:"object",components:{input:e_},fields:[(0,eL.MI)({name:"mode",type:"string",title:"Source",description:"Choose how to provide the image.",options:{list:eF({allowNone:!1,titles:{external:"External Image URL",cdn:"JWPUBS⢠CDN Image Upload",file:"Sanity CDN Image Upload"}})}}),(0,eL.MI)({name:"url",type:"string",title:"External Image URL",description:"Accepted: https://, /path, or #anchor.",hidden:({parent:e})=>e?.mode!=="external",validation:e=>e.custom((e,t)=>{let i=t.parent;return i?.mode!=="external"||("string"==typeof e&&e.trim()?!!eB(e)||ez:"External image URL is required.")})}),(0,eL.MI)({name:"cdnUrl",type:"string",title:"JW CDN Image Upload",description:"Upload an image to host in JW CDN.",hidden:({parent:e})=>e?.mode!=="cdn",components:{input:eV}}),(0,eL.MI)({name:"file",type:"image",title:"Sanity CDN Image Upload",description:"Upload an image to host in Sanity CDN.",options:{hotspot:!0},hidden:({parent:e})=>e?.mode!=="file"})],validation:e=>e.custom(e=>{if(!e)return!0;let t=e?.mode;return!t||"none"===t||("external"===t?e?.url&&String(e.url).trim()?!!eB(String(e.url))||ez:"External image URL is required.":"cdn"!==t||e?.cdnUrl?"file"!==t||!!e?.file?.asset?._ref||"Sanity image is required.":"JW CDN image is required.")})}),eJ=(0,eL.U8)({name:"lyricsSource",title:"Lyrics",type:"object",components:{input:e_},fields:[(0,eL.MI)({name:"mode",title:"Lyrics Type",type:"string",description:"Choose how to provide the Lyrics.",options:{list:[{title:"Inline (Rich Text)",value:"inline"},{title:"Link (URL)",value:"link"}]}}),(0,eL.MI)({name:"lyrics",title:"Lyrics (Rich Text)",type:"array",of:[{type:"block"}],hidden:({parent:e})=>e?.mode!=="inline"}),(0,eL.MI)({name:"lyricsUrl",title:"Lyrics Link",type:"url",hidden:({parent:e})=>e?.mode!=="link",validation:e=>e.uri({allowRelative:!1})})],validation:e=>e.custom(e=>!e||"object"!=typeof e||!e.mode||("inline"!==e.mode||Array.isArray(e.lyrics)&&0!==e.lyrics.length?"link"!==e.mode||!!e.lyricsUrl||"Provide a lyrics URL or clear the selection.":"Provide lyrics content or clear the selection."))}),eG=(0,eL.U8)({name:"pdfSource",title:"PDF Source",type:"object",components:{input:e_},fields:[(0,eL.MI)({name:"mode",type:"string",title:"Source",description:"Choose how to provide the PDF.",options:{list:eF({allowNone:!1})},initialValue:"cdn",validation:e=>e.required()}),(0,eL.MI)({name:"url",type:"url",title:"External PDF URL",description:"PDF URL (must be publicly accessible over HTTPS).",hidden:({parent:e})=>e?.mode!=="external"}),(0,eL.MI)({name:"cdnUrl",type:"string",title:"JW CDN File Upload",description:"Upload the PDF file to JW CDN.",hidden:({parent:e})=>e?.mode!=="cdn",components:{input:function(e){let t={...e,options:{...e?.options||{},accept:"application/pdf",fileType:"d"}};return S.createElement(eR,t)}}}),(0,eL.MI)({name:"file",type:"file",title:"Sanity CDN File Upload",description:"Upload the PDF to host in Sanity CDN.",options:{accept:"application/pdf"},hidden:({parent:e})=>e?.mode!=="file"})],validation:e=>e.custom(e=>{if(!e)return!0;let t=e?.mode;return t?"external"!==t||e?.url?"cdn"!==t||e?.cdnUrl?"file"!==t||!!e?.file?.asset?._ref||"PDF file is required.":"PDF file (JW CDN) is required.":"PDF URL is required.":"Choose a PDF source."})}),eK="Enter a valid link starting with https://, jwlibrary://, /, #, mailto:, or tel:.",eZ=e=>{let t=e.trim();if(!t)return!1;if(t.startsWith("/")||t.startsWith("#")||t.startsWith("mailto:")||t.startsWith("tel:")||/^jwlibrary:\/\//i.test(t))return!0;if(/^https?:\/\//i.test(t))try{let e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol}catch{}return!1},eX=(0,eL.U8)({name:"uploadOrLinkSource",title:"Upload Or Link Source",type:"object",components:{input:e_},fields:[(0,eL.MI)({name:"mode",type:"string",title:"Source",description:"Choose how to provide the file or link target.",options:{list:eF({allowNone:!1,titles:{external:"External File URL",cdn:"JWPUBS⢠CDN File Upload",file:"Sanity CDN File Upload"}})},initialValue:"cdn",validation:e=>e.required()}),(0,eL.MI)({name:"url",type:"string",title:"External File URL",description:"Accepted: https://, jwlibrary://, /path, #anchor, mailto:, tel:.",hidden:({parent:e})=>e?.mode!=="external",validation:e=>e.custom((e,t)=>
133{let i=t.parent;return i?.mode!=="external"||("string"==typeof e&&e.trim()?!!eZ(e)||eK:"External URL is required.")})}),(0,eL.MI)({name:"cdnUrl",type:"string",title:"JW CDN File Upload",description:"Upload a file to host in JW CDN.",hidden:({parent:e})=>e?.mode!=="cdn",components:{input:function(e){let t={...e,options:{...e?.options||{},domain:"cfp"}};return S.createElement(eR,t)}}}),(0,eL.MI)({name:"file",type:"file",title:"Sanity CDN File Upload",description:"Upload a file to host in Sanity CDN.",hidden:({parent:e})=>e?.mode!=="file"})],validation:e=>e.custom(e=>{if(!e)return!0;let t=e?.mode;return!t||("external"===t?e?.url&&String(e.url).trim()?!!eZ(String(e.url))||eK:"External URL is required.":"cdn"!==t||e?.cdnUrl?"file"!==t||!!e?.file?.asset?._ref||"Sanity file is required.":"JW CDN file is required.")})}),eQ=(0,eL.U8)({name:"videoSource",title:"Video Source",type:"object",components:{input:e_},fields:[(0,eL.MI)({name:"mode",type:"string",title:"Source",description:"Choose how to provide the Video.",options:{list:eF({allowNone:!1})},initialValue:"cdn",validation:e=>e.required()}),(0,eL.MI)({name:"url",type:"url",title:"External Video URL",description:"Video URL (must be publicly accessible over HTTPS).",hidden:({parent:e})=>e?.mode!=="external"}),(0,eL.MI)({name:"cdnUrl",type:"string",title:"JW CDN File Upload",description:"Upload the video file to JW CDN.",hidden:({parent:e})=>e?.mode!=="cdn",components:{input:function(e){let t={...e,options:{...e?.options||{},accept:"video/*",fileType:"v"}};return S.createElement(eR,t)}}}),(0,eL.MI)({name:"file",type:"file",title:"Sanity CDN File Upload",description:"Upload the video to host in Sanity CDN.",options:{accept:"video/*"},hidden:({parent:e})=>e?.mode!=="file"}),(0,eL.MI)({name:"poster",type:"imageSource",title:"Poster Image (optional)",description:"Optional poster image for the video."})],validation:e=>e.custom(e=>{if(!e)return!0;let t=e?.mode;return t?"external"!==t||e?.url?"cdn"!==t||e?.cdnUrl?"file"!==t||!!e?.file?.asset?._ref||"Video file is required.":"Video file (JW CDN) is required.":"Video URL is required.":"Choose a video source."})}),e0={alignItems:"center",fontSize:"12px",lineHeight:1},e1={fontSize:"0.7em",lineHeight:1},e2={color:"var(--text-red)"},e3=({children:e})=>S.createElement("span",{style:e2},e),e6={type:"block",styles:[{title:"Normal",value:"normal"},{title:"Heading 1",value:"h1"},{title:"Heading 2",value:"h2"},{title:"Heading 3",value:"h3"},{title:"Heading 4",value:"h4"},{title:"Heading 5",value:"h5"},{title:"Heading 6",value:"h6"},{title:"Warning Text",value:"warningText",icon:v.sAQ,component:e3},{title:"Blockquote",value:"blockquote"}],marks:{decorators:[{title:"Strong",value:"strong"},{title:"Emphasis",value:"em"},{title:"Strikethrough",value:"strike-through"},{title:"Warning Text",value:"warningText",icon:v.sAQ,component:e3},{title:"Superscript",value:"sup",icon:()=>S.createElement("span",{style:e0},"x",S.createElement("sup",{style:e1},"2"))},{title:"Subscript",value:"sub",icon:()=>S.createElement("span",{style:e0},"x",S.createElement("sub",{style:e1},"2"))},{title:"Code",value:"code"}],annotations:[{name:"link",type:"object",title:"URL",fields:[{name:"href",type:"url",title:"URL"}]}]}};function e4(e){if(!e||"string"!=typeof e)return;if(!n)for(let e of(n={},a={},r={},b.F)){let t=String(e.title),i=String(e.id).toLowerCase(),o=String(e.name||"");n[i]=t,a[t.trim().toLowerCase()]=t,r[o.trim().toLowerCase()]=t}let t=e.trim();if(!t)return;let i=t.toLowerCase();if(n&&n[i])return n[i];let o=i.replaceAll("-","_");if(n&&n[o])return n[o];let l=i.split(/[-_]/)[0]||i;return n&&n[l]?n[l]:a&&a[i]?a[i]:r&&r[i]?r[i]:t.slice(0,1).toUpperCase()+t.slice(1)}function e8(e){if(e?.legacyLang&&String(e.legacyLang).trim()){let t=e4(String(e.legacyLang));if(t)return t}if(e?.i18n_lang&&String(e.i18n_lang).trim()){let t=e4(String(e.i18n_lang));if(t)return t}}let e9=new Intl.Collator("en",{sensitivity:"base",numeric:!0}),e5=[{title:"ALL",value:"all"},{title:"Add-on (Feature)",value:"addon"},{title:"Bulk Download (Feature)",value:"bulkdownload"},{title:"Articles",value:"articles"},{title:"Catalog",value:"catalog"},{title:"Catalog (Auth)",value:"authCatalog"},{title:"Music Library (Auth)",value:"authMusic"},{title:"Admin Apps (Auth)",value:"authAdminApps"},{title:"Publications (Auth)",value:"publications"},{title:"Homepage",value:"main"},{title:"AI Search (Feature)",value:"aisearch"},{title:"Image Search (Feature)",value:"imagesearch"},{title:"QR Code (Feature)",value:"qrcode"},{title:"Shortlink (Feature)",value:"shortlink"},{title:"Subscription Library (Feature)",value:"rss"},{title:"Text Marker (Feature)",value:"textmarker"},{title:"Timestamp (Feature)",value:"timestamp"},{title:"Tools",value:"moretools"},{title:"Transcript (Feature)",value:"transcript"}].sort((e,t)=>
133{let i=e9.compare(e.title,t.title);return 0!==i?i:e.value.localeCompare(t.value)}),e7=e5.reduce((e,t)=>(e[t.value]=t.title,e),{}),te=[{title:"Indefinitely",value:"indefinite"},{title:"1 day",value:"1"},{title:"5 days",value:"5"},{title:"7 days",value:"7"},{title:"10 days",value:"10"},{title:"20 days",value:"20"},{title:"24 days",value:"24"},{title:"30 days",value:"30"},{title:"Custom days",value:"custom"}],tt=te.reduce((e,t)=>(e[t.value]=t.title,e),{}),ti=(0,eL.U8)({name:"announcement",title:"Announcement",type:"document",icon:T.A,initialValue:{__i18n_lang:"en",dateDisplay:{show:!1},visibilityDuration:"indefinite"},validation:e=>e.custom(e=>{let t=[],i=e?.title,n=e?.description,a=e?.placement,r=e?.location,o=Array.isArray(r)?r.length>0:"string"==typeof r&&!!r,l=e?.visibilityDuration||"indefinite",s=e?.visibilityCustomDays;return i&&i.trim()||t.push("Title is required"),n&&0!==n.length||t.push("Description is required"),o||"string"==typeof a&&a||t.push("Location is required"),"custom"===l&&(!Number.isInteger(s)||(s??0)<1)&&t.push("Custom visibility days must be a whole number greater than 0"),e?.archived&&t.push("Cannot publish while archived. Unarchive first."),!t.length||t.join("\n")}
133),orderings:[{title:"Newest first (Date)",name:"dateDesc",by:[{field:"dateDisplay.value",direction:"desc"},{field:"date",direction:"desc"},{field:"_createdAt",direction:"desc"}]},{title:"Oldest first (Date)",name:"dateAsc",by:[{field:"dateDisplay.value",direction:"asc"},{field:"date",direction:"asc"},{field:"_createdAt",direction:"asc"}]},{title:"Title A â Z",name:"titleAsc",by:[{field:"title",direction:"asc"}]},{title:"Title Z â A",name:"titleDesc",by:[{field:"title",direction:"desc"}]}],fields:[{name:"title",title:"Title",type:"string",readOnly:({document:e})=>!!e?.archived,validation:e=>e.required().custom(e=>!!e&&"string"==typeof e&&e.trim().length>0||"Title is required")},{name:"description",title:"Description",type:"array",of:[e6],readOnly:({document:e})=>!!e?.archived,validation:e=>e.required().min(1)},{name:"dateDisplay",title:"Date",type:"object",options:{collapsible:!1},fields:[{name:"show",title:"Show Date",description:"Toggle to display the date on the site",type:"boolean",initialValue:!1,options:{layout:"switch"},readOnly:({document:e})=>!!e?.archived},{name:"value",title:"Date",type:"datetime",description:"When this announcement was published",hidden:({parent:e})=>e?.show!==!0,readOnly:({document:e})=>!!e?.archived,validation:e=>e.custom((e,t)=>{let i=t.parent;return!i?.show||!!e||"Date is required when 'Show Date' is enabled"})}]},{name:"visibilityDuration",title:"Visibility Duration",description:"How long this announcement stays visible after publish/update.",type:"string",initialValue:"indefinite",options:{list:te,layout:"dropdown"},readOnly:({document:e})=>!!e?.archived,validation:e=>e.required()},{name:"visibilityCustomDays",title:"Custom Days",description:"Visible for this many days after publish/update.",type:"number",hidden:({document:e})=>e?.visibilityDuration!=="custom",readOnly:({document:e})=>!!e?.archived,validation:e=>e.custom((e,t)=>{let i=t.document;return i?.visibilityDuration!=="custom"||"number"==typeof e&&!!Number.isInteger(e)&&!(e<1)||"Enter a whole number of days greater than 0"})},{name:"date",title:"(Legacy) Date",type:"datetime",hidden:!0},{name:"showDate",title:"(Legacy) Show Date",type:"boolean",hidden:!0},{name:"location",title:"Locations",description:"Choose where this announcement should appear. You can select multiple.",type:"tags",options:{predefinedTags:e5.map(e=>({label:e.title,value:e.value})),allowCreate:!1},readOnly:({document:e})=>!!e?.archived},{name:"placement",title:"(Legacy) Location",description:"Deprecated: use 'Locations' (multi-select) above. Remains for older entries.",type:"string",options:{list:e5,layout:"dropdown"},readOnly:({document:e})=>!!e?.archived,hidden:!0},{name:"archived",title:"Archived",type:"boolean",hidden:!0,initialValue:!1},{name:"archivedAt",title:"Archived At",type:"datetime",hidden:!0}],preview:{select:{title:"title",date:"date",dateValue:"dateDisplay.value",dateShow:"dateDisplay.show",locations:"location",location:"placement",visibilityDuration:"visibilityDuration",visibilityCustomDays:"visibilityCustomDays",showDate:"showDate",i18n_lang:"__i18n_lang",legacyLang:"language"},prepare(e){let{title:t,date:i,dateValue:n,dateShow:a,locations:r,location:o,visibilityDuration:l,visibilityCustomDays:s,showDate:d}=e,u=[],c=n??i;if((a??d)&&c&&u.push(new Date(c).toLocaleDateString()),Array.isArray(r)&&r.length>0){let e=r.map(e=>{if("string"==typeof e)return e7[e]||e;let t=e.value,i=e.label;return i&&"string"==typeof i?i:t&&"string"==typeof t?e7[t]||t:""}).filter(Boolean);if(e.length>0){let t=e[0],i=e.length-1;u.push(i>0?`${t}, +${i}`:t)}}else o&&u.push(e7[o]||o);let p=l||"indefinite";if("indefinite"!==p){let e="custom"===p?s:Number.parseInt(p,10);Number.isInteger(e)&&(e??0)>0?u.push(`Visible ${e} day${1===e?"":"s"}`):u.push(tt[p]||"Visibility set")}let m=e8({i18n_lang:e.i18n_lang,legacyLang:e.legacyLang});return m&&u.push(m),{title:t||"(Untitled Announcement)",subtitle:u.join(" ⢠"),media:T.A}}}}),tn=(0,eL.U8)({name:"appGroup",title:"Application Group",type:"document",fields:[(0,eL.MI)({name:"appType",title:"Application Type",type:"string",options:{list:[{title:"APK",value:"APK"},{title:"EXE",value:"EXE"},{title:"UPDATEPKG",value:"UPDATEPKG"},{title:"ZIP",value:"ZIP"}],layout:"radio"},hidden:!0,readOnly:!0,validation:e=>e.required()}),(0,eL.MI)({name:"name",title:"Group Name",type:"string",validation:e=>e.required().min(2)}),(0,eL.MI)({name:"order",title:"Order",description:"Display order within the Application Type. Must be unique per type (1,2,3,â¦).",type:"number",validation:e=>e.required().integer().min(1).custom(async(e,t)=>{let i;if(!e)return"Order is required";let{document:n,getClient:a}=t,r=n?.appType;if(!r)return!0;let o=n?._id?.replace(/^drafts\./,""),l=a({apiVersion:"2023-01-01"}),s={appType:r,order:e};return o?(i='count(*[_type == "appGroup" && appType == $appType && order == $order && !(_id in [$id, "drafts." + $id])])',s.id=o):i='count(*[_type == "appGroup" && appType == $appType && order == $order])',!(await l.fetch(i,s)>0)||"That order number is already used for this application type"})}),(0,eL.MI)({name:"options",title:"Options",type:"array",description:"List of downloadable options (each must have Name + Mnemonic; Year optional).",of:[(0,eL.MI)({name:"option",type:"object",fields:[(0,eL.MI)({name:"name",title:"Name",type:"string",validation:e=>e.required().min(2)}),(0,eL.MI)({name:"mnemonic",title:"Mnemonic",type:"string",description:"Short identifier used in URLs / downloads.",validation:e=>e.required().min(2)}),(0,eL.MI)({name:"year",title:"Year (optional)",type:"number",validation:e=>e.min(1990).max(new Date().getFullYear()+1)})],preview:{select:{title:"name",subtitle:"mnemonic",year:"year"},prepare(e){let{title:t,subtitle:i,year:n}=e;
133return{title:t||"(Unnamed Option)",subtitle:[i,n].filter(Boolean).join(" ⢠")||void 0}}}})],validation:e=>e.required().min(1).custom(e=>{if(!Array.isArray(e))return"Options are required";let t=new Set;for(let i in e){let n=e[i];if(!n||"object"!=typeof n)return"Invalid option entry";let{name:a,mnemonic:r}=n;if(!a||!r)return"All options must have both Name and Mnemonic";let o=r.toLowerCase();if(t.has(o))return`Duplicate mnemonic: ${r}`;t.add(o)}return!0})})],preview:{select:{title:"name",order:"order",appType:"appType",options:"options"},prepare(e){let{title:t,order:i,options:n}=e,a=Array.isArray(n)?n.length:0,r=`${a} option${1===a?"":"s"}`,o=[];return"number"==typeof i&&o.push(String(i)),o.push(r),{title:t||"(Untitled Group)",subtitle:o.join(" ⢠")}}},orderings:[{title:"Order (Ascending)",name:"orderAsc",by:[{field:"appType",direction:"asc"},{field:"order",direction:"asc"}]}]}),ta=/^\d{6}$/;function tr(e){if("string"!=typeof e)return null;let t=e.trim();if(!t)return null;if(ta.test(t))return t;if(!/^\d+$/.test(t))return null;let i=Number.parseInt(t,10);return!Number.isInteger(i)||i<1?null:String(i).padStart(6,"0")}async function to(e,t){let i=`drafts.${t}`,n=await e.fetch(`coalesce( 134 *[_type == "article" && _id == $baseId][0]{ 135 "legacyGroupId": coalesce(__i18n_base._ref, _id) 136 }, 137 *[_type == "article" && _id == $draftId][0]{ 138 "legacyGroupId": coalesce(__i18n_base._ref, $baseId) 139 } 140 )`,{baseId:t,draftId:i}),a=String(n?.legacyGroupId||t),r=Array.from(new Set([t,i,a,`drafts.${a}`]));return tr(await e.fetch(`*[_type == "article" && defined(articleNumber) && ( 141 _id in $seedIds 142 || __i18n_base._ref == $legacyGroupId 143 || _id in coalesce( 144 *[_type == "translation.metadata" && (references($baseId) || references($legacyGroupId))][0].translations[].value._ref, 145 [] 146 ) 147 )] | order(articleNumber asc)[0].articleNumber`,{seedIds:r,baseId:t,legacyGroupId:a}))}async function tl(e){let t=tr(await e.fetch('*[_type == "article" && defined(articleNumber)] | order(articleNumber desc)[0].articleNumber')),i=t?Number.parseInt(t,10):0;for(;;){let t=i+1,n=String(t).padStart(6,"0");if(!await e.fetch('count(*[_type == "article" && articleNumber == $candidate]) > 0',{candidate:n}))return n;i=t}}let ts={loading:!0,error:null,source:"none",variants:[],candidateVariants:[]};function td(e){return e.startsWith("drafts.")?e.slice(7):e}function tu(e){let t=new Map;for(let i of e){let e=td(i._id),n=t.get(e)||[];n.push(i),t.set(e,n)}let i=[];for(let[e,n]of t.entries()){let t=n.find(e=>e._id.startsWith("drafts."))||n[0];if(!t)continue;let a=String(t.language||"").trim(),r=e4(a)||a||"Unknown language";i.push({id:t._id,baseId:e,title:function(e){if("string"==typeof e&&e.trim())return e.trim();if(Array.isArray(e)){let t=e.map(e=>Array.isArray(e?.children)?e.children.map(e=>"string"==typeof e?.text?e.text:"").join(""):"").join(" ").trim();if(t)return t}return"(Untitled Article)"}(t.title),languageCode:a,languageLabel:r,slug:t.slug?.current||"",archived:n.some(e=>!0===e.archived),hasDraft:n.some(e=>e._id.startsWith("drafts.")),updatedAt:t._updatedAt})}return i.sort((e,t)=>{let i=e.languageLabel.localeCompare(t.languageLabel);if(0!==i)return i;let n=e.updatedAt?Date.parse(e.updatedAt):0;return(t.updatedAt?Date.parse(t.updatedAt):0)-n}),i}async function tc(e,t){let i=Array.from(new Set(t.filter(Boolean)));if(0===i.length)return[];let n=i.flatMap(e=>[e,`drafts.${e}`]);return tu(await e.fetch(`*[_type == "article" && _id in $ids]{ 148 _id, 149 _updatedAt, 150 archived, 151 slug, 152 title, 153 "language": coalesce(language, __i18n_lang) 154 }`,{ids:n}))}function tp(e){if(!e)return"";let t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"2-digit"}).format(new Date(t)):""}function tm(e){return(0,o.jsx)(w.p,{space:2,children:e.map(e=>(0,o.jsx)(w.R,{padding:2,radius:2,border:!0,children:(0,o.jsxs)(w.H,{align:"flex-start",justify:"space-between",gap:2,children:[(0,o.jsxs)(w.p,{space:1,children:[(0,o.jsx)(w.U,{size:1,weight:"semibold",children:e.languageLabel}),(0,o.jsx)(w.U,{size:1,children:e.title}),(0,o.jsxs)(w.U,{size:1,muted:!0,children:[e.slug?`/${e.slug}`:"No slug",tp(e.updatedAt)?` - Updated ${tp(e.updatedAt)}`:""]})]}),(0,o.jsxs)(w.H,{gap:1,children:[e.hasDraft?(0,o.jsx)(x.Ex,{tone:"primary",children:"Draft"}):null,e.archived?(0,o.jsx)(x.Ex,{tone:"critical",children:"Archived"}):null]})]})},e.baseId))})}let tf=(0,eL.U8)({name:"article",title:"Article",type:"document",icon:U.A,initialValue:{__i18n_lang:"en",textDirection:"auto"},validation:e=>e.custom(e=>e?.archived?"Cannot publish while archived. Unarchive first.":!!e?.__i18n_lang||!!e?.language||"Language is required (set Language in translation controls)."),groups:[{name:"content",title:"Content",default:!0},{name:"properties",title:"Properties"}],fields:[{name:"language",title:"Legacy Language",type:"string",hidden:!0,readOnly:!0,group:"properties"},{name:"textDirection",title:"Text Direction",type:"string",description:"Automatic uses the article language. Choose an override only when the language metadata does not match the writing direction.",initialValue:"auto",options:{layout:"radio",list:[{title:"Automatic",value:"auto"},{title:"Left to right (LTR)",value:"ltr"},{title:"Right to left (RTL)",value:"rtl"}]},validation:e=>e.required(),group:"properties",readOnly:({document:e})=>!!e?.archived},{name:"articleNumber",title:"Article Number",type:"string",readOnly:!0,group:"properties",components:{input:function(e){let{value:t,onChange:i,elementProps:n}=e,a=(0,f.tH7)({apiVersion:"2025-02-19"}),r=(0,f.FlV)(["_id"]),l=(0,S.useMemo)(()=>"string"==typeof r?r.startsWith("drafts.")?r.slice(7):r:"",[r]),s=tr("string"==typeof t?t:null),d=(0,S.useRef)(!1),[u,c]=(0,S.useState)(!1),[p,m]=(0,S.useState)(null);return(0,S.useEffect)(()=>
154{!l||s||d.current||(d.current=!0,c(!0),m(null),(async()=>{try{let e=await to(a,l)||await tl(a);i((0,f.hZp)(e))}catch(e){m(e instanceof Error?e.message:"Failed to assign article number.")}finally{d.current=!1,c(!1)}})())},[l,a,s,i]),(0,o.jsxs)(w.p,{space:2,children:[(0,o.jsx)(w.f,{...n,dir:"ltr",readOnly:!0,value:s||"",placeholder:l?"Auto-assigning article number...":"Save to assign"}),u?(0,o.jsxs)(w.H,{align:"center",gap:2,children:[(0,o.jsx)(w.V,{muted:!0}),(0,o.jsx)(w.U,{size:1,muted:!0,children:"Assigning internal article number..."})]}):null,p?(0,o.jsx)(w.U,{size:1,muted:!0,children:p}):null,(0,o.jsx)(w.U,{size:1,muted:!0,children:"Internal identifier only. Not shown on the public site."})]})}},validation:e=>e.required().regex(/^\d{6}$/).error("Article number must be exactly 6 digits."),description:"Internal-only article identifier shared by all language variants."},{name:"title",title:"Title",type:"array",of:[e6,{type:"table"}],validation:e=>e.required(),group:"content",readOnly:({document:e})=>!!e?.archived},{name:"slug",title:"Slug",type:"slug",description:"Auto-generated from the title.",options:{source:e=>Array.isArray(e.title)?e.title.map(e=>e.children?e.children.map(e=>e.text).join(""):"").join(" ").trim():"",maxLength:96,slugify:e=>N(e,96),isUnique:void 0},validation:e=>e.required().error("Slug is required."),group:"properties",readOnly:({document:e})=>!!e?.archived},{name:"description",title:"Description",type:"array",of:[e6,{type:"table"}],group:"content",readOnly:({document:e})=>!!e?.archived},{name:"keywords",title:"SEO Keywords",description:"Optional terms used in article metadata for search engines. Add one keyword or phrase per tag.",type:"array",of:[{type:"string"}],options:{layout:"tags"},group:"properties",readOnly:({document:e})=>!!e?.archived,validation:e=>e.unique().custom(e=>!e||(Array.isArray(e)?!e.some(e=>"string"!=typeof e||!e.trim())||"Keywords cannot contain empty values.":"Keywords must be a list."))},{name:"content",title:"Content",type:"array",of:[e6,{type:"table"}],group:"content",readOnly:({document:e})=>!!e?.archived},{name:"mediaAsset",title:"Media Asset",type:"object",group:"content",fields:[...eY.fields],readOnly:({document:e})=>!!e?.archived},{name:"archived",title:"Archived",type:"boolean",hidden:!0,initialValue:!1,group:"properties"},{name:"archivedAt",title:"Archived At",type:"datetime",hidden:!0,group:"properties"},{name:"translationConnections",title:"Translation Connections",type:"string",readOnly:!0,group:"properties",components:{input:function(e){let t=(0,f.tH7)({apiVersion:"2025-02-19"}),i=(0,f.FlV)(["_id"]),n=(0,f.FlV)(["slug","current"]),a=(0,S.useMemo)(()=>"string"==typeof i?td(i):"",[i]),[r,l]=(0,S.useState)(ts);if((0,S.useEffect)(()=>{let e=!1;return(async()=>{if(!a)return l({loading:!1,error:null,source:"none",variants:[],candidateVariants:[]});l(e=>({...e,loading:!0,error:null}));try{let i=await t.fetch(`*[_type == "translation.metadata" && references($baseId)][0]{ 155 _id, 156 "refs": coalesce(translations[].value._ref, []) 157 }`,{baseId:a});if(i?.refs&&i.refs.length>0){let n=Array.from(new Set([a,...i.refs])),r=await tc(t,n);if(e)return;l({loading:!1,error:null,source:"metadata",groupId:i._id,variants:r,candidateVariants:[]});return}let r=await t.fetch(`coalesce( 158 *[_type == "article" && _id == $baseId][0]{ 159 "legacyGroupId": coalesce(__i18n_base._ref, _id) 160 }, 161 *[_type == "article" && _id == $draftId][0]{ 162 "legacyGroupId": coalesce(__i18n_base._ref, $baseId) 163 } 164 )`,{baseId:a,draftId:`drafts.${a}`}),o=String(r?.legacyGroupId||"").trim();if(o){let i=await t.fetch(`*[_type == "article" && ( 165 __i18n_base._ref == $legacyGroupId || 166 _id in $groupIds 167 )]{ 168 _id, 169 _updatedAt, 170 archived, 171 slug, 172 title, 173 "language": coalesce(language, __i18n_lang) 174 }`,{legacyGroupId:o,groupIds:[o,`drafts.${o}`]}),n=tu(i);if(n.length>1){if(e)return;l({loading:!1,error:null,source:"legacy",groupId:o,variants:n,candidateVariants:[]});return}}let s=[];if(n&&n.trim()){let e=await t.fetch(`*[_type == "article" && slug.current == $slug && !(_id in $excludeIds)]{ 175 _id, 176 _updatedAt, 177 archived, 178 slug, 179 title, 180 "language": coalesce(language, __i18n_lang) 181 }`,{slug:n.trim(),excludeIds:[a,`drafts.${a}`]});s=tu(e)}let d=await tc(t,[a]);if(e)return;l({loading:!1,error:null,source:"none",variants:d,candidateVariants:s})}catch(t){if(e)return;l({loading:!1,error:t instanceof Error?t.message:"Failed to load translations.",source:"none",variants:[],candidateVariants:[]})}})(),()=>{e=!0}},[a,t,n]),!a)return(0,o.jsx)(w.R,{padding:3,radius:2,tone:"caution",border:!0,children:(0,o.jsx)(w.U,{size:1,children:"Save this article first to view translation links."})});if(r.loading)return(0,o.jsx)(w.R,{padding:3,radius:2,border:!0,children:(0,o.jsxs)(w.H,{align:"center",gap:2,children:[(0,o.jsx)(w.V,{muted:!0}
181),(0,o.jsx)(w.U,{size:1,children:"Loading translation connections..."})]})});if(r.error)return(0,o.jsx)(w.R,{padding:3,radius:2,tone:"critical",border:!0,children:(0,o.jsxs)(w.U,{size:1,children:["Unable to load translation links: ",r.error]})});let s=r.variants.length,d=s>1;return(0,o.jsxs)(w.p,{space:3,children:[(0,o.jsx)(w.R,{padding:3,radius:2,border:!0,tone:d?"positive":r.candidateVariants.length>0?"caution":"default",children:(0,o.jsxs)(w.p,{space:2,children:[(0,o.jsx)(w.U,{size:1,weight:"semibold",children:d?`Linked Languages (${s})`:"Linked Languages (1)"}),(0,o.jsx)(w.U,{size:1,children:"metadata"===r.source?"Connected by translation metadata.":"legacy"===r.source?"Connected by legacy grouping. Consider using Manage translations to create metadata links.":"No translation group found yet."}),r.groupId?(0,o.jsxs)(w.U,{size:1,muted:!0,children:["Group ID: ",r.groupId]}):null]})}),r.variants.length>0?tm(r.variants):null,r.candidateVariants.length>0?(0,o.jsx)(w.R,{padding:3,radius:2,tone:"caution",border:!0,children:(0,o.jsxs)(w.p,{space:2,children:[(0,o.jsx)(w.U,{size:1,weight:"semibold",children:"Possible Unlinked Variants"}),(0,o.jsx)(w.U,{size:1,children:"Matching slugs were found in other languages, but they are not connected in translation metadata. Open Manage translations to link them."}),tm(r.candidateVariants)]})}):null]})}},description:"Shows linked language variants for this article and flags unlinked matches."}],preview:{select:{title:"title",sourceType:"mediaAsset.sourceType",sanityImage:"mediaAsset.sanityImage",jwcdnFile:"mediaAsset.jwcdnFile",externalUrl:"mediaAsset.externalUrl",mediaAsset:"mediaAsset",articleNumber:"articleNumber",i18n_lang:"__i18n_lang",legacyLang:"language"},prepare(e){let t,i="",{title:n,mediaAsset:a}=e,r=i;a&&"string"==typeof a.alt&&a.alt.trim()&&(r=a.alt.trim()),Array.isArray(n)?i=n.map(e=>e.children?e.children.map(e=>e.text).join(""):"").join(" ").trim():"string"==typeof n&&(i=n);let o=e8({i18n_lang:e.i18n_lang,legacyLang:e.legacyLang}),l=e.articleNumber,s="string"==typeof l?l:"",d=/^\d+$/.test(s)?s.padStart(6,"0"):"",u=[];return o&&u.push(o),d&&u.push(`#${d}`),a&&(a.cdnUrl?t=S.createElement("img",{src:a.cdnUrl,alt:r,style:{objectFit:"cover",width:"100%",height:"100%"}}):a.file&&a.file.asset&&a.file.asset._ref?t=void 0:a.url&&(t=S.createElement("img",{src:a.url,alt:r,style:{objectFit:"cover",width:"100%",height:"100%"}}))),{title:i||"(Untitled Article)",subtitle:u.length>0?u.join(" ⢠"):void 0,media:t||U.A}}}}),th=(0,eL.U8)({name:"audioLibrary",title:"Audio Asset",type:"document",icon:v.udU,fields:[(0,eL.MI)({name:"audioUrl",title:"Audio Upload",type:"string",components:{input:function(e){let t={...e,options:{accept:"audio/*",domain:"cms",fileType:"a"}};return(0,o.jsx)(eR,{...t})}},validation:e=>e.required(),description:"Upload audio via S3 (restricted to audio MIME types)."}),(0,eL.MI)({name:"title",title:"Title (Optional)",type:"string",validation:e=>e.max(120),description:"Optional label; auto-filled from filename if left blank (feature pending)."}),(0,eL.MI)({name:"usageContext",title:"Intended Usage / Context (Optional)",type:"text",rows:3,description:"Describe where this audio is used (outside of Studio)."}),(0,eL.MI)({name:"tags",title:"Tags (Optional)",type:"tags",options:{allowCreate:!0},description:"Group audio for easier bulk management (for example: intro, promo, meeting)."}),(0,eL.MI)({name:"opt",title:"Media Metadata",type:"object",hidden:!0,readOnly:!0,fields:[(0,eL.MI)({name:"media",title:"Media",type:"object",hidden:!0,readOnly:!0,fields:[(0,eL.MI)({name:"tags",title:"Media Browser Tags",type:"array",of:[(0,eL.dO)({type:"reference",to:[{type:"media.tag"}],weak:!0})]})]})]}),(0,eL.MI)({name:"archived",title:"Archived",type:"boolean",hidden:!0,readOnly:!0,description:"Managed by Archive/Unarchive actions."}),(0,eL.MI)({name:"archivedAt",title:"Archived At",type:"datetime",hidden:!0,readOnly:!0,description:"Timestamp set when document is archived."})],preview:{select:{title:"title",audioUrl:"audioUrl",usageContext:"usageContext",tags:"tags"},prepare(e){let{title:t,audioUrl:i,usageContext:n,tags:a}=e,r="Untitled Audio";!t&&i&&(r=(0,A.V)(String(i)).replace(/\.[a-z0-9]+$/iu,"")||r);let o=Array.isArray(a)?a.map(e=>{if("string"==typeof e)return e.trim();if(e&&"object"==typeof e){let t=e.label,i=e.value;if("string"==typeof t)return t.trim();if("string"==typeof i)return i.trim()}return""}
181).filter(Boolean).slice(0,3).join(", "):"";return{title:t||r,subtitle:n?n.slice(0,80):o||void 0}}}});function ty(e){return e.trim().replace(/^\/+|\/+$/g,"").replace(/\/{2,}/g,"/").toLowerCase()}function tg(e){if("string"!=typeof e)return null;let t=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!t)return null;let i=Number.parseInt(t[1]??"0",10),n=Number.parseInt(t[2]??"0",10),a=Number.parseInt(t[3]??"0",10);if(n<1||n>12||a<1||a>31)return null;let r=new Date(Date.UTC(i,n-1,a));return r.getUTCFullYear()!==i||r.getUTCMonth()!==n-1||r.getUTCDate()!==a?null:r}function tb(e){let t=e.trim().toUpperCase().match(tv);if(!t)return null;let i=Number.parseInt(t[1]??"0",10),n=Number.parseInt(t[2]??"0",10),a=(t[3]??"AM").toUpperCase();return i<1||i>12||n<0||n>59?null:60*(i%12+12*("PM"===a))+n}let tv=/^(0?[1-9]|1[0-2]):([0-5]\d)\s?(AM|PM)$/i,tw=/^[a-z0-9]+(?:[/-][a-z0-9]+)*$/i,tx=function(){let e=[];for(let t=0;t<1440;t+=5){let i=Math.floor(t/60),n=t%60,a=i>=12?"PM":"AM",r=i%12==0?12:i%12,o=`${r}:${n.toString().padStart(2,"0")} ${a}`;e.push({title:o,value:o})}return e}(),tS=("function"==typeof Intl.supportedValuesOf?Intl.supportedValuesOf("timeZone"):["UTC","America/New_York"]).map(e=>({title:e.replaceAll("_"," "),value:e})),tI=(0,eL.U8)({name:"countdown",title:"Countdown",type:"document",icon:v.O4,validation:e=>e.custom(e=>{if(e?.eventMode!=="continuous")return!0;let t=e.continuousTitleTokenType;if("none"!==t&&"number"!==t&&"year"!==t)return"Select Continuous Title Value: None, Number, or Year";if(("number"===t||"year"===t)&&"prefix"!==e.continuousTitleTokenPosition&&"suffix"!==e.continuousTitleTokenPosition)return"Continuous Title Position is required when Number or Year is selected";if("number"===t&&("number"!=typeof e.continuousTitleStartNumber||!Number.isInteger(e.continuousTitleStartNumber)||e.continuousTitleStartNumber<1))return"Continuous Title Starting Number is required when Number is selected";if("daily"!==e.recurrence){if("date"!==e.recurrenceAnchorType&&"dayOfWeek"!==e.recurrenceAnchorType)return"Recurrence Basis is required for non-daily continuous events";if("dayOfWeek"===e.recurrenceAnchorType){if("first"!==e.recurrenceWeekOfMonth&&"second"!==e.recurrenceWeekOfMonth&&"third"!==e.recurrenceWeekOfMonth&&"fourth"!==e.recurrenceWeekOfMonth&&"last"!==e.recurrenceWeekOfMonth)return"Week Position is required when recurrence basis is Day Pattern";if("sunday"!==e.recurrenceWeekday&&"monday"!==e.recurrenceWeekday&&"tuesday"!==e.recurrenceWeekday&&"wednesday"!==e.recurrenceWeekday&&"thursday"!==e.recurrenceWeekday&&"friday"!==e.recurrenceWeekday&&"saturday"!==e.recurrenceWeekday)return"Weekday is required when recurrence basis is Day Pattern"}}return!0}),fieldsets:[{name:"eventDates",title:"Event Dates",options:{columns:1}},{name:"eventTiming",title:"Event Times & Time Zone",options:{columns:1}},{name:"eventSchedule",title:"Event Schedule",options:{columns:1}},{name:"eventWatch",title:"Event Watch",options:{columns:1}}],fields:[(0,eL.MI)({name:"eventSlug",title:"Event Slug",description:"URL segment after /cd/ (example: am or annual-meeting). Use lowercase letters/numbers with dashes; do not include /cd/.",type:"string",validation:e=>e.required().custom(e=>{if("string"!=typeof e)return"Event slug is required";let t=ty(e);return t?e!==t?"Use lowercase slug format without leading/trailing slashes or spaces":t.startsWith("cd/")?"Enter only the slug (for example: am), not /cd/.":t.includes(" ")?"Event slug cannot contain spaces":!!tw.test(t)||"Use letters, numbers, dashes, and optional nested slashes only":"Event slug is required"}).custom(async(e,t)=>{if("string"!=typeof e)return!0;let i=ty(e);if(!i)return!0;let{document:n,getClient:a}=t,r=n?._id?.replace(/^drafts\./,""),o=a({apiVersion:"2023-01-01"});return!(await o.fetch('*[_type == "countdown"]{_id, eventSlug, path}')).some(e=>{let t=e._id?.replace(/^drafts\./,"");return(!r||t!==r)&&ty(e.eventSlug??e.path?.replace(/^\/?cd\//i,"")??"")===i})||"This event slug is already used by another countdown"}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"title",title:"Event Title",description:"Main heading shown on the countdown page. Supports rich text and multiple lines.",type:"array",of:[e6,{type:"table"}],validation:e=>e.required().min(1),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"eventMode",title:"Event Mode",description:"Single Event runs one time. Continuous Event automatically schedules the next occurrence.",type:"string",fieldset:"eventSchedule",initialValue:"single",options:{list:[{title:"Single Event",value:"single"},{title:"Continuous Event",value:"continuous"}],layout:"radio"},validation:e=>e.required(),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"recurrence",title:"Recurrence",description:"How often the event repeats in Continuous mode (daily, monthly, quarterly, annually, etc.).",type:"string",fieldset:"eventSchedule",options:{list:[{title:"Daily",value:"daily"},{title:"Monthly",value:"monthly"},{title:"Bi-Monthly",value:"bi-monthly"},{title:"Quarterly",value:"quarterly"},{title:"Annually",value:"annually"}]},hidden:({document:e})=>e?.eventMode!=="continuous",validation:e=>e.custom((e,t)=>
181{let i=t.document;return i?.eventMode!=="continuous"||"string"==typeof e&&e.length>0||"Recurrence is required for continuous events"}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"recurrenceAnchorType",title:"Recurrence Basis",description:"By Date keeps the same day-of-month. By Day Pattern uses week position + weekday (for example, first Saturday).",type:"string",fieldset:"eventSchedule",initialValue:"date",options:{list:[{title:"By Date (same day-of-month)",value:"date"},{title:"By Day Pattern (first Saturday, third Friday, etc.)",value:"dayOfWeek"}],layout:"radio"},hidden:({document:e})=>e?.eventMode!=="continuous"||e?.recurrence==="daily",validation:e=>e.custom((e,t)=>{let i=t.document;return i?.eventMode!=="continuous"||i?.recurrence==="daily"||"date"===e||"dayOfWeek"===e||"Recurrence Basis is required for non-daily continuous events"}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"recurrenceWeekOfMonth",title:"Week Position",description:"Used only for Day Pattern recurrence. Choose which week occurrence in the month (First, Second, Third, Fourth, Last).",type:"string",fieldset:"eventSchedule",options:{list:[{title:"First",value:"first"},{title:"Second",value:"second"},{title:"Third",value:"third"},{title:"Fourth",value:"fourth"},{title:"Last",value:"last"}],layout:"dropdown"},hidden:({document:e})=>e?.eventMode!=="continuous"||e?.recurrence==="daily"||e?.recurrenceAnchorType!=="dayOfWeek",validation:e=>e.custom((e,t)=>{let i=t.document;return i?.eventMode!=="continuous"||i?.recurrence==="daily"||i?.recurrenceAnchorType!=="dayOfWeek"||"first"===e||"second"===e||"third"===e||"fourth"===e||"last"===e||"Week Position is required when recurrence basis is Day Pattern"}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"recurrenceWeekday",title:"Weekday",description:"Used only for Day Pattern recurrence. Choose the weekday for the repeating event.",type:"string",fieldset:"eventSchedule",options:{list:[{title:"Sunday",value:"sunday"},{title:"Monday",value:"monday"},{title:"Tuesday",value:"tuesday"},{title:"Wednesday",value:"wednesday"},{title:"Thursday",value:"thursday"},{title:"Friday",value:"friday"},{title:"Saturday",value:"saturday"}],layout:"dropdown"},hidden:({document:e})=>e?.eventMode!=="continuous"||e?.recurrence==="daily"||e?.recurrenceAnchorType!=="dayOfWeek",validation:e=>e.custom((e,t)=>{let i=t.document;return i?.eventMode!=="continuous"||i?.recurrence==="daily"||i?.recurrenceAnchorType!=="dayOfWeek"||"sunday"===e||"monday"===e||"tuesday"===e||"wednesday"===e||"thursday"===e||"friday"===e||"saturday"===e||"Weekday is required when recurrence basis is Day Pattern"}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"continuousTitleTokenType",title:"Continuous Title Value",description:"Choose what dynamic value is added to the title for Continuous events: None, Number, or Year.",type:"string",fieldset:"eventSchedule",initialValue:"none",options:{list:[{title:"None",value:"none"},{title:"Number (141st, 142nd, ...)",value:"number"},{title:"Year (2026, 2027, ...)",value:"year"}],layout:"radio"},hidden:({document:e})=>e?.eventMode!=="continuous",validation:e=>e.custom((e,t)=>{let i=t.document;return i?.eventMode!=="continuous"||"none"===e||"number"===e||"year"===e||"Continuous Title Value is required: choose None, Number, or Year"}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"continuousTitleStartNumber",title:"Continuous Title Starting Number",description:"Used when Continuous Title Value is Number. This is the number for the first occurrence (for example, 141 -> 141st).",type:"number",fieldset:"eventSchedule",hidden:({document:e})=>e?.eventMode!=="continuous"||e?.continuousTitleTokenType!=="number",validation:e=>e.integer().min(1).custom((e,t)=>{let i=t.document;return i?.eventMode!=="continuous"||i?.continuousTitleTokenType!=="number"||!!("number"==typeof e&&Number.isInteger(e))||"Starting number is required for Number title value"}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"continuousTitleTokenPosition",title:"Continuous Title Position",description:"Where the Number/Year appears in the title: before the title (Prefix) or after it (Suffix).",type:"string",fieldset:"eventSchedule",options:{list:[{title:"Prefix",value:"prefix"},{title:"Suffix",value:"suffix"}],layout:"radio"},hidden:({document:e})=>e?.eventMode!=="continuous"||e?.continuousTitleTokenType!=="number"&&e?.continuousTitleTokenType!=="year",validation:e=>e.custom((e,t)=>
181{let i=t.document;return i?.eventMode!=="continuous"||i?.continuousTitleTokenType!=="number"&&i?.continuousTitleTokenType!=="year"||"prefix"===e||"suffix"===e||"Choose Prefix or Suffix for continuous title position"}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"eventDate",title:"Event Date",description:"Start date for the event. For Continuous events, this is the anchor date/month used to calculate future occurrences.",type:"date",fieldset:"eventDates",validation:e=>e.required().custom((e,t)=>{let i;if("string"!=typeof e)return"Event date is required";let n=tg(e);if(!n)return"Enter a valid event date";let a=t.document;if(a?.eventMode!=="continuous"||a?.recurrence==="daily"||a?.recurrenceAnchorType!=="dayOfWeek")return!0;let r="first"===a.recurrenceWeekOfMonth||"second"===a.recurrenceWeekOfMonth||"third"===a.recurrenceWeekOfMonth||"fourth"===a.recurrenceWeekOfMonth||"last"===a.recurrenceWeekOfMonth?a.recurrenceWeekOfMonth:null,o="sunday"===a.recurrenceWeekday||"monday"===a.recurrenceWeekday||"tuesday"===a.recurrenceWeekday||"wednesday"===a.recurrenceWeekday||"thursday"===a.recurrenceWeekday||"friday"===a.recurrenceWeekday||"saturday"===a.recurrenceWeekday?a.recurrenceWeekday:null;return!r||!o||((0===(i=n.getUTCDay())?"sunday":1===i?"monday":2===i?"tuesday":3===i?"wednesday":4===i?"thursday":5===i?"friday":"saturday")!==o?"Event date must match the selected weekday for Day Pattern recurrence":!!function(e,t){if("last"===t)return"last"===function(e){let t=e.getUTCDate();if(t+7>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0)).getUTCDate())return"last";let i=Math.floor((t-1)/7)+1;return 1===i?"first":2===i?"second":3===i?"third":"fourth"}(e);let i=Math.floor((e.getUTCDate()-1)/7)+1;return"first"===t&&1===i||"second"===t&&2===i||"third"===t&&3===i||"fourth"===t&&4===i}(n,r)||"Event date must match the selected week position for Day Pattern recurrence")}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"useCustomEventEndDate",title:"Set Event End Date Manually",description:"Enable if the event ends on a different date than it starts (for example, next day).",type:"boolean",fieldset:"eventDates",initialValue:!1,readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"eventEndDate",title:"Event End Date",description:"Required only when manual end date is enabled. Must be the same day or later than Event Date.",type:"date",fieldset:"eventDates",hidden:({document:e})=>!e?.useCustomEventEndDate,validation:e=>e.custom((e,t)=>{let i=t.document;if(!i?.useCustomEventEndDate)return!0;if("string"!=typeof e)return"Event end date is required when manual end date is enabled";let n=tg(i.eventDate),a=tg(e);return a?!(n&&a.getTime()<n.getTime())||"Event end date cannot be before event date":"Enter a valid event end date"}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"eventStartTime",title:"Event Start Time",description:"Start time in 12-hour format. Select from the list (for example, 9:45 AM).",type:"string",fieldset:"eventTiming",options:{list:tx,layout:"dropdown"},validation:e=>e.required().custom(e=>"string"==typeof e&&!!tv.test(e.trim())||"Use 12-hour format with AM/PM (example: 9:45 AM)"),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"eventEndTime",title:"Event End Time",description:"End time in 12-hour format. If it is earlier than the start time, set a manual Event End Date.",type:"string",fieldset:"eventTiming",options:{list:tx,layout:"dropdown"},validation:e=>e.required().custom((e,t)=>{if("string"!=typeof e||!tv.test(e.trim()))return"Use 12-hour format with AM/PM (example: 1:30 PM)";let i=t.document,n="string"==typeof i?.eventStartTime?tb(i.eventStartTime):null,a=tb(e);if(null===n||null===a)return!0;let r=!!i?.useCustomEventEndDate,o=tg(i?.eventDate),l=r?tg(i?.eventEndDate):o;return r?l?o&&l.getTime()<o.getTime()?"Event end date cannot be before event date":!o||l.getTime()!==o.getTime()||!(a<n)||"Event end time cannot be before event start time when start and end dates are the same":"Event end date is required when manual end date is enabled":!(a<n)||"Event end time cannot be before event start time unless an event end date is set"}),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"eventTimeZone",title:"Event Time Zone",description:"IANA time zone used for event scheduling and display (for example, America/Ne
181w_York).",type:"string",fieldset:"eventTiming",options:{list:tS,layout:"dropdown"},validation:e=>e.required().custom(e=>"string"==typeof e&&e.trim()?!!function(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}(e.trim())||"Enter a valid IANA time zone":"Event time zone is required"),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"watchNowUrl",title:"Event Watch Online URL",description:"Optional live/replay URL opened by Watch Now/Watch Replay buttons on the countdown page.",type:"url",fieldset:"eventWatch",readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"showInvitationRequiredNote",title:"Show 'Invitation required.' note",description:"Optional note shown under Watch Now/Watch Replay buttons. Leave unchecked to hide it.",type:"boolean",fieldset:"eventWatch",initialValue:!1,hidden:({document:e})=>!("string"==typeof e?.watchNowUrl?e.watchNowUrl.trim():""),readOnly:({document:e})=>!!e?.archived}),(0,eL.MI)({name:"archived",title:"Archived",type:"boolean",hidden:!0,initialValue:!1}),(0,eL.MI)({name:"archivedAt",title:"Archived At",type:"datetime",hidden:!0})],preview:{select:{title:"title",eventSlug:"eventSlug",eventMode:"eventMode",recurrence:"recurrence",eventDate:"eventDate",continuousTitleTokenType:"continuousTitleTokenType",continuousTitleTokenPosition:"continuousTitleTokenPosition",continuousTitleStartNumber:"continuousTitleStartNumber",eventStartTime:"eventStartTime",eventTimeZone:"eventTimeZone"},prepare(e){var t;let i=function(e,t){if("continuous"!==t.eventMode)return e;let i="number"===t.tokenType||"year"===t.tokenType?t.tokenType:null,n="prefix"===t.tokenPosition||"suffix"===t.tokenPosition?t.tokenPosition:null;if(!i||!n)return e;let a=null;if("number"===i){let e="number"==typeof t.tokenStartNumber?t.tokenStartNumber:null;"number"==typeof e&&Number.isInteger(e)&&e>=1&&(a=function(e){let t=Math.abs(e),i=t%100;if(i>=11&&i<=13)return`${e}th`;let n=t%10;return 1===n?`${e}st`:2===n?`${e}nd`:3===n?`${e}rd`:`${e}th`}(e))}if("year"===i){let e,i=(e=tg(t.eventDate))?e.getUTCFullYear():null;"number"==typeof i&&(a=String(i))}return a?"prefix"===n?`${a} ${e}`:`${e} ${a}`:e}((Array.isArray(t=e.title)?t.map(e=>{let t=e.children;return Array.isArray(t)?t.map(e=>e.text??"").join(""):""}).join(" ").trim():"")||"(Untitled Countdown)",{eventMode:e.eventMode,tokenType:e.continuousTitleTokenType,tokenPosition:e.continuousTitleTokenPosition,tokenStartNumber:e.continuousTitleStartNumber,eventDate:e.eventDate}),n="string"==typeof e.eventSlug?ty(e.eventSlug):"",a="string"==typeof e.eventDate?e.eventDate:"(no date)",r="string"==typeof e.eventStartTime?e.eventStartTime:"--:--",o="string"==typeof e.eventMode?e.eventMode:"single";return{title:i,subtitle:`${n||"(no slug)"} | ${"continuous"===o?"Continuous Event":"Single Event"} | ${a} ${r}`}}}}),tA=(0,eL.U8)({name:"hr",type:"object",title:"Horizontal Rule",fields:[{name:"invisible",type:"string",title:"Invisible",hidden:!0,readOnly:!0,initialValue:"hr"}],preview:{prepare:()=>({title:"â Horizontal Rule â"})}}),tk=(0,eL.U8)({name:"imageLibrary",title:"Image Asset",type:"document",icon:v.sYc,fields:[(0,eL.MI)({name:"imageUrl",title:"Image Upload",type:"string",components:{input:eV},validation:e=>e.required(),description:"Upload image via S3 (restricted to images)."}),(0,eL.MI)({name:"title",title:"Title (Optional)",type:"string",components:{input:function(e){let{onChange:t,value:i,elementProps:n,readOnly:a}=e,r=(0,f.FlV)(["imageUrl"]),[l,s]=(0,S.useState)(!1),d=r?(0,A.V)(r).replace(/\.[a-z0-9]+$/iu,""):"";return(0,S.useEffect)(()=>{l||i||!d||t((0,f.hZp)(d))},[l,i,d,t]),(0,o.jsx)(w.p,{space:2,children:(0,o.jsx)(w.f,{...n,dir:"auto",readOnly:a,value:i||"",onChange:e=>{let i=e.currentTarget.value;i?t((0,f.hZp)(i)):t((0,f.wCX)())},onBlur:()=>s(!0),placeholder:d||"Optional title"})})}},validation:e=>e.max(120),description:"Optional label; auto-filled from filename if left blank."}),(0,eL.MI)({name:"usageContext",title:"Intended Usage / Context (Optional)",type:"text",rows:3,description:"Describe where this image is used (outside of Studio)."}),(0,eL.MI)({name:"tags",title:"Tags (Optional)",type:"tags",options:{allowCreate:!0},description:"Group images for easier bulk management (for example: add
181on, hero, icons)."}),(0,eL.MI)({name:"opt",title:"Media Metadata",type:"object",hidden:!0,readOnly:!0,fields:[(0,eL.MI)({name:"media",title:"Media",type:"object",hidden:!0,readOnly:!0,fields:[(0,eL.MI)({name:"tags",title:"Media Browser Tags",type:"array",of:[(0,eL.dO)({type:"reference",to:[{type:"media.tag"}],weak:!0})]})]})]}),(0,eL.MI)({name:"archived",title:"Archived",type:"boolean",hidden:!0,readOnly:!0,description:"Managed by Archive/Unarchive actions."}),(0,eL.MI)({name:"archivedAt",title:"Archived At",type:"datetime",hidden:!0,readOnly:!0,description:"Timestamp set when document is archived."})],preview:{select:{title:"title",imageUrl:"imageUrl",usageContext:"usageContext",tags:"tags"},prepare(e){let{title:t,imageUrl:i,usageContext:n,tags:a}=e,r="Untitled Image";!t&&i&&(r=(0,A.V)(i).replace(/\.[a-z0-9]+$/iu,"")||r);let o=Array.isArray(a)?a.map(e=>{if("string"==typeof e)return e.trim();if(e&&"object"==typeof e){let t=e.label,i=e.value;if("string"==typeof t)return t.trim();if("string"==typeof i)return i.trim()}return""}).filter(Boolean).slice(0,3).join(", "):"";return{title:t||r,media:i?S.createElement("img",{src:i,style:{objectFit:"contain",maxHeight:40}}):S.createElement(v.xfq,{style:{width:32,height:32}}),subtitle:n?n.slice(0,80):o||void 0}}}});var tM=i(23606);let tC=(0,eL.U8)({name:"musicAlbum",title:"Music Album",type:"document",icon:j.A,initialValue:{__i18n_lang:"en"},groups:[{name:"songs",title:"Song List",default:!0},{name:"properties",title:"Album Properties"}],fields:[(0,eL.MI)({name:"title",title:"Album Title",description:"Enter the album title.",type:"string",validation:e=>e.required().min(2),group:"properties"}),(0,eL.MI)({name:"lyrics",title:"Lyrics",description:"Choose Inline or Link and provide lyrics accordingly.",type:"lyricsSource"}),(0,eL.MI)({name:"description",title:"Album Description",description:"Optional short description of this album.",type:"text",rows:3,group:"properties"}),(0,eL.MI)({name:"mnemonic",title:"Album Mnemonic",description:"Short, URL-friendly identifier used in the music page hash (e.g. 'sing-to-jehovah-1'). Must be unique per language.",type:"string",group:"properties",validation:e=>e.required().min(2).max(64).regex(/^[a-z0-9-]+$/i,"Only letters, numbers, and hyphens are allowed (no spaces).")}),(0,eL.MI)({name:"artwork",title:"Album Artwork",description:"Primary square artwork used for playback and sharing.",type:"imageSource",group:"properties"}),(0,eL.MI)({name:"banner",title:"Album Banner",description:"Wide banner used for the album listing grid. Optional; falls back to Album Artwork.",type:"imageSource",group:"properties"}),(0,eL.MI)({name:"releaseDate",title:"Album Release Date",description:"Defaults to the album's creation time; adjust to schedule a future release.",type:"datetime",initialValue:()=>new Date().toISOString(),group:"properties"}),(0,eL.MI)({name:"language",title:"Legacy Language (string)",type:"string",hidden:!0,readOnly:!0,group:"properties"}),(0,eL.MI)({name:"tracks",title:"Tracks",type:"array",description:"Add the songs that belong to this album. Tracks will appear in the order you specify.",group:"songs",initialValue:[],of:[(0,eL.MI)({name:"track",title:"Track",type:"object",icon:tM.A,fields:[(0,eL.MI)({name:"title",title:"Track Name",description:"The song title.",type:"string",validation:e=>e.required().min(1)}),(0,eL.MI)({name:"audio",title:"Audio File",description:"Provide the audio file (External URL, JW CDN, or Sanity File).",type:"audioSource",validation:e=>e.required()}),(0,eL.MI)({name:"lyrics",title:"Lyrics",description:"Choose Inline or Link and provide lyrics accordingly.",type:"lyricsSource"}),(0,eL.MI)({name:"trackNo",title:"Track #",description:"Display order within the album.",type:"number",validation:e=>e.required().integer().positive()}),(0,eL.MI)({name:"releaseDate",title:"Track Release Date",description:"Defaults to the track's creation time; adjust to schedule a future release.",type:"datetime",initialValue:()=>new Date().toISOString()})],preview:{select:{title:"title",trackNo:"trackNo"},prepare(e){let{title:t,trackNo:i}=e;return{title:t||"(Untitled Track)",subtitle:null!=i?`Track ${i}`:void 0,media:tM.A}}}})],validation:e=>e.custom(e=>{if(!Array.isArray(e))return!0;let t=new Set;for(let i of e){if(!i||"object"!=typeof i)continue;let e=i.trackNo;if("number"==typeof e){if(t.has(e))return`Duplicate track number: ${e}`;t.add(e)}}return!0})}),(0,eL.MI)({name:"archived",title:"Archived",type:"boolean",hidden:!0,initialValue:!1,group:"properties"}),(0,eL.MI)({name:"archivedAt",title:"Archived At",type:"datetime",hidden:!0,group:"properties"})],preview:{select:{title:"title",artworkCdn:"artwork.cdnUrl",artworkUrl:"artwork.url",artworkFile:"artwork.file.asset._ref",bannerCdn:"banner.cdnUrl",bannerUrl:"banner.url",releaseDate:"releaseDate",tracks:"tracks",i18n_lang:"__i18n_lang",legacyLang:"language"},prepare(e){let t,{title:i,artworkCdn:n,artworkUrl:a,releaseDate:r}=e,o=e.tracks;Array.isArray(o)&&(t=o.length);let l=e8({i18n_lang:e.i18n_lang,legacyLang:e.legacyLang}),s=[];if(r)try{s.push(new Date(r).toLocaleDateString())}catch{}null!=t&&s.push(`${t} song${1===t?"":"s"}`),l&&s.push(l);let d=s.length?s.join(" ⢠"):void 0,u=n||a;return{title:i||"(Untitled Album)",subtitle:d,media:u?S.createElement("img",{src:u,alt:i||"Album Artwork",style:{objectFit:"cover",width:"100%",height:"100%"}}):S.createElement(j.A)}}}}),tT=(0,eL.U8)({name:"musicTrack",title:"Music Track",type:"document",icon:tM.A,initialValue:{__i18n_lang:"en"},fields:[(0,eL.MI)({name:"title",title:"Track Name",description:"The song title.",type:"string",validation:e=>e.required().min(1)}),(0,eL.MI)({name:"trackNo",title:"Track #",description:"Display order within the album.",type:"number",validation:e=>e.required().integer().positive()}),(0,eL.MI)({name:"album",title:"Album",description:"Select the album this track belongs to.",type:"reference",to:[{type:"musicAlbum"}],validation:e=>e.required()}),(0,eL.MI)({name:"audio",title:"Audio File",description:"Provide the audio file (External URL, JW CDN, or Sanity File).",type:"audioSource",validation:e=>e.required()}),(0,eL.MI)({name:"lyrics",title:"Lyrics",description:"Choose Inline or Link and provide lyrics accordingly.",type:"lyricsSource"}),(0,eL.MI)({name:"releaseDate",title:"Track Release Date",description:"Defaults to the track's creation time; adjust to schedule a future release.",type:"datetime",initialValue:()=>new Date().toISOString()}),(0,eL.MI)({name:"archived",title:"Archived",type:"boolean",hidden:!0,initialValue:!1}),(0,eL.MI)({name:"archivedAt",title:"Archived At",type:"datetime",hidden:!0})],preview:{select:{title:"title",trackNo:"trackNo",albumTitle:"album.title"},prepare(e){let{title:t,trackNo:i,albumTitle:n}=e;return{title:t||"(Untitled Track)",subtitle:[n,null!=i?`Track ${i}
181`:void 0].filter(Boolean).join(" ⢠"),media:tM.A}}},orderings:[{title:"Track # (Asc)",name:"trackAsc",by:[{field:"trackNo",direction:"asc"}]},{title:"Track # (Desc)",name:"trackDesc",by:[{field:"trackNo",direction:"desc"}]},{title:"Title A â Z",name:"titleAsc",by:[{field:"title",direction:"asc"}]}]}),tU=(0,eL.U8)({name:"publicationCategory",title:"Publication Category",type:"document",icon:D.A,fields:[(0,eL.MI)({name:"categoryName",title:"Category Name",type:"string",validation:e=>e.required().min(2)}),(0,eL.MI)({name:"order",title:"Display Order",description:"Lower numbers appear first.",type:"number",initialValue:100,validation:e=>e.integer().min(0)}),(0,eL.MI)({name:"items",title:"Publication Items",type:"array",of:[(0,eL.MI)({name:"item",title:"Publication Item",type:"object",fields:[(0,eL.MI)({name:"title",title:"Title",type:"string",validation:e=>e.required().min(2)}),(0,eL.MI)({name:"titleLink",title:"Title Link",description:"Where title text should navigate (supports relative paths, hash links, and full URLs).",type:"string",validation:e=>e.custom(e=>!("string"==typeof e&&e.trim())||!!(e=>{let t=e.trim();if(!t)return!1;if(t.startsWith("/")||t.startsWith("#")||t.startsWith("mailto:")||t.startsWith("tel:")||/^jwlibrary:\/\//i.test(t))return!0;if(/^https?:\/\//i.test(t))try{let e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol}catch{}return!1})(e)||"Enter a valid link starting with https://, jwlibrary://, /, #, mailto:, or tel:.")}),(0,eL.MI)({name:"year",title:"Year",type:"number",validation:e=>e.required().integer().min(1900)}),(0,eL.MI)({name:"posterImage",title:"Poster Image",type:"imageUploadOrLinkSource",description:"Choose poster source: external link or file upload."}),(0,eL.MI)({name:"posterImageLink",title:"Poster Image Link (Legacy)",type:"string",hidden:!0,readOnly:!0}),(0,eL.MI)({name:"posterImageAlt",title:"Poster Image Alt",type:"string"}),(0,eL.MI)({name:"buttons",title:"Buttons",description:"Add up to 4 action buttons.",type:"array",validation:e=>e.max(4),of:[(0,eL.MI)({name:"button",title:"Button",type:"object",components:{input:function(e){let{value:t,onChange:i}=e,n=t?.linkSource?.mode,a=t?.iconSource,r=t?.icon,o=t?.target,l=(0,S.useRef)(n),s=(0,S.useRef)(!1);return(0,S.useEffect)(()=>{"preset"===a&&"CloudDownload"===r&&i(f.NJ$.from((0,f.hZp)("download",["icon"])));let e="external"===n?"_blank":"cdn"===n||"file"===n?"_self":void 0,t=l.current;s.current?(n&&n!==t&&e&&i(f.NJ$.from((0,f.hZp)(e,["target"]))),l.current=n):(s.current=!0,l.current=n,"external"!==n||o&&"_self"!==o)?!o&&e&&i(f.NJ$.from((0,f.hZp)(e,["target"]))):i(f.NJ$.from((0,f.hZp)("_blank",["target"])))},[r,a,n,i,o]),e.renderDefault(e)}},fieldsets:[{name:"iconConfig",title:"Icon Configuration"}],fields:[(0,eL.MI)({name:"label",title:"Button Label",type:"string",validation:e=>e.required()}),(0,eL.MI)({name:"iconSource",title:"Icon Source",type:"string",options:{list:[{title:"Preset Icon",value:"preset"},{title:"Custom Icon",value:"custom"}],layout:"radio"},fieldset:"iconConfig",validation:e=>e.required().error("Select either Preset Icon or Custom Icon.")}),(0,eL.MI)({name:"icon",title:"Preset Icon",type:"string",description:"Choose one icon from the preset list.",options:{list:[{title:"Download",value:"download"},{title:"Open",value:"open"},{title:"Share",value:"share"},{title:"Link",value:"link"},{title:"Document",value:"document"}],layout:"dropdown"},fieldset:"iconConfig",hidden:({parent:e})=>e?.iconSource!=="preset",validation:e=>e.custom((e,t)=>{let i=t.parent;return"preset"!==("string"==typeof i?.iconSource?i.iconSource:"")||!!("string"==typeof e?e.trim():"")||"Preset icon is required when Preset Icon is selected."})}),(0,eL.MI)({name:"iconName",title:"Custom Icon Name",description:"Enter any iconoir-react export name (example: CloudDownload, OpenInWindow, ShareAndroid, GoogleDocs).",type:"string",fieldset:"iconConfig",hidden:({parent:e})=>e?.iconSource!=="custom",validation:e=>e.custom((e,t)=>{let i=t.parent;return"custom"!==("string"==typeof i?.iconSource?i.iconSource:"")||!!("string"==typeof e?e.trim():"")||"Custom icon name is required when Custom Icon is selected."})}),(0,eL.MI)({name:"linkSource",title:"Button File / Link",type:"uploadOrLinkSource",validation:e=>e.custom(e=>{if(!e)return!0;let t=String(e.mode||"").trim();if(!t)return!0;let i="string"==typeof e.url&&e.url.trim().length>0,n="string"==typeof e.cdnUrl&&e.cdnUrl.trim().length>0,a=!!e.file?.asset?._ref;return"external"===t?!!i||"An external URL is required.":"cdn"===t?!!n||"A JW CDN upload is required.":"file"!==t||!!a||"A Sanity upload is required."})}),(0,eL.MI)({name:"link",title:"Button Link (Legacy)",type:"string",hidden:!0,readOnly:!0}),(0,eL.MI)({name:"target",title:"Open Link In",description:"Defaults to New Tab for external links and
181Same Tab for uploaded files when not selected.",type:"string",options:{list:[{title:"Same Tab",value:"_self"},{title:"New Tab",value:"_blank"}],layout:"radio"}})],preview:{select:{title:"label",iconSource:"iconSource",iconName:"iconName",iconPreset:"icon"},prepare(e){let t="custom"===e.iconSource?e.iconName:e.iconPreset;return{title:e.title||"Button",subtitle:t||"(no icon)"}}}})]}),(0,eL.MI)({name:"allowSharing",title:"Allow Sharing",description:"When enabled, a share action is shown for this publication item.",type:"boolean",initialValue:!1})],preview:{select:{title:"title",subtitle:"year",posterMode:"posterImage.mode",posterExternalUrl:"posterImage.url",posterCdnUrl:"posterImage.cdnUrl",posterFile:"posterImage.file",legacyPosterUrl:"posterImageLink"},prepare(e){let t=e.title||"(Untitled Publication)",i=e.subtitle,n=e.posterMode||"",a=e.posterExternalUrl||"",r=e.posterCdnUrl||"",o=e.legacyPosterUrl||"",l=e.posterFile,s=("external"===n?a:"")||("cdn"===n?r:"")||o,d="file"===n&&l?.asset?._ref?l:s?S.createElement("img",{src:s,alt:t,style:{width:32,height:40,objectFit:"cover"}}):void 0;return{title:t,subtitle:"number"==typeof i?String(i):void 0,media:d}}}})]}),(0,eL.MI)({name:"archived",title:"Archived",type:"boolean",hidden:!0,initialValue:!1}),(0,eL.MI)({name:"archivedAt",title:"Archived At",type:"datetime",hidden:!0})],preview:{select:{title:"categoryName",itemCount:"items"},prepare(e){let t=e.title||"(Untitled Category)",i=e.itemCount,n=Array.isArray(i)?i.length:0;return{title:t,subtitle:`${n} item${1===n?"":"s"}`}}}});function tj(e){if(!e)return{bucket:2,key:""};let t=e.replace(/^[^A-Za-z0-9]+/,"")||e,i=t.charAt(0);return/^[0-9]/.test(i)?{bucket:0,key:t.toLowerCase()}:/^[A-Za-z]/.test(i)?{bucket:1,key:t.toLowerCase()}:{bucket:2,key:t.toLowerCase()}}function tD(e){let{value:t,onChange:i}=e,n=(0,S.useMemo)(()=>{if(!Array.isArray(t))return t;let e=[...t];return e.sort((e,t)=>{let i=(e?.name||e?.mnemonic||"").toString(),n=(t?.name||t?.mnemonic||"").toString(),a=tj(i),r=tj(n);if(a.bucket!==r.bucket)return a.bucket-r.bucket;if(a.key<r.key)return -1;if(a.key>r.key)return 1;let o=e?._key||"",l=t?._key||"";return o.localeCompare(l)}),e},[t]);return(0,S.useEffect)(()=>{!Array.isArray(t)||!Array.isArray(n)||t.length===n.length&&t.every((e,t)=>e?._key===n[t]?._key)||i(f.NJ$.from((0,f.hZp)(n)))},[n,t,i]),e.renderDefault(e)}let tO=(0,eL.U8)({name:"rssPeriodicalGroup",title:"RSS Periodical Group",type:"document",fields:[(0,eL.MI)({name:"showInKinds",title:"Show Group In",type:"array",of:[{type:"string"}],options:{layout:"grid",list:[{title:"Print",value:"PRINT"},{title:"Audio",value:"AUDIO"},{title:"Video",value:"VIDEO"}]},description:"Select one or more channels this group appears in.",validation:e=>e.required().min(1).unique()}),(0,eL.MI)({name:"groupName",title:"Group Name",type:"string",description:"Name shown as the sublabel for items in this group.",validation:e=>e.required().min(2)}),(0,eL.MI)({name:"order",title:"Order",type:"number",description:"Display sort order. Unique within overlapping kinds (lower numbers appear first).",validation:e=>e.required().min(0)}),(0,eL.MI)({name:"periodicals",title:"Periodicals",type:"array",components:{input:tD},of:[(0,eL.MI)({name:"periodical",type:"object",fields:[(0,eL.MI)({name:"name",title:"Title",type:"string",validation:e=>e.required().min(2)}),(0,eL.MI)({name:"channelTitles",title:"Channel Title Overrides",type:"object",description:"Provide alternate titles per channel. Base Title always used for Print; enable to override Audio/Video.",fields:[(0,eL.MI)({name:"enabled",title:"Enable Overrides",type:"boolean",initialValue:!1}),(0,eL.MI)({name:"audio",title:"Audio Title",type:"string",hidden:({parent:e})=>!e?.enabled,description:"Optional Audio-specific title. Leave blank to fall back to base."}),(0,eL.MI)({name:"video",title:"Video Title",type:"string",hidden:({parent:e})=>!e?.enabled,description:"Optional Video-specific title. Leave blank to fall back to base."})],options:{collapsible:!0,collapsed:!0}}),(0,eL.MI)({name:"mnemonic",title:"Mnemonic",type:"string",validation:e=>e.required().min(1)}),(0,eL.MI)({name:"channelMnemonics",title:"Channel Mnemonic Overrides",type:"object",description:"Provide alternate mnemonics per channel. Base mnemonic always used for Print; enable to override Audio/Video.",fields:[(0,eL.MI)({name:"enabled",title:"Enable Overrides",type:"boolean",initialValue:!1}),(0,eL.MI)({name:"audio",title:"Audio Mnemonic",type:"string",hidden:({parent:e})=>!e?.enabled,description:"Optional Audio-specific mnemonic. Leave blank to fall back to base."}),(0,eL.MI)({name:"video",title:"Video Mnemonic",type:"string",hidden:({parent:e})=>!e?.enabled,description:"Optional Video-specific mnemonic. Leave blank to fall back to base."})],options:{collapsible:!0,collapsed:!0}}),(0,eL.MI)({name:"yearSettings",title:"Year Settings",description:"Controls which years are available for this periodical. Start/End define the allowed range. Rollover Month is the first month (inclusive) when the next year becomes available.",type:"object",options:{collapsible:!0,collapsed:!0},fields:[(0,eL.MI)({name:"startYear",title:"Start Year",description:"The earliest year to include.",type:"number",validation:e=>e.required().integer().min(1900)}),(0,eL.MI)({name:"endYear",title:"End Year",description:"The latest year to include. Optional â if omitted, the range extends to the current year (or next year once the rollover month is reached).",type:"number",validation:e=>e.integer().min(1900)}),(0,eL.MI)({name:"rolloverMonth",title:"Rollover Month",description:"When the following year first appears (inclusive).",type:"number",initialValue:9,options:{list:[{title:"January",value:1},{title:"February",value:2},{title:"March",value:3},{title:"April",value:4},{title:"May",value:5},{title:"June",value:6},{title:"July",value:7},{title:"August",value:8},{title:"September",value:9},{title:"October",value:10},{title:"November",value:11},{title:"December",value:12}],layout:"dropdown"},validation:e=>e.required().integer().min(1).max(12)})],validation:e=>e.custom(e=>e&&"object"==typeof e?"number"!=typeof e.startYear?"Start Year is required.":"number"!=typeof e.rolloverMonth?"Rollover Month is required.":"number"==typeof e.endYear&&e.endYear<e.startYear?"End Year must be greater than or equal to Start Year.":!(e.rolloverMonth<1)&&!(e.rolloverMonth>12)||"Rollover Month must be between 1 and 12.":"Provide the Year Settings.")}),(0,eL.MI)({name:"showInKinds",title:"Show Periodical In (override)",type:"array",of:[{type:"string"}],options:{layout:"grid",list:[{title:"Print",value:"PRINT"},{title:"Audio",value:"AUDIO"},{title:"Video",value:"VIDEO"}]},description:"If empty, inherits the group's selected kinds."})],preview:{select:{title:"name",mnemonic:"mnemonic",ys:"yearSettings"},prepare(e){let{title:t,mnemonic:i,ys:n}=e;return{title:t||"(Untitled)",subtitle:[i,n&&"number"==typeof n.startYear&&"number"==typeof n.endYear?`${n.startYear}â${n.endYear}
181`:void 0].filter(Boolean).join(" ⢠")||void 0}}}})],validation:e=>e.custom(e=>{if(!Array.isArray(e))return!0;let t=new Set;for(let i of e){let e=i?.mnemonic?.toLowerCase();if(!e)return"Each periodical needs a Mnemonic";if(t.has(e))return`Duplicate mnemonic: ${e}`;t.add(e)}return!0})})],preview:{select:{title:"groupName",order:"order",kinds:"showInKinds",count:"periodicals"},prepare(e){let{title:t,count:i}=e,n=Array.isArray(i)?i.length:0;return{title:t||"(Unnamed Group)",subtitle:`${n} item${1===n?"":"s"}`}}},orderings:[{title:"Order",name:"order",by:[{field:"order",direction:"asc"}]}]}),tL=(0,eL.U8)({name:"rssPublicationGroup",title:"RSS Publication Group",type:"document",validation:e=>e.custom(e=>{if(!e)return!0;let t=e.publications;if(!Array.isArray(t))return!0;for(let e of t){let t=e?.year;if("number"!=typeof t||t<1500||t>9999){let t="string"==typeof e?.mnemonic?` (mnemonic: ${e.mnemonic})`:"";return`All publication years must be 4-digit YYYY. Invalid year${t}.`}if(e?.channelMnemonics?.enabled){let t="string"==typeof e.channelMnemonics.audio&&e.channelMnemonics.audio.trim().length>0,i="string"==typeof e.channelMnemonics.video&&e.channelMnemonics.video.trim().length>0;if(!t&&!i){let t="string"==typeof e?.mnemonic?` (publication mnemonic: ${e.mnemonic})`:"";return`Channel overrides enabled but neither Audio nor Video mnemonic provided${t}.`}}}return!0}),fields:[(0,eL.MI)({name:"kind",title:"(Deprecated) Kind",type:"string",hidden:!0,readOnly:!0}),(0,eL.MI)({name:"showInKinds",title:"Show Group In",type:"array",of:[{type:"string"}],options:{layout:"grid",list:[{title:"Print",value:"PRINT"},{title:"Audio",value:"AUDIO"},{title:"Video",value:"VIDEO"}]},description:"Select one or more channels this group appears in.",validation:e=>e.required().min(1).unique().custom(e=>{if(!Array.isArray(e)||0===e.length)return"Select at least one kind";let t=["PRINT","AUDIO","VIDEO"];for(let i of e)if(!t.includes(String(i)))return`Invalid kind: ${i}`;return!0})}),(0,eL.MI)({name:"groupName",title:"Group Name",type:"string",description:"Administrative label shown in the CMS and UI grouping headings (e.g. 'Bibles', 'Yearbooks').",validation:e=>e.required().min(2)}),(0,eL.MI)({name:"order",title:"Order",type:"number",description:"Display sort order. Must be unique among groups for any overlapping channel (lower numbers appear first).",validation:e=>e.required().min(0).custom(async(e,t)=>{if("number"!=typeof e)return"Order required";let i=t.parent?.showInKinds;if(!Array.isArray(i)||0===i.length)return!0;let n=t.getClient;if(!n)return!0;let a=n({apiVersion:"2023-10-01"}),r=t.document?._id,o=r?r.replace(/^drafts\./,""):void 0,l=o?`drafts.${o}`:void 0;return!await a.fetch('*[_type == "rssPublicationGroup" && order == $order && count((showInKinds)[@ in $kinds]) > 0 && !(_id in [$publishedId, $draftId])][0]._id',{order:e,kinds:i,publishedId:o,draftId:l})||"Order conflicts with another group in one of the selected kinds"})}),(0,eL.MI)({name:"publications",title:"Publications",type:"array",description:"List of publications belonging to this group. Each entry requires a Title, Year (YYYY), and Mnemonic. Enable Series to have the frontend ask the user for a specific generated item (e.g. year/number) at subscription time.",components:{input:tD},of:[(0,eL.MI)({name:"publication",type:"object",fields:[(0,eL.MI)({name:"name",title:"Title",type:"string",description:"Human-readable publication title (base used for series items unless overridden).",validation:e=>e.required().min(2)}),(0,eL.MI)({name:"channelTitles",title:"Channel Title Overrides",type:"object",description:"Provide alternate titles per channel. Base Title always used for Print; enable to override Audio/Video.",fields:[(0,eL.MI)({name:"enabled",title:"Enable Overrides",type:"boolean",initialValue:!1}),(0,eL.MI)({name:"audio",title:"Audio Title",type:"string",hidden:({parent:e})=>!e?.enabled,description:"Optional Audio-specific title. Leave blank to fall back to base."}),(0,eL.MI)({name:"video",title:"Video Title",type:"string",hidden:({parent:e})=>!e?.enabled,description:"Optional Video-specific title. Leave blank to fall back to base."})],options:{collapsible:!0,collapsed:!0}
181,validation:e=>e.custom(e=>{if(!e||!e.enabled)return!0;let t="string"==typeof e.audio&&e.audio.trim().length>0,i="string"==typeof e.video&&e.video.trim().length>0;return!!t||!!i||"Provide at least one override (Audio or Video) or disable overrides"})}),(0,eL.MI)({name:"year",title:"Year",type:"number",description:"Publication year (YYYY).",validation:e=>e.required().min(1500).max(new Date().getFullYear()+2).custom(e=>"number"!=typeof e?"Year required":!(e<1500)&&!(e>9999)||"Year must be 4 digits (>=1500)")}),(0,eL.MI)({name:"channelYears",title:"Channel Year Overrides",type:"object",description:"Provide alternate publication years per channel. Base Year is always used for Print; enable to override Audio/Video years.",fields:[(0,eL.MI)({name:"enabled",title:"Enable Overrides",type:"boolean",initialValue:!1}),(0,eL.MI)({name:"audio",title:"Audio Year",type:"number",hidden:({parent:e})=>!e?.enabled,description:"Optional Audio-specific publication year (YYYY). Leave blank to fall back to base.",validation:e=>e.custom((e,t)=>{let i=t.parent;return!i?.enabled||null==e||("number"!=typeof e?"Enter 4-digit year":!(e<1500)&&!(e>9999)||"Year must be 4 digits (>=1500)")})}),(0,eL.MI)({name:"video",title:"Video Year",type:"number",hidden:({parent:e})=>!e?.enabled,description:"Optional Video-specific publication year (YYYY). Leave blank to fall back to base.",validation:e=>e.custom((e,t)=>{let i=t.parent;return!i?.enabled||null==e||("number"!=typeof e?"Enter 4-digit year":!(e<1500)&&!(e>9999)||"Year must be 4 digits (>=1500)")})})],options:{collapsible:!0,collapsed:!0},validation:e=>e.custom(e=>{if(!e||!e.enabled)return!0;let t="number"==typeof e.audio,i="number"==typeof e.video;return!!t||!!i||"Provide at least one override (Audio or Video) or disable overrides"})}),(0,eL.MI)({name:"mnemonic",title:"Mnemonic",type:"string",description:"Short feed code (e.g. yb24). Forms the root for dynamically generated series mnemonics unless overridden in a Series Definition.",validation:e=>e.required().min(1)}),(0,eL.MI)({name:"channelMnemonics",title:"Channel Mnemonic Overrides",type:"object",description:"Provide alternate mnemonics per channel. Base mnemonic always used for Print; enable to override Audio/Video.",fields:[(0,eL.MI)({name:"enabled",title:"Enable Overrides",type:"boolean",initialValue:!1}),(0,eL.MI)({name:"audio",title:"Audio Mnemonic",type:"string",hidden:({parent:e})=>!e?.enabled,description:"Optional Audio-specific mnemonic. Leave blank to fall back to base.",validation:e=>e.custom((e,t)=>{let i=t.parent;if(!i?.enabled)return!0;let n="string"==typeof i.audio&&i.audio.trim().length>0,a="string"==typeof i.video&&i.video.trim().length>0;return!!n||!!a||"Enter Audio or Video mnemonic (at least one)"})}),(0,eL.MI)({name:"video",title:"Video Mnemonic",type:"string",hidden:({parent:e})=>!e?.enabled,description:"Optional Video-specific mnemonic. Leave blank to fall back to base.",validation:e=>e.custom((e,t)=>{let i=t.parent;if(!i?.enabled)return!0;let n="string"==typeof i.audio&&i.audio.trim().length>0,a="string"==typeof i.video&&i.video.trim().length>0;return!!n||!!a||"Enter Audio or Video mnemonic (at least one)"})})],options:{collapsible:!0,collapsed:!0},validation:e=>e.custom(e=>{if(!e||!e.enabled)return!0;let t="string"==typeof e.audio&&e.audio.trim().length>0,i="string"==typeof e.video&&e.video.trim().length>0;return!!t||!!i||"Provide at least one override (Audio or Video) or disable overrides"})}),(0,eL.MI)({name:"showInKinds",title:"Show Publication In (override)",type:"array",of:[{type:"string"}],options:{layout:"grid",list:[{title:"Print",value:"PRINT"},{title:"Audio",value:"AUDIO"},{title:"Video",value:"VIDEO"}]},description:"If empty, inherits the group's selected kinds.",validation:e=>e.unique().custom(e=>{if(null==e||0===e.length)return!0;if(!Array.isArray(e))return"Invalid kinds";let t=["PRINT","AUDIO","VIDEO"];for(let i of e)if(!t.includes(String(i)))return`Invalid kind: ${i}`;return!0})}),(0,eL.MI)({name:"series",title:"Series",type:"object",fields:[(0,eL.MI)({name:"enabled",title:"Enable Series",type:"boolean",initialValue:!1,description:"Turn on to link a Series Definition and generate selectable dynamic items (years, numbers, seasonal)."}),(0,eL.MI)({name:"definition",title:"Series Definition",type:"reference",to:[{type:"seriesDefinition"}],hidden:({parent:e})=>!e?.enabled,description:"Pick a reusable Series Definition document which controls dynamic item expansion.",validation:e=>e.custom((e,t)=>
181{let i=t.parent;return!i?.enabled||!!e||"Select a Series Definition"})})],options:{collapsible:!0,collapsed:!1},description:"Toggle on and choose a Series Definition to dynamically generate selectable items (years, numbers, or seasonal visibility)."})],preview:{select:{title:"name",year:"year",mnemonic:"mnemonic",seriesEnabled:"series.enabled",generatorType:"series.definition.generatorType",pubKinds:"showInKinds"},prepare(e){let{title:t,year:i,mnemonic:n,seriesEnabled:a,generatorType:r,pubKinds:o}=e,l=r?({yearRange:"Year Range",annualFromStart:"Rolling Annual",numberedFromStart:"Numbered Annual",windowed:"Seasonal Windows"})[r]||r:"",s=Array.isArray(o)&&o.length>0?o.length:0,d=[];return n&&d.push(n),i&&d.push(String(i)),s>0&&d.push(`${s} channel${1===s?"":"s"}`),a&&l&&d.push(l),{title:t||"(Untitled)",subtitle:d.join(" ⢠")}}}})],validation:e=>e.custom(e=>{if(!e)return!0;if(!Array.isArray(e))return"Invalid items";let t=new Set;for(let i of e){let e="string"==typeof i?.mnemonic?i.mnemonic:void 0;if(!e)return"Each publication must have mnemonic";let n=e.toLowerCase();if(t.has(n))return`Duplicate mnemonic: ${e}`;t.add(n)}return!0})})],preview:{select:{title:"groupName",order:"order",kinds:"showInKinds",count:"publications"},prepare(e){let{title:t,kinds:i,count:n}=e,a=Array.isArray(n)?n.length:0,r=Array.isArray(i)?i.length:0;return{title:t||"(Unnamed Group)",subtitle:`${r} channel${1===r?"":"s"} ⢠${a} publication${1===a?"":"s"}`}}},orderings:[{title:"Order (within kind)",name:"orderWithinKind",by:[{field:"kind",direction:"asc"},{field:"order",direction:"asc"}]}]}),t_=(0,eL.U8)({name:"seriesDefinition",title:"Series Definition",type:"document",fieldsets:[{name:"titleConstruction",title:"Title Construction",options:{collapsible:!0,collapsed:!0},description:"Controls how each series item title is built. By default the publication's own title is used; enable override to supply a custom base segment. Position determines whether generated year / number goes before (Prefix) or after (Suffix) that base segment."},{name:"mnemonicConstruction",title:"Mnemonic Construction",options:{collapsible:!0,collapsed:!0},description:"Controls how each item's mnemonic (feed code) is built. By default the publication's mnemonic is used; enable override to supply a custom root. Position chooses whether the root appears before or after the dynamic year / number segment."},{name:"startYearControl",title:"Start Year Override",options:{collapsible:!0,collapsed:!0},description:"Optionally override the first year used by generators (non-seasonal). Toggle to enable and then enter a specific starting year."},{name:"windowedYearControl",title:"Seasonal Year Controls",options:{collapsible:!0,collapsed:!0},description:"Controls how the year appears for Seasonal Single Releases. Locking fixes the year to the publication's own year. Optionally hide the year entirely from title & mnemonic (useful for evergreen items that only need windowed visibility without a year label)."}],fields:[(0,eL.MI)({name:"title",title:"Series Definition Title",type:"string",description:"Internal label for this series definition (not used for publication item titles).",validation:e=>e.required().min(3)}),(0,eL.MI)({name:"generatorType",title:"Generator Type",type:"string",initialValue:"yearRange",options:{list:[{title:"Year-by-Year Range",value:"yearRange"},{title:"Rolling Annual with Next-Year Preview",value:"annualFromStart"},{title:"Numbered Annual Installments",value:"numberedFromStart"},{title:"Seasonal Single Releases",value:"windowed"}],layout:"radio"},description:`Patterns: 182⢠Year-by-Year Range â one item per year across a fixed or open span (supports display offset). 183⢠Rolling Annual with Next-Year Preview â yearly items from start; auto add next year's after gate month. 184⢠Numbered Annual Installments â yearly sequence labeled 1,2,3... instead of the year; optional next-year gate. 185⢠Seasonal Single Releases â month windows each emit at most one item (e.g. invitations).`,validation:e=>e.required()}),(0,eL.MI)({name:"seasonalWindows",title:"Visibility Windows",type:"array",hidden:({parent:e})=>e?.generatorType!=="windowed",description:"Define one or more recurring visibility windows for Seasonal Single Releases. Each generated year item is visible when today's date falls within any configured window relative to that item's year. For crossâyear windows you can either set an End Month earlier than the Start Month (auto End Year Offset +1), or explicitly set Start/End Year Offsets (advanced).",of:[(0,eL.MI)({name:"window",type:"object",fields:[(0,eL.MI)({name:"activeStartMonth",title:"Start Month",type:"number",description:"First visible month (inclusive). January = 0 ⦠December = 11. To create a crossâyear window (spanning into the next calendar year, e.g. OctâFeb) pick a later Start Month and an earlier End Month.",options:{list:[{title:"January",value:0},{title:"February",value:1},{title:"March",value:2},{title:"April",value:3},{title:"May",value:4},{title:"June",value:5},{title:"July",value:6},{title:"August",value:7},{title:"September",value:8},{title:"October",value:9},{title:"November",value:10},{title:"December",value:11}]},validation:e=>e.required().min(0).max(11).custom(e=>"number"==typeof e||"Select start month")}),(0,eL.MI)({name:"activeEndMonth",title:"End Month",type:"number",description:"Last visible month (inclusive). For a crossâyear window choose an End Month earlier than the Start Month (e.g. Start: October, End: February).",options:{list:[{title:"January",value:0},{title:"February",value:1},{title:"March",value:2},{title:"April",value:3},{title:"May",value:4},{title:"June",value:5},{title:"July",value:6},{title:"August",value:7},{title:"September",value:8},{title:"October",value:9},{title:"November",value:10},{title:"December",value:11}]},validation:e=>e.required().min(0).max(11).custom(e=>"number"==typeof e||"Select end month")}),(0,eL.MI)({name:"startYearOffset",title:"Start Year Offset",type:"number",description:"Year offset relative to the item's year for the Start Month. Default 0. Example (Invitations): Start Month = December, Start Year Offset = -1.",initialValue:0,options:{list:[{title:"-2",value:-2},{title:"-1",value:-1},{title:"0",value:0},{title:"+1",value:1},{title:"+2",value:2}]},validation:e=>e.custom(e=>null==e||("number"!=typeof e?"Year offset must be a number":Number.isInteger(e)?!(e<-5)&&!(e>5)||"Year offset must be between -5 and +5":"Year offset must be an integer"))}),(0,eL.MI)({name:"endYearOffset",title:"End Year Offset",type:"number",description:"Year offset relative to the item's year for the End Month. Default 0 (or +1 automatically when End Month is earlier than Start Month). Example (Invitations): End Month = January, End Year Offset = +1.",initialValue:0,options:{list:[{title:"-2",value:-2},{title:"-1",value:-1},{title:"0",value:0},{title:"+1",value:1},{title:"+2",value:2}]},validation:e=>e.custom(e=>null==e||("number"!=typeof e?"Year offset must be a number":Number.isInteger(e)?!(e<-5)&&!(e>5)||"Year offset must be between -5 and +5":"Year offset must be an integer"))})],preview:{select:{s:"activeStartMonth",e:"activeEndMonth",so:"startYearOffset",eo:"endYearOffset"},prepare(e){let t,{s:i,e:n,so:a,eo:r}=e,o=["January","February","March","April","May","June","July","August","September","October","November","December"],l="number"==typeof i&&i>=0&&i<=11?o[i]:"?",s="number"==typeof n&&n>=0&&n<=11?o[n]:"?",d="number"==typeof a?a:0,u="number"==typeof r?r:+!!("number"==typeof i&&"number"==typeof n&&n<i),c=12*d+("number"==typeof i?i:0),p=12*u+("number"==typeof n?n:0),m=p>=c?p-c+1:0,f=`${l} (Y${d}) â ${s} (Y${u})`;return m>0&&(t=`${m} month${1===m?"":"s"}`),{title:f,subtitle:t}}}})],validation:e=>e.custom((e,t)=>
185{let i=t.parent;if(i?.generatorType!=="windowed")return!0;if(!Array.isArray(e)||0===e.length)return"Add at least one seasonal window";let n=[];for(let t=0;t<e.length;t++){let i=e[t];if("number"!=typeof i.activeStartMonth||"number"!=typeof i.activeEndMonth)return"Each window needs start and end month";let a=i.activeStartMonth,r=i.activeEndMonth,o=r<a,l="number"==typeof i.startYearOffset?i.startYearOffset:0,s="number"==typeof i.endYearOffset?i.endYearOffset:+!!o;if(!Number.isInteger(l)||!Number.isInteger(s))return"Year offsets must be integers";if(l<-5||l>5||s<-5||s>5)return"Year offsets must be between -5 and +5";let d=12*l+a,u=12*s+r;if(u<d)return"End must be after Start (check months and year offsets)";n.push({idx:t,s:a,e:r,startOff:l,endOff:s,startIdx:d,endIdx:u})}let a=[...n].sort((e,t)=>e.startIdx-t.startIdx);for(let e=0;e<a.length-1;e++){let t=a[e],i=a[e+1];if(i.startIdx<=t.endIdx)return`Windows #${t.idx+1} and #${i.idx+1} overlap; consolidate or adjust months/offsets`}return!0})}),(0,eL.MI)({name:"windowedStaticPublicationYear",title:"Lock Seasonal Year To Publication Year",type:"boolean",initialValue:!1,fieldset:"windowedYearControl",hidden:({parent:e})=>e?.generatorType!=="windowed",description:"OFF (default): the seasonal item's year follows the active cycle (current start year, then advances each new start cycle). ON: always use the publication's own Year field regardless of current calendar year or cycle; the displayed year and mnemonic year segment stay fixed."}),(0,eL.MI)({name:"windowedShowLockedYear",title:"Show Year In Title & Mnemonic",type:"boolean",initialValue:!0,fieldset:"windowedYearControl",hidden:({parent:e})=>e?.generatorType!=="windowed"||!e?.windowedStaticPublicationYear,description:"ON (default): include the locked publication year in generated title/mnemonic. OFF: omit the year entirely (no dynamic or locked year segment)."}),(0,eL.MI)({name:"overrideStartYear",title:"Override Start Year",type:"boolean",initialValue:!1,description:"Enable to manually set the first year instead of deriving it from the publication's year.",fieldset:"startYearControl",hidden:({parent:e})=>["windowed"].includes(e?.generatorType||"")}),(0,eL.MI)({name:"startYearOverride",title:"Start Year (Override)",type:"number",fieldset:"startYearControl",hidden:({parent:e})=>!e?.overrideStartYear||["windowed"].includes(e?.generatorType||""),validation:e=>e.custom((e,t)=>{let i=t.parent;return!i?.overrideStartYear||("number"!=typeof e?"Enter 4-digit year":!(e<1500)&&!(e>9999)||"Year must be 4 digits (>=1500)")})}),(0,eL.MI)({name:"endYear",title:"End Year Mode",type:"string",hidden:({parent:e})=>!["yearRange"].includes(e?.generatorType||""),options:{list:[{title:"Current Year",value:"current"},{title:"Previous Year",value:"previous"},{title:"Custom (enter below)",value:"custom"}],layout:"radio"},initialValue:"current",description:"Determines how far the range extends: current year (default), previous year, or a custom fixed year.",validation:e=>e.custom((e,t)=>{let i=t.parent;return i?.generatorType!=="yearRange"||(e?!!["current","previous","custom"].includes(String(e))||"Invalid end year mode":"Select an end year mode")})}),(0,eL.MI)({name:"endYearCustom",title:"End Year Custom",type:"number",hidden:({parent:e})=>e?.generatorType!=="yearRange"||e?.endYear!=="custom",validation:e=>e.custom((e,t)=>{let i=t.parent;return i?.generatorType!=="yearRange"||i?.endYear!=="custom"||("number"!=typeof e?"Enter a 4-digit year":e<1500||e>new Date().getFullYear()+5?"Year out of allowed range (>=1500)":!(e<1e3)&&!(e>9999)||"Year must be 4 digits")})}),(0,eL.MI)({name:"addNextIfMonthGte",title:"Preview Next Year Starting In Month",type:"number",hidden:({parent:e})=>!["annualFromStart","numberedFromStart"].includes(e?.generatorType||""),options:{list:[{title:"January",value:0},{title:"February",value:1},{title:"March",value:2},{title:"April",value:3},{title:"May",value:4},{title:"June",value:5},{title:"July",value:6},{title:"August",value:7},{title:"September",value:8},{title:"October",value:9},{title:"November",value:10},{title:"December",value:11}]},description:"Choose the first calendar month when the following year's item should appear early. Example: Set to September and during SeptâDec 2025 the 2026 item is also generated.",validation:e=>e.custom((e,t)=>
185{let i=t.parent;return!(i&&["annualFromStart","numberedFromStart"].includes(i.generatorType||""))||("number"!=typeof e?"Select a month (January = 0)":!(e<0)&&!(e>11)||"Month must be between 0 and 11")})}),(0,eL.MI)({name:"displayYearOffset",title:"Year Offset (+/-)",type:"number",initialValue:0,description:"Shifts the underlying year basis for ALL generator types (titles, mnemonics, and ordering). Example: offset +1 turns stored 2024 into a 2025 item (mnemonic yy becomes 25, numbering/year comparisons use shifted year). Use 0 unless you intentionally need a service year style forward (or rarely backward) shift. Applies to: Year Range (affects span & display), Rolling Annual (affects generated years including preview), Numbered Annual (sequence still counts from shifted start), Seasonal (shifts reported year value).",validation:e=>e.custom(e=>"number"!=typeof e||Number.isNaN(e)?"Provide a numeric offset (0 if none)":!(e<-5)&&!(e>5)||"Offset should be between -5 and +5")}),(0,eL.MI)({name:"titlePosition",title:"Title Position",type:"string",initialValue:"suffix",fieldset:"titleConstruction",description:"Place the base title before (Prefix) or after (Suffix) the generated year / number portion.",options:{list:[{title:"Prefix",value:"prefix"},{title:"Suffix",value:"suffix"}],layout:"radio"},validation:e=>e.required()}),(0,eL.MI)({name:"overrideTitle",title:"Override Publication Title",type:"boolean",initialValue:!1,fieldset:"titleConstruction",description:"Toggle on to replace the publication title with a custom base segment for this series."}),(0,eL.MI)({name:"titleOverride",title:"Title Override",type:"string",hidden:({parent:e})=>!e?.overrideTitle,fieldset:"titleConstruction",description:"Custom base title segment when override is enabled.",validation:e=>e.custom((e,t)=>{let i=t.parent;return!i?.overrideTitle||!!e||"Provide title"})}),(0,eL.MI)({name:"titleYearRangeEnabled",title:"Show 2-year range in title",type:"boolean",initialValue:!1,fieldset:"titleConstruction",components:{input:function(e){let t=(0,S.useRef)(!1),i=e.value;return(0,S.useEffect)(()=>{t.current||null==i&&(t.current=!0,e.onChange((0,f.hZp)(!1)))},[i,e]),e.renderDefault(e)}},description:"Turns the year into a 2-year range in the title (example: 2026 â 2025â2026 or 2026â2027).",options:{layout:"switch"},validation:e=>e.custom(e=>null==e||"boolean"==typeof e||"Invalid value")}),(0,eL.MI)({name:"titleYearRangeOffset",title:"Which range to show",type:"number",fieldset:"titleConstruction",hidden:({parent:e})=>!e?.titleYearRangeEnabled,description:"Choose whether the range is the assigned year + previous year, or the assigned year + next year.",options:{list:[{title:"Previous + assigned (2025â2026)",value:-1},{title:"Assigned + next (2026â2027)",value:1}],layout:"radio"},validation:e=>e.custom((e,t)=>{let i=t.parent;return i?.titleYearRangeEnabled!==!0||null!=e&&(-1===e||1===e)||"Select which range to show"})}),(0,eL.MI)({name:"mnemonicPosition",title:"Mnemonic Position",type:"string",initialValue:"prefix",fieldset:"mnemonicConstruction",description:"Place the base mnemonic root before (Prefix) or after (Suffix) the dynamic year / number segment.",options:{list:[{title:"Prefix",value:"prefix"},{title:"Suffix",value:"suffix"}],layout:"radio"},validation:e=>e.required()}),(0,eL.MI)({name:"overrideMnemonic",title:"Override Publication Mnemonic",type:"boolean",initialValue:!1,fieldset:"mnemonicConstruction",description:"Toggle on to replace the publication mnemonic with a custom root."}),(0,eL.MI)({name:"mnemonicOverride",title:"Mnemonic Override",type:"string",hidden:({parent:e})=>!e?.overrideMnemonic,fieldset:"mnemonicConstruction",description:"Custom mnemonic root when override is enabled.",validation:e=>e.custom((e,t)=>{let i=t.parent;return!i?.overrideMnemonic||!!e||"Provide mnemonic"})})],preview:{select:{type:"generatorType",title:"title"},prepare(e){let{type:t,title:i}=e;return{title:i||"(Untitled Series Definition)",subtitle:t?({yearRange:"Year-by-Year Range",annualFromStart:"Rolling Annual with Next-Year Preview",numberedFromStart:"Numbered Annual Installments",windowed:"Seasonal Single Releases"})[t]||t:""}}}}),tN=[tf,tI,tA,ti,tC,tT,tU,(0,eL.U8)({name:"webAddonOption",title:"Web Add-on Option",type:"document",icon:O.A,initialValue:{__i18n_lang:"en"},groups:[{name:"content",title:"Content",default:!0},{name:"properties",title:"Properties"}],fields:[(0,eL.MI)({name:"title",title:"Name",type:"string",validation:e=>e.required().min(2),group:"content"}),(0,eL.MI)({name:"href",title:"Download URL",type:"url",validation:e=>e.required().uri({allowRelative:!1,scheme:["https","http"]}),group:"content"}),(0,eL.MI)({name:"image",title:"Badge Image",type:"imageSource",description:"Upload or link the store badge image. Uses JW CDN if 'JW CDN' source is selected.",group:"content",validation:e=>e.required()}),(0,eL.MI)({name:"description",title:"Description",type:"array",of:[e6],validation:e=>e.required().min(1),group:"content"}),(0,eL.MI)({name:"supportedBrowsers",title:"Supported Browsers",description:"Select all browsers/platforms that support this option.",type:"array",of:[(0,eL.MI)({name:"browser",type:"string",options:{list:[{title:"Chrome",value:"chrome"},{title:"Brave",value:"brave"},{title:"Vivaldi",value:"vivaldi"},{title:"Edge",value:"edge"},{title:"Opera",value:"opera"},{title:"Whale",value:"whale"},{title:"Yandex",value:"yandex"},{title:"Kiwi",value:"kiwi"},{title:"Firefox",value:"firefox"},{title:"iOS (Generic)",value:"ios"},{title:"Orion (iOS)",value:"orion"},{title:"DuckDuckGo",value:"duckduckgo"},{title:"Samsung Internet",value:"samsung"},{title:"Safari",value:"safari"}]}})],group:"properties",validation:e=>e.required().min(1).unique()}),(0,eL.MI)({name:"archived",title:"Archived",type:"boolean",hidden:!0,initialValue:!1,group:"properties"}),(0,eL.MI)({name:"archivedAt",title:"Archived At",type:"datetime",hidden:!0,group:"properties"})],preview:{select:{title:"title",imgCdn:"image.cdnUrl",imgUrl:"image.url",imgFile:"image.file.asset._ref",href:"href",i18n_lang:"__i18n_lang",legacyLang:"language"},prepare(e){let t,{title:i,imgCdn:n,imgUrl:a,href:r}=e,o=e.i18n_lang||e.legacyLang;if(o){let e=o.trim().toLowerCase(),i=globalThis;i.__SLANG_MAP||(i.__SLANG_MAP=b.F.reduce((e,t)=>
185(e[t.id]||(e[t.id]=t.title),e),{})),t=i.__SLANG_MAP[e]||e.toUpperCase()}let l=[];t&&l.push(t),r&&l.push(r);let s=l.length?l.join(" ⢠"):void 0,d=n||a;return{title:i||"(Untitled Option)",subtitle:s,media:d?S.createElement("img",{src:d,alt:i||"Badge",style:{objectFit:"contain",width:"100%",height:"100%"}}):S.createElement(O.A)}}},orderings:[{title:"Title A â Z",name:"titleAsc",by:[{field:"title",direction:"asc"}]}]}),tn,tL,tO,t_,tk,th,eY,eH,eq,eJ,eQ,eG,eW,eX],tE=(0,f.C8j)({projectId:"rgoukaa5",dataset:"production",name:"jwpubs_cms",title:"CMS Studio",basePath:"/catalog/admapps/cms/studio",releases:{enabled:!1},scheduledDrafts:{enabled:!1},scheduledPublishing:{enabled:!1},plugins:[(0,h.j$)({structure:e=>e.list().title("Content").items([e.listItem().title("Announcements").icon(T.A).schemaType("announcement").child(e.documentList().title("Announcements").apiVersion(er).filter('_type == "announcement" && (archived != true)').defaultOrdering([{field:"dateDisplay.value",direction:"desc"},{field:"date",direction:"desc"},{field:"_createdAt",direction:"desc"}])),e.listItem().title("Articles").icon(U.A).schemaType("article").child(e.documentList().title("Articles").apiVersion(er).filter('_type == "article" && (archived != true)').defaultOrdering([{field:"_updatedAt",direction:"desc"}])),e.listItem().title("Music Albums").icon(j.A).schemaType("musicAlbum").child(e.documentList().title("Music Albums").apiVersion(er).filter('_type == "musicAlbum" && (archived != true)').defaultOrdering([{field:"releaseDate",direction:"desc"},{field:"_createdAt",direction:"desc"}])),e.listItem().title("Publications").icon(D.A).schemaType("publicationCategory").child(e.documentList().title("Publications").apiVersion(er).filter('_type == "publicationCategory" && (archived != true)').defaultOrdering([{field:"order",direction:"asc"},{field:"categoryName",direction:"asc"}])),e.listItem().title("JW Web Add-on").icon(O.A).schemaType("webAddonOption").child(e.documentList().title("JW Web Add-on").apiVersion(er).filter('_type == "webAddonOption" && (archived != true)').defaultOrdering([{field:"title",direction:"asc"}])),e.listItem().id("countdown").title("Countdown").icon(v.O4).schemaType("countdown").child(e.documentList().id("countdown-docs").title("Countdown").apiVersion(er).filter('_type == "countdown" && (archived != true)').defaultOrdering([{field:"eventDate",direction:"desc"},{field:"_updatedAt",direction:"desc"}])),e.divider(),e.listItem().title("RSS Applications").child(e.list().title("RSS Applications").items([{code:"APK",label:"Android App Package (APK)"},{code:"EXE",label:"Windows Executable (EXE)"},{code:"UPDATEPKG",label:"Update Package (UPDATEPKG)"},{code:"ZIP",label:"Compressed Archive (ZIP)"}].map(t=>e.listItem().title(t.label).schemaType("appGroup").child(e.documentTypeList("appGroup").title(`${t.label} Groups`).apiVersion(er).filter('_type == "appGroup" && appType == $appType').params({appType:t.code}).defaultOrdering([{field:"order",direction:"asc"}]).initialValueTemplates([e.initialValueTemplateItem("appGroup-by-type",{appType:t.code})]))))),e.listItem().title("RSS Periodicals").child(e.documentTypeList("rssPeriodicalGroup").title("RSS Periodical Groups").defaultOrdering([{field:"order",direction:"asc"}])),e.listItem().title("RSS Publications").child(e.documentTypeList("rssPublicationGroup").title("RSS Publication Groups").defaultOrdering([{field:"order",direction:"asc"}])),e.divider(),e.listItem().id("media-library-audio").title("Audio Library").icon(v.udU).schemaType("audioLibrary").child(e.documentList().id("media-library-audio-docs").title("Audio Library").apiVersion(er).filter('_type == "audioLibrary" && (archived != true)').defaultOrdering([{field:"_updatedAt",direction:"desc"}])),e.listItem().id("media-library-images").title("Image Library").icon(v.sYc).schemaType("imageLibrary").child(e.documentList().id("media-library-images-docs").title("Image Library").apiVersion(er).filter('_type == "imageLibrary" && (archived != true)').defaultOrdering([{field:"_updatedAt",direction:"desc"}])),e.listItem().id("media-library-bulk-upload").title("Bulk Upload").icon(v.JMY).child(e.component().id("media-library-bulk-upload-pane").title("Bulk Upload").component(ea)),e.divider(),e.listItem().title("Archive").icon(L.A).child(e.list().title("Archive").items([e.listItem().title("Announcements").icon(T.A).child(e.documentList().title("Archived Announcements").apiVersion(er).filter('_type == "announcement" && archived == true').defaultOrdering([{field:"_updatedAt",direction:"desc"}])),e.listItem().title("Articles").icon(U.A).child(e.documentList().title("Archived Articles").apiVersion(er).filter('_type == "article" && archived == true').defaultOrdering([{field:"_updatedAt",direction:"desc"}])),e.listItem().title("Albums").icon(j.A).child(e.documentList().title("Archived Albums").apiVersion(er).filter('_type == "musicAlbum" && archived == true').defaultOrdering([{field:"_updatedAt",direction:"desc"}])),e.listItem().title("Publications").icon(D.A).child(e.documentList().title("Archived Publications").apiVersion(er).filter('_type == "publicationCategory" && archived == true').defaultOrdering([{field:"_updatedAt",direction:"desc"}])),e.listItem().title("JW Web Add-on").icon(O.A).child(e.documentList().title("Archived JW Web Add-on").apiVersion(er).filter('_type == "webAddonOption" && archived == true').defaultOrdering([{field:"_updatedAt",direction:"desc"}])),e.listItem().id("archived-media-audio").title("Audio Library").icon(v.udU).child(e.documentList().id("archived-media-audio-docs").title("Archived Audio Library").apiVersion(er).filter('_type == "audioLibrary" && archived == true').defaultOrdering([{field:"_updatedAt",direction:"desc"}])),e.listItem().id("archived-media-images").title("Image Library").icon(v.sYc).child(e.documentList().id("archived-media-images-docs").title("Archived Image Library").apiVersion(er).filter('_type == "imageLibrary" && archived == true').defaultOrdering([{field:"_updatedAt",direction:"desc"}])),e.listItem().title("Countdown").child(e.documentList().title("Archived Countdown").apiVersion(er).filter('_type == "countdown" && archived == true').defaultOrdering([{field:"eventDate",direction:"desc"},{field:"_updatedAt",direction:"desc"}]))]))]),defaultDocumentNode:e=>e.document().initialValueTemplate(void 0)}),(0,y.$_)({directUploads:!0}
185),(0,m.tp)(),(0,g._)({}),(0,p.KY)({supportedLanguages:()=>Promise.resolve(b.F),schemaTypes:["article","announcement","musicAlbum","musicTrack","webAddonOption","hr"],languageField:"language",weakReferences:!0,allowCreateMetaDoc:!0,apiVersion:"2025-02-19"})],auth:{loginMethod:"token",redirectOnSingle:!0,providers:()=>[{name:"cognito",title:"Sign in with Cognito",url:"/api/sso/cognito/start/"}]},studio:{components:{navbar:function(e){let{renderDefault:t}=e;return(0,S.useEffect)(()=>{if("u"<typeof document)return;try{let e="JWPUBS⢠CMS";document.title!==e&&(document.title=e);let t=(e,t,i={})=>{let n=`link[rel="${e}"]`,a=document.head.querySelector(n);a||((a=document.createElement("link")).rel=e,document.head.appendChild(a)),a.href=t,Object.entries(i).forEach(([e,t])=>a.setAttribute(e,t))},i="https://www.jwpubs.org/favicon.ico";t("icon",i),t("shortcut icon",i)}catch{}let e=()=>{let e=new Set;document.querySelectorAll('a[aria-label*="invite" i],button[aria-label*="invite" i],[data-testid*="invite" i],[data-ui*="invite" i],[id*="invite" i],a[href*="invite" i],a[href*="members" i],a[href*="team" i],button[href*="invite" i],a[aria-label*="manage project" i],button[aria-label*="manage project" i],[data-testid*="manage project" i],[data-ui*="manage project" i],a[href*="manage.sanity" i],a[href*="sanity.io/manage" i],a[href*="sanity.io/projects" i],[data-ui="ReleasesNav"],button[aria-label*="schedule publish" i],[data-testid*="schedule-publish" i],[data-ui*="schedule-publish" i],#global-presence-menu,#user-menu').forEach(t=>{if(t.style.display="none",(t.textContent||"").toLowerCase().includes("manage project")){let i=t.parentElement;i&&"DIV"===i.tagName&&e.add(i)}}),Array.from(document.querySelectorAll('a,button,[role="button"]')).forEach(t=>{let i=(t.textContent||"").trim().toLowerCase();if("invite"===i||"invite team"===i||"invite people"===i||i.includes("invite"))t.style.display="none";else if("manage project"===i||i.includes("manage project")){t.style.display="none";let i=t.parentElement;i&&"DIV"===i.tagName&&e.add(i)}else("schedule publish"===i||"schedule for publishing"===i)&&(t.style.display="none")}),e.forEach(e=>{e.querySelectorAll('a:not([style*="display: none"]), button:not([style*="display: none"])').length<=1&&(e.style.display="none")})};e();let t=new MutationObserver(()=>e());return t.observe(document.body,{childList:!0,subtree:!0}),()=>t.disconnect()},[]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("style",{children:` 186 /* Hide Help (broad match) */ 187 a[aria-label*="help" i], button[aria-label*="help" i], [data-testid*="help" i], [data-ui*="help" i] { display: none !important; } 188 /* Hide specific "Help and resources" button */ 189 #menu-button-resources, [data-testid="button-resources-menu"], button[aria-label*="Help and resources" i] { display: none !important; } 190 /* Hide Invite/Team */ 191 a[aria-label*="invite" i], button[aria-label*="invite" i], [data-testid*="invite" i], [data-ui*="invite" i], 192 a[href*="invite" i], button[href*="invite" i], 193 a[aria-label*="team" i], button[aria-label*="team" i], [data-testid*="team" i], [data-ui*="team" i] { display: none !important; } 194 /* Hide Tasks */ 195 [data-ui*="task" i], [data-testid*="task" i], button[aria-label*="task" i], button[aria-label*="tasks" i], 196 button[data-testid="tasks-toolbar"] { display: none !important; } 197 /* Hide Upgrade/Trial/Upgrade notices */ 198 [aria-label*="upgrade" i], [aria-label*="trial" i], [data-ui*="upgrade" i], [data-ui*="trial" i], [data-testid*="upgrade" i], [data-testid*="trial" i], 199 a[href*="upgrade" i], a[href*="trial" i], button[href*="upgrade" i], button[href*="trial" i] { display: none !important; } 200 /* Hide the bolt/auto-update button shown in snippet */ 201 button:has(svg[data-sanity-icon="bolt"]) { display: none !important; } 202 /* Hide Manage project button / links */ 203 a[aria-label*="manage project" i], button[aria-label*="manage project" i], 204 [data-testid*="manage project" i], [data-ui*="manage project" i], 205 a[href*="manage.sanity" i], a[href*="sanity.io/manage" i], a[href*="sanity.io/projects" i] { display: none !important; } 206 /* Hide Releases nav and global presence menu */ 207 [data-ui="ReleasesNav"], #global-presence-menu, #user-menu { display: none !important; } 208 /* Hide scheduled-publish controls as a fallback for plugin-provided UI */ 209 button[aria-label*="schedule publish" i], 210 [data-testid*="schedule-publish" i], 211 [data-ui*="schedule-publish" i] { display: none !important; } 212 /* Hide mobile sidebar trigger (hamburger/menu button) */ 213 button:has(svg[data-sanity-icon="menu"]) { display: none !important; } 214 /* Fallback by aria-label if present */ 215 button[aria-label*="menu" i], button[aria-label*="navigation" i] { display: none !important; } 216 /* Hide parent container (modern browsers supporting :has) */ 217 div:has(> a[aria-label*="manage project" i]), 218 div:has(> button[aria-label*="manage project" i]), 219 div:has(> a[href*="manage.sanity" i]), 220 div:has(> a[href*="sanity.io/manage" i]), 221 div:has(> a[href*="sanity.io/projects" i]) { 222 display: none !important; 223 } 224 225 /* Hide the mobile sidebar/drawer overlay (contains avatar, Tasks, Sign out) */ 226 /* Match the open overlay card that includes the Sign out icon */ 227 [data-ui="Card"][data-open="true"]:has(svg[data-sanity-icon="leave"]) { 228 display: none !important; 229 visibility: hidden !important; 230 pointer-events: none !important; 231 } 232 /* Some builds wrap the drawer in a dialog-like container */ 233 [role="dialog"]:has(svg[data-sanity-icon="leave"]) { 234 display: none !important; 235 visibility: hidden !important; 236 pointer-events: none !important; 237 } 238 /* Also hide any sibling scrim/background cards when drawer is open */ 239 [data-open="true"] > [data-ui="Card"], 240 [data-open="true"] > [data-ui="Flex"] > [data-ui="Card"] { 241 display: none !important; 242 } 243
244 /* Improve contrast for selected items within Studio panes */ 245 [aria-selected="true"], 246 [data-selected="true"], 247 [data-state="selected"], 248 [data-is-selected="true"], 249 [aria-current="true"], 250 [role="option"][aria-selected="true"], 251 li[aria-selected="true"], 252 [role="row"][aria-selected="true"] { 253 color: #ffffff !important; 254 } 255 /* Ensure nested text, links, and icons inside selected rows are also white */ 256 [aria-selected="true"] *, 257 [data-selected="true"] *, 258 [data-state="selected"] *, 259 [data-is-selected="true"] *, 260 [aria-current="true"] *, 261 [role="option"][aria-selected="true"] *, 262 li[aria-selected="true"] *, 263 [role="row"][aria-selected="true"] * { 264 color: #ffffff !important; 265 fill: currentColor !important; 266 stroke: currentColor !important; 267 } 268 /* Links inside selected contexts should inherit */ 269 [aria-selected="true"] a, 270 [data-selected="true"] a, 271 [data-state="selected"] a, 272 [data-is-selected="true"] a, 273 [aria-current="true"] a { 274 color: inherit !important; 275 } 276 /* Limit default light text to Pane and Card only */ 277 [data-ui*="Pane" i], [data-ui*="Card" i] { 278 color: #ffffff; 279 } 280 281 /* Keep icons white for legibility across Studio */ 282 [data-ui*="Pane" i] svg, 283 [data-ui*="Card" i] svg, 284 [data-testid="Media"] svg, 285 svg.tabler-icon { 286 color: #ffffff !important; 287 stroke: currentColor !important; 288 } 289 290 /* Studio page background: neutral grayish dark */ 291 html, body { background-color: #141618 !important; } 292 293 /* Disabled buttons: keep text/icons readable (light gray) */ 294 button[disabled], 295 [data-disabled="true"] { 296 color: #c5d2da !important; 297 } 298 button[disabled] *, 299 [data-disabled="true"] * { 300 color: #c5d2da !important; 301 stroke: currentColor !important; 302 fill: none !important; 303 } 304 305 /* Active/enabled buttons: force white text/icons */ 306 button[data-ui="Button"]:not([disabled]), 307 [data-ui="Button"][data-disabled="false"] { 308 color: #ffffff !important; 309 } 310 button[data-ui="Button"]:not([disabled]) *, 311 [data-ui="Button"][data-disabled="false"] * { 312 color: #ffffff !important; 313 stroke: currentColor !important; 314 fill: none !important; 315 } 316 317 /* Hovered menu items: force white text/icons for readability */ 318 [data-ui="MenuItem"]:hover, 319 [data-ui="MenuItem"][data-hovered="true"], 320 [role="menuitem"]:hover, 321 [role="menuitem"][data-hovered="true"], 322 [role="menuitem"][aria-selected="true"] { 323 color: #ffffff !important; 324 } 325 [data-ui="MenuItem"]:hover *, 326 [data-ui="MenuItem"][data-hovered="true"] *, 327 [role="menuitem"]:hover *, 328 [role="menuitem"][data-hovered="true"] *, 329 [role="menuitem"][aria-selected="true"] * { 330 color: #ffffff !important; 331 stroke: currentColor !important; 332 fill: none !important; 333 } 334 `}),t(e)]})},logo:C,layout:function(e){let{renderDefault:t}=e;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("style",{children:` 335 footer, [data-ui*="footer" i], [data-testid*="footer" i], [data-ui*="branding" i] { display: none !important; } 336 a[href*="sanity.io" i], a[href*="snty.link" i] { display: none !important; } 337 svg[data-sanity-icon="sanity-logo"] { display: none !important; } 338 /* Hide any container that directly contains Sanity links (modern browsers) */ 339 div:has(> a[href*="sanity.io" i]), div:has(> a[href*="snty.link" i]) { display: none !important; } 340 /* Hide any flex that contains a sanity logo */ 341 div[data-ui="Flex"]:has(> * svg[data-sanity-icon="sanity-logo"]) { display:none !important; } 342 /* Hide separators (â¢) that become orphaned when links are removed */ 343 div[data-ui="Flex"] [data-ui="Text"] span:only-child { /* evaluate text content via JS if bullet left */ } 344 div[data-ui="Flex"] [data-ui="Text"] span { /* bullet cleanup via zero-width if bullet and adjacent hidden */ } 345 /* Directly hide sanity/snty links and their ancestor Text wrappers */ 346 a[href*="sanity.io" i], a[href*="snty.link" i] { display:none !important; } 347 a[href*="sanity.io" i] closest [data-ui="Text"], a[href*="snty.link" i] closest [data-ui="Text"] { display:none !important; } 348 /* Allow pane footer (document status / actions) to remain visible */ 349 [data-testid="pane-footer"] { display: block !important; } 350 /* Remove padding only from spans inside the text container of menu item buttons */ 351 /* Global rule: button span { padding:0 7px; } â override narrowly */ 352 button[data-ui="MenuItem"][role="menuitem"] [data-ui="Text"] span { padding: 0 !important; } 353 /* Extend to standard toolbar/action buttons (e.g., All types / Add filter) */ 354 button[data-ui="Button"] [data-ui="Text"] span { padding: 0 !important; } 355 /* Ensure all enabled Sanity buttons can shrink to content width */ 356 button[data-ui="Button"]:not([disabled]), [data-ui="Button"][data-disabled="false"] { min-width: 0 !important; } 357 /* Remove global padding from SVG icons inside those button text spans (e.g., chevron in All types) */ 358 button[data-ui="Button"] [data-ui="Text"] span svg { padding: 0 !important; width: 1em !important; height: 1em !important; } 359 /* Explicit hover + selected styling for Sanity menu items to defeat global button:hover rule */ 360 button[data-ui="MenuItem"][role="menuitem"]:hover:not(:disabled), 361 button[data-ui="MenuItem"][role="menuitem"][data-hovered="true"]:not(:disabled) { 362 /* Use Sanity-ish tokens; fallback colors if variables unavailable */ 363 background-color: var(--card-bg-color-hover, var(--card-bg-color, #1d1f21)) !important; 364 color: var(--card-fg-color, #ffffff) !important; 365 box-shadow: none !important; 366 } 367 /* Selected state (keyboard / active) */ 368 button[data-ui="MenuItem"][role="menuitem"][data-selected], 369 button[data-ui="MenuItem"][role="menuitem"][aria-selected="true"] { 370 background-color: var(--card-bg-color-selected, var(--card-bg-color-hover, #232629)) !important; 371 color: var(--card-fg-color, #ffffff) !important; 372 } 373 /* Focus-visible outline for accessibility */ 374 button[data-ui="MenuItem"][role="menuitem"]:focus-visible { 375 outline: 2px solid var(--focus-color, #344446); 376 outline-offset: 2px; 377 } 378 /* Timeline item: remove global button svg padding/size adjustments */ 379 button[data-ui="timelineItem"] svg { padding: 0 !important; width: 1em !important; height: 1em !important; } 380 button[data-ui="timelineItem"] [data-ui="Text"] span { padding: 0 !important; } 381 /* Timeline avatar: neutralize global button svg padding/size without shrinking avatar image */ 382 button[data-ui="timelineItem"] [data-ui="Avatar"] svg { padding: 0 !important; width: auto !important; height: auto !important; } 383 /* Ensure nested spans (some text wrappers add another span) also have no padding */ 384 button[data-ui="timelineItem"] [data-ui="Text"] span > span { padding: 0 !important; } 385 /* Version menu (timeline popover) explicit overrides */ 386 [data-ui="versionMenu"] [data-ui="timeline"] button[data-ui="timelineItem"] span, 387 [data-ui="versionMenu"] [data-ui="timeline"] button[data-ui="timelineItem"] span span, 388 [data-ui="versionMenu"] [data-ui="timeline"] button[data-ui="timelineItem"] span svg, 389 [data-ui="versionMenu"] [data-ui="timeline"] button[data-ui="timelineItem"] svg, 390 [data-ui="versionMenu"] [data-ui="timeline"] [data-ui="Text"] span, 391 [data-ui="versionMenu"] [data-ui="timeline"] [data-ui="Text"] span svg { 392 padding: 0 !important; 393 } 394 /* Ensure pane footer document status button is always visible */ 395 button[data-testid="pane-footer-document-status"] { display: inline-flex !important; opacity: 1 !important; visibility: visible !important; } 396 /* Hide only the avatar inside the pane footer status button (leave text like "Published X ago") */ 397 button[data-testid="pane-footer-document-status"] [data-ui="Avatar"] { display: none !important; } 398 /* Compact any negative margins left from avatar wrapper */ 399 button[data-testid="pane-footer-document-status"] [data-ui="Avatar"] + * { margin-left: 0 !important; } 400 401 /* ------------------------------------------------------------ */ 402 /* Dialog action buttons (e.g., Delete Document confirmation) */ 403 /* Prevent host globals (e.g., button:hover) from leaking in. */ 404 /* ------------------------------------------------------------ */ 405 [data-ui="DialogCard"] button[data-ui="Button"] [data-ui="Text"] span { padding: 0 !important; } 406 [data-ui="DialogCard"] button[data-ui="Button"] { 407 box-shadow: none !important; /* neutralize global shadow */ 408 /* Preserve Sanity's own background & color; don't force unless hovered */ 409 } 410 /* Hover / keyboard hover */ 411 [data-ui="DialogCard"] button[data-ui="Button"]:hover:not(:disabled), 412 [data-ui="DialogCard"] button[data-ui="Button"][data-hovered="true"]:not(:disabled) { 413 background-color: var(--button-bg-color-hover, var(--card-bg-color-hover, var(--card-bg-color, #1d1f21))) !important; 414 color: var(--button-fg-color, var(--card-fg-color, #ffffff)) !important; 415 box-shadow: none !important; 416 } 417 /* Focus-visible accessibility */ 418 [data-ui="DialogCard"] button[data-ui="Button"]:focus-visible { 419 outline: 2px solid var(--focus-color, #344446); 420 outline-offset: 2px; 421 } 422 /* Destructive tone (if Sanity adds data-tone="critical") keep distinct */ 423 [data-ui="DialogCard"] button[data-ui="Button"][data-tone="critical"]:hover:not(:disabled), 424 [data-ui="DialogCard"] button[data-ui="Button"][data-tone="danger"]:hover:not(:disabled) { 425 background-color: var(--button-danger-bg-color-hover, var(--button-danger-bg-color, #7a0b0b)) !important; 426 color: var(--button-danger-fg-color, #ffffff) !important; 427 } 428 `}),t(e)]})}},project:{basePath:"/catalog/admapps/cms/studio"}},form:{image:{assetSources:e=>[M,...e].filter((e,t,i)=>i.findIndex(t=>t.name===e.name)===t)},file:{assetSources:e=>[M,...e].filter((e,t,i)=>i.findIndex(t=>t.name===e.name)===t)}},schema:{types:tN,templates:e=>[...e.filter(e=>{let t="string"==typeof e.title?e.title.toLowerCase():"",i="string"==typeof e.id?e.id:"",n="string"==typeof e.schemaType?e.schemaType:"",a=["translation.metadata","translationMetadata","translation-metadata"];return!(a.includes(i)||a.includes(n)||t.includes("translation")&&t.includes("metadata"))}
428),{id:"appGroup-by-type",title:"Application Group by Type",schemaType:"appGroup",parameters:[{name:"appType",type:"string"}],value:e=>({appType:e?.appType})},{id:"rssPeriodicals-by-type",title:"RSS Periodicals by Type",schemaType:"rssPeriodicals",parameters:[{name:"periodicalType",type:"string"}],value:e=>{let t=e?.periodicalType==="SPECIAL"?"SPECIAL":"REGULAR";return{periodicalType:t,title:"SPECIAL"===t?"Print Only":"Regular"}}}]},document:{actions:(e,t)=>{let i="rssPeriodicals"===t.schemaType&&(t.documentId?.startsWith("rssPeriodicals-")||!0),n=e=>!!e?.archived,a=e=>{let t=(0,f.tH7)({apiVersion:"2024-01-01"}),i=(0,x.dj)(),[a,r]=(0,S.useState)(!1),o=n(e.draft)||n(e.published);return o&&!e.published?null:{label:o?"Finish archiving":"Archive",tone:"critical",icon:v.kbr,disabled:a,onHandle:async()=>{r(!0);try{await el(t,{documentId:e.id,documentType:e.type,draft:e.draft,published:e.published}),e.onComplete()}catch(e){i.push({status:"error",title:"Archive failed",description:e instanceof Error?e.message:"The document could not be archived and unpublished."})}finally{r(!1)}}}},r=n(t.document),o=e.filter(e=>{if(e===eM)return!1;let t=(e.name||e.displayName||"").toLowerCase(),n=t.replace(/[^a-z]/g,"");if(t.includes("delete")||t.includes("unpublish")||n.includes("schedulepublish")||n.includes("scheduledraft")||n.includes("releaseaction")||i&&t.includes("duplicate"))return!1;try{let t=e.toString().toLowerCase();if(t.includes("delete")&&t.includes("confirm"))return!1}catch{}return!0}),l=[];if(o.forEach(e=>{l.push(t=>{let{patch:a}=(0,f.QSs)(t.id,t.type),r=e(t);if(!r)return r;let o=r.action?.toLowerCase();if("delete"===o||"unpublish"===o)return null;let l=n(t.draft)||n(t.published),s=(e?.name||e?.displayName||"").toLowerCase(),d=(r.label||"").toLowerCase();if(d.includes("schedule publish")||d.includes("schedule for publishing")||d.includes("scheduled draft")||d.includes("add to release")||d.includes("create release")||d.includes("copy to release"))return null;let u="publish"===d||s.includes("publish"),c="duplicate"===d||s.includes("duplicate");if(i&&(c||"archive"===d||s.includes("archive")||"unarchive"===d))return null;if(l){if(u)return{label:"Unarchive",tone:"positive",icon:v.HZr,onHandle:()=>{a.execute([{set:{archived:!1},unset:["archivedAt"]}]),t.onComplete()}};if(c)return null}return r})}),i){let e=["delete","duplicate","unpublish","archive","unarchive"];return l.filter(t=>{let i=t?.name?.toLowerCase()||"";return!e.some(e=>i.includes(e))})}if(r)return[...l,eM,eC];let s=l.findIndex(e=>(e?.name?.toLowerCase()||"").includes("publish")),d=[...l];if(s>0){let e=d.splice(s,1);e[0]&&(d=[e[0],...d])}let u=d.findIndex(e=>(e?.name?.toLowerCase()||"").includes("duplicate")),c=[...d];return u>=0?c.splice(u,0,a):c.splice(1,0,a),[...c,eM,eC]}},icon:C,theme:eO});function t$(){return(0,o.jsx)(c.EQ,{config:tE})}},62730:(e,t,i)=>{"use strict";i.d(t,{V:()=>o,e:()=>r});let n=/^[0-9a-f]{2}$/iu,a=/[\u0080-\u009f\u200e\u200f\u202a-\u202e\u2066-\u2069\ufeff]/u;function r(e){let t="";for(let r=0;r<e.length;){var i;if("%"!==e[r]||!n.test(e.slice(r+1,r+3))){let i=e.codePointAt(r);if(void 0===i)break;let n=String.fromCodePoint(i);t+=a.test(n)?encodeURIComponent(n).toUpperCase():n,r+=n.length;continue}let o=(i=Number.parseInt(e.slice(r+1,r+3),16))>=194&&i<=223?2:i>=224&&i<=239?3:4*(i>=240&&i<=244);if(0===o){t+=e.slice(r,r+3),r+=3;continue}let l="",s=!0;for(let t=0;t<o;t+=1){let i=r+3*t,a=e.slice(i,i+3);if(3!==a.length||"%"!==a[0]||!n.test(a.slice(1))){s=!1;break}l+=a}if(!s){t+=e.slice(r,r+3),r+=3;continue}try{let e=decodeURIComponent(l);a.test(e)?t+=l:t+=e,r+=l.length}catch{t+=e.slice(r,r+3),r+=3}}return t}function o(e){let t=String(e||""),i="";try{i=new URL(t).pathname.split("/").pop()||""}catch{let e=t.split(/[?#]/u,1)[0]||"";i=e.split("/").pop()||e}try{let e=decodeURIComponent(i);return a.test(e)?r(i):e}catch{return r(i)}}},74961:(e,t,i)=>{"use strict";i.d(t,{GA:()=>f,T5:()=>m});var n=i(32697);let a=new TextEncoder,r=/[<>:"/\\|?*\u0000-\u001f\u007f-\u009f\u200e\u200f\u202a-\u202e\u2066-\u2069\ufeff]/gu,o=/^(?:con|prn|aux|nul|clock\$|conin\$|conout\$|com[1-9¹²³]|lpt[1-9¹²³])$/iu,l=/(\.[a-z0-9]{1,16})$/iu;function s(e){return a.encode(e).byteLength}function d(e,t){let i="",a=0;for(let r of(0,n.Ke)(e)){let e=s(r);if(a+e>t)break;
428i+=r,a+=e}return i}function u(e){return e.normalize("NFC").replace(r,"").trim().replace(/[. ]+$/gu,"")}function c(e){return u(e).replace(/^\.+/gu,"")}function p(e){let t=e.split(".",1)[0]?.replace(/[. ]+$/gu,"")||"";return o.test(t)?`file-${e}`:e}function m(e,t="file",i=180){let n=Math.max(1,Math.floor(i)),a=p(c(t)),r=d(p(c(e||a)),n).trim().replace(/[. ]+$/gu,"");return r||d(a,n).trim().replace(/[. ]+$/gu,"")}function f(e,t="file",i=180){let n=Math.max(32,Math.floor(i)),a=u(e||t),r=a.match(l),o=r?.[1]||"",h=o?a.slice(0,-o.length):a,y=m(t,"file",n)||"file",g=d(p(c(h)||y),Math.max(1,n-s(o))).trim().replace(/[. ]+$/gu,"");return`${g||y}${o}`}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.