1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9aeca4a2-aeb8-4f3d-be84-5f7282a80354",e._sentryDebugIdIdentifier="sentry-dbid-9aeca4a2-aeb8-4f3d-be84-5f7282a80354")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[68146],{11007:(e,t,a)=>{a.d(t,{A:()=>i});let i=(0,a(75383).A)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},44032:(e,t,a)=>{a.d(t,{S:()=>n});var i=a(1521),r=a(91429);function n(){return(0,i.useCallback)(e=>(0,r.M)({title:e.title,message:e.message,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,destructive:e.destructive,category:e.category}),[])}},68146:(e,t,a)=>{a.d(t,{b:()=>d});var i=a(73365),r=a(1521),n=a(10738),l=a(68680),o=a(44032),s=a(11007),c=a(87756);function d(e){var t;let{storyId:a,frameNumber:d,disabled:u,scope:v="video",actionOverrideActive:m,imageOverrideActive:p}=e,{t:x}=(0,n.s)(),f=(0,o.S)(),h="advanced-directives-".concat((0,r.useId)()),[g,b]=(0,r.useState)(!1),[w,y]=(0,r.useState)(!1),[j,k]=(0,r.useState)(null),[N,S]=(0,r.useState)(null),[C,D]=(0,r.useState)(""),[_,A]=(0,r.useState)(""),[L,M]=(0,r.useState)(""),[T,E]=(0,r.useState)(""),[I,P]=(0,r.useState)("normal"),[R,F]=(0,r.useState)(!1),[Y,O]=(0,r.useState)(null),[z,H]=(0,r.useState)(null),q=(0,r.useCallback)(e=>{k(e),D(e.dialog),A(e.videoDirective.action),M(e.imageDirective),E(e.videoDirective.cameraMotion),P(e.videoDirective.pacing||"normal")},[]);(0,r.useEffect)(()=>{if(!g||!a||null==d)return;let e=!1;return y(!0),O(null),S(null),(0,l.apiGet)("/api/story/".concat(a,"/frame/").concat(d,"/directives")).then(t=>{if(!e){if(!t||!1===t.available){var a;k(null),S(null!=(a=null==t?void 0:t.reason)?a:"no_screenplay");return}q(t)}}).catch(()=>{e||O(x("viewer.advanced.loadFailed","Failed to load directives"))}).finally(()=>{e||y(!1)}),()=>{e=!0}},[g,a,d,x,q]);let G=!!j&&(C!==j.dialog||_!==j.videoDirective.action||L!==j.imageDirective||T!==j.videoDirective.cameraMotion||I!==(j.videoDirective.pacing||"normal")),$=!!(null==j?void 0:j.original)&&(_!==j.original.action||L!==j.original.imageDirective||T!==j.original.cameraMotion||I!==(j.original.pacing||"normal")||C!==j.original.narration.replace(/^\[[^\]]+\]\s*:\s*/,"")),V=(0,r.useCallback)(async()=>{if(a&&null!=d&&j&&G&&!R){F(!0),O(null);try{let e={};C!==j.dialog&&(e.dialog=C),_!==j.videoDirective.action&&(e.action=_),L!==j.imageDirective&&(e.imageDirective=L),T!==j.videoDirective.cameraMotion&&(e.cameraMotion=T),I!==(j.videoDirective.pacing||"normal")&&(e.pacing=I);let t=await (0,l.$Y)("/api/story/".concat(a,"/frame/").concat(d,"/directives"),e);if(!(null==t?void 0:t.ok))throw Error("save failed");q({...j,dialog:C,imageDirective:L,videoDirective:{action:_,cameraMotion:T,pacing:I}}),H(Date.now()),setTimeout(()=>H(null),3e3)}catch(e){O(("string"==typeof(null==e?void 0:e.message)?e.message:"Save failed").includes("speaker marker")?x("viewer.advanced.invalidSpeakerPrefix",'Action must start with a speaker like "NAME (male) speaks:"'):x("viewer.advanced.saveFailed","Save failed â try again"))}finally{F(!1)}}},[a,d,j,G,R,C,_,L,T,I,q,x]),B=(0,r.useCallback)(async()=>{if(a&&null!=d&&(null==j?void 0:j.original)&&!R&&await f({title:x("viewer.advanced.restoreConfirm","Restore this frame to the original Story Pilot directives? Your current edits will be replaced."),confirmLabel:x("common.restore","Restore"),destructive:!0,category:"viewer-restore-frame"})){F(!0),O(null);try{let e=await (0,l.$Y)("/api/story/".concat(a,"/frame/").concat(d,"/directives"),{restoreOriginal:!0});if(!(null==e?void 0:e.ok))throw Error("restore failed");let t=await (0,l.apiGet)("/api/story/".concat(a,"/frame/").concat(d,"/directives"));t&&t.available&&q(t),H(Date.now()),setTimeout(()=>H(null),3e3)}catch(e){O(x("viewer.advanced.restoreFailed","Restore failed â try again"))}finally{F(!1)}}},[a,d,j,R,q,x,f]);if(null==d)return null;let J="video"===v&&!!j&&("yes"===j.dialogMode||(null!=(t=j.dialog)?t:"").length>0);return(0,i.jsxs)("div",{className:"mb-4",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>b(!g),"aria-expanded":g,"aria-controls":h,className:"flex items-center gap-2 text-sm text-white/50 hover:text-white/70 motion-safe:transition-colors disabled:opacity-50",disabled:u,children:[(0,i.jsx)(s.A,{className:"w-4 h-4 motion-safe:transition-transform duration-200 ".concat(g?"rotate-180":""),"aria-hidden":"true"}),x("viewer.advanced.title","Advanced \xb7 prompt directives"),G&&(0,i.jsx)("span",{className:"px-1.5 py-0.5 bg-purple-500/20 text-purple-400 text-xs rounded-full",children:x("viewer.advanced.unsaved","unsaved")})]}),g&&(0,i.jsxs)("div",{id:h,className:"mt-3 p-4 bg-white/5 rounded-2xl border border-white/5 space-y-4",children:[w&&(0,i.jsx)("p",{className:"text-sm text-white/40",children:x("viewer.advanced.loading","Loadingâ¦")}),!w&&N&&(0,i.jsx)("p",{className:"text-sm text-white/50",children:"no_screenplay"===N?x("viewer.advanced.noScreenplay","This story has no Story Pilot screenplay yet â directives are unavailable."):x("viewer.advanced.frameMissing","This frame is not part of the screenplay yet.")}),!w&&j&&(0,i.jsxs)(i.Fragment,{children:[J&&(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{className:"block text-xs font-medium text-white/60 mb-1.5",children:"yes"===j.dialogMode?x("viewer.advanced.dialog","Dialog"):x("viewer.advanced.spokenText","Spoken text")}),(0,i.jsx)("textarea",{value:C,onChange:e=>D(e.target.value),className:"w-full h-16 px-3 py-2 bg-white/5 border border-white/10 rounded-xl text-white text-sm placeholder:text-white/30 resize-none focus:outline-none focus:border-purple-500/50 focus:ring-2 focus:ring-purple-500/20 motion-safe:transition-all",maxLength:2e3,disabled:u||R}),(0,i.jsx)("p",{className:"text-[11px] text-white/30 mt-1",children:x("viewer.advanced.dialogHint","Syncs across the visible text, narration, and the quoted line in the action below.")})]}),"video"===v&&(0,i.jsxs)("div",{className:m?"opacity-60":"",children:[(0,i.jsx)("label",{className:"block text-xs font-medium text-white/60 mb-1.5",children:x("viewer.advanced.action","Action (scene direction)")}),m&&(0,i.jsx)("p",{className:"text-[11px] text-amber-400 bg-amber-500/10 border border-amber-500/20 rounded-lg px-2 py-1.5 mb-2",children:x("viewer.advanced.actionOverrideActive","A custom video directive is set above â that wins for this generation. Your saved Action below will apply to future generations.")}
1),(0,i.jsx)("textarea",{value:_,onChange:e=>A(e.target.value),className:"w-full h-28 px-3 py-2 bg-white/5 border border-white/10 rounded-xl text-white text-sm placeholder:text-white/30 resize-y focus:outline-none focus:border-purple-500/50 focus:ring-2 focus:ring-purple-500/20 motion-safe:transition-all font-mono",maxLength:5e3,disabled:u||R}),(0,i.jsx)("p",{className:"text-[11px] text-white/30 mt-1",children:x("viewer.advanced.actionHint",'Should start with "NAME (male/female) speaks:" for dialog frames â silences other characters in shot.')})]}),(0,i.jsxs)("div",{className:p?"opacity-60":"",children:[(0,i.jsx)("label",{className:"block text-xs font-medium text-white/60 mb-1.5",children:x("viewer.advanced.imageDirective","Image directive")}),p&&(0,i.jsx)("p",{className:"text-[11px] text-amber-400 bg-amber-500/10 border border-amber-500/20 rounded-lg px-2 py-1.5 mb-2",children:x("viewer.advanced.imageOverrideActive","An image directive is set above â that wins for this regeneration. Your saved Image directive below will apply to future regenerations.")}),(0,i.jsx)("textarea",{value:L,onChange:e=>M(e.target.value),className:"w-full h-28 px-3 py-2 bg-white/5 border border-white/10 rounded-xl text-white text-sm placeholder:text-white/30 resize-y focus:outline-none focus:border-purple-500/50 focus:ring-2 focus:ring-purple-500/20 motion-safe:transition-all",maxLength:1e4,disabled:u||R})]}),"video"===v&&(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{className:"block text-xs font-medium text-white/60 mb-1.5",children:x("viewer.advanced.cameraMotion","Camera motion")}),(0,i.jsx)("input",{value:T,onChange:e=>E(e.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-xl text-white text-sm placeholder:text-white/30 focus:outline-none focus:border-purple-500/50 focus:ring-2 focus:ring-purple-500/20 motion-safe:transition-all",maxLength:200,disabled:u||R})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{className:"block text-xs font-medium text-white/60 mb-1.5",children:x("viewer.advanced.pacing","Pacing")}),(0,i.jsxs)("select",{value:I,onChange:e=>P(e.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-xl text-white text-sm focus:outline-none focus:border-purple-500/50 focus:ring-2 focus:ring-purple-500/20 motion-safe:transition-all",disabled:u||R,children:[(0,i.jsx)("option",{value:"slow",children:x("viewer.advanced.pacing.slow","slow")}),(0,i.jsx)("option",{value:"normal",children:x("viewer.advanced.pacing.normal","normal")}),(0,i.jsx)("option",{value:"fast",children:x("viewer.advanced.pacing.fast","fast")}),(0,i.jsx)("option",{value:"intense",children:x("viewer.advanced.pacing.intense","intense")})]})]})]}),Y&&(0,i.jsx)("p",{className:"text-xs text-red-400",children:Y}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,i.jsx)("button",{type:"button",onClick:V,disabled:!G||R||u,className:"px-4 py-2 rounded-xl text-sm font-medium bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 disabled:opacity-40 disabled:cursor-not-allowed motion-safe:transition-colors",children:R?x("viewer.advanced.saving","Savingâ¦"):x("viewer.advanced.save","Save to screenplay")}),j.original&&$&&(0,i.jsxs)("button",{type:"button",onClick:B,disabled:R||u,className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-xl text-xs font-medium bg-white/5 hover:bg-white/10 text-white/60 disabled:opacity-40 disabled:cursor-not-allowed motion-safe:transition-colors",title:x("viewer.advanced.restoreHint","Reverts dialog, action, image directive, camera, and pacing to the Story Pilot snapshot."),children:[(0,i.jsx)(c.A,{className:"h-3.5 w-3.5","aria-hidden":"true"}),x("viewer.advanced.restoreOriginalV2","Restore Story Pilot original")]}),z&&(0,i.jsx)("span",{className:"text-xs text-emerald-400",children:x("viewer.advanced.saved","Saved")})]})]})]})]})}},91429:(e,t,a)=>{a.d(t,{M:()=>c,s:()=>d});var i=a(73365),r=a(1521),n=a(3162),l=a(88248);let o=null,s=0;function c(e){var t;if(!o)return Promise.resolve(!1);let a=null!=(t=e.id)?t:(s+=1,"confirm-".concat(s,"-").concat(Date.now().toString(36)));return new Promise(t=>{o({...e,id:a,onConfirm:()=>t(!0),onCancel:()=>t(!1)})})}function d(){var e;let[t,a]=(0,r.useState)(null),s=(0,r.useRef)([]),c=(0,r.useRef)(!1),d=(0,r.useRef)(null),u=(0,r.useCallback)(()=>
1{if(0===s.current.length){c.current=!1;return}c.current=!0;let e=s.current.shift();try{var t;(0,l.u4)("ux_confirm_shown",{category:null!=(t=e.category)?t:"unknown",destructive:!!e.destructive})}catch(e){}d.current={confirm:e.onConfirm,cancel:e.onCancel},a(e)},[]);(0,r.useEffect)(()=>(o=e=>{s.current.push(e),c.current||u()},()=>{o=null}),[u]);let v=(0,r.useCallback)(()=>{let e=d.current;try{var i;(0,l.u4)("ux_confirm_accepted",{category:null!=(i=null==t?void 0:t.category)?i:"unknown",destructive:!!(null==t?void 0:t.destructive)})}catch(e){}a(null),d.current=null,setTimeout(()=>{null==e||e.confirm(),setTimeout(()=>u(),50)},0)},[t,u]),m=(0,r.useCallback)(()=>{let e=d.current;try{var i;(0,l.u4)("ux_confirm_cancelled",{category:null!=(i=null==t?void 0:t.category)?i:"unknown",destructive:!!(null==t?void 0:t.destructive)})}catch(e){}a(null),d.current=null,setTimeout(()=>{null==e||e.cancel(),setTimeout(()=>u(),50)},0)},[t,u]);return(0,i.jsx)(n.ConfirmDialog,{open:null!==t,onConfirm:v,onCancel:m,title:null!=(e=null==t?void 0:t.title)?e:"",description:null==t?void 0:t.message,confirmLabel:null==t?void 0:t.confirmLabel,cancelLabel:null==t?void 0:t.cancelLabel,destructive:null==t?void 0:t.destructive})}}}]);
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.