1"use strict";(self.webpackChunksyllabyte_app=self.webpackChunksyllabyte_app||[]).push([[3175],{5284:(e,t,n)=>{n.d(t,{X:()=>c});var s=n(61630),l=n(88461),i=n(62726),a=n(47824),o=n(48136),r=n(90393);function c(e){let{isOpen:t,onClose:n,selectedSuggestion:c,fullSuggestionData:d,isLoading:u,error:p,onFeedbackSubmitted:m}=e;return c?(0,r.jsx)(i.a,{isOpen:t,onClose:n,title:`Suggestion Details: ${c.suggestionType}`,size:"4xl",showCancel:!0,cancelText:"Close",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"mb-6 border-b pb-4",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Suggestion ID:"}),(0,r.jsx)(s.K,{id:c.suggestionId})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Generated Confidence:"}),(0,r.jsx)("span",{className:"text-sm",children:a.n.formatPercentage(c.generatedConfidence)})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Slice ID:"}),(0,r.jsx)(s.K,{id:c.sliceId})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Feedback Confidence:"}),(0,r.jsx)("span",{className:"text-sm",children:a.n.formatPercentage(c.feedbackConfidence)})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Task ID:"}),c.taskId?(0,r.jsx)(s.K,{id:c.taskId}):(0,r.jsx)("span",{className:"text-sm text-gray-400 italic",children:"None"})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"State:"}),(0,r.jsx)("span",{className:"text-sm",children:c.state})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Total Feedback:"}),(0,r.jsx)("span",{className:"text-sm",children:c.totalFeedback})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Last Updated:"}),(0,r.jsx)("span",{className:"text-sm",children:c.lastUpdated})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Positive Feedback:"}),(0,r.jsx)("span",{className:"text-sm text-syllabyte-green font-medium",children:c.positiveFeedback})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Controversial:"}),(0,r.jsx)("span",{className:"text-sm "+(c.isControversial?"text-syllabyte-orange font-medium":""),children:c.isControversial?"Yes":"No"})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Neutral Feedback:"}),(0,r.jsx)("span",{className:"text-sm",children:c.neutralFeedback})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Type:"}),(0,r.jsx)("span",{className:"text-sm",children:c.suggestionType})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500 w-40",children:"Negative Feedback:"}),(0,r.jsx)("span",{className:"text-sm text-syllabyte-pink font-medium",children:c.negativeFeedback})]})]})}),u&&(0,r.jsx)("div",{className:"bg-white p-4 rounded-lg",children:(0,r.jsx)(l.A,{type:"spinner",variant:"card"})}),p&&(0,r.jsxs)("div",{className:"bg-syllabyte-pink/5 p-4 rounded-lg border border-syllabyte-pink/20",children:[(0,r.jsx)("h3",{className:"text-syllabyte-pink font-medium",children:"Error Loading Full Suggestion"}),(0,r.jsx)("p",{className:"text-syllabyte-pink mt-1",children:"Unable to load the complete suggestion details. Please try again."})]}),d&&(0,r.jsx)("div",{children:(0,r.jsx)(o.Z,{suggestion:d,onFeedbackSubmitted:m,hideJustification:!1,hideConfidence:!1})}),!d&&!u&&!p&&(0,r.jsxs)("div",{className:"space-y-4 bg-white p-4 rounded-lg",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-gray-500",children:"Suggested Value"}),(0,r.jsx)("div",{className:"mt-1 p-3 bg-gray-50 rounded border text-sm text-gray-900 whitespace-pre-wrap max-h-48 overflow-y-auto",children:c.suggestedValue||(0,r.jsx)("span",{className:"text-gray-400 italic",children:"No value provided"})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-gray-500",children:"Justification"}),(0,r.jsx)("div",{className:"mt-1 p-3 bg-gray-50 rounded border text-sm text-gray-900 whitespace-pre-wrap max-h-48 overflow-y-auto",children:c.justification||(0,r.jsx)("span",{className:"text-gray-400 italic",children:"No justification provided"})})]})]})]})}):null}},9695:(e,t,n)=>{n.d(t,{u:()=>i});var s=n(15917),l=n(49016);
1function i(){const[e,t]=(0,s.useState)(null),[n,i]=(0,s.useState)("content"),a=(0,s.useMemo)(()=>{var t,n,s,i,a,o;const r=e;return{contentOptionalFields:null!==(t=null===r||void 0===r?void 0:r.contentOptionalFields)&&void 0!==t?t:[],sliceOptionalFields:null!==(n=null===r||void 0===r?void 0:r.sliceOptionalFields)&&void 0!==n?n:[],propertiesColumns:null!==(s=null===r||void 0===r?void 0:r.propertiesColumns)&&void 0!==s?s:{},sliceMode:null!==(i=null===r||void 0===r?void 0:r.sliceMode)&&void 0!==i?i:l.NM.sliceMode,recordLevel:l.NM.recordLevel,includeDisabled:null!==(a=null===r||void 0===r?void 0:r.includeDisabled)&&void 0!==a?a:l.NM.includeDisabled,enrichFromSource:null!==(o=null===r||void 0===r?void 0:r.enrichFromSource)&&void 0!==o?o:l.NM.enrichFromSource,outputFormat:"xlsx",templateId:null===r||void 0===r?void 0:r.id,onixRunConfig:{},sendEmail:!0,wordRunConfig:{}}},[e]);return{selectedTemplate:e,handleTemplateSelect:e=>{t(e)},activeTab:n,setActiveTab:i,initialValues:a}}},13909:(e,t,n)=>{n.d(t,{_T:()=>s._,IK:()=>i});var s=n(45605),l=n(10957);class i{static async getScopeExportTemplates(e,t){return(await l.kL.get(`/scopes/${e}/${t}/export-templates`)).data}static async createScopeExportTemplate(e,t,n){return(await l.kL.post(`/scopes/${e}/${t}/export-templates`,n)).data}static async updateScopeExportTemplate(e,t,n,s){return(await l.kL.put(`/scopes/${e}/${t}/export-templates/${n}`,s)).data}static async deleteScopeExportTemplate(e,t,n){await l.kL.delete(`/scopes/${e}/${t}/export-templates/${n}`)}static async getProjectExportTemplates(e,t){return(await l.kL.get(`/projects/${e}/${t}/export-templates`)).data}static async createProjectExportTemplate(e,t,n){return(await l.kL.post(`/projects/${e}/${t}/export-templates`,n)).data}static async updateProjectExportTemplate(e,t,n,s){return(await l.kL.put(`/projects/${e}/${t}/export-templates/${n}`,s)).data}static async deleteProjectExportTemplate(e,t,n){await l.kL.delete(`/projects/${e}/${t}/export-templates/${n}`)}static async getContentExportTemplates(e,t){return(await l.kL.get(`/content/${e}/${t}/export-templates`)).data}static async createContentExportTemplate(e,t,n){return(await l.kL.post(`/content/${e}/${t}/export-templates`,n)).data}static async updateContentExportTemplate(e,t,n,s){return(await l.kL.put(`/content/${e}/${t}/export-templates/${n}`,s)).data}static async deleteContentExportTemplate(e,t,n){await l.kL.delete(`/content/${e}/${t}/export-templates/${n}`)}}},26559:(e,t,n)=>{n.d(t,{W:()=>l,p:()=>s});const s="01",l="WORLD"},27649:(e,t,n)=>{n.d(t,{$:()=>x});var s=n(61421),l=n(15917),i=n(88461),a=n(60131),o=n(11203),r=n(14045),c=n(51008),d=n(18920),u=n(7922),p=n(90393);async function m(e,t,n,s,l){if("project"===e)return o.u1.getProjectTask(t,n,l);if("scope"===e)return r.$.getScopeTask(t,n,l);return async function(e,t,n,s){var l;return n?a.TaskService.getContentTask(e,t,n,s):null!==(l=(await a.TaskService.getContentTasks(e,t)).find(e=>e.id===s))&&void 0!==l?l:null}(t,n,"sliceId"in s?s.sliceId:null,l)}const x=e=>{let{taskId:t,resourceType:n,ownerId:a,resourceId:o,sendEmail:r=!0}=e;const{getExportTasks:x}=(0,d.fh)(),h=(0,l.useRef)(null),[g,v]=(0,l.useState)(null),[b,y]=(0,l.useState)(!1),j=(0,l.useMemo)(()=>{var e;return null!==(e=x().find(e=>e.id===t))&&void 0!==e?e:null},[t,x]);(0,l.useEffect)(()=>{j&&(h.current=j)},[j]),(0,l.useEffect)(()=>{!h.current||j||g||b||(y(!0),m(n,a,o,h.current,t).then(e=>v(e)).catch(()=>v(null)).finally(()=>y(!1)))},[j,g,b,n,a,o,t]);const f=null!==j&&void 0!==j?j:g;if(!f&&b)return(0,p.jsx)(i.R,{type:"skeleton",variant:"list",lines:3});if(!f)return(0,p.jsx)(i.R,{});const N=f;return(0,p.jsxs)("div",{className:"mt-6",children:[(0,p.jsx)("h3",{className:"text-lg font-medium mb-4",children:"Export Progress"}),(0,p.jsx)("div",{className:"mb-4 p-3 bg-syllabyte-blue/5 border border-syllabyte-blue/20 rounded-md",children:(0,p.jsxs)("p",{className:"text-sm text-syllabyte-blue",children:[(0,p.jsx)("strong",{children:"Note:"})," Your export is being processed."," ",r?"You will receive an email with the download link when complete.":"The download link will appear below when complete."," ","Files expire in 90 days."]})}),(0,p.jsx)(u.y,{task:f}),"complete"===f.state&&N.exportUrl&&(0,p.jsx)("div",{className:"mt-4 p-4 bg-syllabyte-green/5 border border-syllabyte-green/20 rounded-lg",children:(0,p.jsxs)("div",{className:"flex items-center justify-between",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h4",{className:"font-medium text-green-900",children:"Export Ready"}),void 0!==N.contentItemsExported&&(0,p.jsxs)("p",{className:"text-sm text-green-700 mt-1",children:[N.contentItemsExported," content items",N.slicesExported?`, ${N.slicesExported} slices`:""]}),(0,p.jsxs)("p",{className:"text-xs text-syllabyte-green mt-1",children:[N.exportSizeBytes?`${(N.exportSizeBytes/1024/1024).toFixed(2)} MB`:"",N.expiryDate?` \xb7 Expires ${new Date(N.expiryDate).toLocaleDateString()}`:""]})]}),(0,p.jsxs)("a",{href:N.exportUrl,download:N.exportFileName,className:"inline-flex items-center gap-2 px-4 py-2 bg-syllabyte-green text-white rounded-lg hover:bg-syllabyte-green/90 transition-colors",children:[(0,p.jsx)(s.A,{className:"h-5 w-5"}),"Download"]})]})}),"complete"===f.state&&N.exportUrl&&(0,p.jsx)("div",{className:"mt-4",children:(0,p.jsx)(c.v,{warnings:N.warnings})}),("failed"===f.state||"broken"===f.state)&&(0,p.jsxs)("div",{className:"mt-4 p-4 bg-syllabyte-pink/5 border border-syllabyte-pink/20 rounded-lg",children:[(0,p.jsx)("h4",{className:"font-medium text-red-900",children:"Export Failed"}),(0,p.jsx)("p",{className:"text-sm text-syllabyte-pink mt-1",children:N.errorMessage||N.statusMessage||"An error occurred during export"}),N.errorDetails&&(0,p.jsx)("p",{className:"text-xs text-syllabyte-pink mt-2",children:N.errorDetails})]})]})}}
1,38104:(e,t,n)=>{n.d(t,{uc:()=>be,$i:()=>W});var s=n(10957);class l{static async previewProjectPlan(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(await s.kL.post(`/projects/${e}/${t}/look-inside/plan`,n)).data}static async queueProjectExport(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(await s.kL.post(`/projects/${e}/${t}/look-inside`,n)).data}static async getProjectResult(e,t){try{return(await s.kL.get(`/projects/${e}/${t}/look-inside`)).data}catch(l){var n;if(404===(null===l||void 0===l||null===(n=l.response)||void 0===n?void 0:n.status))return null;throw l}}static async getProjectPublicSettings(e,t){return(await s.kL.get(`/projects/${e}/${t}/look-inside/public-settings`)).data}static async updateProjectPublicSettings(e,t,n){await s.kL.put(`/projects/${e}/${t}/look-inside/public-settings`,n)}static async previewContentPlan(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(await s.kL.post(`/content/${e}/${t}/look-inside/plan`,n)).data}static async queueContentExport(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(await s.kL.post(`/content/${e}/${t}/look-inside`,n)).data}static async getContentResult(e,t){try{return(await s.kL.get(`/content/${e}/${t}/look-inside`)).data}catch(l){var n;if(404===(null===l||void 0===l||null===(n=l.response)||void 0===n?void 0:n.status))return null;throw l}}static async getContentPublicSettings(e,t){return(await s.kL.get(`/content/${e}/${t}/look-inside/public-settings`)).data}static async updateContentPublicSettings(e,t,n){await s.kL.put(`/content/${e}/${t}/look-inside/public-settings`,n)}}const i=(e,t)=>["project",e,t,"look-inside","result"],a=(e,t)=>["project",e,t,"look-inside","public-settings"],o=(e,t)=>["content",e,t,"look-inside","result"],r=(e,t)=>["content",e,t,"look-inside","public-settings"];var c=n(15917),d=n(60131),u=n(11203),p=n(37516);var m=n(80004),x=n(50714),h=n(95908),g=n(86131),v=n(39957),b=n(2139),y=n(84596),j=n(72061),f=n(74994),N=n(14166),C=n(62898),k=n(35014),w=n(94984),F=n(48199),S=n(75654),I=n(13903),T=n(63666);const $=["default","cover","frontMatter","interior","backMatter"],O=["top","right","bottom","left"],E={default:"Default",cover:"Cover",frontMatter:"Front Matter",interior:"Interior",backMatter:"Back Matter"};function R(e){return e?{top:null!=e.top?String(e.top):"",right:null!=e.right?String(e.right):"",bottom:null!=e.bottom?String(e.bottom):"",left:null!=e.left?String(e.left):""}:{top:"",right:"",bottom:"",left:""}}function M(e){var t;return{unit:null!==(t=null===e||void 0===e?void 0:e.unit)&&void 0!==t?t:"px",default:R(null===e||void 0===e?void 0:e.default),cover:R(null===e||void 0===e?void 0:e.cover),frontMatter:R(null===e||void 0===e?void 0:e.frontMatter),interior:R(null===e||void 0===e?void 0:e.interior),backMatter:R(null===e||void 0===e?void 0:e.backMatter)}}function P(e){const t={};let n=!1;for(const s of O){const l=e[s];if(""===l||null==l)continue;const i=Number(l);Number.isNaN(i)||(t[s]=i,n=!0)}return n?t:void 0}function A(e){const t={};let n=!1;for(const s of $){const l=P(e[s]);l&&(t[s]=l,n=!0)}if(n)return t.unit=e.unit,t}var L=n(90393);const D=[{key:"px",label:"Pixels (px)"},{key:"percent",label:"Percent (%)"}],B={top:"Top",right:"Right",bottom:"Bottom",left:"Left"},K=e=>{let{namePrefix:t="crop",cascadeNote:n}=e;return(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsxs)("div",{children:[(0,L.jsx)("h3",{className:"text-lg font-medium text-gray-900 border-b pb-2",children:"Crop Settings"}),(0,L.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Trim a fixed region off each edge of rendered pages before export, per per e role."}),(0,L.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Leave a role blank to fall back to Default."}),(0,L.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Use Percent for mixed source resolutions. Use Pixels only when all pages share the same resolution."}),n&&(0,L.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:n})]}),(0,L.jsx)(j.m,{name:`${t}.unit`,label:"Unit",options:D,search:!1}),(0,L.jsx)("div",{className:"space-y-2 bg-white p-5 rounded-lg border border-gray-200 shadow-sm",children:$.map(e=>(0,L.jsx)(f.y,{itemId:`crop-role-${e}`,title:E[e],menuEnabled:!1,defaultOpen:"default"===e,horizontalSpacer:!0,readingChildren:(0,L.jsxs)("div",{className:"space-y-4",children:["default"!==e&&(0,L.jsx)("p",{className:"text-sm text-gray-500",children:"Blank falls back to Default. Zero is an explicit value."}),(0,L.jsx)("div",{className:"grid grid-cols-2 gap-4",children:O.map(n=>(0,L.jsx)(C.A,{name:`${t}.${e}.${n}`,label:B[n],inputType:"number",placeholder:"Not set"},n))})]})},e))}),(0,L.jsx)("div",{className:"p-3 bg-syllabyte-blue/5 border border-syllabyte-blue/20 rounded-md",children:(0,L.jsx)("p",{className:"text-sm text-blue-700",children:"Preview thumbnails do not yet reflect crop settings. The exported images will be cropped correctly."})})]})},q=[{key:"jpg",label:"JPG"},{key:"png",label:"PNG"}],U=[{key:"sequential",label:"Sequential"},{key:"random",label:"Random"}],V={id:"",name:"",cover:"{isbn}.MAIN.{ext}",frontMatter:"{isbn}.FM{nn}.{ext}",interior:"{isbn}.IN{nn}.{ext}",back:"{isbn}.BACK{nn}.{ext}"},z=v.Ik({namingConventions:v.YO().of(v.Ik({id:v.Yj().required("Convention ID is required").matches(/^[a-z0-9][a-z0-9_-]{0,31}$/,"ID must be lowercase letters, digits, underscores, or hyphens only. Max 32 chars. Must start with a letter or digit.")}
1)).max(10,"Maximum 10 naming conventions allowed").test("unique-ids","Convention IDs must be unique",function(e){if(!e)return!0;const t=e.map(e=>e.id).filter(Boolean);return t.length===new Set(t).size}),crop:v.gl().test("crop-valid","Crop settings are invalid",function(e){if(!e)return!0;const t=function(e){const t=e.unit;if("px"!==t&&"percent"!==t)return`Crop unit '${t}' is invalid. Must be 'px' or 'percent'.`;for(const a of $){const o=e[a],r={};for(const e of O){const t=o[e];if(""===t||null==t)continue;const n=Number(t);if(!Number.isNaN(n)){if(n<0)return`Crop ${e} for ${a} must not be negative.`;r[e]=n}}if("percent"===t){var n,s,l,i;for(const n of O){const e=r[n];if(null!=e&&e>=50)return`Crop ${n} for ${a} is ${e}%; a single side must be less than 50% when unit is percent.`}const e=(null!==(n=r.top)&&void 0!==n?n:0)+(null!==(s=r.bottom)&&void 0!==s?s:0);if(e>=100)return`Crop top+bottom for ${a} totals ${e}%; must be less than 100%.`;const t=(null!==(l=r.left)&&void 0!==l?l:0)+(null!==(i=r.right)&&void 0!==i?i:0);if(t>=100)return`Crop left+right for ${a} totals ${t}%; must be less than 100%.`}}return null}(e);return!t||this.createError({message:t})})});const W=e=>{var t,n,s,l,i,a,o,r;let{mode:c,project:d,scope:p,content:v,onSaved:$}=e;const O=(0,x.jE)(),{error:E,handleError:R}=(0,w.C)(),P="project"===c?null===d||void 0===d?void 0:d.lookInsideConfig:"scope"===c?null===p||void 0===p?void 0:p.lookInsideConfig:null===v||void 0===v?void 0:v.lookInsideConfig,D=null===P||void 0===P?void 0:P.backMatterCount,B={isbn13:"project"===c&&null!==(t=null===d||void 0===d?void 0:d.isbn13)&&void 0!==t?t:"",isbn10:"project"===c&&null!==(n=null===d||void 0===d?void 0:d.isbn10)&&void 0!==n?n:"",zipFilenameTemplate:null!==(s=null===P||void 0===P?void 0:P.zipFilenameTemplate)&&void 0!==s?s:"{isbn}_{title}_{date}",namingConventions:(W=null===P||void 0===P?void 0:P.namingConventions,W&&0!==W.length?W.map(e=>{var t,n,s,l,i;return{id:e.id,name:null!==(t=e.name)&&void 0!==t?t:"",cover:null!==(n=e.cover)&&void 0!==n?n:"{isbn}.MAIN.{ext}",frontMatter:null!==(s=e.frontMatter)&&void 0!==s?s:"{isbn}.FM{nn}.{ext}",interior:null!==(l=e.interior)&&void 0!==l?l:"{isbn}.IN{nn}.{ext}",back:null!==(i=e.back)&&void 0!==i?i:"{isbn}.BACK{nn}.{ext}"}}):[]),frontMatterCount:null!==(l=null===P||void 0===P?void 0:P.frontMatterCount)&&void 0!==l?l:0,includeBack:0!==D,backMatterLimit:null!=D&&D>0?D:0,interiorCount:null!==(i=null===P||void 0===P?void 0:P.interiorCount)&&void 0!==i?i:3,interiorCountStart:null!==(a=null===P||void 0===P?void 0:P.interiorCountStart)&&void 0!==a?a:1,interiorSelectionStrategy:null!==(o=null===P||void 0===P?void 0:P.interiorSelectionStrategy)&&void 0!==o?o:"sequential",outputFormat:null!==(r=null===P||void 0===P?void 0:P.outputFormat)&&void 0!==r?r:"jpg",crop:M(null===P||void 0===P?void 0:P.crop)};var W;const _=(0,h.n)({mutationFn:async e=>{var t;const n=e.includeBack?e.backMatterLimit>0?e.backMatterLimit:null:0,s={zipFilenameTemplate:e.zipFilenameTemplate||void 0,namingConventions:(l=e.namingConventions,l.map(e=>{const t={id:e.id};return e.name.trim()&&(t.name=e.name.trim()),e.cover&&(t.cover=e.cover),e.frontMatter&&(t.frontMatter=e.frontMatter),e.interior&&(t.interior=e.interior),e.back&&(t.back=e.back),t})),frontMatterCount:e.frontMatterCount,backMatterCount:n,interiorCount:e.interiorCount,interiorCountStart:e.interiorCountStart,interiorSelectionStrategy:e.interiorSelectionStrategy,outputFormat:e.outputFormat,crop:null!==(t=A(e.crop))&&void 0!==t?t:null};var l;return"project"===c&&d?u.TR.updateProject({...d,isbn13:e.isbn13.trim()||null,isbn10:e.isbn10.trim()||null,lookInsideConfig:s}):"scope"===c&&p?T.c.updateScope(p.ownerId,p.id,{...p,lookInsideConfig:s}):"content"===c&&v?F.f.updateContent({...v,lookInsideConfig:s}):void 0},onSuccess:()=>{"project"===c&&null!==d&&void 0!==d&&d.ownerId&&null!==d&&void 0!==d&&d.id&&O.invalidateQueries({queryKey:I._.detail(d.ownerId,d.id)}),"content"===c&&null!==v&&void 0!==v&&v.ownerId&&null!==v&&void 0!==v&&v.id&&O.invalidateQueries({queryKey:S.M.detail(v.ownerId,v.id)}),null===$||void 0===$||$()},onError:R});return(0,L.jsx)(g.l1,{initialValues:B,enableReinitialize:!0,validationSchema:z,onSubmit:e=>{_.mutate(e)},children:e=>{let{values:t,setFieldValue:n,dirty:s,isValid:l,submitForm:i}=e;return(0,L.jsxs)(g.lV,{className:"space-y-8",children:["project"===c&&!(null!==d&&void 0!==d&&d.lookInsideConfig)&&(0,L.jsx)("div",{className:"p-3 bg-syllabyte-blue/5 border border-syllabyte-blue/20 rounded-md",children:(0,L.jsx)("p",{className:"text-sm text-blue-700",children:"Scope defaults are applied. Configure here to override per project."})}),"content"===c&&!(null!==v&&void 0!==v&&v.lookInsideConfig)&&(0,L.jsx)("div",{className:"p-3 bg-syllabyte-blue/5 border border-syllabyte-blue/20 rounded-md",children:(0,L.jsx)("p",{className:"text-sm text-blue-700",children:"System defaults are applied. Content has no scope or project cascade - configure here to set defaults for this item only."})}),"project"===c&&(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsx)("h3",{className:"text-lg font-medium text-gray-900 border-b pb-2",children:"Publishing Identifiers"}),(0,L.jsx)(C.A,{name:"isbn13",label:"ISBN-13",placeholder:"9781234567890"}),(0,L.jsx)(C.A,{name:"isbn10",label:"ISBN-10",placeholder:"0306406152",helper:"Optional"})]}),(0,L.jsx)(g.ED,{name:"namingConventions",children:e=>{let{push:n,remove:s,move:l}=e;return(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between border-b pb-2",children:[(0,L.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Naming Convention Templates"}),(0,L.jsx)(y.$,{variant:"syllabyteGreen",type:"button",icon:(0,L.jsx)(m.A,{className:"w-4 h-4"}),onClick:()=>n({...V}),disabled:t.namingConventions.length>=10,children:"Add Convention"})]}),(0,L.jsx)("p",{className:"text-sm text-gray-500",children:"Available tokens: {isbn}, {isbn10}, {title}, {date}, {ext}, {n}, {nn}, {nnn}, {role}, {templateId}, {templateName}"}),(0,L.jsxs)("div",{className:"space-y-2 bg-white p-5 rounded-lg border border-gray-200 shadow-sm",children:[0===t.namingConventions.length&&(0,L.jsxs)("p",{className:"text-sm text-gray-500 py-2",children:["scope"===c&&"No conventions set. System defaults apply. Add a convention to set programme-wide defaults.","project"===c&&"No project-level conventions set. Scope or system defaults apply. Add a convention to override for this project.","content"===c&&"No conventions set. System defaults apply. Add a convention to set defaults for this item."]}),t.namingConventions.map((e,n)=>(0,L.jsx)(f.y,{itemId:`convention-${n}`,itemIndex:n,itemsLength:t.namingConventions.length,title:(0,L.jsxs)("span",{className:"flex items-center gap-2",children:[e.id?(0,L.jsx)("span",{className:"font-mono text-sm bg-gray-100 px-2 py-0.5 rounded",children:e.id}):(0,L.jsx)("span",{className:"text-sm text-gray-400 italic",children:"New convention"}),e.name&&(0,L.jsx)("span",{className:"text-sm text-gray-500 font-normal",children:e.name})]}),menuEnabled:!0,defaultOpen:1===t.namingConventions.length,move:l,remove:t.namingConventions.length>1?()=>s(n):void 0,readingChildren:(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsx)(C.A,{name:`namingConventions.${n}.id`,label:"Convention ID",helper:"Lowercase letters, digits, underscores, or hyphens. Max 32 chars. Used as the subfolder name in the ZIP.",placeholder:"e.g. default, distributor-1, meridian"}),(0,L.jsx)(C.A,{name:`namingConventions.${n}.name`,label:"Display Name",helper:"Optional. Used by {templateName} token.",placeholder:"e.g. Meridian Books"}),(0,L.jsx)(C.A,{name:`namingConventions.${n}.cover`,label:"Cover"}),(0,L.jsx)(C.A,{name:`namingConventions.${n}.frontMatter`,label:"Front Matter"}),(0,L.jsx)(C.A,{name:`namingConventions.${n}.interior`,label:"Interior"}),(0,L.jsx)(C.A,{name:`namingConventions.${n}.back`,label:"Back Matter",helper:"Leave empty to exclude back matter from this convention's output"})]}),horizontalSpacer:!0},n))]}),(0,L.jsx)(C.A,{name:"zipFilenameTemplate",label:"ZIP Filename",helper:"Available tokens: {isbn}, {title}, {date}"})]})}}),(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsx)("h3",{className:"text-lg font-medium text-gray-900 border-b pb-2",children:"Output"}),(0,L.jsx)(j.m,{name:"outputFormat",label:"Format",options:q,search:!1})]}),(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsx)("h3",{className:"text-lg font-medium text-gray-900 border-b pb-2",children:"Interior Content"}
1),(0,L.jsx)(N.U,{name:"interiorCount",label:"Number of pages",min:1,max:20}),(0,L.jsx)(N.U,{name:"interiorCountStart",label:"Start from page",min:1,max:20,helper:"1 = first interior page, 3 = skip first two"}),(0,L.jsx)(j.m,{name:"interiorSelectionStrategy",label:"Selection method",options:U,search:!1})]}),(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsx)("h3",{className:"text-lg font-medium text-gray-900 border-b pb-2",children:"Front and Back Matter"}),(0,L.jsx)(N.U,{name:"frontMatterCount",label:"Front matter pages",min:0,max:10,helper:"0 to exclude front matter"}),(0,L.jsx)(k.l,{label:"Include back matter",caption:"Include detected back matter pages in the export",value:t.includeBack,onChange:e=>n("includeBack",e)}),t.includeBack&&(0,L.jsx)(N.U,{name:"backMatterLimit",label:"Back matter limit",min:0,max:20,helper:"0 to include all detected pages"})]}),(0,L.jsx)(K,{namePrefix:"crop",cascadeNote:"scope"===c?"These crop defaults apply to all projects in this scope. A project can override a role without clearing the rest of this configuration.":"project"===c?"Crop merges per role. A role set here overrides the scope default for that role only; other roles still fall back to the scope default.":"Content has no scope or project cascade. A role set here applies to this item only; other roles fall back to the system default."}),(0,L.jsx)(b.D,{error:E}),s&&(0,L.jsx)("div",{className:"pt-4 border-t",children:(0,L.jsx)("div",{className:"flex justify-end",children:(0,L.jsx)(y.$,{variant:"syllabyteBlue",type:"button",isLoading:_.isPending,disabled:_.isPending||!l,onClick:()=>i(),children:"Save Settings"})})})]})}})};var _=n(55889),G=n(3831),X=n(88461),Z=n(56653),Q=n(76126),Y=n(76005);const H=e=>{let{project:t,onSaved:n,onDismiss:s}=e;const[l,i]=(0,c.useState)(""),a=(0,h.n)({mutationFn:()=>u.TR.updateProject({...t,isbn13:l.trim()||null}),onSuccess:()=>{null===n||void 0===n||n()}});return(0,L.jsxs)("div",{className:"mb-4 p-3 bg-syllabyte-blue/5 border border-syllabyte-blue/20 rounded-md flex items-start gap-3",children:[(0,L.jsx)(Q.A,{className:"w-5 h-5 text-syllabyte-blue flex-shrink-0 mt-0.5"}),(0,L.jsxs)("div",{className:"flex-1",children:[(0,L.jsx)("p",{className:"text-sm text-blue-800 mb-2",children:"Add an ISBN-13 to include in Look Inside file names:"}),(0,L.jsxs)("div",{className:"flex gap-2",children:[(0,L.jsx)(C.A,{value:l,onChange:i,placeholder:"e.g. 9781234567890",inputType:"text"}),(0,L.jsx)(y.$,{variant:"syllabyteBlue",onClick:()=>a.mutate(),isLoading:a.isPending,disabled:!l.trim(),children:"Save"})]})]}),(0,L.jsx)("button",{onClick:s,className:"text-gray-400 hover:text-gray-600 flex-shrink-0",children:(0,L.jsx)(Y.A,{className:"w-4 h-4"})})]})};var J=n(36609),ee=n(84879),te=n(34494);const ne={queued:"Waiting to start...",planning:"Planning...",rendering:"Rendering...",packaging:"Packaging..."},se=e=>{var t;let{isRunning:n,statusMessage:s,progressPercent:l,isFailed:i,triggerError:a,onRetry:o,phase:r}=e;const c=i||null!==a;return(0,L.jsxs)("div",{className:"flex flex-col items-center py-8",children:[n&&!c&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ee.A,{autoPlay:!0,width:80,height:80}),(0,L.jsx)("p",{className:"text-sm text-gray-500 mt-3 text-center",children:null!==(t=ne[null!==r&&void 0!==r?r:""])&&void 0!==t?t:s}),l>0&&(0,L.jsx)("div",{className:"w-full mt-3",children:(0,L.jsx)(te.z,{progress:l,max:100,paused:!1})})]}),c&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(J.A,{className:"w-8 h-8 text-syllabyte-pink/70 mx-auto"}),(0,L.jsx)("p",{className:"text-sm text-syllabyte-pink text-center mt-2",children:null!==a&&void 0!==a?a:"The export failed. Please try again."}),(0,L.jsx)(y.$,{variant:"greyOutline",onClick:o,children:"Try Again"})]})]})};var le=n(88446);const ie={isPublic:!1,publicAccessKey:null};function ae(e,t){var n;const s=(null!==(n="https://prod.syllabyteaiapi.com")?n:"")+e;return t?s+"?access_key="+encodeURIComponent(t):s}const oe=e=>{var t;let{mode:n,ownerId:i,resourceId:o,result:d}=e;const u=(0,x.jE)(),{copyToClipboard:p,copied:m}=(0,le.i)(),[g,v]=(0,c.useState)(ie),[b,j]=(0,c.useState)(""),[f,N]=(0,c.useState)(!1),[w,F]=(0,c.useState)(null),[S,I]=(0,c.useState)(null),[T,$]=(0,c.useState)(null),O=(0,c.useMemo)(()=>"project"===n?a(i,o):r(i,o),[n,i,o]),{data:E,isLoading:R}=(0,G.I)({queryKey:O,queryFn:()=>"project"===n?l.getProjectPublicSettings(i,o):l.getContentPublicSettings(i,o),enabled:!!i&&!!o,refetchOnWindowFocus:!1});(0,c.useEffect)(()=>{var e;void 0!==E&&(v(E),j(null!==(e=E.publicAccessKey)&&void 0!==e?e:""))},[E]),(0,c.useEffect)(()=>{m||$(null)},[m]);const M=(0,h.n)({mutationFn:e=>"project"===n?l.updateProjectPublicSettings(i,o,e):l.updateContentPublicSettings(i,o,e),onSuccess:()=>
1{N(!0),u.invalidateQueries({queryKey:O})},onError:e=>{var t;e instanceof s.hD?F(null!==(t=e.message)&&void 0!==t?t:"Failed to save settings."):F("Failed to save settings.")}}),P=(0,c.useMemo)(()=>d.images?[...new Set(d.images.map(e=>e.convention))]:[],[d.images]);(0,c.useEffect)(()=>{P.length>0&&!S&&I(P[0])},[P,S]);const A=(0,c.useMemo)(()=>d.images&&S?d.images.filter(e=>e.convention===S).sort((e,t)=>"cover"===e.role?-1:"cover"===t.role?1:e.filename.localeCompare(t.filename)):[],[d.images,S]),D=(e,t)=>{p(e),$(t)},B=null!==(t=null===E||void 0===E?void 0:E.publicAccessKey)&&void 0!==t?t:null,K=!0===(null===E||void 0===E?void 0:E.isPublic)&&null!=d.images&&d.images.length>0;return R?(0,L.jsx)("div",{className:"py-4 text-sm text-gray-500",children:"Loading public access settings..."}):(0,L.jsxs)("div",{className:"space-y-6 pt-6 border-t",children:[(0,L.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Public Image Access"}),null===d.images&&(0,L.jsx)("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded-md",children:(0,L.jsx)("p",{className:"text-sm text-amber-800",children:"Individual image URLs are not available for this export. Regenerate to enable public image links."})}),(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsx)(k.l,{label:"Enable public access",caption:"Allow unauthenticated access to individual page images",value:g.isPublic,onChange:e=>{N(!1),F(null),v(t=>({...t,isPublic:e}))}}),g.isPublic&&(0,L.jsxs)("div",{className:"space-y-2",children:[(0,L.jsx)(C.A,{label:"Access key (optional)",helper:"Restrict image access with a key. All image URLs must include ?access_key=... when set. Minimum 12 characters.",placeholder:"Enter a secure access key",value:b,onChange:e=>{N(!1),F(null),j(e)}}),b&&(0,L.jsx)(y.$,{variant:"greyOutline",onClick:()=>{N(!1),F(null),j("")},children:"Clear key"})]}),(0,L.jsxs)("div",{className:"flex items-center gap-3",children:[(0,L.jsx)(y.$,{variant:"syllabyteBlue",onClick:()=>{N(!1),F(null);const e=b.trim();e&&e.length<12?F("Access key must be at least 12 characters long."):M.mutate({isPublic:g.isPublic,publicAccessKey:e||null})},isLoading:M.isPending,children:"Save changes"}),f&&(0,L.jsx)("p",{className:"text-sm text-syllabyte-green",children:"Settings saved."}),w&&(0,L.jsx)("p",{className:"text-sm text-syllabyte-pink",children:w})]})]}),K&&(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsx)("h4",{className:"text-sm font-medium text-gray-700 border-t pt-4",children:"Public image URLs"}),P.length>1&&(0,L.jsx)("div",{className:"flex flex-wrap gap-2",children:P.map(e=>(0,L.jsx)(y.$,{variant:S===e?"columnToggleActive":"columnToggleInactive",onClick:()=>I(e),children:e},e))}),(0,L.jsx)("div",{className:"space-y-3",children:A.map(e=>{const t=ae(e.publicUrl,B);return(0,L.jsxs)("div",{className:"space-y-1",children:[(0,L.jsxs)("p",{className:"text-xs text-gray-500 font-mono",children:[e.filename,(0,L.jsxs)("span",{className:"ml-2 text-gray-400",children:[e.widthPx,"\xd7",e.heightPx]})]}),(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[(0,L.jsx)("code",{className:"flex-1 text-xs bg-gray-100 px-3 py-2 rounded border border-gray-300 overflow-x-auto whitespace-nowrap",children:t}),(0,L.jsx)(y.$,{variant:"greyOutline",onClick:()=>D(t,e.filename),children:T===e.filename?"Copied":"Copy"})]})]},e.filename)})}),A.length>1&&(0,L.jsx)("div",{className:"flex justify-end",children:(0,L.jsx)(y.$,{variant:"greyOutline",onClick:()=>{const e=A.map(e=>ae(e.publicUrl,B)).join("\n");D(e,"all")},children:"all"===T?"Copied":"Copy all URLs"})})]}),!0===(null===E||void 0===E?void 0:E.isPublic)&&null!=d.images&&0===d.images.length&&(0,L.jsx)("p",{className:"text-sm text-gray-500 pt-4 border-t",children:"No images were captured in the last export."})]})};var re=n(41536),ce=n(61421),de=n(75573),ue=n(51008);const pe=e=>{let{result:t,isbn13:n,onRegenerate:s}=e;const{copyToClipboard:l,copied:i}=(0,le.i)();return(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between",children:[(0,L.jsxs)("span",{className:"text-sm font-medium text-syllabyte-green",children:[(0,L.jsx)(re.A,{className:"w-4 h-4 inline mr-1"}),"Ready"]}),(0,L.jsx)(y.$,{variant:"greyOutline",onClick:s,children:"Regenerate"})]}),(0,L.jsxs)("p",{className:"text-sm text-gray-600",children:["Generated: ",(0,de.kU)(t.generatedAt)]}),(0,L.jsxs)("p",{className:"text-sm text-gray-500",children:[t.fileCount," file",1!==t.fileCount?"s":"",t.coverIncluded?" \xb7 Cover included":""," \xb7"," ",t.interior
1Count," interior",n?` \xb7 ISBN: ${n}`:""]}),t.isPositionalFallback&&(0,L.jsx)("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded-md",children:(0,L.jsx)("p",{className:"text-sm text-amber-800",children:"Pages were selected by position rather than content analysis. Consider reviewing the selection before distribution."})}),null===t.images&&(0,L.jsx)("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded-md",children:(0,L.jsx)("p",{className:"text-sm text-amber-800",children:"Individual image URLs are not available for this export. Regenerate to enable public image links."})}),(0,L.jsxs)("div",{className:"flex gap-3 flex-wrap",children:[(0,L.jsx)("a",{href:t.exportUrl,download:!0,target:"_blank",rel:"noreferrer",children:(0,L.jsx)(y.$,{variant:"syllabyteBlue",icon:(0,L.jsx)(ce.A,{}),children:"Download ZIP"})}),(0,L.jsx)(y.$,{variant:"greyOutline",onClick:()=>l(t.exportUrl),children:i?"Copied":"Copy Download URL"})]}),(0,L.jsx)(ue.v,{warnings:t.warnings})]})};var me=n(82309),xe=n(62726);const he=["COVER","FRONT_MATTER","INTERIOR","BACK_MATTER"],ge={COVER:"Cover",FRONT_MATTER:"Front Matter",INTERIOR:"Interior",BACK_MATTER:"Back Matter"},ve=e=>{let{isOpen:t,plan:n,onClose:s,onGenerate:l,onReconfigure:i,isGenerating:a=!1}=e;const o=n.selections.reduce((e,t)=>{var n;const s=null!==(n=e.get(t.role))&&void 0!==n?n:[];return s.push(t),e.set(t.role,s),e},new Map);return(0,L.jsxs)(xe.a,{isOpen:t,onClose:s,title:"Proposed Page Selection",size:"4xl",showCancel:!1,primaryAction:{label:a?"Generating...":"Generate with This Selection",onClick:()=>l(n),variant:"syllabyteBlue",isLoading:a,disabled:a},secondaryAction:{label:"Reconfigure",onClick:i,variant:"greyOutline"},children:[n.isPositionalFallback&&(0,L.jsx)("div",{className:"mb-4 p-3 bg-amber-50 border border-amber-200 rounded-md",children:(0,L.jsx)("p",{className:"text-sm text-amber-800",children:"File names and content did not give us enough to identify roles. Pages were selected by position. Verify the selection before generating."})}),(0,L.jsx)("div",{className:"space-y-6",children:he.filter(e=>o.has(e)).map(e=>{const t=o.get(e);return(0,L.jsxs)("div",{children:[(0,L.jsx)("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:ge[e]}),(0,L.jsx)("div",{className:"flex flex-wrap gap-3",children:t.map(e=>(0,L.jsxs)("div",{className:"flex flex-col items-center",children:[e.thumbnailUrl?(0,L.jsx)("img",{src:e.thumbnailUrl,alt:`Page ${e.pageIndex+1}`,className:"object-cover rounded border border-gray-200",style:{width:80,height:112},loading:"lazy"}):(0,L.jsxs)("div",{className:"flex flex-col items-center justify-center rounded border border-gray-200 bg-gray-100 text-gray-400",style:{width:80,height:112},children:[(0,L.jsx)(me.A,{className:"w-6 h-6 mb-1"}),(0,L.jsxs)("span",{className:"text-xs text-center px-1",children:["Page ",e.pageIndex+1]})]}),(0,L.jsxs)("span",{className:"text-xs text-gray-500 mt-1",children:[Math.round(100*e.confidence),"%"]}),e.notes&&(0,L.jsx)("span",{className:"text-xs text-gray-400 mt-0.5 max-w-[80px] text-center leading-tight",children:e.notes})]},`${e.contentItemId}-${e.pageIndex}`))})]},e)})})]})},be=e=>{var t,n,s,a,r,m,g,v,b,j,f,N,C,k,w,F,S,T,$,O,E,R;let{mode:M,project:P,content:A,onSettingsClick:D,onRefetchProject:B,onRefetchContent:K}=e;const q=(0,x.jE)(),U="project"===M?null!==(t=null===P||void 0===P?void 0:P.ownerId)&&void 0!==t?t:"":null!==(n=null===A||void 0===A?void 0:A.ownerId)&&void 0!==n?n:"",V="project"===M?null!==(s=null===P||void 0===P?void 0:P.id)&&void 0!==s?s:"":null!==(a=null===A||void 0===A?void 0:A.id)&&void 0!==a?a:"",z="project"===M?null!==(r=null===P||void 0===P||null===(m=P.lookInsideResult)||void 0===m?void 0:m.currentTaskId)&&void 0!==r?r:null:null!==(g=null===A||void 0===A||null===(v=A.lookInsideResult)||void 0===v?void 0:v.currentTaskId)&&void 0!==g?g:null,Q="project"===M?null===P||void 0===P?void 0:P.isbn13:null!==(b=null!==(j=null===A||void 0===A?void 0:A.isbn13)&&void 0!==j?j:null===A||void 0===A?void 0:A.isbn)&&void 0!==b?b:null,[Y,J]=(0,c.useState)(!1),[ee,te]=(0,c.useState)(!1),[ne,le]=(0,c.useState)(null),ie=(0,G.I)({queryKey:"project"===M?i(U,V):o(U,V),queryFn:()=>"project"===M?l.getProjectResult(U,V):l.getContentResult(U,V),enabled:!!U&&!!V,retry:!1,refetchOnWindowFocus:!1}),ae=(0,G.I)({queryKey:"project"===M&&null!==P&&void 0!==P&&P.ownerId&&null!==P&&void 0!==P&&P.id?I._.contentList(P.ownerId,P.id):["disabled"],queryFn:()=>u.TR.getContent(P.ownerId,P.id),enabled:"project"===M&&!(null===P||void 0===P||!P.ownerId)&&!(null===P||void 0===P||!P.id),refetchOnWindowFocus:!1}),re=null!==(f=ae.data)&&void 0!==f?f:[],ce=re.some(e=>(0,Z.Ie)(e.fileExtension)),de=re.length,ue=function(e){let{mode:t,ownerId:n,resourceId:s,initialTaskId:i,onComplete:a,onFailed:o}=e;const[r,m]=(0,c.useState)(null),[x,h]=(0,c.useState)(null!==i&&void 0!==i?i:null),g=(0,c.useRef)({}),v=(0,c.useRef)(a),b=(0,c.useRef)(o);(0,c.useEffect)(()=>{v.current=a},[a]),(0,c.useEffect)(()=>{b.current=o},[o]);const y=(0,c.useCallback)(e=>"project"===t?u.u1.getProjectTask(n,s,e):d.TaskService.getContentTask(n,s,s,e),[t,n,s]),j=(0,c.useMemo)(()=>"project"===t?["project",n,s,"look-inside","task"]:["content",n,s,"look-inside","task"],[t,n,s]),f=(0,p.n)({trigger:async()=>{const e="project"===t?await l.queueProjectExport(n,s,g.current):await l.queueContentExport(n,s,g.current);return h(e.taskId),{taskId:e.taskId}},fetchTask:y,queryKeyPrefix:j,initialTaskId:null!==i&&void 0!==i?i:null,pollingIntervalMs:2e3,onComplete:()=>{h(null),("project"===t?()=>l.getProjectResult(n,s):()=>l.getContentResult(n,s))().then(e=>{var t;e&&(m(e),null===(t=v.current)||void 0===t||t.call(v,e))})},onFailed:e=>{var t;h(null),"abandoned"!==e.state&&(null===(t=b.current)||void 0===t||t.call(b))},onTriggerError:()=>{h(null)}}),N=(0,c.useCallback)(e=>{g.current=e,f.run()},[f]),C=(0,c.useCallback)(()=>{h(null),m(null),f.reset()},[f]),k=f.task,w=null!=k&&f.isFailed,F="abandoned"===(null===k||void 0===k?void 0:k.state);return{queue:N,reset:C,task:k,result:r,isRunning:f.isRunning,isComplete:f.isComplete,isFailed:w,isAbandoned:F,progressPercent:f.progressPercent,statusMessage:f.statusMessage,triggerError:f.triggerError,taskId:x}}({mode:M,ownerId:U,resourceId:V,initialTaskId:z,onComplete:()=>
1{q.invalidateQueries({queryKey:"project"===M?i(U,V):o(U,V)})}}),me=(0,h.n)({mutationFn:()=>"project"===M?l.previewProjectPlan(U,V,{}):l.previewContentPlan(U,V,{}),onSuccess:e=>{le(e),J(!0)}}),xe=null!==(N=null!==(C=ue.result)&&void 0!==C?C:ie.data)&&void 0!==N?N:null,he="content"!==M||(0,Z.Ie)(null===A||void 0===A?void 0:A.fileExtension);let ge;ge=U&&V?"content"!==M||he?ue.isRunning||ue.isFailed?"generating":ue.isAbandoned?null!==xe?"generated":"not-generated":null!==xe?"generated":ie.isLoading||"project"===M&&ae.isLoading?"loading":"project"===M&&0===de?"no-content":"project"!==M||ce?"not-generated":"no-renderable-content":"unsupported":"loading";const be=()=>te(!1);return"content"===M&&ee?(0,L.jsxs)("div",{className:"space-y-6",children:[(0,L.jsxs)("div",{className:"pb-4 border-b flex justify-between items-center",children:[(0,L.jsxs)("h2",{className:"text-xl leading-6 font-medium",children:[(0,L.jsx)(_.A,{className:"text-syllabyte-navy w-7 float-left -mt-1 mr-2"}),"Look Inside Settings"]}),(0,L.jsx)(y.$,{variant:"greyOutline",onClick:be,children:"Back"})]}),(0,L.jsx)(W,{mode:"content",content:A,onSaved:()=>{be(),null===K||void 0===K||K()}})]}):(0,L.jsxs)("div",{className:"space-y-6",children:[(0,L.jsxs)("div",{className:"pb-4 border-b flex justify-between items-center",children:[(0,L.jsxs)("h2",{className:"text-xl leading-6 font-medium",children:[(0,L.jsx)(_.A,{className:"text-syllabyte-navy w-7 float-left -mt-1 mr-2"}),"Look Inside"]}),"project"===M&&D&&(0,L.jsx)(y.$,{variant:"greyOutline",onClick:D,children:"Settings"}),"content"===M&&"loading"!==ge&&(0,L.jsx)(y.$,{variant:"greyOutline",onClick:()=>te(!0),children:"Settings"})]}),"project"===M&&P&&"loading"!==ge&&(0,L.jsxs)("p",{className:"text-sm text-gray-500",children:[Q?`ISBN: ${Q}`:"No ISBN set"," \xb7 ",(null!==(k=null===(w=P.lookInsideConfig)||void 0===w?void 0:w.outputFormat)&&void 0!==k?k:"jpg").toUpperCase()," \xb7 ",null!==(F=null===(S=P.lookInsideConfig)||void 0===S?void 0:S.interiorCount)&&void 0!==F?F:3," interior pages"]}),"content"===M&&A&&"loading"!==ge&&(0,L.jsxs)("p",{className:"text-sm text-gray-500",children:[Q?`ISBN: ${Q}`:"No ISBN set"," \xb7 ",(null!==(T=null===($=A.lookInsideConfig)||void 0===$?void 0:$.outputFormat)&&void 0!==T?T:"jpg").toUpperCase()," \xb7 ",null!==(O=null===(E=A.lookInsideConfig)||void 0===E?void 0:E.interiorCount)&&void 0!==O?O:3," interior pages"]}),"project"===M&&!Q&&de>0&&(0,L.jsx)(H,{project:P,onSaved:B}),"loading"===ge&&(0,L.jsx)(X.A,{}),"unsupported"===ge&&(0,L.jsx)("div",{className:"py-8 text-center",children:(0,L.jsx)("p",{className:"text-sm text-gray-500",children:"Look Inside is only available for PDF and image files."})}),"no-content"===ge&&(0,L.jsx)("div",{className:"py-8 text-center",children:(0,L.jsx)("p",{className:"text-sm text-gray-500",children:"Upload content to this project to generate a Look Inside export."})}),"no-renderable-content"===ge&&(0,L.jsx)("div",{className:"py-8 text-center",children:(0,L.jsx)("p",{className:"text-sm text-gray-500",children:"Look Inside requires at least one PDF or image file in this project."})}),"generating"===ge&&(0,L.jsx)(se,{isRunning:ue.isRunning,statusMessage:ue.statusMessage,progressPercent:ue.progressPercent,isFailed:ue.isFailed,triggerError:ue.triggerError,onRetry:()=>ue.reset(),phase:null===(R=ue.task)||void 0===R?void 0:R.phase}),"generated"===ge&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(pe,{result:xe,isbn13:Q,onRegenerate:()=>{ue.reset(),ue.queue({})}}),(0,L.jsx)(oe,{mode:M,ownerId:U,resourceId:V,result:xe})]}),"not-generated"===ge&&(0,L.jsxs)("div",{className:"space-y-4",children:[(0,L.jsx)("p",{className:"text-sm text-gray-500",children:"No Look Inside has been generated yet."}),(0,L.jsxs)("div",{className:"flex gap-3 flex-wrap",children:[(0,L.jsx)(y.$,{variant:"greyOutline",onClick:()=>me.mutate(),isLoading:me.isPending,children:"Preview Selection"}),(0,L.jsx)(y.$,{variant:"syllabyteBlue",onClick:()=>ue.queue({}),isLoading:ue.isRunning,children:"Generate Look Inside"})]})]}),ne&&(0,L.jsx)(ve,{isOpen:Y,plan:ne,onClose:()=>J(!1),onGenerate:e=>{J(!1),ue.queue({planOverride:e})},onReconfigure:()=>{J(!1),"project"===M?null===D||void 0===D||D():te(!0)},isGenerating:ue.isRunning})]})}},45605:(e,t,n)=>{n.d(t,{_:()=>i});var s=n(80376),l=n(10957);
1class i{static async getExportAvailableFields(e){return(await l.kL.get(`/content/export/available-fields/${e}`)).data}static async exportContent(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"xlsx";return(await l.kL.post(`/content/${e}/export?outputFormat=${n}`,t)).data}static async exportProject(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"xlsx";try{return(await l.kL.post(`/projects/${e}/${t}/export?outputFormat=${s}`,n)).data}catch(a){var i;if(403===(null===a||void 0===a||null===(i=a.response)||void 0===i?void 0:i.status))throw new Error("You don't have permission to export this project. Contributor or Administrator access is required.");throw a}}static async exportScope(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"xlsx";return(await l.kL.post(`/scopes/${e}/${t}/export?outputFormat=${s}`,n)).data}static async exportProfile(e){return(await l.kL.post("/profile/tasks",e)).data}static async downloadTemplate(e){try{var t;const n=await l.kL.post("/projects/export/template",{mode:e},{responseType:"blob"}),i=n.headers["content-disposition"],a=i?null===(t=i.split("filename=")[1])||void 0===t?void 0:t.replace(/"/g,""):`syllabyte-import-template-${e}.xlsx`,o=new Blob([n.data],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});(0,s.saveAs)(o,a)}catch(a){var n,i;if(400===(null===a||void 0===a||null===(n=a.response)||void 0===n?void 0:n.status))throw new Error("Invalid template request. Please try again.");if(500===(null===a||void 0===a||null===(i=a.response)||void 0===i?void 0:i.status))throw new Error("Failed to generate template. Please try again later.");throw a}}}},47824:(e,t,n)=>{n.d(t,{n:()=>s});class s{static validateTextLength(e){const t=e.length;return t<40?{isValid:!1,length:t,message:`Text must be at least 40 characters for meaningful analysis. Current length: ${t} characters.`}:{isValid:!0,length:t,message:null}}static formatPercentage(e){return`${(100*e).toFixed(arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}%`}static formatAnalysisScore(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 0===e?"Invalid":e.toFixed(t)}}},49016:(e,t,n)=>{n.d(t,{NM:()=>s,tH:()=>i,vi:()=>l});const s={sliceMode:"perSlice",recordLevel:"Content",includeDisabled:!0,enrichFromSource:!0},l=e=>({templateId:e.templateId,sliceMode:"marc21xml"===e.outputFormat?"perSlice":e.sliceMode,recordLevel:"marc21xml"===e.outputFormat?e.recordLevel:void 0,includeFields:e.contentOptionalFields,sliceIncludeFields:"none"===e.sliceMode?[]:e.sliceOptionalFields,includeDisabled:e.includeDisabled,enrichFromSource:e.enrichFromSource,propertiesColumns:e.propertiesColumns,includeReproductionNote:e.includeReproductionNote,onixRunConfig:"onix"===e.outputFormat?e.onixRunConfig:void 0,sendEmail:e.sendEmail,wordRunConfig:"docx"===e.outputFormat?e.wordRunConfig:void 0}),i=e=>({sliceMode:"marc21xml"===e.outputFormat?"perSlice":e.sliceMode,recordLevel:"marc21xml"===e.outputFormat?e.recordLevel:void 0,contentIncludeFields:e.contentOptionalFields,sliceIncludeFields:"none"===e.sliceMode?[]:e.sliceOptionalFields,includeDisabled:e.includeDisabled,enrichFromSource:e.enrichFromSource,templateId:e.templateId,propertiesColumns:e.propertiesColumns,onixRunConfig:"onix"===e.outputFormat?e.onixRunConfig:void 0,sendEmail:e.sendEmail})},59683:(e,t,n)=>{n.d(t,{O:()=>p});var s=n(86131),l=n(15917),i=n(48676),a=n(26559),o=n(72061),r=n(95243),c=n(35014),d=n(90393);function u(e){let{items:t,onRemove:n,emptyText:s,emptyDescription:l,entityName:i,getLabel:a,getCaption:o,showCount:u=!0,className:p=""}=e;return 0===t.length?(0,d.jsx)(r.r,{text:s||`No ${i.toLowerCase()} selected`,description:l}):(0,d.jsxs)("div",{className:`space-y-2 ${p}`,children:[(0,d.jsxs)("h4",{className:"font-medium text-gray-700",children:["Selected ",i," ",u&&`(${t.length})`]}),(0,d.jsx)("div",{className:"space-y-2",children:t.map((e,t)=>(0,d.jsx)("div",{className:"text-sm border-b pb-2 last:border-b-0",children:(0,d.jsx)(c.l,{value:!0,label:a(e),caption:null===o||void 0===o?void 0:o(e),onChange:()=>n(e)})},e.id||`item-${t}`))})]})}const p=e=>{var t,n;let{name:r,disabled:p=!1}=e;const[m,,x]=(0,s.Mt)(r),{data:h}=(0,i.v)(),[g,v]=(0,l.useState)(""),b=null!==(t=m.value)&&void 0!==t?t:"",y=b.trim()===a.W,j=y?[]:b.split(" ").map(e=>e.trim()).filter(e=>e.length>0),f=(null!==(n=null===h||void 0===h?void 0:h.countries)&&void 0!==n?n:[]).map(e=>({key:e.value,label:e.displayName}));return(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(c.l,{label:"Worldwide",value:y,onChange:e=>{x.setValue(e?a.W:"")},isDisabled:p}),!y&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(o.m,{label:"Add country",options:f,search:!0,disabled:p,value:g,onChange:e=>{v(""),e&&!j.includes(e)&&x.setValue([...j,e].join(" "))}}),(0,d.jsx)(u,{items:j.map(e=>({id:e,code:e})),onRemove:e=>{const t=j.filter(t=>t!==e.code);x.setValue(t.join(" "))},getLabel:e=>(e=>{var t,n;return null!==(t=null===h||void 0===h||null===(n=h.countries.find(t=>t.value===e))||void 0===n?void 0:n.displayName)&&void 0!==t?t:e})(e.code),entityName:"countries"})]})]})}}
1,70833:(e,t,n)=>{n.d(t,{_:()=>X});var s=n(82309),l=n(74875),i=n(56797),a=n(61421),o=n(3831),r=n(86131),c=n(15917),d=n(84596),u=n(72061),p=n(48988),m=n(90393);const x=e=>{let{selectedFormat:t,onChange:n,options:s,disabled:l=!1,label:i="Select Export Format"}=e;const a=s.map(e=>({key:e.value,label:e.label,description:`${e.description} \u2022 File type: ${e.fileExtension}`}));return(0,m.jsx)("div",{className:"space-y-2",children:(0,m.jsx)(p.L,{label:i,options:a,selectedKey:t,onChange:n,disabled:l})})},h=[{key:"perSlice",label:"Full export (one row per slice)",description:"One row per slice. All requested slice fields are written to individual rows. Best for content analysis, round-trip import, and rule validation."},{key:"none",label:"Content metadata only",description:"One row per content item. No slice documents are loaded. Fastest option, best for book catalogs, ISBN/DOI listings, and publisher metadata."},{key:"canonical",label:"Content with merged annotations",description:"One row per title with all slice annotations combined. Alignments and classifications are merged across slices. Best for content where curriculum alignments are attached to the primary slice."}];function g(e){let{value:t,onChange:n,disabled:s,label:l="Row structure"}=e;return(0,m.jsx)(p.L,{label:l,options:h,selectedKey:t,onChange:e=>n(e),disabled:s})}var v=n(35014),b=n(68960);function y(e){let{variant:t,children:n}=e;return(0,m.jsx)("div",{className:`text-sm border rounded-lg px-4 py-3 ${{info:"bg-syllabyte-blue/5 border-syllabyte-blue/20 text-blue-800",warning:"bg-yellow-50 border-yellow-200 text-yellow-800"}[t]}`,children:n})}const j=e=>{let{fieldType:t,baseFields:n,optionalFields:s,selectedFields:l,onFieldsChange:i,showSliceInfo:a=!1,contentFields:o,isReadOnly:r=!1,sliceMode:c}=e;const u="none"===c,p="canonical"===c,x="content"===t?"Content":"Slice",h=s.reduce((e,t)=>{const n=t.category||"other";return e[n]||(e[n]=[]),e[n].push(t),e},{}),g=Object.keys(h).sort((e,t)=>"other"===e?1:"other"===t?-1:e.localeCompare(t)),b=p?"Fields will be collected from all slices and merged into a single row.":"Content properties will be repeated for each slice.";return(0,m.jsxs)("div",{className:"space-y-6",children:["slice"===t&&u&&(0,m.jsx)(y,{variant:"warning",children:"Slice fields are not included in Content metadata only mode. Select \u201cFull export\u201d or \u201cContent with merged annotations\u201d to include slice data."}),"slice"===t&&p&&(0,m.jsx)(y,{variant:"info",children:"These fields will be collected across all slices and merged into a single row per title."}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"flex justify-between items-center mb-3",children:(0,m.jsxs)("h3",{className:"text-lg font-medium",children:["Base ",x," Fields (Always Included)"]})}),(0,m.jsx)("div",{className:"space-y-2 opacity-60 bg-gray-50 p-4 rounded-lg",children:n.map(e=>(0,m.jsxs)("div",{className:"flex items-start gap-2",children:[(0,m.jsx)("input",{type:"checkbox",checked:!0,disabled:!0,className:"mt-1","aria-label":e.displayName}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"font-medium text-sm",children:e.displayName}),(0,m.jsx)("div",{className:"text-xs text-gray-500",children:e.description})]})]},e.name))})]}),(0,m.jsxs)("div",{children:[(0,m.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,m.jsxs)("h3",{className:"text-lg font-medium",children:["Optional ",x," Fields"]}),(0,m.jsxs)("div",{className:"flex space-x-2",children:[(0,m.jsx)(d.$,{type:"button",variant:"greyOutline",className:"py-1 px-3 text-sm",onClick:()=>{r||i(s.map(e=>e.name))},disabled:r,children:"Select All"}),(0,m.jsx)(d.$,{type:"button",variant:"greyOutline",className:"py-1 px-3 text-sm",onClick:()=>{r||i([])},disabled:r,children:"Deselect All"}),"slice"===t&&o&&(0,m.jsx)(d.$,{type:"button",variant:"greyOutline",className:"py-1 px-3 text-sm",onClick:()=>{!r&&o&&i(o)},disabled:r,children:"Use Content Fields"})]})]}),(0,m.jsxs)("div",{className:"text-sm text-gray-600 mb-4",children:[(0,m.jsxs)("p",{children:["Select additional fields to include in your export.",a&&!u&&` ${b}`]}),(0,m.jsxs)("p",{className:"mt-1",children:["Currently selected:"," ",(0,m.jsxs)("span",{className:"font-medium",children:[l.length," optional fields"]})]})]}),(0,m.jsx)("div",{className:"space-y-2",children:g.map(e=>(0,m.jsxs)("div",{children:[g.length>1&&(0,m.jsx)("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-2 mt-4 first:mt-0",children:"other"===e?"Other":e}),h[e].map(e=>(0,m.jsx)("div",{className:"py-2 px-4 border-l-4 "+(l.includes(e.name)?"border-syllabyte-blue bg-syllabyte-blue/5":"border-gray-200"),children:(0,m.jsx)(v.l,{label:e.displayName,caption:e.description,value:l.includes(e.name),onChange:r?()=>{}:()=>(e=>{if(r||"slice"===t&&u)return;const n=l.includes(e)?l.filter(t=>t!==e):[...l,e];i(n)})(e.name)})},e.name))]},e))})]})]})};var f=n(47070),N=n(80004),C=n(89341);const k=e=>{let{propertiesColumns:t,onChange:n}=e;const[s,l]=(0,c.useState)(null),[i,a]=(0,c.useState)(""),[o,r]=(0,c.useState)(!1),[u,p]=(0,c.useState)(""),[x,h]=(0,c.useState)(""),[g,v]=(0,c.useState)(""),[b,y]=(0,c.useState)(""),[j,k]=(0,c.useState)(null),w=Object.keys(t),F=()=>{r(!1),p(""),h(""),v(""),y("")},S=()=>{let e=!1;const s=u.trim(),l=x.trim();s?/^[a-zA-Z0-9_-]+$/.test(s)?void 0!==t[s]?(v(`The key "${s}" already exists.`),e=!0):v(""):(v("Key must contain only letters, numbers, underscores, and hyphens."),e=!0):(v("Property key is required."),e=!0),l?y(""):(y("Friendly column name is required."),e=!0),e||(n({...t,[s]:l}),F())},I=e=>{i.trim()&&((e,s)=>{n({...t,[e]:s})})(e,i.trim()),l(null),a("")},T=()=>{l(null),a("")};return(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"text-sm text-gray-600 space-y-1",children:[(0,m.jsx)("p",{children:"Map property keys to friendly Excel column names. Properties are resolved hierarchically:"}),(0,m.jsx)("p",{className:"text-xs italic ml-4",children:"Slice \u2192 Content \u2192 Project \u2192 Scope (child values override parent)"})]}),w.length>0?(0,m.jsx)("div",{className:"border rounded-lg overflow-hidden",children:(0,m.jsxs)("table",{className:"w-full",children:[(0,m.jsx)("thead",{className:"bg-gray-50 border-b",children:(0,m.jsxs)("tr",{children:[(0,m.jsx)("th",{className:"px-4 py-2 text-left text-sm font-medium text-gray-700",children:"Property Key"}),(0,m.jsx)("th",{className:"px-4 py-2 text-left text-sm font-medium text-gray-700",children:"Excel Column Name"}),(0,m.jsx)("th",{className:"px-4 py-2 w-20"})]})}),(0,m.jsx)("tbody",{className:"divide-y",children:Object.entries(t).map(e=>{let[t,n]=e;return(0,m.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,m.jsx)("td",{className:"px-4 py-3",children:(0,m.jsx)("code",{className:"text-sm bg-gray-100 px-2 py-1 rounded font-mono",children:t})}),(0,m.jsx)("td",{className:"px-4 py-3",children:s===t?(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)("input",{type:"text",value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&I(t),"Escape"===e.key&&T()},className:"flex-1 px-2 py-1 border rounded text-sm focus:outline-none focus:ring-2 focus:ring-syllabyte-blue",autoFocus:!0,placeholder:"Enter column name"}),(0,m.jsx)("button",{type:"button",onClick:()=>I(t),className:"px-2 py-1 bg-syllabyte-green text-white rounded text-sm hover:bg-syllabyte-green/90 transition-colors",children:"Save"}),(0,m.jsx)("button",{type:"button",onClick:T,className:"px-2 py-1 bg-gray-300 text-gray-700 rounded text-sm hover:bg-gray-400 transition-colors",children:"Cancel"})]}):(0,m.jsx)("button",{type:"button",onClick:()=>((e,t)=>{l(e),a(t)})(t,n),className:"text-left w-full hover:text-syllabyte-blue transition-colors",title:"Click to edit",children:n})}),(0,m.jsx)("td",{className:"px-4 py-3 text-center",children:(0,m.jsx)("button",{type:"button",onClick:()=>k(t),className:"text-syllabyte-pink hover:text-syllabyte-pink transition-colors",title:"Remove c
1olumn",children:(0,m.jsx)(f.A,{className:"h-4 w-4"})})})]},t)})})]})}):(0,m.jsx)("div",{className:"text-sm text-gray-500 italic py-8 text-center border-2 border-dashed rounded-lg bg-gray-50",children:'No properties columns defined. Click "Add Properties Column" to get started.'}),o&&(0,m.jsxs)("div",{className:"border rounded-lg p-4 bg-gray-50 space-y-3",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Property Key"}),(0,m.jsx)("input",{type:"text",value:u,onChange:e=>{p(e.target.value),g&&v("")},placeholder:"e.g. programId",className:"w-full px-3 py-2 border rounded text-sm focus:outline-none focus:ring-2 focus:ring-syllabyte-blue",autoFocus:!0}),g&&(0,m.jsx)("p",{className:"text-syllabyte-pink text-xs mt-1",children:g})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Friendly Column Name"}),(0,m.jsx)("input",{type:"text",value:x,onChange:e=>{h(e.target.value),b&&y("")},placeholder:"e.g. Program ID",className:"w-full px-3 py-2 border rounded text-sm focus:outline-none focus:ring-2 focus:ring-syllabyte-blue",onKeyDown:e=>{"Enter"===e.key&&S(),"Escape"===e.key&&F()}}),b&&(0,m.jsx)("p",{className:"text-syllabyte-pink text-xs mt-1",children:b})]}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(d.$,{type:"button",variant:"syllabyteBlue",onClick:S,children:"Add"}),(0,m.jsx)(d.$,{type:"button",variant:"greyOutline",onClick:F,children:"Cancel"})]})]}),!o&&(0,m.jsx)("div",{className:"flex gap-2",children:w.length>=50?(0,m.jsx)("p",{className:"text-sm text-gray-500 italic",children:"Maximum of 50 property columns reached."}):(0,m.jsx)(d.$,{type:"button",variant:"syllabyteBlue",icon:(0,m.jsx)(N.A,{className:"h-4 w-4"}),onClick:()=>{p(""),h(""),v(""),y(""),r(!0)},children:"Add Properties Column"})}),w.length>0&&(0,m.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Click on a column name to edit it inline. Press Enter to save or Escape to cancel."}),null!==j&&(0,m.jsx)(C.T,{isOpen:!0,onClose:()=>k(null),resourceType:"property column",resourceId:j,resourceTitle:j,deleteFunction:async e=>{const s={...t};delete s[e],n(s)},onDeleteSuccess:()=>k(null)})]})},w=e=>{let{propertiesColumns:t,onPropertiesColumnsChange:n,resourceType:s,resourceOwnerId:l,resourceId:i}=e;return(0,m.jsxs)("div",{className:"space-y-6",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h3",{className:"text-lg font-medium mb-3",children:"Properties Column Mapping"}),(0,m.jsxs)("div",{className:"text-sm text-gray-600 mb-4 space-y-2",children:[(0,m.jsx)("p",{children:"Map property keys to friendly Excel column names. Properties are resolved hierarchically from Slice \u2192 Content \u2192 Project \u2192 Scope."}),(0,m.jsxs)("p",{children:[(0,m.jsx)("strong",{children:"Example:"})," Map"," ",(0,m.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"programId"}),' to "Program ID" for a user-friendly column header.']})]})]}),(0,m.jsx)(k,{propertiesColumns:t,onChange:n,resourceType:s,resourceOwnerId:l,resourceId:i}),(0,m.jsxs)("div",{className:"bg-syllabyte-blue/5 border border-syllabyte-blue/20 rounded-lg p-4",children:[(0,m.jsx)("h4",{className:"font-medium text-blue-900 mb-2",children:"\ud83d\udca1 How Properties Resolution Works"}),(0,m.jsxs)("div",{className:"text-sm text-blue-800 space-y-1",children:[(0,m.jsx)("p",{children:"When exporting, the system searches for each property key in this order:"}),(0,m.jsxs)("ol",{className:"list-decimal list-inside ml-2 space-y-1",children:[(0,m.jsxs)("li",{children:[(0,m.jsx)("strong",{children:"Slice properties"})," (highest priority)"]}),(0,m.jsx)("li",{children:(0,m.jsx)("strong",{children:"Content properties"})}),(0,m.jsx)("li",{children:(0,m.jsx)("strong",{children:"Project properties"})}),(0,m.jsxs)("li",{children:[(0,m.jsx)("strong",{children:"Scope properties"})," (lowest priority)"]})]}),(0,m.jsx)("p",{className:"mt-2",children:"The first value found is used. Child values override parent values."})]})]})]})};var F=n(13909),S=n(76435),I=n(50714),T=n(95908),$=n(2139),O=n(62898),E=n(62726),R=n(27422),M=n(49016);const P=e=>{var t,n,s,l,i,a;let{isOpen:o,onClose:u,resourceType:p,resourceOwnerId:x,resourceId:h,template:b,currentConfig:y,templates:j}=e;const N=(0,I.jE)(),[w,S]=(0,c.useState)(b||null),[P,A]=(0,c.useState)(!1),[L,D]=(0,c.useState)(null),[B,K]=(0,c.useState)(b||0===j.length?"edit":"list"),q=(0,T.n)({mutationFn:async e=>{switch(p){case"scope":return F.IK.createScopeExportTemplate(x,h,e);case"project":return F.IK.createProjectExportTemplate(x,h,e);case"content":return F.IK.createContentExportTemplate(x,h,e)}},onSuccess:()=>{N.invalidateQueries({queryKey:[`${p}-export-templates`,x,h]}),u()}}),U=(0,T.n)({mutationFn:async e=>{let{id:t,updates:n}=e;switch(p){case"scope":return F.IK.updateScopeExportTemplate(x,h,t,n);case"project":return F.IK.updateProjectExportTemplate(x,h,t,n);case"content":return F.IK.updateContentExportTemplate(x,h,t,n)}},onSuccess:()=>{N.invalidateQueries({queryKey:[`${p}-export-templates`,x,h]}),u()}}),V=(0,T.n)({mutationFn:async e=>{switch(p){case"scope":return F.IK.deleteScopeExportTemplate(x,h,e);case"project":return F.IK.deleteProjectExportTemplate(x,h,e);case"content":return F.IK.deleteContentExportTemplate(x,h,e)}},onSuccess:()=>{N.invalidateQueries({queryKey:[`${p}-export-templates`,x,h]}),A(!1),D(null),j.length<=1&&u()}}),{error:z,handleSubmitError:W}=(0,R.i)(),_=w?{name:w.name,description:w.description||"",contentOptionalFields:w.contentOptionalFields||[],sliceOptionalFields:w.sliceOptionalFields||[],propertiesColumns:w.propertiesColumns||{},sliceMode:null!==(t=w.sliceMode)&&void 0!==t?t:M.NM.sliceMode,includeDisabled:null!==(n=w.includeDisabled)&&void 0!==n?n:M.NM.includeDisabled,enrichFromSource:null!==(s=w.enrichFromSource)&&void 0!==s?s:M.NM.enrichFromSource}:{name:"",description:"",contentOptionalFields:(null===y||void 0===y?void 0:y.contentOptionalFields)||[],sliceOptionalFields:(null===y||void 0===y?void 0:y.sliceOptionalFields)||[],propertiesColumns:(null===y||void 0===y?void 0:y.propertiesColumns)||{},sliceMode:null!==(l=null===y||void 0===y?void 0:y.sliceMode)&&void 0!==l?l:M.NM.sliceMode,includeDisabled:null!==(i=null===y||void 0===y?void 0:y.includeDisabled)&&void 0!==i?i:M.NM.includeDisabled,enrichFromSource:null!==(a=null===y||void 0===y?void 0:y.enrichFromSource)&&void 0!==a?a:M.NM.enrichFromSource};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(E.a,{isOpen:o,onClose:u,title:"list"===B?"Manage Templates":w?"E
1dit Template":"Save as Template",size:"4xl",children:"list"===B?(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsx)("div",{className:"mb-4",children:(0,m.jsx)(d.$,{variant:"syllabyteBlue",onClick:()=>{S(null),K("edit")},children:"Create New Template"})}),(0,m.jsx)("div",{className:"space-y-3",children:j.map(e=>(0,m.jsx)("div",{className:"border rounded-lg p-4 hover:bg-gray-50",children:(0,m.jsxs)("div",{className:"flex justify-between items-start",children:[(0,m.jsxs)("div",{className:"flex-1",children:[(0,m.jsx)("h4",{className:"font-medium",children:e.name}),e.description&&(0,m.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:e.description}),(0,m.jsxs)("p",{className:"text-xs text-gray-500 mt-2",children:["Last used:"," ",e.lastUsed?new Date(e.lastUsed).toLocaleDateString():"Never"]})]}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(d.$,{variant:"greyOutline",onClick:()=>(e=>{S(e),K("edit")})(e),className:"text-sm",children:"Edit"}),(0,m.jsx)(d.$,{variant:"syllabytePink",icon:(0,m.jsx)(f.A,{className:"h-4 w-4"}),onClick:()=>(e=>{D(e),A(!0)})(e),className:"text-sm"})]})]})},e.id))})]}):(0,m.jsx)(r.l1,{initialValues:_,onSubmit:async(e,t)=>{let{setErrors:n}=t;try{null!==w&&void 0!==w&&w.id?await U.mutateAsync({id:w.id,updates:e}):await q.mutateAsync(e)}catch(s){W(s,n)}},validate:e=>{var t;const n={};null!==(t=e.name)&&void 0!==t&&t.trim()||(n.name="Template name is required");if(j.some(t=>t.id!==(null===w||void 0===w?void 0:w.id)&&t.name.toLowerCase()===e.name.toLowerCase())&&(n.name="A template with this name already exists"),e.propertiesColumns&&Object.keys(e.propertiesColumns).length>0){const t=Object.values(e.propertiesColumns),s=Object.keys(e.propertiesColumns),l=t.filter((e,n)=>t.indexOf(e)!==n);l.length>0&&(n.propertiesColumns=`Duplicate column names found: ${l.join(", ")}`);const i=["ScopeId","ScopeTitle","ScopeOwnerId","ScopeTags","ProjectId","ProjectTitle","ProjectOwnerId","ProjectTags","ContentId","ContentTitle","ContentType","ContentOwnerId","SliceId","SliceText","SlicePage","SliceStart","SliceEnd","SliceEnabled","AlignmentReferences","ClassificationReferences","WebLinkUrls","DescriptionReferences"],a=t.filter(e=>i.some(t=>t.toLowerCase()===e.toLowerCase()));a.length>0&&(n.propertiesColumns=`Column names conflict with base columns: ${a.join(", ")}. Please use different names.`),s.length>50&&(n.propertiesColumns="Maximum 50 properties columns allowed per template");const o=s.filter(e=>!/^[a-zA-Z0-9_-]+$/.test(e));o.length>0&&(n.propertiesColumns=`Invalid property keys (use only letters, numbers, underscores, hyphens): ${o.join(", ")}`)}return n},children:e=>{let{isSubmitting:t,values:n,setFieldValue:s,errors:l}=e;return(0,m.jsxs)(r.lV,{className:"space-y-6",children:[(0,m.jsx)(O.A,{name:"name",label:"Template Name",placeholder:"e.g., Weekly Report, Compliance Export",required:!0}),(0,m.jsx)(O.A,{name:"description",label:"Description",placeholder:"Optional description"}),(0,m.jsxs)("div",{className:"space-y-4 border-t pt-4",children:[(0,m.jsx)("h4",{className:"font-medium",children:"Export Options"}),(0,m.jsx)(g,{value:n.sliceMode,onChange:e=>s("sliceMode",e)}),(0,m.jsx)(v.l,{label:"Include Disabled Items",caption:"Include disabled content/slices",value:n.includeDisabled,onChange:e=>s("includeDisabled",e)}),"none"!==n.sliceMode&&(0,m.jsx)(v.l,{label:"Enrich from Source",caption:"Fetch latest outcome and classification descriptions from source",value:n.enrichFromSource,onChange:e=>s("enrichFromSource",e)})]}),(0,m.jsxs)("div",{className:"space-y-4 border-t pt-4",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"font-medium",children:"Optional Fields"}),(0,m.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:"Configure optional fields in the export form before saving the template. These fields will be included when this template is used."})]}),n.contentOptionalFields&&n.contentOptionalFields.length>0||n.sliceOptionalFields&&n.sliceOptionalFields.length>0?(0,m.jsxs)("div",{className:"space-y-3",children:[n.contentOptionalFields&&n.contentOptionalFields.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium mb-2",children:"Content Fields:"}),(0,m.jsx)("div",{className:"flex flex-wrap gap-2",children:n.contentOptionalFields.map(e=>(0,m.jsx)("span",{className:"px-2 py-1 bg-syllabyte-blue/10 text-blue-800 rounded text-sm",children:e},e))})]}),n.sliceOptionalFields&&n.sliceOptionalFields.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium mb-2",children:"Slice Fields:"}),(0,m.jsx)("div",{className:"flex flex-wrap gap-2",children:n.sliceOptionalFields.map(e=>(0,m.jsx)("span",{className:"px-2 py-1 bg-syllabyte-green/10 text-green-800 rounded text-sm",children:e},e))})]})]}):(0,m.jsx)("div",{className:"text-sm text-gray-500 italic py-3 px-4 bg-gray-50 rounded border",children:"No optional fields selected. Select fields in the export form before saving the template."})]}),(0,m.jsxs)("div",{className:"space-y-4 border-t pt-4",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"font-medium",children:"Properties Columns"}),(0,m.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:"Export custom properties with friendly column names. Properties are resolved hierarchically from Slice \u2192 Content \u2192 Project \u2192 Scope."})]}),(0,m.jsx)(k,{propertiesColumns:n.propertiesColumns||{},onChange:e=>s("propertiesColumns",e),resourceType:p,resourceOwnerId:x,resourceId:h}),l.propertiesColumns&&"string"===typeof l.propertiesColumns&&(0,m.jsxs)("div",{className:"text-sm text-syllabyte-pink mt-2 p-3 bg-syllabyte-pink/5 rounded border border-syllabyte-pink/20",children:[(0,m.jsx)("strong",{children:"Validation Error:"})," ",l.propertiesColumns]})]}),(0,m.jsx)($.D,{error:z}),(0,m.jsxs)("div",{className:"flex gap-2 justify-end pt-4 border-t",children:[j.length>0&&(0,m.jsx)(d.$,{type:"button",variant:"greyOutline",onClick:()=>K("list"),children:"Back"}),(0,m.jsx)(d.$,{type:"button",variant:"greyOutline",onClick:u,children:"Cancel"}),(0,m.jsx)(d.$,{type:"submit",variant:"syllabyteBlue",isLoading:t,children:w?"Update":"Save"})]})]})}})}),L&&(0,m.jsx)(C.T,{isOpen:P,onClose:()=>{A(!1),D(null)},resourceType:"export template",resourceId:L.id,resourceTitle:L.name,deleteFunction:async e=>{await V.mutateAsync(e)}})]})},A={none:"\ud83d\udcca",canonical:"\ud83d\udd00",perSlice:"\ud83d\udce6"},L={none:"Catalog",canonical:"Merged",perSlice:"Full"},D=e=>{let{resourceType:t,resourceOwnerId:n,resourceId:s,selectedTemplateId:l,onTemplateSelect:i,currentConfig:a}=e;const[r,p]=(0,c.useState)(!1),[x,h]=(0,c.useState)(void 0),{data:g,isLoading:v,refetch:b}=(0,o.I)({queryKey:[`${t}-export-templates`,n,s],queryFn:async()=>
1{switch(t){case"scope":return F.IK.getScopeExportTemplates(n,s);case"project":return F.IK.getProjectExportTemplates(n,s);case"content":return F.IK.getContentExportTemplates(n,s)}},enabled:!!n&&!!s}),j=g||[],f=[{key:"",label:"No Template (Custom Export)",description:"Configure export settings manually"},...j.map(e=>{var t,n,s;const l=null!==(t=e.sliceMode)&&void 0!==t?t:"perSlice",i=null!==(n=A[l])&&void 0!==n?n:"\ud83d\udce6",a=null!==(s=L[l])&&void 0!==s?s:"Full",o=e.lastUsed?new Date(e.lastUsed).toLocaleDateString():"Never";return{key:e.id,label:`${i} ${e.name}`,description:e.description||`${a} export \u2022 Last used: ${o}`}})];return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mb-6 space-y-4",children:[(0,m.jsx)(u.m,{label:"Export Template",helper:"Select a saved template or configure manually",options:f,value:l||"",onChange:e=>{const t=j.find(t=>t.id===e);i(t||null)},search:!0,disabled:v}),l&&(0,m.jsx)(y,{variant:"info",children:"A template is applied. Field selections below reflect the template configuration and are read-only. Clear the template to configure manually."}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(d.$,{type:"button",variant:"greyOutline",icon:(0,m.jsx)(N.A,{className:"h-5 w-5"}),onClick:()=>{h(void 0),p(!0)},className:"flex-1",children:"Save Current as Template"}),j.length>0&&(0,m.jsx)(d.$,{type:"button",variant:"greyOutline",icon:(0,m.jsx)(S.A,{className:"h-5 w-5"}),onClick:()=>{h(void 0),p(!0)},children:"Manage"})]})]}),(0,m.jsx)(P,{isOpen:r,onClose:()=>{p(!1),h(void 0),b()},resourceType:t,resourceOwnerId:n,resourceId:s,template:x,currentConfig:a,templates:j})]})},B=[{value:"xlsx",label:"Excel (XLSX)",description:"Spreadsheet with content and metadata",fileExtension:".xlsx"},{value:"marc21xml",label:"MARC 21 XML",description:"Library catalog records",fileExtension:".xml"},{value:"alto",label:"ALTO XML",description:"OCR transcript with pixel coordinates",fileExtension:".xml or .zip"},{value:"onix",label:"ONIX 3.0 XML",description:"Trade metadata for publishers and distributors",fileExtension:".xml"},{value:"docx",label:"Word Document (DOCX)",description:"Structured lesson plan document with headings, images, and appendices",fileExtension:".docx"}];function K(e,t,n){if(t)return"Starting Export...";if(n)return"Export Disabled";switch(e){case"marc21xml":return"Export to MARC 21 XML";case"alto":return"Export to ALTO XML";case"onix":return"Export to ONIX 3.0";case"docx":return"Export to Word";default:return"Export to Excel"}}var q=n(49768),U=n(14166),V=n(59683),z=n(48676),W=n(26559);const _=e=>{var t,n,s,l;let{value:i,onChange:a}=e;const{data:o}=(0,z.v)(),r=null===i||void 0===i?void 0:i.priceOverride,c=(null!==(t=null===o||void 0===o?void 0:o.currencies)&&void 0!==t?t:[]).map(e=>({key:e.value,label:e.displayName})),d=(null!==(n=null===o||void 0===o?void 0:o.priceTypes)&&void 0!==n?n:[]).map(e=>({key:e.value,label:e.displayName}));return(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)(v.l,{label:"Override price for this export",caption:"Replace every item's price in this export run with a single configured price, without changing any stored content pricing.",value:!!r,onChange:e=>{a(e?{...i,priceOverride:{territoryCode:W.W,currencyCode:"",priceTypeCode:W.p,amount:0,taxInclusive:!1}}:{...i,priceOverride:void 0})}}),r&&(0,m.jsxs)("div",{className:"space-y-2 pl-4 border-l border-gray-200 dark:border-gray-700",children:[(0,m.jsx)(V.O,{name:"onixRunConfig.priceOverride.territoryCode"}),(0,m.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,m.jsx)("div",{className:"flex-1",children:(0,m.jsx)(u.m,{label:"Currency",options:c,search:!0,required:!0,value:r.currencyCode,onChange:e=>a({...i,priceOverride:{...r,currencyCode:e}})})}),(0,m.jsx)("div",{className:"flex-1",children:(0,m.jsx)(u.m,{label:"Price type",options:d,search:!1,value:null!==(s=r.priceTypeCode)&&void 0!==s?s:W.p,onChange:e=>a({...i,priceOverride:{...r,priceTypeCode:e}})})}),(0,m.jsx)("div",{className:"flex-1",children:(0,m.jsx)(U.U,{label:"Amount",step:.01,min:0,value:r.amount,onChange:e=>a({...i,priceOverride:{...r,amount:e}})})})]}),(0,m.jsx)(v.l,{label:"Tax inclusive",value:null!==(l=r.taxInclusive)&&void 0!==l&&l,onChange:e=>a({...i,priceOverride:{...r,taxInclusive:e}})})]})]})};function G(e){let{activeTab:t,onTabChange:n}=e;const{values:s,setFieldValue:l}=(0,r.j7)();return(0,c.useEffect)(()=>{"none"===s.sliceMode&&s.sliceOptionalFields.length>0&&l("sliceOptionalFields",[])},[s.sliceMode]),(0,c.useEffect)(()=>{"slices"===t&&"none"===s.sliceMode&&n("content")},[s.sliceMode,t]),null}function X(e){var t;let{resourceType:n,resourceOwnerId:c,resourceId:p,initialValues:h,selectedTemplate:f,onTemplateSelect:N,activeTab:C,onTabChange:k,onExport:S,isPending:I,isSuccess:T,isError:$,error:O,isDisabled:E,disabledReason:R}=e;const{data:M}=(0,o.I)({queryKey:["export-fields","content"],queryFn:()=>F._T.getExportAvailableFields("content"),staleTime:36e5}),{data:P}=(0,o.I)({queryKey:["export-fields","slice"],queryFn:()=>F._T.getExportAvailableFields("slice"),staleTime:36e5}),A=null!==M&&void 0!==M?M:[],L=null!==P&&void 0!==P?P:[],U=A.filter(e=>e.isBase),V=A.filter(e=>!e.isBase),z=L.filter(e=>e.isBase),W=L.filter(e=>!e.isBase),X=null!==(t=null===O||void 0===O?void 0:O.message)&&void 0!==t?t:"An unexpected error occurred. Please try again.",Z="content"===n?B:B.filter(e=>"docx"!==e.value);return(0,m.jsx)(r.l1,{initialValues:h,onSubmit:S,enableReinitialize:!0,children:e=>{var t,o,h,F,S,O,M,P,A,L,B,Q,Y,H,J,ee,te,ne,se,le,ie,ae,oe,re,ce,de;let{values:ue,setFieldValue:pe}=e;const me=[{key:"content",label:"Content Fields",icon:s.A,visible:!0},{key:"slices",label:"Slice Fields",icon:l.A,visible:"none"!==ue.sliceMode},{key:"metadata",label:"Metadata Fields",icon:i.A,visible:!0}].filter(e=>e.visible),xe=null===f||void 0===f?void 0:f.id;return(0,m.jsxs)(r.lV,{children:[(0,m.jsx)(G,{activeTab:C,onTabChange:k}),(0,m.jsxs)("div",{className:"space-y-6",children:["xlsx"===ue.outputFormat&&(0,m.jsx)(D,{resourceType:n,resourceOwnerId:c,resourceId:p,selectedTemplateId:xe,onTemplateSelect:N,currentConfig:{contentOptionalFields:ue.contentOptionalFields,sliceOptionalFields:ue.sliceOptionalFields,propertiesColumns:ue.propertiesColumns,sliceMode:ue.sliceMode,includeDisabled:ue.includeDisabled,enrichFromSource:ue.enrichFromSource}}),(0,m.jsx)(x,{selectedFormat:ue.outputFormat,onChange:e=>pe("outputFormat",e),options:Z,label:"Export Format"}),"alto"===ue.outputFormat&&(0,m.jsx)(y,{variant:"info",children:"ALTO XML exports OCR data only. Field customization is not available."}),"marc21xml"===ue.outputFormat&&(0,m.jsx)(y,{variant:"info",children:"MARC 21 XML uses standardized bibliographic fields. Field customization is not available."}),"docx"===ue.outputFormat&&(0,m.jsx)(y,{variant:"info",children:"Word documents include all slice content. Field customisation is not available. Use the section toggles below to control which sections are generated."}),"xlsx"===ue.outputFormat&&(0,m.jsxs)("div",{className:"space-y-4 border-t pt-4",children:[(0,m.jsx)("h3",{className:"text-lg font-medium",children:"Export Options"}),(0,m.jsx)(g,{value:ue.sliceMode,onChange:e=>pe("sliceMode",e)}),"none"===ue.sliceMode&&(0,m.jsx)(y,{variant:"warning",children:"Fastest export: slice documents are not loaded. Only content-level fields will be included in this export."}),"canonical"===ue.sliceMode&&(0,m.jsx)(y,{variant:"info",children:"One row per title: alignments, classifications, and other slice annotations are merged from all slices into a single row."}),(0,m.jsx)(v.l,{label:"Include Disabled Items",caption:"Include disabled content and slices",value:ue.includeDisabled,onChange:e=>pe("includeDisabled",e)}),"none"!==ue.sliceMode&&(0,m.jsx)(v.l,{label:"Enrich from Source",caption:"Fetch latest outcome and classification descriptions from source",value:ue.enrichFromSource,onCh
1ange:e=>pe("enrichFromSource",e)})]}),"marc21xml"===ue.outputFormat&&(0,m.jsxs)("div",{className:"space-y-4 border-t pt-4",children:[(0,m.jsx)("h3",{className:"text-lg font-medium",children:"Export Options"}),(0,m.jsx)(v.l,{label:"One MARC record per slice",caption:"Enabled: one MARC record per slice. Disabled: one MARC record per content item.",value:"Slice"===ue.recordLevel,onChange:e=>pe("recordLevel",e?"Slice":"Content")}),(0,m.jsx)(v.l,{label:"Include Disabled Items",caption:"Include disabled content and slices",value:ue.includeDisabled,onChange:e=>pe("includeDisabled",e)}),(0,m.jsx)(v.l,{label:"Include Reproduction Note",caption:"Add a MARC 533 Reproduction Note to scanned document records (text-document and mixed types). Standard practice for digitised materials. Disable for institutions that do not accept MARC 533.",value:null===(t=ue.includeReproductionNote)||void 0===t||t,onChange:e=>pe("includeReproductionNote",e)})]}),"alto"===ue.outputFormat&&(0,m.jsxs)("div",{className:"space-y-4 border-t pt-4",children:[(0,m.jsx)("h3",{className:"text-lg font-medium",children:"Export Options"}),(0,m.jsx)(v.l,{label:"Include Disabled Items",caption:"Include disabled content and slices",value:ue.includeDisabled,onChange:e=>pe("includeDisabled",e)})]}),"onix"===ue.outputFormat&&(0,m.jsxs)("div",{className:"space-y-4 border-t pt-4",children:[(0,m.jsx)("h3",{className:"text-lg font-medium",children:"Export Options"}),(0,m.jsx)(y,{variant:"info",children:"ONIX 3.0 XML exports trade metadata only. Publisher identity, rights, and distribution settings are configured in the project or scope ONIX settings."}),(0,m.jsx)(v.l,{label:"Include Disabled Items",caption:"Include disabled content and slices",value:ue.includeDisabled,onChange:e=>pe("includeDisabled",e)}),(0,m.jsx)(u.m,{label:"Product form mode",options:q.qd,value:null!==(o=null===(h=ue.onixRunConfig)||void 0===h?void 0:h.productFormMode)&&void 0!==o?o:"",onChange:e=>pe("onixRunConfig",{...ue.onixRunConfig,productFormMode:e||void 0}),search:!1}),(0,m.jsx)(u.m,{label:"Notification type override",helper:"Use Metadata update to push corrections without changing publication status.",options:q.Dz,value:null!==(F=null===(S=ue.onixRunConfig)||void 0===S?void 0:S.notificationTypeOverride)&&void 0!==F?F:"",onChange:e=>pe("onixRunConfig",{...ue.onixRunConfig,notificationTypeOverride:e||void 0}),search:!1}),(0,m.jsx)(v.l,{label:"Include Look Inside images",caption:"Embed Look Inside page images as SupportingResource in the ONIX output",value:null===(O=null===(M=ue.onixRunConfig)||void 0===M?void 0:M.includeLookInsideImages)||void 0===O||O,onChange:e=>pe("onixRunConfig",{...ue.onixRunConfig,includeLookInsideImages:e})}),(0,m.jsx)(_,{value:ue.onixRunConfig,onChange:e=>pe("onixRunConfig",e)})]}),"docx"===ue.outputFormat&&(0,m.jsxs)("div",{className:"space-y-4 border-t pt-4",children:[(0,m.jsx)("h3",{className:"text-lg font-medium",children:"Document Sections"}),(0,m.jsx)(v.l,{label:"Title Page",caption:"Title, description, authors, publisher, year and ISBN.",value:null===(P=null===(A=ue.wordRunConfig)||void 0===A?void 0:A.includeTitlePage)||void 0===P||P,onChange:e=>pe("wordRunConfig",{...ue.wordRunConfig,includeTitlePage:e})}),(0,m.jsx)(v.l,{label:"Table of Contents",caption:"TOC field covering Heading 1-3. Word updates page numbers when the file is opened.",value:null===(L=null===(B=ue.wordRunConfig)||void 0===B?void 0:B.includeTableOfContents)||void 0===L||L,onChange:e=>pe("wordRunConfig",{...ue.wordRunConfig,includeTableOfContents:e})}),(0,m.jsx)(v.l,{label:"Images",caption:"Embed slice images inline, capped at 400px width. A text placeholder is used if the image is unavailable.",value:null===(Q=null===(Y=ue.wordRunConfig)||void 0===Y?void 0:Y.includeImages)||void 0===Q||Q,onChange:e=>pe("wordRunConfig",{...ue.wordRunConfig,includeImages:e})}),(0,m.jsx)(v.l,{label:"Teacher Notes",caption:"Render teacher instructions as a sub-section under each slice.",value:null===(H=null===(J=ue.wordRunConfig)||void 0===J?void 0:J.includeTeacherNotes)||void 0===H||H,onChange:e=>pe("wordRunConfig",{...ue.wordRunConfig,includeTeacherNotes:e})}),(0,m.jsx)(v.l,{label:"Student Notes",caption:"Render student instructions as a sub-section under each slice.",value:null===(ee=null===(te=ue.wordRunConfig)||void 0===te?void 0:te.includeStudentNotes)||void 0===ee||ee,onChange:e=>pe("wordRunConfig",{...ue.wordRunConfig,includeStudentNotes:e})}),(0,m.jsx)(v.l,{label:"Glossary",caption:"Append a glossary with all slice-level glossary items, deduplicated and sorted A-Z.",value:null===(ne=null===(se=ue.wordRunConfig)||void 0===se?void 0:se.includeGlossary)||void 0===ne||ne,onCh
1ange:e=>pe("wordRunConfig",{...ue.wordRunConfig,includeGlossary:e})}),(0,m.jsx)(v.l,{label:"Web Links",caption:"Append all slice-level web links, deduplicated by URL.",value:null===(le=null===(ie=ue.wordRunConfig)||void 0===ie?void 0:ie.includeWebLinks)||void 0===le||le,onChange:e=>pe("wordRunConfig",{...ue.wordRunConfig,includeWebLinks:e})}),(0,m.jsx)(v.l,{label:"References",caption:"Append content-level and slice-level references. Omitted if no reference data exists.",value:null===(ae=null===(oe=ue.wordRunConfig)||void 0===oe?void 0:oe.includeReferences)||void 0===ae||ae,onChange:e=>pe("wordRunConfig",{...ue.wordRunConfig,includeReferences:e})})]}),(0,m.jsx)("div",{className:"space-y-2 border-t pt-4",children:(0,m.jsx)(v.l,{label:"Send email notification",caption:"Email the download link when the export completes. Disable to use the direct download link in this panel instead.",value:null===(re=ue.sendEmail)||void 0===re||re,onChange:e=>pe("sendEmail",e)})}),"xlsx"===ue.outputFormat&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(b.H,{options:me,selectedKey:C,onTabChange:k}),(0,m.jsxs)("div",{className:"mt-6",children:["content"===C&&(0,m.jsx)(j,{fieldType:"content",baseFields:U,optionalFields:V,selectedFields:ue.contentOptionalFields,onFieldsChange:e=>pe("contentOptionalFields",e),isReadOnly:!!f}),"slices"===C&&(0,m.jsx)(j,{fieldType:"slice",baseFields:z,optionalFields:W,selectedFields:ue.sliceOptionalFields,onFieldsChange:e=>pe("sliceOptionalFields",e),contentFields:ue.contentOptionalFields,isReadOnly:!!f,sliceMode:ue.sliceMode}),"metadata"===C&&(0,m.jsx)(w,{propertiesColumns:null!==(ce=ue.propertiesColumns)&&void 0!==ce?ce:{},onPropertiesColumnsChange:e=>pe("propertiesColumns",e),resourceType:n,resourceOwnerId:c,resourceId:p})]})]}),$&&(0,m.jsxs)("div",{className:"mt-4 p-3 bg-syllabyte-pink/5 border border-syllabyte-pink/20 rounded-md text-sm text-syllabyte-pink",children:[(0,m.jsx)("strong",{children:"Export failed:"})," ",X]}),(0,m.jsxs)("div",{className:"pt-4 border-t",children:[(0,m.jsxs)("div",{className:"flex items-center justify-end gap-4",children:[T&&!I&&(0,m.jsx)("p",{className:"text-sm text-syllabyte-green",children:null===(de=ue.sendEmail)||void 0===de||de?"Export requested. Check your email for the download link.":"Export started. Download link will appear above when ready."}),(0,m.jsx)(d.$,{type:"submit",variant:"syllabyteGreen",icon:(0,m.jsx)(a.A,{className:"h-5 w-5"}),disabled:I||!!E,isLoading:I,children:K(ue.outputFormat,I,!!E)})]}),R&&(0,m.jsx)("p",{className:"mt-2 text-sm text-syllabyte-pink",children:R})]})]})]})}})}},76435:(e,t,n)=>{n.d(t,{A:()=>i});var s=n(15917);function l(e,t){let{title:n,titleId:l,...i}=e;return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":l},i),n?s.createElement("title",{id:l},n):null,s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const i=s.forwardRef(l)},94285:(e,t,n)=>{n.d(t,{w:()=>a});var s=n(61630),l=n(47824),i=n(90393);function a(e){const{showContentColumn:t=!1,showSliceColumn:n=!1}=e||{},a=[];return a.push({header:"Suggestion",accessor:"suggestionId",className:"w-24",filterable:!1,searchable:!0,sortable:!0,render:(e,t)=>(0,i.jsx)(s.K,{id:(null===t||void 0===t?void 0:t.suggestionId)||""})}),t&&a.push({header:"Content",accessor:"contentId",className:"w-24",filterable:!1,searchable:!0,sortable:!0,render:(e,t)=>(0,i.jsx)(s.K,{id:(null===t||void 0===t?void 0:t.contentId)||""})}),n&&a.push({header:"Slice",accessor:"sliceId",className:"w-24",filterable:!1,searchable:!0,sortable:!0,render:(e,t)=>(0,i.jsx)(s.K,{id:(null===t||void 0===t?void 0:t.sliceId)||""})}),a.push({header:"Type",accessor:"suggestionType",className:"w-30",filterable:!0,searchable:!0,sortable:!0},{header:"State",accessor:"state",className:"w-20",filterable:!0,searchable:!0,sortable:!0},{header:"Suggested Value",accessor:"suggestedValue",className:"w-48",f
1ilterable:!1,searchable:!0,sortable:!0,render:e=>{const t=String(e||"");return t.length>100?`${t.substring(0,100)}...`:t},tooltipAccessor:"suggestedValue"},{header:"Justification",accessor:"justification",className:"w-60",filterable:!1,searchable:!0,sortable:!1,render:e=>{const t=String(e||"");return t.length>150?`${t.substring(0,150)}...`:t},tooltipAccessor:"justification"},{header:"Generated Confidence",accessor:"generatedConfidence",className:"w-24",filterable:!1,searchable:!1,sortable:!0,render:(e,t)=>"number"===typeof(null===t||void 0===t?void 0:t.generatedConfidence)?l.n.formatPercentage(t.generatedConfidence):void 0},{header:"Feedback Confidence",accessor:"feedbackConfidence",className:"w-24",filterable:!1,searchable:!1,sortable:!0,render:(e,t)=>"number"===typeof(null===t||void 0===t?void 0:t.feedbackConfidence)?l.n.formatPercentage(t.feedbackConfidence):void 0},{header:"Total Feedback",accessor:"totalFeedback",className:"w-24",filterable:!1,searchable:!1,sortable:!0},{header:"Positive",accessor:"positiveFeedback",className:"w-20",filterable:!1,searchable:!1,sortable:!0,render:(e,t)=>"number"===typeof(null===t||void 0===t?void 0:t.positiveFeedback)?(0,i.jsx)("div",{className:"flex items-center",children:(0,i.jsx)("span",{className:"text-syllabyte-green font-medium",children:t.positiveFeedback})}):void 0},{header:"Neutral",accessor:"neutralFeedback",className:"w-20",filterable:!1,searchable:!1,sortable:!0,render:(e,t)=>"number"===typeof(null===t||void 0===t?void 0:t.neutralFeedback)?(0,i.jsx)("div",{className:"flex items-center",children:(0,i.jsx)("span",{className:"text-gray-600 font-medium",children:t.neutralFeedback})}):void 0},{header:"Negative",accessor:"negativeFeedback",className:"w-20",filterable:!1,searchable:!1,sortable:!0,render:(e,t)=>"number"===typeof(null===t||void 0===t?void 0:t.negativeFeedback)?(0,i.jsx)("div",{className:"flex items-center",children:(0,i.jsx)("span",{className:"text-syllabyte-pink font-medium",children:t.negativeFeedback})}):void 0},{header:"Controversial",accessor:"isControversial",className:"w-30",filterable:!0,searchable:!1,sortable:!0,render:(e,t)=>"boolean"===typeof(null===t||void 0===t?void 0:t.isControversial)?(0,i.jsx)("span",{className:t.isControversial?"text-syllabyte-orange font-medium":"text-gray-500",children:t.isControversial?"Yes":"No"}):void 0}),a}}}]); 2//# sourceMappingURL=3175.ab4ce240.chunk.js.map
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.