beatsheet 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -25
- package/bin/beatsheet.js +2 -0
- package/bin/register-fallback.mjs +23 -0
- package/bin/resolve-fallback.mjs +83 -0
- package/package.json +4 -3
- package/skill/SKILL.md +63 -42
- package/skill/reference/scene-techniques.md +4 -2
- package/skill/scripts/beats.ts +4 -12
- package/skill/scripts/catalogue.ts +9 -7
- package/src/args.ts +5 -0
- package/src/cli.ts +6 -12
- package/src/commands.ts +7 -7
- package/src/default-project.config.ts +9 -0
- package/src/packages.ts +17 -0
- package/src/paths.ts +15 -0
- package/src/project.ts +50 -15
- package/src/render/browser.ts +98 -14
- package/src/samples.ts +6 -6
- package/src/server/api.ts +31 -0
- package/src/server/server.ts +8 -1
- package/src/server/vite.ts +34 -6
- package/src/skill.ts +39 -3
- package/src/speech.ts +4 -4
- package/studio/index.html +2 -2
- package/studio/{main-YAPVEB24.js → main-KMYDBWZH.js} +10 -10
- package/studio/{styles-TKESX5FY.css → styles-NJ2CULOW.css} +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ly=Object.defineProperty,dy=Object.defineProperties;var uy=Object.getOwnPropertyDescriptors;var bi=Object.getOwnPropertySymbols;var Td=Object.prototype.hasOwnProperty,Dd=Object.prototype.propertyIsEnumerable;var wd=(t,e,n)=>e in t?ly(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,v=(t,e)=>{for(var n in e||={})Td.call(e,n)&&wd(t,n,e[n]);if(bi)for(var n of bi(e))Dd.call(e,n)&&wd(t,n,e[n]);return t},x=(t,e)=>dy(t,uy(e));var qt=(t,e)=>{var n={};for(var o in t)Td.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&bi)for(var o of bi(t))e.indexOf(o)<0&&Dd.call(t,o)&&(n[o]=t[o]);return n};var po=[null],_i=[!1],Kt=1,fy=null,Ee=Symbol("SIGNAL");function V(t){let e=po[0];return po[0]=t,e}function Ii(){return po[0]}var Qt={version:0,lastCleanEpoch:0,dirty:!1,producers:void 0,producersTail:void 0,consumers:void 0,consumersTail:void 0,recomputing:!1,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,kind:"unknown",producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Rt(t){if(_i[0])throw new Error("");let e=po[0];if(e===null)return;e.consumerOnSignalRead(t);let n=e.producersTail;if(n!==void 0&&n.producer===t)return;let o,i=e.recomputing;if(i&&(o=n!==void 0?n.nextProducer:e.producers,o!==void 0&&o.producer===t)){e.producersTail=o,o.lastReadVersion=t.version,o.knownValidAtEpoch=Kt;return}let r=t.consumersTail;if(r!==void 0&&r.consumer===e&&(!i||r.knownValidAtEpoch===Kt))return;let s=Tn(e),a={producer:t,consumer:e,nextProducer:o,prevConsumer:void 0,knownValidAtEpoch:Kt,lastReadVersion:t.version,nextConsumer:void 0};e.producersTail=a,n!==void 0?n.nextProducer=a:e.producers=a,s&&Rd(t,a)}function Md(){Kt++}function mo(t){if(!(Tn(t)&&!t.dirty)&&!(!t.dirty&&t.lastCleanEpoch===Kt)){if(!t.producerMustRecompute(t)&&!wn(t)){Ci(t);return}t.producerRecomputeValue(t),Ci(t)}}function Ks(t){if(t.consumers===void 0)return;let e=_i[0];_i[0]=!0;try{for(let n=t.consumers;n!==void 0;n=n.nextConsumer){let o=n.consumer;o.dirty||py(o)}}finally{_i[0]=e}}function Zs(){return po[0]?.consumerAllowSignalWrites!==!1}function py(t){t.dirty=!0,Ks(t),t.consumerMarkedDirty?.(t)}function Ci(t){t.dirty=!1,t.lastCleanEpoch=Kt}function At(t){return t&&Nd(t),V(t)}function Nd(t){if(t.producersTail?.knownValidAtEpoch===Kt){let e=t.producers;for(;e!==void 0;)e.knownValidAtEpoch=null,e=e.nextProducer}t.producersTail=void 0,t.recomputing=!0}function Yt(t,e){V(e),t&&kd(t)}function kd(t){t.recomputing=!1;let e=t.producersTail,n=e!==void 0?e.nextProducer:t.producers;if(n!==void 0){if(Tn(t))do n=Qs(n);while(n!==void 0);e!==void 0?e.nextProducer=void 0:t.producers=void 0}}function wn(t){for(let e=t.producers;e!==void 0;e=e.nextProducer){let n=e.producer,o=e.lastReadVersion;if(o!==n.version||(mo(n),o!==n.version))return!0}return!1}function Ot(t){if(Tn(t)){let e=t.producers;for(;e!==void 0;)e=Qs(e)}t.producers=void 0,t.producersTail=void 0,t.consumers=void 0,t.consumersTail=void 0}function Rd(t,e){let n=t.consumersTail,o=Tn(t);if(n!==void 0?(e.nextConsumer=n.nextConsumer,n.nextConsumer=e):(e.nextConsumer=void 0,t.consumers=e),e.prevConsumer=n,t.consumersTail=e,!o)for(let i=t.producers;i!==void 0;i=i.nextProducer)Rd(i.producer,i)}function Qs(t){let e=t.producer,n=t.nextProducer,o=t.nextConsumer,i=t.prevConsumer;if(t.nextConsumer=void 0,t.prevConsumer=void 0,o!==void 0?o.prevConsumer=i:e.consumersTail=i,i!==void 0)i.nextConsumer=o;else if(e.consumers=o,!Tn(e)){let r=e.producers;for(;r!==void 0;)r=Qs(r)}return n}function Tn(t){return t.consumerIsAlwaysLive||t.consumers!==void 0}function Si(t){fy?.(t)}function wi(t,e){return Object.is(t,e)}function ho(t,e){let n=Object.create(my);n.computation=t,e!==void 0&&(n.equal=e);let o=()=>{if(mo(n),Rt(n),n.value===Zt)throw n.error;return n.value};return o[Ee]=n,Si(n),o}var Ei=Symbol("UNSET"),xi=Symbol("COMPUTING"),Zt=Symbol("ERRORED"),my=x(v({},Qt),{value:Ei,dirty:!0,error:null,equal:wi,kind:"computed",producerMustRecompute(t){return t.value===Ei||t.value===xi},producerRecomputeValue(t){if(t.value===xi)throw new Error("");let e=t.value;t.value=xi;let n=At(t),o,i=!1;try{o=t.computation(),V(null),i=e!==Ei&&e!==Zt&&o!==Zt&&t.equal(e,o)}catch(r){o=Zt,t.error=r}finally{Yt(t,n)}if(i){t.value=e;return}t.value=o,t.version++}});function hy(){throw new Error}var Ad=hy;function Od(t){Ad(t)}function Ys(t){Ad=t}var gy=null;function Js(t,e){let n=Object.create(Dn);n.value=t,e!==void 0&&(n.equal=e);let o=()=>Pd(n);return o[Ee]=n,Si(n),[o,s=>Jt(n,s),s=>Xs(n,s)]}function Pd(t){return Rt(t),t.value}function Jt(t,e){Zs()||Od(t),t.equal(t.value,e)||(t.value=e,yy(t))}function Xs(t,e){Zs()||Od(t),Jt(t,e(t.value))}var Dn=x(v({},Qt),{equal:wi,value:void 0,kind:"signal"});function yy(t){t.version++,Md(),Ks(t),gy?.(t)}var ea=x(v({},Qt),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,dirty:!0,kind:"effect"});function ta(t){if(t.dirty=!1,t.version>0&&!wn(t))return;t.version++;let e=At(t);try{t.cleanup(),t.fn()}finally{Yt(t,e)}}var na=[void 0];function Ti(){return na[0]}function ut(t){let e=na[0];return na[0]=t,e}var Ld=Symbol("NotFound");function Mn(t){return t===Ld||t?.name==="\u0275NotFound"}function Fd(t){let e=V(null);try{return t()}finally{V(e)}}function Ae(t){return typeof t=="function"}function Di(t){let n=t(o=>{Error.call(o),o.stack=new Error().stack});return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Mi=Di(t=>function(n){t(this),this.message=n?`${n.length} errors occurred during unsubscription:
|
|
2
2
|
${n.map((o,i)=>`${i+1}) ${o.toString()}`).join(`
|
|
3
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=n});function go(t,e){if(t){let n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Me=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:n}=this;if(n)if(this._parentage=null,Array.isArray(n))for(let r of n)r.remove(this);else n.remove(this);let{initialTeardown:o}=this;if(Ae(o))try{o()}catch(r){e=r instanceof Mi?r.errors:[r]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let r of i)try{
|
|
4
|
-
`);return o>=0?n.slice(0,o):n}function Bi(t,e){return t?e?`${t} ${e}`:t:e||""}var Iy=ne({__forward_ref__:ne});function Hi(t){return t.__forward_ref__=Hi,t}function Fe(t){return eu(t)?t():t}function eu(t){return typeof t=="function"&&Object.hasOwn(t,Iy)&&t.__forward_ref__===Hi}function K(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}function Ui(t){return Sy(t,Gi)}function Sy(t,e){return Object.hasOwn(t,e)&&t[e]||null}function wy(t){let e=t?.[Gi]??null;return e||null}function da(t){return t&&Object.hasOwn(t,Oi)?t[Oi]:null}var Gi=ne({\u0275prov:ne}),Oi=ne({\u0275inj:ne}),Y=class{_desc;ngMetadataName="InjectionToken";\u0275prov;constructor(e,n){this._desc=e,this.\u0275prov=void 0,typeof n=="number"?this.__NG_ELEMENT_ID__=n:n!==void 0&&(this.\u0275prov=K({token:this,providedIn:n.providedIn||"root",factory:n.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}};function Ca(t){return t&&!!t.\u0275providers}var Ia=ne({\u0275cmp:ne}),Sa=ne({\u0275dir:ne}),wa=ne({\u0275pipe:ne});var ua=ne({\u0275fac:ne}),rn=ne({__NG_ELEMENT_ID__:ne}),Qd=ne({__NG_ENV_ID__:ne});function sn(t){return Ta(t,"@Component"),t[Ia]||null}function Wi(t){return Ta(t,"@Directive"),t[Sa]||null}function tu(t){return Ta(t,"@Pipe"),t[wa]||null}function Ta(t,e){if(t==null)throw new U(-919,!1)}function Ve(t){return typeof t=="string"?t:t==null?"":String(t)}var nu=ne({ngErrorCode:ne}),Ty=ne({ngErrorMessage:ne}),Dy=ne({ngTokenPath:ne});function Da(t,e){return ou("",-200,e)}function zi(t,e){throw new U(-201,!1)}function ou(t,e,n){let o=new U(e,t);return o[nu]=e,o[Ty]=t,n&&(o[Dy]=n),o}function My(t){return t[nu]}var fa;function iu(){return fa}function Le(t){let e=fa;return fa=t,e}function Ma(t,e,n){let o=Ui(t);if(o&&o.providedIn=="root")return o.value===void 0?o.value=o.factory():o.value;if(n&8)return null;if(e!==void 0)return e;zi(t,"")}var Co=globalThis;var Ny={},tn=Ny,ky="__NG_DI_FLAG__",pa=class{injector;constructor(e){this.injector=e}retrieve(e,n){let o=nn(n)||0;try{return this.injector.get(e,o&8?null:tn,o)}catch(i){if(Mn(i))return i;throw i}}};function Ry(t,e=0){let n=Ti();if(n===void 0)throw new U(-203,!1);if(n===null)return Ma(t,void 0,e);{let o=Ay(e),i=n.retrieve(t,o);if(Mn(i)){if(o.optional)return null;throw i}return i}}function te(t,e=0){return(iu()||Ry)(Fe(t),e)}function w(t,e){return te(t,nn(e))}function nn(t){return typeof t>"u"||typeof t=="number"?t:0|(t.optional&&8)|(t.host&&1)|(t.self&&2)|(t.skipSelf&&4)}function Ay(t){return{optional:!!(t&8),host:!!(t&1),self:!!(t&2),skipSelf:!!(t&4)}}function ma(t){let e=[];for(let n=0;n<t.length;n++){let o=Fe(t[n]);if(Array.isArray(o)){if(o.length===0)throw new U(900,!1);let i,r=0;for(let s=0;s<o.length;s++){let a=o[s],c=Oy(a);typeof c=="number"?c===-1?i=a.token:r|=c:i=a}e.push(te(i,r))}else e.push(te(o))}return e}function Oy(t){return t[ky]}function On(t,e){let n=Object.hasOwn(t,ua);return n?t[ua]:null}function ru(t,e,n){if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++){let i=t[o],r=e[o];if(n&&(i=n(i),r=n(r)),r!==i)return!1}return!0}function su(t){return t.flat(Number.POSITIVE_INFINITY)}function qi(t,e){t.forEach(n=>Array.isArray(n)?qi(n,e):e(n))}function Na(t,e,n){e>=t.length?t.push(n):t.splice(e,0,n)}function Io(t,e){return e>=t.length-1?t.pop():t.splice(e,1)[0]}function au(t,e,n,o){let i=t.length;if(i==e)t.push(n,o);else if(i===1)t.push(o,t[0]),t[0]=n;else{for(i--,t.push(t[i-1],t[i]);i>e;){let r=i-2;t[i]=t[r],i--}t[e]=n,t[e+1]=o}}function Ki(t,e,n){let o=Ln(t,e);return o>=0?t[o|1]=n:(o=~o,au(t,o,e,n)),o}function Zi(t,e){let n=Ln(t,e);if(n>=0)return t[n|1]}function Ln(t,e){return Py(t,e,1)}function Py(t,e,n){let o=0,i=t.length>>n;for(;i!==o;){let r=o+(i-o>>1),s=t[r<<n];if(e===s)return r<<n;s>e?i=r:o=r+1}return~(i<<n)}var Qi={},nt=[],Fn=new Y(""),ka=new Y("",-1),Ra=new Y(""),Pn=class{get(e,n=tn){if(n===tn){let i=ou("",-201);throw i.name="\u0275NotFound",i}return n}};function So(t){return{\u0275providers:t}}function cu(t){return So([{provide:Fn,multi:!0,useValue:t}])}function lu(...t){return{\u0275providers:Aa(!0,t),\u0275fromNgModule:!0}}function Aa(t,...e){let n=[],o=new Set,i,r=s=>{n.push(s)};return qi(e,s=>{let a=s;Pi(a,r,[],o)&&(i||=[],i.push(a))}),i!==void 0&&du(i,r),n}function du(t,e){for(let n=0;n<t.length;n++){let{ngModule:o,providers:i}=t[n];Oa(i,r=>{e(r,o)})}}function Pi(t,e,n,o){if(t=Fe(t),!t)return!1;let i=null,r=da(t),s=!r&&sn(t);if(!r&&!s){let c=t.ngModule;if(r=da(c),r)i=c;else return!1}else{if(s&&!s.standalone)return!1;i=t}let a=o.has(i);if(s){if(a)return!1;if(o.add(i),s.dependencies){let c=typeof s.dependencies=="function"?s.dependencies():s.dependencies;for(let d of c)Pi(d,e,n,o)}}else if(r){if(r.imports!=null&&!a){o.add(i);let d;qi(r.imports,f=>{Pi(f,e,n,o)&&(d||=[],d.push(f))}),d!==void 0&&du(d,e)}if(!a){let d=On(i)||(()=>new i);e({provide:i,useFactory:d,deps:nt},i),e({provide:Ra,useValue:i,multi:!0},i),e({provide:Fn,useValue:()=>te(i),multi:!0},i)}let c=r.providers;if(c!=null&&!a){let d=t;Oa(c,f=>{e(f,d)})}}else return!1;return i!==t&&t.providers!==void 0}function Oa(t,e){for(let n of t)Ca(n)&&(n=n.\u0275providers),Array.isArray(n)?Oa(n,e):e(n)}var Ly=ne({provide:String,useValue:ne});function uu(t){return t!==null&&typeof t=="object"&&Ly in t}function Fy(t){return!!(t&&t.useExisting)}function Vy(t){return!!(t&&t.useFactory)}function Li(t){return typeof t=="function"}var wo=new Y(""),Ai={},Yd={},la;function To(){return la===void 0&&(la=new Pn),la}var ot=class{},on=class extends ot{parent;source;scopes;records=new Map;_ngOnDestroyHooks=new Set;_onDestroyHooks=[];get destroyed(){return this._destroyed}_destroyed=!1;injectorDefTypes;constructor(e,n,o,i){super(),this.parent=n,this.source=o,this.scopes=i,ga(e,s=>this.processProvider(s)),this.records.set(ka,An(void 0,this)),i.has("environment")&&this.records.set(ot,An(void 0,this));let r=this.records.get(wo);r!=null&&typeof r.value=="string"&&this.scopes.add(r.value),this.injectorDefTypes=new Set(this.get(Ra,nt,{self:!0}))}retrieve(e,n){let o=nn(n)||0;try{return this.get(e,tn,o)}catch(i){if(Mn(i))return i;throw i}}destroy(){vo(this),this._destroyed=!0;let e=V(null);try{for(let o of this._ngOnDestroyHooks)o.ngOnDestroy();let n=this._onDestroyHooks;this._onDestroyHooks=[];for(let o of n)o()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),V(e)}}onDestroy(e){return vo(this),this._onDestroyHooks.push(e),()=>this.removeOnDestroy(e)}runInContext(e){vo(this);let n=ut(this),o=Le(void 0),i;try{return e()}finally{ut(n),Le(o)}}get(e,n=tn,o){if(vo(this),Object.hasOwn(e,Qd))return e[Qd](this);let i=nn(o),r,s=ut(this),a=Le(void 0);try{if(!(i&4)){let d=this.records.get(e);if(d===void 0){let f=Uy(e)&&Ui(e);f&&this.injectableDefInScope(f)?d=An(ha(e),Ai):d=null,this.records.set(e,d)}if(d!=null)return this.hydrate(e,d,i)}let c=i&2?To():this.parent;return n=i&8&&n===tn?null:n,c.get(e,n)}catch(c){let d=My(c);throw d===-200||d===-201?new U(d,null):c}finally{Le(a),ut(s)}}resolveInjectorInitializers(){let e=V(null),n=ut(this),o=Le(void 0),i;try{let r=this.get(Fn,nt,{self:!0});for(let s of r)s()}finally{ut(n),Le(o),V(e)}}toString(){return"R3Injector[...]"}processProvider(e){e=Fe(e);let n=Li(e)?e:Fe(e&&e.provide),o=$y(e);if(!Li(e)&&e.multi===!0){let i=this.records.get(n);i||(i=An(void 0,Ai,!0),i.factory=()=>ma(i.multi),this.records.set(n,i)),n=e,i.multi.push(e)}this.records.set(n,o)}hydrate(e,n,o){let i=V(null);try{if(n.value===Yd)throw Da("");return n.value===Ai&&(n.value=Yd,n.value=n.factory(void 0,o)),typeof n.value=="object"&&n.value&&Hy(n.value)&&this._ngOnDestroyHooks.add(n.value),n.value}finally{V(i)}}injectableDefInScope(e){if(!e.providedIn)return!1;let n=Fe(e.providedIn);return typeof n=="string"?n==="any"||this.scopes.has(n):this.injectorDefTypes.has(n)}removeOnDestroy(e){let n=this._onDestroyHooks.indexOf(e);n!==-1&&this._onDestroyHooks.splice(n,1)}};function ha(t){let e=Ui(t),n=e!==null?e.factory:On(t);if(n!==null)return n;if(t instanceof Y)throw new U(-204,!1);if(t instanceof Function)return jy(t);throw new U(-204,!1)}function jy(t){if(t.length>0)throw new U(-204,!1);let n=wy(t);return n!==null?()=>n.factory(t):()=>new t}function $y(t){if(uu(t))return An(void 0,t.useValue);{let e=fu(t);return An(e,Ai)}}function fu(t,e,n){let o;if(Li(t)){let i=Fe(t);return On(i)||ha(i)}else if(uu(t))o=()=>Fe(t.useValue);else if(Vy(t))o=()=>t.useFactory(...ma(t.deps||[]));else if(Fy(t))o=(i,r)=>te(Fe(t.useExisting),r!==void 0&&r&8?8:void 0);else{let i=Fe(t&&(t.useClass||t.provide));if(By(t))o=()=>new i(...ma(t.deps));else return On(i)||ha(i)}return o}function vo(t){if(t.destroyed)throw new U(-205,!1)}function An(t,e,n=!1){return{factory:t,value:e,multi:n?[]:void 0}}function By(t){return!!t.deps}function Hy(t){return t!==null&&typeof t=="object"&&typeof t.ngOnDestroy=="function"}function Uy(t){return typeof t=="function"||typeof t=="object"&&t.ngMetadataName==="InjectionToken"}function ga(t,e){for(let n of t)Array.isArray(n)?ga(n,e):n&&Ca(n)?ga(n.\u0275providers,e):e(n)}function Yi(t,e){let n;t instanceof on?(vo(t),n=t):n=new pa(t);let o,i=ut(n),r=Le(void 0);try{return e()}finally{ut(i),Le(r)}}function pu(){return iu()!==void 0||Ti()!=null}var it=0,$=1,H=2,he=3,ze=4,Pe=5,Vn=6,jn=7,ue=8,Dt=9,pt=10,de=11,$n=12,Pa=13,Pt=14,je=15,Lt=16,an=17,mt=18,Do=19,La=20,It=21,Ji=22,St=23,$e=24,cn=25,mu=26,Mo=27,ye=28,hu=1,Fa=6,ln=7,No=8,dn=9,fe=10;function Ft(t){return Array.isArray(t)&&typeof t[hu]=="object"}function qe(t){return Array.isArray(t)&&t[hu]===!0}function Va(t){return(t.flags&4)!==0}function Vt(t){return t.componentOffset>-1}function Xi(t){return(t.flags&1)===1}function un(t){return!!t.template}function Bn(t){return(t[H]&512)!==0}function fn(t){return(t[H]&256)===256}var gu="svg",yu="math";function Ie(t){for(;Array.isArray(t);)t=t[it];return t}function ja(t,e){return Ie(e[t])}function rt(t,e){return Ie(e[t.index])}function er(t,e){return t.data[e]}function $a(t,e){return t[e]}function tr(t,e,n,o){n>=t.data.length&&(t.data[n]=null,t.blueprint[n]=null),e[n]=o}function ht(t,e){let n=e[t];return Ft(n)?n:n[it]}function nr(t){return(t[H]&128)===128}function vu(t){return qe(t[he])}function gt(t,e){return e==null?null:t[e]}function Ba(t){t[an]=0}function Ha(t){t[H]&1024||(t[H]|=1024,nr(t)&&pn(t))}function bu(t,e){for(;t>0;)e=e[Pt],t--;return e}function ko(t){return!!(t[H]&9216||t[$e]?.dirty)}function or(t){t[pt].changeDetectionScheduler?.notify(8),t[H]&64&&(t[H]|=1024),ko(t)&&pn(t)}function pn(t){t[pt].changeDetectionScheduler?.notify(0);let e=wt(t);for(;e!==null&&!(e[H]&8192||(e[H]|=8192,!nr(e)));)e=wt(e)}function ir(t,e){if(fn(t))throw new U(911,!1);t[It]===null&&(t[It]=[]),t[It].push(e)}function _u(t,e){if(t[It]===null)return;let n=t[It].indexOf(e);n!==-1&&t[It].splice(n,1)}function wt(t){let e=t[he];return qe(e)?e[he]:e}function Ua(t){return t[jn]??=[]}function Ga(t){return t.cleanup??=[]}function Eu(t,e,n,o){let i=Ua(e);i.push(n),t.firstCreatePass&&Ga(t).push(o,i.length-1)}var G={lFrame:Lu(null),bindingsEnabled:!0,skipHydrationRootTNode:null};var ya=!1;function xu(){return G.lFrame.elementDepthCount}function Cu(){G.lFrame.elementDepthCount++}function Wa(){G.lFrame.elementDepthCount--}function Iu(){return G.bindingsEnabled}function Su(){return G.skipHydrationRootTNode!==null}function za(t){return G.skipHydrationRootTNode===t}function qa(){G.skipHydrationRootTNode=null}function W(){return G.lFrame.lView}function Se(){return G.lFrame.tView}function I(t){return G.lFrame.contextLView=t,t[ue]}function S(t){return G.lFrame.contextLView=null,t}function Ke(){let t=Ka();for(;t!==null&&t.type===64;)t=t.parent;return t}function Ka(){return G.lFrame.currentTNode}function wu(){let t=G.lFrame,e=t.currentTNode;return t.isParent?e:e.parent}function mn(t,e){let n=G.lFrame;n.currentTNode=t,n.isParent=e}function Za(){return G.lFrame.isParent}function Tu(){G.lFrame.isParent=!1}function Qa(){return G.lFrame.contextLView}function Ya(){return ya}function bo(t){let e=ya;return ya=t,e}function Du(){let t=G.lFrame,e=t.bindingRootIndex;return e===-1&&(e=t.bindingRootIndex=t.tView.bindingStartIndex),e}function rr(){return G.lFrame.bindingIndex}function Mu(t){return G.lFrame.bindingIndex=t}function hn(){return G.lFrame.bindingIndex++}function Hn(t){let e=G.lFrame,n=e.bindingIndex;return e.bindingIndex=e.bindingIndex+t,n}function Nu(){return G.lFrame.inI18n}function ku(t,e){let n=G.lFrame;n.bindingIndex=n.bindingRootIndex=t,sr(e)}function Ru(){return G.lFrame.currentDirectiveIndex}function sr(t){G.lFrame.currentDirectiveIndex=t}function Au(t){let e=G.lFrame.currentDirectiveIndex;return e===-1?null:t[e]}function Ou(){return G.lFrame.currentQueryIndex}function ar(t){G.lFrame.currentQueryIndex=t}function Gy(t){let e=t[$];return e.type===2?e.declTNode:e.type===1?t[Pe]:null}function Ja(t,e,n){if(n&4){let i=e,r=t;for(;i=i.parent,i===null&&!(n&1);)if(i=Gy(r),i===null||(r=r[Pt],i.type&10))break;if(i===null)return!1;e=i,t=r}let o=G.lFrame=Pu();return o.currentTNode=e,o.lView=t,!0}function cr(t){let e=Pu(),n=t[$];G.lFrame=e,e.currentTNode=n.firstChild,e.lView=t,e.tView=n,e.contextLView=t,e.bindingIndex=n.bindingStartIndex,e.inI18n=!1}function Pu(){let t=G.lFrame,e=t===null?null:t.child;return e===null?Lu(t):e}function Lu(t){let e={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:t,child:null,inI18n:!1};return t!==null&&(t.child=e),e}function Fu(){let t=G.lFrame;return G.lFrame=t.parent,t.currentTNode=null,t.lView=null,t}var Xa=Fu;function lr(){let t=Fu();t.isParent=!0,t.tView=null,t.selectedIndex=-1,t.contextLView=null,t.elementDepthCount=0,t.currentDirectiveIndex=-1,t.currentNamespace=null,t.bindingRootIndex=-1,t.bindingIndex=-1,t.currentQueryIndex=0}function Vu(t){return(G.lFrame.contextLView=bu(t,G.lFrame.contextLView))[ue]}function Be(){return G.lFrame.selectedIndex}function jt(t){G.lFrame.selectedIndex=t}function dr(){let t=G.lFrame;return er(t.tView,t.selectedIndex)}function ec(){return G.lFrame.currentNamespace}var ju=!0;function ur(){return ju}function fr(t){ju=t}function va(t,e=null,n=null,o){let i=$u(t,e,n,o);return i.resolveInjectorInitializers(),i}function $u(t,e=null,n=null,o,i=new Set){let r=[n||nt,lu(t)],s;return new on(r,e||To(),s||null,i)}var Ce=class t{static THROW_IF_NOT_FOUND=tn;static NULL=new Pn;static create(e,n){if(Array.isArray(e))return va({name:""},n,e,"");{let o=e.name??"";return va({name:o},e.parent,e.providers,o)}}static \u0275prov=K({token:t,providedIn:"any",factory:()=>te(ka)});static __NG_ELEMENT_ID__=-1},Ne=new Y(""),ge=class{static __NG_ELEMENT_ID__=Wy;static __NG_ENV_ID__=e=>e},Fi=class extends ge{_lView;constructor(e){super(),this._lView=e}get destroyed(){return fn(this._lView)}onDestroy(e){let n=this._lView;return ir(n,e),()=>_u(n,e)}};function Wy(){return new Fi(W())}var Bu=!1,Hu=new Y(""),Un=(()=>{class t{taskId=0;pendingTasks=new Set;destroyed=!1;pendingTask=new yo(!1);debugTaskTracker=w(Hu,{optional:!0});get hasPendingTasks(){return this.destroyed?!1:this.pendingTask.value}get hasPendingTasksObservable(){return this.destroyed?new ft(n=>{n.next(!1),n.complete()}):this.pendingTask}add(){!this.hasPendingTasks&&!this.destroyed&&this.pendingTask.next(!0);let n=this.taskId++;return this.pendingTasks.add(n),this.debugTaskTracker?.add(n),n}has(n){return this.pendingTasks.has(n)}remove(n){this.pendingTasks.delete(n),this.debugTaskTracker?.remove(n),this.pendingTasks.size===0&&this.hasPendingTasks&&this.pendingTask.next(!1)}ngOnDestroy(){this.pendingTasks.clear(),this.hasPendingTasks&&this.pendingTask.next(!1),this.destroyed=!0,this.pendingTask.unsubscribe()}static \u0275prov=K({token:t,providedIn:"root",factory:()=>new t})}return t})(),ba=class extends Ge{__isAsync;destroyRef=void 0;pendingTasks=void 0;constructor(e=!1){super(),this.__isAsync=e,pu()&&(this.destroyRef=w(ge,{optional:!0})??void 0,this.pendingTasks=w(Un,{optional:!0})??void 0)}emit(e){let n=V(null);try{super.next(e)}finally{V(n)}}subscribe(e,n,o){let i=e,r=n||(()=>null),s=o;if(e&&typeof e=="object"){let c=e;i=c.next?.bind(c),r=c.error?.bind(c),s=c.complete?.bind(c)}this.__isAsync&&(r=this.wrapInTimeout(r),i&&(i=this.wrapInTimeout(i)),s&&(s=this.wrapInTimeout(s)));let a=super.subscribe({next:i,error:r,complete:s});return e instanceof Me&&e.add(a),a}wrapInTimeout(e){return n=>{let o=this.pendingTasks?.add();setTimeout(()=>{try{e(n)}finally{o!==void 0&&this.pendingTasks?.remove(o)}})}}},Ct=ba;function Vi(...t){}function tc(t){let e,n;function o(){t=Vi;try{n!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(n),e!==void 0&&clearTimeout(e)}catch{}}return e=setTimeout(()=>{t(),o()}),typeof requestAnimationFrame=="function"&&(n=requestAnimationFrame(()=>{t(),o()})),()=>o()}function Uu(t){return queueMicrotask(()=>t()),()=>{t=Vi}}var nc="isAngularZone",_o=nc+"_ID",zy=0,Oe=class t{hasPendingMacrotasks=!1;hasPendingMicrotasks=!1;isStable=!0;onUnstable=new Ct(!1);onMicrotaskEmpty=new Ct(!1);onStable=new Ct(!1);onError=new Ct(!1);constructor(e){let{enableLongStackTrace:n=!1,shouldCoalesceEventChangeDetection:o=!1,shouldCoalesceRunChangeDetection:i=!1,scheduleInRootZone:r=Bu}=e;if(typeof Zone>"u")throw new U(908,!1);Zone.assertZonePatched();let s=this;s._nesting=0,s._outer=s._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(s._inner=s._inner.fork(new Zone.TaskTrackingZoneSpec)),n&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!i&&o,s.shouldCoalesceRunChangeDetection=i,s.callbackScheduled=!1,s.scheduleInRootZone=r,Zy(s)}static isInAngularZone(){return typeof Zone<"u"&&Zone.current.get(nc)===!0}static assertInAngularZone(){if(!t.isInAngularZone())throw new U(909,!1)}static assertNotInAngularZone(){if(t.isInAngularZone())throw new U(909,!1)}run(e,n,o){return this._inner.run(e,n,o)}runTask(e,n,o,i){let r=this._inner,s=r.scheduleEventTask("NgZoneEvent: "+i,e,qy,Vi,Vi);try{return r.runTask(s,n,o)}finally{r.cancelTask(s)}}runGuarded(e,n,o){return this._inner.runGuarded(e,n,o)}runOutsideAngular(e){return this._outer.run(e)}},qy={};function oc(t){if(t._nesting==0&&!t.hasPendingMicrotasks&&!t.isStable)try{t._nesting++,t.onMicrotaskEmpty.emit(null)}finally{if(t._nesting--,!t.hasPendingMicrotasks)try{t.runOutsideAngular(()=>t.onStable.emit(null))}finally{t.isStable=!0}}}function Ky(t){if(t.isCheckStableRunning||t.callbackScheduled)return;t.callbackScheduled=!0;function e(){tc(()=>{t.callbackScheduled=!1,_a(t),t.isCheckStableRunning=!0,oc(t),t.isCheckStableRunning=!1})}t.scheduleInRootZone?Zone.root.run(()=>{e()}):t._outer.run(()=>{e()}),_a(t)}function Zy(t){let e=()=>{Ky(t)},n=zy++;t._inner=t._inner.fork({name:"angular",properties:{[nc]:!0,[_o]:n,[_o+n]:!0},onInvokeTask:(o,i,r,s,a,c)=>{if(Qy(c))return o.invokeTask(r,s,a,c);try{return Jd(t),o.invokeTask(r,s,a,c)}finally{(t.shouldCoalesceEventChangeDetection&&s.type==="eventTask"||t.shouldCoalesceRunChangeDetection)&&e(),Xd(t)}},onInvoke:(o,i,r,s,a,c,d)=>{try{return Jd(t),o.invoke(r,s,a,c,d)}finally{t.shouldCoalesceRunChangeDetection&&!t.callbackScheduled&&!Yy(c)&&e(),Xd(t)}},onHasTask:(o,i,r,s)=>{o.hasTask(r,s),i===r&&(s.change=="microTask"?(t._hasPendingMicrotasks=s.microTask,_a(t),oc(t)):s.change=="macroTask"&&(t.hasPendingMacrotasks=s.macroTask))},onHandleError:(o,i,r,s)=>(o.handleError(r,s),t.runOutsideAngular(()=>t.onError.emit(s)),!1)})}function _a(t){t._hasPendingMicrotasks||(t.shouldCoalesceEventChangeDetection||t.shouldCoalesceRunChangeDetection)&&t.callbackScheduled===!0?t.hasPendingMicrotasks=!0:t.hasPendingMicrotasks=!1}function Jd(t){t._nesting++,t.isStable&&(t.isStable=!1,t.onUnstable.emit(null))}function Xd(t){t._nesting--,oc(t)}var Eo=class{hasPendingMicrotasks=!1;hasPendingMacrotasks=!1;isStable=!0;onUnstable=new Ct;onMicrotaskEmpty=new Ct;onStable=new Ct;onError=new Ct;run(e,n,o){return e.apply(n,o)}runGuarded(e,n,o){return e.apply(n,o)}runOutsideAngular(e){return e()}runTask(e,n,o,i){return e.apply(n,o)}};function Qy(t){return Gu(t,"__ignore_ng_zone__")}function Yy(t){return Gu(t,"__scheduler_tick__")}function Gu(t,e){return!Array.isArray(t)||t.length!==1?!1:t[0]?.data?.[e]===!0}var We=class{_console=console;handleError(e){this._console.error("ERROR",e)}};function Wu(t){return zu(t)?t:new Ea(t)}function zu(t){return t instanceof Error||typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.message=="string"}var Ea=class extends Error{constructor(e){super(String(e),{cause:e}),this.name="ErrorBoundaryWrappedError"}},gn=new Y("",{factory:()=>{let t=w(Oe),e=w(ot),n;return o=>{t.runOutsideAngular(()=>{e.destroyed&&!n?setTimeout(()=>{throw o}):(n??=e.get(We),n.handleError(o))})}}}),qu={provide:Fn,useValue:()=>{let t=w(We,{optional:!0})},multi:!0},Jy=new Y("",{factory:()=>{let t=w(Ne).defaultView;if(!t)return;let e=w(gn),n=r=>{e(r.reason),r.preventDefault()},o=r=>{r.error?e(r.error):e(new Error(r.message,{cause:r})),r.preventDefault()},i=()=>{t.addEventListener("unhandledrejection",n),t.addEventListener("error",o)};typeof Zone<"u"?Zone.root.run(i):i(),w(ge).onDestroy(()=>{t.removeEventListener("error",o),t.removeEventListener("unhandledrejection",n)})}});function ic(){return So([cu(()=>{w(Jy)})])}function A(t,e){let[n,o,i]=Qs(t,e?.equal),r=n,s=r[Ee];return r.set=o,r.update=i,r.asReadonly=rc.bind(r),r}function rc(){let t=this[Ee];if(t.readonlyFn===void 0){let e=()=>this();e[Ee]=t,t.readonlyFn=e}return t.readonlyFn}var Ro=new Y("",{factory:()=>Xy}),Xy="ng";var pr=new Y(""),Ao=new Y("",{providedIn:"platform",factory:()=>"unknown"});var mr=new Y("",{factory:()=>w(Ne).body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce")||null});var Gn=(()=>{class t{view;node;constructor(n,o){this.view=n,this.node=o}static __NG_ELEMENT_ID__=ev}return t})();function ev(){return new Gn(W(),Ke())}var Tt=class{},Oo=new Y("",{factory:()=>!0});var sc=new Y(""),hr=(()=>{class t{static \u0275prov=K({token:t,providedIn:"root",factory:()=>new xa})}return t})(),xa=class{dirtyEffectCount=0;queues=new Map;add(e){this.enqueue(e),this.schedule(e)}schedule(e){e.dirty&&this.dirtyEffectCount++}remove(e){let n=e.zone,o=this.queues.get(n);o.has(e)&&(o.delete(e),e.dirty&&this.dirtyEffectCount--)}enqueue(e){let n=e.zone;this.queues.has(n)||this.queues.set(n,new Set);let o=this.queues.get(n);o.has(e)||o.add(e)}flush(){for(;this.dirtyEffectCount>0;){let e=!1;for(let[n,o]of this.queues)n===null?e||=this.flushQueue(o):e||=n.run(()=>this.flushQueue(o));e||(this.dirtyEffectCount=0)}}flushQueue(e){let n=!1;for(let o of e)o.dirty&&(this.dirtyEffectCount--,n=!0,o.run());return n}},ji=class{[Ee];constructor(e){this[Ee]=e}destroy(){this[Ee].destroy()}};function He(t,e){let n=e?.injector??w(Ce),o=e?.manualCleanup!==!0?n.get(ge):null,i,r=n.get(Gn,null,{optional:!0}),s=n.get(Tt);return r!==null?(i=Zu(r.view,s,t),o instanceof Fi&&o._lView===r.view&&(o=null)):i=ov(t,n.get(hr),s),i.injector=n,o!==null&&(i.onDestroyFns=[o.onDestroy(()=>i.destroy())]),new ji(i)}var Ku=x(y({},Js),{cleanupFns:void 0,zone:null,onDestroyFns:null,run(){let t=bo(!1);try{Xs(this)}finally{bo(t)}},cleanup(){if(!this.cleanupFns?.length)return;let t=V(null);try{for(;this.cleanupFns.length;)this.cleanupFns.pop()()}finally{this.cleanupFns=[],V(t)}}}),tv=x(y({},Ku),{consumerMarkedDirty(){this.scheduler.schedule(this),this.notifier.notify(12)},destroy(){if(Ot(this),this.onDestroyFns!==null)for(let t of this.onDestroyFns)t();this.cleanup(),this.scheduler.remove(this)}}),nv=x(y({},Ku),{consumerMarkedDirty(){this.view[H]|=8192,pn(this.view),this.notifier.notify(13)},destroy(){if(Ot(this),this.onDestroyFns!==null)for(let t of this.onDestroyFns)t();this.cleanup(),this.view[St]?.delete(this)}});function Zu(t,e,n){let o=Object.create(nv);return o.view=t,o.zone=typeof Zone<"u"?Zone.current:null,o.notifier=e,o.userFn=n,o.fn=Qu(o,n),t[St]??=new Set,t[St].add(o),o.consumerMarkedDirty(o),o}function ov(t,e,n){let o=Object.create(tv);return o.userFn=t,o.fn=Qu(o,t),o.scheduler=e,o.notifier=n,o.zone=typeof Zone<"u"?Zone.current:null,o.scheduler.add(o),o.notifier.notify(12),o}function Qu(t,e){return()=>{e(n=>(t.cleanupFns??=[]).push(n))}}var Hc=Symbol("InputSignalNode#UNSET"),Mf=x(y({},Dn),{transformFn:void 0,applyValueToInputSignal(t,e){Jt(t,e)}});function Nf(t){return{toString:t}.toString()}var X=(function(t){return t[t.TemplateCreateStart=0]="TemplateCreateStart",t[t.TemplateCreateEnd=1]="TemplateCreateEnd",t[t.TemplateUpdateStart=2]="TemplateUpdateStart",t[t.TemplateUpdateEnd=3]="TemplateUpdateEnd",t[t.LifecycleHookStart=4]="LifecycleHookStart",t[t.LifecycleHookEnd=5]="LifecycleHookEnd",t[t.OutputStart=6]="OutputStart",t[t.OutputEnd=7]="OutputEnd",t[t.BootstrapApplicationStart=8]="BootstrapApplicationStart",t[t.BootstrapApplicationEnd=9]="BootstrapApplicationEnd",t[t.BootstrapComponentStart=10]="BootstrapComponentStart",t[t.BootstrapComponentEnd=11]="BootstrapComponentEnd",t[t.ChangeDetectionStart=12]="ChangeDetectionStart",t[t.ChangeDetectionEnd=13]="ChangeDetectionEnd",t[t.ChangeDetectionSyncStart=14]="ChangeDetectionSyncStart",t[t.ChangeDetectionSyncEnd=15]="ChangeDetectionSyncEnd",t[t.AfterRenderHooksStart=16]="AfterRenderHooksStart",t[t.AfterRenderHooksEnd=17]="AfterRenderHooksEnd",t[t.ComponentStart=18]="ComponentStart",t[t.ComponentEnd=19]="ComponentEnd",t[t.DeferBlockStateStart=20]="DeferBlockStateStart",t[t.DeferBlockStateEnd=21]="DeferBlockStateEnd",t[t.DynamicComponentStart=22]="DynamicComponentStart",t[t.DynamicComponentEnd=23]="DynamicComponentEnd",t[t.HostBindingsUpdateStart=24]="HostBindingsUpdateStart",t[t.HostBindingsUpdateEnd=25]="HostBindingsUpdateEnd",t})(X||{});function _v(t,e,n,o){e!==null?e.applyValueToInputSignal(e,o):t[n]=o}var Ev=null;function xv(){return Ev}var Yu=[];var ee=function(t,e=null,n){for(let o=0;o<Yu.length;o++){let i=Yu[o];i(t,e,n)}};function Cv(t,e,n){let{ngOnChanges:o,ngOnInit:i,ngDoCheck:r}=e.type.prototype;if(o){let s=xv()(e);(n.preOrderHooks??=[]).push(t,s),(n.preOrderCheckHooks??=[]).push(t,s)}i&&(n.preOrderHooks??=[]).push(0-t,i),r&&((n.preOrderHooks??=[]).push(t,r),(n.preOrderCheckHooks??=[]).push(t,r))}function Iv(t,e){for(let n=e.directiveStart,o=e.directiveEnd;n<o;n++){let r=t.data[n].type.prototype,{ngAfterContentInit:s,ngAfterContentChecked:a,ngAfterViewInit:c,ngAfterViewChecked:d,ngOnDestroy:f}=r;s&&(t.contentHooks??=[]).push(-n,s),a&&((t.contentHooks??=[]).push(n,a),(t.contentCheckHooks??=[]).push(n,a)),c&&(t.viewHooks??=[]).push(-n,c),d&&((t.viewHooks??=[]).push(n,d),(t.viewCheckHooks??=[]).push(n,d)),f!=null&&(t.destroyHooks??=[]).push(n,f)}}function vr(t,e,n){kf(t,e,3,n)}function br(t,e,n,o){(t[H]&3)===n&&kf(t,e,n,o)}function ac(t,e){let n=t[H];(n&3)===e&&(n&=16383,n+=1,t[H]=n)}function kf(t,e,n,o){let i=o!==void 0?t[an]&65535:0,r=o??-1,s=e.length-1,a=0;for(let c=i;c<s;c++)if(typeof e[c+1]=="number"){if(a=e[c],o!=null&&a>=o)break}else e[c]<0&&(t[an]+=65536),(a<r||r==-1)&&(Sv(t,n,e,c),t[an]=(t[an]&4294901760)+c+2),c++}function Ju(t,e){ee(X.LifecycleHookStart,t,e);let n=V(null);try{e.call(t)}finally{V(n),ee(X.LifecycleHookEnd,t,e)}}function Sv(t,e,n,o){let i=n[o]<0,r=n[o+1],s=i?-n[o]:n[o],a=t[s];i?t[H]>>14<t[an]>>16&&(t[H]&3)===e&&(t[H]+=16384,Ju(a,r)):Ju(a,r)}var qn=-1,Fo=class{factory;name;injectImpl;resolving=!1;canSeeViewProviders;multi;componentProviders;index;providerFactory;constructor(e,n,o,i){this.factory=e,this.name=i,this.canSeeViewProviders=n,this.injectImpl=o}};function wv(t){return(t.flags&8)!==0}function Tv(t){return(t.flags&16)!==0}function Dv(t,e,n){let o=0;for(;o<n.length;){let i=n[o];if(typeof i=="number"){if(i!==0)break;o++;let r=n[o++],s=n[o++],a=n[o++];t.setAttribute(e,s,a,r)}else{let r=i,s=n[++o];Nv(r)?t.setProperty(e,r,s):t.setAttribute(e,r,s),o++}}return o}function Mv(t){return t===3||t===4||t===6}function Nv(t){return t.charCodeAt(0)===64}function Lr(t,e){if(!(e===null||e.length===0))if(t===null||t.length===0)t=e.slice();else{let n=-1;for(let o=0;o<e.length;o++){let i=e[o];typeof i=="number"?n=i:n===0||(n===-1||n===2?Xu(t,n,i,null,e[++o]):Xu(t,n,i,null,null))}}return t}function Xu(t,e,n,o,i){let r=0,s=t.length;if(e===-1)s=-1;else for(;r<t.length;){let a=t[r++];if(typeof a=="number"){if(a===e){s=-1;break}else if(a>e){s=r-1;break}}}for(;r<t.length;){let a=t[r];if(typeof a=="number")break;if(a===n){i!==null&&(t[r+1]=i);return}r++,i!==null&&r++}s!==-1&&(t.splice(s,0,e),r=s+1),t.splice(r++,0,n),i!==null&&t.splice(r++,0,i)}function Rf(t){return t!==qn}function Cr(t){return t&32767}function kv(t){return t>>16}function Ir(t,e){let n=kv(t),o=e;for(;n>0;)o=o[Pt],n--;return o}var mc=!0;function ef(t){let e=mc;return mc=t,e}var Rv=256,Af=Rv-1,Of=5,Av=0,yt={};function Ov(t,e,n){let o;typeof n=="string"?o=n.charCodeAt(0)||0:Object.hasOwn(n,rn)&&(o=n[rn]),o==null&&(o=n[rn]=Av++);let i=o&Af,r=1<<i;e.data[t+(i>>Of)]|=r}function Pf(t,e){let n=Lf(t,e);if(n!==-1)return n;let o=e[$];o.firstCreatePass&&(t.injectorIndex=e.length,cc(o.data,t),cc(e,null),cc(o.blueprint,null));let i=Uc(t,e),r=t.injectorIndex;if(Rf(i)){let s=Cr(i),a=Ir(i,e),c=a[$].data;for(let d=0;d<8;d++)e[r+d]=a[s+d]|c[s+d]}return e[r+8]=i,r}function cc(t,e){t.push(0,0,0,0,0,0,0,0,e)}function Lf(t,e){return t.injectorIndex===-1||t.parent&&t.parent.injectorIndex===t.injectorIndex||e[t.injectorIndex+8]===null?-1:t.injectorIndex}function Uc(t,e){if(t.parent&&t.parent.injectorIndex!==-1)return t.parent.injectorIndex;let n=0,o=null,i=e;for(;i!==null;){if(o=Bf(i),o===null)return qn;if(n++,i=i[Pt],o.injectorIndex!==-1)return o.injectorIndex|n<<16}return qn}function Pv(t,e,n){Ov(t,e,n)}function Ff(t,e,n){if(n&8||t!==void 0)return t;zi(e,"NodeInjector")}function Vf(t,e,n,o){if(n&8&&o===void 0&&(o=null),(n&3)===0){let i=t[Dt],r=Le(void 0);try{return i?i.get(e,o,n&8):Ma(e,o,n&8)}finally{Le(r)}}return Ff(o,e,n)}function jf(t,e,n,o=0,i){if(t!==null){if(e[H]&2048&&!(o&2)){let s=jv(t,e,n,o,yt);if(s!==yt)return s}let r=$f(t,e,n,o,yt);if(r!==yt)return r}return Vf(e,n,o,i)}function $f(t,e,n,o,i){let r=Fv(n);if(typeof r=="function"){if(!Ja(e,t,o))return o&1?Ff(i,n,o):Vf(e,n,o,i);try{let s;if(s=r(o),s==null&&!(o&8))zi(n);else return s}finally{Xa()}}else if(typeof r=="number"){let s=null,a=Lf(t,e),c=qn,d=o&1?e[je][Pe]:null;for((a===-1||o&4)&&(c=a===-1?Uc(t,e):e[a+8],c===qn||!nf(o,!1)?a=-1:(s=e[$],a=Cr(c),e=Ir(c,e)));a!==-1;){let f=e[$];if(tf(r,a,f.data)){let g=Lv(a,e,n,s,o,d);if(g!==yt)return g}c=e[a+8],c!==qn&&nf(o,e[$].data[a+8]===d)&&tf(r,a,e)?(s=f,a=Cr(c),e=Ir(c,e)):a=-1}}return i}function Lv(t,e,n,o,i,r){let s=e[$],a=s.data[t+8],c=o==null?Vt(a)&&mc:o!=s&&(a.type&3)!==0,d=i&1&&r===a,f=_r(a,s,n,c,d);return f!==null?Sr(e,s,f,a,i):yt}function _r(t,e,n,o,i){let r=t.providerIndexes,s=e.data,a=r&1048575,c=t.directiveStart,d=t.directiveEnd,f=r>>20,g=o?a:a+f,C=i?a+f:d;for(let E=g;E<C;E++){let O=s[E];if(E<c&&n===O||E>=c&&O.type===n)return E}if(i){let E=s[c];if(E&&un(E)&&E.type===n)return c}return null}function Sr(t,e,n,o,i){let r=t[n],s=e.data;if(r instanceof Fo){let a=r;if(a.resolving)throw Da("");let c=ef(a.canSeeViewProviders);a.resolving=!0;let d=s[n].type||s[n],f,g=a.injectImpl?Le(a.injectImpl):null,C=Ja(t,o,0);try{r=t[n]=a.factory(void 0,i,s,t,o),e.firstCreatePass&&n>=o.directiveStart&&Cv(n,s[n],e)}finally{g!==null&&Le(g),ef(c),a.resolving=!1,Xa()}}return r}function Fv(t){if(typeof t=="string")return t.charCodeAt(0)||0;let e=Object.hasOwn(t,rn)?t[rn]:void 0;return typeof e=="number"?e>=0?e&Af:Vv:e}function tf(t,e,n){let o=1<<t;return!!(n[e+(t>>Of)]&o)}function nf(t,e){return!(t&2)&&!(t&1&&e)}var Mt=class{_tNode;_lView;constructor(e,n){this._tNode=e,this._lView=n}get(e,n,o){return jf(this._tNode,this._lView,e,nn(o),n)}};function Vv(){return new Mt(Ke(),W())}function jv(t,e,n,o,i){let r=t,s=e;for(;r!==null&&s!==null&&s[H]&2048&&!Bn(s);){let a=$f(r,s,n,o|2,yt);if(a!==yt)return a;o&=-5;let c=r.parent;if(!c){let d=s[La];if(d){let f=d.get(n,yt,o);if(f!==yt)return f}c=Bf(s),s=s[Pt]}r=c}return i}function Bf(t){let e=t[$],n=e.type;return n===2?e.declTNode:n===1?t[Pe]:null}function Fr(t){return{token:t.token,providedIn:t.autoProvided===!1?null:"root",factory:t.factory,value:void 0}}function $v(){return Yn(Ke(),W())}function Yn(t,e){return new qo(rt(t,e))}var qo=(()=>{class t{nativeElement;constructor(n){this.nativeElement=n}static __NG_ELEMENT_ID__=$v}return t})();function Bv(t){return t instanceof qo?t.nativeElement:t}function Hv(){return this._results[Symbol.iterator]()}var wr=class{_emitDistinctChangesOnly;dirty=!0;_onDirty=void 0;_results=[];_changesDetected=!1;_changes=void 0;length=0;first=void 0;last=void 0;get changes(){return this._changes??=new Ge}constructor(e=!1){this._emitDistinctChangesOnly=e}get(e){return this._results[e]}map(e){return this._results.map(e)}filter(e){return this._results.filter(e)}find(e){return this._results.find(e)}reduce(e,n){return this._results.reduce(e,n)}forEach(e){this._results.forEach(e)}some(e){return this._results.some(e)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(e,n){this.dirty=!1;let o=su(e);(this._changesDetected=!ru(this._results,o,n))&&(this._results=o,this.length=o.length,this.last=o[this.length-1],this.first=o[0])}notifyOnChanges(){this._changes!==void 0&&(this._changesDetected||!this._emitDistinctChangesOnly)&&this._changes.next(this)}onDirty(e){this._onDirty=e}setDirty(){this.dirty=!0,this._onDirty?.()}destroy(){this._changes!==void 0&&(this._changes.complete(),this._changes.unsubscribe())}[Symbol.iterator]=Hv};function Hf(t){return(t.flags&128)===128}var Gc=(function(t){return t[t.OnPush=0]="OnPush",t[t.Eager=1]="Eager",t[t.Default=1]="Default",t})(Gc||{}),Uf=new Map,Uv=0;function Gv(){return Uv++}function Wv(t){Uf.set(t[Do],t)}function hc(t){Uf.delete(t[Do])}var of="__ngContext__";function Kn(t,e){Ft(e)?(t[of]=e[Do],Wv(e)):t[of]=e}function Gf(t){return zf(t[$n])}function Wf(t){return zf(t[ze])}function zf(t){for(;t!==null&&!qe(t);)t=t[ze];return t}var gc;function Wc(t){gc=t}function qf(){if(gc!==void 0)return gc;if(typeof document<"u")return document;throw new U(210,!1)}var Kf="r";var Zf="di";var Qf=!1,Yf=new Y("",{factory:()=>Qf});var rf=new WeakMap;function zv(t,e){if(t==null||typeof t!="object")return;let n=rf.get(t);n||(n=new WeakSet,rf.set(t,n)),n.add(e)}var qv=(t,e,n,o)=>{};function Kv(t,e,n,o){qv(t,e,n,o)}function zc(t){return(t.flags&32)===32}var Zv=()=>null;function Jf(t,e,n=!1){return Zv(t,e,n)}function Xf(t,e){let n=t.contentQueries;if(n!==null){let o=V(null);try{for(let i=0;i<n.length;i+=2){let r=n[i],s=n[i+1];if(s!==-1){let a=t.data[s];ar(r),a.contentQueries(2,e[s],s)}}}finally{V(o)}}}function yc(t,e,n){ar(0);let o=V(null);try{e(t,n)}finally{V(o)}}function ep(t,e,n){if(Va(e)){let o=V(null);try{let i=e.directiveStart,r=e.directiveEnd;for(let s=i;s<r;s++){let a=t.data[s];if(a.contentQueries){let c=n[s];a.contentQueries(1,c,s)}}}finally{V(o)}}}var ct=(function(t){return t[t.Emulated=0]="Emulated",t[t.None=2]="None",t[t.ShadowDom=3]="ShadowDom",t[t.ExperimentalIsolatedShadowDom=4]="ExperimentalIsolatedShadowDom",t})(ct||{}),vc=class{changingThisBreaksApplicationSecurity;constructor(e){this.changingThisBreaksApplicationSecurity=e}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity}`}};function Vo(t){return t instanceof vc?t.changingThisBreaksApplicationSecurity:t}var gr;function Qv(){if(gr===void 0&&(gr=null,Co.trustedTypes))try{gr=Co.trustedTypes.createPolicy("angular",{createHTML:t=>t,createScript:t=>t,createScriptURL:t=>t})}catch{}return gr}function Yv(t){return Qv()?.createScriptURL(t)||t}function Jv(t,e){return t.createText(e)}function Xv(t,e,n){t.setValue(e,n)}function tp(t,e,n){return t.createElement(e,n)}function yn(t,e,n,o,i){t.insertBefore(e,n,o,i)}function np(t,e,n){t.appendChild(e,n)}function sf(t,e,n,o,i){o!==null?yn(t,e,n,o,i):np(t,e,n)}function op(t,e,n,o){t.removeChild(null,e,n,o)}function e0(t,e,n){t.setAttribute(e,"style",n)}function t0(t,e,n){n===""?t.removeAttribute(e,"class"):t.setAttribute(e,"class",n)}function ip(t,e,n){let{mergedAttrs:o,classes:i,styles:r}=n;o!==null&&Dv(t,e,o),i!==null&&t0(t,e,i),r!==null&&e0(t,e,r)}function qc(t){return Yv(t[0])}function Kc(t){return t.ownerDocument.defaultView}function Vr(t){return t.ownerDocument}function n0(t,e,n){let o=t.length;for(;;){let i=t.indexOf(e,n);if(i===-1)return i;if(i===0||t.charCodeAt(i-1)<=32){let r=e.length;if(i+r===o||t.charCodeAt(i+r)<=32)return i}n=i+1}}var rp="ng-template";function o0(t,e,n,o){let i=0;if(o){for(;i<e.length&&typeof e[i]=="string";i+=2)if(e[i]==="class"&&n0(e[i+1].toLowerCase(),n,0)!==-1)return!0}else if(Zc(t))return!1;if(i=e.indexOf(1,i),i>-1){let r;for(;++i<e.length&&typeof(r=e[i])=="string";)if(r.toLowerCase()===n)return!0}return!1}function Zc(t){return t.type===4&&t.value!==rp}function i0(t,e,n){let o=t.type===4&&!n?rp:t.value;return e===o}function r0(t,e,n){let o=4,i=t.attrs,r=i!==null?c0(i):0,s=!1;for(let a=0;a<e.length;a++){let c=e[a];if(typeof c=="number"){if(!s&&!st(o)&&!st(c))return!1;if(s&&st(c))continue;s=!1,o=c|o&1;continue}if(!s)if(o&4){if(o=2|o&1,c!==""&&!i0(t,c,n)||c===""&&e.length===1){if(st(o))return!1;s=!0}}else if(o&8){if(i===null||!o0(t,i,c,n)){if(st(o))return!1;s=!0}}else{let d=e[++a],f=s0(c,i,Zc(t),n);if(f===-1){if(st(o))return!1;s=!0;continue}if(d!==""){let g;if(f>r?g="":g=i[f+1].toLowerCase(),o&2&&d!==g){if(st(o))return!1;s=!0}}}}return st(o)||s}function st(t){return(t&1)===0}function s0(t,e,n,o){if(e===null)return-1;let i=0;if(o||!n){let r=!1;for(;i<e.length;){let s=e[i];if(s===t)return i;if(s===3||s===6)r=!0;else if(s===1||s===2){let a=e[++i];for(;typeof a=="string";)a=e[++i];continue}else{if(s===4)break;if(s===0){i+=4;continue}}i+=r?1:2}return-1}else return l0(e,t)}function a0(t,e,n=!1){for(let o=0;o<e.length;o++)if(r0(t,e[o],n))return!0;return!1}function c0(t){for(let e=0;e<t.length;e++){let n=t[e];if(Mv(n))return e}return t.length}function l0(t,e){let n=t.indexOf(4);if(n>-1)for(n++;n<t.length;){let o=t[n];if(typeof o=="number")return-1;if(o===e)return n;n++}return-1}function af(t,e){return t?":not("+e.trim()+")":e}function d0(t){let e=t[0],n=1,o=2,i="",r=!1;for(;n<t.length;){let s=t[n];if(typeof s=="string")if(o&2){let a=t[++n];i+="["+s+(a.length>0?'="'+a+'"':"")+"]"}else o&8?i+="."+s:o&4&&(i+=" "+s);else i!==""&&!st(s)&&(e+=af(r,i),i=""),o=s,r=r||!st(o);n++}return i!==""&&(e+=af(r,i)),e}function u0(t){return t.map(d0).join(",")}function f0(t){let e=[],n=[],o=1,i=2;for(;o<t.length;){let r=t[o];if(typeof r=="string")i===2?r!==""&&e.push(r,t[++o]):i===8&&n.push(r);else{if(!st(i))break;i=r}o++}return n.length&&e.push(1,...n),e}var xe={},Nt=(function(t){return t[t.Important=1]="Important",t[t.DashCase=2]="DashCase",t})(Nt||{}),p0;function Qc(t,e){return p0(t,e)}var Yc=new Set;var OM=typeof document<"u"&&typeof document?.documentElement?.getAnimations=="function";var bc=new WeakMap;function sp(t){return t?t[Pt]??t:null}var Wn=new WeakSet;function m0(t,e,n){let o=bc.get(t);if(!o||o.length===0)return;let i=e.parentNode,r=e.previousSibling,s=sp(n);for(let a=o.length-1;a>=0;a--){let{el:c,declarationView:d}=o[a],f=c.parentNode;c===e?(o.splice(a,1),Wn.add(c),c.dispatchEvent(new CustomEvent("animationend",{detail:{cancel:!0}}))):r&&c===r?(o.splice(a,1),c.dispatchEvent(new CustomEvent("animationend",{detail:{cancel:!0}})),c.parentNode?.removeChild(c)):f&&i&&f!==i&&(s===null||d===null||s===d)&&(o.splice(a,1),c.dispatchEvent(new CustomEvent("animationend",{detail:{cancel:!0}})),c.parentNode?.removeChild(c))}}function h0(t,e,n){let o=sp(n),i=bc.get(t);i?i.some(r=>r.el===e)||i.push({el:e,declarationView:o}):bc.set(t,[{el:e,declarationView:o}])}var jr=(function(t){return t[t.CHANGE_DETECTION=0]="CHANGE_DETECTION",t[t.AFTER_NEXT_RENDER=1]="AFTER_NEXT_RENDER",t})(jr||{}),vt=new Y(""),cf=new Set;function $t(t){cf.has(t)||(cf.add(t),performance?.mark?.("mark_feature_usage",{detail:{feature:t}}))}var $r=(()=>{class t{impl=null;execute(){this.impl?.execute()}static \u0275prov=K({token:t,providedIn:"root",factory:()=>new t})}return t})(),Jc=[0,1,2,3],Xc=(()=>{class t{ngZone=w(Oe);scheduler=w(Tt);errorHandler=w(We,{optional:!0});sequences=new Set;deferredRegistrations=new Set;executing=!1;constructor(){w(vt,{optional:!0})}execute(){let n=this.sequences.size>0;n&&ee(X.AfterRenderHooksStart),this.executing=!0;for(let o of Jc)for(let i of this.sequences)if(!(i.erroredOrDestroyed||!i.hooks[o]))try{i.pipelinedValue=this.ngZone.runOutsideAngular(()=>this.maybeTrace(()=>{let r=i.hooks[o];return r(i.pipelinedValue)},i.snapshot))}catch(r){i.erroredOrDestroyed=!0,this.errorHandler?.handleError(r)}this.executing=!1;for(let o of this.sequences)o.afterRun(),o.once&&(this.sequences.delete(o),o.destroy());for(let o of this.deferredRegistrations)this.sequences.add(o);this.deferredRegistrations.size>0&&this.scheduler.notify(7),this.deferredRegistrations.clear(),n&&ee(X.AfterRenderHooksEnd)}register(n){let{view:o}=n;o!==void 0?((o[cn]??=[]).push(n),pn(o),o[H]|=8192):this.addSequence(n)}addSequence(n){this.executing?this.deferredRegistrations.add(n):this.sequences.add(n),this.scheduler.notify(7)}unregister(n){this.executing&&this.sequences.has(n)?(n.erroredOrDestroyed=!0,n.pipelinedValue=void 0,n.once=!0):(this.sequences.delete(n),this.deferredRegistrations.delete(n))}maybeTrace(n,o){return o?o.run(jr.AFTER_NEXT_RENDER,n):n()}static \u0275prov=K({token:t,providedIn:"root",factory:()=>new t})}return t})(),jo=class{impl;hooks;view;once;snapshot;erroredOrDestroyed=!1;pipelinedValue=void 0;unregisterOnDestroy;constructor(e,n,o,i,r,s=null){this.impl=e,this.hooks=n,this.view=o,this.once=i,this.snapshot=s,this.unregisterOnDestroy=r?.onDestroy(()=>this.destroy())}afterRun(){this.erroredOrDestroyed=!1,this.pipelinedValue=void 0,this.snapshot?.dispose(),this.snapshot=null}destroy(){this.impl.unregister(this),this.unregisterOnDestroy?.();let e=this.view?.[cn];e&&(this.view[cn]=e.filter(n=>n!==this))}};function Bt(t,e){let n=e?.injector??w(Ce);return $t("NgAfterNextRender"),y0(t,n,e,!0)}function g0(t){return t instanceof Function?[void 0,void 0,t,void 0]:[t.earlyRead,t.write,t.mixedReadWrite,t.read]}function y0(t,e,n,o){let i=e.get($r);i.impl??=e.get(Xc);let r=e.get(vt,null,{optional:!0}),s=n?.manualCleanup!==!0?e.get(ge):null,a=e.get(Gn,null,{optional:!0}),c=new jo(i.impl,g0(t),a?.view,o,s,r?.snapshot(null));return i.impl.register(c),c}var _c=null,ap=null;function lf(t,e,n,o){_c?.maybeQueueEnterAnimation(t,e,n,o)}function df(t,e,n,o){_c===null?o(!1):_c.runLeaveAnimationsWithCallback(t,e,n,o)}function v0(t){ap?.initViewDetachAnimations(t)}function b0(t){ap?.clearViewDetachAnimations(t)}function zn(t,e,n,o,i,r,s,a){if(i!=null){let c,d=!1;qe(i)?c=i:Ft(i)&&(d=!0,i=i[it]);let f=Ie(i);t===0&&o!==null?(lf(a,o,r,n),s==null?np(e,o,f):yn(e,o,f,s||null,!0)):t===1&&o!==null?(yn(e,o,f,s||null,!0),m0(r,f,a),Wn.has(f)||lf(a,o,r,n)):t===2?(a?.[mu]?.leave?.has(r.index)&&h0(r,f,a),Wn.delete(f),df(a,r,n,g=>{if(Wn.has(f)){Wn.delete(f);return}op(e,f,d,g)})):t===3&&(Wn.delete(f),df(a,r,n,()=>{e.destroyNode(f)})),c!=null&&R0(e,t,n,c,r,o,s)}}function _0(t,e){cp(t,e),e[it]=null,e[Pe]=null}function E0(t,e,n,o,i,r){o[it]=i,o[Pe]=e,Hr(t,o,n,1,i,r)}function cp(t,e){e[pt].changeDetectionScheduler?.notify(9),Hr(t,e,e[de],2,null,null)}function x0(t){let e=t[$n];if(!e)return lc(t[$],t);for(;e;){let n=null;if(Ft(e))n=e[$n];else{let o=e[fe];o&&(n=o)}if(!n){for(;e&&!e[ze]&&e!==t;)Ft(e)&&lc(e[$],e),e=e[he];e===null&&(e=t),Ft(e)&&lc(e[$],e),n=e&&e[ze]}e=n}}function el(t,e){let n=t[dn],o=n.indexOf(e);n.splice(o,1)}function Br(t,e){if(fn(e))return;let n=e[de];n.destroyNode&&Hr(t,e,n,3,null,null),x0(e)}function lc(t,e){if(fn(e))return;let n=V(null);try{e[H]&=-129,e[H]|=256,e[$e]&&Ot(e[$e]),I0(t,e),C0(t,e),e[$].type===1&&e[de].destroy();let o=e[Lt];if(o!==null&&qe(e[he])){o!==e[he]&&el(o,e);let i=e[mt];i!==null&&i.detachView(t)}hc(e)}finally{V(n)}}function C0(t,e){let n=t.cleanup,o=e[jn];if(n!==null)for(let s=0;s<n.length-1;s+=2)if(typeof n[s]=="string"){let a=n[s+3];a>=0?o[a]():o[-a].unsubscribe(),s+=2}else{let a=o[n[s+1]];n[s].call(a)}o!==null&&(e[jn]=null);let i=e[It];if(i!==null){e[It]=null;for(let s=0;s<i.length;s++){let a=i[s];a()}}let r=e[St];if(r!==null){e[St]=null;for(let s of r)s.destroy()}}function I0(t,e){let n;if(t!=null&&(n=t.destroyHooks)!=null)for(let o=0;o<n.length;o+=2){let i=e[n[o]];if(!(i instanceof Fo)){let r=n[o+1];if(Array.isArray(r))for(let s=0;s<r.length;s+=2){let a=i[r[s]],c=r[s+1];ee(X.LifecycleHookStart,a,c);try{c.call(a)}finally{ee(X.LifecycleHookEnd,a,c)}}else{ee(X.LifecycleHookStart,i,r);try{r.call(i)}finally{ee(X.LifecycleHookEnd,i,r)}}}}}function S0(t,e,n){if(e===null)throw new U(510,!1);return w0(t,e.parent,n)}function w0(t,e,n){let o=e;for(;o!==null&&o.type&168;)e=o,o=e.parent;if(o===null)return n[it];if(Vt(o)){let{encapsulation:i}=t.data[o.directiveStart+o.componentOffset];if(i===ct.None||i===ct.Emulated)return null}return rt(o,n)}function T0(t,e,n){return M0(t,e,n)}function D0(t,e,n){return t.type&40?rt(t,n):null}var M0=D0,uf;function tl(t,e,n,o){let i=S0(t,o,e),r=e[de],s=o.parent||e[Pe],a=T0(s,o,e);if(i!=null)if(Array.isArray(n))for(let c=0;c<n.length;c++)sf(r,i,n[c],a,!1);else sf(r,i,n,a,!1);uf!==void 0&&uf(r,o,e,n,i)}function Po(t,e){if(e!==null){let n=e.type;if(n&3)return rt(e,t);if(n&4)return Ec(-1,t[e.index]);if(n&8){let o=e.child;if(o!==null)return Po(t,o);{let i=t[e.index];return qe(i)?Ec(-1,i):Ie(i)}}else{if(n&128)return Po(t,e.next);if(n&32)return Qc(e,t)()||Ie(t[e.index]);{let o=lp(t,e);if(o!==null){if(Array.isArray(o))return o[0];let i=wt(t[je]);return Po(i,o)}else return Po(t,e.next)}}}return null}function lp(t,e){if(e!==null){let o=t[je][Pe],i=e.projection;return o.projection[i]}return null}function Ec(t,e){let n=fe+t+1;if(n<e.length){let o=e[n],i=o[$].firstChild;if(i!==null)return Po(o,i)}return e[ln]}function nl(t,e,n,o,i,r,s){for(;n!=null;){let a=o[Dt];if(n.type===128){n=n.next;continue}let c=o[n.index],d=n.type;if(s&&e===0&&(c&&Kn(Ie(c),o),n.flags|=2),!zc(n))if(d&8)nl(t,e,n.child,o,i,r,!1),zn(e,t,a,i,c,n,r,o);else if(d&32){let f=Qc(n,o),g;for(;g=f();)zn(e,t,a,i,g,n,r,o);zn(e,t,a,i,c,n,r,o)}else d&16?k0(t,e,o,n,i,r):zn(e,t,a,i,c,n,r,o);n=s?n.projectionNext:n.next}}function Hr(t,e,n,o,i,r){t.type===3?N0(n,o,e,i,r):nl(n,o,t.firstChild,e,i,r,!1)}function N0(t,e,n,o,i){let s=n[$].firstChild,a=s.next,c=Ie(n[s.index]),d=Ie(n[a.index]),f=a.index+1,g=n[f];if(e===1||e===0)o!==null&&(g&&g.hasChildNodes()?yn(t,o,g,i,!0):(yn(t,o,c,i,!0),yn(t,o,d,i,!0)));else if(e===2){if(g||(g=document.createDocumentFragment(),n[f]=g),c&&c.parentNode===g)return;let C=c;for(;C!==null;){let E=C.nextSibling;if(g.appendChild(C),C===d)break;C=E}}}function k0(t,e,n,o,i,r){let s=n[je],c=s[Pe].projection[o.projection];if(Array.isArray(c))for(let d=0;d<c.length;d++){let f=c[d];zn(e,t,n[Dt],i,f,o,r,n)}else{let d=c,f=s[he];Hf(o)&&(d.flags|=128),nl(t,e,d,f,i,r,!0)}}function R0(t,e,n,o,i,r,s){let a=o[ln],c=Ie(o);if(a!==c&&zn(e,t,n,r,a,i,s),(o[H]&4)===0)for(let d=fe;d<o.length;d++){let f=o[d];Hr(f[$],f,t,e,r,a)}}function A0(t,e,n,o,i){if(e)i?t.addClass(n,o):t.removeClass(n,o);else{let r=o.indexOf("-")===-1?void 0:Nt.DashCase;i==null?t.removeStyle(n,o,r):(typeof i=="string"&&i.endsWith("!important")&&(i=i.slice(0,-10),r|=Nt.Important),t.setStyle(n,o,i,r))}}function ol(t,e,n,o,i,r,s,a,c,d,f){let g=ye+o,C=g+i,E=O0(g,C),O=typeof d=="function"?d():d;return E[$]={type:t,blueprint:E,template:n,queries:null,viewQuery:a,declTNode:e,data:E.slice().fill(null,g),bindingStartIndex:g,expandoStartIndex:C,hostBindingOpCodes:null,firstCreatePass:!0,firstUpdatePass:!0,staticViewQueries:!1,staticContentQueries:!1,preOrderHooks:null,preOrderCheckHooks:null,contentHooks:null,contentCheckHooks:null,viewHooks:null,viewCheckHooks:null,destroyHooks:null,cleanup:null,contentQueries:null,components:null,directiveRegistry:typeof r=="function"?r():r,pipeRegistry:typeof s=="function"?s():s,firstChild:null,schemas:c,consts:O,incompleteFirstPass:!1,ssrId:f}}function O0(t,e){let n=[];for(let o=0;o<e;o++)n.push(o<t?null:xe);return n}function P0(t){let e=t.tView;return e===null||e.incompleteFirstPass?t.tView=ol(1,null,t.template,t.decls,t.vars,t.directiveDefs,t.pipeDefs,t.viewQuery,t.schemas,t.consts,t.id):e}function il(t,e,n,o,i,r,s,a,c,d,f){let g=e.blueprint.slice();return g[it]=i,g[H]=o|4|128|8|64|1024,(d!==null||t&&t[H]&2048)&&(g[H]|=2048),Ba(g),g[he]=g[Pt]=t,g[ue]=n,g[pt]=s||t&&t[pt],g[de]=a||t&&t[de],g[Dt]=c||t&&t[Dt]||null,g[Pe]=r,g[Do]=Gv(),g[Vn]=f,g[La]=d,g[je]=e.type==2?t[je]:g,g}function L0(t,e,n){let o=rt(e,t),i=P0(n),r=t[pt].rendererFactory,s=rl(t,il(t,i,null,dp(n),o,e,null,r.createRenderer(o,n),null,null,null));return t[e.index]=s}function dp(t){let e=16;return t.signals?e=4096:t.onPush&&(e=64),e}function up(t,e,n,o){if(n===0)return-1;let i=e.length;for(let r=0;r<n;r++)e.push(o),t.blueprint.push(o),t.data.push(null);return i}function rl(t,e){return t[$n]?t[Pa][ze]=e:t[$n]=e,t[Pa]=e,e}function l(t=1){fp(Se(),W(),Be()+t,!1)}function fp(t,e,n,o){if(!o)if((e[H]&3)===3){let r=t.preOrderCheckHooks;r!==null&&vr(e,r,n)}else{let r=t.preOrderHooks;r!==null&&br(e,r,0,n)}jt(n)}var Ur=(function(t){return t[t.None=0]="None",t[t.SignalBased=1]="SignalBased",t[t.HasDecoratorInputTransform=2]="HasDecoratorInputTransform",t})(Ur||{});function xc(t,e,n,o){let i=V(null);try{let[r,s,a]=t.inputs[n],c=null;(s&Ur.SignalBased)!==0&&(c=e[r][Ee]),c!==null&&c.transformFn!==void 0?o=c.transformFn(o):a!==null&&(o=a.call(e,o)),t.setInput!==null?t.setInput(e,c,o,n,r):_v(e,c,r,o)}finally{V(i)}}function pp(t,e,n,o,i){let r=Be(),s=o&2;try{jt(-1),s&&e.length>ye&&fp(t,e,ye,!1);let a=s?X.TemplateUpdateStart:X.TemplateCreateStart;ee(a,i,n),n(o,i)}finally{jt(r);let a=s?X.TemplateUpdateEnd:X.TemplateCreateEnd;ee(a,i,n)}}function mp(t,e,n){U0(t,e,n),(n.flags&64)===64&&G0(t,e,n)}function sl(t,e,n=rt){let o=e.localNames;if(o!==null){let i=e.index+1;for(let r=0;r<o.length;r+=2){let s=o[r+1],a=s===-1?n(e,t):t[s];t[i++]=a}}}function F0(t,e,n,o){let r=o.get(Yf,Qf)||n===ct.ShadowDom||n===ct.ExperimentalIsolatedShadowDom,s=t.selectRootElement(e,r);return V0(s),s}function V0(t){j0(t)}var j0=()=>null;function $0(t){return t==="class"?"className":t==="for"?"htmlFor":t==="formaction"?"formAction":t==="innerHtml"?"innerHTML":t==="readonly"?"readOnly":t==="tabindex"?"tabIndex":t}function B0(t,e,n,o,i,r){let s=e[$];if(al(t,s,e,n,o)){Vt(t)&&H0(e,t.index);return}t.type&3&&(n=$0(n)),hp(t,e,n,o,i,r)}function hp(t,e,n,o,i,r){if(t.type&3){let s=rt(t,e);o=r!=null?r(o,t.value||"",n):o,o=gp(n,s,o),i.setProperty(s,n,o)}else t.type&12}function gp(t,e,n,o=!1){return t==="src"&&(e.tagName==="IMG"||e.tagName==="VIDEO")?n==null?o?n:"":Vo(n):n}function H0(t,e){let n=ht(e,t);n[H]&16||(n[H]|=64)}function U0(t,e,n){let o=n.directiveStart,i=n.directiveEnd;Vt(n)&&L0(e,n,t.data[o+n.componentOffset]),t.firstCreatePass||Pf(n,e);let r=n.initialInputs;for(let s=o;s<i;s++){let a=t.data[s],c=Sr(e,t,s,n);if(Kn(c,e),r!==null&&Z0(e,s-o,c,a,n,r),un(a)){let d=ht(n.index,e);d[ue]=Sr(e,t,s,n)}}}function G0(t,e,n){let o=n.directiveStart,i=n.directiveEnd,r=n.index,s=Ru();try{jt(r);for(let a=o;a<i;a++){let c=t.data[a],d=e[a];sr(a),(c.hostBindings!==null||c.hostVars!==0||c.hostAttrs!==null)&&W0(c,d)}}finally{jt(-1),sr(s)}}function W0(t,e){t.hostBindings!==null&&t.hostBindings(1,e)}function z0(t,e){let n=t.directiveRegistry,o=null;if(n)for(let i=0;i<n.length;i++){let r=n[i];a0(e,r.selectors,!1)&&(o??=[],un(r)?o.unshift(r):o.push(r))}return o}function q0(t,e,n,o,i,r){let s=rt(t,e);o=gp(n,s,o,!0),K0(e[de],s,r,t.value,n,o,i)}function K0(t,e,n,o,i,r,s){if(r==null)s?.(r,o||"",i),t.removeAttribute(e,i,n);else{let a=s==null?Ve(r):s(r,o||"",i);t.setAttribute(e,i,a,n)}}function Z0(t,e,n,o,i,r){let s=r[e];if(s!==null)for(let a=0;a<s.length;a+=2){let c=s[a],d=s[a+1];xc(o,n,c,d)}}function yp(t,e,n,o,i){let r=ye+n,s=e[$],a=i(s,e,t,o,n);e[r]=a,mn(t,!0);let c=t.type===2;return c?(ip(e[de],a,t),(xu()===0||Xi(t))&&Kn(a,e),Cu()):Kn(a,e),ur()&&(!c||!zc(t))&&tl(s,e,a,t),t}function vp(t){let e=t;return Za()?Tu():(e=e.parent,mn(e,!1)),e}function Q0(t,e){let n=t[Dt];if(!n)return;let o;try{o=n.get(gn,null)}catch{o=null}o?.(e)}function al(t,e,n,o,i){let r=t.inputs?.[o],s=t.hostDirectiveInputs?.[o],a=!1;if(s)for(let c=0;c<s.length;c+=2){let d=s[c],f=s[c+1],g=e.data[d];xc(g,n[d],f,i),a=!0}if(r)for(let c of r){let d=n[c],f=e.data[c];xc(f,d,o,i),a=!0}return a}function Y0(t,e){let n=ht(e,t),o=n[$];J0(o,n);let i=n[it];i!==null&&n[Vn]===null&&(n[Vn]=Jf(i,n[Dt])),ee(X.ComponentStart);try{cl(o,n,n[ue])}finally{ee(X.ComponentEnd,n[ue])}}function J0(t,e){for(let n=e.length;n<t.blueprint.length;n++)e.push(t.blueprint[n])}function cl(t,e,n){cr(e);try{let o=t.viewQuery;o!==null&&yc(1,o,n);let i=t.template;i!==null&&pp(t,e,i,1,n),t.firstCreatePass&&(t.firstCreatePass=!1),e[mt]?.finishViewCreation(t),t.staticContentQueries&&Xf(t,e),t.staticViewQueries&&yc(2,t.viewQuery,n);let r=t.components;r!==null&&X0(e,r)}catch(o){throw t.firstCreatePass&&(t.incompleteFirstPass=!0,t.firstCreatePass=!1),o}finally{e[H]&=-5,lr()}}function X0(t,e){for(let n=0;n<e.length;n++)Y0(t,e[n])}function Gr(t,e,n,o){let i=V(null);try{let r=e.tView,a=t[H]&4096?4096:16,c=il(t,r,n,a,null,e,null,null,o?.injector??null,o?.embeddedViewInjector??null,o?.dehydratedView??null),d=t[e.index];c[Lt]=d;let f=t[mt];return f!==null&&(c[mt]=f.createEmbeddedView(r)),cl(r,c,n),c}finally{V(i)}}function $o(t,e){return!e||e.firstChild===null||Hf(t)}function Bo(t,e,n,o,i=!1){if(t.type===3){let r=t.firstChild,s=r.next,a=Ie(e[r.index]),c=Ie(e[s.index]),d=a;for(;d!==null&&(o.push(d),d!==c);)d=d.nextSibling;return o}for(;n!==null;){if(n.type===128){n=i?n.projectionNext:n.next;continue}let r=e[n.index];if(r!==null)if(qe(r)){let a=r[ln];a!==r[it]&&o.push(Ie(r)),r[H]&4||bp(r,o),o.push(a)}else o.push(Ie(r));let s=n.type;if(s&8)Bo(t,e,n.child,o);else if(s&32){let a=Qc(n,e),c;for(;c=a();)o.push(c)}else if(s&16){let a=lp(e,n);if(Array.isArray(a))o.push(...a);else{let c=wt(e[je]);Bo(c[$],c,a,o,!0)}}n=i?n.projectionNext:n.next}return o}function bp(t,e){for(let n=fe;n<t.length;n++){let o=t[n],i=o[$].firstChild;i!==null&&Bo(o[$],o,i,e)}}function _p(t){if(t[cn]!==null){for(let e of t[cn])e.impl.addSequence(e);t[cn].length=0}}var Ep=[];function eb(t){return t[$e]??tb(t)}function tb(t){let e=Ep.pop()??Object.create(ob);return e.lView=t,e}function nb(t){t.lView[$e]!==t&&(t.lView=null,Ep.push(t))}var ob=x(y({},Qt),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:t=>{pn(t.lView)},consumerOnSignalRead(){this.lView[$e]=this}});function ib(t){let e=t[$e]??Object.create(rb);return e.lView=t,e}var rb=x(y({},Qt),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:t=>{let e=wt(t.lView);for(;e&&!xp(e[$]);)e=wt(e);e&&Ha(e)},consumerOnSignalRead(){this.lView[$e]=this}});function xp(t){return t.type!==2}function Cp(t){if(t[St]===null)return;let e=!0;for(;e;){let n=!1;for(let o of t[St])if(o.dirty&&(n=!0,o.zone===null||Zone.current===o.zone?o.run():o.zone.run(()=>o.run()),t[St]===null))return;e=n&&!!(t[H]&8192)}}var sb=100;function Ip(t,e=0){let o=t[pt].rendererFactory,i=!1;i||o.begin?.();try{ab(t,e)}finally{i||o.end?.()}}function ab(t,e){let n=Ya();try{bo(!0),Cc(t,e);let o=0;for(;ko(t);){if(o===sb)throw new U(103,!1);o++,Cc(t,1)}}finally{bo(n)}}function cb(t,e,n,o){if(fn(e))return;let i=e[H],r=!1,s=!1;cr(e);let a=!0,c=null,d=null;r||(xp(t)?(d=eb(e),c=At(d)):Ii()===null?(a=!1,d=ib(e),c=At(d)):e[$e]&&(Ot(e[$e]),e[$e]=null));try{Ba(e),Mu(t.bindingStartIndex),n!==null&&pp(t,e,n,2,o);let f=(i&3)===3;if(!r)if(f){let E=t.preOrderCheckHooks;E!==null&&vr(e,E,null)}else{let E=t.preOrderHooks;E!==null&&br(e,E,0,null),ac(e,0)}if(s||lb(e),Cp(e),wp(e,0),t.contentQueries!==null&&Xf(t,e),!r)if(f){let E=t.contentCheckHooks;E!==null&&vr(e,E)}else{let E=t.contentHooks;E!==null&&br(e,E,1),ac(e,1)}ub(t,e);let g=t.components;g!==null&&Dp(e,g,0);let C=t.viewQuery;if(C!==null&&yc(2,C,o),!r)if(f){let E=t.viewCheckHooks;E!==null&&vr(e,E)}else{let E=t.viewHooks;E!==null&&br(e,E,2),ac(e,2)}if(t.firstUpdatePass===!0&&(t.firstUpdatePass=!1),e[Ji]){for(let E of e[Ji])E();e[Ji]=null}r||(_p(e),e[H]&=-73)}catch(f){Sp(e,f,r)}finally{d!==null&&(Yt(d,c),a&&nb(d)),lr()}}function Sp(t,e,n){let o=!1,i=e,r=t,s=V(null);try{for(;r!==null;){if(qe(r)){r=r[he];continue}let a=r[Mo];if(a)try{let c=t[je][ue],d=c?.constructor,f={declarationInstance:c,declarationType:d,caughtBy:a},g=V(null);try{a(Wu(i),f)}finally{V(g)}o=!0;break}catch(c){i=c}r=r[he]}}finally{V(s)}if(!o)throw n||pn(t),i}function wp(t,e){for(let n=Gf(t);n!==null;n=Wf(n))for(let o=fe;o<n.length;o++){let i=n[o];Tp(i,e)}}function lb(t){for(let e=Gf(t);e!==null;e=Wf(e)){if(!(e[H]&2))continue;let n=e[dn];for(let o=0;o<n.length;o++){let i=n[o];Ha(i)}}}function db(t,e,n){ee(X.ComponentStart);let o=ht(e,t);try{Tp(o,n)}finally{ee(X.ComponentEnd,o[ue])}}function Tp(t,e){nr(t)&&Cc(t,e)}function Cc(t,e){let o=t[$],i=t[H],r=t[$e],s=!!(e===0&&i&16);if(s||=!!(i&64&&e===0),s||=!!(i&1024),s||=!!(r?.dirty&&wn(r)),s||=!1,r&&(r.dirty=!1),t[H]&=-9217,s)cb(o,t,o.template,t[ue]);else if(i&8192){let a=V(null);try{try{Cp(t)}catch(d){Sp(t,d,!1)}wp(t,1);let c=o.components;c!==null&&Dp(t,c,1),_p(t)}finally{V(a)}}}function Dp(t,e,n){for(let o=0;o<e.length;o++)db(t,e[o],n)}function ub(t,e){let n=t.hostBindingOpCodes;if(n!==null)try{for(let o=0;o<n.length;o++){let i=n[o];if(i<0)jt(~i);else{let r=i,s=n[++o],a=n[++o];ku(s,r);let c=e[r];ee(X.HostBindingsUpdateStart,c);try{a(2,c)}finally{ee(X.HostBindingsUpdateEnd,c)}}}}finally{jt(-1)}}function ll(t,e){let n=Ya()?64:1088;for(t[pt].changeDetectionScheduler?.notify(e);t;){t[H]|=n;let o=wt(t);if(Bn(t)&&!o)return t;t=o}return null}function Mp(t,e,n,o){return[t,!0,0,e,null,o,null,n,null,null]}function Np(t,e){let n=fe+e;if(n<t.length)return t[n]}function Wr(t,e,n,o=!0){let i=e[$];if(fb(i,e,t,n),o){let s=Ec(n,t),a=e[de],c=a.parentNode(t[ln]);c!==null&&E0(i,t[Pe],a,e,c,s)}let r=e[Vn];r!==null&&r.firstChild!==null&&(r.firstChild=null)}function kp(t,e){let n=Ho(t,e);return n!==void 0&&Br(n[$],n),n}function Ho(t,e){if(t.length<=fe)return;let n=fe+e,o=t[n];if(o){let i=o[Lt];i!==null&&i!==t&&el(i,o),e>0&&(t[n-1][ze]=o[ze]);let r=Io(t,fe+e);_0(o[$],o);let s=r[mt];s!==null&&s.detachView(r[$]),o[he]=null,o[ze]=null,o[H]&=-129}return o}function fb(t,e,n,o){let i=fe+o,r=n.length;o>0&&(n[i-1][ze]=e),o<r-fe?(e[ze]=n[i],Na(n,fe+o,e)):(n.push(e),e[ze]=null),e[he]=n;let s=e[Lt];s!==null&&n!==s&&Rp(s,e);let a=e[mt];a!==null&&a.insertView(t),or(e),e[H]|=128}function Rp(t,e){let n=t[dn],o=e[he];if(Ft(o))t[H]|=2;else{let i=o[he][je];e[je]!==i&&(t[H]|=2)}n===null?t[dn]=[e]:n.push(e)}var Zn=class{_lView;_cdRefInjectingView;_appRef=null;_attachedToViewContainer=!1;exhaustive;get rootNodes(){let e=this._lView,n=e[$];return Bo(n,e,n.firstChild,[])}constructor(e,n){this._lView=e,this._cdRefInjectingView=n}get context(){return this._lView[ue]}set context(e){this._lView[ue]=e}get destroyed(){return fn(this._lView)}destroy(){if(this._appRef)this._appRef.detachView(this);else if(this._attachedToViewContainer){let e=this._lView[he];if(qe(e)){let n=e[No],o=n?n.indexOf(this):-1;o>-1&&(Ho(e,o),Io(n,o))}this._attachedToViewContainer=!1}Br(this._lView[$],this._lView)}onDestroy(e){ir(this._lView,e)}markForCheck(){ll(this._cdRefInjectingView||this._lView,4)}detach(){this._lView[H]&=-129}reattach(){or(this._lView),this._lView[H]|=128}detectChanges(){this._lView[H]|=1024,Ip(this._lView)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new U(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null;let e=Bn(this._lView),n=this._lView[Lt];n!==null&&!e&&el(n,this._lView),cp(this._lView[$],this._lView)}attachToAppRef(e){if(this._attachedToViewContainer)throw new U(902,!1);this._appRef=e;let n=Bn(this._lView),o=this._lView[Lt];o!==null&&!n&&Rp(o,this._lView),or(this._lView)}};var Uo=(()=>{class t{_declarationLView;_declarationTContainer;elementRef;static __NG_ELEMENT_ID__=pb;constructor(n,o,i){this._declarationLView=n,this._declarationTContainer=o,this.elementRef=i}get ssrId(){return this._declarationTContainer.tView?.ssrId||null}createEmbeddedView(n,o){return this.createEmbeddedViewImpl(n,o)}createEmbeddedViewImpl(n,o,i){let r=Gr(this._declarationLView,this._declarationTContainer,n,{embeddedViewInjector:o,dehydratedView:i});return new Zn(r)}}return t})();function pb(){return dl(Ke(),W())}function dl(t,e){return t.type&4?new Uo(e,t,Yn(t,e)):null}function Ko(t,e,n,o,i){let r=t.data[e];if(r===null)r=mb(t,e,n,o,i),Nu()&&(r.flags|=32);else if(r.type&64){r.type=n,r.value=o,r.attrs=i;let s=wu();r.injectorIndex=s===null?-1:s.injectorIndex}return mn(r,!0),r}function mb(t,e,n,o,i){let r=Ka(),s=Za(),a=s?r:r&&r.parent,c=t.data[e]=gb(t,a,n,e,o,i);return hb(t,c,r,s),c}function hb(t,e,n,o){t.firstChild===null&&(t.firstChild=e),n!==null&&(o?n.child==null&&e.parent!==null&&(n.child=e):n.next===null&&(n.next=e,e.prev=n))}function gb(t,e,n,o,i,r){let s=e?e.injectorIndex:-1,a=0;return Su()&&(a|=128),{type:n,index:o,insertBeforeIndex:null,injectorIndex:s,directiveStart:-1,directiveEnd:-1,directiveStylingLast:-1,componentOffset:-1,controlDirectiveIndex:-1,customControlIndex:-1,propertyBindings:null,flags:a,providerIndexes:0,value:i,namespace:ec(),attrs:r,mergedAttrs:null,localNames:null,initialInputs:null,inputs:null,hostDirectiveInputs:null,outputs:null,hostDirectiveOutputs:null,directiveToIndex:null,tView:null,next:null,prev:null,projectionNext:null,child:null,parent:e,projection:null,styles:null,stylesWithoutHost:null,residualStyles:void 0,classes:null,classesWithoutHost:null,residualClasses:void 0,classBindings:0,styleBindings:0}}function yb(t){let e=t[Fa]??[],o=t[he][de],i=[];for(let r of e)r.data[Zf]!==void 0?i.push(r):vb(r,o);t[Fa]=i}function vb(t,e){let n=0,o=t.firstChild;if(o){let i=t.data[Kf];for(;n<i;){let r=o.nextSibling;op(e,o,!1),o=r,n++}}}var bb=()=>null,_b=()=>null;function Ic(t,e){return bb(t,e)}function Ap(t,e,n){return _b(t,e,n)}var Op=class{},vn=class{};var Pp=(()=>{class t{static \u0275prov=K({token:t,providedIn:"root",factory:()=>null})}return t})();function Lp(t){return t.debugInfo?.className||t.type.name||null}var Er={},Tr=class{injector;parentInjector;constructor(e,n){this.injector=e,this.parentInjector=n}get(e,n,o){let i=this.injector.get(e,Er,o);return i!==Er||n===Er?i:this.parentInjector.get(e,n,o)}};function Eb(t,e,n){return t[e]=n}function xb(t,e){return t[e]}function Ze(t,e,n){if(n===xe)return!1;let o=t[e];return Object.is(o,n)?!1:(t[e]=n,!0)}function Dr(t,e,n,o){let i=Ze(t,e,n);return Ze(t,e+1,o)||i}function Cb(t,e,n,o,i){let r=Dr(t,e,n,o);return Ze(t,e+2,i)||r}function Ib(t,e,n,o,i,r){let s=Dr(t,e,n,o);return Dr(t,e+2,i,r)||s}function xr(t,e,n){return function o(i){let r=o.__ngNativeEl__;r!==void 0&&zv(i,r);let s=Vt(t)?ht(t.index,e):e;ll(s,5);let a=e[ue],c=ff(e,a,n,i),d=o.__ngNextListenerFn__;for(;d;)c=ff(e,a,d,i)&&c,d=d.__ngNextListenerFn__;return c}}function ff(t,e,n,o){let i=V(null);try{return ee(X.OutputStart,e,n),n(o)!==!1}catch(r){return Q0(t,r),!1}finally{ee(X.OutputEnd,e,n),V(i)}}function Fp(t,e,n,o,i,r,s,a){let c=Xi(t),d=!1,f=null;if(!o&&c&&(f=wb(e,n,r,t.index)),f!==null){let g=f.__ngLastListenerFn__||f;g.__ngNextListenerFn__=s,f.__ngLastListenerFn__=s,d=!0}else{let g=rt(t,n),C=o?o(g):g;Kv(n,C,r,a),o||(a.__ngNativeEl__=g);let E=i.listen(C,r,a);if(!Sb(r)){let O=o?Z=>o(Ie(Z[t.index])):t.index;Vp(O,e,n,r,a,E,!1)}}return d}function Sb(t){return t.startsWith("animation")||t.startsWith("transition")}function wb(t,e,n,o){let i=t.cleanup;if(i!=null)for(let r=0;r<i.length-1;r+=2){let s=i[r];if(s===n&&i[r+1]===o){let a=e[jn],c=i[r+2];return a&&a.length>c?a[c]:null}typeof s=="string"&&(r+=2)}return null}function Vp(t,e,n,o,i,r,s){let a=e.firstCreatePass?Ga(e):null,c=Ua(n),d=c.length;c.push(i,r),a&&a.push(o,t,d,(d+1)*(s?-1:1))}function pf(t,e,n,o,i,r){let s=e[n],a=e[$],d=a.data[n].outputs[o],g=s[d].subscribe(r);Vp(t.index,a,e,i,r,g,!0)}var Sc=Symbol("BINDING");var _n=new Y("");function Mr(t,e,n){let o=n?t.styles:null,i=n?t.classes:null,r=0;if(e!==null)for(let s=0;s<e.length;s++){let a=e[s];if(typeof a=="number")r=a;else if(r==1)i=Bi(i,a);else if(r==2){let c=a,d=e[++s];o=Bi(o,c+": "+d+";")}}n?t.styles=o:t.stylesWithoutHost=o,n?t.classes=i:t.classesWithoutHost=i}function jp(t,e=0){let n=W();if(n===null)return te(t,e);let o=Ke();return jf(o,n,Fe(t),e)}function Tb(t,e,n,o,i){let r=o===null?null:{"":-1},s=i(t,n);if(s!==null){let a=s,c=null,d=null;for(let f of s)if(f.resolveHostDirectives!==null){[a,c,d]=f.resolveHostDirectives(s);break}Nb(t,e,n,a,r,c,d)}r!==null&&o!==null&&Db(n,o,r)}function Db(t,e,n){let o=t.localNames=[];for(let i=0;i<e.length;i+=2){let r=n[e[i+1]];if(r==null)throw new U(-301,!1);o.push(e[i],r)}}function Mb(t,e,n){e.componentOffset=n,(t.components??=[]).push(e.index)}function Nb(t,e,n,o,i,r,s){let a=o.length,c=null;for(let C=0;C<a;C++){let E=o[C];c===null&&un(E)&&(c=E,Mb(t,n,C)),Pv(Pf(n,e),t,E.type)}Lb(n,t.data.length,a),c?.viewProvidersResolver&&c.viewProvidersResolver(c);for(let C=0;C<a;C++){let E=o[C];E.providersResolver&&E.providersResolver(E)}let d=!1,f=!1,g=up(t,e,a,null);a>0&&(n.directiveToIndex=new Map);for(let C=0;C<a;C++){let E=o[C];if(n.mergedAttrs=Lr(n.mergedAttrs,E.hostAttrs),Rb(t,n,e,g,E),Pb(g,E,i),s!==null&&s.has(E)){let[Z,Q]=s.get(E);n.directiveToIndex.set(E.type,[g,Z+n.directiveStart,Q+n.directiveStart])}else(r===null||!r.has(E))&&n.directiveToIndex.set(E.type,g);E.contentQueries!==null&&(n.flags|=4),(E.hostBindings!==null||E.hostAttrs!==null||E.hostVars!==0)&&(n.flags|=64);let O=E.type.prototype;!d&&(O.ngOnChanges||O.ngOnInit||O.ngDoCheck)&&((t.preOrderHooks??=[]).push(n.index),d=!0),!f&&(O.ngOnChanges||O.ngDoCheck)&&((t.preOrderCheckHooks??=[]).push(n.index),f=!0),g++}kb(t,n,r)}function kb(t,e,n){for(let o=e.directiveStart;o<e.directiveEnd;o++){let i=t.data[o];if(n===null||!n.has(i))mf(0,e,i,o),mf(1,e,i,o),gf(e,o,!1);else{let r=n.get(i);hf(0,e,r,o),hf(1,e,r,o),gf(e,o,!0)}}}function mf(t,e,n,o){let i=t===0?n.inputs:n.outputs;for(let r in i)if(Object.hasOwn(i,r)){let s;t===0?s=e.inputs??={}:s=e.outputs??={},s[r]??=[],s[r].push(o),$p(e,r)}}function hf(t,e,n,o){let i=t===0?n.inputs:n.outputs;for(let r in i)if(Object.hasOwn(i,r)){let s=i[r],a;t===0?a=e.hostDirectiveInputs??={}:a=e.hostDirectiveOutputs??={},a[s]??=[],a[s].push(o,r),$p(e,s)}}function $p(t,e){e==="class"?t.flags|=8:e==="style"&&(t.flags|=16)}function gf(t,e,n){let{attrs:o,inputs:i,hostDirectiveInputs:r}=t;if(o===null||!n&&i===null||n&&r===null||Zc(t)){t.initialInputs??=[],t.initialInputs.push(null);return}let s=null,a=0;for(;a<o.length;){let c=o[a];if(c===0){a+=4;continue}else if(c===5){a+=2;continue}else if(typeof c=="number")break;if(!n&&Object.hasOwn(i,c)){let d=i[c];for(let f of d)if(f===e){s??=[],s.push(c,o[a+1]);break}}else if(n&&Object.hasOwn(r,c)){let d=r[c];for(let f=0;f<d.length;f+=2)if(d[f]===e){s??=[],s.push(d[f+1],o[a+1]);break}}a+=2}t.initialInputs??=[],t.initialInputs.push(s)}function Rb(t,e,n,o,i){t.data[o]=i;let r=i.factory||(i.factory=On(i.type,!0)),s=new Fo(r,un(i),jp,null);t.blueprint[o]=s,n[o]=s,Ab(t,e,o,up(t,n,i.hostVars,xe),i)}function Ab(t,e,n,o,i){let r=i.hostBindings;if(r){let s=t.hostBindingOpCodes;s===null&&(s=t.hostBindingOpCodes=[]);let a=~e.index;Ob(s)!=a&&s.push(a),s.push(n,o,r)}}function Ob(t){let e=t.length;for(;e>0;){let n=t[--e];if(typeof n=="number"&&n<0)return n}return 0}function Pb(t,e,n){if(n){if(e.exportAs)for(let o=0;o<e.exportAs.length;o++)n[e.exportAs[o]]=t;un(e)&&(n[""]=t)}}function Lb(t,e,n){t.flags|=1,t.directiveStart=e,t.directiveEnd=e+n,t.providerIndexes=e}function Bp(t,e,n,o,i,r,s,a){let c=e[$],d=c.consts,f=gt(d,s),g=Ko(c,t,n,o,f);return r&&Tb(c,e,g,gt(d,a),i),g.mergedAttrs=Lr(g.mergedAttrs,g.attrs),g.attrs!==null&&Mr(g,g.attrs,!1),g.mergedAttrs!==null&&Mr(g,g.mergedAttrs,!0),c.queries!==null&&c.queries.elementStart(c,g),g}function Hp(t,e){Iv(t,e),Va(e)&&t.queries.elementEnd(e)}function Fb(t,e,n,o,i,r){let s=e.consts,a=gt(s,i),c=Ko(e,t,n,o,a);if(c.mergedAttrs=Lr(c.mergedAttrs,c.attrs),r!=null){let d=gt(s,r);c.localNames=[];for(let f=0;f<d.length;f+=2)c.localNames.push(d[f],-1)}return c.attrs!==null&&Mr(c,c.attrs,!1),c.mergedAttrs!==null&&Mr(c,c.mergedAttrs,!0),e.queries!==null&&e.queries.elementStart(e,c),c}var Up=typeof ShadowRoot<"u",Vb=typeof Document<"u";function jb(t){return Object.keys(t).map(e=>{let[n,o,i]=t[e],r={propName:n,templateName:e,isSignal:(o&Ur.SignalBased)!==0};return i&&(r.transform=i),r})}function $b(t){return Object.keys(t).map(e=>({propName:t[e],templateName:e}))}function Bb(t,e,n){let o=e instanceof ot?e:e?.injector;return o&&t.getStandaloneInjector!==null&&(o=t.getStandaloneInjector(o)||o),o?new Tr(n,o):n}function Hb(t){let e=t.get(vn,null);if(e===null)throw new U(407,!1);let n=t.get(Pp,null),o=t.get(Tt,null),i=t.get(vt,null,{optional:!0});return{rendererFactory:e,sanitizer:n,changeDetectionScheduler:o,ngReflect:!1,tracingService:i}}function Ub(t,e,n){let o=Gp(t);return tp(e,o,o==="svg"?gu:o==="math"?yu:n)}function Gb(t){if((t&&"localName"in t&&typeof t.localName=="string"?t.localName:t?.tagName)?.toLowerCase()==="script")throw new U(905,!1)}function Gp(t){return(t.selectors[0][0]||"div").toLowerCase()}var Go=class{componentDef;ngModule;selector;componentType;ngContentSelectors;isBoundToModule;cachedInputs=null;cachedOutputs=null;get inputs(){return this.cachedInputs??=jb(this.componentDef.inputs),this.cachedInputs}get outputs(){return this.cachedOutputs??=$b(this.componentDef.outputs),this.cachedOutputs}constructor(e,n){this.componentDef=e,this.ngModule=n,this.componentType=e.type,this.selector=u0(e.selectors),this.ngContentSelectors=e.ngContentSelectors??[],this.isBoundToModule=!!n}create(e,n,o,i,r,s,a,c){ee(X.DynamicComponentStart);let d=V(null);try{let f=this.componentDef,g=Bb(f,i||this.ngModule,e),C=Hb(g),E=C.tracingService;return E&&E.componentCreate?E.componentCreate(Lp(f),()=>this.createComponentRef(C,g,n,o,r,s,a,c)):this.createComponentRef(C,g,n,o,r,s,a,c)}finally{V(d)}}createComponentRef(e,n,o,i,r,s,a,c){let d=this.componentDef,f=Wb(i,d,s,r,c),g=e.rendererFactory.createRenderer(null,d),C=i?F0(g,i,d.encapsulation,n):Ub(d,g,a??null);Gb(C);let E=n.get(_n,null),O=zb(C,()=>n.get(Ne,null)??qf());E&&E.addHost(O);let Z=s?.some(yf)||r?.some(re=>typeof re!="function"&&re.bindings.some(yf)),Q=il(null,f,null,512|dp(d),null,null,e,g,n,null,Jf(C,n,!0));E&&Up&&O instanceof ShadowRoot&&ir(Q,()=>{E.removeHost(O)}),Q[ye]=C,cr(Q);let ve=null;try{let re=Bp(ye,Q,2,"#host",()=>f.directiveRegistry,!0,0);ip(g,C,re),Kn(C,Q),mp(f,Q,re),ep(f,re,Q),Hp(f,re),o!==void 0&&Kb(re,this.ngContentSelectors,o),ve=ht(re.index,Q),Q[ue]=ve[ue],cl(f,Q,null)}catch(re){throw ve!==null&&hc(ve),hc(Q),re}finally{ee(X.DynamicComponentEnd),lr()}return new Nr(this.componentType,Q,!!Z)}};function Wb(t,e,n,o,i){let r=t?["ng-version","22.2.5"]:f0(e.selectors[0]),s=null,a=null,c=0;if(n)for(let g of n)c+=g[Sc].requiredVars,g.create&&(g.targetIdx=0,(s??=[]).push(g)),g.update&&(g.targetIdx=0,(a??=[]).push(g));if(o)for(let g=0;g<o.length;g++){let C=o[g];if(typeof C!="function")for(let E of C.bindings){c+=E[Sc].requiredVars;let O=g+1;E.create&&(E.targetIdx=O,(s??=[]).push(E)),E.update&&(E.targetIdx=O,(a??=[]).push(E))}}let d=[e];if(o)for(let g of o){let C=typeof g=="function"?g:g.type,E=Wi(C);d.push(E)}return ol(0,null,qb(s,a),1,c,d,null,null,null,[r],null)}function zb(t,e){let n=t.getRootNode?.();return Vb&&n instanceof Document?n.head:n&&Up&&n instanceof ShadowRoot?n:e().head}function qb(t,e){return!t&&!e?null:n=>{if(n&1&&t)for(let o of t)o.create();if(n&2&&e)for(let o of e)o.update()}}function yf(t){let e=t[Sc].kind;return e==="input"||e==="twoWay"}var Nr=class extends Op{_rootLView;_hasInputBindings;instance;hostView;changeDetectorRef;componentType;location;previousInputValues=null;_tNode;constructor(e,n,o){super(),this._rootLView=n,this._hasInputBindings=o,this._tNode=er(n[$],ye),this.location=Yn(this._tNode,n),this.instance=ht(this._tNode.index,n)[ue],this.hostView=this.changeDetectorRef=new Zn(n,void 0),this.componentType=e}setInput(e,n){this._hasInputBindings;let o=this._tNode;if(this.previousInputValues??=new Map,this.previousInputValues.has(e)&&Object.is(this.previousInputValues.get(e),n))return;let i=this._rootLView,r=al(o,i[$],i,e,n);this.previousInputValues.set(e,n);let s=ht(o.index,i);ll(s,1)}get injector(){return new Mt(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(e){this.hostView.onDestroy(e)}};function Kb(t,e,n){let o=t.projection=[];for(let i=0;i<e.length;i++){let r=n[i];o.push(r!=null&&r.length?Array.from(r):null)}}var zr=(()=>{class t{static __NG_ELEMENT_ID__=Zb}return t})();function Zb(){let t=Ke();return Wp(t,W())}var wc=class t extends zr{_lContainer;_hostTNode;_hostLView;constructor(e,n,o){super(),this._lContainer=e,this._hostTNode=n,this._hostLView=o}get element(){return Yn(this._hostTNode,this._hostLView)}get injector(){return new Mt(this._hostTNode,this._hostLView)}get parentInjector(){let e=Uc(this._hostTNode,this._hostLView);if(Rf(e)){let n=Ir(e,this._hostLView),o=Cr(e),i=n[$].data[o+8];return new Mt(i,n)}else return new Mt(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(e){let n=vf(this._lContainer);return n!==null&&n[e]||null}get length(){return this._lContainer.length-fe}createEmbeddedView(e,n,o){let i,r,s;typeof o=="number"?i=o:o!=null&&(i=o.index,r=o.injector,s=o.onError);let a=Ic(this._lContainer,e.ssrId),c=e.createEmbeddedViewImpl(n||{},r,a);return s&&(c._lView[Mo]=s),this.insertImpl(c,i,$o(this._hostTNode,a)),c}createComponent(e,n,o,i,r,s,a){let c,d,f=n||{};c=f.index,o=f.injector,i=f.projectableNodes,r=f.environmentInjector||f.ngModuleRef,s=f.directives,a=f.bindings,d=f.onError;let g=new Go(sn(e)),C=o||this.parentInjector;if(!r&&g.ngModule==null){let re=this.parentInjector.get(ot,null);re&&(r=re)}let E=sn(g.componentType??{}),O=Ic(this._lContainer,E?.id??null),Z=O?.firstChild??null,Q=g.create(C,i,Z,r,s,a,this._getHostElementNamespace());return d&&(Q.hostView._lView[Mo]=d),this.insertImpl(Q.hostView,c,$o(this._hostTNode,O)),Q}_getHostElementNamespace(){if(this._hostTNode.type&2){let e=this._hostTNode.parent??this._hostLView[Pe];return e!==null&&e.type&2&&typeof e.value=="string"&&e.value.toLowerCase()==="foreignobject"?null:e?.namespace??null}return this._hostTNode.namespace}insert(e,n){return this.insertImpl(e,n,!0)}insertImpl(e,n,o){let i=e._lView;if(vu(i)){let a=this.indexOf(e);if(a!==-1)this.detach(a);else{let c=i[he],d=new t(c,c[Pe],c[he]);d.detach(d.indexOf(e))}}let r=this._adjustIndex(n),s=this._lContainer;return Wr(s,i,r,o),e.attachToViewContainerRef(),Na(dc(s),r,e),e}move(e,n){return this.insert(e,n)}indexOf(e){let n=vf(this._lContainer);return n!==null?n.indexOf(e):-1}remove(e){let n=this._adjustIndex(e,-1),o=Ho(this._lContainer,n);o&&(Io(dc(this._lContainer),n),Br(o[$],o))}detach(e){let n=this._adjustIndex(e,-1),o=Ho(this._lContainer,n);return o&&Io(dc(this._lContainer),n)!=null?new Zn(o):null}_adjustIndex(e,n=0){return e??this.length+n}};function vf(t){return t[No]}function dc(t){return t[No]||(t[No]=[])}function Wp(t,e){let n,o=e[t.index];return qe(o)?n=o:(n=Mp(o,e,null,t),e[t.index]=n,rl(e,n)),Yb(n,e,t,o),new wc(n,t,e)}function Qb(t,e){let n=t[de],o=n.createComment(""),i=rt(e,t),r=n.parentNode(i);return yn(n,r,o,n.nextSibling(i),!1),o}var Yb=e_,Jb=()=>!1;function Xb(t,e,n){return Jb(t,e,n)}function e_(t,e,n,o){if(t[ln])return;let i;n.type&8?i=Ie(o):i=Qb(e,n),t[ln]=i}var Tc=class t{queryList;matches=null;constructor(e){this.queryList=e}clone(){return new t(this.queryList)}setDirty(){this.queryList.setDirty()}},Dc=class t{queries;constructor(e=[]){this.queries=e}createEmbeddedView(e){let n=e.queries;if(n!==null){let o=e.contentQueries!==null?e.contentQueries[0]:n.length,i=[];for(let r=0;r<o;r++){let s=n.getByIndex(r),a=this.queries[s.indexInDeclarationView];i.push(a.clone())}return new t(i)}return null}insertView(e){this.dirtyQueriesWithMatches(e)}detachView(e){this.dirtyQueriesWithMatches(e)}finishViewCreation(e){this.dirtyQueriesWithMatches(e)}dirtyQueriesWithMatches(e){for(let n=0;n<this.queries.length;n++)Kp(e,n).matches!==null&&this.queries[n].setDirty()}},Mc=class{flags;read;predicate;constructor(e,n,o=null){this.flags=n,this.read=o,typeof e=="string"?this.predicate=a_(e):this.predicate=e}},Nc=class t{queries;constructor(e=[]){this.queries=e}elementStart(e,n){for(let o=0;o<this.queries.length;o++)this.queries[o].elementStart(e,n)}elementEnd(e){for(let n=0;n<this.queries.length;n++)this.queries[n].elementEnd(e)}embeddedTView(e){let n=null;for(let o=0;o<this.length;o++){let i=n!==null?n.length:0,r=this.getByIndex(o).embeddedTView(e,i);r&&(r.indexInDeclarationView=o,n!==null?n.push(r):n=[r])}return n!==null?new t(n):null}template(e,n){for(let o=0;o<this.queries.length;o++)this.queries[o].template(e,n)}getByIndex(e){return this.queries[e]}get length(){return this.queries.length}track(e){this.queries.push(e)}},kc=class t{metadata;matches=null;indexInDeclarationView=-1;crossesNgTemplate=!1;_declarationNodeIndex;_appliesToNextNode=!0;constructor(e,n=-1){this.metadata=e,this._declarationNodeIndex=n}elementStart(e,n){this.isApplyingToNode(n)&&this.matchTNode(e,n)}elementEnd(e){this._declarationNodeIndex===e.index&&(this._appliesToNextNode=!1)}template(e,n){this.elementStart(e,n)}embeddedTView(e,n){return this.isApplyingToNode(e)?(this.crossesNgTemplate=!0,this.addMatch(-e.index,n),new t(this.metadata)):null}isApplyingToNode(e){if(this._appliesToNextNode&&(this.metadata.flags&1)!==1){let n=this._declarationNodeIndex,o=e.parent;for(;o!==null&&o.type&8&&o.index!==n;)o=o.parent;return n===(o!==null?o.index:-1)}return this._appliesToNextNode}matchTNode(e,n){let o=this.metadata.predicate;if(Array.isArray(o))for(let i=0;i<o.length;i++){let r=o[i];this.matchTNodeWithReadOption(e,n,t_(n,r)),this.matchTNodeWithReadOption(e,n,_r(n,e,r,!1,!1))}else o===Uo?n.type&4&&this.matchTNodeWithReadOption(e,n,-1):this.matchTNodeWithReadOption(e,n,_r(n,e,o,!1,!1))}matchTNodeWithReadOption(e,n,o){if(o!==null){let i=this.metadata.read;if(i!==null)if(i===qo||i===zr||i===Ce||i===Uo&&n.type&4)this.addMatch(n.index,-2);else{let r=_r(n,e,i,!1,!1);r!==null&&this.addMatch(n.index,r)}else this.addMatch(n.index,o)}}addMatch(e,n){this.matches===null?this.matches=[e,n]:this.matches.push(e,n)}};function t_(t,e){let n=t.localNames;if(n!==null){for(let o=0;o<n.length;o+=2)if(n[o]===e)return n[o+1]}return null}function n_(t,e){return t.type&11?Yn(t,e):t.type&4?dl(t,e):null}function o_(t,e,n,o){return n===-1?n_(e,t):n===-2?i_(t,e,o):Sr(t,t[$],n,e)}function i_(t,e,n){if(n===qo)return Yn(e,t);if(n===Uo)return dl(e,t);if(n===zr)return Wp(e,t);if(n===Ce)return new Mt(e,t)}function zp(t,e,n,o){let i=e[mt].queries[o];if(i.matches===null){let r=t.data,s=n.matches,a=[];for(let c=0;s!==null&&c<s.length;c+=2){let d=s[c];if(d<0)a.push(null);else{let f=r[d];a.push(o_(e,f,s[c+1],n.metadata.read))}}i.matches=a}return i.matches}function Rc(t,e,n,o){let i=t.queries.getByIndex(n),r=i.matches;if(r!==null){let s=zp(t,e,i,n);for(let a=0;a<r.length;a+=2){let c=r[a];if(c>0)o.push(s[a/2]);else{let d=r[a+1],f=e[-c];for(let g=fe;g<f.length;g++){let C=f[g];C[Lt]===C[he]&&Rc(C[$],C,d,o)}if(f[dn]!==null){let g=f[dn];for(let C=0;C<g.length;C++){let E=g[C];Rc(E[$],E,d,o)}}}}}return o}function qp(t,e){return t[mt].queries[e].queryList}function r_(t,e,n){let o=new wr((n&4)===4);return Eu(t,e,o,o.destroy),(e[mt]??=new Dc).queries.push(new Tc(o))-1}function s_(t,e,n){let o=Se();return o.firstCreatePass&&(c_(o,new Mc(t,e,n),-1),(e&2)===2&&(o.staticViewQueries=!0)),r_(o,W(),e)}function a_(t){return t.split(",").map(e=>e.trim())}function c_(t,e,n){t.queries===null&&(t.queries=new Nc),t.queries.track(new kc(e,n))}function Kp(t,e){return t.queries.getByIndex(e)}function l_(t,e){let n=t[$],o=Kp(n,e);return o.crossesNgTemplate?Rc(n,t,e,[]):zp(n,t,o,e)}function Zp(t,e,n){let o,i=ho(()=>{o._dirtyCounter();let r=u_(o,t);if(e&&r===void 0)throw new U(-951,!1);return r});return o=i[Ee],o._dirtyCounter=A(0),o._flatValue=void 0,i}function Qp(t){return Zp(!0,!1,t)}function Yp(t){return Zp(!0,!0,t)}function d_(t,e){let n=t[Ee];n._lView=W(),n._queryIndex=e,n._queryList=qp(n._lView,e),n._queryList.onDirty(()=>n._dirtyCounter.update(o=>o+1))}function u_(t,e){let n=t._lView,o=t._queryIndex;if(n===void 0||o===void 0||n[H]&4)return e?void 0:nt;let i=qp(n,o),r=l_(n,o);return i.reset(r,Bv),e?i.first:i._changesDetected||t._flatValue===void 0?t._flatValue=i.toArray():t._flatValue}function ul(t){return!!t&&typeof t.then=="function"}function Jp(t){return!!t&&typeof t.subscribe=="function"}var kr=class{};var Wo=class extends kr{injector;instance=null;constructor(e){super();let n=new on([...e.providers,{provide:kr,useValue:this}],e.parent||To(),e.debugName,new Set(["environment"]));this.injector=n,e.runEnvironmentInitializers&&n.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(e){this.injector.onDestroy(e)}};function Xp(t,e,n=null){return new Wo({providers:t,parent:e,debugName:n,runEnvironmentInitializers:!0}).injector}var f_=(()=>{class t{_injector;cachedInjectors=new Map;constructor(n){this._injector=n}getOrCreateStandaloneInjector(n){if(!n.standalone)return null;if(!this.cachedInjectors.has(n)){let o=Aa(!1,n.type),i=o.length>0?Xp([o],this._injector,""):null;this.cachedInjectors.set(n,i)}return this.cachedInjectors.get(n)}ngOnDestroy(){try{for(let n of this.cachedInjectors.values())n!==null&&n.destroy()}finally{this.cachedInjectors.clear()}}static \u0275prov=K({token:t,providedIn:"environment",factory:()=>new t(te(ot))})}return t})();function se(t){return Nf(()=>{let e=g_(t),n=x(y({},e),{decls:t.decls,vars:t.vars,template:t.template,consts:t.consts||null,ngContentSelectors:t.ngContentSelectors,onPush:t.changeDetection!==Gc.Eager,directiveDefs:null,pipeDefs:null,dependencies:e.standalone&&t.dependencies||null,getStandaloneInjector:e.standalone?i=>i.get(f_).getOrCreateStandaloneInjector(n):null,getExternalStyles:null,signals:t.signals??!1,data:t.data||{},encapsulation:t.encapsulation||ct.Emulated,styles:t.styles||nt,_:null,schemas:t.schemas||null,tView:null,id:""});e.standalone&&$t("NgStandalone"),y_(n);let o=t.dependencies;return n.directiveDefs=bf(o,p_),n.pipeDefs=bf(o,tu),n.id=v_(n),n})}function p_(t){return sn(t)||Wi(t)}function m_(t,e){if(t==null)return Qi;let n={};for(let o in t)if(Object.hasOwn(t,o)){let i=t[o],r,s,a,c;Array.isArray(i)?(a=i[0],r=i[1],s=i[2]??r,c=i[3]||null):(r=i,s=i,a=Ur.None,c=null),n[r]=[o,a,c],e[r]=s}return n}function h_(t){if(t==null)return Qi;let e={};for(let n in t)Object.hasOwn(t,n)&&(e[t[n]]=n);return e}function g_(t){let e={};return{type:t.type,providersResolver:null,viewProvidersResolver:null,factory:null,hostBindings:t.hostBindings||null,hostVars:t.hostVars||0,hostAttrs:t.hostAttrs||null,contentQueries:t.contentQueries||null,declaredInputs:e,inputConfig:t.inputs||Qi,exportAs:t.exportAs||null,standalone:t.standalone??!0,signals:t.signals===!0,selectors:t.selectors||nt,viewQuery:t.viewQuery||null,features:t.features||null,setInput:null,resolveHostDirectives:null,hostDirectives:null,controlDef:null,signalFormsInputPresence:null,inputs:m_(t.inputs,e),outputs:h_(t.outputs),debugInfo:null}}function y_(t){t.features?.forEach(e=>e(t))}function bf(t,e){return t?()=>{let n=typeof t=="function"?t():t,o=[];for(let i of n){let r=e(i);r!==null&&o.push(r)}return o}:null}function v_(t){let e=0,n=typeof t.consts=="function"?"":t.consts,o=[t.selectors,t.ngContentSelectors,t.hostVars,t.hostAttrs,n,t.vars,t.decls,t.encapsulation,t.standalone,t.signals,t.exportAs,JSON.stringify(t.inputs),JSON.stringify(t.outputs),Object.getOwnPropertyNames(t.type.prototype),!!t.contentQueries,!!t.viewQuery];for(let r of o.join("|"))e=Math.imul(31,e)+r.charCodeAt(0)<<0;return e+=2147483648,"c"+e}var em=new Y("");var fl=(()=>{class t{resolve;reject;initialized=!1;done=!1;donePromise=new Promise((n,o)=>{this.resolve=n,this.reject=o});appInits=w(em,{optional:!0})??[];injector=w(Ce);constructor(){}runInitializers(){if(this.initialized)return;let n=[];for(let i of this.appInits){let r=Yi(this.injector,i);if(ul(r))n.push(r);else if(Jp(r)){let s=new Promise((a,c)=>{r.subscribe({complete:a,error:c})});n.push(s)}}let o=()=>{this.done=!0,this.resolve()};Promise.all(n).then(()=>{o()}).catch(i=>{this.reject(i)}),n.length===0&&o(),this.initialized=!0}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Fr({token:t,factory:t.\u0275fac})}return t})();function b_(t,e,n,o,i,r,s,a){if(n.firstCreatePass){t.mergedAttrs=Lr(t.mergedAttrs,t.attrs);let f=t.tView=ol(2,t,i,r,s,n.directiveRegistry,n.pipeRegistry,null,n.schemas,n.consts,null);n.queries!==null&&(n.queries.template(n,t),f.queries=n.queries.embeddedTView(t))}a&&(t.flags|=a),mn(t,!1);let c=__(n,e,t,o);ur()&&tl(n,e,c,t),Kn(c,e);let d=Mp(c,e,c,t);e[o+ye]=d,rl(e,d),Xb(d,t,e)}function Rr(t,e,n,o,i,r,s,a,c,d,f){let g=n+ye,C;if(e.firstCreatePass){if(C=Ko(e,g,4,s||null,a||null),d!=null){let E=gt(e.consts,d);C.localNames=[];for(let O=0;O<E.length;O+=2)C.localNames.push(E[O],-1)}}else C=e.data[g];return b_(C,t,e,n,o,i,r,c),d!=null&&sl(t,C,f),C}var __=E_;function E_(t,e,n,o){return fr(!0),e[de].createComment("")}var pl=new Y("");var tm=new Y("");function nm(){Zs(t=>{let e="";throw new U(-600,e)})}var x_=10;var qr=(()=>{class t{_runningTick=!1;_destroyed=!1;_destroyListeners=[];_views=[];internalErrorHandler=w(gn);afterRenderManager=w($r);zonelessEnabled=w(Oo);rootEffectScheduler=w(hr);dirtyFlags=0;tracingSnapshot=null;allTestViews=new Set;autoDetectTestViews=new Set;includeAllTestViews=!1;afterTick=new Ge;get allViews(){return[...(this.includeAllTestViews?this.allTestViews:this.autoDetectTestViews).keys(),...this._views]}get destroyed(){return this._destroyed}componentTypes=[];components=[];internalPendingTask=w(Un);get isStable(){return this.internalPendingTask.hasPendingTasksObservable.pipe(ca(n=>!n))}constructor(){w(vt,{optional:!0})}whenStable(){let n;return new Promise(o=>{n=this.isStable.subscribe({next:i=>{i&&o()}})}).finally(()=>{n.unsubscribe()})}_injector=w(ot);_rendererFactory=null;get injector(){return this._injector}bootstrap(n,o){return this.bootstrapImpl(n,o)}bootstrapImpl(n,o,i=Ce.NULL){return this._injector.get(Oe).run(()=>{if(ee(X.BootstrapComponentStart),!this._injector.get(fl).done){let ve="";throw new U(405,ve)}let a=sn(n),c=this._injector.get(kr),d=new Go(a,c);this.componentTypes.push(n);let{hostElement:f,directives:g,bindings:C}=C_(o),E=f||d.selector,O=d.create(i,[],E,c.injector,g,C),Z=O.location.nativeElement,Q=O.injector.get(pl,null);return Q?.registerApplication(Z),O.onDestroy(()=>{this.detachView(O.hostView),Lo(this.components,O),Q?.unregisterApplication(Z)}),this._loadComponent(O),ee(X.BootstrapComponentEnd,O),O})}tick(){this.zonelessEnabled||(this.dirtyFlags|=1),this._tick()}_tick(){ee(X.ChangeDetectionStart),this.tracingSnapshot!==null?this.tracingSnapshot.run(jr.CHANGE_DETECTION,this.tickImpl):this.tickImpl()}tickImpl=()=>{if(this._runningTick)throw ee(X.ChangeDetectionEnd),new U(101,!1);let n=V(null);try{this._runningTick=!0,this.synchronize()}finally{this._runningTick=!1,this.tracingSnapshot?.dispose(),this.tracingSnapshot=null,V(n),this.afterTick.next(),ee(X.ChangeDetectionEnd)}};synchronize(){this._rendererFactory===null&&!this._injector.destroyed&&(this._rendererFactory=this._injector.get(vn,null,{optional:!0}));let n=0;for(;this.dirtyFlags!==0&&n++<x_;){ee(X.ChangeDetectionSyncStart);try{this.synchronizeOnce()}finally{ee(X.ChangeDetectionSyncEnd)}}}synchronizeOnce(){this.dirtyFlags&16&&(this.dirtyFlags&=-17,this.rootEffectScheduler.flush());let n=!1;if(this.dirtyFlags&7){let o=!!(this.dirtyFlags&1);this.dirtyFlags&=-8,this.dirtyFlags|=8;for(let{_lView:i}of this.allViews){if(!o&&!ko(i))continue;let r=o&&!this.zonelessEnabled?0:1;Ip(i,r),n=!0}if(this.dirtyFlags&=-5,this.syncDirtyFlagsWithViews(),this.dirtyFlags&23)return}n||(this._rendererFactory?.begin?.(),this._rendererFactory?.end?.()),this.dirtyFlags&8&&(this.dirtyFlags&=-9,this.afterRenderManager.execute()),this.syncDirtyFlagsWithViews()}syncDirtyFlagsWithViews(){if(this.allViews.some(({_lView:n})=>ko(n))){this.dirtyFlags|=2;return}else this.dirtyFlags&=-8}attachView(n){let o=n;this._views.push(o),o.attachToAppRef(this)}detachView(n){let o=n;Lo(this._views,o),o.detachFromAppRef()}_loadComponent(n){this.attachView(n.hostView);try{this.tick()}catch(i){this.internalErrorHandler(i)}this.components.push(n),this._injector.get(tm,[]).forEach(i=>i(n))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(n=>n()),this._views.slice().forEach(n=>n.destroy())}finally{this._destroyed=!0,this._views=[],this._destroyListeners=[]}}onDestroy(n){return this._destroyListeners.push(n),()=>Lo(this._destroyListeners,n)}destroy(){if(this._destroyed)throw new U(406,!1);let n=this._injector;n.destroy&&!n.destroyed&&n.destroy()}get viewCount(){return this._views.length}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Fr({token:t,factory:t.\u0275fac})}return t})();function C_(t){return t===void 0||typeof t=="string"||t instanceof Element?{hostElement:t}:t}function Lo(t,e){let n=t.indexOf(e);n>-1&&t.splice(n,1)}function z(t,e,n,o){let i=W(),r=hn();if(Ze(i,r,e)){let s=Se(),a=dr();q0(a,i,t,e,n,o)}return z}var Ac=class{destroy(e){}updateValue(e,n){}swap(e,n){let o=Math.min(e,n),i=Math.max(e,n),r=this.detach(i);if(i-o>1){let s=this.detach(o);this.attach(o,r),this.attach(i,s)}else this.attach(o,r)}move(e,n){this.attach(n,this.detach(e))}};function uc(t,e,n,o,i){return t===n&&Object.is(e,o)?1:Object.is(i(t,e),i(n,o))?-1:0}function I_(t,e,n,o){let i,r,s=0,a=t.length-1,c=void 0;if(Array.isArray(e)){V(o);let d=e.length-1;for(V(null);s<=a&&s<=d;){let f=t.at(s),g=e[s],C=uc(s,f,s,g,n);if(C!==0){C<0&&t.updateValue(s,g),s++;continue}let E=t.at(a),O=e[d],Z=uc(a,E,d,O,n);if(Z!==0){Z<0&&t.updateValue(a,O),a--,d--;continue}let Q=n(s,f),ve=n(a,E),re=n(s,g);if(Object.is(re,ve)){let me=n(d,O);Object.is(me,Q)?(t.swap(s,a),t.updateValue(a,O),d--,a--):t.move(a,s),t.updateValue(s,g),s++;continue}if(i??=new Ar,r??=Ef(t,s,a,n),Oc(t,i,s,re))t.updateValue(s,g),s++,a++;else if(r.has(re))i.set(Q,t.detach(s)),a--;else{let me=t.create(s,e[s]);t.attach(s,me),s++,a++}}for(;s<=d;)_f(t,i,n,s,e[s]),s++}else if(e!=null){V(o);let d=e[Symbol.iterator]();V(null);let f=d.next();for(;!f.done&&s<=a;){let g=t.at(s),C=f.value,E=uc(s,g,s,C,n);if(E!==0)E<0&&t.updateValue(s,C),s++,f=d.next();else{i??=new Ar,r??=Ef(t,s,a,n);let O=n(s,C);if(Oc(t,i,s,O))t.updateValue(s,C),s++,a++,f=d.next();else if(!r.has(O))t.attach(s,t.create(s,C)),s++,a++,f=d.next();else{let Z=n(s,g);i.set(Z,t.detach(s)),a--}}}for(;!f.done;)_f(t,i,n,t.length,f.value),f=d.next()}for(;s<=a;)t.destroy(t.detach(a--));i?.forEach(d=>{t.destroy(d)})}function Oc(t,e,n,o){return e!==void 0&&e.has(o)?(t.attach(n,e.get(o)),e.delete(o),!0):!1}function _f(t,e,n,o,i){if(Oc(t,e,o,n(o,i)))t.updateValue(o,i);else{let r=t.create(o,i);t.attach(o,r)}}function Ef(t,e,n,o){let i=new Set;for(let r=e;r<=n;r++)i.add(o(r,t.at(r)));return i}var Ar=class{kvMap=new Map;_vMap=void 0;has(e){return this.kvMap.has(e)}delete(e){if(!this.has(e))return!1;let n=this.kvMap.get(e);return this._vMap!==void 0&&this._vMap.has(n)?(this.kvMap.set(e,this._vMap.get(n)),this._vMap.delete(n)):this.kvMap.delete(e),!0}get(e){return this.kvMap.get(e)}set(e,n){if(this.kvMap.has(e)){let o=this.kvMap.get(e);this._vMap===void 0&&(this._vMap=new Map);let i=this._vMap;for(;i.has(o);)o=i.get(o);i.set(o,n)}else this.kvMap.set(e,n)}forEach(e){for(let[n,o]of this.kvMap)if(e(o,n),this._vMap!==void 0){let i=this._vMap;for(;i.has(o);)o=i.get(o),e(o,n)}}};function T(t,e,n,o,i,r,s,a){$t("NgControlFlow");let c=W(),d=Se(),f=gt(d.consts,r);return Rr(c,d,t,e,n,o,i,f,256,s,a),ml}function ml(t,e,n,o,i,r,s,a){return $t("NgControlFlow"),S_(t,e,n,o,i,r,s,a),ml}function S_(t,e,n,o,i,r,s,a){let c=W(),d=Se(),f=gt(d.consts,r);Rr(c,d,t,e,n,o,i,f,512,s,a)}function D(t,e){$t("NgControlFlow");let n=W(),o=hn(),i=n[o]!==xe?n[o]:-1,r=i!==-1?Or(n,ye+i):void 0,s=0;if(Ze(n,o,t)){let a=V(null);try{if(r!==void 0&&kp(r,s),t!==-1){let c=ye+t,d=Or(n,c),f=Vc(n[$],c),g=Ap(d,f,n),C=Gr(n,f,e,{dehydratedView:g});Wr(d,C,s,$o(f,g))}}finally{V(a)}}else if(r!==void 0){let a=Np(r,s);a!==void 0&&(a[ue]=e)}}var Pc=class{lContainer;$implicit;$index;constructor(e,n,o){this.lContainer=e,this.$implicit=n,this.$index=o}get $count(){return this.lContainer.length-fe}};function oe(t){return t}function pe(t,e){return e}var Lc=class{hasEmptyBlock;trackByFn;liveCollection;constructor(e,n,o){this.hasEmptyBlock=e,this.trackByFn=n,this.liveCollection=o}};function L(t,e,n,o,i,r,s,a,c,d,f,g,C){$t("NgControlFlow");let E=W(),O=Se(),Z=c!==void 0,Q=W(),ve=a?s.bind(Q[je][ue]):s,re=new Lc(Z,ve);Q[ye+t]=re,Rr(E,O,t+1,e,n,o,i,gt(O.consts,r),256),Z&&Rr(E,O,t+2,c,d,f,g,gt(O.consts,C),512)}var Fc=class extends Ac{lContainer;hostLView;templateTNode;operationsCounter=void 0;needsIndexUpdate=!1;constructor(e,n,o){super(),this.lContainer=e,this.hostLView=n,this.templateTNode=o}get length(){return this.lContainer.length-fe}at(e){return this.getLView(e)[ue].$implicit}attach(e,n){let o=n[Vn];this.needsIndexUpdate||=e!==this.length,Wr(this.lContainer,n,e,$o(this.templateTNode,o)),w_(this.lContainer,e)}detach(e){return this.needsIndexUpdate||=e!==this.length-1,T_(this.lContainer,e),D_(this.lContainer,e)}create(e,n){let o=Ic(this.lContainer,this.templateTNode.tView.ssrId);return Gr(this.hostLView,this.templateTNode,new Pc(this.lContainer,n,e),{dehydratedView:o})}destroy(e){Br(e[$],e)}updateValue(e,n){this.getLView(e)[ue].$implicit=n}reset(){this.needsIndexUpdate=!1}updateIndexes(){if(this.needsIndexUpdate)for(let e=0;e<this.length;e++)this.getLView(e)[ue].$index=e}getLView(e){return M_(this.lContainer,e)}};function F(t){let e=V(null),n=Be();try{let o=W(),i=o[$],r=o[n],s=n+1,a=Or(o,s);if(r.liveCollection===void 0){let d=Vc(i,s);r.liveCollection=new Fc(a,o,d)}else r.liveCollection.reset();let c=r.liveCollection;if(I_(c,t,r.trackByFn,e),c.updateIndexes(),r.hasEmptyBlock){let d=hn(),f=c.length===0;if(Ze(o,d,f)){let g=n+2,C=Or(o,g);if(f){let E=Vc(i,g),O=Ap(C,E,o),Z=Gr(o,E,void 0,{dehydratedView:O});Wr(C,Z,0,$o(E,O))}else i.firstUpdatePass&&yb(C),kp(C,0)}}}finally{V(e)}}function Or(t,e){return t[e]}function w_(t,e){if(t.length<=fe)return;let n=fe+e,o=t[n];o&&b0(o)}function T_(t,e){if(t.length<=fe)return;let n=fe+e,o=t[n];o&&v0(o)}function D_(t,e){return Ho(t,e)}function M_(t,e){return Np(t,e)}function Vc(t,e){return er(t,e)}function N(t,e,n){let o=W(),i=hn();if(Ze(o,i,e)){let r=Se(),s=dr();B0(s,o,t,e,o[de],n)}return N}function jc(t,e,n,o,i){al(e,t,n,i?"class":"style",o)}function h(t,e,n,o){let i=W(),r=i[$],s=t+ye,a=r.firstCreatePass?Bp(s,i,2,e,z0,Iu(),n,o):r.data[s];if(Vt(a)){let c=i[pt].tracingService;if(c&&c.componentCreate){let d=r.data[a.directiveStart+a.componentOffset];return c.componentCreate(Lp(d),()=>(xf(t,e,i,a,o),h))}}return xf(t,e,i,a,o),h}function xf(t,e,n,o,i){if(yp(o,n,t,e,om),Xi(o)){let r=n[$];mp(r,n,o),ep(r,o,n)}i!=null&&sl(n,o)}function m(){let t=Se(),e=Ke(),n=vp(e);return t.firstCreatePass&&Hp(t,n),za(n)&&qa(),Wa(),n.classesWithoutHost!=null&&wv(n)&&jc(t,n,W(),n.classesWithoutHost,!0),n.stylesWithoutHost!=null&&Tv(n)&&jc(t,n,W(),n.stylesWithoutHost,!1),m}function lt(t,e,n,o){return h(t,e,n,o),m(),lt}function b(t,e,n,o){let i=W(),r=i[$],s=t+ye,a=r.firstCreatePass?Fb(s,r,2,e,n,o):r.data[s];return yp(a,i,t,e,om),o!=null&&sl(i,a),b}function v(){let t=Ke(),e=vp(t);return za(e)&&qa(),Wa(),v}function ie(t,e,n,o){return b(t,e,n,o),v(),ie}var om=(t,e,n,o,i)=>(fr(!0),tp(e[de],o,ec()));function j(){return W()}function R(t,e,n){let o=W(),i=hn();if(Ze(o,i,e)){let r=Se(),s=dr();hp(s,o,t,e,o[de],n)}return R}var Zo="en-US";var N_=Zo;function im(t){typeof t=="string"&&(N_=t.toLowerCase().replace(/_/g,"-"))}function k(t,e,n){let o=W(),i=Se(),r=Ke();return k_(i,o,o[de],r,t,e,n),k}function P(t,e,n){let o=W(),i=Se(),r=Ke();return(r.type&3||n)&&Fp(r,i,o,n,o[de],t,e,xr(r,o,e)),P}function k_(t,e,n,o,i,r,s){let a=!0,c=null;if((o.type&3||s)&&(c??=xr(o,e,r),Fp(o,t,e,s,n,i,r,c)&&(a=!1)),a){let d=o.outputs?.[i],f=o.hostDirectiveOutputs?.[i];if(f&&f.length)for(let g=0;g<f.length;g+=2){let C=f[g],E=f[g+1];c??=xr(o,e,r),pf(o,e,C,E,i,c)}if(d&&d.length)for(let g of d)c??=xr(o,e,r),pf(o,e,g,i,i,c)}}function p(t=1){return Vu(t)}function Qe(t,e,n,o){return d_(t,s_(e,n,o)),Qe}function dt(t=1){ar(Ou()+t)}function hl(t){let e=Qa();return $a(e,ye+t)}function yr(t,e){return t<<17|e<<2}function bn(t){return t>>17&32767}function R_(t){return(t&2)==2}function A_(t,e){return t&131071|e<<17}function $c(t){return t|2}function Qn(t){return(t&131068)>>2}function fc(t,e){return t&-131069|e<<2}function O_(t){return(t&1)===1}function Bc(t){return t|1}function P_(t,e,n,o,i,r){let s=r?e.classBindings:e.styleBindings,a=bn(s),c=Qn(s);t[o]=n;let d=!1,f;if(Array.isArray(n)){let g=n;f=g[1],(f===null||Ln(g,f)>0)&&(d=!0)}else f=n;if(i)if(c!==0){let C=bn(t[a+1]);t[o+1]=yr(C,a),C!==0&&(t[C+1]=fc(t[C+1],o)),t[a+1]=A_(t[a+1],o)}else t[o+1]=yr(a,0),a!==0&&(t[a+1]=fc(t[a+1],o)),a=o;else t[o+1]=yr(c,0),a===0?a=o:t[c+1]=fc(t[c+1],o),c=o;d&&(t[o+1]=$c(t[o+1])),Cf(t,f,o,!0),Cf(t,f,o,!1),L_(e,f,t,o,r),s=yr(a,c),r?e.classBindings=s:e.styleBindings=s}function L_(t,e,n,o,i){let r=i?t.residualClasses:t.residualStyles;r!=null&&typeof e=="string"&&Ln(r,e)>=0&&(n[o+1]=Bc(n[o+1]))}function Cf(t,e,n,o){let i=t[n+1],r=e===null,s=o?bn(i):Qn(i),a=!1;for(;s!==0&&(a===!1||r);){let c=t[s],d=t[s+1];F_(c,e)&&(a=!0,t[s+1]=o?Bc(d):$c(d)),s=o?bn(d):Qn(d)}a&&(t[n+1]=o?$c(i):Bc(i))}function F_(t,e){return t===null||e==null||(Array.isArray(t)?t[1]:t)===e?!0:Array.isArray(t)&&typeof e=="string"?Ln(t,e)>=0:!1}var at={textEnd:0,key:0,keyEnd:0,value:0,valueEnd:0};function V_(t){return t.substring(at.key,at.keyEnd)}function j_(t){return $_(t),rm(t,sm(t,0,at.textEnd))}function rm(t,e){let n=at.textEnd;return n===e?-1:(e=at.keyEnd=B_(t,at.key=e,n),sm(t,e,n))}function $_(t){at.key=0,at.keyEnd=0,at.value=0,at.valueEnd=0,at.textEnd=t.length}function sm(t,e,n){for(;e<n&&t.charCodeAt(e)<=32;)e++;return e}function B_(t,e,n){for(;e<n&&t.charCodeAt(e)>32;)e++;return e}function ae(t,e,n){return am(t,e,n,!1),ae}function q(t,e){return am(t,e,null,!0),q}function gl(t){U_(Z_,H_,t,!0)}function H_(t,e){for(let n=j_(e);n>=0;n=rm(e,n))Ki(t,V_(e),!0)}function am(t,e,n,o){let i=W(),r=Se(),s=Hn(2);if(r.firstUpdatePass&&lm(r,t,s,o),e!==xe&&Ze(i,s,e)){let a=r.data[Be()];dm(r,a,i,i[de],t,i[s+1]=Y_(e,n),o,s)}}function U_(t,e,n,o){let i=Se(),r=Hn(2);i.firstUpdatePass&&lm(i,null,r,o);let s=W();if(n!==xe&&Ze(s,r,n)){let a=i.data[Be()];if(um(a,o)&&!cm(i,r)){let c=o?a.classesWithoutHost:a.stylesWithoutHost;c!==null&&(n=Bi(c,n||"")),jc(i,a,s,n,o)}else Q_(i,a,s,s[de],s[r+1],s[r+1]=K_(t,e,n),o,r)}}function cm(t,e){return e>=t.expandoStartIndex}function lm(t,e,n,o){let i=t.data;if(i[n+1]===null){let r=i[Be()],s=cm(t,n);um(r,o)&&e===null&&!s&&(e=!1),e=G_(i,r,e,o),P_(i,r,e,n,s,o)}}function G_(t,e,n,o){let i=Au(t),r=o?e.residualClasses:e.residualStyles;if(i===null)(o?e.classBindings:e.styleBindings)===0&&(n=pc(null,t,e,n,o),n=zo(n,e.attrs,o),r=null);else{let s=e.directiveStylingLast;if(s===-1||t[s]!==i)if(n=pc(i,t,e,n,o),r===null){let c=W_(t,e,o);c!==void 0&&Array.isArray(c)&&(c=pc(null,t,e,c[1],o),c=zo(c,e.attrs,o),z_(t,e,o,c))}else r=q_(t,e,o)}return r!==void 0&&(o?e.residualClasses=r:e.residualStyles=r),n}function W_(t,e,n){let o=n?e.classBindings:e.styleBindings;if(Qn(o)!==0)return t[bn(o)]}function z_(t,e,n,o){let i=n?e.classBindings:e.styleBindings;t[bn(i)]=o}function q_(t,e,n){let o,i=e.directiveEnd;for(let r=1+e.directiveStylingLast;r<i;r++){let s=t[r].hostAttrs;o=zo(o,s,n)}return zo(o,e.attrs,n)}function pc(t,e,n,o,i){let r=null,s=n.directiveEnd,a=n.directiveStylingLast;for(a===-1?a=n.directiveStart:a++;a<s&&(r=e[a],o=zo(o,r.hostAttrs,i),r!==t);)a++;return t!==null&&(n.directiveStylingLast=a),o}function zo(t,e,n){let o=n?1:2,i=-1;if(e!==null)for(let r=0;r<e.length;r++){let s=e[r];typeof s=="number"?i=s:i===o&&(Array.isArray(t)||(t=t===void 0?[]:["",t]),Ki(t,s,n?!0:e[++r]))}return t===void 0?null:t}function K_(t,e,n){if(n==null||n==="")return nt;let o=[],i=Vo(n);if(Array.isArray(i))for(let r=0;r<i.length;r++)t(o,i[r],!0);else if(i instanceof Set)for(let r of i)t(o,r,!0);else if(typeof i=="object")for(let r in i)Object.hasOwn(i,r)&&t(o,r,i[r]);else typeof i=="string"&&e(o,i);return o}function Z_(t,e,n){let o=String(e);o!==""&&!o.includes(" ")&&Ki(t,o,n)}function Q_(t,e,n,o,i,r,s,a){i===xe&&(i=nt);let c=0,d=0,f=0<i.length?i[0]:null,g=0<r.length?r[0]:null;for(;f!==null||g!==null;){let C=c<i.length?i[c+1]:void 0,E=d<r.length?r[d+1]:void 0,O=null,Z;f===g?(c+=2,d+=2,C!==E&&(O=g,Z=E)):g===null||f!==null&&f<g?(c+=2,O=f):(d+=2,O=g,Z=E),O!==null&&dm(t,e,n,o,O,Z,s,a),f=c<i.length?i[c]:null,g=d<r.length?r[d]:null}}function dm(t,e,n,o,i,r,s,a){if(!(e.type&3))return;let c=t.data,d=c[a+1],f=O_(d)?If(c,e,n,i,Qn(d),s):void 0;if(!Pr(f)){Pr(r)||R_(d)&&(r=If(c,null,n,i,a,s));let g=ja(Be(),n);A0(o,s,g,i,r)}}function If(t,e,n,o,i,r){let s=e===null,a;for(;i>0;){let c=t[i],d=Array.isArray(c),f=d?c[1]:c,g=f===null,C=n[i+1];C===xe&&(C=g?nt:void 0);let E=g?Zi(C,o):f===o?C:void 0;if(d&&!Pr(E)&&(E=Zi(c,o)),Pr(E)&&(a=E,s))return a;let O=t[i+1];i=s?bn(O):Qn(O)}if(e!==null){let c=r?e.residualClasses:e.residualStyles;c!=null&&(a=Zi(c,o))}return a}function Pr(t){return t!==void 0}function Y_(t,e){return t==null||t===""||(typeof e=="string"?t=Vo(t)+e:typeof t=="object"&&(t=$i(Vo(t)))),t}function um(t,e){return(t.flags&(e?8:16))!==0}function u(t,e=""){let n=W(),o=Se(),i=t+ye,r=o.firstCreatePass?Ko(o,i,1,e,null):o.data[i],s=J_(o,n,r,e);n[i]=s,ur()&&tl(o,n,s,r),mn(r,!1)}var J_=(t,e,n,o)=>(fr(!0),Jv(e[de],o));function fm(t,e,n,o=""){return Ze(t,hn(),n)?e+Ve(n)+o:xe}function X_(t,e,n,o,i,r=""){let s=rr(),a=Dr(t,s,n,i);return Hn(2),a?e+Ve(n)+o+Ve(i)+r:xe}function eE(t,e,n,o,i,r,s,a=""){let c=rr(),d=Cb(t,c,n,i,s);return Hn(3),d?e+Ve(n)+o+Ve(i)+r+Ve(s)+a:xe}function tE(t,e,n,o,i,r,s,a,c,d,f,g=""){let C=rr(),E=Ib(t,C,n,i,s,c);return E=Ze(t,C+4,f)||E,Hn(5),E?e+Ve(n)+o+Ve(i)+r+Ve(s)+a+Ve(c)+d+Ve(f)+g:xe}function M(t){return B("",t),M}function B(t,e,n){let o=W(),i=fm(o,t,e,n);return i!==xe&&Zr(o,Be(),i),B}function ke(t,e,n,o,i){let r=W(),s=X_(r,t,e,n,o,i);return s!==xe&&Zr(r,Be(),s),ke}function Jn(t,e,n,o,i,r,s){let a=W(),c=eE(a,t,e,n,o,i,r,s);return c!==xe&&Zr(a,Be(),c),Jn}function Kr(t,e,n,o,i,r,s,a,c,d,f){let g=W(),C=tE(g,t,e,n,o,i,r,s,a,c,d,f);return C!==xe&&Zr(g,Be(),C),Kr}function Zr(t,e,n){let o=ja(e,t);Xv(t[de],o,n)}var pm={};function Xn(t){$t("NgLet");let e=Se(),n=W(),o=t+ye,i=Ko(e,o,128,null,null);return mn(i,!1),tr(e,n,o,pm),Xn}function Qo(t){let e=Se(),n=W(),o=Be();return tr(e,n,o,t),t}function we(t){let e=Qa(),n=$a(e,ye+t);if(n===pm)throw new U(314,!1);return n}function yl(t,e,n=""){return fm(W(),t,e,n)}function Te(t,e){let n=Du()+t,o=W();return o[n]===xe?Eb(o,n,e()):xb(o,n)}var mm=(()=>{class t{applicationErrorHandler=w(gn);appRef=w(qr);taskService=w(Un);ngZone=w(Oe);zonelessEnabled=w(Oo);tracing=w(vt,{optional:!0});zoneIsDefined=typeof Zone<"u"&&!!Zone.root.run;schedulerTickApplyArgs=[{data:{__scheduler_tick__:!0}}];subscriptions=new Me;angularZoneId=this.zoneIsDefined?this.ngZone._inner?.get(_o):null;scheduleInRootZone=!this.zonelessEnabled&&this.zoneIsDefined&&(w(sc,{optional:!0})??!1);cancelScheduledCallback=null;useMicrotaskScheduler=!1;runningTick=!1;pendingRenderTaskId=null;constructor(){this.subscriptions.add(this.appRef.afterTick.subscribe(()=>{let n=this.taskService.add();if(!this.runningTick&&(this.cleanup(),!this.zonelessEnabled||this.appRef.includeAllTestViews)){this.taskService.remove(n);return}this.switchToMicrotaskScheduler(),this.taskService.remove(n)})),this.subscriptions.add(this.ngZone.onUnstable.subscribe(()=>{this.runningTick||this.cleanup()}))}switchToMicrotaskScheduler(){this.ngZone.runOutsideAngular(()=>{let n=this.taskService.add();this.useMicrotaskScheduler=!0,queueMicrotask(()=>{this.useMicrotaskScheduler=!1,this.taskService.remove(n)})})}notify(n){if(!this.zonelessEnabled&&n===5)return;switch(n){case 0:case 2:{this.appRef.dirtyFlags|=2;break}case 3:case 4:case 5:case 1:{this.appRef.dirtyFlags|=4;break}case 6:{this.appRef.dirtyFlags|=2;break}case 12:{this.appRef.dirtyFlags|=16;break}case 13:{this.appRef.dirtyFlags|=2;break}case 11:break;default:this.appRef.dirtyFlags|=8}if(this.appRef.tracingSnapshot=this.tracing?.snapshot(this.appRef.tracingSnapshot)??null,!this.shouldScheduleTick())return;let o=this.useMicrotaskScheduler?Uu:tc;this.pendingRenderTaskId=this.taskService.add(),this.scheduleInRootZone?this.cancelScheduledCallback=Zone.root.run(()=>o(()=>this.tick())):this.cancelScheduledCallback=this.ngZone.runOutsideAngular(()=>o(()=>this.tick()))}shouldScheduleTick(){return!(this.appRef.destroyed||this.pendingRenderTaskId!==null||this.runningTick||this.appRef._runningTick||!this.zonelessEnabled&&this.zoneIsDefined&&Zone.current.get(_o+this.angularZoneId))}tick(){if(this.runningTick||this.appRef.destroyed)return;if(this.appRef.dirtyFlags===0){this.cleanup();return}!this.zonelessEnabled&&this.appRef.dirtyFlags&7&&(this.appRef.dirtyFlags|=1);let n=this.taskService.add();try{this.ngZone.run(()=>{this.runningTick=!0,this.appRef._tick()},void 0,this.schedulerTickApplyArgs)}catch(o){this.applicationErrorHandler(o)}finally{this.taskService.remove(n),this.cleanup()}}ngOnDestroy(){this.subscriptions.unsubscribe(),this.cleanup()}cleanup(){if(this.runningTick=!1,this.cancelScheduledCallback?.(),this.cancelScheduledCallback=null,this.pendingRenderTaskId!==null){let n=this.pendingRenderTaskId;this.pendingRenderTaskId=null,this.taskService.remove(n)}}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Fr({token:t,factory:t.\u0275fac})}return t})();function hm(){return[{provide:Tt,useExisting:mm},{provide:Oe,useClass:Eo},{provide:Oo,useValue:!0}]}function nE(){return typeof $localize<"u"&&$localize.locale||Zo}var vl=new Y("",{factory:()=>w(vl,{optional:!0,skipSelf:!0})||nE()});var Qr=class{destroyed=!1;listeners=null;errorHandler=w(We,{optional:!0});isEmitting=!1;hasNullListeners=!1;destroyRef=w(ge);constructor(){this.destroyRef.onDestroy(()=>{this.destroyed=!0,this.listeners=null})}subscribe(e){if(this.destroyed)throw new U(953,!1);return(this.listeners??=[]).push(e),{unsubscribe:()=>{let n=this.listeners?this.listeners.indexOf(e):-1;n>-1&&(this.isEmitting?(this.hasNullListeners=!0,this.listeners[n]=null):this.listeners.splice(n,1))}}}emit(e){if(this.destroyed){console.warn(xo(953,!1));return}if(this.listeners===null)return;this.isEmitting=!0;let n=V(null);try{for(let o of this.listeners)try{o!==null&&o(e)}catch(i){this.errorHandler?.handleError(i)}}finally{this.hasNullListeners&&(this.hasNullListeners=!1,this.listeners&&oE(this.listeners)),V(n),this.isEmitting=!1}}};function oE(t){let e=t.length-1;for(;e>-1;)t[e]===null&&t.splice(e,1),e--}function _(t,e){return ho(t,e?.equal)}function Ye(t){return Ld(t)}var gm=class t extends Error{_brand;constructor(e){super(e)}static IDLE=new t("IDLE");static LOADING=new t("LOADING")};function _m(t,e){let n=Object.create(Mf);n.value=t,n.transformFn=e?.transform;function o(){if(Rt(n),n.value===Hc){let i=null;throw new U(-950,i)}return n.value}return o[Ee]=n,o}function eo(t){return new Qr}function ym(t,e){return _m(t,e)}function uE(t){return _m(Hc,t)}var to=(ym.required=uE,ym);function vm(t,e){return Qp(e)}function fE(t,e){return Yp(e)}var Ue=(vm.required=fE,vm);var pE=1e4;var LP=pE-1e3;var _l=new Y(""),mE=new Y("");function Yo(t){return!t.moduleRef}function hE(t){let e=Yo(t)?t.r3Injector:t.moduleRef.injector,n=e.get(Oe);return n.run(()=>{Yo(t)?t.r3Injector.resolveInjectorInitializers():t.moduleRef.resolveInjectorInitializers();let o=e.get(gn),i;if(n.runOutsideAngular(()=>{i=n.onError.subscribe({next:o})}),Yo(t)){let r=()=>e.destroy(),s=t.platformInjector.get(_l);s.add(r),e.onDestroy(()=>{i.unsubscribe(),s.delete(r)})}else{let r=()=>t.moduleRef.destroy(),s=t.platformInjector.get(_l);s.add(r),t.moduleRef.onDestroy(()=>{Lo(t.allPlatformModules,t.moduleRef),i.unsubscribe(),s.delete(r)})}return yE(o,n,()=>{let r=e.get(Un),s=r.add(),a=e.get(fl);return a.runInitializers(),a.donePromise.then(()=>{let c=e.get(vl,Zo);if(im(c||Zo),!e.get(mE,!0))return Yo(t)?e.get(qr):(t.allPlatformModules.push(t.moduleRef),t.moduleRef);if(Yo(t)){let f=e.get(qr);return t.rootComponent!==void 0&&f.bootstrap(t.rootComponent),f}else return gE?.(t.moduleRef,t.allPlatformModules),t.moduleRef}).finally(()=>{r.remove(s)})})})}var gE;function yE(t,e,n){try{let o=n();return ul(o)?o.catch(i=>{throw e.runOutsideAngular(()=>t(i)),i}):o}catch(o){throw e.runOutsideAngular(()=>t(o)),o}}var Yr=null;function vE(t=[],e){return Ce.create({name:e,providers:[{provide:wo,useValue:"platform"},{provide:_l,useValue:new Set([()=>Yr=null])},...t]})}function bE(t=[]){if(Yr)return Yr;let e=vE(t);return Yr=e,nm(),_E(e),e}function _E(t){let e=t.get(pr,null);Yi(t,()=>{e?.forEach(n=>n())})}function Em(t){let{rootComponent:e,appProviders:n,platformProviders:o,platformRef:i}=t;ee(X.BootstrapApplicationStart);try{let r=i?.injector??bE(o),s=[hm(),qu,...n||[]],a=new Wo({providers:s,parent:r,debugName:"",runEnvironmentInitializers:!1});return hE({r3Injector:a.injector,platformInjector:r,rootComponent:e})}catch(r){return Promise.reject(r)}finally{ee(X.BootstrapApplicationEnd)}}var bl=Symbol("NOT_SET"),xm=new Set,EE=x(y({},Dn),{kind:"afterRenderEffectPhase",consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,value:bl,cleanup:null,consumerMarkedDirty(){if(this.sequence.impl.executing){if(this.sequence.lastPhase===null||this.sequence.lastPhase<this.phase)return;this.sequence.erroredOrDestroyed=!0}this.sequence.scheduler.notify(7)},phaseFn(t){if(this.sequence.lastPhase=this.phase,!this.dirty)return this.signal;if(this.dirty=!1,this.value!==bl&&!wn(this))return this.signal;try{for(let i of this.cleanup??xm)i()}finally{this.cleanup?.clear()}let e=[];t!==void 0&&e.push(t),e.push(this.registerCleanupFn);let n=At(this),o;try{o=this.userFn.apply(null,e)}finally{Yt(this,n)}return(this.value===bl||!this.equal(this.value,o))&&(this.value=o,this.version++),this.signal}}),El=class extends jo{scheduler;lastPhase=null;nodes=[void 0,void 0,void 0,void 0];onDestroyFns=null;constructor(e,n,o,i,r,s=null,a){super(e,[void 0,void 0,void 0,void 0],o,!1,r.get(ge),s),this.scheduler=i;for(let c of Jc){let d=n[c];if(d===void 0)continue;let f=Object.create(EE);f.sequence=this,f.phase=c,f.userFn=d,f.dirty=!0,f.signal=()=>(Rt(f),f.value),f.signal[Ee]=f,f.registerCleanupFn=g=>(f.cleanup??=new Set).add(g),this.nodes[c]=f,this.hooks[c]=g=>f.phaseFn(g)}}afterRun(){super.afterRun(),this.lastPhase=null}destroy(){if(this.onDestroyFns!==null)for(let e of this.onDestroyFns)e();super.destroy();for(let e of this.nodes)if(e)try{for(let n of e.cleanup??xm)n()}finally{Ot(e)}}};function Cm(t,e){let n=e?.injector??w(Ce),o=n.get(Tt),i=n.get($r),r=n.get(vt,null,{optional:!0});i.impl??=n.get(Xc);let s=t;typeof s=="function"&&(s={mixedReadWrite:t});let a=n.get(Gn,null,{optional:!0}),c=new El(i.impl,[s.earlyRead,s.write,s.mixedReadWrite,s.read],a?.view,o,n,r?.snapshot(null),void 0);return i.impl.register(c),c}function Im(){return!1}var Sm=null;function Xo(){return Sm}function xl(t){Sm??=t}var Jo=class{};function Cl(t,e){e=encodeURIComponent(e);for(let n of t.split(";")){let o=n.indexOf("="),[i,r]=o==-1?[n,""]:[n.slice(0,o),n.slice(o+1)];if(i.trim()!==e)continue;let s=r;try{s=decodeURIComponent(r)}catch{}return s.length>1&&s[0]==='"'&&s[s.length-1]==='"'&&(s=s.slice(1,-1)),s}return null}var wm="browser";var ei=class{_doc;constructor(e){this._doc=e}manager},Jr=(()=>{class t extends ei{constructor(n){super(n)}supports(n){return!0}addEventListener(n,o,i,r){return n.addEventListener(o,i,r),()=>this.removeEventListener(n,o,i,r)}removeEventListener(n,o,i,r){return n.removeEventListener(o,i,r)}static \u0275fac=function(o){return new(o||t)(te(Ne))};static \u0275prov=K({token:t,factory:t.\u0275fac})}return t})(),ts=new Y(""),Tl=(()=>{class t{_zone;_plugins;_eventNameToPlugin=new Map;constructor(n,o){this._zone=o,n.forEach(s=>{s.manager=this});let i=n.filter(s=>!(s instanceof Jr));this._plugins=i.slice().reverse();let r=n.find(s=>s instanceof Jr);r&&this._plugins.push(r)}addEventListener(n,o,i,r){return this._findPluginFor(o).addEventListener(n,o,i,r)}getZone(){return this._zone}_findPluginFor(n){let o=this._eventNameToPlugin.get(n);if(o)return o;if(o=this._plugins.find(r=>r.supports(n)),!o)throw new U(-5101,!1);return this._eventNameToPlugin.set(n,o),o}static \u0275fac=function(o){return new(o||t)(te(ts),te(Oe))};static \u0275prov=K({token:t,factory:t.\u0275fac})}return t})(),Il="ng-app-id";function Tm(t){for(let e of t)e.remove()}function Dm(t,e){let n=e.createElement("style");return n.textContent=t,n}function xE(t,e,n,o){let i=t.head?.querySelectorAll(`style[${Il}="${e}"],link[${Il}="${e}"]`);if(!i||i.length===0)return!1;for(let r of i)r.removeAttribute(Il),r instanceof HTMLLinkElement?o.set(r.href.slice(r.href.lastIndexOf("/")+1),{usage:0,elements:[r]}):r.textContent&&n.set(r.textContent,{usage:0,elements:[r]});return!0}function wl(t,e){let n=e.createElement("link");return n.setAttribute("rel","stylesheet"),n.setAttribute("href",t),n}var Dl=(()=>{class t{doc;appId;nonce;inline=new Map;external=new Map;hosts=new Set;constructor(n,o,i,r={}){this.doc=n,this.appId=o,this.nonce=i,xE(n,o,this.inline,this.external)&&this.hosts.add(n.head)}addStyles(n,o){for(let i of n)this.addUsage(i,this.inline,Dm);o?.forEach(i=>this.addUsage(i,this.external,wl))}removeStyles(n,o){for(let i of n)this.removeUsage(i,this.inline);o?.forEach(i=>this.removeUsage(i,this.external))}addUsage(n,o,i){let r=o.get(n);r?r.usage++:o.set(n,{usage:1,elements:[...this.hosts].map(s=>this.addElement(s,i(n,this.doc)))})}removeUsage(n,o){let i=o.get(n);i&&(i.usage--,i.usage<=0&&(Tm(i.elements),o.delete(n)))}ngOnDestroy(){for(let[,{elements:n}]of[...this.inline,...this.external])Tm(n);this.hosts.clear()}addHost(n){if(!this.hosts.has(n)){this.hosts.add(n);for(let[o,{elements:i}]of this.inline)i.push(this.addElement(n,Dm(o,this.doc)));for(let[o,{elements:i}]of this.external)i.push(this.addElement(n,wl(o,this.doc)))}}removeHost(n){this.hosts.delete(n);for(let o of[...this.inline.values(),...this.external.values()]){let i=[];for(let r of o.elements)r.parentNode===n?r.remove():i.push(r);o.elements=i}}addElement(n,o){return this.nonce&&o.setAttribute("nonce",this.nonce),n.appendChild(o)}static \u0275fac=function(o){return new(o||t)(te(Ne),te(Ro),te(mr,8),te(Ao))};static \u0275prov=K({token:t,factory:t.\u0275fac})}return t})(),Sl={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/Math/MathML"},Ml=/%COMP%/g;var Nm="%COMP%",CE=`_nghost-${Nm}`,IE=`_ngcontent-${Nm}`,SE=!0,wE=new Y("",{factory:()=>SE}),TE=new Y("");function DE(t){return IE.replace(Ml,t)}function ME(t){return CE.replace(Ml,t)}function km(t,e){return e.map(n=>n.replace(Ml,t))}var Nl=(()=>{class t{eventManager;sharedStylesHost;appId;removeStylesOnCompDestroy;doc;ngZone;nonce;tracingService;rendererByCompId=new Map;defaultRenderer;cssVarNamespace;constructor(n,o,i,r,s,a,c=null,d=null,f=null){this.eventManager=n,this.sharedStylesHost=o,this.appId=i,this.removeStylesOnCompDestroy=r,this.doc=s,this.ngZone=a,this.nonce=c,this.tracingService=d,this.cssVarNamespace=f??"",this.defaultRenderer=new ti(n,s,a,this.tracingService,this.cssVarNamespace)}createRenderer(n,o){if(!n||!o)return this.defaultRenderer;let i=this.getOrCreateRenderer(n,o);return i instanceof es?i.applyToHost(n):i instanceof ni&&i.applyStyles(),i}getOrCreateRenderer(n,o){let i=this.rendererByCompId,r=i.get(o.id);if(!r){let s=this.doc,a=this.ngZone,c=this.eventManager,d=this.sharedStylesHost,f=this.removeStylesOnCompDestroy,g=this.tracingService;switch(o.encapsulation){case ct.Emulated:r=new es(c,d,o,this.appId,f,s,a,g,this.cssVarNamespace);break;case ct.ShadowDom:return new Xr(c,n,o,s,a,this.nonce,g,this.cssVarNamespace,d);case ct.ExperimentalIsolatedShadowDom:return new Xr(c,n,o,s,a,this.nonce,g,this.cssVarNamespace);default:r=new ni(c,d,o,f,s,a,g,this.cssVarNamespace);break}i.set(o.id,r)}return r}ngOnDestroy(){this.rendererByCompId.clear()}componentReplaced(n){this.rendererByCompId.delete(n)}static \u0275fac=function(o){return new(o||t)(te(Tl),te(_n),te(Ro),te(wE),te(Ne),te(Oe),te(mr),te(vt,8),te(TE,8))};static \u0275prov=K({token:t,factory:t.\u0275fac})}return t})(),ti=class{eventManager;doc;ngZone;tracingService;cssVarNamespace;data=Object.create(null);throwOnSyntheticProps=!0;constructor(e,n,o,i,r=""){this.eventManager=e,this.doc=n,this.ngZone=o,this.tracingService=i,this.cssVarNamespace=r}destroy(){}destroyNode=null;createElement(e,n){return n?this.doc.createElementNS(Sl[n]||n,e):this.doc.createElement(e)}createComment(e){return this.doc.createComment(e)}createText(e){return this.doc.createTextNode(e)}appendChild(e,n){(Mm(e)?e.content:e).appendChild(n)}insertBefore(e,n,o){if(e){let i=Mm(e)?e.content:e;if(o!=null&&o.parentNode!==i)throw new U(-5106,!1);i.insertBefore(n,o)}}removeChild(e,n){n.remove()}selectRootElement(e,n){let o=typeof e=="string"?this.doc.querySelector(e):e;if(!o)throw new U(-5104,!1);return n||(o.textContent=""),o}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,n,o,i){if(i){n=i+":"+n;let r=Sl[i];r?e.setAttributeNS(r,n,o):e.setAttribute(n,o)}else e.setAttribute(n,o)}removeAttribute(e,n,o){if(o){let i=Sl[o];i?e.removeAttributeNS(i,n):e.removeAttribute(`${o}:${n}`)}else e.removeAttribute(n)}addClass(e,n){e.classList.add(n)}removeClass(e,n){e.classList.remove(n)}setStyle(e,n,o,i){let r=n.startsWith("--");r&&(n=n.replace("%NS%",this.cssVarNamespace)),r||i&(Nt.DashCase|Nt.Important)?e.style.setProperty(n,o,i&Nt.Important?"important":""):e.style[n]=o}removeStyle(e,n,o){let i=n.startsWith("--");i&&(n=n.replace("%NS%",this.cssVarNamespace)),i||o&Nt.DashCase?e.style.removeProperty(n):e.style[n]=""}setProperty(e,n,o){e!=null&&(e[n]=o)}setValue(e,n){e.nodeValue=n}listen(e,n,o,i){if(typeof e=="string"&&(e=Xo().getGlobalEventTarget(this.doc,e),!e))throw new U(-5102,!1);let r=this.decoratePreventDefault(o);return this.tracingService?.wrapEventListener&&(r=this.tracingService.wrapEventListener(e,n,r)),this.eventManager.addEventListener(e,n,r,i)}decoratePreventDefault(e){return n=>{if(n==="__ngUnwrap__")return e;e(n)===!1&&n.preventDefault()}}};function Mm(t){return t.tagName==="TEMPLATE"&&t.content!==void 0}var Xr=class extends ti{hostEl;sharedStylesHost;shadowRoot;constructor(e,n,o,i,r,s,a,c,d){super(e,i,r,a,c),this.hostEl=n,this.sharedStylesHost=d,this.shadowRoot=n.attachShadow({mode:"open"}),this.sharedStylesHost&&this.sharedStylesHost.addHost(this.shadowRoot);let f=o.styles;f=km(o.id,f).map(C=>C.replace(/%NS%/g,c));for(let C of f){let E=document.createElement("style");s&&E.setAttribute("nonce",s),E.textContent=C,this.shadowRoot.appendChild(E)}let g=o.getExternalStyles?.();if(g)for(let C of g){let E=wl(C,i);s&&E.setAttribute("nonce",s),this.shadowRoot.appendChild(E)}}nodeOrShadowRoot(e){return e===this.hostEl?this.shadowRoot:e}appendChild(e,n){return super.appendChild(this.nodeOrShadowRoot(e),n)}insertBefore(e,n,o){return super.insertBefore(this.nodeOrShadowRoot(e),n,o)}removeChild(e,n){return super.removeChild(null,n)}parentNode(e){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(e)))}destroy(){this.sharedStylesHost&&this.sharedStylesHost.removeHost(this.shadowRoot)}},ni=class extends ti{sharedStylesHost;removeStylesOnCompDestroy;styles;styleUrls;constructor(e,n,o,i,r,s,a,c,d){super(e,r,s,a,c),this.sharedStylesHost=n,this.removeStylesOnCompDestroy=i;let f=o.styles,g=d?km(d,f):f;this.styles=g.map(C=>C.replace(/%NS%/g,c)),this.styleUrls=o.getExternalStyles?.(d)}applyStyles(){this.sharedStylesHost.addStyles(this.styles,this.styleUrls)}destroy(){this.removeStylesOnCompDestroy&&Yc.size===0&&this.sharedStylesHost.removeStyles(this.styles,this.styleUrls)}},es=class extends ni{contentAttr;hostAttr;constructor(e,n,o,i,r,s,a,c,d){let f=i+"-"+o.id;super(e,n,o,r,s,a,c,d,f),this.contentAttr=DE(f),this.hostAttr=ME(f)}applyToHost(e){this.applyStyles(),this.setAttribute(e,this.hostAttr,"")}createElement(e,n){let o=super.createElement(e,n);return super.setAttribute(o,this.contentAttr,""),o}};var ns=class t extends Jo{supportsDOMEvents=!0;static makeCurrent(){xl(new t)}onAndCancel(e,n,o,i){return e.addEventListener(n,o,i),()=>{e.removeEventListener(n,o,i)}}dispatchEvent(e,n){e.dispatchEvent(n)}remove(e){e.remove()}createElement(e,n){return n=n||this.getDefaultDocument(),n.createElement(e)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(e){return e.nodeType===Node.ELEMENT_NODE}isShadowRoot(e){return e instanceof DocumentFragment}getGlobalEventTarget(e,n){return n==="window"?window:n==="document"?e:n==="body"?e.body:null}getBaseHref(e){let n=NE();return n==null?null:kE(n)}resetBaseElement(){oi=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return Cl(document.cookie,e)}},oi=null;function NE(){return oi=oi||document.head.querySelector("base"),oi?oi.getAttribute("href"):null}function kE(t){return new URL(t,document.baseURI).pathname}var Rm=["alt","control","meta","shift"],RE={"\b":"Backspace"," ":"Tab","\x7F":"Delete","\x1B":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},AE={alt:t=>t.altKey,control:t=>t.ctrlKey,meta:t=>t.metaKey,shift:t=>t.shiftKey},Am=(()=>{class t extends ei{constructor(n){super(n)}supports(n){return t.parseEventName(n)!=null}addEventListener(n,o,i,r){let s=t.parseEventName(o),a=t.eventCallback(s.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>Xo().onAndCancel(n,s.domEventName,a,r))}static parseEventName(n){let o=n.toLowerCase().split("."),i=o.shift();if(o.length===0||!(i==="keydown"||i==="keyup"))return null;let r=t._normalizeKey(o.pop()),s="",a=o.indexOf("code");if(a>-1&&(o.splice(a,1),s="code."),Rm.forEach(d=>{let f=o.indexOf(d);f>-1&&(o.splice(f,1),s+=d+".")}),s+=r,o.length!=0||r.length===0)return null;let c={};return c.domEventName=i,c.fullKey=s,c}static matchEventFullKeyCode(n,o){let i=RE[n.key]||n.key,r="";return o.indexOf("code.")>-1&&(i=n.code,r="code."),i==null||!i?!1:(i=i.toLowerCase(),i===" "?i="space":i==="."&&(i="dot"),Rm.forEach(s=>{if(s!==i){let a=AE[s];a(n)&&(r+=s+".")}}),r+=i,r===o)}static eventCallback(n,o,i){return r=>{t.matchEventFullKeyCode(r,n)&&i.runGuarded(()=>o(r))}}static _normalizeKey(n){return n==="esc"?"escape":n}static \u0275fac=function(o){return new(o||t)(te(Ne))};static \u0275prov=K({token:t,factory:t.\u0275fac})}return t})();async function kl(t,e,n){let o=y({rootComponent:t},OE(e,n));return Em(o)}function OE(t,e){return{platformRef:e?.platformRef,appProviders:[...jE,...t?.providers??[]],platformProviders:VE}}function PE(){ns.makeCurrent()}function LE(){return new We}function FE(){return Wc(document),document}var VE=[{provide:Ao,useValue:wm},{provide:pr,useValue:PE,multi:!0},{provide:Ne,useFactory:FE}];var jE=[{provide:wo,useValue:"root"},{provide:We,useFactory:LE},{provide:ts,useClass:Jr,multi:!0},{provide:ts,useClass:Am,multi:!0},Nl,{provide:_n,useClass:Dl},{provide:Dl,useExisting:_n},Tl,{provide:vn,useExisting:Nl},[]];var Om={providers:[ic()]};var le=class t{loadDelayMs=100;ready=A(!1);project=A(null);timeline=A(null);validation=A(null);readTime=A(null);missingSpeech=A([]);time=A(0);playing=A(!1);error=A(null);speechDurations={};target=null;targetOrigin="*";pending=null;last=null;loadTimer=null;lastSeekAt=-1/0;echoWindowMs=300;constructor(){let e=n=>this.handleMessage(n);globalThis.addEventListener?.("message",e),w(ge).onDestroy(()=>{globalThis.removeEventListener?.("message",e),this.clearTimer()})}attach(e,n="*"){this.target=e,this.targetOrigin=n,this.ready.set(!1)}detach(){this.target=null,this.ready.set(!1),this.clearTimer()}handleMessage(e){if(!this.target||e.source!==this.target)return;let n=e.data;if(!(!n||typeof n!="object"||n.source!=="beatsheet-player"))switch(n.type){case"ready":this.project.set(n.project),this.ready.set(!0),this.error.set(null),(this.pending??this.last)&&(this.pending=this.pending??this.last,this.flush());break;case"timeline":this.timeline.set(n.timeline),this.validation.set(n.validation),this.error.set(null);break;case"time":if(!n.playing&&!this.playing()&&Date.now()-this.lastSeekAt<this.echoWindowMs)break;this.time.set(n.t),this.playing.set(n.playing);break;case"readTime":this.readTime.set({format:n.format,issues:n.issues});break;case"audio":this.missingSpeech.set(n.missingSpeech);break;case"error":this.error.set(n.message);break}}requestLoad(e,n){this.pending={doc:e,format:n},!(!this.ready()||this.loadTimer!==null)&&(this.loadTimer=setTimeout(()=>{this.loadTimer=null,this.flush()},this.loadDelayMs))}flush(){if(this.clearTimer(),!this.pending||!this.ready())return;let{doc:e,format:n}=this.pending;this.pending=null,this.last={doc:e,format:n};let o=this.speechDurations;this.send(y({type:"load",doc:e,format:n},Object.keys(o).length?{speechDurations:o}:{}))}reload(){this.pending=this.pending??this.last,this.flush()}seek(e){let n=Math.max(0,e);this.time.set(n),this.lastSeekAt=Date.now(),this.send({type:"seek",t:n})}play(e=this.time()){this.pending&&this.flush();let n=this.timeline();n&&e>=n.duration-1/n.fps&&(e=0),this.playing.set(!0),this.send({type:"play",from:e})}pause(){this.playing.set(!1),this.send({type:"pause"})}togglePlay(){this.playing()?this.pause():this.play()}send(e){if(!this.target||!this.ready())return;let n=y({source:"beatsheet-studio"},e);this.target.postMessage(n,this.targetOrigin)}clearTimer(){this.loadTimer!==null&&(clearTimeout(this.loadTimer),this.loadTimer=null)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};function En(t,e=0,n=1){return t<e?e:t>n?n:t}var Rl={linear:t=>En(t),outCubic:t=>1-Math.pow(1-En(t),3),inOutCubic:t=>{let e=En(t);return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2},outQuart:t=>1-Math.pow(1-En(t),4),outBack:t=>{let e=En(t),n=1.70158;return 1+(n+1)*Math.pow(e-1,3)+n*Math.pow(e-1,2)}};var os=["cut","dip","slide","zoom","wipe","iris"],is=["left","right","up","down"],$E="left";var PL=1/3;function ii(t){return t==="dip"||t==="slide"||t==="zoom"?"through":t==="wipe"||t==="iris"?"reveal":"cut"}function Al(t){return os.includes(t)}function rs(t){return t==="slide"||t==="wipe"}function Pm(t){return is.includes(t.direction)?t.direction:$E}function BE(t){let e=t&&t.duration>0?t.duration:0,n=ii(t?.kind);return n==="through"?{before:e/2,after:e/2}:n==="reveal"?{before:0,after:e}:{before:0,after:0}}function Lm(t,e){let{before:n,after:o}=BE(t);return n+o>0?{from:e-n,to:e+o}:null}var no=["none","aurora","grid","dots"];var HE="--bs-backdrop-alpha";var VL=1/600;var UE=2,Fm=32;function Vm(t,e=UE){let n=10**e,o=Math.round(t*n)/n;return o===0?0:o}function Bm(t){let e=[];for(let n=0;n<=Fm;n++){let o=n/Fm,i=(1-o*o)**2*100;e.push(`color-mix(in srgb,var(--${t}) ${Vm(i,1)}%,transparent) ${Vm(o*100,1)}%`)}return e.join(",")}var jm="62%",$m=`radial-gradient(ellipse ${jm} ${jm} at 50% 50%,${Bm("bs-fg")})`,jL=`
|
|
3
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=n});function go(t,e){if(t){let n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Me=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:n}=this;if(n)if(this._parentage=null,Array.isArray(n))for(let r of n)r.remove(this);else n.remove(this);let{initialTeardown:o}=this;if(Ae(o))try{o()}catch(r){e=r instanceof Mi?r.errors:[r]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let r of i)try{Vd(r)}catch(s){e=e??[],s instanceof Mi?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Mi(e)}}add(e){var n;if(e&&e!==this)if(this.closed)Vd(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}}_hasParent(e){let{_parentage:n}=this;return n===e||Array.isArray(n)&&n.includes(e)}_addParent(e){let{_parentage:n}=this;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e}_removeParent(e){let{_parentage:n}=this;n===e?this._parentage=null:Array.isArray(n)&&go(n,e)}remove(e){let{_finalizers:n}=this;n&&go(n,e),e instanceof t&&e._removeParent(this)}};Me.EMPTY=(()=>{let t=new Me;return t.closed=!0,t})();var oa=Me.EMPTY;function Ni(t){return t instanceof Me||t&&"closed"in t&&Ae(t.remove)&&Ae(t.add)&&Ae(t.unsubscribe)}function Vd(t){Ae(t)?t():t.unsubscribe()}var nt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Nn={setTimeout(t,e,...n){let{delegate:o}=Nn;return o?.setTimeout?o.setTimeout(t,e,...n):setTimeout(t,e,...n)},clearTimeout(t){let{delegate:e}=Nn;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function jd(t){Nn.setTimeout(()=>{let{onUnhandledError:e}=nt;if(e)e(t);else throw t})}function ia(){}var $d=ra("C",void 0,void 0);function Bd(t){return ra("E",void 0,t)}function Hd(t){return ra("N",t,void 0)}function ra(t,e,n){return{kind:t,value:e,error:n}}var Xt=null;function kn(t){if(nt.useDeprecatedSynchronousErrorHandling){let e=!Xt;if(e&&(Xt={errorThrown:!1,error:null}),t(),e){let{errorThrown:n,error:o}=Xt;if(Xt=null,n)throw o}}else t()}function Ud(t){nt.useDeprecatedSynchronousErrorHandling&&Xt&&(Xt.errorThrown=!0,Xt.error=t)}var en=class extends Me{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Ni(e)&&e.add(this)):this.destination=_y}static create(e,n,o){return new Rn(e,n,o)}next(e){this.isStopped?aa(Hd(e),this):this._next(e)}error(e){this.isStopped?aa(Bd(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?aa($d,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},vy=Function.prototype.bind;function sa(t,e){return vy.call(t,e)}var ca=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:n}=this;if(n.next)try{n.next(e)}catch(o){ki(o)}}error(e){let{partialObserver:n}=this;if(n.error)try{n.error(e)}catch(o){ki(o)}else ki(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(n){ki(n)}}},Rn=class extends en{constructor(e,n,o){super();let i;if(Ae(e)||!e)i={next:e??void 0,error:n??void 0,complete:o??void 0};else{let r;this&&nt.useDeprecatedNextContext?(r=Object.create(e),r.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&sa(e.next,r),error:e.error&&sa(e.error,r),complete:e.complete&&sa(e.complete,r)}):i=e}this.destination=new ca(i)}};function ki(t){nt.useDeprecatedSynchronousErrorHandling?Ud(t):jd(t)}function by(t){throw t}function aa(t,e){let{onStoppedNotification:n}=nt;n&&Nn.setTimeout(()=>n(t,e))}var _y={closed:!0,next:ia,error:by,complete:ia};var Gd=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Wd(t){return t}function zd(t){return t.length===0?Wd:t.length===1?t[0]:function(n){return t.reduce((o,i)=>i(o),n)}}var ft=class t{constructor(e){e&&(this._subscribe=e)}lift(e){let n=new t;return n.source=this,n.operator=e,n}subscribe(e,n,o){let i=xy(e)?e:new Rn(e,n,o);return kn(()=>{let{operator:r,source:s}=this;i.add(r?r.call(i,s):s?this._subscribe(i):this._trySubscribe(i))}),i}_trySubscribe(e){try{return this._subscribe(e)}catch(n){e.error(n)}}forEach(e,n){return n=qd(n),new n((o,i)=>{let r=new Rn({next:s=>{try{e(s)}catch(a){i(a),r.unsubscribe()}},error:i,complete:o});this.subscribe(r)})}_subscribe(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)}[Gd](){return this}pipe(...e){return zd(e)(this)}toPromise(e){return e=qd(e),new e((n,o)=>{let i;this.subscribe(r=>i=r,r=>o(r),()=>n(i))})}};ft.create=t=>new ft(t);function qd(t){var e;return(e=t??nt.Promise)!==null&&e!==void 0?e:Promise}function Ey(t){return t&&Ae(t.next)&&Ae(t.error)&&Ae(t.complete)}function xy(t){return t&&t instanceof en||Ey(t)&&Ni(t)}function Cy(t){return Ae(t?.lift)}function Kd(t){return e=>{if(Cy(e))return e.lift(function(n){try{return t(n,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}function Zd(t,e,n,o,i){return new la(t,e,n,o,i)}var la=class extends en{constructor(e,n,o,i,r,s){super(e),this.onFinalize=r,this.shouldUnsubscribe=s,this._next=n?function(a){try{n(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=o?function(){try{o()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:n}=this;super.unsubscribe(),!n&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};var Qd=Di(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var We=class extends ft{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(e){let n=new Ri(this,this);return n.operator=e,n}_throwIfClosed(){if(this.closed)throw new Qd}next(e){kn(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(e)}})}error(e){kn(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=e;let{observers:n}=this;for(;n.length;)n.shift().error(e)}})}complete(){kn(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:e}=this;for(;e.length;)e.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0}_trySubscribe(e){return this._throwIfClosed(),super._trySubscribe(e)}_subscribe(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)}_innerSubscribe(e){let{hasError:n,isStopped:o,observers:i}=this;return n||o?oa:(this.currentObservers=null,i.push(e),new Me(()=>{this.currentObservers=null,go(i,e)}))}_checkFinalizedStatuses(e){let{hasError:n,thrownError:o,isStopped:i}=this;n?e.error(o):i&&e.complete()}asObservable(){let e=new ft;return e.source=this,e}};We.create=(t,e)=>new Ri(t,e);var Ri=class extends We{constructor(e,n){super(),this.destination=e,this.source=n}next(e){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,e)}error(e){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,e)}complete(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)}_subscribe(e){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&o!==void 0?o:oa}};var yo=class extends We{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let n=super._subscribe(e);return!n.closed&&e.next(this._value),n}getValue(){let{hasError:e,thrownError:n,_value:o}=this;if(e)throw n;return this._throwIfClosed(),o}next(e){super.next(this._value=e)}};function da(t,e){return Kd((n,o)=>{let i=0;n.subscribe(Zd(o,r=>{o.next(t.call(e,r,i++))}))})}var U=class extends Error{code;constructor(e,n){super(xo(e,n)),this.code=e}};function Iy(t){return`NG0${Math.abs(t)}`}function xo(t,e){return`${Iy(t)}${e?": "+e:""}`}function ne(t){for(let e in t)if(t[e]===ne)return e;throw Error("")}function $i(t){if(typeof t=="string")return t;if(Array.isArray(t))return`[${t.map($i).join(", ")}]`;if(t==null)return""+t;let e=t.overriddenName||t.name;if(e)return`${e}`;let n=t.toString();if(n==null)return""+n;let o=n.indexOf(`
|
|
4
|
+
`);return o>=0?n.slice(0,o):n}function Bi(t,e){return t?e?`${t} ${e}`:t:e||""}var Sy=ne({__forward_ref__:ne});function Hi(t){return t.__forward_ref__=Hi,t}function Fe(t){return tu(t)?t():t}function tu(t){return typeof t=="function"&&Object.hasOwn(t,Sy)&&t.__forward_ref__===Hi}function K(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}function Ui(t){return wy(t,Gi)}function wy(t,e){return Object.hasOwn(t,e)&&t[e]||null}function Ty(t){let e=t?.[Gi]??null;return e||null}function fa(t){return t&&Object.hasOwn(t,Oi)?t[Oi]:null}var Gi=ne({\u0275prov:ne}),Oi=ne({\u0275inj:ne}),J=class{_desc;ngMetadataName="InjectionToken";\u0275prov;constructor(e,n){this._desc=e,this.\u0275prov=void 0,typeof n=="number"?this.__NG_ELEMENT_ID__=n:n!==void 0&&(this.\u0275prov=K({token:this,providedIn:n.providedIn||"root",factory:n.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}};function Sa(t){return t&&!!t.\u0275providers}var wa=ne({\u0275cmp:ne}),Ta=ne({\u0275dir:ne}),Da=ne({\u0275pipe:ne});var pa=ne({\u0275fac:ne}),rn=ne({__NG_ELEMENT_ID__:ne}),Yd=ne({__NG_ENV_ID__:ne});function sn(t){return Ma(t,"@Component"),t[wa]||null}function Wi(t){return Ma(t,"@Directive"),t[Ta]||null}function nu(t){return Ma(t,"@Pipe"),t[Da]||null}function Ma(t,e){if(t==null)throw new U(-919,!1)}function Ve(t){return typeof t=="string"?t:t==null?"":String(t)}var ou=ne({ngErrorCode:ne}),Dy=ne({ngErrorMessage:ne}),My=ne({ngTokenPath:ne});function Na(t,e){return iu("",-200,e)}function zi(t,e){throw new U(-201,!1)}function iu(t,e,n){let o=new U(e,t);return o[ou]=e,o[Dy]=t,n&&(o[My]=n),o}function Ny(t){return t[ou]}var ma;function ru(){return ma}function Le(t){let e=ma;return ma=t,e}function ka(t,e,n){let o=Ui(t);if(o&&o.providedIn=="root")return o.value===void 0?o.value=o.factory():o.value;if(n&8)return null;if(e!==void 0)return e;zi(t,"")}var Co=globalThis;var ky={},tn=ky,Ry="__NG_DI_FLAG__",ha=class{injector;constructor(e){this.injector=e}retrieve(e,n){let o=nn(n)||0;try{return this.injector.get(e,o&8?null:tn,o)}catch(i){if(Mn(i))return i;throw i}}};function Ay(t,e=0){let n=Ti();if(n===void 0)throw new U(-203,!1);if(n===null)return ka(t,void 0,e);{let o=Oy(e),i=n.retrieve(t,o);if(Mn(i)){if(o.optional)return null;throw i}return i}}function te(t,e=0){return(ru()||Ay)(Fe(t),e)}function w(t,e){return te(t,nn(e))}function nn(t){return typeof t>"u"||typeof t=="number"?t:0|(t.optional&&8)|(t.host&&1)|(t.self&&2)|(t.skipSelf&&4)}function Oy(t){return{optional:!!(t&8),host:!!(t&1),self:!!(t&2),skipSelf:!!(t&4)}}function ga(t){let e=[];for(let n=0;n<t.length;n++){let o=Fe(t[n]);if(Array.isArray(o)){if(o.length===0)throw new U(900,!1);let i,r=0;for(let s=0;s<o.length;s++){let a=o[s],c=Py(a);typeof c=="number"?c===-1?i=a.token:r|=c:i=a}e.push(te(i,r))}else e.push(te(o))}return e}function Py(t){return t[Ry]}function On(t,e){let n=Object.hasOwn(t,pa);return n?t[pa]:null}function su(t,e,n){if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++){let i=t[o],r=e[o];if(n&&(i=n(i),r=n(r)),r!==i)return!1}return!0}function au(t){return t.flat(Number.POSITIVE_INFINITY)}function qi(t,e){t.forEach(n=>Array.isArray(n)?qi(n,e):e(n))}function Ra(t,e,n){e>=t.length?t.push(n):t.splice(e,0,n)}function Io(t,e){return e>=t.length-1?t.pop():t.splice(e,1)[0]}function cu(t,e,n,o){let i=t.length;if(i==e)t.push(n,o);else if(i===1)t.push(o,t[0]),t[0]=n;else{for(i--,t.push(t[i-1],t[i]);i>e;){let r=i-2;t[i]=t[r],i--}t[e]=n,t[e+1]=o}}function Ki(t,e,n){let o=Ln(t,e);return o>=0?t[o|1]=n:(o=~o,cu(t,o,e,n)),o}function Zi(t,e){let n=Ln(t,e);if(n>=0)return t[n|1]}function Ln(t,e){return Ly(t,e,1)}function Ly(t,e,n){let o=0,i=t.length>>n;for(;i!==o;){let r=o+(i-o>>1),s=t[r<<n];if(e===s)return r<<n;s>e?i=r:o=r+1}return~(i<<n)}var Qi={},ot=[],Fn=new J(""),Aa=new J("",-1),Oa=new J(""),Pn=class{get(e,n=tn){if(n===tn){let i=iu("",-201);throw i.name="\u0275NotFound",i}return n}};function So(t){return{\u0275providers:t}}function lu(t){return So([{provide:Fn,multi:!0,useValue:t}])}function du(...t){return{\u0275providers:Pa(!0,t),\u0275fromNgModule:!0}}function Pa(t,...e){let n=[],o=new Set,i,r=s=>{n.push(s)};return qi(e,s=>{let a=s;Pi(a,r,[],o)&&(i||=[],i.push(a))}),i!==void 0&&uu(i,r),n}function uu(t,e){for(let n=0;n<t.length;n++){let{ngModule:o,providers:i}=t[n];La(i,r=>{e(r,o)})}}function Pi(t,e,n,o){if(t=Fe(t),!t)return!1;let i=null,r=fa(t),s=!r&&sn(t);if(!r&&!s){let c=t.ngModule;if(r=fa(c),r)i=c;else return!1}else{if(s&&!s.standalone)return!1;i=t}let a=o.has(i);if(s){if(a)return!1;if(o.add(i),s.dependencies){let c=typeof s.dependencies=="function"?s.dependencies():s.dependencies;for(let d of c)Pi(d,e,n,o)}}else if(r){if(r.imports!=null&&!a){o.add(i);let d;qi(r.imports,f=>{Pi(f,e,n,o)&&(d||=[],d.push(f))}),d!==void 0&&uu(d,e)}if(!a){let d=On(i)||(()=>new i);e({provide:i,useFactory:d,deps:ot},i),e({provide:Oa,useValue:i,multi:!0},i),e({provide:Fn,useValue:()=>te(i),multi:!0},i)}let c=r.providers;if(c!=null&&!a){let d=t;La(c,f=>{e(f,d)})}}else return!1;return i!==t&&t.providers!==void 0}function La(t,e){for(let n of t)Sa(n)&&(n=n.\u0275providers),Array.isArray(n)?La(n,e):e(n)}var Fy=ne({provide:String,useValue:ne});function fu(t){return t!==null&&typeof t=="object"&&Fy in t}function Vy(t){return!!(t&&t.useExisting)}function jy(t){return!!(t&&t.useFactory)}function Li(t){return typeof t=="function"}var wo=new J(""),Ai={},Jd={},ua;function To(){return ua===void 0&&(ua=new Pn),ua}var it=class{},on=class extends it{parent;source;scopes;records=new Map;_ngOnDestroyHooks=new Set;_onDestroyHooks=[];get destroyed(){return this._destroyed}_destroyed=!1;injectorDefTypes;constructor(e,n,o,i){super(),this.parent=n,this.source=o,this.scopes=i,va(e,s=>this.processProvider(s)),this.records.set(Aa,An(void 0,this)),i.has("environment")&&this.records.set(it,An(void 0,this));let r=this.records.get(wo);r!=null&&typeof r.value=="string"&&this.scopes.add(r.value),this.injectorDefTypes=new Set(this.get(Oa,ot,{self:!0}))}retrieve(e,n){let o=nn(n)||0;try{return this.get(e,tn,o)}catch(i){if(Mn(i))return i;throw i}}destroy(){vo(this),this._destroyed=!0;let e=V(null);try{for(let o of this._ngOnDestroyHooks)o.ngOnDestroy();let n=this._onDestroyHooks;this._onDestroyHooks=[];for(let o of n)o()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),V(e)}}onDestroy(e){return vo(this),this._onDestroyHooks.push(e),()=>this.removeOnDestroy(e)}runInContext(e){vo(this);let n=ut(this),o=Le(void 0),i;try{return e()}finally{ut(n),Le(o)}}get(e,n=tn,o){if(vo(this),Object.hasOwn(e,Yd))return e[Yd](this);let i=nn(o),r,s=ut(this),a=Le(void 0);try{if(!(i&4)){let d=this.records.get(e);if(d===void 0){let f=Gy(e)&&Ui(e);f&&this.injectableDefInScope(f)?d=An(ya(e),Ai):d=null,this.records.set(e,d)}if(d!=null)return this.hydrate(e,d,i)}let c=i&2?To():this.parent;return n=i&8&&n===tn?null:n,c.get(e,n)}catch(c){let d=Ny(c);throw d===-200||d===-201?new U(d,null):c}finally{Le(a),ut(s)}}resolveInjectorInitializers(){let e=V(null),n=ut(this),o=Le(void 0),i;try{let r=this.get(Fn,ot,{self:!0});for(let s of r)s()}finally{ut(n),Le(o),V(e)}}toString(){return"R3Injector[...]"}processProvider(e){e=Fe(e);let n=Li(e)?e:Fe(e&&e.provide),o=By(e);if(!Li(e)&&e.multi===!0){let i=this.records.get(n);i||(i=An(void 0,Ai,!0),i.factory=()=>ga(i.multi),this.records.set(n,i)),n=e,i.multi.push(e)}this.records.set(n,o)}hydrate(e,n,o){let i=V(null);try{if(n.value===Jd)throw Na("");return n.value===Ai&&(n.value=Jd,n.value=n.factory(void 0,o)),typeof n.value=="object"&&n.value&&Uy(n.value)&&this._ngOnDestroyHooks.add(n.value),n.value}finally{V(i)}}injectableDefInScope(e){if(!e.providedIn)return!1;let n=Fe(e.providedIn);return typeof n=="string"?n==="any"||this.scopes.has(n):this.injectorDefTypes.has(n)}removeOnDestroy(e){let n=this._onDestroyHooks.indexOf(e);n!==-1&&this._onDestroyHooks.splice(n,1)}};function ya(t){let e=Ui(t),n=e!==null?e.factory:On(t);if(n!==null)return n;if(t instanceof J)throw new U(-204,!1);if(t instanceof Function)return $y(t);throw new U(-204,!1)}function $y(t){if(t.length>0)throw new U(-204,!1);let n=Ty(t);return n!==null?()=>n.factory(t):()=>new t}function By(t){if(fu(t))return An(void 0,t.useValue);{let e=pu(t);return An(e,Ai)}}function pu(t,e,n){let o;if(Li(t)){let i=Fe(t);return On(i)||ya(i)}else if(fu(t))o=()=>Fe(t.useValue);else if(jy(t))o=()=>t.useFactory(...ga(t.deps||[]));else if(Vy(t))o=(i,r)=>te(Fe(t.useExisting),r!==void 0&&r&8?8:void 0);else{let i=Fe(t&&(t.useClass||t.provide));if(Hy(t))o=()=>new i(...ga(t.deps));else return On(i)||ya(i)}return o}function vo(t){if(t.destroyed)throw new U(-205,!1)}function An(t,e,n=!1){return{factory:t,value:e,multi:n?[]:void 0}}function Hy(t){return!!t.deps}function Uy(t){return t!==null&&typeof t=="object"&&typeof t.ngOnDestroy=="function"}function Gy(t){return typeof t=="function"||typeof t=="object"&&t.ngMetadataName==="InjectionToken"}function va(t,e){for(let n of t)Array.isArray(n)?va(n,e):n&&Sa(n)?va(n.\u0275providers,e):e(n)}function Yi(t,e){let n;t instanceof on?(vo(t),n=t):n=new ha(t);let o,i=ut(n),r=Le(void 0);try{return e()}finally{ut(i),Le(r)}}function mu(){return ru()!==void 0||Ti()!=null}var rt=0,$=1,H=2,ge=3,qe=4,Pe=5,Vn=6,jn=7,fe=8,Dt=9,pt=10,de=11,$n=12,Fa=13,Pt=14,je=15,Lt=16,an=17,mt=18,Do=19,Va=20,It=21,Ji=22,St=23,$e=24,cn=25,hu=26,Mo=27,ye=28,gu=1,ja=6,ln=7,No=8,dn=9,pe=10;function Ft(t){return Array.isArray(t)&&typeof t[gu]=="object"}function Ke(t){return Array.isArray(t)&&t[gu]===!0}function $a(t){return(t.flags&4)!==0}function Vt(t){return t.componentOffset>-1}function Xi(t){return(t.flags&1)===1}function un(t){return!!t.template}function Bn(t){return(t[H]&512)!==0}function fn(t){return(t[H]&256)===256}var yu="svg",vu="math";function Ie(t){for(;Array.isArray(t);)t=t[rt];return t}function Ba(t,e){return Ie(e[t])}function st(t,e){return Ie(e[t.index])}function er(t,e){return t.data[e]}function Ha(t,e){return t[e]}function tr(t,e,n,o){n>=t.data.length&&(t.data[n]=null,t.blueprint[n]=null),e[n]=o}function ht(t,e){let n=e[t];return Ft(n)?n:n[rt]}function nr(t){return(t[H]&128)===128}function bu(t){return Ke(t[ge])}function gt(t,e){return e==null?null:t[e]}function Ua(t){t[an]=0}function Ga(t){t[H]&1024||(t[H]|=1024,nr(t)&&pn(t))}function _u(t,e){for(;t>0;)e=e[Pt],t--;return e}function ko(t){return!!(t[H]&9216||t[$e]?.dirty)}function or(t){t[pt].changeDetectionScheduler?.notify(8),t[H]&64&&(t[H]|=1024),ko(t)&&pn(t)}function pn(t){t[pt].changeDetectionScheduler?.notify(0);let e=wt(t);for(;e!==null&&!(e[H]&8192||(e[H]|=8192,!nr(e)));)e=wt(e)}function ir(t,e){if(fn(t))throw new U(911,!1);t[It]===null&&(t[It]=[]),t[It].push(e)}function Eu(t,e){if(t[It]===null)return;let n=t[It].indexOf(e);n!==-1&&t[It].splice(n,1)}function wt(t){let e=t[ge];return Ke(e)?e[ge]:e}function Wa(t){return t[jn]??=[]}function za(t){return t.cleanup??=[]}function xu(t,e,n,o){let i=Wa(e);i.push(n),t.firstCreatePass&&za(t).push(o,i.length-1)}var G={lFrame:Fu(null),bindingsEnabled:!0,skipHydrationRootTNode:null};var ba=!1;function Cu(){return G.lFrame.elementDepthCount}function Iu(){G.lFrame.elementDepthCount++}function qa(){G.lFrame.elementDepthCount--}function Su(){return G.bindingsEnabled}function wu(){return G.skipHydrationRootTNode!==null}function Ka(t){return G.skipHydrationRootTNode===t}function Za(){G.skipHydrationRootTNode=null}function W(){return G.lFrame.lView}function Se(){return G.lFrame.tView}function I(t){return G.lFrame.contextLView=t,t[fe]}function S(t){return G.lFrame.contextLView=null,t}function Ze(){let t=Qa();for(;t!==null&&t.type===64;)t=t.parent;return t}function Qa(){return G.lFrame.currentTNode}function Tu(){let t=G.lFrame,e=t.currentTNode;return t.isParent?e:e.parent}function mn(t,e){let n=G.lFrame;n.currentTNode=t,n.isParent=e}function Ya(){return G.lFrame.isParent}function Du(){G.lFrame.isParent=!1}function Ja(){return G.lFrame.contextLView}function Xa(){return ba}function bo(t){let e=ba;return ba=t,e}function Mu(){let t=G.lFrame,e=t.bindingRootIndex;return e===-1&&(e=t.bindingRootIndex=t.tView.bindingStartIndex),e}function rr(){return G.lFrame.bindingIndex}function Nu(t){return G.lFrame.bindingIndex=t}function hn(){return G.lFrame.bindingIndex++}function Hn(t){let e=G.lFrame,n=e.bindingIndex;return e.bindingIndex=e.bindingIndex+t,n}function ku(){return G.lFrame.inI18n}function Ru(t,e){let n=G.lFrame;n.bindingIndex=n.bindingRootIndex=t,sr(e)}function Au(){return G.lFrame.currentDirectiveIndex}function sr(t){G.lFrame.currentDirectiveIndex=t}function Ou(t){let e=G.lFrame.currentDirectiveIndex;return e===-1?null:t[e]}function Pu(){return G.lFrame.currentQueryIndex}function ar(t){G.lFrame.currentQueryIndex=t}function Wy(t){let e=t[$];return e.type===2?e.declTNode:e.type===1?t[Pe]:null}function ec(t,e,n){if(n&4){let i=e,r=t;for(;i=i.parent,i===null&&!(n&1);)if(i=Wy(r),i===null||(r=r[Pt],i.type&10))break;if(i===null)return!1;e=i,t=r}let o=G.lFrame=Lu();return o.currentTNode=e,o.lView=t,!0}function cr(t){let e=Lu(),n=t[$];G.lFrame=e,e.currentTNode=n.firstChild,e.lView=t,e.tView=n,e.contextLView=t,e.bindingIndex=n.bindingStartIndex,e.inI18n=!1}function Lu(){let t=G.lFrame,e=t===null?null:t.child;return e===null?Fu(t):e}function Fu(t){let e={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:t,child:null,inI18n:!1};return t!==null&&(t.child=e),e}function Vu(){let t=G.lFrame;return G.lFrame=t.parent,t.currentTNode=null,t.lView=null,t}var tc=Vu;function lr(){let t=Vu();t.isParent=!0,t.tView=null,t.selectedIndex=-1,t.contextLView=null,t.elementDepthCount=0,t.currentDirectiveIndex=-1,t.currentNamespace=null,t.bindingRootIndex=-1,t.bindingIndex=-1,t.currentQueryIndex=0}function ju(t){return(G.lFrame.contextLView=_u(t,G.lFrame.contextLView))[fe]}function Be(){return G.lFrame.selectedIndex}function jt(t){G.lFrame.selectedIndex=t}function dr(){let t=G.lFrame;return er(t.tView,t.selectedIndex)}function nc(){return G.lFrame.currentNamespace}var $u=!0;function ur(){return $u}function fr(t){$u=t}function _a(t,e=null,n=null,o){let i=Bu(t,e,n,o);return i.resolveInjectorInitializers(),i}function Bu(t,e=null,n=null,o,i=new Set){let r=[n||ot,du(t)],s;return new on(r,e||To(),s||null,i)}var Ce=class t{static THROW_IF_NOT_FOUND=tn;static NULL=new Pn;static create(e,n){if(Array.isArray(e))return _a({name:""},n,e,"");{let o=e.name??"";return _a({name:o},e.parent,e.providers,o)}}static \u0275prov=K({token:t,providedIn:"any",factory:()=>te(Aa)});static __NG_ELEMENT_ID__=-1},Ne=new J(""),ue=class{static __NG_ELEMENT_ID__=zy;static __NG_ENV_ID__=e=>e},Fi=class extends ue{_lView;constructor(e){super(),this._lView=e}get destroyed(){return fn(this._lView)}onDestroy(e){let n=this._lView;return ir(n,e),()=>Eu(n,e)}};function zy(){return new Fi(W())}var Hu=!1,Uu=new J(""),Un=(()=>{class t{taskId=0;pendingTasks=new Set;destroyed=!1;pendingTask=new yo(!1);debugTaskTracker=w(Uu,{optional:!0});get hasPendingTasks(){return this.destroyed?!1:this.pendingTask.value}get hasPendingTasksObservable(){return this.destroyed?new ft(n=>{n.next(!1),n.complete()}):this.pendingTask}add(){!this.hasPendingTasks&&!this.destroyed&&this.pendingTask.next(!0);let n=this.taskId++;return this.pendingTasks.add(n),this.debugTaskTracker?.add(n),n}has(n){return this.pendingTasks.has(n)}remove(n){this.pendingTasks.delete(n),this.debugTaskTracker?.remove(n),this.pendingTasks.size===0&&this.hasPendingTasks&&this.pendingTask.next(!1)}ngOnDestroy(){this.pendingTasks.clear(),this.hasPendingTasks&&this.pendingTask.next(!1),this.destroyed=!0,this.pendingTask.unsubscribe()}static \u0275prov=K({token:t,providedIn:"root",factory:()=>new t})}return t})(),Ea=class extends We{__isAsync;destroyRef=void 0;pendingTasks=void 0;constructor(e=!1){super(),this.__isAsync=e,mu()&&(this.destroyRef=w(ue,{optional:!0})??void 0,this.pendingTasks=w(Un,{optional:!0})??void 0)}emit(e){let n=V(null);try{super.next(e)}finally{V(n)}}subscribe(e,n,o){let i=e,r=n||(()=>null),s=o;if(e&&typeof e=="object"){let c=e;i=c.next?.bind(c),r=c.error?.bind(c),s=c.complete?.bind(c)}this.__isAsync&&(r=this.wrapInTimeout(r),i&&(i=this.wrapInTimeout(i)),s&&(s=this.wrapInTimeout(s)));let a=super.subscribe({next:i,error:r,complete:s});return e instanceof Me&&e.add(a),a}wrapInTimeout(e){return n=>{let o=this.pendingTasks?.add();setTimeout(()=>{try{e(n)}finally{o!==void 0&&this.pendingTasks?.remove(o)}})}}},Ct=Ea;function Vi(...t){}function oc(t){let e,n;function o(){t=Vi;try{n!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(n),e!==void 0&&clearTimeout(e)}catch{}}return e=setTimeout(()=>{t(),o()}),typeof requestAnimationFrame=="function"&&(n=requestAnimationFrame(()=>{t(),o()})),()=>o()}function Gu(t){return queueMicrotask(()=>t()),()=>{t=Vi}}var ic="isAngularZone",_o=ic+"_ID",qy=0,Oe=class t{hasPendingMacrotasks=!1;hasPendingMicrotasks=!1;isStable=!0;onUnstable=new Ct(!1);onMicrotaskEmpty=new Ct(!1);onStable=new Ct(!1);onError=new Ct(!1);constructor(e){let{enableLongStackTrace:n=!1,shouldCoalesceEventChangeDetection:o=!1,shouldCoalesceRunChangeDetection:i=!1,scheduleInRootZone:r=Hu}=e;if(typeof Zone>"u")throw new U(908,!1);Zone.assertZonePatched();let s=this;s._nesting=0,s._outer=s._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(s._inner=s._inner.fork(new Zone.TaskTrackingZoneSpec)),n&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!i&&o,s.shouldCoalesceRunChangeDetection=i,s.callbackScheduled=!1,s.scheduleInRootZone=r,Qy(s)}static isInAngularZone(){return typeof Zone<"u"&&Zone.current.get(ic)===!0}static assertInAngularZone(){if(!t.isInAngularZone())throw new U(909,!1)}static assertNotInAngularZone(){if(t.isInAngularZone())throw new U(909,!1)}run(e,n,o){return this._inner.run(e,n,o)}runTask(e,n,o,i){let r=this._inner,s=r.scheduleEventTask("NgZoneEvent: "+i,e,Ky,Vi,Vi);try{return r.runTask(s,n,o)}finally{r.cancelTask(s)}}runGuarded(e,n,o){return this._inner.runGuarded(e,n,o)}runOutsideAngular(e){return this._outer.run(e)}},Ky={};function rc(t){if(t._nesting==0&&!t.hasPendingMicrotasks&&!t.isStable)try{t._nesting++,t.onMicrotaskEmpty.emit(null)}finally{if(t._nesting--,!t.hasPendingMicrotasks)try{t.runOutsideAngular(()=>t.onStable.emit(null))}finally{t.isStable=!0}}}function Zy(t){if(t.isCheckStableRunning||t.callbackScheduled)return;t.callbackScheduled=!0;function e(){oc(()=>{t.callbackScheduled=!1,xa(t),t.isCheckStableRunning=!0,rc(t),t.isCheckStableRunning=!1})}t.scheduleInRootZone?Zone.root.run(()=>{e()}):t._outer.run(()=>{e()}),xa(t)}function Qy(t){let e=()=>{Zy(t)},n=qy++;t._inner=t._inner.fork({name:"angular",properties:{[ic]:!0,[_o]:n,[_o+n]:!0},onInvokeTask:(o,i,r,s,a,c)=>{if(Yy(c))return o.invokeTask(r,s,a,c);try{return Xd(t),o.invokeTask(r,s,a,c)}finally{(t.shouldCoalesceEventChangeDetection&&s.type==="eventTask"||t.shouldCoalesceRunChangeDetection)&&e(),eu(t)}},onInvoke:(o,i,r,s,a,c,d)=>{try{return Xd(t),o.invoke(r,s,a,c,d)}finally{t.shouldCoalesceRunChangeDetection&&!t.callbackScheduled&&!Jy(c)&&e(),eu(t)}},onHasTask:(o,i,r,s)=>{o.hasTask(r,s),i===r&&(s.change=="microTask"?(t._hasPendingMicrotasks=s.microTask,xa(t),rc(t)):s.change=="macroTask"&&(t.hasPendingMacrotasks=s.macroTask))},onHandleError:(o,i,r,s)=>(o.handleError(r,s),t.runOutsideAngular(()=>t.onError.emit(s)),!1)})}function xa(t){t._hasPendingMicrotasks||(t.shouldCoalesceEventChangeDetection||t.shouldCoalesceRunChangeDetection)&&t.callbackScheduled===!0?t.hasPendingMicrotasks=!0:t.hasPendingMicrotasks=!1}function Xd(t){t._nesting++,t.isStable&&(t.isStable=!1,t.onUnstable.emit(null))}function eu(t){t._nesting--,rc(t)}var Eo=class{hasPendingMicrotasks=!1;hasPendingMacrotasks=!1;isStable=!0;onUnstable=new Ct;onMicrotaskEmpty=new Ct;onStable=new Ct;onError=new Ct;run(e,n,o){return e.apply(n,o)}runGuarded(e,n,o){return e.apply(n,o)}runOutsideAngular(e){return e()}runTask(e,n,o,i){return e.apply(n,o)}};function Yy(t){return Wu(t,"__ignore_ng_zone__")}function Jy(t){return Wu(t,"__scheduler_tick__")}function Wu(t,e){return!Array.isArray(t)||t.length!==1?!1:t[0]?.data?.[e]===!0}var ze=class{_console=console;handleError(e){this._console.error("ERROR",e)}};function zu(t){return qu(t)?t:new Ca(t)}function qu(t){return t instanceof Error||typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.message=="string"}var Ca=class extends Error{constructor(e){super(String(e),{cause:e}),this.name="ErrorBoundaryWrappedError"}},gn=new J("",{factory:()=>{let t=w(Oe),e=w(it),n;return o=>{t.runOutsideAngular(()=>{e.destroyed&&!n?setTimeout(()=>{throw o}):(n??=e.get(ze),n.handleError(o))})}}}),Ku={provide:Fn,useValue:()=>{let t=w(ze,{optional:!0})},multi:!0},Xy=new J("",{factory:()=>{let t=w(Ne).defaultView;if(!t)return;let e=w(gn),n=r=>{e(r.reason),r.preventDefault()},o=r=>{r.error?e(r.error):e(new Error(r.message,{cause:r})),r.preventDefault()},i=()=>{t.addEventListener("unhandledrejection",n),t.addEventListener("error",o)};typeof Zone<"u"?Zone.root.run(i):i(),w(ue).onDestroy(()=>{t.removeEventListener("error",o),t.removeEventListener("unhandledrejection",n)})}});function sc(){return So([lu(()=>{w(Xy)})])}function A(t,e){let[n,o,i]=Js(t,e?.equal),r=n,s=r[Ee];return r.set=o,r.update=i,r.asReadonly=ac.bind(r),r}function ac(){let t=this[Ee];if(t.readonlyFn===void 0){let e=()=>this();e[Ee]=t,t.readonlyFn=e}return t.readonlyFn}var Ro=new J("",{factory:()=>ev}),ev="ng";var pr=new J(""),Ao=new J("",{providedIn:"platform",factory:()=>"unknown"});var mr=new J("",{factory:()=>w(Ne).body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce")||null});var Gn=(()=>{class t{view;node;constructor(n,o){this.view=n,this.node=o}static __NG_ELEMENT_ID__=tv}return t})();function tv(){return new Gn(W(),Ze())}var Tt=class{},Oo=new J("",{factory:()=>!0});var cc=new J(""),hr=(()=>{class t{static \u0275prov=K({token:t,providedIn:"root",factory:()=>new Ia})}return t})(),Ia=class{dirtyEffectCount=0;queues=new Map;add(e){this.enqueue(e),this.schedule(e)}schedule(e){e.dirty&&this.dirtyEffectCount++}remove(e){let n=e.zone,o=this.queues.get(n);o.has(e)&&(o.delete(e),e.dirty&&this.dirtyEffectCount--)}enqueue(e){let n=e.zone;this.queues.has(n)||this.queues.set(n,new Set);let o=this.queues.get(n);o.has(e)||o.add(e)}flush(){for(;this.dirtyEffectCount>0;){let e=!1;for(let[n,o]of this.queues)n===null?e||=this.flushQueue(o):e||=n.run(()=>this.flushQueue(o));e||(this.dirtyEffectCount=0)}}flushQueue(e){let n=!1;for(let o of e)o.dirty&&(this.dirtyEffectCount--,n=!0,o.run());return n}},ji=class{[Ee];constructor(e){this[Ee]=e}destroy(){this[Ee].destroy()}};function He(t,e){let n=e?.injector??w(Ce),o=e?.manualCleanup!==!0?n.get(ue):null,i,r=n.get(Gn,null,{optional:!0}),s=n.get(Tt);return r!==null?(i=Qu(r.view,s,t),o instanceof Fi&&o._lView===r.view&&(o=null)):i=iv(t,n.get(hr),s),i.injector=n,o!==null&&(i.onDestroyFns=[o.onDestroy(()=>i.destroy())]),new ji(i)}var Zu=x(v({},ea),{cleanupFns:void 0,zone:null,onDestroyFns:null,run(){let t=bo(!1);try{ta(this)}finally{bo(t)}},cleanup(){if(!this.cleanupFns?.length)return;let t=V(null);try{for(;this.cleanupFns.length;)this.cleanupFns.pop()()}finally{this.cleanupFns=[],V(t)}}}),nv=x(v({},Zu),{consumerMarkedDirty(){this.scheduler.schedule(this),this.notifier.notify(12)},destroy(){if(Ot(this),this.onDestroyFns!==null)for(let t of this.onDestroyFns)t();this.cleanup(),this.scheduler.remove(this)}}),ov=x(v({},Zu),{consumerMarkedDirty(){this.view[H]|=8192,pn(this.view),this.notifier.notify(13)},destroy(){if(Ot(this),this.onDestroyFns!==null)for(let t of this.onDestroyFns)t();this.cleanup(),this.view[St]?.delete(this)}});function Qu(t,e,n){let o=Object.create(ov);return o.view=t,o.zone=typeof Zone<"u"?Zone.current:null,o.notifier=e,o.userFn=n,o.fn=Yu(o,n),t[St]??=new Set,t[St].add(o),o.consumerMarkedDirty(o),o}function iv(t,e,n){let o=Object.create(nv);return o.userFn=t,o.fn=Yu(o,t),o.scheduler=e,o.notifier=n,o.zone=typeof Zone<"u"?Zone.current:null,o.scheduler.add(o),o.notifier.notify(12),o}function Yu(t,e){return()=>{e(n=>(t.cleanupFns??=[]).push(n))}}var Gc=Symbol("InputSignalNode#UNSET"),Nf=x(v({},Dn),{transformFn:void 0,applyValueToInputSignal(t,e){Jt(t,e)}});function kf(t){return{toString:t}.toString()}var X=(function(t){return t[t.TemplateCreateStart=0]="TemplateCreateStart",t[t.TemplateCreateEnd=1]="TemplateCreateEnd",t[t.TemplateUpdateStart=2]="TemplateUpdateStart",t[t.TemplateUpdateEnd=3]="TemplateUpdateEnd",t[t.LifecycleHookStart=4]="LifecycleHookStart",t[t.LifecycleHookEnd=5]="LifecycleHookEnd",t[t.OutputStart=6]="OutputStart",t[t.OutputEnd=7]="OutputEnd",t[t.BootstrapApplicationStart=8]="BootstrapApplicationStart",t[t.BootstrapApplicationEnd=9]="BootstrapApplicationEnd",t[t.BootstrapComponentStart=10]="BootstrapComponentStart",t[t.BootstrapComponentEnd=11]="BootstrapComponentEnd",t[t.ChangeDetectionStart=12]="ChangeDetectionStart",t[t.ChangeDetectionEnd=13]="ChangeDetectionEnd",t[t.ChangeDetectionSyncStart=14]="ChangeDetectionSyncStart",t[t.ChangeDetectionSyncEnd=15]="ChangeDetectionSyncEnd",t[t.AfterRenderHooksStart=16]="AfterRenderHooksStart",t[t.AfterRenderHooksEnd=17]="AfterRenderHooksEnd",t[t.ComponentStart=18]="ComponentStart",t[t.ComponentEnd=19]="ComponentEnd",t[t.DeferBlockStateStart=20]="DeferBlockStateStart",t[t.DeferBlockStateEnd=21]="DeferBlockStateEnd",t[t.DynamicComponentStart=22]="DynamicComponentStart",t[t.DynamicComponentEnd=23]="DynamicComponentEnd",t[t.HostBindingsUpdateStart=24]="HostBindingsUpdateStart",t[t.HostBindingsUpdateEnd=25]="HostBindingsUpdateEnd",t})(X||{});function Ev(t,e,n,o){e!==null?e.applyValueToInputSignal(e,o):t[n]=o}var xv=null;function Cv(){return xv}var Ju=[];var ee=function(t,e=null,n){for(let o=0;o<Ju.length;o++){let i=Ju[o];i(t,e,n)}};function Iv(t,e,n){let{ngOnChanges:o,ngOnInit:i,ngDoCheck:r}=e.type.prototype;if(o){let s=Cv()(e);(n.preOrderHooks??=[]).push(t,s),(n.preOrderCheckHooks??=[]).push(t,s)}i&&(n.preOrderHooks??=[]).push(0-t,i),r&&((n.preOrderHooks??=[]).push(t,r),(n.preOrderCheckHooks??=[]).push(t,r))}function Sv(t,e){for(let n=e.directiveStart,o=e.directiveEnd;n<o;n++){let r=t.data[n].type.prototype,{ngAfterContentInit:s,ngAfterContentChecked:a,ngAfterViewInit:c,ngAfterViewChecked:d,ngOnDestroy:f}=r;s&&(t.contentHooks??=[]).push(-n,s),a&&((t.contentHooks??=[]).push(n,a),(t.contentCheckHooks??=[]).push(n,a)),c&&(t.viewHooks??=[]).push(-n,c),d&&((t.viewHooks??=[]).push(n,d),(t.viewCheckHooks??=[]).push(n,d)),f!=null&&(t.destroyHooks??=[]).push(n,f)}}function vr(t,e,n){Rf(t,e,3,n)}function br(t,e,n,o){(t[H]&3)===n&&Rf(t,e,n,o)}function lc(t,e){let n=t[H];(n&3)===e&&(n&=16383,n+=1,t[H]=n)}function Rf(t,e,n,o){let i=o!==void 0?t[an]&65535:0,r=o??-1,s=e.length-1,a=0;for(let c=i;c<s;c++)if(typeof e[c+1]=="number"){if(a=e[c],o!=null&&a>=o)break}else e[c]<0&&(t[an]+=65536),(a<r||r==-1)&&(wv(t,n,e,c),t[an]=(t[an]&4294901760)+c+2),c++}function Xu(t,e){ee(X.LifecycleHookStart,t,e);let n=V(null);try{e.call(t)}finally{V(n),ee(X.LifecycleHookEnd,t,e)}}function wv(t,e,n,o){let i=n[o]<0,r=n[o+1],s=i?-n[o]:n[o],a=t[s];i?t[H]>>14<t[an]>>16&&(t[H]&3)===e&&(t[H]+=16384,Xu(a,r)):Xu(a,r)}var qn=-1,Fo=class{factory;name;injectImpl;resolving=!1;canSeeViewProviders;multi;componentProviders;index;providerFactory;constructor(e,n,o,i){this.factory=e,this.name=i,this.canSeeViewProviders=n,this.injectImpl=o}};function Tv(t){return(t.flags&8)!==0}function Dv(t){return(t.flags&16)!==0}function Mv(t,e,n){let o=0;for(;o<n.length;){let i=n[o];if(typeof i=="number"){if(i!==0)break;o++;let r=n[o++],s=n[o++],a=n[o++];t.setAttribute(e,s,a,r)}else{let r=i,s=n[++o];kv(r)?t.setProperty(e,r,s):t.setAttribute(e,r,s),o++}}return o}function Nv(t){return t===3||t===4||t===6}function kv(t){return t.charCodeAt(0)===64}function Lr(t,e){if(!(e===null||e.length===0))if(t===null||t.length===0)t=e.slice();else{let n=-1;for(let o=0;o<e.length;o++){let i=e[o];typeof i=="number"?n=i:n===0||(n===-1||n===2?ef(t,n,i,null,e[++o]):ef(t,n,i,null,null))}}return t}function ef(t,e,n,o,i){let r=0,s=t.length;if(e===-1)s=-1;else for(;r<t.length;){let a=t[r++];if(typeof a=="number"){if(a===e){s=-1;break}else if(a>e){s=r-1;break}}}for(;r<t.length;){let a=t[r];if(typeof a=="number")break;if(a===n){i!==null&&(t[r+1]=i);return}r++,i!==null&&r++}s!==-1&&(t.splice(s,0,e),r=s+1),t.splice(r++,0,n),i!==null&&t.splice(r++,0,i)}function Af(t){return t!==qn}function Cr(t){return t&32767}function Rv(t){return t>>16}function Ir(t,e){let n=Rv(t),o=e;for(;n>0;)o=o[Pt],n--;return o}var gc=!0;function tf(t){let e=gc;return gc=t,e}var Av=256,Of=Av-1,Pf=5,Ov=0,yt={};function Pv(t,e,n){let o;typeof n=="string"?o=n.charCodeAt(0)||0:Object.hasOwn(n,rn)&&(o=n[rn]),o==null&&(o=n[rn]=Ov++);let i=o&Of,r=1<<i;e.data[t+(i>>Pf)]|=r}function Lf(t,e){let n=Ff(t,e);if(n!==-1)return n;let o=e[$];o.firstCreatePass&&(t.injectorIndex=e.length,dc(o.data,t),dc(e,null),dc(o.blueprint,null));let i=Wc(t,e),r=t.injectorIndex;if(Af(i)){let s=Cr(i),a=Ir(i,e),c=a[$].data;for(let d=0;d<8;d++)e[r+d]=a[s+d]|c[s+d]}return e[r+8]=i,r}function dc(t,e){t.push(0,0,0,0,0,0,0,0,e)}function Ff(t,e){return t.injectorIndex===-1||t.parent&&t.parent.injectorIndex===t.injectorIndex||e[t.injectorIndex+8]===null?-1:t.injectorIndex}function Wc(t,e){if(t.parent&&t.parent.injectorIndex!==-1)return t.parent.injectorIndex;let n=0,o=null,i=e;for(;i!==null;){if(o=Hf(i),o===null)return qn;if(n++,i=i[Pt],o.injectorIndex!==-1)return o.injectorIndex|n<<16}return qn}function Lv(t,e,n){Pv(t,e,n)}function Vf(t,e,n){if(n&8||t!==void 0)return t;zi(e,"NodeInjector")}function jf(t,e,n,o){if(n&8&&o===void 0&&(o=null),(n&3)===0){let i=t[Dt],r=Le(void 0);try{return i?i.get(e,o,n&8):ka(e,o,n&8)}finally{Le(r)}}return Vf(o,e,n)}function $f(t,e,n,o=0,i){if(t!==null){if(e[H]&2048&&!(o&2)){let s=$v(t,e,n,o,yt);if(s!==yt)return s}let r=Bf(t,e,n,o,yt);if(r!==yt)return r}return jf(e,n,o,i)}function Bf(t,e,n,o,i){let r=Vv(n);if(typeof r=="function"){if(!ec(e,t,o))return o&1?Vf(i,n,o):jf(e,n,o,i);try{let s;if(s=r(o),s==null&&!(o&8))zi(n);else return s}finally{tc()}}else if(typeof r=="number"){let s=null,a=Ff(t,e),c=qn,d=o&1?e[je][Pe]:null;for((a===-1||o&4)&&(c=a===-1?Wc(t,e):e[a+8],c===qn||!of(o,!1)?a=-1:(s=e[$],a=Cr(c),e=Ir(c,e)));a!==-1;){let f=e[$];if(nf(r,a,f.data)){let g=Fv(a,e,n,s,o,d);if(g!==yt)return g}c=e[a+8],c!==qn&&of(o,e[$].data[a+8]===d)&&nf(r,a,e)?(s=f,a=Cr(c),e=Ir(c,e)):a=-1}}return i}function Fv(t,e,n,o,i,r){let s=e[$],a=s.data[t+8],c=o==null?Vt(a)&&gc:o!=s&&(a.type&3)!==0,d=i&1&&r===a,f=_r(a,s,n,c,d);return f!==null?Sr(e,s,f,a,i):yt}function _r(t,e,n,o,i){let r=t.providerIndexes,s=e.data,a=r&1048575,c=t.directiveStart,d=t.directiveEnd,f=r>>20,g=o?a:a+f,C=i?a+f:d;for(let E=g;E<C;E++){let P=s[E];if(E<c&&n===P||E>=c&&P.type===n)return E}if(i){let E=s[c];if(E&&un(E)&&E.type===n)return c}return null}function Sr(t,e,n,o,i){let r=t[n],s=e.data;if(r instanceof Fo){let a=r;if(a.resolving)throw Na("");let c=tf(a.canSeeViewProviders);a.resolving=!0;let d=s[n].type||s[n],f,g=a.injectImpl?Le(a.injectImpl):null,C=ec(t,o,0);try{r=t[n]=a.factory(void 0,i,s,t,o),e.firstCreatePass&&n>=o.directiveStart&&Iv(n,s[n],e)}finally{g!==null&&Le(g),tf(c),a.resolving=!1,tc()}}return r}function Vv(t){if(typeof t=="string")return t.charCodeAt(0)||0;let e=Object.hasOwn(t,rn)?t[rn]:void 0;return typeof e=="number"?e>=0?e&Of:jv:e}function nf(t,e,n){let o=1<<t;return!!(n[e+(t>>Pf)]&o)}function of(t,e){return!(t&2)&&!(t&1&&e)}var Mt=class{_tNode;_lView;constructor(e,n){this._tNode=e,this._lView=n}get(e,n,o){return $f(this._tNode,this._lView,e,nn(o),n)}};function jv(){return new Mt(Ze(),W())}function $v(t,e,n,o,i){let r=t,s=e;for(;r!==null&&s!==null&&s[H]&2048&&!Bn(s);){let a=Bf(r,s,n,o|2,yt);if(a!==yt)return a;o&=-5;let c=r.parent;if(!c){let d=s[Va];if(d){let f=d.get(n,yt,o);if(f!==yt)return f}c=Hf(s),s=s[Pt]}r=c}return i}function Hf(t){let e=t[$],n=e.type;return n===2?e.declTNode:n===1?t[Pe]:null}function Fr(t){return{token:t.token,providedIn:t.autoProvided===!1?null:"root",factory:t.factory,value:void 0}}function Bv(){return Yn(Ze(),W())}function Yn(t,e){return new qo(st(t,e))}var qo=(()=>{class t{nativeElement;constructor(n){this.nativeElement=n}static __NG_ELEMENT_ID__=Bv}return t})();function Hv(t){return t instanceof qo?t.nativeElement:t}function Uv(){return this._results[Symbol.iterator]()}var wr=class{_emitDistinctChangesOnly;dirty=!0;_onDirty=void 0;_results=[];_changesDetected=!1;_changes=void 0;length=0;first=void 0;last=void 0;get changes(){return this._changes??=new We}constructor(e=!1){this._emitDistinctChangesOnly=e}get(e){return this._results[e]}map(e){return this._results.map(e)}filter(e){return this._results.filter(e)}find(e){return this._results.find(e)}reduce(e,n){return this._results.reduce(e,n)}forEach(e){this._results.forEach(e)}some(e){return this._results.some(e)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(e,n){this.dirty=!1;let o=au(e);(this._changesDetected=!su(this._results,o,n))&&(this._results=o,this.length=o.length,this.last=o[this.length-1],this.first=o[0])}notifyOnChanges(){this._changes!==void 0&&(this._changesDetected||!this._emitDistinctChangesOnly)&&this._changes.next(this)}onDirty(e){this._onDirty=e}setDirty(){this.dirty=!0,this._onDirty?.()}destroy(){this._changes!==void 0&&(this._changes.complete(),this._changes.unsubscribe())}[Symbol.iterator]=Uv};function Uf(t){return(t.flags&128)===128}var zc=(function(t){return t[t.OnPush=0]="OnPush",t[t.Eager=1]="Eager",t[t.Default=1]="Default",t})(zc||{}),Gf=new Map,Gv=0;function Wv(){return Gv++}function zv(t){Gf.set(t[Do],t)}function yc(t){Gf.delete(t[Do])}var rf="__ngContext__";function Kn(t,e){Ft(e)?(t[rf]=e[Do],zv(e)):t[rf]=e}function Wf(t){return qf(t[$n])}function zf(t){return qf(t[qe])}function qf(t){for(;t!==null&&!Ke(t);)t=t[qe];return t}var vc;function qc(t){vc=t}function Kf(){if(vc!==void 0)return vc;if(typeof document<"u")return document;throw new U(210,!1)}var Zf="r";var Qf="di";var Yf=!1,Jf=new J("",{factory:()=>Yf});var sf=new WeakMap;function qv(t,e){if(t==null||typeof t!="object")return;let n=sf.get(t);n||(n=new WeakSet,sf.set(t,n)),n.add(e)}var Kv=(t,e,n,o)=>{};function Zv(t,e,n,o){Kv(t,e,n,o)}function Kc(t){return(t.flags&32)===32}var Qv=()=>null;function Xf(t,e,n=!1){return Qv(t,e,n)}function ep(t,e){let n=t.contentQueries;if(n!==null){let o=V(null);try{for(let i=0;i<n.length;i+=2){let r=n[i],s=n[i+1];if(s!==-1){let a=t.data[s];ar(r),a.contentQueries(2,e[s],s)}}}finally{V(o)}}}function bc(t,e,n){ar(0);let o=V(null);try{e(t,n)}finally{V(o)}}function tp(t,e,n){if($a(e)){let o=V(null);try{let i=e.directiveStart,r=e.directiveEnd;for(let s=i;s<r;s++){let a=t.data[s];if(a.contentQueries){let c=n[s];a.contentQueries(1,c,s)}}}finally{V(o)}}}var lt=(function(t){return t[t.Emulated=0]="Emulated",t[t.None=2]="None",t[t.ShadowDom=3]="ShadowDom",t[t.ExperimentalIsolatedShadowDom=4]="ExperimentalIsolatedShadowDom",t})(lt||{}),_c=class{changingThisBreaksApplicationSecurity;constructor(e){this.changingThisBreaksApplicationSecurity=e}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity}`}};function Vo(t){return t instanceof _c?t.changingThisBreaksApplicationSecurity:t}var gr;function Yv(){if(gr===void 0&&(gr=null,Co.trustedTypes))try{gr=Co.trustedTypes.createPolicy("angular",{createHTML:t=>t,createScript:t=>t,createScriptURL:t=>t})}catch{}return gr}function Jv(t){return Yv()?.createScriptURL(t)||t}function Xv(t,e){return t.createText(e)}function e0(t,e,n){t.setValue(e,n)}function np(t,e,n){return t.createElement(e,n)}function yn(t,e,n,o,i){t.insertBefore(e,n,o,i)}function op(t,e,n){t.appendChild(e,n)}function af(t,e,n,o,i){o!==null?yn(t,e,n,o,i):op(t,e,n)}function ip(t,e,n,o){t.removeChild(null,e,n,o)}function t0(t,e,n){t.setAttribute(e,"style",n)}function n0(t,e,n){n===""?t.removeAttribute(e,"class"):t.setAttribute(e,"class",n)}function rp(t,e,n){let{mergedAttrs:o,classes:i,styles:r}=n;o!==null&&Mv(t,e,o),i!==null&&n0(t,e,i),r!==null&&t0(t,e,r)}function Zc(t){return Jv(t[0])}function Qc(t){return t.ownerDocument.defaultView}function Vr(t){return t.ownerDocument}function o0(t,e,n){let o=t.length;for(;;){let i=t.indexOf(e,n);if(i===-1)return i;if(i===0||t.charCodeAt(i-1)<=32){let r=e.length;if(i+r===o||t.charCodeAt(i+r)<=32)return i}n=i+1}}var sp="ng-template";function i0(t,e,n,o){let i=0;if(o){for(;i<e.length&&typeof e[i]=="string";i+=2)if(e[i]==="class"&&o0(e[i+1].toLowerCase(),n,0)!==-1)return!0}else if(Yc(t))return!1;if(i=e.indexOf(1,i),i>-1){let r;for(;++i<e.length&&typeof(r=e[i])=="string";)if(r.toLowerCase()===n)return!0}return!1}function Yc(t){return t.type===4&&t.value!==sp}function r0(t,e,n){let o=t.type===4&&!n?sp:t.value;return e===o}function s0(t,e,n){let o=4,i=t.attrs,r=i!==null?l0(i):0,s=!1;for(let a=0;a<e.length;a++){let c=e[a];if(typeof c=="number"){if(!s&&!at(o)&&!at(c))return!1;if(s&&at(c))continue;s=!1,o=c|o&1;continue}if(!s)if(o&4){if(o=2|o&1,c!==""&&!r0(t,c,n)||c===""&&e.length===1){if(at(o))return!1;s=!0}}else if(o&8){if(i===null||!i0(t,i,c,n)){if(at(o))return!1;s=!0}}else{let d=e[++a],f=a0(c,i,Yc(t),n);if(f===-1){if(at(o))return!1;s=!0;continue}if(d!==""){let g;if(f>r?g="":g=i[f+1].toLowerCase(),o&2&&d!==g){if(at(o))return!1;s=!0}}}}return at(o)||s}function at(t){return(t&1)===0}function a0(t,e,n,o){if(e===null)return-1;let i=0;if(o||!n){let r=!1;for(;i<e.length;){let s=e[i];if(s===t)return i;if(s===3||s===6)r=!0;else if(s===1||s===2){let a=e[++i];for(;typeof a=="string";)a=e[++i];continue}else{if(s===4)break;if(s===0){i+=4;continue}}i+=r?1:2}return-1}else return d0(e,t)}function c0(t,e,n=!1){for(let o=0;o<e.length;o++)if(s0(t,e[o],n))return!0;return!1}function l0(t){for(let e=0;e<t.length;e++){let n=t[e];if(Nv(n))return e}return t.length}function d0(t,e){let n=t.indexOf(4);if(n>-1)for(n++;n<t.length;){let o=t[n];if(typeof o=="number")return-1;if(o===e)return n;n++}return-1}function cf(t,e){return t?":not("+e.trim()+")":e}function u0(t){let e=t[0],n=1,o=2,i="",r=!1;for(;n<t.length;){let s=t[n];if(typeof s=="string")if(o&2){let a=t[++n];i+="["+s+(a.length>0?'="'+a+'"':"")+"]"}else o&8?i+="."+s:o&4&&(i+=" "+s);else i!==""&&!at(s)&&(e+=cf(r,i),i=""),o=s,r=r||!at(o);n++}return i!==""&&(e+=cf(r,i)),e}function f0(t){return t.map(u0).join(",")}function p0(t){let e=[],n=[],o=1,i=2;for(;o<t.length;){let r=t[o];if(typeof r=="string")i===2?r!==""&&e.push(r,t[++o]):i===8&&n.push(r);else{if(!at(i))break;i=r}o++}return n.length&&e.push(1,...n),e}var xe={},Nt=(function(t){return t[t.Important=1]="Important",t[t.DashCase=2]="DashCase",t})(Nt||{}),m0;function Jc(t,e){return m0(t,e)}var Xc=new Set;var FM=typeof document<"u"&&typeof document?.documentElement?.getAnimations=="function";var Ec=new WeakMap;function ap(t){return t?t[Pt]??t:null}var Wn=new WeakSet;function h0(t,e,n){let o=Ec.get(t);if(!o||o.length===0)return;let i=e.parentNode,r=e.previousSibling,s=ap(n);for(let a=o.length-1;a>=0;a--){let{el:c,declarationView:d}=o[a],f=c.parentNode;c===e?(o.splice(a,1),Wn.add(c),c.dispatchEvent(new CustomEvent("animationend",{detail:{cancel:!0}}))):r&&c===r?(o.splice(a,1),c.dispatchEvent(new CustomEvent("animationend",{detail:{cancel:!0}})),c.parentNode?.removeChild(c)):f&&i&&f!==i&&(s===null||d===null||s===d)&&(o.splice(a,1),c.dispatchEvent(new CustomEvent("animationend",{detail:{cancel:!0}})),c.parentNode?.removeChild(c))}}function g0(t,e,n){let o=ap(n),i=Ec.get(t);i?i.some(r=>r.el===e)||i.push({el:e,declarationView:o}):Ec.set(t,[{el:e,declarationView:o}])}var jr=(function(t){return t[t.CHANGE_DETECTION=0]="CHANGE_DETECTION",t[t.AFTER_NEXT_RENDER=1]="AFTER_NEXT_RENDER",t})(jr||{}),vt=new J(""),lf=new Set;function $t(t){lf.has(t)||(lf.add(t),performance?.mark?.("mark_feature_usage",{detail:{feature:t}}))}var $r=(()=>{class t{impl=null;execute(){this.impl?.execute()}static \u0275prov=K({token:t,providedIn:"root",factory:()=>new t})}return t})(),el=[0,1,2,3],tl=(()=>{class t{ngZone=w(Oe);scheduler=w(Tt);errorHandler=w(ze,{optional:!0});sequences=new Set;deferredRegistrations=new Set;executing=!1;constructor(){w(vt,{optional:!0})}execute(){let n=this.sequences.size>0;n&&ee(X.AfterRenderHooksStart),this.executing=!0;for(let o of el)for(let i of this.sequences)if(!(i.erroredOrDestroyed||!i.hooks[o]))try{i.pipelinedValue=this.ngZone.runOutsideAngular(()=>this.maybeTrace(()=>{let r=i.hooks[o];return r(i.pipelinedValue)},i.snapshot))}catch(r){i.erroredOrDestroyed=!0,this.errorHandler?.handleError(r)}this.executing=!1;for(let o of this.sequences)o.afterRun(),o.once&&(this.sequences.delete(o),o.destroy());for(let o of this.deferredRegistrations)this.sequences.add(o);this.deferredRegistrations.size>0&&this.scheduler.notify(7),this.deferredRegistrations.clear(),n&&ee(X.AfterRenderHooksEnd)}register(n){let{view:o}=n;o!==void 0?((o[cn]??=[]).push(n),pn(o),o[H]|=8192):this.addSequence(n)}addSequence(n){this.executing?this.deferredRegistrations.add(n):this.sequences.add(n),this.scheduler.notify(7)}unregister(n){this.executing&&this.sequences.has(n)?(n.erroredOrDestroyed=!0,n.pipelinedValue=void 0,n.once=!0):(this.sequences.delete(n),this.deferredRegistrations.delete(n))}maybeTrace(n,o){return o?o.run(jr.AFTER_NEXT_RENDER,n):n()}static \u0275prov=K({token:t,providedIn:"root",factory:()=>new t})}return t})(),jo=class{impl;hooks;view;once;snapshot;erroredOrDestroyed=!1;pipelinedValue=void 0;unregisterOnDestroy;constructor(e,n,o,i,r,s=null){this.impl=e,this.hooks=n,this.view=o,this.once=i,this.snapshot=s,this.unregisterOnDestroy=r?.onDestroy(()=>this.destroy())}afterRun(){this.erroredOrDestroyed=!1,this.pipelinedValue=void 0,this.snapshot?.dispose(),this.snapshot=null}destroy(){this.impl.unregister(this),this.unregisterOnDestroy?.();let e=this.view?.[cn];e&&(this.view[cn]=e.filter(n=>n!==this))}};function Bt(t,e){let n=e?.injector??w(Ce);return $t("NgAfterNextRender"),v0(t,n,e,!0)}function y0(t){return t instanceof Function?[void 0,void 0,t,void 0]:[t.earlyRead,t.write,t.mixedReadWrite,t.read]}function v0(t,e,n,o){let i=e.get($r);i.impl??=e.get(tl);let r=e.get(vt,null,{optional:!0}),s=n?.manualCleanup!==!0?e.get(ue):null,a=e.get(Gn,null,{optional:!0}),c=new jo(i.impl,y0(t),a?.view,o,s,r?.snapshot(null));return i.impl.register(c),c}var xc=null,cp=null;function df(t,e,n,o){xc?.maybeQueueEnterAnimation(t,e,n,o)}function uf(t,e,n,o){xc===null?o(!1):xc.runLeaveAnimationsWithCallback(t,e,n,o)}function b0(t){cp?.initViewDetachAnimations(t)}function _0(t){cp?.clearViewDetachAnimations(t)}function zn(t,e,n,o,i,r,s,a){if(i!=null){let c,d=!1;Ke(i)?c=i:Ft(i)&&(d=!0,i=i[rt]);let f=Ie(i);t===0&&o!==null?(df(a,o,r,n),s==null?op(e,o,f):yn(e,o,f,s||null,!0)):t===1&&o!==null?(yn(e,o,f,s||null,!0),h0(r,f,a),Wn.has(f)||df(a,o,r,n)):t===2?(a?.[hu]?.leave?.has(r.index)&&g0(r,f,a),Wn.delete(f),uf(a,r,n,g=>{if(Wn.has(f)){Wn.delete(f);return}ip(e,f,d,g)})):t===3&&(Wn.delete(f),uf(a,r,n,()=>{e.destroyNode(f)})),c!=null&&A0(e,t,n,c,r,o,s)}}function E0(t,e){lp(t,e),e[rt]=null,e[Pe]=null}function x0(t,e,n,o,i,r){o[rt]=i,o[Pe]=e,Hr(t,o,n,1,i,r)}function lp(t,e){e[pt].changeDetectionScheduler?.notify(9),Hr(t,e,e[de],2,null,null)}function C0(t){let e=t[$n];if(!e)return uc(t[$],t);for(;e;){let n=null;if(Ft(e))n=e[$n];else{let o=e[pe];o&&(n=o)}if(!n){for(;e&&!e[qe]&&e!==t;)Ft(e)&&uc(e[$],e),e=e[ge];e===null&&(e=t),Ft(e)&&uc(e[$],e),n=e&&e[qe]}e=n}}function nl(t,e){let n=t[dn],o=n.indexOf(e);n.splice(o,1)}function Br(t,e){if(fn(e))return;let n=e[de];n.destroyNode&&Hr(t,e,n,3,null,null),C0(e)}function uc(t,e){if(fn(e))return;let n=V(null);try{e[H]&=-129,e[H]|=256,e[$e]&&Ot(e[$e]),S0(t,e),I0(t,e),e[$].type===1&&e[de].destroy();let o=e[Lt];if(o!==null&&Ke(e[ge])){o!==e[ge]&&nl(o,e);let i=e[mt];i!==null&&i.detachView(t)}yc(e)}finally{V(n)}}function I0(t,e){let n=t.cleanup,o=e[jn];if(n!==null)for(let s=0;s<n.length-1;s+=2)if(typeof n[s]=="string"){let a=n[s+3];a>=0?o[a]():o[-a].unsubscribe(),s+=2}else{let a=o[n[s+1]];n[s].call(a)}o!==null&&(e[jn]=null);let i=e[It];if(i!==null){e[It]=null;for(let s=0;s<i.length;s++){let a=i[s];a()}}let r=e[St];if(r!==null){e[St]=null;for(let s of r)s.destroy()}}function S0(t,e){let n;if(t!=null&&(n=t.destroyHooks)!=null)for(let o=0;o<n.length;o+=2){let i=e[n[o]];if(!(i instanceof Fo)){let r=n[o+1];if(Array.isArray(r))for(let s=0;s<r.length;s+=2){let a=i[r[s]],c=r[s+1];ee(X.LifecycleHookStart,a,c);try{c.call(a)}finally{ee(X.LifecycleHookEnd,a,c)}}else{ee(X.LifecycleHookStart,i,r);try{r.call(i)}finally{ee(X.LifecycleHookEnd,i,r)}}}}}function w0(t,e,n){if(e===null)throw new U(510,!1);return T0(t,e.parent,n)}function T0(t,e,n){let o=e;for(;o!==null&&o.type&168;)e=o,o=e.parent;if(o===null)return n[rt];if(Vt(o)){let{encapsulation:i}=t.data[o.directiveStart+o.componentOffset];if(i===lt.None||i===lt.Emulated)return null}return st(o,n)}function D0(t,e,n){return N0(t,e,n)}function M0(t,e,n){return t.type&40?st(t,n):null}var N0=M0,ff;function ol(t,e,n,o){let i=w0(t,o,e),r=e[de],s=o.parent||e[Pe],a=D0(s,o,e);if(i!=null)if(Array.isArray(n))for(let c=0;c<n.length;c++)af(r,i,n[c],a,!1);else af(r,i,n,a,!1);ff!==void 0&&ff(r,o,e,n,i)}function Po(t,e){if(e!==null){let n=e.type;if(n&3)return st(e,t);if(n&4)return Cc(-1,t[e.index]);if(n&8){let o=e.child;if(o!==null)return Po(t,o);{let i=t[e.index];return Ke(i)?Cc(-1,i):Ie(i)}}else{if(n&128)return Po(t,e.next);if(n&32)return Jc(e,t)()||Ie(t[e.index]);{let o=dp(t,e);if(o!==null){if(Array.isArray(o))return o[0];let i=wt(t[je]);return Po(i,o)}else return Po(t,e.next)}}}return null}function dp(t,e){if(e!==null){let o=t[je][Pe],i=e.projection;return o.projection[i]}return null}function Cc(t,e){let n=pe+t+1;if(n<e.length){let o=e[n],i=o[$].firstChild;if(i!==null)return Po(o,i)}return e[ln]}function il(t,e,n,o,i,r,s){for(;n!=null;){let a=o[Dt];if(n.type===128){n=n.next;continue}let c=o[n.index],d=n.type;if(s&&e===0&&(c&&Kn(Ie(c),o),n.flags|=2),!Kc(n))if(d&8)il(t,e,n.child,o,i,r,!1),zn(e,t,a,i,c,n,r,o);else if(d&32){let f=Jc(n,o),g;for(;g=f();)zn(e,t,a,i,g,n,r,o);zn(e,t,a,i,c,n,r,o)}else d&16?R0(t,e,o,n,i,r):zn(e,t,a,i,c,n,r,o);n=s?n.projectionNext:n.next}}function Hr(t,e,n,o,i,r){t.type===3?k0(n,o,e,i,r):il(n,o,t.firstChild,e,i,r,!1)}function k0(t,e,n,o,i){let s=n[$].firstChild,a=s.next,c=Ie(n[s.index]),d=Ie(n[a.index]),f=a.index+1,g=n[f];if(e===1||e===0)o!==null&&(g&&g.hasChildNodes()?yn(t,o,g,i,!0):(yn(t,o,c,i,!0),yn(t,o,d,i,!0)));else if(e===2){if(g||(g=document.createDocumentFragment(),n[f]=g),c&&c.parentNode===g)return;let C=c;for(;C!==null;){let E=C.nextSibling;if(g.appendChild(C),C===d)break;C=E}}}function R0(t,e,n,o,i,r){let s=n[je],c=s[Pe].projection[o.projection];if(Array.isArray(c))for(let d=0;d<c.length;d++){let f=c[d];zn(e,t,n[Dt],i,f,o,r,n)}else{let d=c,f=s[ge];Uf(o)&&(d.flags|=128),il(t,e,d,f,i,r,!0)}}function A0(t,e,n,o,i,r,s){let a=o[ln],c=Ie(o);if(a!==c&&zn(e,t,n,r,a,i,s),(o[H]&4)===0)for(let d=pe;d<o.length;d++){let f=o[d];Hr(f[$],f,t,e,r,a)}}function O0(t,e,n,o,i){if(e)i?t.addClass(n,o):t.removeClass(n,o);else{let r=o.indexOf("-")===-1?void 0:Nt.DashCase;i==null?t.removeStyle(n,o,r):(typeof i=="string"&&i.endsWith("!important")&&(i=i.slice(0,-10),r|=Nt.Important),t.setStyle(n,o,i,r))}}function rl(t,e,n,o,i,r,s,a,c,d,f){let g=ye+o,C=g+i,E=P0(g,C),P=typeof d=="function"?d():d;return E[$]={type:t,blueprint:E,template:n,queries:null,viewQuery:a,declTNode:e,data:E.slice().fill(null,g),bindingStartIndex:g,expandoStartIndex:C,hostBindingOpCodes:null,firstCreatePass:!0,firstUpdatePass:!0,staticViewQueries:!1,staticContentQueries:!1,preOrderHooks:null,preOrderCheckHooks:null,contentHooks:null,contentCheckHooks:null,viewHooks:null,viewCheckHooks:null,destroyHooks:null,cleanup:null,contentQueries:null,components:null,directiveRegistry:typeof r=="function"?r():r,pipeRegistry:typeof s=="function"?s():s,firstChild:null,schemas:c,consts:P,incompleteFirstPass:!1,ssrId:f}}function P0(t,e){let n=[];for(let o=0;o<e;o++)n.push(o<t?null:xe);return n}function L0(t){let e=t.tView;return e===null||e.incompleteFirstPass?t.tView=rl(1,null,t.template,t.decls,t.vars,t.directiveDefs,t.pipeDefs,t.viewQuery,t.schemas,t.consts,t.id):e}function sl(t,e,n,o,i,r,s,a,c,d,f){let g=e.blueprint.slice();return g[rt]=i,g[H]=o|4|128|8|64|1024,(d!==null||t&&t[H]&2048)&&(g[H]|=2048),Ua(g),g[ge]=g[Pt]=t,g[fe]=n,g[pt]=s||t&&t[pt],g[de]=a||t&&t[de],g[Dt]=c||t&&t[Dt]||null,g[Pe]=r,g[Do]=Wv(),g[Vn]=f,g[Va]=d,g[je]=e.type==2?t[je]:g,g}function F0(t,e,n){let o=st(e,t),i=L0(n),r=t[pt].rendererFactory,s=al(t,sl(t,i,null,up(n),o,e,null,r.createRenderer(o,n),null,null,null));return t[e.index]=s}function up(t){let e=16;return t.signals?e=4096:t.onPush&&(e=64),e}function fp(t,e,n,o){if(n===0)return-1;let i=e.length;for(let r=0;r<n;r++)e.push(o),t.blueprint.push(o),t.data.push(null);return i}function al(t,e){return t[$n]?t[Fa][qe]=e:t[$n]=e,t[Fa]=e,e}function l(t=1){pp(Se(),W(),Be()+t,!1)}function pp(t,e,n,o){if(!o)if((e[H]&3)===3){let r=t.preOrderCheckHooks;r!==null&&vr(e,r,n)}else{let r=t.preOrderHooks;r!==null&&br(e,r,0,n)}jt(n)}var Ur=(function(t){return t[t.None=0]="None",t[t.SignalBased=1]="SignalBased",t[t.HasDecoratorInputTransform=2]="HasDecoratorInputTransform",t})(Ur||{});function Ic(t,e,n,o){let i=V(null);try{let[r,s,a]=t.inputs[n],c=null;(s&Ur.SignalBased)!==0&&(c=e[r][Ee]),c!==null&&c.transformFn!==void 0?o=c.transformFn(o):a!==null&&(o=a.call(e,o)),t.setInput!==null?t.setInput(e,c,o,n,r):Ev(e,c,r,o)}finally{V(i)}}function mp(t,e,n,o,i){let r=Be(),s=o&2;try{jt(-1),s&&e.length>ye&&pp(t,e,ye,!1);let a=s?X.TemplateUpdateStart:X.TemplateCreateStart;ee(a,i,n),n(o,i)}finally{jt(r);let a=s?X.TemplateUpdateEnd:X.TemplateCreateEnd;ee(a,i,n)}}function hp(t,e,n){G0(t,e,n),(n.flags&64)===64&&W0(t,e,n)}function cl(t,e,n=st){let o=e.localNames;if(o!==null){let i=e.index+1;for(let r=0;r<o.length;r+=2){let s=o[r+1],a=s===-1?n(e,t):t[s];t[i++]=a}}}function V0(t,e,n,o){let r=o.get(Jf,Yf)||n===lt.ShadowDom||n===lt.ExperimentalIsolatedShadowDom,s=t.selectRootElement(e,r);return j0(s),s}function j0(t){$0(t)}var $0=()=>null;function B0(t){return t==="class"?"className":t==="for"?"htmlFor":t==="formaction"?"formAction":t==="innerHtml"?"innerHTML":t==="readonly"?"readOnly":t==="tabindex"?"tabIndex":t}function H0(t,e,n,o,i,r){let s=e[$];if(ll(t,s,e,n,o)){Vt(t)&&U0(e,t.index);return}t.type&3&&(n=B0(n)),gp(t,e,n,o,i,r)}function gp(t,e,n,o,i,r){if(t.type&3){let s=st(t,e);o=r!=null?r(o,t.value||"",n):o,o=yp(n,s,o),i.setProperty(s,n,o)}else t.type&12}function yp(t,e,n,o=!1){return t==="src"&&(e.tagName==="IMG"||e.tagName==="VIDEO")?n==null?o?n:"":Vo(n):n}function U0(t,e){let n=ht(e,t);n[H]&16||(n[H]|=64)}function G0(t,e,n){let o=n.directiveStart,i=n.directiveEnd;Vt(n)&&F0(e,n,t.data[o+n.componentOffset]),t.firstCreatePass||Lf(n,e);let r=n.initialInputs;for(let s=o;s<i;s++){let a=t.data[s],c=Sr(e,t,s,n);if(Kn(c,e),r!==null&&Q0(e,s-o,c,a,n,r),un(a)){let d=ht(n.index,e);d[fe]=Sr(e,t,s,n)}}}function W0(t,e,n){let o=n.directiveStart,i=n.directiveEnd,r=n.index,s=Au();try{jt(r);for(let a=o;a<i;a++){let c=t.data[a],d=e[a];sr(a),(c.hostBindings!==null||c.hostVars!==0||c.hostAttrs!==null)&&z0(c,d)}}finally{jt(-1),sr(s)}}function z0(t,e){t.hostBindings!==null&&t.hostBindings(1,e)}function q0(t,e){let n=t.directiveRegistry,o=null;if(n)for(let i=0;i<n.length;i++){let r=n[i];c0(e,r.selectors,!1)&&(o??=[],un(r)?o.unshift(r):o.push(r))}return o}function K0(t,e,n,o,i,r){let s=st(t,e);o=yp(n,s,o,!0),Z0(e[de],s,r,t.value,n,o,i)}function Z0(t,e,n,o,i,r,s){if(r==null)s?.(r,o||"",i),t.removeAttribute(e,i,n);else{let a=s==null?Ve(r):s(r,o||"",i);t.setAttribute(e,i,a,n)}}function Q0(t,e,n,o,i,r){let s=r[e];if(s!==null)for(let a=0;a<s.length;a+=2){let c=s[a],d=s[a+1];Ic(o,n,c,d)}}function vp(t,e,n,o,i){let r=ye+n,s=e[$],a=i(s,e,t,o,n);e[r]=a,mn(t,!0);let c=t.type===2;return c?(rp(e[de],a,t),(Cu()===0||Xi(t))&&Kn(a,e),Iu()):Kn(a,e),ur()&&(!c||!Kc(t))&&ol(s,e,a,t),t}function bp(t){let e=t;return Ya()?Du():(e=e.parent,mn(e,!1)),e}function Y0(t,e){let n=t[Dt];if(!n)return;let o;try{o=n.get(gn,null)}catch{o=null}o?.(e)}function ll(t,e,n,o,i){let r=t.inputs?.[o],s=t.hostDirectiveInputs?.[o],a=!1;if(s)for(let c=0;c<s.length;c+=2){let d=s[c],f=s[c+1],g=e.data[d];Ic(g,n[d],f,i),a=!0}if(r)for(let c of r){let d=n[c],f=e.data[c];Ic(f,d,o,i),a=!0}return a}function J0(t,e){let n=ht(e,t),o=n[$];X0(o,n);let i=n[rt];i!==null&&n[Vn]===null&&(n[Vn]=Xf(i,n[Dt])),ee(X.ComponentStart);try{dl(o,n,n[fe])}finally{ee(X.ComponentEnd,n[fe])}}function X0(t,e){for(let n=e.length;n<t.blueprint.length;n++)e.push(t.blueprint[n])}function dl(t,e,n){cr(e);try{let o=t.viewQuery;o!==null&&bc(1,o,n);let i=t.template;i!==null&&mp(t,e,i,1,n),t.firstCreatePass&&(t.firstCreatePass=!1),e[mt]?.finishViewCreation(t),t.staticContentQueries&&ep(t,e),t.staticViewQueries&&bc(2,t.viewQuery,n);let r=t.components;r!==null&&eb(e,r)}catch(o){throw t.firstCreatePass&&(t.incompleteFirstPass=!0,t.firstCreatePass=!1),o}finally{e[H]&=-5,lr()}}function eb(t,e){for(let n=0;n<e.length;n++)J0(t,e[n])}function Gr(t,e,n,o){let i=V(null);try{let r=e.tView,a=t[H]&4096?4096:16,c=sl(t,r,n,a,null,e,null,null,o?.injector??null,o?.embeddedViewInjector??null,o?.dehydratedView??null),d=t[e.index];c[Lt]=d;let f=t[mt];return f!==null&&(c[mt]=f.createEmbeddedView(r)),dl(r,c,n),c}finally{V(i)}}function $o(t,e){return!e||e.firstChild===null||Uf(t)}function Bo(t,e,n,o,i=!1){if(t.type===3){let r=t.firstChild,s=r.next,a=Ie(e[r.index]),c=Ie(e[s.index]),d=a;for(;d!==null&&(o.push(d),d!==c);)d=d.nextSibling;return o}for(;n!==null;){if(n.type===128){n=i?n.projectionNext:n.next;continue}let r=e[n.index];if(r!==null)if(Ke(r)){let a=r[ln];a!==r[rt]&&o.push(Ie(r)),r[H]&4||_p(r,o),o.push(a)}else o.push(Ie(r));let s=n.type;if(s&8)Bo(t,e,n.child,o);else if(s&32){let a=Jc(n,e),c;for(;c=a();)o.push(c)}else if(s&16){let a=dp(e,n);if(Array.isArray(a))o.push(...a);else{let c=wt(e[je]);Bo(c[$],c,a,o,!0)}}n=i?n.projectionNext:n.next}return o}function _p(t,e){for(let n=pe;n<t.length;n++){let o=t[n],i=o[$].firstChild;i!==null&&Bo(o[$],o,i,e)}}function Ep(t){if(t[cn]!==null){for(let e of t[cn])e.impl.addSequence(e);t[cn].length=0}}var xp=[];function tb(t){return t[$e]??nb(t)}function nb(t){let e=xp.pop()??Object.create(ib);return e.lView=t,e}function ob(t){t.lView[$e]!==t&&(t.lView=null,xp.push(t))}var ib=x(v({},Qt),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:t=>{pn(t.lView)},consumerOnSignalRead(){this.lView[$e]=this}});function rb(t){let e=t[$e]??Object.create(sb);return e.lView=t,e}var sb=x(v({},Qt),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:t=>{let e=wt(t.lView);for(;e&&!Cp(e[$]);)e=wt(e);e&&Ga(e)},consumerOnSignalRead(){this.lView[$e]=this}});function Cp(t){return t.type!==2}function Ip(t){if(t[St]===null)return;let e=!0;for(;e;){let n=!1;for(let o of t[St])if(o.dirty&&(n=!0,o.zone===null||Zone.current===o.zone?o.run():o.zone.run(()=>o.run()),t[St]===null))return;e=n&&!!(t[H]&8192)}}var ab=100;function Sp(t,e=0){let o=t[pt].rendererFactory,i=!1;i||o.begin?.();try{cb(t,e)}finally{i||o.end?.()}}function cb(t,e){let n=Xa();try{bo(!0),Sc(t,e);let o=0;for(;ko(t);){if(o===ab)throw new U(103,!1);o++,Sc(t,1)}}finally{bo(n)}}function lb(t,e,n,o){if(fn(e))return;let i=e[H],r=!1,s=!1;cr(e);let a=!0,c=null,d=null;r||(Cp(t)?(d=tb(e),c=At(d)):Ii()===null?(a=!1,d=rb(e),c=At(d)):e[$e]&&(Ot(e[$e]),e[$e]=null));try{Ua(e),Nu(t.bindingStartIndex),n!==null&&mp(t,e,n,2,o);let f=(i&3)===3;if(!r)if(f){let E=t.preOrderCheckHooks;E!==null&&vr(e,E,null)}else{let E=t.preOrderHooks;E!==null&&br(e,E,0,null),lc(e,0)}if(s||db(e),Ip(e),Tp(e,0),t.contentQueries!==null&&ep(t,e),!r)if(f){let E=t.contentCheckHooks;E!==null&&vr(e,E)}else{let E=t.contentHooks;E!==null&&br(e,E,1),lc(e,1)}fb(t,e);let g=t.components;g!==null&&Mp(e,g,0);let C=t.viewQuery;if(C!==null&&bc(2,C,o),!r)if(f){let E=t.viewCheckHooks;E!==null&&vr(e,E)}else{let E=t.viewHooks;E!==null&&br(e,E,2),lc(e,2)}if(t.firstUpdatePass===!0&&(t.firstUpdatePass=!1),e[Ji]){for(let E of e[Ji])E();e[Ji]=null}r||(Ep(e),e[H]&=-73)}catch(f){wp(e,f,r)}finally{d!==null&&(Yt(d,c),a&&ob(d)),lr()}}function wp(t,e,n){let o=!1,i=e,r=t,s=V(null);try{for(;r!==null;){if(Ke(r)){r=r[ge];continue}let a=r[Mo];if(a)try{let c=t[je][fe],d=c?.constructor,f={declarationInstance:c,declarationType:d,caughtBy:a},g=V(null);try{a(zu(i),f)}finally{V(g)}o=!0;break}catch(c){i=c}r=r[ge]}}finally{V(s)}if(!o)throw n||pn(t),i}function Tp(t,e){for(let n=Wf(t);n!==null;n=zf(n))for(let o=pe;o<n.length;o++){let i=n[o];Dp(i,e)}}function db(t){for(let e=Wf(t);e!==null;e=zf(e)){if(!(e[H]&2))continue;let n=e[dn];for(let o=0;o<n.length;o++){let i=n[o];Ga(i)}}}function ub(t,e,n){ee(X.ComponentStart);let o=ht(e,t);try{Dp(o,n)}finally{ee(X.ComponentEnd,o[fe])}}function Dp(t,e){nr(t)&&Sc(t,e)}function Sc(t,e){let o=t[$],i=t[H],r=t[$e],s=!!(e===0&&i&16);if(s||=!!(i&64&&e===0),s||=!!(i&1024),s||=!!(r?.dirty&&wn(r)),s||=!1,r&&(r.dirty=!1),t[H]&=-9217,s)lb(o,t,o.template,t[fe]);else if(i&8192){let a=V(null);try{try{Ip(t)}catch(d){wp(t,d,!1)}Tp(t,1);let c=o.components;c!==null&&Mp(t,c,1),Ep(t)}finally{V(a)}}}function Mp(t,e,n){for(let o=0;o<e.length;o++)ub(t,e[o],n)}function fb(t,e){let n=t.hostBindingOpCodes;if(n!==null)try{for(let o=0;o<n.length;o++){let i=n[o];if(i<0)jt(~i);else{let r=i,s=n[++o],a=n[++o];Ru(s,r);let c=e[r];ee(X.HostBindingsUpdateStart,c);try{a(2,c)}finally{ee(X.HostBindingsUpdateEnd,c)}}}}finally{jt(-1)}}function ul(t,e){let n=Xa()?64:1088;for(t[pt].changeDetectionScheduler?.notify(e);t;){t[H]|=n;let o=wt(t);if(Bn(t)&&!o)return t;t=o}return null}function Np(t,e,n,o){return[t,!0,0,e,null,o,null,n,null,null]}function kp(t,e){let n=pe+e;if(n<t.length)return t[n]}function Wr(t,e,n,o=!0){let i=e[$];if(pb(i,e,t,n),o){let s=Cc(n,t),a=e[de],c=a.parentNode(t[ln]);c!==null&&x0(i,t[Pe],a,e,c,s)}let r=e[Vn];r!==null&&r.firstChild!==null&&(r.firstChild=null)}function Rp(t,e){let n=Ho(t,e);return n!==void 0&&Br(n[$],n),n}function Ho(t,e){if(t.length<=pe)return;let n=pe+e,o=t[n];if(o){let i=o[Lt];i!==null&&i!==t&&nl(i,o),e>0&&(t[n-1][qe]=o[qe]);let r=Io(t,pe+e);E0(o[$],o);let s=r[mt];s!==null&&s.detachView(r[$]),o[ge]=null,o[qe]=null,o[H]&=-129}return o}function pb(t,e,n,o){let i=pe+o,r=n.length;o>0&&(n[i-1][qe]=e),o<r-pe?(e[qe]=n[i],Ra(n,pe+o,e)):(n.push(e),e[qe]=null),e[ge]=n;let s=e[Lt];s!==null&&n!==s&&Ap(s,e);let a=e[mt];a!==null&&a.insertView(t),or(e),e[H]|=128}function Ap(t,e){let n=t[dn],o=e[ge];if(Ft(o))t[H]|=2;else{let i=o[ge][je];e[je]!==i&&(t[H]|=2)}n===null?t[dn]=[e]:n.push(e)}var Zn=class{_lView;_cdRefInjectingView;_appRef=null;_attachedToViewContainer=!1;exhaustive;get rootNodes(){let e=this._lView,n=e[$];return Bo(n,e,n.firstChild,[])}constructor(e,n){this._lView=e,this._cdRefInjectingView=n}get context(){return this._lView[fe]}set context(e){this._lView[fe]=e}get destroyed(){return fn(this._lView)}destroy(){if(this._appRef)this._appRef.detachView(this);else if(this._attachedToViewContainer){let e=this._lView[ge];if(Ke(e)){let n=e[No],o=n?n.indexOf(this):-1;o>-1&&(Ho(e,o),Io(n,o))}this._attachedToViewContainer=!1}Br(this._lView[$],this._lView)}onDestroy(e){ir(this._lView,e)}markForCheck(){ul(this._cdRefInjectingView||this._lView,4)}detach(){this._lView[H]&=-129}reattach(){or(this._lView),this._lView[H]|=128}detectChanges(){this._lView[H]|=1024,Sp(this._lView)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new U(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null;let e=Bn(this._lView),n=this._lView[Lt];n!==null&&!e&&nl(n,this._lView),lp(this._lView[$],this._lView)}attachToAppRef(e){if(this._attachedToViewContainer)throw new U(902,!1);this._appRef=e;let n=Bn(this._lView),o=this._lView[Lt];o!==null&&!n&&Ap(o,this._lView),or(this._lView)}};var Uo=(()=>{class t{_declarationLView;_declarationTContainer;elementRef;static __NG_ELEMENT_ID__=mb;constructor(n,o,i){this._declarationLView=n,this._declarationTContainer=o,this.elementRef=i}get ssrId(){return this._declarationTContainer.tView?.ssrId||null}createEmbeddedView(n,o){return this.createEmbeddedViewImpl(n,o)}createEmbeddedViewImpl(n,o,i){let r=Gr(this._declarationLView,this._declarationTContainer,n,{embeddedViewInjector:o,dehydratedView:i});return new Zn(r)}}return t})();function mb(){return fl(Ze(),W())}function fl(t,e){return t.type&4?new Uo(e,t,Yn(t,e)):null}function Ko(t,e,n,o,i){let r=t.data[e];if(r===null)r=hb(t,e,n,o,i),ku()&&(r.flags|=32);else if(r.type&64){r.type=n,r.value=o,r.attrs=i;let s=Tu();r.injectorIndex=s===null?-1:s.injectorIndex}return mn(r,!0),r}function hb(t,e,n,o,i){let r=Qa(),s=Ya(),a=s?r:r&&r.parent,c=t.data[e]=yb(t,a,n,e,o,i);return gb(t,c,r,s),c}function gb(t,e,n,o){t.firstChild===null&&(t.firstChild=e),n!==null&&(o?n.child==null&&e.parent!==null&&(n.child=e):n.next===null&&(n.next=e,e.prev=n))}function yb(t,e,n,o,i,r){let s=e?e.injectorIndex:-1,a=0;return wu()&&(a|=128),{type:n,index:o,insertBeforeIndex:null,injectorIndex:s,directiveStart:-1,directiveEnd:-1,directiveStylingLast:-1,componentOffset:-1,controlDirectiveIndex:-1,customControlIndex:-1,propertyBindings:null,flags:a,providerIndexes:0,value:i,namespace:nc(),attrs:r,mergedAttrs:null,localNames:null,initialInputs:null,inputs:null,hostDirectiveInputs:null,outputs:null,hostDirectiveOutputs:null,directiveToIndex:null,tView:null,next:null,prev:null,projectionNext:null,child:null,parent:e,projection:null,styles:null,stylesWithoutHost:null,residualStyles:void 0,classes:null,classesWithoutHost:null,residualClasses:void 0,classBindings:0,styleBindings:0}}function vb(t){let e=t[ja]??[],o=t[ge][de],i=[];for(let r of e)r.data[Qf]!==void 0?i.push(r):bb(r,o);t[ja]=i}function bb(t,e){let n=0,o=t.firstChild;if(o){let i=t.data[Zf];for(;n<i;){let r=o.nextSibling;ip(e,o,!1),o=r,n++}}}var _b=()=>null,Eb=()=>null;function wc(t,e){return _b(t,e)}function Op(t,e,n){return Eb(t,e,n)}var Pp=class{},vn=class{};var Lp=(()=>{class t{static \u0275prov=K({token:t,providedIn:"root",factory:()=>null})}return t})();function Fp(t){return t.debugInfo?.className||t.type.name||null}var Er={},Tr=class{injector;parentInjector;constructor(e,n){this.injector=e,this.parentInjector=n}get(e,n,o){let i=this.injector.get(e,Er,o);return i!==Er||n===Er?i:this.parentInjector.get(e,n,o)}};function xb(t,e,n){return t[e]=n}function Cb(t,e){return t[e]}function Qe(t,e,n){if(n===xe)return!1;let o=t[e];return Object.is(o,n)?!1:(t[e]=n,!0)}function Dr(t,e,n,o){let i=Qe(t,e,n);return Qe(t,e+1,o)||i}function Ib(t,e,n,o,i){let r=Dr(t,e,n,o);return Qe(t,e+2,i)||r}function Sb(t,e,n,o,i,r){let s=Dr(t,e,n,o);return Dr(t,e+2,i,r)||s}function xr(t,e,n){return function o(i){let r=o.__ngNativeEl__;r!==void 0&&qv(i,r);let s=Vt(t)?ht(t.index,e):e;ul(s,5);let a=e[fe],c=pf(e,a,n,i),d=o.__ngNextListenerFn__;for(;d;)c=pf(e,a,d,i)&&c,d=d.__ngNextListenerFn__;return c}}function pf(t,e,n,o){let i=V(null);try{return ee(X.OutputStart,e,n),n(o)!==!1}catch(r){return Y0(t,r),!1}finally{ee(X.OutputEnd,e,n),V(i)}}function Vp(t,e,n,o,i,r,s,a){let c=Xi(t),d=!1,f=null;if(!o&&c&&(f=Tb(e,n,r,t.index)),f!==null){let g=f.__ngLastListenerFn__||f;g.__ngNextListenerFn__=s,f.__ngLastListenerFn__=s,d=!0}else{let g=st(t,n),C=o?o(g):g;Zv(n,C,r,a),o||(a.__ngNativeEl__=g);let E=i.listen(C,r,a);if(!wb(r)){let P=o?Z=>o(Ie(Z[t.index])):t.index;jp(P,e,n,r,a,E,!1)}}return d}function wb(t){return t.startsWith("animation")||t.startsWith("transition")}function Tb(t,e,n,o){let i=t.cleanup;if(i!=null)for(let r=0;r<i.length-1;r+=2){let s=i[r];if(s===n&&i[r+1]===o){let a=e[jn],c=i[r+2];return a&&a.length>c?a[c]:null}typeof s=="string"&&(r+=2)}return null}function jp(t,e,n,o,i,r,s){let a=e.firstCreatePass?za(e):null,c=Wa(n),d=c.length;c.push(i,r),a&&a.push(o,t,d,(d+1)*(s?-1:1))}function mf(t,e,n,o,i,r){let s=e[n],a=e[$],d=a.data[n].outputs[o],g=s[d].subscribe(r);jp(t.index,a,e,i,r,g,!0)}var Tc=Symbol("BINDING");var _n=new J("");function Mr(t,e,n){let o=n?t.styles:null,i=n?t.classes:null,r=0;if(e!==null)for(let s=0;s<e.length;s++){let a=e[s];if(typeof a=="number")r=a;else if(r==1)i=Bi(i,a);else if(r==2){let c=a,d=e[++s];o=Bi(o,c+": "+d+";")}}n?t.styles=o:t.stylesWithoutHost=o,n?t.classes=i:t.classesWithoutHost=i}function $p(t,e=0){let n=W();if(n===null)return te(t,e);let o=Ze();return $f(o,n,Fe(t),e)}function Db(t,e,n,o,i){let r=o===null?null:{"":-1},s=i(t,n);if(s!==null){let a=s,c=null,d=null;for(let f of s)if(f.resolveHostDirectives!==null){[a,c,d]=f.resolveHostDirectives(s);break}kb(t,e,n,a,r,c,d)}r!==null&&o!==null&&Mb(n,o,r)}function Mb(t,e,n){let o=t.localNames=[];for(let i=0;i<e.length;i+=2){let r=n[e[i+1]];if(r==null)throw new U(-301,!1);o.push(e[i],r)}}function Nb(t,e,n){e.componentOffset=n,(t.components??=[]).push(e.index)}function kb(t,e,n,o,i,r,s){let a=o.length,c=null;for(let C=0;C<a;C++){let E=o[C];c===null&&un(E)&&(c=E,Nb(t,n,C)),Lv(Lf(n,e),t,E.type)}Fb(n,t.data.length,a),c?.viewProvidersResolver&&c.viewProvidersResolver(c);for(let C=0;C<a;C++){let E=o[C];E.providersResolver&&E.providersResolver(E)}let d=!1,f=!1,g=fp(t,e,a,null);a>0&&(n.directiveToIndex=new Map);for(let C=0;C<a;C++){let E=o[C];if(n.mergedAttrs=Lr(n.mergedAttrs,E.hostAttrs),Ab(t,n,e,g,E),Lb(g,E,i),s!==null&&s.has(E)){let[Z,Y]=s.get(E);n.directiveToIndex.set(E.type,[g,Z+n.directiveStart,Y+n.directiveStart])}else(r===null||!r.has(E))&&n.directiveToIndex.set(E.type,g);E.contentQueries!==null&&(n.flags|=4),(E.hostBindings!==null||E.hostAttrs!==null||E.hostVars!==0)&&(n.flags|=64);let P=E.type.prototype;!d&&(P.ngOnChanges||P.ngOnInit||P.ngDoCheck)&&((t.preOrderHooks??=[]).push(n.index),d=!0),!f&&(P.ngOnChanges||P.ngDoCheck)&&((t.preOrderCheckHooks??=[]).push(n.index),f=!0),g++}Rb(t,n,r)}function Rb(t,e,n){for(let o=e.directiveStart;o<e.directiveEnd;o++){let i=t.data[o];if(n===null||!n.has(i))hf(0,e,i,o),hf(1,e,i,o),yf(e,o,!1);else{let r=n.get(i);gf(0,e,r,o),gf(1,e,r,o),yf(e,o,!0)}}}function hf(t,e,n,o){let i=t===0?n.inputs:n.outputs;for(let r in i)if(Object.hasOwn(i,r)){let s;t===0?s=e.inputs??={}:s=e.outputs??={},s[r]??=[],s[r].push(o),Bp(e,r)}}function gf(t,e,n,o){let i=t===0?n.inputs:n.outputs;for(let r in i)if(Object.hasOwn(i,r)){let s=i[r],a;t===0?a=e.hostDirectiveInputs??={}:a=e.hostDirectiveOutputs??={},a[s]??=[],a[s].push(o,r),Bp(e,s)}}function Bp(t,e){e==="class"?t.flags|=8:e==="style"&&(t.flags|=16)}function yf(t,e,n){let{attrs:o,inputs:i,hostDirectiveInputs:r}=t;if(o===null||!n&&i===null||n&&r===null||Yc(t)){t.initialInputs??=[],t.initialInputs.push(null);return}let s=null,a=0;for(;a<o.length;){let c=o[a];if(c===0){a+=4;continue}else if(c===5){a+=2;continue}else if(typeof c=="number")break;if(!n&&Object.hasOwn(i,c)){let d=i[c];for(let f of d)if(f===e){s??=[],s.push(c,o[a+1]);break}}else if(n&&Object.hasOwn(r,c)){let d=r[c];for(let f=0;f<d.length;f+=2)if(d[f]===e){s??=[],s.push(d[f+1],o[a+1]);break}}a+=2}t.initialInputs??=[],t.initialInputs.push(s)}function Ab(t,e,n,o,i){t.data[o]=i;let r=i.factory||(i.factory=On(i.type,!0)),s=new Fo(r,un(i),$p,null);t.blueprint[o]=s,n[o]=s,Ob(t,e,o,fp(t,n,i.hostVars,xe),i)}function Ob(t,e,n,o,i){let r=i.hostBindings;if(r){let s=t.hostBindingOpCodes;s===null&&(s=t.hostBindingOpCodes=[]);let a=~e.index;Pb(s)!=a&&s.push(a),s.push(n,o,r)}}function Pb(t){let e=t.length;for(;e>0;){let n=t[--e];if(typeof n=="number"&&n<0)return n}return 0}function Lb(t,e,n){if(n){if(e.exportAs)for(let o=0;o<e.exportAs.length;o++)n[e.exportAs[o]]=t;un(e)&&(n[""]=t)}}function Fb(t,e,n){t.flags|=1,t.directiveStart=e,t.directiveEnd=e+n,t.providerIndexes=e}function Hp(t,e,n,o,i,r,s,a){let c=e[$],d=c.consts,f=gt(d,s),g=Ko(c,t,n,o,f);return r&&Db(c,e,g,gt(d,a),i),g.mergedAttrs=Lr(g.mergedAttrs,g.attrs),g.attrs!==null&&Mr(g,g.attrs,!1),g.mergedAttrs!==null&&Mr(g,g.mergedAttrs,!0),c.queries!==null&&c.queries.elementStart(c,g),g}function Up(t,e){Sv(t,e),$a(e)&&t.queries.elementEnd(e)}function Vb(t,e,n,o,i,r){let s=e.consts,a=gt(s,i),c=Ko(e,t,n,o,a);if(c.mergedAttrs=Lr(c.mergedAttrs,c.attrs),r!=null){let d=gt(s,r);c.localNames=[];for(let f=0;f<d.length;f+=2)c.localNames.push(d[f],-1)}return c.attrs!==null&&Mr(c,c.attrs,!1),c.mergedAttrs!==null&&Mr(c,c.mergedAttrs,!0),e.queries!==null&&e.queries.elementStart(e,c),c}var Gp=typeof ShadowRoot<"u",jb=typeof Document<"u";function $b(t){return Object.keys(t).map(e=>{let[n,o,i]=t[e],r={propName:n,templateName:e,isSignal:(o&Ur.SignalBased)!==0};return i&&(r.transform=i),r})}function Bb(t){return Object.keys(t).map(e=>({propName:t[e],templateName:e}))}function Hb(t,e,n){let o=e instanceof it?e:e?.injector;return o&&t.getStandaloneInjector!==null&&(o=t.getStandaloneInjector(o)||o),o?new Tr(n,o):n}function Ub(t){let e=t.get(vn,null);if(e===null)throw new U(407,!1);let n=t.get(Lp,null),o=t.get(Tt,null),i=t.get(vt,null,{optional:!0});return{rendererFactory:e,sanitizer:n,changeDetectionScheduler:o,ngReflect:!1,tracingService:i}}function Gb(t,e,n){let o=Wp(t);return np(e,o,o==="svg"?yu:o==="math"?vu:n)}function Wb(t){if((t&&"localName"in t&&typeof t.localName=="string"?t.localName:t?.tagName)?.toLowerCase()==="script")throw new U(905,!1)}function Wp(t){return(t.selectors[0][0]||"div").toLowerCase()}var Go=class{componentDef;ngModule;selector;componentType;ngContentSelectors;isBoundToModule;cachedInputs=null;cachedOutputs=null;get inputs(){return this.cachedInputs??=$b(this.componentDef.inputs),this.cachedInputs}get outputs(){return this.cachedOutputs??=Bb(this.componentDef.outputs),this.cachedOutputs}constructor(e,n){this.componentDef=e,this.ngModule=n,this.componentType=e.type,this.selector=f0(e.selectors),this.ngContentSelectors=e.ngContentSelectors??[],this.isBoundToModule=!!n}create(e,n,o,i,r,s,a,c){ee(X.DynamicComponentStart);let d=V(null);try{let f=this.componentDef,g=Hb(f,i||this.ngModule,e),C=Ub(g),E=C.tracingService;return E&&E.componentCreate?E.componentCreate(Fp(f),()=>this.createComponentRef(C,g,n,o,r,s,a,c)):this.createComponentRef(C,g,n,o,r,s,a,c)}finally{V(d)}}createComponentRef(e,n,o,i,r,s,a,c){let d=this.componentDef,f=zb(i,d,s,r,c),g=e.rendererFactory.createRenderer(null,d),C=i?V0(g,i,d.encapsulation,n):Gb(d,g,a??null);Wb(C);let E=n.get(_n,null),P=qb(C,()=>n.get(Ne,null)??Kf());E&&E.addHost(P);let Z=s?.some(vf)||r?.some(se=>typeof se!="function"&&se.bindings.some(vf)),Y=sl(null,f,null,512|up(d),null,null,e,g,n,null,Xf(C,n,!0));E&&Gp&&P instanceof ShadowRoot&&ir(Y,()=>{E.removeHost(P)}),Y[ye]=C,cr(Y);let ve=null;try{let se=Hp(ye,Y,2,"#host",()=>f.directiveRegistry,!0,0);rp(g,C,se),Kn(C,Y),hp(f,Y,se),tp(f,se,Y),Up(f,se),o!==void 0&&Zb(se,this.ngContentSelectors,o),ve=ht(se.index,Y),Y[fe]=ve[fe],dl(f,Y,null)}catch(se){throw ve!==null&&yc(ve),yc(Y),se}finally{ee(X.DynamicComponentEnd),lr()}return new Nr(this.componentType,Y,!!Z)}};function zb(t,e,n,o,i){let r=t?["ng-version","22.2.5"]:p0(e.selectors[0]),s=null,a=null,c=0;if(n)for(let g of n)c+=g[Tc].requiredVars,g.create&&(g.targetIdx=0,(s??=[]).push(g)),g.update&&(g.targetIdx=0,(a??=[]).push(g));if(o)for(let g=0;g<o.length;g++){let C=o[g];if(typeof C!="function")for(let E of C.bindings){c+=E[Tc].requiredVars;let P=g+1;E.create&&(E.targetIdx=P,(s??=[]).push(E)),E.update&&(E.targetIdx=P,(a??=[]).push(E))}}let d=[e];if(o)for(let g of o){let C=typeof g=="function"?g:g.type,E=Wi(C);d.push(E)}return rl(0,null,Kb(s,a),1,c,d,null,null,null,[r],null)}function qb(t,e){let n=t.getRootNode?.();return jb&&n instanceof Document?n.head:n&&Gp&&n instanceof ShadowRoot?n:e().head}function Kb(t,e){return!t&&!e?null:n=>{if(n&1&&t)for(let o of t)o.create();if(n&2&&e)for(let o of e)o.update()}}function vf(t){let e=t[Tc].kind;return e==="input"||e==="twoWay"}var Nr=class extends Pp{_rootLView;_hasInputBindings;instance;hostView;changeDetectorRef;componentType;location;previousInputValues=null;_tNode;constructor(e,n,o){super(),this._rootLView=n,this._hasInputBindings=o,this._tNode=er(n[$],ye),this.location=Yn(this._tNode,n),this.instance=ht(this._tNode.index,n)[fe],this.hostView=this.changeDetectorRef=new Zn(n,void 0),this.componentType=e}setInput(e,n){this._hasInputBindings;let o=this._tNode;if(this.previousInputValues??=new Map,this.previousInputValues.has(e)&&Object.is(this.previousInputValues.get(e),n))return;let i=this._rootLView,r=ll(o,i[$],i,e,n);this.previousInputValues.set(e,n);let s=ht(o.index,i);ul(s,1)}get injector(){return new Mt(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(e){this.hostView.onDestroy(e)}};function Zb(t,e,n){let o=t.projection=[];for(let i=0;i<e.length;i++){let r=n[i];o.push(r!=null&&r.length?Array.from(r):null)}}var zr=(()=>{class t{static __NG_ELEMENT_ID__=Qb}return t})();function Qb(){let t=Ze();return zp(t,W())}var Dc=class t extends zr{_lContainer;_hostTNode;_hostLView;constructor(e,n,o){super(),this._lContainer=e,this._hostTNode=n,this._hostLView=o}get element(){return Yn(this._hostTNode,this._hostLView)}get injector(){return new Mt(this._hostTNode,this._hostLView)}get parentInjector(){let e=Wc(this._hostTNode,this._hostLView);if(Af(e)){let n=Ir(e,this._hostLView),o=Cr(e),i=n[$].data[o+8];return new Mt(i,n)}else return new Mt(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(e){let n=bf(this._lContainer);return n!==null&&n[e]||null}get length(){return this._lContainer.length-pe}createEmbeddedView(e,n,o){let i,r,s;typeof o=="number"?i=o:o!=null&&(i=o.index,r=o.injector,s=o.onError);let a=wc(this._lContainer,e.ssrId),c=e.createEmbeddedViewImpl(n||{},r,a);return s&&(c._lView[Mo]=s),this.insertImpl(c,i,$o(this._hostTNode,a)),c}createComponent(e,n,o,i,r,s,a){let c,d,f=n||{};c=f.index,o=f.injector,i=f.projectableNodes,r=f.environmentInjector||f.ngModuleRef,s=f.directives,a=f.bindings,d=f.onError;let g=new Go(sn(e)),C=o||this.parentInjector;if(!r&&g.ngModule==null){let se=this.parentInjector.get(it,null);se&&(r=se)}let E=sn(g.componentType??{}),P=wc(this._lContainer,E?.id??null),Z=P?.firstChild??null,Y=g.create(C,i,Z,r,s,a,this._getHostElementNamespace());return d&&(Y.hostView._lView[Mo]=d),this.insertImpl(Y.hostView,c,$o(this._hostTNode,P)),Y}_getHostElementNamespace(){if(this._hostTNode.type&2){let e=this._hostTNode.parent??this._hostLView[Pe];return e!==null&&e.type&2&&typeof e.value=="string"&&e.value.toLowerCase()==="foreignobject"?null:e?.namespace??null}return this._hostTNode.namespace}insert(e,n){return this.insertImpl(e,n,!0)}insertImpl(e,n,o){let i=e._lView;if(bu(i)){let a=this.indexOf(e);if(a!==-1)this.detach(a);else{let c=i[ge],d=new t(c,c[Pe],c[ge]);d.detach(d.indexOf(e))}}let r=this._adjustIndex(n),s=this._lContainer;return Wr(s,i,r,o),e.attachToViewContainerRef(),Ra(fc(s),r,e),e}move(e,n){return this.insert(e,n)}indexOf(e){let n=bf(this._lContainer);return n!==null?n.indexOf(e):-1}remove(e){let n=this._adjustIndex(e,-1),o=Ho(this._lContainer,n);o&&(Io(fc(this._lContainer),n),Br(o[$],o))}detach(e){let n=this._adjustIndex(e,-1),o=Ho(this._lContainer,n);return o&&Io(fc(this._lContainer),n)!=null?new Zn(o):null}_adjustIndex(e,n=0){return e??this.length+n}};function bf(t){return t[No]}function fc(t){return t[No]||(t[No]=[])}function zp(t,e){let n,o=e[t.index];return Ke(o)?n=o:(n=Np(o,e,null,t),e[t.index]=n,al(e,n)),Jb(n,e,t,o),new Dc(n,t,e)}function Yb(t,e){let n=t[de],o=n.createComment(""),i=st(e,t),r=n.parentNode(i);return yn(n,r,o,n.nextSibling(i),!1),o}var Jb=t_,Xb=()=>!1;function e_(t,e,n){return Xb(t,e,n)}function t_(t,e,n,o){if(t[ln])return;let i;n.type&8?i=Ie(o):i=Yb(e,n),t[ln]=i}var Mc=class t{queryList;matches=null;constructor(e){this.queryList=e}clone(){return new t(this.queryList)}setDirty(){this.queryList.setDirty()}},Nc=class t{queries;constructor(e=[]){this.queries=e}createEmbeddedView(e){let n=e.queries;if(n!==null){let o=e.contentQueries!==null?e.contentQueries[0]:n.length,i=[];for(let r=0;r<o;r++){let s=n.getByIndex(r),a=this.queries[s.indexInDeclarationView];i.push(a.clone())}return new t(i)}return null}insertView(e){this.dirtyQueriesWithMatches(e)}detachView(e){this.dirtyQueriesWithMatches(e)}finishViewCreation(e){this.dirtyQueriesWithMatches(e)}dirtyQueriesWithMatches(e){for(let n=0;n<this.queries.length;n++)Zp(e,n).matches!==null&&this.queries[n].setDirty()}},kc=class{flags;read;predicate;constructor(e,n,o=null){this.flags=n,this.read=o,typeof e=="string"?this.predicate=c_(e):this.predicate=e}},Rc=class t{queries;constructor(e=[]){this.queries=e}elementStart(e,n){for(let o=0;o<this.queries.length;o++)this.queries[o].elementStart(e,n)}elementEnd(e){for(let n=0;n<this.queries.length;n++)this.queries[n].elementEnd(e)}embeddedTView(e){let n=null;for(let o=0;o<this.length;o++){let i=n!==null?n.length:0,r=this.getByIndex(o).embeddedTView(e,i);r&&(r.indexInDeclarationView=o,n!==null?n.push(r):n=[r])}return n!==null?new t(n):null}template(e,n){for(let o=0;o<this.queries.length;o++)this.queries[o].template(e,n)}getByIndex(e){return this.queries[e]}get length(){return this.queries.length}track(e){this.queries.push(e)}},Ac=class t{metadata;matches=null;indexInDeclarationView=-1;crossesNgTemplate=!1;_declarationNodeIndex;_appliesToNextNode=!0;constructor(e,n=-1){this.metadata=e,this._declarationNodeIndex=n}elementStart(e,n){this.isApplyingToNode(n)&&this.matchTNode(e,n)}elementEnd(e){this._declarationNodeIndex===e.index&&(this._appliesToNextNode=!1)}template(e,n){this.elementStart(e,n)}embeddedTView(e,n){return this.isApplyingToNode(e)?(this.crossesNgTemplate=!0,this.addMatch(-e.index,n),new t(this.metadata)):null}isApplyingToNode(e){if(this._appliesToNextNode&&(this.metadata.flags&1)!==1){let n=this._declarationNodeIndex,o=e.parent;for(;o!==null&&o.type&8&&o.index!==n;)o=o.parent;return n===(o!==null?o.index:-1)}return this._appliesToNextNode}matchTNode(e,n){let o=this.metadata.predicate;if(Array.isArray(o))for(let i=0;i<o.length;i++){let r=o[i];this.matchTNodeWithReadOption(e,n,n_(n,r)),this.matchTNodeWithReadOption(e,n,_r(n,e,r,!1,!1))}else o===Uo?n.type&4&&this.matchTNodeWithReadOption(e,n,-1):this.matchTNodeWithReadOption(e,n,_r(n,e,o,!1,!1))}matchTNodeWithReadOption(e,n,o){if(o!==null){let i=this.metadata.read;if(i!==null)if(i===qo||i===zr||i===Ce||i===Uo&&n.type&4)this.addMatch(n.index,-2);else{let r=_r(n,e,i,!1,!1);r!==null&&this.addMatch(n.index,r)}else this.addMatch(n.index,o)}}addMatch(e,n){this.matches===null?this.matches=[e,n]:this.matches.push(e,n)}};function n_(t,e){let n=t.localNames;if(n!==null){for(let o=0;o<n.length;o+=2)if(n[o]===e)return n[o+1]}return null}function o_(t,e){return t.type&11?Yn(t,e):t.type&4?fl(t,e):null}function i_(t,e,n,o){return n===-1?o_(e,t):n===-2?r_(t,e,o):Sr(t,t[$],n,e)}function r_(t,e,n){if(n===qo)return Yn(e,t);if(n===Uo)return fl(e,t);if(n===zr)return zp(e,t);if(n===Ce)return new Mt(e,t)}function qp(t,e,n,o){let i=e[mt].queries[o];if(i.matches===null){let r=t.data,s=n.matches,a=[];for(let c=0;s!==null&&c<s.length;c+=2){let d=s[c];if(d<0)a.push(null);else{let f=r[d];a.push(i_(e,f,s[c+1],n.metadata.read))}}i.matches=a}return i.matches}function Oc(t,e,n,o){let i=t.queries.getByIndex(n),r=i.matches;if(r!==null){let s=qp(t,e,i,n);for(let a=0;a<r.length;a+=2){let c=r[a];if(c>0)o.push(s[a/2]);else{let d=r[a+1],f=e[-c];for(let g=pe;g<f.length;g++){let C=f[g];C[Lt]===C[ge]&&Oc(C[$],C,d,o)}if(f[dn]!==null){let g=f[dn];for(let C=0;C<g.length;C++){let E=g[C];Oc(E[$],E,d,o)}}}}}return o}function Kp(t,e){return t[mt].queries[e].queryList}function s_(t,e,n){let o=new wr((n&4)===4);return xu(t,e,o,o.destroy),(e[mt]??=new Nc).queries.push(new Mc(o))-1}function a_(t,e,n){let o=Se();return o.firstCreatePass&&(l_(o,new kc(t,e,n),-1),(e&2)===2&&(o.staticViewQueries=!0)),s_(o,W(),e)}function c_(t){return t.split(",").map(e=>e.trim())}function l_(t,e,n){t.queries===null&&(t.queries=new Rc),t.queries.track(new Ac(e,n))}function Zp(t,e){return t.queries.getByIndex(e)}function d_(t,e){let n=t[$],o=Zp(n,e);return o.crossesNgTemplate?Oc(n,t,e,[]):qp(n,t,o,e)}function Qp(t,e,n){let o,i=ho(()=>{o._dirtyCounter();let r=f_(o,t);if(e&&r===void 0)throw new U(-951,!1);return r});return o=i[Ee],o._dirtyCounter=A(0),o._flatValue=void 0,i}function Yp(t){return Qp(!0,!1,t)}function Jp(t){return Qp(!0,!0,t)}function u_(t,e){let n=t[Ee];n._lView=W(),n._queryIndex=e,n._queryList=Kp(n._lView,e),n._queryList.onDirty(()=>n._dirtyCounter.update(o=>o+1))}function f_(t,e){let n=t._lView,o=t._queryIndex;if(n===void 0||o===void 0||n[H]&4)return e?void 0:ot;let i=Kp(n,o),r=d_(n,o);return i.reset(r,Hv),e?i.first:i._changesDetected||t._flatValue===void 0?t._flatValue=i.toArray():t._flatValue}function pl(t){return!!t&&typeof t.then=="function"}function Xp(t){return!!t&&typeof t.subscribe=="function"}var kr=class{};var Wo=class extends kr{injector;instance=null;constructor(e){super();let n=new on([...e.providers,{provide:kr,useValue:this}],e.parent||To(),e.debugName,new Set(["environment"]));this.injector=n,e.runEnvironmentInitializers&&n.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(e){this.injector.onDestroy(e)}};function em(t,e,n=null){return new Wo({providers:t,parent:e,debugName:n,runEnvironmentInitializers:!0}).injector}var p_=(()=>{class t{_injector;cachedInjectors=new Map;constructor(n){this._injector=n}getOrCreateStandaloneInjector(n){if(!n.standalone)return null;if(!this.cachedInjectors.has(n)){let o=Pa(!1,n.type),i=o.length>0?em([o],this._injector,""):null;this.cachedInjectors.set(n,i)}return this.cachedInjectors.get(n)}ngOnDestroy(){try{for(let n of this.cachedInjectors.values())n!==null&&n.destroy()}finally{this.cachedInjectors.clear()}}static \u0275prov=K({token:t,providedIn:"environment",factory:()=>new t(te(it))})}return t})();function ie(t){return kf(()=>{let e=y_(t),n=x(v({},e),{decls:t.decls,vars:t.vars,template:t.template,consts:t.consts||null,ngContentSelectors:t.ngContentSelectors,onPush:t.changeDetection!==zc.Eager,directiveDefs:null,pipeDefs:null,dependencies:e.standalone&&t.dependencies||null,getStandaloneInjector:e.standalone?i=>i.get(p_).getOrCreateStandaloneInjector(n):null,getExternalStyles:null,signals:t.signals??!1,data:t.data||{},encapsulation:t.encapsulation||lt.Emulated,styles:t.styles||ot,_:null,schemas:t.schemas||null,tView:null,id:""});e.standalone&&$t("NgStandalone"),v_(n);let o=t.dependencies;return n.directiveDefs=_f(o,m_),n.pipeDefs=_f(o,nu),n.id=b_(n),n})}function m_(t){return sn(t)||Wi(t)}function h_(t,e){if(t==null)return Qi;let n={};for(let o in t)if(Object.hasOwn(t,o)){let i=t[o],r,s,a,c;Array.isArray(i)?(a=i[0],r=i[1],s=i[2]??r,c=i[3]||null):(r=i,s=i,a=Ur.None,c=null),n[r]=[o,a,c],e[r]=s}return n}function g_(t){if(t==null)return Qi;let e={};for(let n in t)Object.hasOwn(t,n)&&(e[t[n]]=n);return e}function y_(t){let e={};return{type:t.type,providersResolver:null,viewProvidersResolver:null,factory:null,hostBindings:t.hostBindings||null,hostVars:t.hostVars||0,hostAttrs:t.hostAttrs||null,contentQueries:t.contentQueries||null,declaredInputs:e,inputConfig:t.inputs||Qi,exportAs:t.exportAs||null,standalone:t.standalone??!0,signals:t.signals===!0,selectors:t.selectors||ot,viewQuery:t.viewQuery||null,features:t.features||null,setInput:null,resolveHostDirectives:null,hostDirectives:null,controlDef:null,signalFormsInputPresence:null,inputs:h_(t.inputs,e),outputs:g_(t.outputs),debugInfo:null}}function v_(t){t.features?.forEach(e=>e(t))}function _f(t,e){return t?()=>{let n=typeof t=="function"?t():t,o=[];for(let i of n){let r=e(i);r!==null&&o.push(r)}return o}:null}function b_(t){let e=0,n=typeof t.consts=="function"?"":t.consts,o=[t.selectors,t.ngContentSelectors,t.hostVars,t.hostAttrs,n,t.vars,t.decls,t.encapsulation,t.standalone,t.signals,t.exportAs,JSON.stringify(t.inputs),JSON.stringify(t.outputs),Object.getOwnPropertyNames(t.type.prototype),!!t.contentQueries,!!t.viewQuery];for(let r of o.join("|"))e=Math.imul(31,e)+r.charCodeAt(0)<<0;return e+=2147483648,"c"+e}var tm=new J("");var ml=(()=>{class t{resolve;reject;initialized=!1;done=!1;donePromise=new Promise((n,o)=>{this.resolve=n,this.reject=o});appInits=w(tm,{optional:!0})??[];injector=w(Ce);constructor(){}runInitializers(){if(this.initialized)return;let n=[];for(let i of this.appInits){let r=Yi(this.injector,i);if(pl(r))n.push(r);else if(Xp(r)){let s=new Promise((a,c)=>{r.subscribe({complete:a,error:c})});n.push(s)}}let o=()=>{this.done=!0,this.resolve()};Promise.all(n).then(()=>{o()}).catch(i=>{this.reject(i)}),n.length===0&&o(),this.initialized=!0}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Fr({token:t,factory:t.\u0275fac})}return t})();function __(t,e,n,o,i,r,s,a){if(n.firstCreatePass){t.mergedAttrs=Lr(t.mergedAttrs,t.attrs);let f=t.tView=rl(2,t,i,r,s,n.directiveRegistry,n.pipeRegistry,null,n.schemas,n.consts,null);n.queries!==null&&(n.queries.template(n,t),f.queries=n.queries.embeddedTView(t))}a&&(t.flags|=a),mn(t,!1);let c=E_(n,e,t,o);ur()&&ol(n,e,c,t),Kn(c,e);let d=Np(c,e,c,t);e[o+ye]=d,al(e,d),e_(d,t,e)}function Rr(t,e,n,o,i,r,s,a,c,d,f){let g=n+ye,C;if(e.firstCreatePass){if(C=Ko(e,g,4,s||null,a||null),d!=null){let E=gt(e.consts,d);C.localNames=[];for(let P=0;P<E.length;P+=2)C.localNames.push(E[P],-1)}}else C=e.data[g];return __(C,t,e,n,o,i,r,c),d!=null&&cl(t,C,f),C}var E_=x_;function x_(t,e,n,o){return fr(!0),e[de].createComment("")}var hl=new J("");var nm=new J("");function om(){Ys(t=>{let e="";throw new U(-600,e)})}var C_=10;var qr=(()=>{class t{_runningTick=!1;_destroyed=!1;_destroyListeners=[];_views=[];internalErrorHandler=w(gn);afterRenderManager=w($r);zonelessEnabled=w(Oo);rootEffectScheduler=w(hr);dirtyFlags=0;tracingSnapshot=null;allTestViews=new Set;autoDetectTestViews=new Set;includeAllTestViews=!1;afterTick=new We;get allViews(){return[...(this.includeAllTestViews?this.allTestViews:this.autoDetectTestViews).keys(),...this._views]}get destroyed(){return this._destroyed}componentTypes=[];components=[];internalPendingTask=w(Un);get isStable(){return this.internalPendingTask.hasPendingTasksObservable.pipe(da(n=>!n))}constructor(){w(vt,{optional:!0})}whenStable(){let n;return new Promise(o=>{n=this.isStable.subscribe({next:i=>{i&&o()}})}).finally(()=>{n.unsubscribe()})}_injector=w(it);_rendererFactory=null;get injector(){return this._injector}bootstrap(n,o){return this.bootstrapImpl(n,o)}bootstrapImpl(n,o,i=Ce.NULL){return this._injector.get(Oe).run(()=>{if(ee(X.BootstrapComponentStart),!this._injector.get(ml).done){let ve="";throw new U(405,ve)}let a=sn(n),c=this._injector.get(kr),d=new Go(a,c);this.componentTypes.push(n);let{hostElement:f,directives:g,bindings:C}=I_(o),E=f||d.selector,P=d.create(i,[],E,c.injector,g,C),Z=P.location.nativeElement,Y=P.injector.get(hl,null);return Y?.registerApplication(Z),P.onDestroy(()=>{this.detachView(P.hostView),Lo(this.components,P),Y?.unregisterApplication(Z)}),this._loadComponent(P),ee(X.BootstrapComponentEnd,P),P})}tick(){this.zonelessEnabled||(this.dirtyFlags|=1),this._tick()}_tick(){ee(X.ChangeDetectionStart),this.tracingSnapshot!==null?this.tracingSnapshot.run(jr.CHANGE_DETECTION,this.tickImpl):this.tickImpl()}tickImpl=()=>{if(this._runningTick)throw ee(X.ChangeDetectionEnd),new U(101,!1);let n=V(null);try{this._runningTick=!0,this.synchronize()}finally{this._runningTick=!1,this.tracingSnapshot?.dispose(),this.tracingSnapshot=null,V(n),this.afterTick.next(),ee(X.ChangeDetectionEnd)}};synchronize(){this._rendererFactory===null&&!this._injector.destroyed&&(this._rendererFactory=this._injector.get(vn,null,{optional:!0}));let n=0;for(;this.dirtyFlags!==0&&n++<C_;){ee(X.ChangeDetectionSyncStart);try{this.synchronizeOnce()}finally{ee(X.ChangeDetectionSyncEnd)}}}synchronizeOnce(){this.dirtyFlags&16&&(this.dirtyFlags&=-17,this.rootEffectScheduler.flush());let n=!1;if(this.dirtyFlags&7){let o=!!(this.dirtyFlags&1);this.dirtyFlags&=-8,this.dirtyFlags|=8;for(let{_lView:i}of this.allViews){if(!o&&!ko(i))continue;let r=o&&!this.zonelessEnabled?0:1;Sp(i,r),n=!0}if(this.dirtyFlags&=-5,this.syncDirtyFlagsWithViews(),this.dirtyFlags&23)return}n||(this._rendererFactory?.begin?.(),this._rendererFactory?.end?.()),this.dirtyFlags&8&&(this.dirtyFlags&=-9,this.afterRenderManager.execute()),this.syncDirtyFlagsWithViews()}syncDirtyFlagsWithViews(){if(this.allViews.some(({_lView:n})=>ko(n))){this.dirtyFlags|=2;return}else this.dirtyFlags&=-8}attachView(n){let o=n;this._views.push(o),o.attachToAppRef(this)}detachView(n){let o=n;Lo(this._views,o),o.detachFromAppRef()}_loadComponent(n){this.attachView(n.hostView);try{this.tick()}catch(i){this.internalErrorHandler(i)}this.components.push(n),this._injector.get(nm,[]).forEach(i=>i(n))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(n=>n()),this._views.slice().forEach(n=>n.destroy())}finally{this._destroyed=!0,this._views=[],this._destroyListeners=[]}}onDestroy(n){return this._destroyListeners.push(n),()=>Lo(this._destroyListeners,n)}destroy(){if(this._destroyed)throw new U(406,!1);let n=this._injector;n.destroy&&!n.destroyed&&n.destroy()}get viewCount(){return this._views.length}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Fr({token:t,factory:t.\u0275fac})}return t})();function I_(t){return t===void 0||typeof t=="string"||t instanceof Element?{hostElement:t}:t}function Lo(t,e){let n=t.indexOf(e);n>-1&&t.splice(n,1)}function z(t,e,n,o){let i=W(),r=hn();if(Qe(i,r,e)){let s=Se(),a=dr();K0(a,i,t,e,n,o)}return z}var Pc=class{destroy(e){}updateValue(e,n){}swap(e,n){let o=Math.min(e,n),i=Math.max(e,n),r=this.detach(i);if(i-o>1){let s=this.detach(o);this.attach(o,r),this.attach(i,s)}else this.attach(o,r)}move(e,n){this.attach(n,this.detach(e))}};function pc(t,e,n,o,i){return t===n&&Object.is(e,o)?1:Object.is(i(t,e),i(n,o))?-1:0}function S_(t,e,n,o){let i,r,s=0,a=t.length-1,c=void 0;if(Array.isArray(e)){V(o);let d=e.length-1;for(V(null);s<=a&&s<=d;){let f=t.at(s),g=e[s],C=pc(s,f,s,g,n);if(C!==0){C<0&&t.updateValue(s,g),s++;continue}let E=t.at(a),P=e[d],Z=pc(a,E,d,P,n);if(Z!==0){Z<0&&t.updateValue(a,P),a--,d--;continue}let Y=n(s,f),ve=n(a,E),se=n(s,g);if(Object.is(se,ve)){let he=n(d,P);Object.is(he,Y)?(t.swap(s,a),t.updateValue(a,P),d--,a--):t.move(a,s),t.updateValue(s,g),s++;continue}if(i??=new Ar,r??=xf(t,s,a,n),Lc(t,i,s,se))t.updateValue(s,g),s++,a++;else if(r.has(se))i.set(Y,t.detach(s)),a--;else{let he=t.create(s,e[s]);t.attach(s,he),s++,a++}}for(;s<=d;)Ef(t,i,n,s,e[s]),s++}else if(e!=null){V(o);let d=e[Symbol.iterator]();V(null);let f=d.next();for(;!f.done&&s<=a;){let g=t.at(s),C=f.value,E=pc(s,g,s,C,n);if(E!==0)E<0&&t.updateValue(s,C),s++,f=d.next();else{i??=new Ar,r??=xf(t,s,a,n);let P=n(s,C);if(Lc(t,i,s,P))t.updateValue(s,C),s++,a++,f=d.next();else if(!r.has(P))t.attach(s,t.create(s,C)),s++,a++,f=d.next();else{let Z=n(s,g);i.set(Z,t.detach(s)),a--}}}for(;!f.done;)Ef(t,i,n,t.length,f.value),f=d.next()}for(;s<=a;)t.destroy(t.detach(a--));i?.forEach(d=>{t.destroy(d)})}function Lc(t,e,n,o){return e!==void 0&&e.has(o)?(t.attach(n,e.get(o)),e.delete(o),!0):!1}function Ef(t,e,n,o,i){if(Lc(t,e,o,n(o,i)))t.updateValue(o,i);else{let r=t.create(o,i);t.attach(o,r)}}function xf(t,e,n,o){let i=new Set;for(let r=e;r<=n;r++)i.add(o(r,t.at(r)));return i}var Ar=class{kvMap=new Map;_vMap=void 0;has(e){return this.kvMap.has(e)}delete(e){if(!this.has(e))return!1;let n=this.kvMap.get(e);return this._vMap!==void 0&&this._vMap.has(n)?(this.kvMap.set(e,this._vMap.get(n)),this._vMap.delete(n)):this.kvMap.delete(e),!0}get(e){return this.kvMap.get(e)}set(e,n){if(this.kvMap.has(e)){let o=this.kvMap.get(e);this._vMap===void 0&&(this._vMap=new Map);let i=this._vMap;for(;i.has(o);)o=i.get(o);i.set(o,n)}else this.kvMap.set(e,n)}forEach(e){for(let[n,o]of this.kvMap)if(e(o,n),this._vMap!==void 0){let i=this._vMap;for(;i.has(o);)o=i.get(o),e(o,n)}}};function T(t,e,n,o,i,r,s,a){$t("NgControlFlow");let c=W(),d=Se(),f=gt(d.consts,r);return Rr(c,d,t,e,n,o,i,f,256,s,a),gl}function gl(t,e,n,o,i,r,s,a){return $t("NgControlFlow"),w_(t,e,n,o,i,r,s,a),gl}function w_(t,e,n,o,i,r,s,a){let c=W(),d=Se(),f=gt(d.consts,r);Rr(c,d,t,e,n,o,i,f,512,s,a)}function D(t,e){$t("NgControlFlow");let n=W(),o=hn(),i=n[o]!==xe?n[o]:-1,r=i!==-1?Or(n,ye+i):void 0,s=0;if(Qe(n,o,t)){let a=V(null);try{if(r!==void 0&&Rp(r,s),t!==-1){let c=ye+t,d=Or(n,c),f=$c(n[$],c),g=Op(d,f,n),C=Gr(n,f,e,{dehydratedView:g});Wr(d,C,s,$o(f,g))}}finally{V(a)}}else if(r!==void 0){let a=kp(r,s);a!==void 0&&(a[fe]=e)}}var Fc=class{lContainer;$implicit;$index;constructor(e,n,o){this.lContainer=e,this.$implicit=n,this.$index=o}get $count(){return this.lContainer.length-pe}};function oe(t){return t}function me(t,e){return e}var Vc=class{hasEmptyBlock;trackByFn;liveCollection;constructor(e,n,o){this.hasEmptyBlock=e,this.trackByFn=n,this.liveCollection=o}};function L(t,e,n,o,i,r,s,a,c,d,f,g,C){$t("NgControlFlow");let E=W(),P=Se(),Z=c!==void 0,Y=W(),ve=a?s.bind(Y[je][fe]):s,se=new Vc(Z,ve);Y[ye+t]=se,Rr(E,P,t+1,e,n,o,i,gt(P.consts,r),256),Z&&Rr(E,P,t+2,c,d,f,g,gt(P.consts,C),512)}var jc=class extends Pc{lContainer;hostLView;templateTNode;operationsCounter=void 0;needsIndexUpdate=!1;constructor(e,n,o){super(),this.lContainer=e,this.hostLView=n,this.templateTNode=o}get length(){return this.lContainer.length-pe}at(e){return this.getLView(e)[fe].$implicit}attach(e,n){let o=n[Vn];this.needsIndexUpdate||=e!==this.length,Wr(this.lContainer,n,e,$o(this.templateTNode,o)),T_(this.lContainer,e)}detach(e){return this.needsIndexUpdate||=e!==this.length-1,D_(this.lContainer,e),M_(this.lContainer,e)}create(e,n){let o=wc(this.lContainer,this.templateTNode.tView.ssrId);return Gr(this.hostLView,this.templateTNode,new Fc(this.lContainer,n,e),{dehydratedView:o})}destroy(e){Br(e[$],e)}updateValue(e,n){this.getLView(e)[fe].$implicit=n}reset(){this.needsIndexUpdate=!1}updateIndexes(){if(this.needsIndexUpdate)for(let e=0;e<this.length;e++)this.getLView(e)[fe].$index=e}getLView(e){return N_(this.lContainer,e)}};function F(t){let e=V(null),n=Be();try{let o=W(),i=o[$],r=o[n],s=n+1,a=Or(o,s);if(r.liveCollection===void 0){let d=$c(i,s);r.liveCollection=new jc(a,o,d)}else r.liveCollection.reset();let c=r.liveCollection;if(S_(c,t,r.trackByFn,e),c.updateIndexes(),r.hasEmptyBlock){let d=hn(),f=c.length===0;if(Qe(o,d,f)){let g=n+2,C=Or(o,g);if(f){let E=$c(i,g),P=Op(C,E,o),Z=Gr(o,E,void 0,{dehydratedView:P});Wr(C,Z,0,$o(E,P))}else i.firstUpdatePass&&vb(C),Rp(C,0)}}}finally{V(e)}}function Or(t,e){return t[e]}function T_(t,e){if(t.length<=pe)return;let n=pe+e,o=t[n];o&&_0(o)}function D_(t,e){if(t.length<=pe)return;let n=pe+e,o=t[n];o&&b0(o)}function M_(t,e){return Ho(t,e)}function N_(t,e){return kp(t,e)}function $c(t,e){return er(t,e)}function N(t,e,n){let o=W(),i=hn();if(Qe(o,i,e)){let r=Se(),s=dr();H0(s,o,t,e,o[de],n)}return N}function Bc(t,e,n,o,i){ll(e,t,n,i?"class":"style",o)}function h(t,e,n,o){let i=W(),r=i[$],s=t+ye,a=r.firstCreatePass?Hp(s,i,2,e,q0,Su(),n,o):r.data[s];if(Vt(a)){let c=i[pt].tracingService;if(c&&c.componentCreate){let d=r.data[a.directiveStart+a.componentOffset];return c.componentCreate(Fp(d),()=>(Cf(t,e,i,a,o),h))}}return Cf(t,e,i,a,o),h}function Cf(t,e,n,o,i){if(vp(o,n,t,e,im),Xi(o)){let r=n[$];hp(r,n,o),tp(r,o,n)}i!=null&&cl(n,o)}function m(){let t=Se(),e=Ze(),n=bp(e);return t.firstCreatePass&&Up(t,n),Ka(n)&&Za(),qa(),n.classesWithoutHost!=null&&Tv(n)&&Bc(t,n,W(),n.classesWithoutHost,!0),n.stylesWithoutHost!=null&&Dv(n)&&Bc(t,n,W(),n.stylesWithoutHost,!1),m}function Ye(t,e,n,o){return h(t,e,n,o),m(),Ye}function b(t,e,n,o){let i=W(),r=i[$],s=t+ye,a=r.firstCreatePass?Vb(s,r,2,e,n,o):r.data[s];return vp(a,i,t,e,im),o!=null&&cl(i,a),b}function y(){let t=Ze(),e=bp(t);return Ka(e)&&Za(),qa(),y}function re(t,e,n,o){return b(t,e,n,o),y(),re}var im=(t,e,n,o,i)=>(fr(!0),np(e[de],o,nc()));function j(){return W()}function R(t,e,n){let o=W(),i=hn();if(Qe(o,i,e)){let r=Se(),s=dr();gp(s,o,t,e,o[de],n)}return R}var Zo="en-US";var k_=Zo;function rm(t){typeof t=="string"&&(k_=t.toLowerCase().replace(/_/g,"-"))}function k(t,e,n){let o=W(),i=Se(),r=Ze();return R_(i,o,o[de],r,t,e,n),k}function O(t,e,n){let o=W(),i=Se(),r=Ze();return(r.type&3||n)&&Vp(r,i,o,n,o[de],t,e,xr(r,o,e)),O}function R_(t,e,n,o,i,r,s){let a=!0,c=null;if((o.type&3||s)&&(c??=xr(o,e,r),Vp(o,t,e,s,n,i,r,c)&&(a=!1)),a){let d=o.outputs?.[i],f=o.hostDirectiveOutputs?.[i];if(f&&f.length)for(let g=0;g<f.length;g+=2){let C=f[g],E=f[g+1];c??=xr(o,e,r),mf(o,e,C,E,i,c)}if(d&&d.length)for(let g of d)c??=xr(o,e,r),mf(o,e,g,i,i,c)}}function p(t=1){return ju(t)}function Je(t,e,n,o){return u_(t,a_(e,n,o)),Je}function dt(t=1){ar(Pu()+t)}function yl(t){let e=Ja();return Ha(e,ye+t)}function yr(t,e){return t<<17|e<<2}function bn(t){return t>>17&32767}function A_(t){return(t&2)==2}function O_(t,e){return t&131071|e<<17}function Hc(t){return t|2}function Qn(t){return(t&131068)>>2}function mc(t,e){return t&-131069|e<<2}function P_(t){return(t&1)===1}function Uc(t){return t|1}function L_(t,e,n,o,i,r){let s=r?e.classBindings:e.styleBindings,a=bn(s),c=Qn(s);t[o]=n;let d=!1,f;if(Array.isArray(n)){let g=n;f=g[1],(f===null||Ln(g,f)>0)&&(d=!0)}else f=n;if(i)if(c!==0){let C=bn(t[a+1]);t[o+1]=yr(C,a),C!==0&&(t[C+1]=mc(t[C+1],o)),t[a+1]=O_(t[a+1],o)}else t[o+1]=yr(a,0),a!==0&&(t[a+1]=mc(t[a+1],o)),a=o;else t[o+1]=yr(c,0),a===0?a=o:t[c+1]=mc(t[c+1],o),c=o;d&&(t[o+1]=Hc(t[o+1])),If(t,f,o,!0),If(t,f,o,!1),F_(e,f,t,o,r),s=yr(a,c),r?e.classBindings=s:e.styleBindings=s}function F_(t,e,n,o,i){let r=i?t.residualClasses:t.residualStyles;r!=null&&typeof e=="string"&&Ln(r,e)>=0&&(n[o+1]=Uc(n[o+1]))}function If(t,e,n,o){let i=t[n+1],r=e===null,s=o?bn(i):Qn(i),a=!1;for(;s!==0&&(a===!1||r);){let c=t[s],d=t[s+1];V_(c,e)&&(a=!0,t[s+1]=o?Uc(d):Hc(d)),s=o?bn(d):Qn(d)}a&&(t[n+1]=o?Hc(i):Uc(i))}function V_(t,e){return t===null||e==null||(Array.isArray(t)?t[1]:t)===e?!0:Array.isArray(t)&&typeof e=="string"?Ln(t,e)>=0:!1}var ct={textEnd:0,key:0,keyEnd:0,value:0,valueEnd:0};function j_(t){return t.substring(ct.key,ct.keyEnd)}function $_(t){return B_(t),sm(t,am(t,0,ct.textEnd))}function sm(t,e){let n=ct.textEnd;return n===e?-1:(e=ct.keyEnd=H_(t,ct.key=e,n),am(t,e,n))}function B_(t){ct.key=0,ct.keyEnd=0,ct.value=0,ct.valueEnd=0,ct.textEnd=t.length}function am(t,e,n){for(;e<n&&t.charCodeAt(e)<=32;)e++;return e}function H_(t,e,n){for(;e<n&&t.charCodeAt(e)>32;)e++;return e}function ce(t,e,n){return cm(t,e,n,!1),ce}function q(t,e){return cm(t,e,null,!0),q}function vl(t){G_(Q_,U_,t,!0)}function U_(t,e){for(let n=$_(e);n>=0;n=sm(e,n))Ki(t,j_(e),!0)}function cm(t,e,n,o){let i=W(),r=Se(),s=Hn(2);if(r.firstUpdatePass&&dm(r,t,s,o),e!==xe&&Qe(i,s,e)){let a=r.data[Be()];um(r,a,i,i[de],t,i[s+1]=J_(e,n),o,s)}}function G_(t,e,n,o){let i=Se(),r=Hn(2);i.firstUpdatePass&&dm(i,null,r,o);let s=W();if(n!==xe&&Qe(s,r,n)){let a=i.data[Be()];if(fm(a,o)&&!lm(i,r)){let c=o?a.classesWithoutHost:a.stylesWithoutHost;c!==null&&(n=Bi(c,n||"")),Bc(i,a,s,n,o)}else Y_(i,a,s,s[de],s[r+1],s[r+1]=Z_(t,e,n),o,r)}}function lm(t,e){return e>=t.expandoStartIndex}function dm(t,e,n,o){let i=t.data;if(i[n+1]===null){let r=i[Be()],s=lm(t,n);fm(r,o)&&e===null&&!s&&(e=!1),e=W_(i,r,e,o),L_(i,r,e,n,s,o)}}function W_(t,e,n,o){let i=Ou(t),r=o?e.residualClasses:e.residualStyles;if(i===null)(o?e.classBindings:e.styleBindings)===0&&(n=hc(null,t,e,n,o),n=zo(n,e.attrs,o),r=null);else{let s=e.directiveStylingLast;if(s===-1||t[s]!==i)if(n=hc(i,t,e,n,o),r===null){let c=z_(t,e,o);c!==void 0&&Array.isArray(c)&&(c=hc(null,t,e,c[1],o),c=zo(c,e.attrs,o),q_(t,e,o,c))}else r=K_(t,e,o)}return r!==void 0&&(o?e.residualClasses=r:e.residualStyles=r),n}function z_(t,e,n){let o=n?e.classBindings:e.styleBindings;if(Qn(o)!==0)return t[bn(o)]}function q_(t,e,n,o){let i=n?e.classBindings:e.styleBindings;t[bn(i)]=o}function K_(t,e,n){let o,i=e.directiveEnd;for(let r=1+e.directiveStylingLast;r<i;r++){let s=t[r].hostAttrs;o=zo(o,s,n)}return zo(o,e.attrs,n)}function hc(t,e,n,o,i){let r=null,s=n.directiveEnd,a=n.directiveStylingLast;for(a===-1?a=n.directiveStart:a++;a<s&&(r=e[a],o=zo(o,r.hostAttrs,i),r!==t);)a++;return t!==null&&(n.directiveStylingLast=a),o}function zo(t,e,n){let o=n?1:2,i=-1;if(e!==null)for(let r=0;r<e.length;r++){let s=e[r];typeof s=="number"?i=s:i===o&&(Array.isArray(t)||(t=t===void 0?[]:["",t]),Ki(t,s,n?!0:e[++r]))}return t===void 0?null:t}function Z_(t,e,n){if(n==null||n==="")return ot;let o=[],i=Vo(n);if(Array.isArray(i))for(let r=0;r<i.length;r++)t(o,i[r],!0);else if(i instanceof Set)for(let r of i)t(o,r,!0);else if(typeof i=="object")for(let r in i)Object.hasOwn(i,r)&&t(o,r,i[r]);else typeof i=="string"&&e(o,i);return o}function Q_(t,e,n){let o=String(e);o!==""&&!o.includes(" ")&&Ki(t,o,n)}function Y_(t,e,n,o,i,r,s,a){i===xe&&(i=ot);let c=0,d=0,f=0<i.length?i[0]:null,g=0<r.length?r[0]:null;for(;f!==null||g!==null;){let C=c<i.length?i[c+1]:void 0,E=d<r.length?r[d+1]:void 0,P=null,Z;f===g?(c+=2,d+=2,C!==E&&(P=g,Z=E)):g===null||f!==null&&f<g?(c+=2,P=f):(d+=2,P=g,Z=E),P!==null&&um(t,e,n,o,P,Z,s,a),f=c<i.length?i[c]:null,g=d<r.length?r[d]:null}}function um(t,e,n,o,i,r,s,a){if(!(e.type&3))return;let c=t.data,d=c[a+1],f=P_(d)?Sf(c,e,n,i,Qn(d),s):void 0;if(!Pr(f)){Pr(r)||A_(d)&&(r=Sf(c,null,n,i,a,s));let g=Ba(Be(),n);O0(o,s,g,i,r)}}function Sf(t,e,n,o,i,r){let s=e===null,a;for(;i>0;){let c=t[i],d=Array.isArray(c),f=d?c[1]:c,g=f===null,C=n[i+1];C===xe&&(C=g?ot:void 0);let E=g?Zi(C,o):f===o?C:void 0;if(d&&!Pr(E)&&(E=Zi(c,o)),Pr(E)&&(a=E,s))return a;let P=t[i+1];i=s?bn(P):Qn(P)}if(e!==null){let c=r?e.residualClasses:e.residualStyles;c!=null&&(a=Zi(c,o))}return a}function Pr(t){return t!==void 0}function J_(t,e){return t==null||t===""||(typeof e=="string"?t=Vo(t)+e:typeof t=="object"&&(t=$i(Vo(t)))),t}function fm(t,e){return(t.flags&(e?8:16))!==0}function u(t,e=""){let n=W(),o=Se(),i=t+ye,r=o.firstCreatePass?Ko(o,i,1,e,null):o.data[i],s=X_(o,n,r,e);n[i]=s,ur()&&ol(o,n,s,r),mn(r,!1)}var X_=(t,e,n,o)=>(fr(!0),Xv(e[de],o));function pm(t,e,n,o=""){return Qe(t,hn(),n)?e+Ve(n)+o:xe}function eE(t,e,n,o,i,r=""){let s=rr(),a=Dr(t,s,n,i);return Hn(2),a?e+Ve(n)+o+Ve(i)+r:xe}function tE(t,e,n,o,i,r,s,a=""){let c=rr(),d=Ib(t,c,n,i,s);return Hn(3),d?e+Ve(n)+o+Ve(i)+r+Ve(s)+a:xe}function nE(t,e,n,o,i,r,s,a,c,d,f,g=""){let C=rr(),E=Sb(t,C,n,i,s,c);return E=Qe(t,C+4,f)||E,Hn(5),E?e+Ve(n)+o+Ve(i)+r+Ve(s)+a+Ve(c)+d+Ve(f)+g:xe}function M(t){return B("",t),M}function B(t,e,n){let o=W(),i=pm(o,t,e,n);return i!==xe&&Zr(o,Be(),i),B}function ke(t,e,n,o,i){let r=W(),s=eE(r,t,e,n,o,i);return s!==xe&&Zr(r,Be(),s),ke}function Jn(t,e,n,o,i,r,s){let a=W(),c=tE(a,t,e,n,o,i,r,s);return c!==xe&&Zr(a,Be(),c),Jn}function Kr(t,e,n,o,i,r,s,a,c,d,f){let g=W(),C=nE(g,t,e,n,o,i,r,s,a,c,d,f);return C!==xe&&Zr(g,Be(),C),Kr}function Zr(t,e,n){let o=Ba(e,t);e0(t[de],o,n)}var mm={};function Xn(t){$t("NgLet");let e=Se(),n=W(),o=t+ye,i=Ko(e,o,128,null,null);return mn(i,!1),tr(e,n,o,mm),Xn}function Qo(t){let e=Se(),n=W(),o=Be();return tr(e,n,o,t),t}function we(t){let e=Ja(),n=Ha(e,ye+t);if(n===mm)throw new U(314,!1);return n}function bl(t,e,n=""){return pm(W(),t,e,n)}function Te(t,e){let n=Mu()+t,o=W();return o[n]===xe?xb(o,n,e()):Cb(o,n)}var hm=(()=>{class t{applicationErrorHandler=w(gn);appRef=w(qr);taskService=w(Un);ngZone=w(Oe);zonelessEnabled=w(Oo);tracing=w(vt,{optional:!0});zoneIsDefined=typeof Zone<"u"&&!!Zone.root.run;schedulerTickApplyArgs=[{data:{__scheduler_tick__:!0}}];subscriptions=new Me;angularZoneId=this.zoneIsDefined?this.ngZone._inner?.get(_o):null;scheduleInRootZone=!this.zonelessEnabled&&this.zoneIsDefined&&(w(cc,{optional:!0})??!1);cancelScheduledCallback=null;useMicrotaskScheduler=!1;runningTick=!1;pendingRenderTaskId=null;constructor(){this.subscriptions.add(this.appRef.afterTick.subscribe(()=>{let n=this.taskService.add();if(!this.runningTick&&(this.cleanup(),!this.zonelessEnabled||this.appRef.includeAllTestViews)){this.taskService.remove(n);return}this.switchToMicrotaskScheduler(),this.taskService.remove(n)})),this.subscriptions.add(this.ngZone.onUnstable.subscribe(()=>{this.runningTick||this.cleanup()}))}switchToMicrotaskScheduler(){this.ngZone.runOutsideAngular(()=>{let n=this.taskService.add();this.useMicrotaskScheduler=!0,queueMicrotask(()=>{this.useMicrotaskScheduler=!1,this.taskService.remove(n)})})}notify(n){if(!this.zonelessEnabled&&n===5)return;switch(n){case 0:case 2:{this.appRef.dirtyFlags|=2;break}case 3:case 4:case 5:case 1:{this.appRef.dirtyFlags|=4;break}case 6:{this.appRef.dirtyFlags|=2;break}case 12:{this.appRef.dirtyFlags|=16;break}case 13:{this.appRef.dirtyFlags|=2;break}case 11:break;default:this.appRef.dirtyFlags|=8}if(this.appRef.tracingSnapshot=this.tracing?.snapshot(this.appRef.tracingSnapshot)??null,!this.shouldScheduleTick())return;let o=this.useMicrotaskScheduler?Gu:oc;this.pendingRenderTaskId=this.taskService.add(),this.scheduleInRootZone?this.cancelScheduledCallback=Zone.root.run(()=>o(()=>this.tick())):this.cancelScheduledCallback=this.ngZone.runOutsideAngular(()=>o(()=>this.tick()))}shouldScheduleTick(){return!(this.appRef.destroyed||this.pendingRenderTaskId!==null||this.runningTick||this.appRef._runningTick||!this.zonelessEnabled&&this.zoneIsDefined&&Zone.current.get(_o+this.angularZoneId))}tick(){if(this.runningTick||this.appRef.destroyed)return;if(this.appRef.dirtyFlags===0){this.cleanup();return}!this.zonelessEnabled&&this.appRef.dirtyFlags&7&&(this.appRef.dirtyFlags|=1);let n=this.taskService.add();try{this.ngZone.run(()=>{this.runningTick=!0,this.appRef._tick()},void 0,this.schedulerTickApplyArgs)}catch(o){this.applicationErrorHandler(o)}finally{this.taskService.remove(n),this.cleanup()}}ngOnDestroy(){this.subscriptions.unsubscribe(),this.cleanup()}cleanup(){if(this.runningTick=!1,this.cancelScheduledCallback?.(),this.cancelScheduledCallback=null,this.pendingRenderTaskId!==null){let n=this.pendingRenderTaskId;this.pendingRenderTaskId=null,this.taskService.remove(n)}}static \u0275fac=function(o){return new(o||t)};static \u0275prov=Fr({token:t,factory:t.\u0275fac})}return t})();function gm(){return[{provide:Tt,useExisting:hm},{provide:Oe,useClass:Eo},{provide:Oo,useValue:!0}]}function oE(){return typeof $localize<"u"&&$localize.locale||Zo}var _l=new J("",{factory:()=>w(_l,{optional:!0,skipSelf:!0})||oE()});var Qr=class{destroyed=!1;listeners=null;errorHandler=w(ze,{optional:!0});isEmitting=!1;hasNullListeners=!1;destroyRef=w(ue);constructor(){this.destroyRef.onDestroy(()=>{this.destroyed=!0,this.listeners=null})}subscribe(e){if(this.destroyed)throw new U(953,!1);return(this.listeners??=[]).push(e),{unsubscribe:()=>{let n=this.listeners?this.listeners.indexOf(e):-1;n>-1&&(this.isEmitting?(this.hasNullListeners=!0,this.listeners[n]=null):this.listeners.splice(n,1))}}}emit(e){if(this.destroyed){console.warn(xo(953,!1));return}if(this.listeners===null)return;this.isEmitting=!0;let n=V(null);try{for(let o of this.listeners)try{o!==null&&o(e)}catch(i){this.errorHandler?.handleError(i)}}finally{this.hasNullListeners&&(this.hasNullListeners=!1,this.listeners&&iE(this.listeners)),V(n),this.isEmitting=!1}}};function iE(t){let e=t.length-1;for(;e>-1;)t[e]===null&&t.splice(e,1),e--}function _(t,e){return ho(t,e?.equal)}function Xe(t){return Fd(t)}var ym=class t extends Error{_brand;constructor(e){super(e)}static IDLE=new t("IDLE");static LOADING=new t("LOADING")};function Em(t,e){let n=Object.create(Nf);n.value=t,n.transformFn=e?.transform;function o(){if(Rt(n),n.value===Gc){let i=null;throw new U(-950,i)}return n.value}return o[Ee]=n,o}function eo(t){return new Qr}function vm(t,e){return Em(t,e)}function fE(t){return Em(Gc,t)}var to=(vm.required=fE,vm);function bm(t,e){return Yp(e)}function pE(t,e){return Jp(e)}var Ge=(bm.required=pE,bm);var mE=1e4;var jP=mE-1e3;var xl=new J(""),hE=new J("");function Yo(t){return!t.moduleRef}function gE(t){let e=Yo(t)?t.r3Injector:t.moduleRef.injector,n=e.get(Oe);return n.run(()=>{Yo(t)?t.r3Injector.resolveInjectorInitializers():t.moduleRef.resolveInjectorInitializers();let o=e.get(gn),i;if(n.runOutsideAngular(()=>{i=n.onError.subscribe({next:o})}),Yo(t)){let r=()=>e.destroy(),s=t.platformInjector.get(xl);s.add(r),e.onDestroy(()=>{i.unsubscribe(),s.delete(r)})}else{let r=()=>t.moduleRef.destroy(),s=t.platformInjector.get(xl);s.add(r),t.moduleRef.onDestroy(()=>{Lo(t.allPlatformModules,t.moduleRef),i.unsubscribe(),s.delete(r)})}return vE(o,n,()=>{let r=e.get(Un),s=r.add(),a=e.get(ml);return a.runInitializers(),a.donePromise.then(()=>{let c=e.get(_l,Zo);if(rm(c||Zo),!e.get(hE,!0))return Yo(t)?e.get(qr):(t.allPlatformModules.push(t.moduleRef),t.moduleRef);if(Yo(t)){let f=e.get(qr);return t.rootComponent!==void 0&&f.bootstrap(t.rootComponent),f}else return yE?.(t.moduleRef,t.allPlatformModules),t.moduleRef}).finally(()=>{r.remove(s)})})})}var yE;function vE(t,e,n){try{let o=n();return pl(o)?o.catch(i=>{throw e.runOutsideAngular(()=>t(i)),i}):o}catch(o){throw e.runOutsideAngular(()=>t(o)),o}}var Yr=null;function bE(t=[],e){return Ce.create({name:e,providers:[{provide:wo,useValue:"platform"},{provide:xl,useValue:new Set([()=>Yr=null])},...t]})}function _E(t=[]){if(Yr)return Yr;let e=bE(t);return Yr=e,om(),EE(e),e}function EE(t){let e=t.get(pr,null);Yi(t,()=>{e?.forEach(n=>n())})}function xm(t){let{rootComponent:e,appProviders:n,platformProviders:o,platformRef:i}=t;ee(X.BootstrapApplicationStart);try{let r=i?.injector??_E(o),s=[gm(),Ku,...n||[]],a=new Wo({providers:s,parent:r,debugName:"",runEnvironmentInitializers:!1});return gE({r3Injector:a.injector,platformInjector:r,rootComponent:e})}catch(r){return Promise.reject(r)}finally{ee(X.BootstrapApplicationEnd)}}var El=Symbol("NOT_SET"),Cm=new Set,xE=x(v({},Dn),{kind:"afterRenderEffectPhase",consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,value:El,cleanup:null,consumerMarkedDirty(){if(this.sequence.impl.executing){if(this.sequence.lastPhase===null||this.sequence.lastPhase<this.phase)return;this.sequence.erroredOrDestroyed=!0}this.sequence.scheduler.notify(7)},phaseFn(t){if(this.sequence.lastPhase=this.phase,!this.dirty)return this.signal;if(this.dirty=!1,this.value!==El&&!wn(this))return this.signal;try{for(let i of this.cleanup??Cm)i()}finally{this.cleanup?.clear()}let e=[];t!==void 0&&e.push(t),e.push(this.registerCleanupFn);let n=At(this),o;try{o=this.userFn.apply(null,e)}finally{Yt(this,n)}return(this.value===El||!this.equal(this.value,o))&&(this.value=o,this.version++),this.signal}}),Cl=class extends jo{scheduler;lastPhase=null;nodes=[void 0,void 0,void 0,void 0];onDestroyFns=null;constructor(e,n,o,i,r,s=null,a){super(e,[void 0,void 0,void 0,void 0],o,!1,r.get(ue),s),this.scheduler=i;for(let c of el){let d=n[c];if(d===void 0)continue;let f=Object.create(xE);f.sequence=this,f.phase=c,f.userFn=d,f.dirty=!0,f.signal=()=>(Rt(f),f.value),f.signal[Ee]=f,f.registerCleanupFn=g=>(f.cleanup??=new Set).add(g),this.nodes[c]=f,this.hooks[c]=g=>f.phaseFn(g)}}afterRun(){super.afterRun(),this.lastPhase=null}destroy(){if(this.onDestroyFns!==null)for(let e of this.onDestroyFns)e();super.destroy();for(let e of this.nodes)if(e)try{for(let n of e.cleanup??Cm)n()}finally{Ot(e)}}};function Im(t,e){let n=e?.injector??w(Ce),o=n.get(Tt),i=n.get($r),r=n.get(vt,null,{optional:!0});i.impl??=n.get(tl);let s=t;typeof s=="function"&&(s={mixedReadWrite:t});let a=n.get(Gn,null,{optional:!0}),c=new Cl(i.impl,[s.earlyRead,s.write,s.mixedReadWrite,s.read],a?.view,o,n,r?.snapshot(null),void 0);return i.impl.register(c),c}function Sm(){return!1}var wm=null;function Xo(){return wm}function Il(t){wm??=t}var Jo=class{};function Sl(t,e){e=encodeURIComponent(e);for(let n of t.split(";")){let o=n.indexOf("="),[i,r]=o==-1?[n,""]:[n.slice(0,o),n.slice(o+1)];if(i.trim()!==e)continue;let s=r;try{s=decodeURIComponent(r)}catch{}return s.length>1&&s[0]==='"'&&s[s.length-1]==='"'&&(s=s.slice(1,-1)),s}return null}var Tm="browser";var ei=class{_doc;constructor(e){this._doc=e}manager},Jr=(()=>{class t extends ei{constructor(n){super(n)}supports(n){return!0}addEventListener(n,o,i,r){return n.addEventListener(o,i,r),()=>this.removeEventListener(n,o,i,r)}removeEventListener(n,o,i,r){return n.removeEventListener(o,i,r)}static \u0275fac=function(o){return new(o||t)(te(Ne))};static \u0275prov=K({token:t,factory:t.\u0275fac})}return t})(),ts=new J(""),Ml=(()=>{class t{_zone;_plugins;_eventNameToPlugin=new Map;constructor(n,o){this._zone=o,n.forEach(s=>{s.manager=this});let i=n.filter(s=>!(s instanceof Jr));this._plugins=i.slice().reverse();let r=n.find(s=>s instanceof Jr);r&&this._plugins.push(r)}addEventListener(n,o,i,r){return this._findPluginFor(o).addEventListener(n,o,i,r)}getZone(){return this._zone}_findPluginFor(n){let o=this._eventNameToPlugin.get(n);if(o)return o;if(o=this._plugins.find(r=>r.supports(n)),!o)throw new U(-5101,!1);return this._eventNameToPlugin.set(n,o),o}static \u0275fac=function(o){return new(o||t)(te(ts),te(Oe))};static \u0275prov=K({token:t,factory:t.\u0275fac})}return t})(),wl="ng-app-id";function Dm(t){for(let e of t)e.remove()}function Mm(t,e){let n=e.createElement("style");return n.textContent=t,n}function CE(t,e,n,o){let i=t.head?.querySelectorAll(`style[${wl}="${e}"],link[${wl}="${e}"]`);if(!i||i.length===0)return!1;for(let r of i)r.removeAttribute(wl),r instanceof HTMLLinkElement?o.set(r.href.slice(r.href.lastIndexOf("/")+1),{usage:0,elements:[r]}):r.textContent&&n.set(r.textContent,{usage:0,elements:[r]});return!0}function Dl(t,e){let n=e.createElement("link");return n.setAttribute("rel","stylesheet"),n.setAttribute("href",t),n}var Nl=(()=>{class t{doc;appId;nonce;inline=new Map;external=new Map;hosts=new Set;constructor(n,o,i,r={}){this.doc=n,this.appId=o,this.nonce=i,CE(n,o,this.inline,this.external)&&this.hosts.add(n.head)}addStyles(n,o){for(let i of n)this.addUsage(i,this.inline,Mm);o?.forEach(i=>this.addUsage(i,this.external,Dl))}removeStyles(n,o){for(let i of n)this.removeUsage(i,this.inline);o?.forEach(i=>this.removeUsage(i,this.external))}addUsage(n,o,i){let r=o.get(n);r?r.usage++:o.set(n,{usage:1,elements:[...this.hosts].map(s=>this.addElement(s,i(n,this.doc)))})}removeUsage(n,o){let i=o.get(n);i&&(i.usage--,i.usage<=0&&(Dm(i.elements),o.delete(n)))}ngOnDestroy(){for(let[,{elements:n}]of[...this.inline,...this.external])Dm(n);this.hosts.clear()}addHost(n){if(!this.hosts.has(n)){this.hosts.add(n);for(let[o,{elements:i}]of this.inline)i.push(this.addElement(n,Mm(o,this.doc)));for(let[o,{elements:i}]of this.external)i.push(this.addElement(n,Dl(o,this.doc)))}}removeHost(n){this.hosts.delete(n);for(let o of[...this.inline.values(),...this.external.values()]){let i=[];for(let r of o.elements)r.parentNode===n?r.remove():i.push(r);o.elements=i}}addElement(n,o){return this.nonce&&o.setAttribute("nonce",this.nonce),n.appendChild(o)}static \u0275fac=function(o){return new(o||t)(te(Ne),te(Ro),te(mr,8),te(Ao))};static \u0275prov=K({token:t,factory:t.\u0275fac})}return t})(),Tl={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/Math/MathML"},kl=/%COMP%/g;var km="%COMP%",IE=`_nghost-${km}`,SE=`_ngcontent-${km}`,wE=!0,TE=new J("",{factory:()=>wE}),DE=new J("");function ME(t){return SE.replace(kl,t)}function NE(t){return IE.replace(kl,t)}function Rm(t,e){return e.map(n=>n.replace(kl,t))}var Rl=(()=>{class t{eventManager;sharedStylesHost;appId;removeStylesOnCompDestroy;doc;ngZone;nonce;tracingService;rendererByCompId=new Map;defaultRenderer;cssVarNamespace;constructor(n,o,i,r,s,a,c=null,d=null,f=null){this.eventManager=n,this.sharedStylesHost=o,this.appId=i,this.removeStylesOnCompDestroy=r,this.doc=s,this.ngZone=a,this.nonce=c,this.tracingService=d,this.cssVarNamespace=f??"",this.defaultRenderer=new ti(n,s,a,this.tracingService,this.cssVarNamespace)}createRenderer(n,o){if(!n||!o)return this.defaultRenderer;let i=this.getOrCreateRenderer(n,o);return i instanceof es?i.applyToHost(n):i instanceof ni&&i.applyStyles(),i}getOrCreateRenderer(n,o){let i=this.rendererByCompId,r=i.get(o.id);if(!r){let s=this.doc,a=this.ngZone,c=this.eventManager,d=this.sharedStylesHost,f=this.removeStylesOnCompDestroy,g=this.tracingService;switch(o.encapsulation){case lt.Emulated:r=new es(c,d,o,this.appId,f,s,a,g,this.cssVarNamespace);break;case lt.ShadowDom:return new Xr(c,n,o,s,a,this.nonce,g,this.cssVarNamespace,d);case lt.ExperimentalIsolatedShadowDom:return new Xr(c,n,o,s,a,this.nonce,g,this.cssVarNamespace);default:r=new ni(c,d,o,f,s,a,g,this.cssVarNamespace);break}i.set(o.id,r)}return r}ngOnDestroy(){this.rendererByCompId.clear()}componentReplaced(n){this.rendererByCompId.delete(n)}static \u0275fac=function(o){return new(o||t)(te(Ml),te(_n),te(Ro),te(TE),te(Ne),te(Oe),te(mr),te(vt,8),te(DE,8))};static \u0275prov=K({token:t,factory:t.\u0275fac})}return t})(),ti=class{eventManager;doc;ngZone;tracingService;cssVarNamespace;data=Object.create(null);throwOnSyntheticProps=!0;constructor(e,n,o,i,r=""){this.eventManager=e,this.doc=n,this.ngZone=o,this.tracingService=i,this.cssVarNamespace=r}destroy(){}destroyNode=null;createElement(e,n){return n?this.doc.createElementNS(Tl[n]||n,e):this.doc.createElement(e)}createComment(e){return this.doc.createComment(e)}createText(e){return this.doc.createTextNode(e)}appendChild(e,n){(Nm(e)?e.content:e).appendChild(n)}insertBefore(e,n,o){if(e){let i=Nm(e)?e.content:e;if(o!=null&&o.parentNode!==i)throw new U(-5106,!1);i.insertBefore(n,o)}}removeChild(e,n){n.remove()}selectRootElement(e,n){let o=typeof e=="string"?this.doc.querySelector(e):e;if(!o)throw new U(-5104,!1);return n||(o.textContent=""),o}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,n,o,i){if(i){n=i+":"+n;let r=Tl[i];r?e.setAttributeNS(r,n,o):e.setAttribute(n,o)}else e.setAttribute(n,o)}removeAttribute(e,n,o){if(o){let i=Tl[o];i?e.removeAttributeNS(i,n):e.removeAttribute(`${o}:${n}`)}else e.removeAttribute(n)}addClass(e,n){e.classList.add(n)}removeClass(e,n){e.classList.remove(n)}setStyle(e,n,o,i){let r=n.startsWith("--");r&&(n=n.replace("%NS%",this.cssVarNamespace)),r||i&(Nt.DashCase|Nt.Important)?e.style.setProperty(n,o,i&Nt.Important?"important":""):e.style[n]=o}removeStyle(e,n,o){let i=n.startsWith("--");i&&(n=n.replace("%NS%",this.cssVarNamespace)),i||o&Nt.DashCase?e.style.removeProperty(n):e.style[n]=""}setProperty(e,n,o){e!=null&&(e[n]=o)}setValue(e,n){e.nodeValue=n}listen(e,n,o,i){if(typeof e=="string"&&(e=Xo().getGlobalEventTarget(this.doc,e),!e))throw new U(-5102,!1);let r=this.decoratePreventDefault(o);return this.tracingService?.wrapEventListener&&(r=this.tracingService.wrapEventListener(e,n,r)),this.eventManager.addEventListener(e,n,r,i)}decoratePreventDefault(e){return n=>{if(n==="__ngUnwrap__")return e;e(n)===!1&&n.preventDefault()}}};function Nm(t){return t.tagName==="TEMPLATE"&&t.content!==void 0}var Xr=class extends ti{hostEl;sharedStylesHost;shadowRoot;constructor(e,n,o,i,r,s,a,c,d){super(e,i,r,a,c),this.hostEl=n,this.sharedStylesHost=d,this.shadowRoot=n.attachShadow({mode:"open"}),this.sharedStylesHost&&this.sharedStylesHost.addHost(this.shadowRoot);let f=o.styles;f=Rm(o.id,f).map(C=>C.replace(/%NS%/g,c));for(let C of f){let E=document.createElement("style");s&&E.setAttribute("nonce",s),E.textContent=C,this.shadowRoot.appendChild(E)}let g=o.getExternalStyles?.();if(g)for(let C of g){let E=Dl(C,i);s&&E.setAttribute("nonce",s),this.shadowRoot.appendChild(E)}}nodeOrShadowRoot(e){return e===this.hostEl?this.shadowRoot:e}appendChild(e,n){return super.appendChild(this.nodeOrShadowRoot(e),n)}insertBefore(e,n,o){return super.insertBefore(this.nodeOrShadowRoot(e),n,o)}removeChild(e,n){return super.removeChild(null,n)}parentNode(e){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(e)))}destroy(){this.sharedStylesHost&&this.sharedStylesHost.removeHost(this.shadowRoot)}},ni=class extends ti{sharedStylesHost;removeStylesOnCompDestroy;styles;styleUrls;constructor(e,n,o,i,r,s,a,c,d){super(e,r,s,a,c),this.sharedStylesHost=n,this.removeStylesOnCompDestroy=i;let f=o.styles,g=d?Rm(d,f):f;this.styles=g.map(C=>C.replace(/%NS%/g,c)),this.styleUrls=o.getExternalStyles?.(d)}applyStyles(){this.sharedStylesHost.addStyles(this.styles,this.styleUrls)}destroy(){this.removeStylesOnCompDestroy&&Xc.size===0&&this.sharedStylesHost.removeStyles(this.styles,this.styleUrls)}},es=class extends ni{contentAttr;hostAttr;constructor(e,n,o,i,r,s,a,c,d){let f=i+"-"+o.id;super(e,n,o,r,s,a,c,d,f),this.contentAttr=ME(f),this.hostAttr=NE(f)}applyToHost(e){this.applyStyles(),this.setAttribute(e,this.hostAttr,"")}createElement(e,n){let o=super.createElement(e,n);return super.setAttribute(o,this.contentAttr,""),o}};var ns=class t extends Jo{supportsDOMEvents=!0;static makeCurrent(){Il(new t)}onAndCancel(e,n,o,i){return e.addEventListener(n,o,i),()=>{e.removeEventListener(n,o,i)}}dispatchEvent(e,n){e.dispatchEvent(n)}remove(e){e.remove()}createElement(e,n){return n=n||this.getDefaultDocument(),n.createElement(e)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(e){return e.nodeType===Node.ELEMENT_NODE}isShadowRoot(e){return e instanceof DocumentFragment}getGlobalEventTarget(e,n){return n==="window"?window:n==="document"?e:n==="body"?e.body:null}getBaseHref(e){let n=kE();return n==null?null:RE(n)}resetBaseElement(){oi=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return Sl(document.cookie,e)}},oi=null;function kE(){return oi=oi||document.head.querySelector("base"),oi?oi.getAttribute("href"):null}function RE(t){return new URL(t,document.baseURI).pathname}var Am=["alt","control","meta","shift"],AE={"\b":"Backspace"," ":"Tab","\x7F":"Delete","\x1B":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},OE={alt:t=>t.altKey,control:t=>t.ctrlKey,meta:t=>t.metaKey,shift:t=>t.shiftKey},Om=(()=>{class t extends ei{constructor(n){super(n)}supports(n){return t.parseEventName(n)!=null}addEventListener(n,o,i,r){let s=t.parseEventName(o),a=t.eventCallback(s.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>Xo().onAndCancel(n,s.domEventName,a,r))}static parseEventName(n){let o=n.toLowerCase().split("."),i=o.shift();if(o.length===0||!(i==="keydown"||i==="keyup"))return null;let r=t._normalizeKey(o.pop()),s="",a=o.indexOf("code");if(a>-1&&(o.splice(a,1),s="code."),Am.forEach(d=>{let f=o.indexOf(d);f>-1&&(o.splice(f,1),s+=d+".")}),s+=r,o.length!=0||r.length===0)return null;let c={};return c.domEventName=i,c.fullKey=s,c}static matchEventFullKeyCode(n,o){let i=AE[n.key]||n.key,r="";return o.indexOf("code.")>-1&&(i=n.code,r="code."),i==null||!i?!1:(i=i.toLowerCase(),i===" "?i="space":i==="."&&(i="dot"),Am.forEach(s=>{if(s!==i){let a=OE[s];a(n)&&(r+=s+".")}}),r+=i,r===o)}static eventCallback(n,o,i){return r=>{t.matchEventFullKeyCode(r,n)&&i.runGuarded(()=>o(r))}}static _normalizeKey(n){return n==="esc"?"escape":n}static \u0275fac=function(o){return new(o||t)(te(Ne))};static \u0275prov=K({token:t,factory:t.\u0275fac})}return t})();async function Al(t,e,n){let o=v({rootComponent:t},PE(e,n));return xm(o)}function PE(t,e){return{platformRef:e?.platformRef,appProviders:[...$E,...t?.providers??[]],platformProviders:jE}}function LE(){ns.makeCurrent()}function FE(){return new ze}function VE(){return qc(document),document}var jE=[{provide:Ao,useValue:Tm},{provide:pr,useValue:LE,multi:!0},{provide:Ne,useFactory:VE}];var $E=[{provide:wo,useValue:"root"},{provide:ze,useFactory:FE},{provide:ts,useClass:Jr,multi:!0},{provide:ts,useClass:Om,multi:!0},Rl,{provide:_n,useClass:Nl},{provide:Nl,useExisting:_n},Ml,{provide:vn,useExisting:Rl},[]];var Pm={providers:[sc()]};var le=class t{loadDelayMs=100;ready=A(!1);project=A(null);timeline=A(null);validation=A(null);readTime=A(null);missingSpeech=A([]);time=A(0);playing=A(!1);error=A(null);speechDurations={};target=null;targetOrigin="*";pending=null;last=null;loadTimer=null;lastSeekAt=-1/0;echoWindowMs=300;constructor(){let e=n=>this.handleMessage(n);globalThis.addEventListener?.("message",e),w(ue).onDestroy(()=>{globalThis.removeEventListener?.("message",e),this.clearTimer()})}attach(e,n="*"){this.target=e,this.targetOrigin=n,this.ready.set(!1)}detach(){this.target=null,this.ready.set(!1),this.clearTimer()}handleMessage(e){if(!this.target||e.source!==this.target)return;let n=e.data;if(!(!n||typeof n!="object"||n.source!=="beatsheet-player"))switch(n.type){case"ready":this.project.set(n.project),this.ready.set(!0),this.error.set(null),(this.pending??this.last)&&(this.pending=this.pending??this.last,this.flush());break;case"timeline":this.timeline.set(n.timeline),this.validation.set(n.validation),this.error.set(null);break;case"time":if(!n.playing&&!this.playing()&&Date.now()-this.lastSeekAt<this.echoWindowMs)break;this.time.set(n.t),this.playing.set(n.playing);break;case"readTime":this.readTime.set({format:n.format,issues:n.issues});break;case"audio":this.missingSpeech.set(n.missingSpeech);break;case"error":this.error.set(n.message);break}}requestLoad(e,n){this.pending={doc:e,format:n},!(!this.ready()||this.loadTimer!==null)&&(this.loadTimer=setTimeout(()=>{this.loadTimer=null,this.flush()},this.loadDelayMs))}flush(){if(this.clearTimer(),!this.pending||!this.ready())return;let{doc:e,format:n}=this.pending;this.pending=null,this.last={doc:e,format:n};let o=this.speechDurations;this.send(v({type:"load",doc:e,format:n},Object.keys(o).length?{speechDurations:o}:{}))}reload(){this.pending=this.pending??this.last,this.flush()}seek(e){let n=Math.max(0,e);this.time.set(n),this.lastSeekAt=Date.now(),this.send({type:"seek",t:n})}play(e=this.time()){this.pending&&this.flush();let n=this.timeline();n&&e>=n.duration-1/n.fps&&(e=0),this.playing.set(!0),this.send({type:"play",from:e})}pause(){this.playing.set(!1),this.send({type:"pause"})}togglePlay(){this.playing()?this.pause():this.play()}send(e){if(!this.target||!this.ready())return;let n=v({source:"beatsheet-studio"},e);this.target.postMessage(n,this.targetOrigin)}clearTimer(){this.loadTimer!==null&&(clearTimeout(this.loadTimer),this.loadTimer=null)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};function En(t,e=0,n=1){return t<e?e:t>n?n:t}var Ol={linear:t=>En(t),outCubic:t=>1-Math.pow(1-En(t),3),inOutCubic:t=>{let e=En(t);return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2},outQuart:t=>1-Math.pow(1-En(t),4),outBack:t=>{let e=En(t),n=1.70158;return 1+(n+1)*Math.pow(e-1,3)+n*Math.pow(e-1,2)}};var os=["cut","dip","slide","zoom","wipe","iris"],is=["left","right","up","down"],BE="left";var VL=1/3;function ii(t){return t==="dip"||t==="slide"||t==="zoom"?"through":t==="wipe"||t==="iris"?"reveal":"cut"}function Pl(t){return os.includes(t)}function rs(t){return t==="slide"||t==="wipe"}function Lm(t){return is.includes(t.direction)?t.direction:BE}function HE(t){let e=t&&t.duration>0?t.duration:0,n=ii(t?.kind);return n==="through"?{before:e/2,after:e/2}:n==="reveal"?{before:0,after:e}:{before:0,after:0}}function Fm(t,e){let{before:n,after:o}=HE(t);return n+o>0?{from:e-n,to:e+o}:null}var no=["none","aurora","grid","dots"];var UE="--bs-backdrop-alpha";var BL=1/600;var GE=2,Vm=32;function jm(t,e=GE){let n=10**e,o=Math.round(t*n)/n;return o===0?0:o}function Hm(t){let e=[];for(let n=0;n<=Vm;n++){let o=n/Vm,i=(1-o*o)**2*100;e.push(`color-mix(in srgb,var(--${t}) ${jm(i,1)}%,transparent) ${jm(o*100,1)}%`)}return e.join(",")}var $m="62%",Bm=`radial-gradient(ellipse ${$m} ${$m} at 50% 50%,${Hm("bs-fg")})`,HL=`
|
|
5
5
|
.bs-backdrop-part{position:absolute;left:0;top:0}
|
|
6
|
-
.bs-backdrop[data-kind="aurora"]{--bs-backdrop-glow:color-mix(in srgb,var(--bs-accent) calc(var(${
|
|
7
|
-
.bs-backdrop[data-kind="aurora"] .bs-backdrop-part{background:radial-gradient(closest-side,${
|
|
8
|
-
.bs-backdrop:is([data-kind="grid"],[data-kind="dots"]){-webkit-mask-image:${
|
|
6
|
+
.bs-backdrop[data-kind="aurora"]{--bs-backdrop-glow:color-mix(in srgb,var(--bs-accent) calc(var(${UE},0) * 100%),var(--bs-bg))}
|
|
7
|
+
.bs-backdrop[data-kind="aurora"] .bs-backdrop-part{background:radial-gradient(closest-side,${Hm("bs-backdrop-glow")})}
|
|
8
|
+
.bs-backdrop:is([data-kind="grid"],[data-kind="dots"]){-webkit-mask-image:${Bm};mask-image:${Bm}}
|
|
9
9
|
.bs-backdrop:is([data-kind="grid"],[data-kind="dots"]) .bs-backdrop-part{background-size:var(--bs-backdrop-cell) var(--bs-backdrop-cell)}
|
|
10
10
|
.bs-backdrop[data-kind="grid"] .bs-backdrop-part{background-image:linear-gradient(to right,var(--bs-fg) var(--bs-rule),transparent var(--bs-rule)),linear-gradient(to bottom,var(--bs-fg) var(--bs-rule),transparent var(--bs-rule))}
|
|
11
11
|
.bs-backdrop[data-kind="dots"] .bs-backdrop-part{background-image:radial-gradient(circle at 50% 50%,var(--bs-fg) calc(var(--bs-backdrop-dot) - 0.5px),transparent calc(var(--bs-backdrop-dot) + 0.5px))}
|
|
12
|
-
`;function ss(t){return 60/t}function oo(t,e){return Math.max(0,Math.ceil((t-.005)/e))*e}function Hm(t,e){return t-Math.round(t/e)*e}function as(t,e){return Math.abs(Hm(t,e))<=.005}function Ol(t,e,n="nearest"){return n==="up"?oo(t,e):Math.max(0,Math.round(t/e))*e}var GE=t=>Math.round(t*1e3)/1e3;function xn(t,e,n,o="nearest"){let i=Ol(t+e,n,o);return i<=t+.005&&(i=oo(t+2*.005,n)),GE(i-t)}function Pl(t,e,n="up",o){let i=0;return t.map((r,s)=>{let a=r;if(!as(i+r,e)){a=xn(i,r,e,n);let c=o?.[s];c!==void 0&&Number.isFinite(c)&&a<c-.005&&(a=xn(i,c,e,"up"))}return i+=a,a})}function Um(t,e){let n=ss(e),o=[],i=0;return t.forEach((r,s)=>{let a=i+r;as(a,n)||o.push({index:s,off:Hm(a,n),suggested:xn(i,r,n,"up")}),i=a}),o}function Gm(t,e){let n=t.map(i=>oo(i.start,e)),o=t.length;if(o>0){let i=t[o-1];n[o-1]>=i.end-.005&&(n[o-1]=i.start)}return n.map((i,r)=>r+1<o&&i>=n[r+1]-.005?void 0:i)}var Ll=.5;function Wm(t){return typeof t=="number"&&Number.isFinite(t)&&t>0?Math.min(t,Ll):0}var ri=1.5;var WE=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function zm(t,e){let n=t&&WE(t,e)?t[e]:void 0;return typeof n=="number"&&Number.isFinite(n)?Math.min(ri,Math.max(0,n)):1}var zE=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function qE(t){let e=[];for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);if(o>=55296&&o<=56319){let i=n+1<t.length?t.charCodeAt(n+1):0;i>=56320&&i<=57343?(o=65536+(o-55296<<10)+(i-56320),n++):o=65533}else o>=56320&&o<=57343&&(o=65533);o<128?e.push(o):o<2048?e.push(192|o>>6,128|o&63):o<65536?e.push(224|o>>12,128|o>>6&63,128|o&63):e.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|o&63)}return Uint8Array.from(e)}function qm(t){let e=typeof t=="string"?qE(t):t,n=Math.ceil((e.length+9)/64)*64,o=new Uint8Array(n);o.set(e),o[e.length]=128;let i=new DataView(o.buffer),r=e.length*8;i.setUint32(n-8,Math.floor(r/4294967296)),i.setUint32(n-4,r>>>0);let s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64),c=(f,g)=>f>>>g|f<<32-g;for(let f=0;f<n;f+=64){for(let me=0;me<16;me++)a[me]=i.getUint32(f+me*4);for(let me=16;me<64;me++){let uo=a[me-15],fo=a[me-2],vi=c(uo,7)^c(uo,18)^uo>>>3,Ws=c(fo,17)^c(fo,19)^fo>>>10;a[me]=a[me-16]+vi+a[me-7]+Ws>>>0}let g=s[0],C=s[1],E=s[2],O=s[3],Z=s[4],Q=s[5],ve=s[6],re=s[7];for(let me=0;me<64;me++){let uo=c(Z,6)^c(Z,11)^c(Z,25),fo=Z&Q^~Z&ve,vi=re+uo+fo+zE[me]+a[me]>>>0,Ws=c(g,2)^c(g,13)^c(g,22),sy=g&C^g&E^C&E,ay=Ws+sy>>>0;re=ve,ve=Q,Q=Z,Z=O+vi>>>0,O=E,E=C,C=g,g=vi+ay>>>0}s[0]=s[0]+g>>>0,s[1]=s[1]+C>>>0,s[2]=s[2]+E>>>0,s[3]=s[3]+O>>>0,s[4]=s[4]+Z>>>0,s[5]=s[5]+Q>>>0,s[6]=s[6]+ve>>>0,s[7]=s[7]+re>>>0}let d="";for(let f of s)d+=f.toString(16).padStart(8,"0");return d}var Km={kokoro:{title:"Kokoro",model:"kokoro-82m-v1.0-onnx-fp32/kokoro-js-1.2.1",hosted:!1,languages:["en"]}},cs=.3,Ht={min:.5,max:2,default:1},io=.3,KE={in:.3,out:.8},Zm=Math.max(io,KE.out),ls=8,ds=24,ZE=2,QE=1,YE=3,JE=2,Vl=["raw","studio"],us="raw";function Fl(t){return typeof t=="string"&&Vl.includes(t)}function Qm(t,e){return Fl(t.voiceFx)?t.voiceFx:Fl(e?.voiceFx)?e.voiceFx:us}var XE=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),ex=t=>typeof t=="number"&&Number.isFinite(t);function Ym(t){if(!XE(Km,t))return;let e=Km[t];return{id:t,title:e.title,model:e.model,hosted:e.hosted,languages:[...e.languages]}}var tx=/^([a-z][a-z0-9-]*):([A-Za-z0-9][A-Za-z0-9_.-]*)$/;function fs(t){if(typeof t!="string")return null;let e=tx.exec(t);return e?{engine:e[1],voice:e[2]}:null}function Jm(t,e){return typeof t.voice=="string"?t.voice:typeof e?.voice=="string"?e.voice:void 0}function si(t){return t.normalize("NFC").trim().replace(/\s+/g," ")}function Xm(t){let e=ex(t.speed)?t.speed:Ht.default,n=Fl(t.fx)?t.fx:us,o={engine:t.engine,model:t.model,voice:t.voice,text:si(t.text),speed:e},i=JSON.stringify(n==="raw"?x(y({v:ZE},o),{processing:QE}):x(y({v:YE},o),{processing:JE,fx:n}));return qm(i).slice(0,16)}var nx=["4:5","1:1","9:16"],eh={"bs-text-display-xl":{base:"150px",narrow:"96px","1:1":"84px"},"bs-text-display-l":{base:"104px",narrow:"84px","1:1":"76px"},"bs-text-display-m":{base:"88px",narrow:"84px","1:1":"68px"},"bs-text-heading":{base:"72px",narrow:"64px","1:1":"54px"},"bs-text-title":{base:"40px",narrow:"38px","1:1":"34px"},"bs-text-body":"30px","bs-text-caption":"26px","bs-text-mono":{base:"30px",narrow:"26px"}},th={"bs-weight-display":"600","bs-weight-heading":"600","bs-weight-strong":"600","bs-weight-bold":"700","bs-weight-medium":"500","bs-weight-body":"400"},nh={"bs-tracking-display":"-0.04em","bs-tracking-heading":"-0.035em","bs-tracking-title":"-0.02em","bs-tracking-tight":"-0.01em","bs-tracking-wide":"0.01em"},oh={"bs-leading-display":"0.98","bs-leading-heading":"1.02","bs-leading-title":"1.12","bs-leading-snug":"1.2","bs-leading-body":"1.3"},ih={"bs-frame-x":{base:"160px",narrow:"72px"},"bs-space-scale":"1"},rh={"bs-radius-pill":"999px","bs-shadow-color":"var(--bs-fg)","bs-shadow-sm":"0 6px 18px -6px color-mix(in srgb,var(--bs-shadow-color) 50%,transparent)","bs-shadow-md":"0 24px 60px -28px color-mix(in srgb,var(--bs-shadow-color) 45%,transparent)","bs-shadow-lg":"0 40px 90px -30px color-mix(in srgb,var(--bs-shadow-color) 30%,transparent)"},sh={"bs-captions-size":{base:"44px",narrow:"42px","9:16":"46px"},"bs-captions-fg":"var(--bs-dark-fg)","bs-captions-bg":"color-mix(in srgb,var(--bs-dark-bg) 80%,transparent)","bs-captions-edge":"color-mix(in srgb,var(--bs-dark-fg) 32%,transparent)","bs-captions-inset":{base:"56px",narrow:"64px","9:16":"300px"}},jl=y(y(y(y(y(y(y({},eh),th),nh),oh),ih),rh),sh),ox=["bs-bg","bs-fg","bs-muted","bs-accent","bs-accent-fg","bs-warn","bs-error","bs-ok","bs-panel-bg","bs-panel-fg","bs-panel-muted","bs-dark-bg","bs-dark-fg","bs-font-display","bs-font-body","bs-font-mono","bs-radius","bs-rule"];function ix(t){return t.startsWith("--")?t.slice(2):t}function $l(t){return new Set([...ox,...Object.keys(jl),...Object.keys(t.tokens??{}).map(ix)])}var e2=[{id:"type",title:"Type scale",tokens:Object.keys(eh)},{id:"weight",title:"Weights",tokens:Object.keys(th)},{id:"tracking",title:"Tracking",tokens:Object.keys(nh)},{id:"leading",title:"Line heights",tokens:Object.keys(oh)},{id:"space",title:"Spacing",tokens:Object.keys(ih)},{id:"shape",title:"Radii and shadows",tokens:Object.keys(rh)},{id:"captions",title:"Captions",tokens:Object.keys(sh)}];function Bl(t,e){if(typeof t=="string"||typeof t=="number")return String(t);let n=t[e],o=n!==void 0?n:t.narrow!==void 0&&nx.includes(e)?t.narrow:t.base;return String(o)}var rx=Object.keys(Rl),Hl=["fade","reveal","punch","blur","words"],Ut=.1,sx={easeIn:"outCubic",easeMove:"inOutCubic",easePop:"outBack",easeSettle:"outQuart",enter:.5,exit:.25,stagger:.07,rise:26,entrance:"fade",push:0};function ah(t){let e=t?.motion??{},n=y({},sx);for(let i of["easeIn","easeMove","easePop","easeSettle"]){let r=e[i];typeof r=="string"&&rx.includes(r)&&(n[i]=r)}for(let i of["enter","exit","stagger","rise"]){let r=e[i];typeof r=="number"&&Number.isFinite(r)&&r>=0&&(n[i]=r)}typeof e.entrance=="string"&&Hl.includes(e.entrance)&&(n.entrance=e.entrance);let o=e.push;return typeof o=="number"&&Number.isFinite(o)&&o>=0&&o<=Ut&&(n.push=o),n}function ms(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(String(t[n])!==String(e[n]))return!1;return!0}function ch(t,e){if(e.length>t.length)return!1;for(let n=0;n<e.length;n++)if(String(t[n])!==String(e[n]))return!1;return!0}function lh(t){return t.map(String).join(".")}function ps(t,e,n){if(e.length===0)return n;let[o,...i]=e,r=t;if(Array.isArray(r)){let f=Number(o),g=r.slice(),C=ps(g[f],i,n);return C===void 0&&i.length===0?g.splice(f,1):g[f]=C,g}let s=r!==null&&typeof r=="object"?y({},r):{},a=s[String(o)],c=a===void 0&&i.length>0&&typeof i[0]=="number"?[]:a,d=ps(c,i,n);return d===void 0?delete s[String(o)]:s[String(o)]=d,s}var Cn=.1;function be(t){return Math.round(t*1e3)/1e3}function De(t,e){return t.scenes.findIndex(n=>n.id===e)}function In(t,e){return t.scenes.find(n=>n.id===e)}function Re(t,e,n){let o=De(t,e);if(o<0)return t;let i=t.scenes[o],r=n(i);if(r===i)return t;let s=t.scenes.slice();return s[o]=r,x(y({},t),{scenes:s})}function _e(t,e){if(!(e in t))return t;let n=y({},t);return delete n[e],n}function fh(t,e){return t.title===e?t:x(y({},t),{title:e})}function ph(t,e,n){let o=t.formats.includes(e);if(n===o||!n&&t.formats.length<=1)return t;let i=n?[...t.formats,e]:t.formats.filter(r=>r!==e);return x(y({},t),{formats:i})}function mh(t,e,n=[]){if(e===null)return t.music===null?t:x(y({},t),{music:null});if(t.music?.track===e)return t;let o=x(y({},t.music),{track:e});if(o.mix){let i=Object.fromEntries(Object.entries(o.mix).filter(([r])=>n.includes(r)));Object.keys(i).length?o.mix=i:delete o.mix}return x(y({},t),{music:o})}function hh(t,e,n){if(!t.music||!Number.isFinite(n))return t;let o=be(Math.min(ri,Math.max(0,n))),i=t.music.mix??{},r=Object.hasOwn(i,e);if(o===1?!r:r&&i[e]===o)return t;let s=y({},i);return o===1?delete s[e]:s[e]=o,Object.keys(s).length?x(y({},t),{music:x(y({},t.music),{mix:s})}):x(y({},t),{music:_e(t.music,"mix")})}function gh(t){return t.music?.mix?x(y({},t),{music:_e(t.music,"mix")}):t}function yh(t,e){if(!t.music)return t;let n=Rh(e);return t.music.gain===n?t:x(y({},t),{music:x(y({},t.music),{gain:n})})}function vh(t,e){return e===void 0||e===""?_e(t,"voice"):t.voice===e?t:x(y({},t),{voice:e})}function bh(t,e){if(!t.music||!Number.isFinite(e))return t;let n=Math.round(Math.min(ds,Math.max(0,e)));return n===ls?t.music.duck===void 0?t:x(y({},t),{music:_e(t.music,"duck")}):t.music.duck===n?t:x(y({},t),{music:x(y({},t.music),{duck:n})})}function ax(t,e){if(t===e)return!0;if(!t||!e||typeof t!="object"||typeof e!="object")return!1;let n=Object.keys(t);return n.length===Object.keys(e).length&&n.every(o=>t[o]===e[o])}function _h(t,e,n,o){let i=t[e]??{},r=Object.hasOwn(i,n);if(o===void 0){if(!r)return t;let s=y({},i);return delete s[n],Object.keys(s).length?x(y({},t),{[e]:s}):_e(t,e)}return r&&ax(i[n],o)?t:x(y({},t),{[e]:x(y({},i),{[n]:o})})}function ro(t,e,n){let o=e.trim();return o?_h(t,"tokens",o,n===""?void 0:n):t}function hs(t,e,n){let o=n;if(typeof o=="number"){if(!Number.isFinite(o))return t;o=be(Math.max(0,e==="push"?Math.min(Ut,o):o))}return _h(t,"motion",e,o)}function Gl(t,e){if(e===void 0)return _e(t,"grain");if(!Number.isFinite(e))return t;let n=be(Math.min(Ll,Math.max(0,e)));return t.grain===n?t:x(y({},t),{grain:n})}function gs(t,e){if(e===void 0)return _e(t,"backdrop");if(!no.includes(e.kind))return t;let n=e.strength;if(n!==void 0&&!Number.isFinite(n))return t;let o=y({kind:e.kind},n!==void 0&&e.kind!=="none"?{strength:be(Math.min(1,Math.max(0,n)))}:{});return t.backdrop&&t.backdrop.kind===o.kind&&t.backdrop.strength===o.strength?t:x(y({},t),{backdrop:o})}function ys(t,e){if(!e)return _e(t,"captions");let n=e===!0?{}:e,o=y(y({},n.style&&n.style!=="bar"?{style:n.style}:{}),n.position&&n.position!=="bottom"?{position:n.position}:{}),i=Object.keys(o).length?o:!0,r=t.captions;return r===i||r&&JSON.stringify(dh(r))===JSON.stringify(dh(i))?t:x(y({},t),{captions:i})}function dh(t){return t===!0?["bar","bottom"]:[t.style??"bar",t.position??"bottom"]}function Eh(t,e){return e===void 0?_e(t,"voiceFx"):t.voiceFx===e?t:x(y({},t),{voiceFx:e})}function vs(t,e){if(e===void 0)return _e(t,"poster");let n={scene:e.scene};return e.beat!==void 0&&e.beat!==""&&(n.beat=e.beat),e.offset!==void 0&&Number.isFinite(e.offset)&&(n.offset=be(e.offset)),x(y({},t),{poster:n})}function so(t,e,n){if(!Number.isFinite(n))return t;let o=be(Math.max(Cn,n));return Re(t,e,i=>i.duration===o?i:x(y({},i),{duration:o}))}function bs(t,e){let n=De(t,e);return n<0?-1:t.scenes.slice(0,n).reduce((o,i)=>o+i.duration,0)}function cx(t,e,n,o){let i=In(t,e);if(!i||!Number.isFinite(n)||n<=0)return t;let r=i.duration+n;return so(t,e,o&&o>0?xn(bs(t,e),r,o,"up"):r)}function Wl(t,e,n,o){let i=In(t,e);if(!i)return t;let r=n.readMissing!==void 0&&n.readMissing>0?n.readMissing:0,s=n.speech!==void 0&&n.speech>i.duration+1e-6?n.speech-i.duration:0;return s>0&&!(o&&o>0)&&(s=Math.ceil((i.duration+s)*10-1e-6)/10-i.duration),cx(t,e,Math.max(r,s),o)}function _s(t,e,n){let o=In(t,e);if(!o||!(n>0))return t;let i=bs(t,e);return as(i+o.duration,n)?t:so(t,e,xn(i,o.duration,n,"up"))}function xh(t,e){if(!(e>0))return t;let n=Pl(t.scenes.map(o=>o.duration),e,"up");return n.every((o,i)=>o===t.scenes[i].duration)?t:x(y({},t),{scenes:t.scenes.map((o,i)=>n[i]===o.duration?o:x(y({},o),{duration:n[i]}))})}function Ch(t,e){return e>0?Pl(t.scenes.map(o=>o.duration),e,"up").filter((o,i)=>o!==t.scenes[i].duration).length:0}function ai(t,e,n,o){if(!Number.isFinite(o))return t;let i=be(Math.max(0,o));return Re(t,e,r=>r.beats?.[n]===i?r:x(y({},r),{beats:x(y({},r.beats),{[n]:i})}))}function Ih(t,e,n){return Re(t,e,o=>{if(!o.beats||!(n in o.beats))return o;let i=y({},o.beats);return delete i[n],Object.keys(i).length?x(y({},o),{beats:i}):_e(o,"beats")})}function ci(t,e,n){return Re(t,e,o=>{if(n===void 0)return _e(o,"transitionIn");let i={kind:n.kind,duration:be(Math.max(0,n.duration))};n.direction!==void 0&&rs(i.kind)&&(i.direction=n.direction);let r=o.transitionIn;return r?.kind===i.kind&&r.duration===i.duration&&r.direction===i.direction?o:x(y({},o),{transitionIn:i})})}function zl(t,e,n){return Re(t,e,o=>{if(n===void 0)return _e(o,"push");if(!Number.isFinite(n))return o;let i=be(Math.min(Ut,Math.max(0,n)));return o.push===i?o:x(y({},o),{push:i})})}function Sh(t,e,n){return Re(t,e,o=>n?o.captions===!1?o:x(y({},o),{captions:!1}):_e(o,"captions"))}function wh(t,e,n,o){return Re(t,e,i=>x(y({},i),{props:ps(i.props,n,o)}))}function Th(t,e,n){return Re(t,e,o=>n?o.muteDefaultSfx?o:x(y({},o),{muteDefaultSfx:!0}):_e(o,"muteDefaultSfx"))}function Dh(t,e,n){return Re(t,e,o=>x(y({},o),{sfx:[...o.sfx??[],Ah(n)]}))}function ql(t,e,n,o){return Re(t,e,i=>{let r=i.sfx??[];if(n<0||n>=r.length)return i;let s=y({},r[n]);for(let[c,d]of Object.entries(o))d===void 0?delete s[c]:s[c]=d;let a=r.slice();return a[n]=Ah(s),x(y({},i),{sfx:a})})}function Mh(t,e,n){return Re(t,e,o=>{let i=o.sfx??[];if(n<0||n>=i.length)return o;let r=i.filter((s,a)=>a!==n);return r.length?x(y({},o),{sfx:r}):_e(o,"sfx")})}function Nh(t,e,n=""){return Re(t,e,o=>o.narration?o:x(y({},o),{narration:{text:n}}))}function li(t,e,n){return Re(t,e,o=>{let i=o.narration;if(!i)return o;let r=y({},i);return"text"in n&&typeof n.text=="string"&&(r.text=n.text),"offset"in n&&(n.offset===void 0?delete r.offset:Number.isFinite(n.offset)&&(r.offset=be(Math.max(0,n.offset)))),"speed"in n&&(n.speed===void 0?delete r.speed:Number.isFinite(n.speed)&&(r.speed=Math.round(Math.min(Ht.max,Math.max(Ht.min,n.speed))*100)/100)),"caption"in n&&(n.caption===void 0||n.caption===""?delete r.caption:typeof n.caption=="string"&&(r.caption=n.caption)),JSON.stringify(r)===JSON.stringify(i)?o:x(y({},o),{narration:r})})}function kh(t,e){return Re(t,e,n=>_e(n,"narration"))}function Rh(t){return be(Math.min(2,Math.max(0,t)))}function Ah(t){let r=t,{offset:e,gain:n}=r,o=qt(r,["offset","gain"]),i=x(y({},o),{at:typeof t.at=="number"?be(Math.max(0,t.at)):t.at});return t.offset!==void 0&&Number.isFinite(t.offset)&&t.offset!==0&&(i.offset=be(t.offset)),t.gain!==void 0&&Number.isFinite(t.gain)&&(i.gain=Rh(t.gain)),i}function Es(t,e,n){let o=t.scenes.length;if(e<0||e>=o)return t;let i=Math.max(0,Math.min(o-1,n));if(i===e)return t;let r=t.scenes.slice(),[s]=r.splice(e,1);return r.splice(i,0,s),x(y({},t),{scenes:r})}function Oh(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"scene"}function Kl(t,e){let n=new Set(t.scenes.map(i=>i.id)),o=Oh(e).replace(/-\d+$/,"")||"scene";if(!n.has(o))return o;for(let i=2;;i++){let r=`${o}-${i}`;if(!n.has(r))return r}}function Ph(t,e){let n=De(t,e);if(n<0)return{doc:t,id:e};let o=x(y({},structuredClone(t.scenes[n])),{id:Kl(t,e)}),i=t.scenes.slice();return i.splice(n+1,0,o),{doc:x(y({},t),{scenes:i}),id:o.id}}function Lh(t,e){if(De(t,e)<0||t.scenes.length<=1)return t;let o=x(y({},t),{scenes:t.scenes.filter(s=>s.id!==e)}),i=o.export?.gif,r=o.poster?.scene===e?_e(o,"poster"):o;return i?.range?.kind==="scene"&&i.range.scene===e?Vh(r,_e(i,"range")):r}function Fh(t,e,n){let o=Oh(n);if(o===e||t.scenes.some(a=>a.id===o))return t;let i=Re(t,e,a=>x(y({},a),{id:o}));if(i===t)return t;let r=i.poster?.scene===e?x(y({},i),{poster:x(y({},i.poster),{scene:o})}):i,s=r.export?.gif;return s?.range?.kind==="scene"&&s.range.scene===e?Vh(r,x(y({},s),{range:{kind:"scene",scene:o}})):r}function Vh(t,e){return t.export?.gif&&Ul(t.export.gif)===Ul(e)?t:x(y({},t),{export:x(y({},t.export),{gif:structuredClone(e)})})}function Zl(t,e){let n=e&&(e.gif!==void 0||e.mp4===!1)?e:void 0;if(uh(t.export)===uh(n))return t;let r=t,{export:o}=r,i=qt(r,["export"]);return n?x(y({},i),{export:structuredClone(n)}):i}function jh(t,e,n){let o=e??t?.gif,i=y(y({},o?{gif:o}:{}),n?{}:{mp4:!1});return i.gif||i.mp4===!1?i:void 0}function uh(t){return JSON.stringify([t?.gif?Ul(t.gif):null,t?.mp4===!1])}function Ul(t){let e=t.range;return JSON.stringify([t.fps,t.width,t.loop,e?.kind,e?.kind==="scene"?e.scene:null,e?.kind==="time"?[e.from,e.to]:null])}var di=class{past=[];future=[];current;lastKey=null;limit;constructor(e,n={}){this.current=e,this.limit=n.limit??200}get present(){return this.current}get canUndo(){return this.past.length>0}get canRedo(){return this.future.length>0}push(e,n){return e===this.current?!1:(n!==void 0&&n===this.lastKey&&this.past.length>0||(this.past.push(this.current),this.past.length>this.limit&&this.past.shift()),this.current=e,this.future=[],this.lastKey=n??null,!0)}breakCoalescing(){this.lastKey=null}undo(){let e=this.past.pop();return e===void 0?null:(this.future.push(this.current),this.current=e,this.lastKey=null,e)}redo(){let e=this.future.pop();return e===void 0?null:(this.past.push(this.current),this.current=e,this.lastKey=null,e)}mapAll(e){this.past=this.past.map(e),this.future=this.future.map(e),this.current=e(this.current)}reset(e){this.past=[],this.future=[],this.current=e,this.lastKey=null}};var Gt=class t{base="";async getProject(){return this.json(await fetch(`${this.base}/api/project`))}async getVideo(e){let n=await fetch(`${this.base}/api/videos/${encodeURIComponent(e)}`),o=n.headers.get("etag");if(n.status===422){let i=await n.json().catch(()=>null);if(i?.doc)return{doc:i.doc,issues:i.issues??[],etag:o};throw new Error(`422: ${(i?.issues??[]).map(r=>r.message).join("; ")||"invalid file"}`)}return{doc:await this.json(n),issues:[],etag:o}}async putVideo(e,n,o){let i={"content-type":"application/json"};o&&(i["if-match"]=o);let r=await fetch(`${this.base}/api/videos/${encodeURIComponent(e)}`,{method:"PUT",headers:i,body:JSON.stringify(n)}),s=await r.json().catch(()=>null);if(r.ok)return{ok:!0,etag:s?.etag??r.headers.get("etag")};if(r.status===409&&s?.doc&&s.etag)return{ok:!1,reason:"stale",etag:s.etag,doc:s.doc};if(r.status===428)return{ok:!1,reason:"precondition-required",message:"Bug: the studio sent the save without the file version (If-Match), so the server refused it. Reload the page and report this."};let a=s?.message??s?.error??(r.status===404?"The file does not exist on disk any more":$h(r,s));return{ok:!1,issues:s?.issues??[],message:a}}async startRender(e,n,o){let i=y({file:e,formats:n},o?y({mp4:o.mp4},o.gif?{gif:o.gif}:{}):{}),r=await fetch(`${this.base}/api/render`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i)}),s=await this.json(r);return{jobId:s.jobId,existing:s.existing===!0}}async listRenderJobs(){return this.json(await fetch(`${this.base}/api/render/jobs`))}renderEvents(e,n,o){let i=new EventSource(`${this.base}/api/render/${encodeURIComponent(e)}/events`);return i.onmessage=r=>{try{n(JSON.parse(r.data))}catch{}},i.onerror=()=>{i.close(),o()},()=>i.close()}async getSpeechStatus(e){return this.json(await fetch(`${this.base}/api/speech/${encodeURIComponent(e)}`))}async startSpeech(e,n={}){let o=await fetch(`${this.base}/api/speech/${encodeURIComponent(e)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)}),i=await this.json(o);return{jobId:i.jobId,existing:i.existing===!0}}speechEvents(e,n,o){let i=new EventSource(`${this.base}/api/speech/jobs/${encodeURIComponent(e)}/events`);return i.onmessage=r=>{try{n(JSON.parse(r.data))}catch{}},i.onerror=()=>{i.close(),o()},()=>i.close()}speechClipUrl(e){return`${this.base}/speech/${encodeURIComponent(e)}.wav`}async json(e){if(!e.ok){let n=await e.text().catch(()=>""),o=null;try{o=JSON.parse(n)}catch{o=null}throw new Error(o?.issues?.length?$h(e,o):`${e.status} ${e.statusText}${n?`: ${n.slice(0,200)}`:""}`)}return await e.json()}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};function $h(t,e){let n=(e?.issues??[]).map(o=>o.message).filter(o=>typeof o=="string"&&o!=="");return n.length>0?n.join("; "):`${t.status} ${t.statusText}`}var J=class t{api=w(Gt);saveDelayMs=800;docState=A(null);savedDoc=A(null);historyVersion=A(0);history=new di(null);saveTimer=null;saveChain=Promise.resolve(!0);etag=null;doc=this.docState.asReadonly();file=A(null);project=A(null);loadError=A(null);saveState=A("idle");saveError=A(null);serverIssues=A([]);conflict=A(null);bugError=A(null);openError=A(null);selectedSceneId=A(null);format=A("16:9");saves=A(0);dirty=_(()=>this.docState()!==this.savedDoc());canUndo=_(()=>(this.historyVersion(),this.history.canUndo));canRedo=_(()=>(this.historyVersion(),this.history.canRedo));selectedScene=_(()=>{let e=this.selectedSceneId();return e?this.docState()?.scenes.find(n=>n.id===e)??null:null});async init(){try{let e=await this.api.getProject();this.project.set(e);let n=new URLSearchParams(globalThis.location?.search??"").get("video"),o=e.videos.find(i=>i.file===n)?.file??e.videos[0]?.file;o&&await this.open(o)}catch(e){this.loadError.set(`Could not load the project: ${Ql(e)}`)}}async open(e){this.openError.set(null);let n=this.file();if(this.dirty()&&!await this.save()){let o=this.conflict()?"it changed on disk":this.saveError()??"unknown error";return this.openError.set(`Did not switch to ${e}: saving ${n??"the current video"} failed (${o}). Your edits are still here; resolve the problem, then switch again.`),!1}try{let{doc:o,issues:i,etag:r}=await this.api.getVideo(e);if(this.loadDoc(e,o,r),this.serverIssues.set(i),this.loadError.set(null),globalThis.history&&globalThis.location){let s=new URL(globalThis.location.href);s.searchParams.set("video",e),globalThis.history.replaceState(null,"",s)}}catch(o){return this.loadError.set(`Could not open ${e}: ${Ql(o)}`),!1}return!0}loadDoc(e,n,o=null){this.clearTimer(),this.file.set(e),this.etag=o,this.conflict.set(null),this.bugError.set(null),this.openError.set(null),this.history=new di(n),this.docState.set(n),this.savedDoc.set(n),this.historyVersion.update(i=>i+1),this.selectedSceneId.set(null),this.serverIssues.set([]),this.saveState.set("idle"),this.saveError.set(null),!n.formats.includes(this.format())&&n.formats.length&&this.format.set(n.formats[0])}apply(e,n){let o=this.docState();if(!o)return;let i=e(o);i!==o&&(this.history.push(i,n),this.commit(i))}setExport(e){let n=this.docState();if(!n)return;let o=Zl(n,e);o!==n&&(this.history.mapAll(i=>i===n?o:i&&Zl(i,e)),this.commit(o))}endCoalescing(){this.history.breakCoalescing()}undo(){let e=this.history.undo();e&&this.commit(e)}redo(){let e=this.history.redo();e&&this.commit(e)}deleteScene(e){let n=this.docState();if(!n)return;let o=De(n,e),i=Lh(n,e);i!==n&&(this.apply(()=>i),this.select(i.scenes[Math.min(o,i.scenes.length-1)]?.id??null))}select(e){this.selectedSceneId.set(e)}setFormat(e){this.format.set(e)}reloadFromDisk(){let e=this.conflict(),n=this.file();e&&n&&this.loadDoc(n,e.doc,e.etag)}keepMine(){let e=this.conflict();return e?(this.etag=e.etag,this.savedDoc.set(e.doc),this.conflict.set(null),this.saveError.set(null),this.saveState.set("idle"),this.save()):Promise.resolve(!1)}save(){return this.clearTimer(),this.saveChain=this.saveChain.then(()=>this.saveNow()),this.saveChain}async saveNow(){let e=this.file(),n=this.docState();if(!e||!n)return!0;if(this.conflict())return!1;if(n===this.savedDoc())return!0;this.saveState.set("saving");try{let o=await this.api.putVideo(e,n,this.etag);return this.file()!==e?!0:o.ok?(o.etag&&(this.etag=o.etag),this.savedDoc.set(n),this.serverIssues.set([]),this.saveError.set(null),this.bugError.set(null),this.saveState.set("saved"),this.saves.update(i=>i+1),!0):o.reason==="stale"?(this.clearTimer(),this.conflict.set({doc:o.doc,etag:o.etag}),this.saveError.set("This video changed on disk"),this.saveState.set("conflict"),!1):o.reason==="precondition-required"?(this.bugError.set(o.message),this.saveError.set(o.message),this.saveState.set("error"),!1):(this.serverIssues.set(o.issues),this.saveError.set(o.message??"The server refused the file"),this.saveState.set("error"),!1)}catch(o){return this.saveError.set(Ql(o)),this.saveState.set("error"),!1}}commit(e){this.docState.set(e),this.historyVersion.update(o=>o+1);let n=this.selectedSceneId();n&&!e.scenes.some(o=>o.id===n)&&this.selectedSceneId.set(null),this.scheduleSave()}scheduleSave(){this.clearTimer(),!this.conflict()&&(this.saveTimer=setTimeout(()=>{this.saveTimer=null,this.save()},this.saveDelayMs))}clearTimer(){this.saveTimer!==null&&(clearTimeout(this.saveTimer),this.saveTimer=null)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};function Ql(t){return t instanceof Error?t.message:String(t)}var xs=["dark","light"];var Bh={"duplicate-format":"a format is listed twice","no-scenes":"the video has no scenes","off-beat":"a scene ends off the music track's beat","captions-no-narration":"captions are on, but no scene has narration","gif-range":"the stored GIF range names a scene or a time the video no longer has","beats-error":"a scene type's beats() failed","sounds-error":"a scene type's sounds() failed","beat-after-end":"a beat is after the end of its scene","unknown-sfx-beat":"a scene type's sound is placed on a beat the scene does not have","invalid-sfx-at":"a scene type's sound has no valid time","unknown-sound":"a scene type's sound is not in the theme","sfx-after-end":"a sound starts after the end of the video","transition-overlap":"the transitions into and out of a scene take longer than the scene","transition-empty":"a slide or zoom moves a scene in before its first beat: an empty page arrives","read-time":"a scene is too short to read","speech-fit":"a narration line runs past the end of its scene","speech-overlap":"a narration line runs into the next scene's line","speech-missing":"a narration line is not spoken yet","speech-fade-in":"a narration line starts inside the video's fade-in","captions-brief":"a caption shows too briefly to read","captions-covers":"a caption covers a text of its scene","svg-text":"an SVG image has live text that can render a few pixels differently","layout-overlap":"two labels of a scene cover each other, or a label covers a point","code-wrap":"code lines are too long for their panel in a format and wrap"},M2=Object.keys(Bh);function lx(t){return typeof t=="string"&&Object.prototype.hasOwnProperty.call(Bh,t)}function Hh(t,e){return new Set([...e?.ignoreWarnings??[],...t?.ignoreWarnings??[]].filter(lx))}function Uh(t){return t.severity==="warning"?t.code:void 0}function ui(t,e,n){let o={kept:[],silenced:[],ids:[]};for(let i of t){let r=e(i);if(r===void 0||!n.has(r)){o.kept.push(i);continue}o.silenced.push(i),o.ids.includes(r)||o.ids.push(r)}return o}function Gh(t,e){return!t?.scenes||t.scenes.includes(e)}function Yl(t,e){return!t?.music?.allowed||t.music.allowed.includes(e)}function Jl(t,e){return!t?.variants||!xs.includes(e)?!0:t.variants.includes(e)}function Xl(t,e){return!t?.transition||t.transition===e}function Wh(t,e){if(!t||typeof t!="object"||Array.isArray(t))return t;let n=t.variant,o=e?.variants?.find(i=>xs.includes(i));return o===void 0||Jl(e,n)?t:x(y({},t),{variant:o})}function zh(t,e){let n=e.filter(i=>Yl(t,i)),o=t?.music?.default;return o!==void 0&&n.includes(o)?[o,...n.filter(i=>i!==o)]:n}var qh={source:"beatsheet-studio",type:"pause"};function Cs(t){if(!t||typeof t!="object")return null;let e=t;if(e.source!=="beatsheet-gallery"||e.type!=="add-scene")return null;let n=e.scene;if(!n||typeof n!="object"||typeof n.id!="string"||typeof n.type!="string"||typeof n.duration!="number"||!Number.isFinite(n.duration)||n.duration<=0||!n.props||typeof n.props!="object"||Array.isArray(n.props))return null;let o={id:n.id,type:n.type,duration:n.duration,props:n.props};return e.sampleId===void 0?{source:"beatsheet-gallery",type:"add-scene",scene:o}:typeof e.sampleId!="string"||!e.sampleId?null:{source:"beatsheet-gallery",type:"add-scene",scene:o,sampleId:e.sampleId}}function kt(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function dx(t,e){switch(t){case"object":return kt(e);case"array":return Array.isArray(e);case"string":return typeof e=="string";case"number":return typeof e=="number"&&Number.isFinite(e);case"integer":return typeof e=="number"&&Number.isInteger(e);case"boolean":return typeof e=="boolean";case"null":return e===null;default:return!0}}function Kh(t,e){return JSON.stringify(t)===JSON.stringify(e)}function ux(t,e){if(!e.startsWith("#/"))return null;let n=t;for(let o of e.slice(2).split("/")){let i=o.replace(/~1/g,"/").replace(/~0/g,"~");if(!kt(n)||!Object.hasOwn(n,i))return null;n=n[i]}return kt(n)?n:null}function Sn(t,e,n,o,i,r){if(!kt(e)||i.length>=8)return;if(r>40){i.push(`${o}: nested too deeply`);return}let s=e;if(typeof s.$ref=="string"){let c=ux(t,s.$ref);c&&Sn(t,c,n,o,i,r+1)}let a=s.type;if(typeof a=="string"||Array.isArray(a)){let c=(Array.isArray(a)?a:[a]).filter(d=>typeof d=="string");if(c.length&&!c.some(d=>dx(d,n))){i.push(`${o}: expected ${c.join(" or ")}`);return}}Array.isArray(s.enum)&&!s.enum.some(c=>Kh(c,n))&&i.push(`${o}: not one of the allowed values`),"const"in s&&!Kh(s.const,n)&&i.push(`${o}: not the allowed value`);for(let c of["anyOf","oneOf"]){let d=s[c];if(!Array.isArray(d)||!d.length)continue;d.some(g=>{let C=[];return Sn(t,g,n,o,C,r+1),C.length===0})||i.push(`${o}: fits none of the allowed shapes`)}if(Array.isArray(s.allOf))for(let c of s.allOf)Sn(t,c,n,o,i,r+1);if(typeof n=="number"){let c=E=>typeof s[E]=="number"?s[E]:null,d=c("minimum"),f=c("maximum"),g=c("exclusiveMinimum"),C=c("exclusiveMaximum");d!==null&&n<d&&i.push(`${o}: below ${d}`),f!==null&&n>f&&i.push(`${o}: above ${f}`),g!==null&&n<=g&&i.push(`${o}: must be above ${g}`),C!==null&&n>=C&&i.push(`${o}: must be below ${C}`)}if(typeof n=="string"&&(typeof s.minLength=="number"&&[...n].length<s.minLength&&i.push(`${o}: shorter than ${s.minLength}`),typeof s.maxLength=="number"&&[...n].length>s.maxLength&&i.push(`${o}: longer than ${s.maxLength}`),typeof s.pattern=="string"))try{new RegExp(s.pattern,"u").test(n)||i.push(`${o}: does not match the pattern`)}catch{}if(Array.isArray(n)&&(typeof s.minItems=="number"&&n.length<s.minItems&&i.push(`${o}: fewer than ${s.minItems} items`),typeof s.maxItems=="number"&&n.length>s.maxItems&&i.push(`${o}: more than ${s.maxItems} items`),kt(s.items)&&n.forEach((c,d)=>Sn(t,s.items,c,`${o}[${d}]`,i,r+1))),kt(n)){let c=kt(s.properties)?s.properties:{};if(Array.isArray(s.required))for(let d of s.required)typeof d=="string"&&!Object.hasOwn(n,d)&&i.push(`${o}.${d}: missing`);for(let[d,f]of Object.entries(n))Object.hasOwn(c,d)?Sn(t,c[d],f,`${o}.${d}`,i,r+1):s.additionalProperties===!1?i.push(`${o}.${d}: not a field of this scene type`):kt(s.additionalProperties)&&Sn(t,s.additionalProperties,f,`${o}.${d}`,i,r+1)}}function ed(t,e,n="props"){let o=[];return kt(t)&&Sn(t,t,e,n,o,0),o}function Zh(t){return`/player/?mode=gallery&pick=1#${new URLSearchParams({format:t}).toString()}`}function Qh(t){return{source:"beatsheet-studio",type:"pick-open",format:t}}var Yh={source:"beatsheet-studio",type:"pause"};function Jh(t){if(t&&typeof t=="object"){let e=t;if(e.source==="beatsheet-gallery"&&e.type==="pick-close")return{source:"beatsheet-gallery",type:"pick-close"}}return Cs(t)}function Xh(t,e){if(!e)return{ok:!1,error:"The project is still loading: try again in a moment."};let n=e.sceneTypes.find(d=>d.id===t.scene.type);if(!n)return{ok:!1,error:`Scene type "${t.scene.type}" is not in this project.`};if(!Gh(e.rules,n.id))return{ok:!1,error:`${n.title} is not allowed by the project's rules.`};let o=t.sampleId??"default",i=n.samples?.find(d=>d.id===o);if(n.samples&&!i)return{ok:!1,error:`${n.title} has no sample "${o}".`};let r=ed(n.jsonSchema,t.scene.props);if(r.length)return{ok:!1,error:`The ${n.title} sample doesn't fit its schema (${r.slice(0,3).join("; ")}).`};let s=i?.duration??n.defaultDuration,a=Wh(t.scene.props,e.rules),c=a===t.scene.props||ed(n.jsonSchema,a).length?t.scene.props:a;return{ok:!0,pick:{type:n,sampleId:o,props:c,duration:s}}}function fx(t,e){let n=e?De(t,e):-1;return n<0?t.scenes.length:n+1}function eg(t,e,n){let o=Kl(t,e.sampleId==="default"?e.type.id:`${e.type.id}-${e.sampleId}`),i={id:o,type:e.type.id,duration:be(Math.max(Cn,e.duration||e.type.defaultDuration||3)),props:structuredClone(e.props)},r=t.scenes.slice();return r.splice(fx(t,n),0,i),{doc:x(y({},t),{scenes:r}),id:o}}function tg(t,e){return!t||!e||De(t,e)<0?"at the end":`after \u201C${e}\u201D`}var bt=class t{bridge=w(le);store=w(J);isOpen=A(!1);loaded=A(!1);open(){this.isOpen()||!this.store.doc()||(this.bridge.playing()&&this.bridge.pause(),this.loaded.set(!0),this.isOpen.set(!0))}close(){this.isOpen.set(!1)}add(e){let n=this.store.doc();if(!n)return"Open a video first: the scene goes into the open video.";let o=Xh(e,this.bridge.project());if(!o.ok)return o.error;let i=eg(n,o.pick,this.store.selectedSceneId());return this.store.endCoalescing(),this.store.apply(()=>i.doc),this.store.select(i.id),null}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};var ng="beatsheet-studio-view";function px(){try{return globalThis.sessionStorage?.getItem(ng)==="gallery"?"gallery":"editor"}catch{return"editor"}}var _t=class t{bridge=w(le);view=A(px());galleryLoaded=A(this.view()==="gallery");show(e){e==="gallery"&&this.bridge.playing()&&this.bridge.pause(),this.view.set(e),e==="gallery"&&this.galleryLoaded.set(!0);try{globalThis.sessionStorage?.setItem(ng,e)}catch{}}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};var mx=["frame"];function hx(t,e){t&1&&(b(0,"div",2),u(1),v()),t&2&&(l(),M(e))}var Is=class t{picker=w(bt);view=w(_t);frame=Ue.required("frame");notice=A(null);constructor(){let e=n=>this.onMessage(n);globalThis.addEventListener?.("message",e),w(ge).onDestroy(()=>globalThis.removeEventListener?.("message",e)),He(()=>{this.view.view()!=="gallery"&&this.pauseGallery()})}pauseGallery(){this.frame().nativeElement.contentWindow?.postMessage(qh,globalThis.location?.origin??"/")}onMessage(e){if(e.source!==this.frame().nativeElement.contentWindow||e.origin!==globalThis.location?.origin)return;let n=Cs(e.data);if(!n)return;let o=this.picker.add(n);if(o){this.notice.set(o);return}this.notice.set(null),this.view.show("editor")}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-gallery"]],viewQuery:function(n,o){n&1&&Qe(o.frame,mx,5),n&2&&dt()},hostAttrs:["role","region","aria-label","Gallery",1,"gallery-pane"],decls:3,vars:1,consts:[["frame",""],["title","Gallery: scene types, sounds and music","src",qc`/player/?mode=gallery`,1,"gallery-frame"],["role","status",1,"gallery-notice"]],template:function(n,o){if(n&1&&(ie(0,"iframe",1,0),T(2,hx,2,1,"div",2)),n&2){let i;l(2),D((i=o.notice())?2:-1,i)}},encapsulation:2})};var gx=/rich[\s-]?text|markup/i,yx=/\[\/?(accent|warn|error|ok|dim|strong|highlight)\]/;function Et(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function vx(t){let e=t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return e?e[0].toUpperCase()+e.slice(1):t}function rg(t){return typeof t=="string"&&yx.test(t)}function Ss(t,e,n=0){let o=t.$ref;if(typeof o!="string"||!o.startsWith("#")||n>20)return t;let i=e;for(let c of o.slice(1).split("/").filter(Boolean))i=Et(i)?i[decodeURIComponent(c.replace(/~1/g,"/").replace(/~0/g,"~"))]:void 0;if(!Et(i))return t;let a=t,{$ref:r}=a,s=qt(a,["$ref"]);return Ss(y(y({},i),s),e,n+1)}function og(t){return Et(t)&&(t.type==="null"||t.const===null&&t.type===void 0)}function bx(t,e){let n=Ss(t,e),o=n.type;if(Array.isArray(o)&&o.includes("null")){let s=o.filter(a=>a!=="null");return{schema:x(y({},n),{type:s.length===1?s[0]:s}),nullable:!0}}let i=n.anyOf??n.oneOf;if(Array.isArray(i)&&i.some(og)){let s=i.filter(f=>!og(f)),r=n,{anyOf:a,oneOf:c}=r,d=qt(r,["anyOf","oneOf"]);return s.length===1&&Et(s[0])?{schema:y(y({},Ss(s[0],e)),d),nullable:!0}:{schema:x(y({},d),{anyOf:s}),nullable:!0}}return{schema:n,nullable:!1}}function _x(t,e){let n=[];for(let o of t){if(!Et(o))return null;let i=Ss(o,e);if("const"in i)n.push(i.const);else if(Array.isArray(i.enum))n.push(...i.enum);else return null}return n}function Ex(t,e,n){return e&&e.length<=40&&!e.includes(`
|
|
13
|
-
`)?{label:e}:{label:t!==null?vx(t):n,hint:e}}function td(t,e,n,o=Et(t)?t:{},i="Value"){let{schema:r,nullable:s}=bx(Et(t)?t:{},o),a=typeof r.description=="string"?r.description:void 0,{label:c,hint:d}=Ex(e,a,i),f={key:e,kind:"json",label:c,hint:d,required:n,nullable:s,richText:typeof r.richText=="boolean"?r.richText:a!==void 0&&gx.test(a),integer:!1,defaultValue:r.default};if(Array.isArray(r.enum))return x(y({},f),{kind:"enum",options:r.enum});if("const"in r)return x(y({},f),{kind:"enum",options:[r.const]});let g=r.anyOf??r.oneOf;if(Array.isArray(g)){let E=_x(g,o);return E?x(y({},f),{kind:"enum",options:E}):f}let C=r.type;switch(C){case"string":return x(y({},f),{kind:"string"});case"number":case"integer":return x(y({},f),{kind:"number",integer:C==="integer",min:ig(r.minimum??r.exclusiveMinimum),max:ig(r.maximum??r.exclusiveMaximum)});case"boolean":return x(y({},f),{kind:"boolean"});case"object":{let E=r.properties;if(!Et(E))return f;let O=new Set(Array.isArray(r.required)?r.required:[]),Z=Object.entries(E).map(([Q,ve])=>td(ve,Q,O.has(Q),o));return x(y({},f),{kind:"object",fields:Z})}case"array":{let E=r.items;if(!Et(E))return f;let O=td(E,null,!0,o,xx(c));return x(y({},f),{kind:"array",item:O})}default:return f}}function sg(t){let e=Et(t)?t:{};return td(e,null,!0,e,"Props")}function ig(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function xx(t){return t.endsWith("s")&&t.length>3?t.slice(0,-1):"Item"}function nd(t){if(t.defaultValue!==void 0)return structuredClone(t.defaultValue);switch(t.kind){case"string":return"";case"number":return t.min!==void 0&&t.min>0?t.min:0;case"boolean":return!1;case"enum":return t.options?.[0]??null;case"array":return[];case"object":{let e={};for(let n of t.fields??[])n.required&&n.key!==null&&(e[n.key]=nd(n));return e}default:return t.nullable?null:""}}function ag(t,e,n,o){let i=Math.max(0,Math.min(e,n,t.length)),r=Math.min(t.length,Math.max(e,n)),s=`[${o}]`,a=`[/${o}]`,c=t.slice(i,r);return{value:t.slice(0,i)+s+c+a+t.slice(r),start:i+s.length,end:i+s.length+c.length}}var Cx=.05,id=10,rd=600,cg=80;function Ix(t,e){return t*e}function fi(t,e){return e>0?t/e:0}function Ts(t,e=!0,n=Cx){let o=e?Math.round(t/n)*n:t;return Math.round(o*1e3)/1e3}function Ds(t,e,n){return Math.min(n,Math.max(e,t))}function Ms(t){return Ds(t,id,rd)}function sd(t,e){return Math.max(0,Math.floor(t*e+1e-4))}function pi(t,e){let n=Math.round(t*e);return n>0?(n-1)/e:0}function ad(t,e,n){return Math.min(sd(t,e),Math.max(0,n-1))}function Ns(t,e,n,o){let i=ad(t,e,Math.round(o*e));return Ds((i+n)/e,0,pi(o,e))}function lg(t,e){return sd(t,e)/e}function ws(t){return String(t).padStart(2,"0")}function cd(t,e){let n=sd(t,e),o=Math.max(1,Math.round(e)),i=Math.floor(n/o);return`${ws(Math.floor(i/60))}:${ws(i%60)}.${ws(n%o)}`}function Sx(t){let e=Math.round(t*100)/100;if(e>=60){let n=Math.floor(e/60),o=e-n*60;return`${n}:${ws(Math.round(o))}`}return`${e}s`}function mi(t){return`${(Math.round(t*100)/100).toFixed(2)}s`}var od=[.05,.1,.25,.5,1,2,5,10,15,30,60];function dg(t,e,n=64){let o=od.find(a=>a*e>=n)??od[od.length-1],i=o/(o*e>=120?5:2),r=[],s=Math.floor(t/i+1e-6);for(let a=0;a<=s;a++){let c=Math.round(a*i*1e3)/1e3,d=Math.abs(c/o-Math.round(c/o))<1e-6;r.push({t:c,x:Ix(c,e),major:d,label:d?Sx(c):void 0})}return r}function ug(t,e,n){let o=0;return t.forEach((i,r)=>{r!==e&&(i.start+i.end)/2<n&&o++}),o}function fg(t){return Math.min(160,Math.ceil(t.length*6.2)+3)}function pg(t,e=3,n=4){let o=new Array(e).fill(Number.NEGATIVE_INFINITY);return t.map(({x:i,width:r})=>{let s=o.findIndex(a=>a+n<=i);return s===-1?null:(o[s]=i+r,s)})}function mg(t,e){let n=t.index>0?Lm(t.transitionIn,t.start):null;if(!n)return null;let o=t.transitionIn.kind;return{kind:o,reveal:ii(o)==="reveal",left:n.from*e,width:(n.to-n.from)*e,title:`${o.charAt(0).toUpperCase()}${o.slice(1)} transition (${mi(t.transitionIn.duration)})`}}function dd(t,e){let n=e?.music?.track;if(!n)return;let o=t?.theme.music.find(i=>i.id===n)?.bpm;return typeof o=="number"&&Number.isFinite(o)&&o>0?o:void 0}function gg(t,e){let n=dd(t,e);return n===void 0?void 0:ss(n)}var wx=12;function yg(t,e){let n=e.beat;if(!e.enabled||n===void 0||!(n>0))return Math.max(Cn,Ts(t,e.enabled));let o=e.start+t,i=oo(e.start,n),r=n*4,s=i+Math.max(1,Math.round((o-i)/r))*r,a=e.pxPerSecond>0?wx/e.pxPerSecond:0,c=Math.abs(s-o)<=a?s:Ol(o,n,"nearest"),d=oo(e.start+Cn+.005,n);return Math.max(Cn,be(Math.max(c,d)-e.start))}var Tx=6;function vg(t,e,n,o){if(!(n>0)||!(e>0))return{beats:[],bars:[]};let i=[],r=n*4;Gm(t,n).forEach((c,d)=>{if(c===void 0)return;let f=t[d].end;for(let g=c;g<f-.005;g+=r)i.push(g)});let s=c=>i.some(d=>Math.abs(d-c)<=.005),a=[];if(n*o>=Tx){let c=Math.floor(e/n+1e-6);for(let d=1;d<=c;d++){let f=d*n;s(f)||a.push(be(f*o))}}return{beats:a,bars:i.map(c=>be(c*o))}}var Wt=class t{bridge=w(le);store=w(J);bpm=_(()=>dd(this.bridge.project(),this.store.doc()));beat=_(()=>gg(this.bridge.project(),this.store.doc()));offBeat=_(()=>{let e=this.bpm(),n=this.store.doc();if(e===void 0||!n)return new Map;let o=Um(n.scenes.map(i=>i.duration),e);return new Map(o.map(i=>[n.scenes[i.index].id,x(y({},i),{sceneId:n.scenes[i.index].id})]))});snapAllChanges=_(()=>{let e=this.beat(),n=this.store.doc();return e===void 0||!n?0:Ch(n,e)});static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};var Dx=2.5;function bg(t){return typeof t.offset=="number"&&Number.isFinite(t.offset)?Math.max(0,t.offset):cs}function Mx(t){return typeof t.speed=="number"&&Number.isFinite(t.speed)?t.speed:Ht.default}function fd(t){let e=si(t);return e?e.split(" ").length:0}function Nx(t){return fd(t.text)/Dx/Mx(t)}function kx(t,e,n){if(!t||typeof t.text!="string")return null;let o=si(t.text),i=fs(e),r=i?Ym(i.engine):void 0;return!o||!i||!r?null:Xm(y({engine:r.id,model:r.model,voice:i.voice,text:o,speed:t.speed},n?{fx:n}:{}))}function _g(t=!1){return t?Zm:io}function Rx(t,e,n=!1){return bg(t)+e+_g(n)}function Eg(t,e){return t?.state==="ready"&&t.need!==void 0&&t.need>e+1e-6}function xg(t,e,n,o,i=!1,r){let s=t.narration;if(!s)return null;let a={sceneId:t.id,estimate:Nx(s),offset:bg(s)};if(!si(s.text??""))return x(y({},a),{key:null,state:"empty"});let c=kx(s,e,r);if(c===null)return x(y({},a),{key:null,state:"unvoiced"});let d=n.get(c);return d!==void 0?x(y({},a),{key:c,state:"ready",duration:d,need:Rx(s,d,i),tail:_g(i)}):x(y({},a),{key:c,state:o.has(t.id)?"stale":"missing"})}var ud=t=>`${(Math.round(t*100)/100).toFixed(2)} s`;function Cg(t,e,n,o){let i=n.state==="ready"?n.duration??0:n.estimate;if(!(i>0))return null;let r=t+n.offset,s=r+i,a=ks(r*o),c=ks(i*o),d=Math.max(r,e),f=s>e+1e-6?{x:ks((d-r)*o),width:ks((s-d)*o)}:null,g=n.state==="ready"?`clip ${ud(i)}`:`about ${ud(i)} (${Ax[n.state]})`,C=f?` \xB7 runs ${ud(s-e)} past the scene end`:"";return{sceneId:n.sceneId,x:a,width:c,estimate:n.state!=="ready",state:n.state,over:f,title:`${n.sceneId}: ${g}${C}`}}var Ax={ready:"ready",stale:"stale: the line changed since it was spoken",missing:"not spoken yet",empty:"no text",unvoiced:"no voice"};function ks(t){return Math.round(t*100)/100}function Ox(t,e){switch(e.type){case"loading":return x(y({},t),{phase:"loading"});case"progress":return x(y({},t),{phase:"speaking",sceneId:e.sceneId,done:e.done,total:e.total});case"clip":return t.phase==="speaking"?t:x(y({},t),{phase:"speaking"});case"done":return x(y({},t),{phase:"done",sceneId:null});case"error":return x(y({},t),{phase:"error",sceneId:null,error:e.message})}}function hi(t){switch(t.phase){case"saving":return"Saving\u2026";case"starting":return"Starting\u2026";case"loading":return"Loading the voice engine\u2026";case"speaking":return`Speaking${t.sceneId?` \u201C${t.sceneId}\u201D`:""}${t.total>0?` (${Math.min(t.done+1,t.total)} of ${t.total})`:""}\u2026`;case"done":return"Speech generated";case"error":return t.error??"Speech failed"}}var Xe=class t{api=w(Gt);store=w(J);bridge=w(le);refreshDelayMs=300;createAudio=e=>new Audio(e);status=A(null);statusError=A(null);job=A(null);playingKey=A(null);playError=A(null);ready=A(new Map);spoken=A(new Set);refreshTimer=null;stream=null;audio=null;voice=_(()=>{let e=this.store.doc();return e?Jm(e,this.bridge.project()??void 0):void 0});voiceFx=_(()=>{let e=this.store.doc();return e?Qm(e,this.bridge.project()??void 0):void 0});engine=_(()=>fs(this.voice())?.engine??null);engines=_(()=>this.status()?.engines??this.bridge.project()?.speechEngines??[]);available=_(()=>this.status()?.available??null);engineMissing=_(()=>{let e=this.available(),n=this.engine();return e!==null&&n!==null&&!e.includes(n)});scenes=_(()=>{let e=this.store.doc(),n=this.voice(),o=this.voiceFx(),i=this.ready(),r=this.spoken(),s=new Map,a=e?.scenes??[];for(let[c,d]of a.entries()){let f=xg(d,n,i,r,c===a.length-1,o);f&&s.set(d.id,f)}return s});toSpeak=_(()=>[...this.scenes().values()].filter(e=>e.state==="missing"||e.state==="stale").length);running=_(()=>{let e=this.job();return e!==null&&e.file===this.store.file()&&e.phase!=="done"&&e.phase!=="error"});currentJob=_(()=>{let e=this.job();return e&&e.file===this.store.file()?e:null});of(e){return this.scenes().get(e)??null}open(e){this.stop(),this.clearTimer(),this.status.set(null),this.statusError.set(null),this.setReady(new Map),this.spoken.set(new Set),e&&this.refresh()}scheduleRefresh(){this.clearTimer(),this.refreshTimer=setTimeout(()=>{this.refreshTimer=null,this.refresh()},this.refreshDelayMs)}async refresh(e=!1){let n=this.store.file();if(!n)return;try{let i=await this.api.getSpeechStatus(n);if(this.store.file()!==n)return;this.applyStatus(i),this.statusError.set(null)}catch(i){this.store.file()===n&&this.statusError.set(`Could not load the speech status: ${pd(i)}`)}if(this.store.file()!==n)return;let o=this.ready();(e||this.bridge.missingSpeech().some(i=>o.has(i.key)))&&this.bridge.reload()}async generate(e){let n=this.store.file();if(!(!n||this.running())){if(this.job.set({file:n,jobId:null,scenes:e??null,phase:"saving",done:0,total:0,sceneId:null,error:null,notice:null}),!await this.store.save()){this.patch(n,{phase:"error",error:`Save failed: ${this.store.saveError()??"unknown error"}. The server speaks the saved file: fix the problems and try again.`});return}this.patch(n,{phase:"starting"});try{let{jobId:o,existing:i}=await this.api.startSpeech(n,e?{scenes:e}:{});this.patch(n,i?{jobId:o,scenes:null,notice:"Speech for this video was already being generated: following that job."}:{jobId:o}),this.listen(n,o)}catch(o){this.patch(n,{phase:"error",error:`Could not start speaking: ${pd(o)}`})}}}play(e){this.stop(),this.bridge.playing()&&this.bridge.pause();let n=this.createAudio(this.api.speechClipUrl(e));this.audio=n,this.playingKey.set(e),this.playError.set(null);let o=()=>{this.audio===n&&(this.audio=null,this.playingKey.set(null))};n.onended=o,n.play().catch(i=>{this.audio===n&&(o(),this.playError.set(`Could not play the clip: ${pd(i)}`))})}stop(){this.audio?.pause(),this.audio=null,this.playingKey.set(null)}toggle(e){this.playingKey()===e?this.stop():this.play(e)}applyStatus(e){this.status.set(e);let n=new Map(this.ready()),o=new Set(this.spoken());for(let i of e.scenes)i.state==="ready"?(n.set(i.key,i.duration??0),o.add(i.sceneId)):n.delete(i.key);this.setReady(n),this.spoken.set(o)}setReady(e){this.ready.set(e),this.bridge.speechDurations=Object.fromEntries([...e].filter(([,n])=>n>0))}listen(e,n){this.stream?.close();let o=!1,i=this.api.speechEvents(n,r=>{let s=this.job();!s||s.jobId!==n||(r.type==="clip"&&this.store.file()===e&&(this.setReady(new Map(this.ready()).set(r.key,r.duration)),this.spoken.update(a=>new Set(a).add(r.sceneId))),this.job.set(Ox(s,r)),(r.type==="done"||r.type==="error")&&(o=!0,this.stopListening(n),this.finish(e)))},()=>{if(this.stream?.jobId===n&&(this.stream=null),o)return;let r=this.job();r?.jobId===n&&r.phase!=="done"&&r.phase!=="error"&&this.job.set(x(y({},r),{phase:"error",sceneId:null,error:"The progress stream closed before the speech was done; the clips made so far are kept."})),this.finish(e)});this.stream={jobId:n,close:i}}stopListening(e){this.stream?.jobId===e&&(this.stream.close(),this.stream=null)}async finish(e){this.store.file()===e&&await this.refresh(!0)}patch(e,n){this.job.update(o=>o&&o.file===e?y(y({},o),n):o)}clearTimer(){this.refreshTimer!==null&&(clearTimeout(this.refreshTimer),this.refreshTimer=null)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};function pd(t){return t instanceof Error?t.message:String(t)}var ao=t=>String(Math.round(t*100)/100);function Px(t){let e=`${ao(t.words)} words`;if(t.leaves!==void 0){let o=t.kind==="scene"?`${e} gone by then`:`${e} in \u201C${t.text??t.element??""}\u201D`;return`Gone too early to read (${t.format}): needs ${ao(t.need)} s, has ${ao(t.has)} s until ${ao(t.leaves)} s \xB7 ${o} \xB7 slow it down or move its beats`}let n=t.kind==="scene"?`all ${e}`:`${e} in \u201C${t.text??t.element??""}\u201D`;return`Too short to read (${t.format}): needs ${ao(t.duration+t.missing)} s, has ${ao(t.duration)} s \xB7 ${n}`}function Lx(t,e,n){let o=new Set(n.filter(i=>i.path[0]==="scenes"&&i.path[1]===t).map(i=>i.message));return e.filter(i=>!o.has(i))}var et=class t{bridge=w(le);store=w(J);speech=w(Xe);ignored=_(()=>Hh(this.store.doc()??void 0,this.bridge.project()?.rules));validationSplit=_(()=>{let e=new Set,n=[];for(let o of[...this.bridge.validation()?.issues??[],...this.store.serverIssues()]){let i=`${o.path.join(".")}|${o.message}`;e.has(i)||(e.add(i),n.push(o))}return ui(n,Uh,this.ignored())});validationIssues=_(()=>this.validationSplit().kept);readTimeSplit=_(()=>{let e=this.bridge.readTime(),n=this.store.doc();if(!e||!n||e.format!==this.store.format())return ui([],()=>"read-time",this.ignored());let o=e.issues.flatMap(i=>{let r=De(n,i.sceneId);if(r<0||n.scenes[r].duration!==i.duration)return[];let s=Px(i);return[{sceneId:i.sceneId,index:r,issue:i,message:s,validation:{path:["scenes",r,"duration"],message:s,severity:"warning"}}]});return ui(o,()=>"read-time",this.ignored())});readTime=_(()=>this.readTimeSplit().kept);speechFitSplit=_(()=>{let n=(this.store.doc()?.scenes??[]).filter(o=>Eg(this.speech.of(o.id),o.duration)).map(o=>o.id);return ui(n,()=>"speech-fit",this.ignored())});silenced=_(()=>{let e=[this.validationSplit(),this.readTimeSplit(),this.speechFitSplit()];return{count:e.reduce((n,o)=>n+o.silenced.length,0),ids:[...new Set(e.flatMap(n=>n.ids))]}});silencedLabel=_(()=>this.silenced().count?`${this.silenced().count} silenced`:"");silencedNote=_(()=>this.silenced().count?`${this.silencedLabel()} (${this.silenced().ids.join(", ")}) by ignoreWarnings`:"");all=_(()=>[...this.validationIssues(),...this.readTime().map(e=>e.validation)]);errorCount=_(()=>this.all().filter(e=>e.severity==="error").length);readTimeOf(e){return this.readTime().find(n=>n.sceneId===e)??null}speechFitShown(e){return this.speechFitSplit().kept.includes(e)}sceneWarnings(e){return Lx(e.index,e.warnings,this.validationSplit().silenced)}isReadTime(e){return this.readTime().some(n=>n.validation===e)}at(e){return this.all().filter(n=>ms(n.path,e))}under(e){return this.all().filter(n=>ch(n.path,e)).map(n=>x(y({},n),{path:n.path.slice(e.length)}))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};var md=()=>[],Ig=(t,e)=>e.key;function Fx(t,e){if(t&1){let n=j();h(0,"app-schema-field",5),k("edit",function(i){I(n);let r=p(3);return S(r.edit.emit(i))}),m()}if(t&2){let n=e.$implicit,o=p(3);N("field",n)("value",o.childValue(n))("path",o.childPath(n.key))("issues",o.issues())("depth",o.depth()+1)}}function Vx(t,e){if(t&1&&L(0,Fx,1,5,"app-schema-field",4,Ig),t&2){p(2);let n=we(0);F(n.fields??Te(0,md))}}function jx(t,e){t&1&&(h(0,"span",6),u(1," optional"),m())}function $x(t,e){if(t&1&&(h(0,"p",7),u(1),m()),t&2){p(3);let n=we(0);l(),M(n.hint)}}function Bx(t,e){if(t&1){let n=j();h(0,"app-schema-field",5),k("edit",function(i){I(n);let r=p(3);return S(r.edit.emit(i))}),m()}if(t&2){let n=e.$implicit,o=p(3);N("field",n)("value",o.childValue(n))("path",o.childPath(n.key))("issues",o.issues())("depth",o.depth()+1)}}function Hx(t,e){if(t&1&&(h(0,"fieldset",3)(1,"legend"),u(2),T(3,jx,2,0,"span",6),m(),T(4,$x,2,1,"p",7),L(5,Bx,1,5,"app-schema-field",4,Ig),m()),t&2){p(2);let n=we(0);l(2),M(n.label),l(),D(n.required?-1:3),l(),D(n.hint?4:-1),l(),F(n.fields??Te(3,md))}}function Ux(t,e){if(t&1&&T(0,Vx,2,1)(1,Hx,7,4,"fieldset",3),t&2){let n=p();D(n.depth()===0?0:1)}}function Gx(t,e){if(t&1&&(h(0,"p",7),u(1),m()),t&2){p(2);let n=we(0);l(),M(n.hint)}}function Wx(t,e){if(t&1){let n=j();h(0,"app-schema-field",5),k("edit",function(i){I(n);let r=p(3);return S(r.edit.emit(i))}),m()}if(t&2){let n=e,o=p(),i=o.$implicit,r=o.$index,s=p(2);N("field",n)("value",i)("path",s.childPath(r))("issues",s.issues())("depth",n.kind==="object"?0:s.depth()+1)}}function zx(t,e){if(t&1){let n=j();h(0,"div",9)(1,"div",11)(2,"span",12),u(3),m(),h(4,"span",13),u(5),m(),h(6,"button",14),k("click",function(){let i=I(n).$index,r=p(2);return S(r.moveItem(i,-1))}),u(7,"\u2191"),m(),h(8,"button",15),k("click",function(){let i=I(n).$index,r=p(2);return S(r.moveItem(i,1))}),u(9,"\u2193"),m(),h(10,"button",16),k("click",function(){let i=I(n).$index,r=p(2);return S(r.removeItem(i))}),u(11,"\u2715"),m()(),T(12,Wx,1,5,"app-schema-field",4),m()}if(t&2){let n,o=e.$implicit,i=e.$index,r=e.$count,s=p(2),a=we(0);l(3),M(i+1),l(2),M(s.itemTitle(o)),l(),N("disabled",i===0),z("aria-label","Move "+a.label+" item "+(i+1)+" up"),l(2),N("disabled",i===r-1),z("aria-label","Move "+a.label+" item "+(i+1)+" down"),l(2),z("aria-label","Remove "+a.label+" item "+(i+1)),l(2),D((n=a.item)?12:-1,n)}}function qx(t,e){if(t&1){let n=j();h(0,"fieldset",1)(1,"legend"),u(2),h(3,"span",8),u(4),m()(),T(5,Gx,2,1,"p",7),L(6,zx,13,8,"div",9,oe),h(8,"button",10),k("click",function(){I(n);let i=p();return S(i.addItem())}),u(9),m()()}if(t&2){let n=p(),o=we(0);l(2),B("",o.label," "),l(2),M(n.items().length),l(),D(o.hint?5:-1),l(),F(n.items()),l(3),B("+ Add ",n.itemLabel())}}function Kx(t,e){if(t&1){let n=j();h(0,"input",22),k("change",function(i){I(n);let r=p(2);return S(r.emitValue(r.checked(i),!1))}),m(),h(1,"label",18),u(2),m()}if(t&2){let n=p(2),o=we(0);N("id",n.id)("checked",n.value()===!0),l(),N("for",n.id),l(),M(o.label)}}function Zx(t,e){t&1&&(h(0,"span",6),u(1," optional"),m())}function Qx(t,e){if(t&1&&(h(0,"label",18),u(1),T(2,Zx,2,0,"span",6),m()),t&2){let n=p(2),o=we(0);N("for",n.id),l(),B(" ",o.label),l(),D(o.required?-1:2)}}function Yx(t,e){if(t&1){let n=j();h(0,"button",27),k("mousedown",function(i){return i.preventDefault()})("click",function(){let i=I(n).$implicit;p();let r=hl(4),s=p(3);return S(s.wrap(r,i))}),u(1),m()}if(t&2){let n=e.$implicit;gl(yl("rt-tag rt-",n)),z("aria-label","Wrap selection in "+n),l(),M(n)}}function Jx(t,e){if(t&1){let n=j();h(0,"div",24),L(1,Yx,2,5,"button",25,pe),m(),h(3,"textarea",26,0),k("input",function(i){I(n);let r=p(3);return S(r.onText(i))}),m()}if(t&2){let n=p(3),o=we(0);z("aria-label","Markup for "+o.label),l(),F(n.richTags),l(2),N("id",n.id)("value",n.stringValue())}}function Xx(t,e){if(t&1){let n=j();h(0,"input",28),k("input",function(i){I(n);let r=p(3);return S(r.onText(i))}),m()}if(t&2){let n=p(3);N("id",n.id)("value",n.stringValue())}}function eC(t,e){if(t&1&&T(0,Jx,5,3)(1,Xx,1,2,"input",23),t&2){let n=p(2);D(n.multiline()?0:1)}}function tC(t,e){if(t&1){let n=j();h(0,"input",29),k("input",function(i){I(n);let r=p(2);return S(r.onNumber(i))}),m()}if(t&2){let n=p(2),o=we(0);N("id",n.id)("value",n.value()??"")("step",o.integer?1:.05),z("min",o.min??null)("max",o.max??null)}}function nC(t,e){if(t&1&&(h(0,"option",31),u(1,"\u2014"),m()),t&2){let n=p(3);N("selected",n.value()===void 0)}}function oC(t,e){if(t&1&&(h(0,"option",32),u(1),m()),t&2){let n=e.$implicit,o=e.$index,i=p(3);N("value",o)("selected",n===i.value()),l(),M(i.optionLabel(n))}}function iC(t,e){if(t&1){let n=j();h(0,"select",30),k("change",function(i){I(n);let r=p(2);return S(r.onEnum(i))}),T(1,nC,2,1,"option",31),L(2,oC,2,3,"option",32,oe),m()}if(t&2){let n=p(2),o=we(0);N("id",n.id),l(),D(!o.required||n.value()===void 0?1:-1),l(),F(o.options??Te(2,md))}}function rC(t,e){if(t&1&&(h(0,"p",34),u(1),m()),t&2){let n=p(3);l(),M(n.jsonError())}}function sC(t,e){if(t&1){let n=j();h(0,"textarea",33),k("change",function(i){I(n);let r=p(2);return S(r.onJson(i))}),m(),T(1,rC,2,1,"p",34)}if(t&2){let n=p(2);N("id",n.id)("value",n.jsonText()),l(),D(n.jsonError()?1:-1)}}function aC(t,e){if(t&1&&(h(0,"p",7),u(1),m()),t&2){p(2);let n=we(0);l(),M(n.hint)}}function cC(t,e){if(t&1&&(h(0,"p",34),u(1),m()),t&2){let n=e.$implicit;q("warning",n.severity==="warning"),l(),M(n.message)}}function lC(t,e){if(t&1&&(h(0,"div",17),T(1,Kx,3,4)(2,Qx,3,3,"label",18),T(3,eC,2,1)(4,tC,1,5,"input",19)(5,iC,4,3,"select",20)(6,sC,2,3),T(7,aC,2,1,"p",7),L(8,cC,2,3,"p",21,oe),m()),t&2){let n,o=p(),i=we(0);q("sf-inline",i.kind==="boolean")("has-error",o.myIssues().length>0),l(),D(i.kind==="boolean"?1:2),l(2),D((n=i.kind)==="string"?3:n==="number"?4:n==="enum"?5:n==="json"?6:-1),l(4),D(i.hint?7:-1),l(),F(o.myIssues())}}var dC=["accent","warn","error","ok","dim","strong","highlight"],uC=0,Rs=class t{field=to.required();value=to();path=to([]);issues=to([]);depth=to(0);edit=eo();id=`sf-${uC++}`;richTags=dC;jsonError=A(null);myIssues=_(()=>this.issues().filter(e=>ms(e.path,this.path())));items=_(()=>{let e=this.value();return Array.isArray(e)?e:[]});stringValue=_(()=>{let e=this.value();return typeof e=="string"?e:e==null?"":String(e)});multiline=_(()=>{let e=this.stringValue();return this.field().richText||rg(e)||e.includes(`
|
|
14
|
-
`)});jsonText=_(()=>JSON.stringify(this.value()??null,null,2));itemLabel=_(()=>(this.field().item?.label??"item").toLowerCase());childValue(e){let n=this.value();return n!==null&&typeof n=="object"&&e.key!==null?n[e.key]:void 0}childPath(e){return e===null?this.path():[...this.path(),e]}itemTitle(e){if(e===null||typeof e!="object")return"";let n=e,o=["label","kind","title","text","src"].map(r=>n[r]).find(r=>typeof r=="string"&&r),i=typeof o=="string"?o.replace(/\[\/?[a-z]+\]/g,""):"";return i.length>32?`${i.slice(0,32)}\u2026`:i}optionLabel(e){return e===null?"none":String(e)}checked(e){return e.target.checked}emitValue(e,n){this.edit.emit({path:this.path(),value:e,coalesce:n})}onText(e){let n=e.target.value,o=this.field();n===""&&!o.required?this.emitValue(o.nullable?null:void 0,!0):this.emitValue(n,!0)}onNumber(e){let n=e.target;if(n.value===""){this.field().required||this.emitValue(void 0,!0);return}let o=n.valueAsNumber;Number.isFinite(o)&&this.emitValue(o,!0)}onEnum(e){let n=e.target.value;if(n===""){this.emitValue(void 0,!1);return}this.emitValue(this.field().options?.[Number(n)],!1)}onJson(e){let n=e.target.value;try{this.emitValue(JSON.parse(n),!1),this.jsonError.set(null)}catch(o){this.jsonError.set(`Invalid JSON: ${o instanceof Error?o.message:String(o)}`)}}wrap(e,n){let o=ag(e.value,e.selectionStart,e.selectionEnd,n);e.value=o.value,e.focus(),e.setSelectionRange(o.start,o.end),this.emitValue(o.value,!1)}addItem(){let e=this.field().item;e&&this.emitValue([...this.items(),nd(e)],!1)}removeItem(e){this.emitValue(this.items().filter((n,o)=>o!==e),!1)}moveItem(e,n){let o=this.items().slice(),i=e+n;i<0||i>=o.length||([o[e],o[i]]=[o[i],o[e]],this.emitValue(o,!1))}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-schema-field"]],inputs:{field:[1,"field"],value:[1,"value"],path:[1,"path"],issues:[1,"issues"],depth:[1,"depth"]},outputs:{edit:"edit"},decls:4,vars:2,consts:[["ta",""],[1,"sf-group","sf-array"],[1,"sf-field",3,"sf-inline","has-error"],[1,"sf-group"],[3,"field","value","path","issues","depth"],[3,"edit","field","value","path","issues","depth"],[1,"sf-optional"],[1,"sf-hint"],[1,"sf-count"],[1,"sf-item"],["type","button",1,"ghost","sf-add",3,"click"],[1,"sf-item-head"],[1,"sf-item-no"],[1,"sf-item-title"],["type","button","title","Move up",1,"icon",3,"click","disabled"],["type","button","title","Move down",1,"icon",3,"click","disabled"],["type","button","title","Remove",1,"icon","danger",3,"click"],[1,"sf-field"],[3,"for"],["type","number",3,"id","value","step"],[3,"id"],["role","alert",1,"sf-issue",3,"warning"],["type","checkbox",3,"change","id","checked"],["type","text",3,"id","value"],["role","toolbar",1,"rt-toolbar"],["type","button",3,"class"],["rows","3",3,"input","id","value"],["type","button",3,"mousedown","click"],["type","text",3,"input","id","value"],["type","number",3,"input","id","value","step"],[3,"change","id"],["value","",3,"selected"],[3,"value","selected"],["rows","4",1,"mono",3,"change","id","value"],["role","alert",1,"sf-issue"]],template:function(n,o){if(n&1&&(Xn(0),T(1,Ux,2,1)(2,qx,10,4,"fieldset",1)(3,lC,10,7,"div",2)),n&2){let i,r=Qo(o.field());l(),D((i=r.kind)==="object"?1:i==="array"?2:3)}},dependencies:[t],encapsulation:2})};var fC=.5,pC=.6;function Sg(t,e,n){if(!e?.variants||t.kind!=="object"||!t.fields)return t;let o=n&&typeof n=="object"?n.variant:void 0,i=t.fields.map(r=>r.key!=="variant"||r.kind!=="enum"||!r.options?.some(s=>xs.includes(s))?r:x(y({},r),{options:r.options.filter(s=>Jl(e,s)||s===o)}));return x(y({},t),{fields:i})}function wg(t,e,n){let o=new Map(t.map(s=>[s.id,s])),i=e?.music?.default,r=zh(e,t.map(s=>s.id)).map(s=>{let a=o.get(s);return s===i?{id:s,title:`${a.title} (default)`}:a});return n!==void 0&&o.has(n)&&!Yl(e,n)&&r.push({id:n,title:`${o.get(n).title} (not allowed)`}),{tracks:r,noMusic:!e?.music?.required||n===void 0}}function Tg(t,e,n){return{themeDefault:Xl(t,e)||n===void 0,kinds:os.filter(o=>Xl(t,o)||n===o)}}function hd(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Dg(t){let e=ii(t);return e==="cut"?0:e==="reveal"?pC:fC}var Mg=["300","400","500","600","700","800"],gd=["bs-weight-display","bs-accent"];function Ng(t){return t.startsWith("--")?t.slice(2):t}function yd(t,e,n){let i=Object.entries(t?.tokens??{}).find(([r])=>Ng(r)===e)?.[1]??jl[e];return i===void 0?null:Bl(i,n)}function kg(t){return[...$l({tokens:t?.tokens??{}})].sort()}function Rg(t,e){return $l({tokens:t?.tokens??{}}).has(Ng(e.trim()))}function As(t){return ah({motion:t?.motion})}function Ag(t){return Wm(t?.grain)}function Og(t){let e=t&&no.includes(t.kind)?t.kind:"none",n=t?.strength;return{kind:e,strength:typeof n=="number"&&Number.isFinite(n)?Math.min(1,Math.max(0,n)):.5}}function Pg(t){return Og(t?.backdrop)}function Lg(t,e){return Og(t?.backdrop??e?.backdrop)}function Fg(t){return typeof t=="string"||typeof t=="number"?String(t):JSON.stringify(t)}function vd(t){let e=t.trim();if(e.startsWith("{"))try{let n=JSON.parse(e);if(n&&typeof n=="object"&&!Array.isArray(n)&&"base"in n&&Object.values(n).every(o=>typeof o=="string"))return n}catch{}return e}function bd(t){let e=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t?.trim()??"");if(!e)return null;let n=e[1].toLowerCase();return`#${n.length===3?[...n].map(o=>o+o).join(""):n}`}function _d(t,e,n){let o=t.tokens?.[e];return o===void 0?null:Bl(o,n)}var hC=()=>["captions"],gC=(t,e)=>e.key;function yC(t,e){if(t&1&&(b(0,"option",7),u(1),v()),t&2){let n=e.$implicit,o=p(2);R("value",n)("selected",o.weight()===n),l(),M(n)}}function vC(t,e){if(t&1&&(b(0,"option",53),u(1),v()),t&2){let n=p();R("value",n),l(),M(n)}}function bC(t,e){if(t&1&&T(0,vC,2,2,"option",53),t&2){let n=p(2);D(n.weights.includes(e)?-1:0)}}function _C(t,e){if(t&1&&(b(0,"option",7),u(1),v()),t&2){let n=e.$implicit,o=p(),i=p();R("value",n)("selected",o.motion?.entrance===n),l(),M(i.entranceLabels[n])}}function EC(t,e){t&1&&(b(0,"p",22),u(1,"Grain makes the MP4 about 1 MB larger per second of video. GIFs leave it out."),v())}function xC(t,e){if(t&1&&(b(0,"option",7),u(1),v()),t&2){let n=e.$implicit,o=p(),i=p();R("value",n)("selected",o.backdrop?.kind===n),l(),M(i.backdropLabels[n])}}function CC(t,e){t&1&&(b(0,"p",28),u(1,"A slow background behind light scenes, running through cuts and transitions. Dark and accent scenes cover it."),v())}function IC(t,e){if(t&1){let n=j();b(0,"div",31)(1,"label",54),u(2),v(),b(3,"input",55),P("change",function(i){let r=I(n).$implicit,s=p(2);return S(s.onTokenValue(r.key,i))}),v(),b(4,"button",56),P("click",function(){let i=I(n).$implicit,r=p(2);return S(r.resetToken(i.key))}),u(5,"\u2715"),v()()}if(t&2){let n=e.$implicit;l(),R("htmlFor","look-token-"+n.key)("title",n.key),l(),M(n.key),l(),R("id","look-token-"+n.key)("value",n.text),l(),z("aria-label","Remove "+n.key+" (theme default)")}}function SC(t,e){if(t&1&&(b(0,"p",32),u(1),v()),t&2){let n=e.$implicit;l(),M(n.message)}}function wC(t,e){if(t&1&&ie(0,"option",38),t&2){let n=e.$implicit;R("value",n)}}function TC(t,e){t&1&&(b(0,"p",39),u(1),v()),t&2&&(l(),M(e))}function DC(t,e){if(t&1&&(b(0,"p",32),u(1),v()),t&2){let n=e.$implicit;l(),M(n.message)}}function MC(t,e){if(t&1){let n=j();b(0,"fieldset",0)(1,"legend"),u(2,"Look"),v(),b(3,"p",1),u(4,"Overrides of the theme for this video. \u201CTheme default\u201D removes the override."),v(),b(5,"div",2)(6,"div",3)(7,"label",4),u(8,"Display weight"),v(),b(9,"select",5),P("change",function(i){I(n);let r=p();return S(r.onWeight(i))}),b(10,"option",6),u(11),v(),L(12,yC,2,3,"option",7,pe),T(14,bC,1,1),v()(),b(15,"div",3)(16,"label",8),u(17,"Entrance style"),v(),b(18,"select",9),P("change",function(i){I(n);let r=p();return S(r.onEntrance(i))}),b(19,"option",6),u(20),v(),L(21,_C,2,3,"option",7,pe),v()()(),b(23,"div",3)(24,"label",10),u(25,"Accent colour"),v(),b(26,"span",11)(27,"input",12),P("input",function(i){I(n);let r=p();return S(r.onAccent(i))})("change",function(){I(n);let i=p();return S(i.store.endCoalescing())}),v(),b(28,"output",13),u(29),v(),b(30,"button",14),P("click",function(){I(n);let i=p();return S(i.resetToken("bs-accent"))}),u(31,"Theme default"),v()()(),b(32,"div",3)(33,"label",15),u(34,"Camera push"),v(),b(35,"span",16)(36,"input",17),P("input",function(i){I(n);let r=p();return S(r.onPush(i))})("change",function(){I(n);let i=p();return S(i.store.endCoalescing())}),v(),b(37,"output",18),u(38),v(),b(39,"button",14),P("click",function(){I(n);let i=p();return S(i.onResetPush())}),u(40,"Theme default"),v()()(),b(41,"div",3)(42,"label",19),u(43,"Film grain"),v(),b(44,"span",16)(45,"input",20),P("input",function(i){I(n);let r=p();return S(r.onGrain(i))})("change",function(){I(n);let i=p();return S(i.store.endCoalescing())}),v(),b(46,"output",21),u(47),v(),b(48,"button",14),P("click",function(){I(n);let i=p();return S(i.onResetGrain())}),u(49,"Theme default"),v()(),T(50,EC,2,0,"p",22),v(),b(51,"div",3)(52,"label",23),u(53,"Backdrop"),v(),b(54,"select",24),P("change",function(i){I(n);let r=p();return S(r.onBackdropKind(i))}),b(55,"option",6),u(56),v(),L(57,xC,2,3,"option",7,pe),v()(),b(59,"div",3)(60,"label",25),u(61,"Backdrop strength"),v(),b(62,"span",16)(63,"input",26),P("input",function(i){I(n);let r=p();return S(r.onBackdropStrength(i))})("change",function(){I(n);let i=p();return S(i.store.endCoalescing())}),v(),b(64,"output",27),u(65),v(),b(66,"button",14),P("click",function(){I(n);let i=p();return S(i.onResetBackdropStrength())}),u(67,"Default"),v()(),T(68,CC,2,0,"p",28),v(),b(69,"details",29)(70,"summary",30),u(71),v(),L(72,IC,6,6,"div",31,gC),L(74,SC,2,1,"p",32,oe),b(76,"div",33)(77,"input",34),P("input",function(i){I(n);let r=p();return S(r.newKey.set(r.text(i)))}),v(),b(78,"input",35),P("input",function(i){I(n);let r=p();return S(r.newValue.set(r.text(i)))})("keydown.enter",function(){I(n);let i=p();return S(i.onAddToken())}),v(),b(79,"button",36),P("click",function(){I(n);let i=p();return S(i.onAddToken())}),u(80,"Add"),v()(),b(81,"datalist",37),L(82,wC,1,1,"option",38,pe),v(),T(84,TC,2,1,"p",39),b(85,"p",40),u(86,"Any token the theme knows (the rule "),b(87,"code"),u(88,"check"),v(),u(89),v()()(),b(90,"fieldset",41)(91,"legend"),u(92,"Captions"),v(),b(93,"div",42)(94,"input",43),P("change",function(i){I(n);let r=p();return S(r.onCaptionsOn(i))}),v(),b(95,"label",44),u(96,"Burn in captions of the narration"),v()(),b(97,"div",2)(98,"div",3)(99,"label",45),u(100,"Style"),v(),b(101,"select",46),P("change",function(i){I(n);let r=p();return S(r.onCaptionStyle(i))}),b(102,"option",47),u(103,"Bar"),v(),b(104,"option",48),u(105,"Plain (shadow, no bar)"),v()()(),b(106,"div",3)(107,"label",49),u(108,"Position"),v(),b(109,"select",50),P("change",function(i){I(n);let r=p();return S(r.onCaptionPosition(i))}),b(110,"option",51),u(111,"Bottom"),v(),b(112,"option",52),u(113,"Top"),v()()()(),b(114,"p",40),u(115,"The narration, written, while it is spoken. A scene hides its own, or shows a written form, in its narration."),v(),L(116,DC,2,1,"p",32,oe),v()}if(t&2){let n,o,i=e,r=p();l(10),R("selected",r.weight()===null),l(),B("Theme default (",r.themeWeight(),")"),l(),F(r.weights),l(2),D((n=r.weight())?14:-1,n),l(5),R("selected",i.motion?.entrance===void 0),l(),B("Theme default (",r.themeMotion().entrance,")"),l(),F(r.entrances),l(6),R("value",r.accentHex()),l(),q("muted",r.accent()===null),l(),M(r.accent()??r.themeAccent()??"theme"),l(),R("disabled",r.accent()===null),l(6),R("max",r.pushMax)("value",r.push()),l(),q("muted",i.motion?.push===void 0),l(),M(r.label(r.push())),l(),R("disabled",i.motion?.push===void 0),l(6),R("max",r.grainMax)("value",r.grain()),l(),q("muted",i.grain===void 0),l(),M(r.label(r.grain())),l(),R("disabled",i.grain===void 0),l(2),D(r.grain()>0?50:-1),l(5),R("selected",i.backdrop===void 0),l(),B("Theme default (",r.backdropLabels[r.themeBackdrop().kind],")"),l(),F(r.backdrops),l(6),R("step",r.backdropStep)("value",r.backdrop().strength)("disabled",r.backdrop().kind==="none"),l(),q("muted",i.backdrop?.strength===void 0),l(),M(r.backdrop().kind==="none"?"off":r.label(r.backdrop().strength)),l(),R("disabled",i.backdrop?.strength===void 0),l(2),D(r.backdrop().kind!=="none"?68:-1),l(),R("open",r.advanced().length>0||r.tokenIssues().length>0),l(2),B("Advanced tokens",r.advanced().length?" ("+r.advanced().length+")":""),l(),F(r.advanced()),l(2),F(r.tokenIssues()),l(3),R("value",r.newKey()),l(),R("value",r.newValue()),l(),R("disabled",!r.canAdd()),l(3),F(r.tokenKeys()),l(2),D((o=r.newKeyError())?84:-1,o),l(5),B(" applies); a value, or per format as JSON: ",r.formatExample,"."),l(5),R("checked",!!i.captions),l(7),R("disabled",!i.captions),l(),R("selected",r.captionSettings().style==="bar"),l(2),R("selected",r.captionSettings().style==="plain"),l(5),R("disabled",!i.captions),l(),R("selected",r.captionSettings().position==="bottom"),l(2),R("selected",r.captionSettings().position==="top"),l(4),F(r.issues.under(Te(47,hC)))}}var NC=.1,kC=.05;function Ed(t){return t===0?"off":t.toFixed(2)}var Os=class t{store=w(J);issues=w(et);bridge=w(le);weights=Mg;entrances=Hl;entranceLabels={fade:"Fade",reveal:"Reveal",punch:"Punch",blur:"Blur",words:"Word by word"};pushMax=Ut;grainMax=NC;backdrops=no;backdropLabels={none:"None",aurora:"Aurora",grid:"Grid",dots:"Dots"};backdropStep=kC;label=Ed;formatExample='{"base": "600", "narrow": "500"}';theme=_(()=>this.bridge.project()?.theme);themeMotion=_(()=>As(this.theme()));themeWeight=_(()=>yd(this.theme(),"bs-weight-display",this.store.format())??"600");themeAccent=_(()=>yd(this.theme(),"bs-accent",this.store.format()));weight=_(()=>{let e=this.store.doc();return e?_d(e,"bs-weight-display",this.store.format()):null});accent=_(()=>{let e=this.store.doc();return e?_d(e,"bs-accent",this.store.format()):null});accentHex=_(()=>bd(this.accent())??bd(this.themeAccent())??"#000000");push=_(()=>this.store.doc()?.motion?.push??this.themeMotion().push);grain=_(()=>this.store.doc()?.grain??Ag(this.theme()));themeBackdrop=_(()=>Pg(this.theme()));backdrop=_(()=>Lg(this.store.doc(),this.theme()));advanced=_(()=>Object.entries(this.store.doc()?.tokens??{}).filter(([e])=>!gd.includes(e)).map(([e,n])=>({key:e,text:Fg(n)})));tokenKeys=_(()=>kg(this.theme()).filter(e=>!gd.includes(e)));tokenIssues=_(()=>this.issues.under(["tokens"]));newKey=A("");newValue=A("");newKeyError=_(()=>{let e=this.newKey().trim();return!e||Rg(this.theme(),e)?null:`Unknown token \u201C${e}\u201D: the theme has no such key (check would report it).`});canAdd=_(()=>this.newKey().trim()!==""&&this.newValue().trim()!==""&&this.newKeyError()===null);captionSettings=_(()=>{let e=this.store.doc()?.captions,n=e&&e!==!0?e:{};return{style:n.style??"bar",position:n.position??"bottom"}});edit(e,n){this.store.apply(e,n)}text(e){return e.target.value}onWeight(e){let n=e.target.value;this.edit(o=>ro(o,"bs-weight-display",n||void 0))}onAccent(e){let n=e.target.value;this.edit(o=>ro(o,"bs-accent",n),"look-accent")}resetToken(e){this.store.endCoalescing(),this.edit(n=>ro(n,e,void 0))}onEntrance(e){let n=e.target.value;this.edit(o=>hs(o,"entrance",n||void 0))}onPush(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.edit(o=>hs(o,"push",n),"look-push")}onResetPush(){this.store.endCoalescing(),this.edit(e=>hs(e,"push",void 0))}onGrain(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.edit(o=>Gl(o,n),"look-grain")}onResetGrain(){this.store.endCoalescing(),this.edit(e=>Gl(e,void 0))}onBackdropKind(e){let n=e.target.value;this.edit(o=>gs(o,n?{kind:n,strength:o.backdrop?.strength}:void 0))}onBackdropStrength(e){let n=e.target.valueAsNumber,o=this.backdrop().kind;Number.isFinite(n)&&o!=="none"&&this.edit(i=>gs(i,{kind:o,strength:n}),"look-backdrop-strength")}onResetBackdropStrength(){this.store.endCoalescing(),this.edit(e=>e.backdrop?gs(e,{kind:e.backdrop.kind}):e)}onTokenValue(e,n){let o=vd(this.text(n));this.edit(i=>ro(i,e,o))}onAddToken(){if(!this.canAdd())return;let e=this.newKey().trim(),n=vd(this.newValue());this.edit(o=>ro(o,e,n)),this.newKey.set(""),this.newValue.set("")}onCaptionsOn(e){let n=e.target.checked;this.edit(o=>ys(o,n?this.captionSettings():!1))}onCaptionStyle(e){let n=e.target.value;this.edit(o=>ys(o,x(y({},this.captionSettings()),{style:n})))}onCaptionPosition(e){let n=e.target.value;this.edit(o=>ys(o,x(y({},this.captionSettings()),{position:n})))}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-look-settings"]],decls:1,vars:1,consts:[[1,"sf-group","look"],[1,"sf-hint","look-intro"],[1,"grid-2"],[1,"sf-field"],["for","look-weight"],["id","look-weight",3,"change"],["value","",3,"selected"],[3,"value","selected"],["for","look-entrance"],["id","look-entrance",3,"change"],["for","look-accent"],[1,"sf-inline","look-row","look-accent"],["id","look-accent","type","color",3,"input","change","value"],["for","look-accent",1,"mono","small"],["type","button",1,"link","small","look-reset",3,"click","disabled"],["for","look-push"],[1,"sf-inline","look-row"],["id","look-push","type","range","min","0","step","0.01","title","Every scene's content scales from 1 to 1 + push over the scene; 0 is off",3,"input","change","max","value"],["for","look-push",1,"mono","small","look-readout"],["for","look-grain"],["id","look-grain","type","range","min","0","step","0.01",3,"input","change","max","value"],["for","look-grain",1,"mono","small","look-readout"],[1,"sf-hint","grain-note"],["for","look-backdrop"],["id","look-backdrop",3,"change"],["for","look-backdrop-strength"],["id","look-backdrop-strength","type","range","min","0","max","1",3,"input","change","step","value","disabled"],["for","look-backdrop-strength",1,"mono","small","look-readout"],[1,"sf-hint","backdrop-note"],[1,"look-advanced",3,"open"],[1,"small"],[1,"sf-inline","look-token"],["role","alert",1,"sf-issue"],[1,"sf-inline","look-token","look-token-add"],["id","look-token-new-key","type","text","list","look-token-keys","placeholder","bs-text-body","aria-label","Token",1,"mono",3,"input","value"],["id","look-token-new-value","type","text","placeholder","value","aria-label","Value",1,"mono",3,"input","keydown.enter","value"],["type","button",1,"ghost","look-token-add-btn",3,"click","disabled"],["id","look-token-keys"],[3,"value"],["role","alert",1,"sf-issue","look-token-error"],[1,"sf-hint"],[1,"sf-group","captions"],[1,"sf-field","sf-inline"],["id","captions-on","type","checkbox",3,"change","checked"],["for","captions-on"],["for","captions-style"],["id","captions-style",3,"change","disabled"],["value","bar",3,"selected"],["value","plain",3,"selected"],["for","captions-position"],["id","captions-position",3,"change","disabled"],["value","bottom",3,"selected"],["value","top",3,"selected"],["selected","",3,"value"],[1,"mono","small","look-token-key",3,"for","title"],["type","text",1,"mono",3,"change","id","value"],["type","button","title","Theme default",1,"icon","danger",3,"click"]],template:function(n,o){if(n&1&&T(0,MC,118,48),n&2){let i;D((i=o.store.doc())?0:-1,i)}},encapsulation:2})};var Vg=()=>[],xd=(t,e)=>e.id;function RC(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;q("warning",n.severity==="warning"),l(),M(n.message)}}function AC(t,e){if(t&1&&(h(0,"p",8),u(1),m()),t&2){let n=e.$implicit;l(),M(n)}}function OC(t,e){t&1&&(h(0,"p",49),u(1),m()),t&2&&(l(),M(e.message))}function PC(t,e){t&1&&(h(0,"p",50),u(1),m()),t&2&&(l(),M(e))}function LC(t,e){if(t&1){let n=j();h(0,"button",52),k("click",function(){I(n);let i=p(3);return S(i.lengthenToFit())}),u(1),m()}if(t&2){let n=e,o=p(2),i=p();N("title","Duration "+i.fmt(o.duration)+" \u2192 "+i.fmt(n)+", beats unchanged"+(i.bpm()?", the end on the next beat":"")+(i.readTimeNeed()?" (read time measured in "+i.readTimeNeed().issue.format+" only)":"")),l(),Jn(" Lengthen to fit (+",(n-o.duration).toFixed(1)," s",i.readTimeNeed()?" in "+i.readTimeNeed().issue.format:"","",i.bpm()?", on the beat":"",") ")}}function FC(t,e){if(t&1&&(h(0,"div",9),T(1,OC,2,1,"p",49),T(2,PC,2,1,"p",50),T(3,LC,2,4,"button",51),m()),t&2){let n,o,i,r=p(2);l(),D((n=r.readTime())?1:-1,n),l(),D((o=r.speechFit())?2:-1,o),l(),D((i=r.lengthenTo())?3:-1,i)}}function VC(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;q("warning",n.severity==="warning"),l(),M(n.message)}}function jC(t,e){if(t&1){let n=j();h(0,"button",53),k("click",function(){I(n);let i=p(2);return S(i.snapToBeat())}),u(1),m()}if(t&2){let n=e,o=p(),i=p();N("title","Ends "+i.offBy(n.off)+" s off the beat ("+i.bpm()+" bpm): duration "+i.fmt(o.duration)+" \u2192 "+i.fmt(n.suggested)+", the cut on the next beat"),l(),B(" \u2669 Snap to the beat (",i.fmt(n.suggested),") ")}}function $C(t,e){if(t&1&&(h(0,"option",20),u(1),m()),t&2){let n=p(),o=p();N("selected",!n.transitionIn),l(),M(o.defaultTransitionLabel())}}function BC(t,e){if(t&1&&(h(0,"option",21),u(1),m()),t&2){let n=e.$implicit,o=p(),i=p();N("value",n)("selected",o.transitionIn?.kind===n),l(),M(i.transitionLabel(n))}}function HC(t,e){if(t&1&&(h(0,"option",21),u(1),m()),t&2){let n=e.$implicit,o=p(2),i=p(2);N("value",n)("selected",i.transitionDirection(o)===n),l(),M(n)}}function UC(t,e){if(t&1){let n=j();h(0,"div",12)(1,"label",54),u(2,"Direction"),m(),h(3,"select",55),k("change",function(i){I(n);let r=p(3);return S(r.setTransitionDirection(i))}),L(4,HC,2,3,"option",21,pe),m()()}if(t&2){let n=p(3);l(3),N("disabled",n.index()===0),l(),F(n.directions)}}function GC(t,e){if(t&1&&T(0,UC,6,1,"div",12),t&2){let n=p(2);D(n.usesDirection(e.kind)?0:-1)}}function WC(t,e){t&1&&(h(0,"p",33),u(1,"The first scene always starts with a cut."),m())}function zC(t,e){if(t&1){let n=j();h(0,"div",56),k("focusout",function(){I(n);let i=p(2);return S(i.store.endCoalescing())}),h(1,"app-schema-field",57),k("edit",function(i){I(n);let r=p(2);return S(r.onPropEdit(i))}),m()()}if(t&2){let n=p(),o=p();l(),N("field",e)("value",n.props)("path",Te(4,Vg))("issues",o.propIssues())}}function qC(t,e){if(t&1&&(h(0,"p",1),u(1),m()),t&2){let n=p();l(),B("Waiting for the player to describe the scene type \u201C",n.type,"\u201D.")}}function KC(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function ZC(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function QC(t,e){t&1&&(h(0,"p",64),u(1,"Captions are off for this video (video settings \u2192 Captions)."),m())}function YC(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function JC(t,e){if(t&1){let n=j();h(0,"button",78),k("click",function(){I(n);let i=p(),r=p(3);return S(r.speech.toggle(i.key))}),u(1),m()}if(t&2){let n=p(),o=p(3);N("title",o.speech.playingKey()===n.key?"Stop":"Play the clip alone"),z("aria-label",o.speech.playingKey()===n.key?"Stop the clip":"Play the clip alone"),l(),M(o.speech.playingKey()===n.key?"\u25A0":"\u25B6")}}function XC(t,e){if(t&1){let n=j();h(0,"button",79),k("click",function(){I(n);let i=p(4);return S(i.generate())}),u(1,"Generate speech"),m()}if(t&2){let n=p(4);N("disabled",!n.canGenerate())("title",n.generateTitle())}}function eI(t,e){if(t&1){let n=j();h(0,"button",80),k("click",function(){I(n);let i=p(4);return S(i.store.select(null))}),u(1,"Pick a voice"),m()}}function tI(t,e){if(t&1&&T(0,JC,2,3,"button",75)(1,XC,2,2,"button",76)(2,eI,2,0,"button",77),t&2){let n=e;D(n.state==="ready"&&n.key?0:n.state==="missing"||n.state==="stale"?1:n.state==="unvoiced"?2:-1)}}function nI(t,e){if(t&1&&(h(0,"p",81),u(1),m()),t&2){let n=p(3);q("error",n.speech.currentJob()?.phase==="error"),l(),M(e)}}function oI(t,e){t&1&&(h(0,"p",48),u(1),m()),t&2&&(l(),M(e))}function iI(t,e){t&1&&(h(0,"p",33),u(1),m()),t&2&&(l(),M(e))}function rI(t,e){if(t&1){let n=j();h(0,"div",12)(1,"label",58),u(2,"Line"),m(),h(3,"textarea",59),k("input",function(i){I(n);let r=p(2);return S(r.setNarrationText(i))}),m(),h(4,"p",33),u(5),m(),L(6,KC,2,1,"p",48,oe),m(),h(8,"div",12)(9,"label",60),u(10,"Caption (written form)"),m(),h(11,"input",61),k("input",function(i){I(n);let r=p(2);return S(r.setNarrationCaption(i))}),m(),h(12,"p",33),u(13,"Shown in the captions instead of the line, e.g. \u201CACME, since 1998\u201D for \u201CA C M E, since nineteen ninety-eight\u201D. Not spoken."),m(),L(14,ZC,2,1,"p",48,oe),m(),h(16,"div",43)(17,"input",62),k("change",function(i){I(n);let r=p(2);return S(r.setCaptionHidden(i))}),m(),h(18,"label",63),u(19,"Hide caption for this scene"),m()(),T(20,QC,2,0,"p",64),h(21,"div",11)(22,"div",12)(23,"label",65),u(24,"Starts after (s)"),m(),h(25,"input",66),k("input",function(i){I(n);let r=p(2);return S(r.setNarrationOffset(i))}),m()(),h(26,"div",12)(27,"label",67),u(28,"Speed"),m(),h(29,"span",68)(30,"input",69),k("input",function(i){I(n);let r=p(2);return S(r.setNarrationSpeed(i))})("change",function(){I(n);let i=p(2);return S(i.store.endCoalescing())}),m(),h(31,"output",70),u(32),m()()()(),L(33,YC,2,1,"p",48,oe),h(35,"div",71)(36,"span",72),u(37),m(),T(38,tI,3,1),m(),T(39,nI,2,3,"p",73),T(40,oI,2,1,"p",48),T(41,iI,2,1,"p",33),h(42,"button",74),k("click",function(){I(n);let i=p(2);return S(i.onRemoveNarration())}),u(43,"Remove narration"),m()}if(t&2){let n,o,i,r,s=e,a=p(),c=p();l(3),N("value",s.text),l(2),M(c.wordsLabel(s.text)),l(),F(c.issuesAt("narration","text")),l(5),N("placeholder",s.text||"The line as the captions show it")("value",s.caption??""),l(3),F(c.issuesAt("narration","caption")),l(3),N("checked",a.captions===!1),l(3),D(c.captionsOn()?-1:20),l(5),N("value",s.offset??c.narrationOffset),l(5),N("min",c.speed.min)("max",c.speed.max)("value",s.speed??c.speed.default),l(2),B("\xD7",(s.speed??c.speed.default).toFixed(2)),l(),F(c.issuesAt("narration")),l(2),z("data-state",c.clip()?.state),l(2),M(c.clipLabel()),l(),D((n=c.clip())?38:-1,n),l(),D((o=c.jobLine())?39:-1,o),l(),D((i=c.speech.playError())?40:-1,i),l(),D((r=c.installHint())?41:-1,r)}}function sI(t,e){if(t&1){let n=j();h(0,"p",1),u(1,"A spoken line over this scene, in the video's voice."),m(),h(2,"button",82),k("click",function(){I(n);let i=p(2);return S(i.onAddNarration())}),u(3,"+ Add narration"),m()}}function aI(t,e){if(t&1){let n=j();h(0,"button",90),k("click",function(){I(n);let i=p().$implicit,r=p(3);return S(r.reset(i))}),u(1,"\u21BA"),m()}if(t&2){let n=p().$implicit;z("aria-label","Reset gap of "+(n.label||n.id)+" to the default")}}function cI(t,e){if(t&1){let n=j();h(0,"tr")(1,"td")(2,"span",86),u(3),m()(),h(4,"td")(5,"input",87),k("input",function(i){let r=I(n).$implicit,s=p(3);return S(s.setGap(r,i))})("blur",function(){I(n);let i=p(3);return S(i.store.endCoalescing())}),m()(),h(6,"td",88),u(7),m(),h(8,"td"),T(9,aI,2,1,"button",89),m()()}if(t&2){let n=e.$implicit,o=p(2),i=p();q("overridden",n.overridden)("late",n.offset>o.duration),l(2),N("title",n.id),l(),M(n.label||n.id),l(2),N("value",n.gap),z("aria-label","Gap before "+(n.label||n.id)+" in seconds"),l(2),M(i.fmt(n.offset)),l(2),D(n.overridden?9:-1)}}function lI(t,e){if(t&1&&(h(0,"table",40)(1,"thead")(2,"tr")(3,"th",83),u(4,"Beat"),m(),h(5,"th",83),u(6,"Gap (s)"),m(),h(7,"th",83),u(8,"At"),m(),h(9,"th",83)(10,"span",84),u(11,"Reset"),m()()()(),h(12,"tbody"),L(13,cI,10,10,"tr",85,xd),m()()),t&2){let n=p(2);l(13),F(n.beats())}}function dI(t,e){t&1&&(h(0,"p",1),u(1,"This scene has no beats."),m())}function uI(t,e){if(t&1&&(h(0,"option",21),u(1),m()),t&2){let n=e.$implicit,o=p().$implicit;N("value",n.id)("selected",n.id===o.sound),l(),M(n.title)}}function fI(t,e){if(t&1&&(h(0,"option",93),u(1),m()),t&2){let n=p().$implicit;N("value",n.sound),l(),B("",n.sound," (unknown)")}}function pI(t,e){if(t&1&&(h(0,"option",21),u(1),m()),t&2){let n=e.$implicit,o=p().$implicit;N("value","beat:"+n.id)("selected",o.at===n.id),l(),M(n.label||n.id)}}function mI(t,e){if(t&1&&(h(0,"option",94),u(1,"Scene end"),m()),t&2){let n=p().$implicit;N("selected",n.at==="end")}}function hI(t,e){if(t&1){let n=j();h(0,"div",12)(1,"label",91),u(2,"Seconds"),m(),h(3,"input",99),k("input",function(i){I(n);let r=p().$index,s=p(2);return S(s.patchNumber(r,"at",i))}),m()()}if(t&2){let n=p(),o=n.$implicit,i=n.$index;l(),N("for","sfx-sec-"+i),l(2),N("id","sfx-sec-"+i)("value",o.at)}}function gI(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function yI(t,e){if(t&1){let n=j();h(0,"div",46)(1,"div",12)(2,"label",91),u(3,"Sound"),m(),h(4,"select",92),k("change",function(i){let r=I(n).$index,s=p(2);return S(s.patchCue(r,{sound:s.selectValue(i)}))}),L(5,uI,2,3,"option",21,xd),T(7,fI,2,2,"option",93),m()(),h(8,"div",12)(9,"label",91),u(10,"At"),m(),h(11,"select",92),k("change",function(i){let r=I(n),s=r.$implicit,a=r.$index,c=p(2);return S(c.setCueAt(a,s,i))}),L(12,pI,2,3,"option",21,xd),T(14,mI,2,1,"option",94),h(15,"option",95),u(16,"Seconds\u2026"),m()()(),T(17,hI,4,3,"div",12),h(18,"div",12)(19,"label",91),u(20,"Offset (s)"),m(),h(21,"input",96),k("input",function(i){let r=I(n).$index,s=p(2);return S(s.patchNumber(r,"offset",i))}),m()(),h(22,"div",12)(23,"label",91),u(24,"Gain"),m(),h(25,"input",97),k("input",function(i){let r=I(n).$index,s=p(2);return S(s.patchNumber(r,"gain",i))}),m()(),h(26,"button",98),k("click",function(){let i=I(n).$index,r=p(2);return S(r.removeCue(i))}),u(27,"\u2715"),m(),L(28,gI,2,1,"p",48,oe),m()}if(t&2){let n=e.$implicit,o=e.$index,i=p(2);l(2),N("for","sfx-sound-"+o),l(2),N("id","sfx-sound-"+o),l(),F(i.sounds()),l(2),D(i.hasSound(n.sound)?-1:7),l(2),N("for","sfx-at-"+o),l(2),N("id","sfx-at-"+o),l(),F(i.beats()),l(2),D(i.hasEndBeat()?-1:14),l(),N("selected",typeof n.at=="number"),l(2),D(typeof n.at=="number"?17:-1),l(2),N("for","sfx-off-"+o),l(2),N("id","sfx-off-"+o)("value",n.offset??0),l(2),N("for","sfx-gain-"+o),l(2),N("id","sfx-gain-"+o)("value",n.gain??1),l(),z("aria-label","Remove sound "+(o+1)),l(2),F(i.issuesAt("sfx",o))}}function vI(t,e){if(t&1){let n=j();h(0,"header",0)(1,"div")(2,"h2"),u(3),m(),h(4,"p",1),u(5),m()(),h(6,"div",2)(7,"button",3),k("click",function(){I(n);let i=p();return S(i.move(-1))}),u(8,"\u2190"),m(),h(9,"button",4),k("click",function(){I(n);let i=p();return S(i.move(1))}),u(10,"\u2192"),m(),h(11,"button",5),k("click",function(){I(n);let i=p();return S(i.duplicate())}),u(12,"Duplicate"),m(),h(13,"button",6),k("click",function(){I(n);let i=p();return S(i.remove())}),u(14,"Delete"),m()()(),L(15,RC,2,3,"p",7,oe),L(17,AC,2,1,"p",8,oe),T(19,FC,4,3,"div",9),h(20,"section",10),k("focusout",function(){I(n);let i=p();return S(i.store.endCoalescing())}),h(21,"div",11)(22,"div",12)(23,"label",13),u(24,"Scene id"),m(),h(25,"input",14),k("change",function(i){I(n);let r=p();return S(r.rename(i))}),m()(),h(26,"div",12)(27,"label",15),u(28,"Duration (s)"),m(),h(29,"input",16),k("input",function(i){I(n);let r=p();return S(r.setDuration(i))}),m(),L(30,VC,2,3,"p",7,oe),T(32,jC,2,2,"button",17),m(),h(33,"div",12)(34,"label",18),u(35,"Transition in"),m(),h(36,"select",19),k("change",function(i){I(n);let r=p();return S(r.setTransitionKind(i))}),T(37,$C,2,2,"option",20),L(38,BC,2,3,"option",21,pe),m()(),T(40,GC,1,1),h(41,"div",12)(42,"label",22),u(43,"Transition (s)"),m(),h(44,"input",23),k("input",function(i){I(n);let r=p();return S(r.setTransitionDuration(i))}),m()(),h(45,"div",12)(46,"label",24),u(47,"Camera push"),m(),h(48,"select",25),k("change",function(i){I(n);let r=p();return S(r.setPushMode(i))}),h(49,"option",26),u(50),m(),h(51,"option",27),u(52,"Off"),m(),h(53,"option",28),u(54,"Custom"),m()()(),h(55,"div",12)(56,"label",29),u(57,"Push amount"),m(),h(58,"span",30)(59,"input",31),k("input",function(i){I(n);let r=p();return S(r.setPush(i))})("change",function(){I(n);let i=p();return S(i.store.endCoalescing())}),m(),h(60,"output",32),u(61),m()()()(),T(62,WC,2,0,"p",33),m(),h(63,"section",34)(64,"h3",35),u(65,"Content"),m(),T(66,zC,2,5,"div")(67,qC,2,1,"p",1),m(),h(68,"section",36),k("focusout",function(){I(n);let i=p();return S(i.store.endCoalescing())}),h(69,"h3",37),u(70,"Narration"),m(),T(71,rI,44,17)(72,sI,4,0),m(),h(73,"section",38)(74,"h3",39),u(75,"Beats"),m(),T(76,lI,15,0,"table",40)(77,dI,2,0,"p",1),m(),h(78,"section",41)(79,"h3",42),u(80,"Sounds"),m(),h(81,"div",43)(82,"input",44),k("change",function(i){I(n);let r=p();return S(r.setMute(i))}),m(),h(83,"label",45),u(84,"Mute the scene type's built-in sounds"),m()(),L(85,yI,30,15,"div",46,oe),h(87,"button",47),k("click",function(){I(n);let i=p();return S(i.addCue())}),u(88,"+ Add sound"),m()()}if(t&2){let n,o,i,r,s=e,a=p();l(3),M(a.typeInfo()?.title??s.type),l(2),M(a.typeInfo()?.description),l(2),N("disabled",a.index()===0),l(2),N("disabled",a.index()===a.sceneCount()-1),l(4),N("disabled",a.sceneCount()<=1),l(2),F(a.sceneIssues()),l(2),F(a.timelineWarnings()),l(2),D(a.readTime()||a.speechFit()?19:-1),l(6),N("value",s.id),l(4),N("value",s.duration),l(),F(a.durationIssues()),l(2),D((n=a.offBeat())?32:-1,n),l(4),N("disabled",a.index()===0),l(),D(a.transitions().themeDefault?37:-1),l(),F(a.transitions().kinds),l(2),D((o=s.transitionIn)?40:-1,o),l(4),N("disabled",!s.transitionIn||a.index()===0)("value",s.transitionIn?.duration??a.resolved()?.transitionIn?.duration??""),l(5),N("selected",s.push===void 0),l(),B("Video default (",a.pushLabel(a.inheritedPush()),")"),l(),N("selected",s.push===0),l(2),N("selected",!!s.push),l(6),N("max",a.pushMax)("disabled",!s.push)("value",s.push||a.customPush()),l(),q("muted",!s.push),l(),M(a.pushLabel(s.push??a.inheritedPush())),l(),D(a.index()===0?62:-1),l(4),D((i=a.form())?66:67,i),l(5),D((r=s.narration)?71:72,r),l(5),D(a.beats().length?76:77),l(6),N("checked",!!s.muteDefaultSfx),l(3),F(s.sfx??Te(30,Vg)),l(2),N("disabled",!a.sounds().length)}}function bI(t){return is.includes(t)}var Ps=class t{store=w(J);bridge=w(le);issues=w(et);beatGrid=w(Wt);speech=w(Xe);scene=this.store.selectedScene;narrationOffset=cs;speed=Ht;bpm=this.beatGrid.bpm;offBeat=_(()=>{let e=this.scene();return e?this.beatGrid.offBeat().get(e.id)??null:null});index=_(()=>{let e=this.store.doc(),n=this.scene();return e&&n?De(e,n.id):-1});sceneCount=_(()=>this.store.doc()?.scenes.length??0);typeInfo=_(()=>{let e=this.scene();return e?this.bridge.project()?.sceneTypes.find(n=>n.id===e.type)??null:null});variant=_(()=>this.scene()?.props?.variant);form=_(()=>{let e=this.typeInfo();return e?Sg(sg(e.jsonSchema),this.bridge.project()?.rules,{variant:this.variant()}):null});resolved=_(()=>{let e=this.scene();return e?this.bridge.timeline()?.scenes.find(n=>n.id===e.id)??null:null});timelineWarnings=_(()=>{let e=this.resolved();return e?this.issues.sceneWarnings(e):[]});beats=_(()=>this.resolved()?.beats??[]);hasEndBeat=_(()=>this.beats().some(e=>e.id==="end"));sounds=_(()=>this.bridge.project()?.theme.sounds??[]);defaultTransitionLabel=_(()=>{let e=this.bridge.project()?.theme.defaultTransition;return e?`Default: ${hd(e.kind)}${e.kind==="cut"&&!e.duration?"":` ${_I(e.duration)} s`}`:"Theme default"});directions=is;transitionLabel=hd;transitionDirection=Pm;usesDirection=rs;transitions=_(()=>{let e=this.bridge.project();return Tg(e?.rules,e?.theme.defaultTransition?.kind??"dip",this.scene()?.transitionIn?.kind)});scenePrefix=_(()=>["scenes",this.index()]);propIssues=_(()=>this.issues.under([...this.scenePrefix(),"props"]));sceneIssues=_(()=>this.issues.under(this.scenePrefix()).filter(e=>e.path.length===0||!["props","duration","sfx"].includes(String(e.path[0]))));readTime=_(()=>{let e=this.scene();return e?this.issues.readTimeOf(e.id):null});readTimeNeed=_(()=>{let e=this.readTime();return e&&e.issue.leaves===void 0?e:null});clip=_(()=>{let e=this.scene();return e?this.speech.of(e.id):null});speechFit=_(()=>{let e=this.clip(),n=this.scene();if(!n||e?.state!=="ready"||e.need===void 0||!this.issues.speechFitShown(n.id))return null;let o=e.tail??io,i=o>io?`the ${o} s tail: the video fades out over its last ${o} s`:`the ${o} s tail`;return`Narration runs to ${gi(e.need-o)} s, the scene ends at ${gi(n.duration)} s (it needs ${gi(e.need)} s with ${i})`});lengthenTo=_(()=>{let e=this.scene(),n=this.store.doc();if(!e||!n)return null;let o=Wl(n,e.id,this.fitNeed(),this.beatGrid.beat());return o===n?null:In(o,e.id)?.duration??null});durationIssues=_(()=>this.issues.at([...this.scenePrefix(),"duration"]).filter(e=>!this.issues.isReadTime(e)));lengthenToFit(){let e=this.scene();if(!e)return;let n=this.fitNeed(),o=this.beatGrid.beat();this.store.endCoalescing(),this.store.apply(i=>Wl(i,e.id,n,o)),this.store.endCoalescing()}fitNeed(){let e=this.readTimeNeed(),n=this.clip();return y(y({},e?{readMissing:e.issue.missing}:{}),n?.state==="ready"&&n.need!==void 0?{speech:n.need}:{})}clipLabel=_(()=>{let e=this.clip();if(!e)return"";switch(e.state){case"ready":return`Clip ready \xB7 ${gi(e.duration??0)} s`;case"stale":return"Stale: the line, voice, speed or voice processing changed since its clip was spoken";case"missing":return this.speech.status()===null&&!this.speech.statusError()?"Checking the clip\u2026":"Not spoken yet";case"empty":return"Write the line, then generate its speech";case"unvoiced":return"No voice for the narration"}});jobLine=_(()=>{let e=this.speech.currentJob(),n=this.scene();return!e||!n||e.scenes!==null&&!e.scenes.includes(n.id)?null:e.notice&&e.phase!=="error"?`${hi(e)} ${e.notice}`:hi(e)});canGenerate=_(()=>!this.speech.running()&&!this.speech.engineMissing());generateTitle=_(()=>this.speech.running()?"Speech is being generated":this.speech.engineMissing()?`The ${this.speech.engine()} engine is not installed`:"Saves, then speaks this line on the server (the first one loads the engine: about 15 s)");installHint=_(()=>{let e=this.speech.engine();return this.speech.engineMissing()&&e?`The ${e} engine is not installed: npm install @beatsheet/voice-${e} in the project, then restart beatsheet studio.`:null});wordsLabel(e){let n=fd(e),o=this.clip();return n?`${n===1?"1 word":`${n} words`}${o&&o.state!=="ready"?` \xB7 about ${gi(o.estimate)} s spoken`:""}`:"Short spoken sentences, one idea per scene; about 2.5 words per second."}onAddNarration(){this.store.endCoalescing(),this.apply(e=>n=>Nh(n,e.id))}onRemoveNarration(){this.speech.stop(),this.store.endCoalescing(),this.apply(e=>n=>kh(n,e.id))}setNarrationText(e){let n=e.target.value;this.apply(o=>i=>li(i,o.id,{text:n}),`narration-text:${this.scene()?.id}`)}setNarrationOffset(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&n>=0&&this.apply(o=>i=>li(i,o.id,{offset:n}),`narration-offset:${this.scene()?.id}`)}setNarrationCaption(e){let n=e.target.value;this.apply(o=>i=>li(i,o.id,{caption:n}),`narration-caption:${this.scene()?.id}`)}setCaptionHidden(e){let n=e.target.checked;this.apply(o=>i=>Sh(i,o.id,n))}pushMax=Ut;inheritedPush=_(()=>this.store.doc()?.motion?.push??As(this.bridge.project()?.theme).push);customPush=_(()=>this.inheritedPush()||.04);captionsOn=_(()=>!!this.store.doc()?.captions);pushLabel=Ed;setPushMode(e){let n=e.target.value,o=n==="off"?0:n==="custom"?this.customPush():void 0;this.store.endCoalescing(),this.apply(i=>r=>zl(r,i.id,o))}setPush(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.apply(o=>i=>zl(i,o.id,n),`push:${this.scene()?.id}`)}setNarrationSpeed(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.apply(o=>i=>li(i,o.id,{speed:n}),`narration-speed:${this.scene()?.id}`)}generate(){let e=this.scene();e&&this.speech.generate([e.id])}snapToBeat(){let e=this.scene(),n=this.beatGrid.beat();!e||n===void 0||(this.store.endCoalescing(),this.store.apply(o=>_s(o,e.id,n)),this.store.endCoalescing())}offBy(e){return String(Math.max(.01,Math.round(Math.abs(e)*100)/100))}issuesAt(...e){return this.issues.at([...this.scenePrefix(),...e])}fmt(e){return mi(e)}apply(e,n){let o=this.scene();o&&this.store.apply(e(o),n)}onPropEdit(e){this.apply(n=>o=>wh(o,n.id,e.path,e.value),e.coalesce?`prop:${this.scene()?.id}:${lh(e.path)}`:void 0)}rename(e){let n=e.target,o=this.scene(),i=this.store.doc();if(!o||!i)return;let r=Fh(i,o.id,n.value);if(r===i){n.value=o.id;return}let s=De(i,o.id);this.store.apply(()=>r),this.store.select(r.scenes[s].id)}setDuration(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&n>0&&this.apply(o=>i=>so(i,o.id,n),`duration:${this.scene()?.id}`)}setTransitionKind(e){let n=e.target.value;this.apply(o=>i=>{if(!Al(n))return ci(i,o.id,void 0);let r=o.transitionIn?.duration??this.resolved()?.transitionIn.duration??this.bridge.project()?.theme.defaultTransition?.duration,s=r===void 0||r<=0&&n!=="cut"?Dg(n):r;return ci(i,o.id,{kind:n,duration:s,direction:o.transitionIn?.direction})})}setTransitionDuration(e){let n=e.target.valueAsNumber,o=this.scene()?.transitionIn;!o||!Number.isFinite(n)||this.apply(i=>r=>ci(r,i.id,x(y({},o),{duration:n})),`transition:${this.scene()?.id}`)}setTransitionDirection(e){let n=e.target.value,o=this.scene()?.transitionIn;!o||!bI(n)||this.apply(i=>r=>ci(r,i.id,x(y({},o),{direction:n})))}setGap(e,n){let o=n.target.valueAsNumber;Number.isFinite(o)&&this.apply(i=>r=>ai(r,i.id,e.id,o),`beat:${this.scene()?.id}:${e.id}`)}reset(e){this.apply(n=>o=>Ih(o,n.id,e.id))}setMute(e){let n=e.target.checked;this.apply(o=>i=>Th(i,o.id,n))}hasSound(e){return this.sounds().some(n=>n.id===e)}selectValue(e){return e.target.value}patchCue(e,n){this.apply(o=>i=>ql(i,o.id,e,n))}setCueAt(e,n,o){let i=this.selectValue(o);if(i==="sec"){let r=this.beats().find(a=>a.id===n.at),s=n.at==="end"?this.scene()?.duration??0:0;this.patchCue(e,{at:r?r.offset:s})}else i==="end"?this.patchCue(e,{at:"end"}):this.patchCue(e,{at:i.slice(5)})}patchNumber(e,n,o){let i=o.target.valueAsNumber;Number.isFinite(i)&&this.apply(r=>s=>ql(s,r.id,e,{[n]:i}),`sfx:${this.scene()?.id}:${e}:${n}`)}addCue(){let e=this.sounds()[0]?.id;if(!e)return;let n=this.beats()[0]?.id;this.apply(o=>i=>Dh(i,o.id,{sound:e,at:n??0}))}removeCue(e){this.apply(n=>o=>Mh(o,n.id,e))}move(e){let n=this.index();this.store.apply(o=>Es(o,n,n+e))}duplicate(){let e=this.scene();if(!e)return;let n=null;this.store.apply(o=>{let i=Ph(o,e.id);return n=i.id,i.doc}),n&&this.store.select(n)}remove(){let e=this.scene();e&&this.store.deleteScene(e.id)}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-scene-inspector"]],decls:1,vars:1,consts:[[1,"insp-head"],[1,"muted","small"],[1,"insp-actions"],["type","button","aria-label","Move scene earlier","title","Move earlier",1,"icon",3,"click","disabled"],["type","button","aria-label","Move scene later","title","Move later",1,"icon",3,"click","disabled"],["type","button",3,"click"],["type","button",1,"danger",3,"click","disabled"],["role","alert",1,"sf-issue",3,"warning"],["role","status",1,"sf-issue","warning"],["role","status",1,"read-time"],["aria-label","Scene timing",1,"insp-section",3,"focusout"],[1,"grid-2"],[1,"sf-field"],["for","scene-id"],["id","scene-id","type","text",3,"change","value"],["for","scene-duration"],["id","scene-duration","type","number","min","0.1","step","0.05",3,"input","value"],["type","button",1,"link","small","snap-beat",3,"title"],["for","scene-transition"],["id","scene-transition",3,"change","disabled"],["value","",3,"selected"],[3,"value","selected"],["for","scene-transition-d"],["id","scene-transition-d","type","number","min","0","step","0.05",3,"input","disabled","value"],["for","scene-push-mode"],["id","scene-push-mode",3,"change"],["value","inherit",3,"selected"],["value","off",3,"selected"],["value","custom",3,"selected"],["for","scene-push"],[1,"sf-inline","scene-push"],["id","scene-push","type","range","min","0.01","step","0.01",3,"input","change","max","disabled","value"],["for","scene-push",1,"mono","small"],[1,"sf-hint"],["aria-labelledby","content-h",1,"insp-section"],["id","content-h"],["aria-labelledby","narration-h",1,"insp-section","narration",3,"focusout"],["id","narration-h"],["aria-labelledby","beats-h",1,"insp-section"],["id","beats-h"],[1,"beat-table"],["aria-labelledby","sfx-h",1,"insp-section"],["id","sfx-h"],[1,"sf-field","sf-inline"],["id","mute-default","type","checkbox",3,"change","checked"],["for","mute-default"],[1,"sfx-row"],["type","button",1,"ghost",3,"click","disabled"],["role","alert",1,"sf-issue"],[1,"sf-issue","warning"],[1,"sf-issue","warning","speech-fit"],["type","button",1,"read-time-fix",3,"title"],["type","button",1,"read-time-fix",3,"click","title"],["type","button",1,"link","small","snap-beat",3,"click","title"],["for","scene-transition-dir"],["id","scene-transition-dir",3,"change","disabled"],[3,"focusout"],[3,"edit","field","value","path","issues"],["for","narration-text"],["id","narration-text","rows","3","placeholder","What the voice says over this scene",3,"input","value"],["for","narration-caption"],["id","narration-caption","type","text",3,"input","placeholder","value"],["id","narration-caption-hidden","type","checkbox",3,"change","checked"],["for","narration-caption-hidden"],[1,"sf-hint","captions-off"],["for","narration-offset"],["id","narration-offset","type","number","min","0","step","0.05",3,"input","value"],["for","narration-speed"],[1,"sf-inline","narration-speed"],["id","narration-speed","type","range","step","0.05",3,"input","change","min","max","value"],["for","narration-speed",1,"mono","small"],["role","status",1,"speech-status"],[1,"speech-state"],[1,"sf-hint","speech-job",3,"error"],["type","button",1,"link","small","danger","narration-remove",3,"click"],["type","button",1,"icon","speech-play",3,"title"],["type","button",1,"speech-generate",3,"disabled","title"],["type","button",1,"link","small"],["type","button",1,"icon","speech-play",3,"click","title"],["type","button",1,"speech-generate",3,"click","disabled","title"],["type","button",1,"link","small",3,"click"],[1,"sf-hint","speech-job"],["type","button",1,"ghost","narration-add",3,"click"],["scope","col"],[1,"sr-only"],[3,"overridden","late"],[1,"beat-label",3,"title"],["type","number","min","0","step","0.05",3,"input","blur","value"],[1,"mono","small"],["type","button","title","Reset to default",1,"icon"],["type","button","title","Reset to default",1,"icon",3,"click"],[3,"for"],[3,"change","id"],["selected","",3,"value"],["value","end",3,"selected"],["value","sec",3,"selected"],["type","number","step","0.05",3,"input","id","value"],["type","number","min","0","max","2","step","0.05",3,"input","id","value"],["type","button","title","Remove",1,"icon","danger",3,"click"],["type","number","min","0","step","0.05",3,"input","id","value"]],template:function(n,o){if(n&1&&T(0,vI,89,31),n&2){let i;D((i=o.scene())?0:-1,i)}},dependencies:[Rs],encapsulation:2})};function gi(t){return String(Math.round(t*100)/100)}function _I(t){return String(Math.round(t*100)/100)}var zt={"16:9":{id:"16:9",width:1920,height:1080,slug:"16x9"},"4:5":{id:"4:5",width:1080,height:1350,slug:"4x5"},"1:1":{id:"1:1",width:1080,height:1080,slug:"1x1"},"9:16":{id:"9:16",width:1080,height:1920,slug:"9x16"}};function jg(t){let e=zt[t];if(!e)throw new Error(`Unknown format "${t}"`);return e}var EI=()=>["title"],xI=()=>["formats"],CI=()=>["music"],II=()=>["voice"],SI=()=>["voiceFx"],wI=()=>["poster"],Ls=(t,e)=>e.id,TI=(t,e)=>e.engine,DI=(t,e)=>e.value;function MI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function NI(t,e){if(t&1){let n=j();h(0,"span",9)(1,"input",40),k("change",function(i){let r=I(n).$implicit,s=p(2);return S(s.onFormat(r,i))}),m(),h(2,"label",41),u(3),h(4,"span",1),u(5),m()()()}if(t&2){let n=e.$implicit,o=p(),i=p();l(),N("id","fmt-"+n)("checked",o.formats.includes(n)),l(),N("for","fmt-"+n),l(),B("",n," "),l(2),M(i.sizes[n])}}function kI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function RI(t,e){if(t&1&&(h(0,"option",13),u(1,"No music"),m()),t&2){let n=p();N("selected",!n.music)}}function AI(t,e){if(t&1&&(h(0,"option",14),u(1),m()),t&2){let n=e.$implicit,o=p();N("value",n.id)("selected",o.music?.track===n.id),l(),M(n.title)}}function OI(t,e){if(t&1&&(h(0,"span",42),u(1),m()),t&2){let n=e;l(),B("",n===1?"1 scene ends":n+" scenes end"," off the beat.")}}function PI(t,e){t&1&&u(0," Every cut is on the beat. ")}function LI(t,e){if(t&1){let n=j();h(0,"div",17)(1,"p",24),u(2),T(3,OI,2,1,"span",42)(4,PI,1,0),m(),h(5,"button",43),k("click",function(){I(n);let i=p(2);return S(i.onSnapAll())}),u(6),m()()}if(t&2){let n,o=p(2);l(2),B(" \u2669 ",e," bpm: scene ends snap to the beat. "),l(),D((n=o.offBeatCount())?3:4,n),l(2),N("disabled",!o.beatGrid.snapAllChanges()),l(),B(" Snap all scenes to the beat",o.beatGrid.snapAllChanges()?" ("+o.changesLabel(o.beatGrid.snapAllChanges())+")":""," ")}}function FI(t,e){if(t&1){let n=j();h(0,"div",44)(1,"label",41),u(2),m(),h(3,"input",46),k("input",function(i){let r=I(n).$implicit,s=p(3);return S(s.onPartLevel(r.id,i))})("change",function(){I(n);let i=p(3);return S(i.store.endCoalescing())}),m(),h(4,"output",47),u(5),m()()}if(t&2){let n=e.$implicit,o=p(3);l(),N("for","mix-"+n.id),z("title",n.description??null),l(),M(n.title),l(),N("id","mix-"+n.id)("max",o.partMax)("value",n.level),z("title",n.description??null),l(),q("muted",n.level===1),z("for","mix-"+n.id),l(),M(n.label)}}function VI(t,e){if(t&1){let n=j();h(0,"fieldset",18)(1,"legend"),u(2,"Mix"),m(),L(3,FI,6,11,"div",44,Ls),h(5,"button",45),k("click",function(){I(n);let i=p(2);return S(i.onResetMix())}),u(6,"Reset mix"),m()()}if(t&2){let n=p(),o=p();l(3),F(o.mixParts()),l(2),N("disabled",!n.music?.mix)}}function jI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function $I(t,e){if(t&1&&(h(0,"option",48),u(1),m()),t&2){let n=e.$implicit,o=p(2);N("value",n.value)("disabled",n.disabled)("selected",o.voice===n.value),l(),M(n.label)}}function BI(t,e){if(t&1&&(h(0,"optgroup",22),L(1,$I,2,4,"option",48,DI),m()),t&2){let n=e.$implicit;N("label",n.label),l(),F(n.options)}}function HI(t,e){if(t&1&&(h(0,"option",23),u(1),m()),t&2){let n=e;N("value",n),l(),B("",n," (not available)")}}function UI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function GI(t,e){t&1&&(h(0,"p",24),u(1),m()),t&2&&(l(),M(e))}function WI(t,e){t&1&&(h(0,"p",25),u(1," No speech engine is installed. Kokoro ("),h(2,"code"),u(3,"@beatsheet/voice-kokoro"),m(),u(4,") is not on npm yet: it comes with a beatsheet checkout ("),h(5,"code"),u(6,"packages/voice-kokoro"),m(),u(7,"). Restart beatsheet studio after installing it. "),m())}function zI(t,e){if(t&1&&(h(0,"option",14),u(1),m()),t&2){let n=e.$implicit,o=p(),i=p();N("value",n)("selected",o.voiceFx===n),l(),M(i.fxLabels[n])}}function qI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function KI(t,e){if(t&1){let n=j();h(0,"div",3)(1,"label",49),u(2,"Music under speech (dB down)"),m(),h(3,"input",50),k("input",function(i){I(n);let r=p(2);return S(r.onDuck(i))}),m(),h(4,"p",24),u(5),m()()}if(t&2){let n=p(),o=p();l(3),N("max",o.duckMax)("value",n.music.duck??o.duckDefault),l(2),ke("How far the music drops while the narration speaks: 0 to ",o.duckMax," dB, default ",o.duckDefault,".")}}function ZI(t,e){if(t&1&&(h(0,"p",51),u(1),m()),t&2){let n=e,o=p(2);q("error",n.phase==="error"),l(),ke("",o.jobLabel(n),"",n.notice&&n.phase!=="error"?" "+n.notice:"")}}function QI(t,e){if(t&1&&(h(0,"option",14),u(1),m()),t&2){let n=e.$implicit,o=p();N("value",n.id)("selected",o.poster?.scene===n.id),l(),M(n.id)}}function YI(t,e){if(t&1&&(h(0,"option",14),u(1),m()),t&2){let n=e.$implicit,o=p();N("value",n.id)("selected",o.poster?.beat===n.id),l(),M(n.label||n.id)}}function JI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function XI(t,e){if(t&1){let n=j();h(0,"li")(1,"button",56),k("click",function(){let i=I(n).$implicit,r=p(3);return S(r.goTo(i.path))}),h(2,"span",57),u(3),m(),u(4),m()()}if(t&2){let n=e.$implicit;q("warning",n.severity==="warning"),l(3),M(n.path.join(".")||"video"),l(),B(" ",n.message," ")}}function eS(t,e){if(t&1&&(h(0,"p",55),u(1),m()),t&2){let n=p(3);l(),M(n.issues.silencedNote())}}function tS(t,e){if(t&1&&(h(0,"section",39)(1,"h3",52),u(2,"Problems"),m(),h(3,"ul",53),L(4,XI,5,4,"li",54,oe),m(),T(6,eS,2,1,"p",55),m()),t&2){let n=p(2);l(4),F(n.issues.all()),l(2),D(n.issues.silenced().count?6:-1)}}function nS(t,e){if(t&1){let n=j();h(0,"header",0)(1,"div")(2,"h2"),u(3,"Video settings"),m(),h(4,"p",1),u(5,"Select a scene in the timeline to edit it."),m()()(),h(6,"section",2),k("focusout",function(){I(n);let i=p();return S(i.store.endCoalescing())}),h(7,"div",3)(8,"label",4),u(9,"Title"),m(),h(10,"input",5),k("input",function(i){I(n);let r=p();return S(r.onTitle(i))}),m(),L(11,MI,2,1,"p",6,oe),m(),h(13,"fieldset",7)(14,"legend"),u(15,"Formats to render"),m(),h(16,"div",8),L(17,NI,6,5,"span",9,pe),m(),L(19,kI,2,1,"p",6,oe),m(),h(21,"div",10)(22,"div",3)(23,"label",11),u(24,"Music"),m(),h(25,"select",12),k("change",function(i){I(n);let r=p();return S(r.onMusic(i))}),T(26,RI,2,1,"option",13),L(27,AI,2,3,"option",14,Ls),m()(),h(29,"div",3)(30,"label",15),u(31,"Music gain"),m(),h(32,"input",16),k("input",function(i){I(n);let r=p();return S(r.onGain(i))}),m()()(),T(33,LI,7,4,"div",17),T(34,VI,7,1,"fieldset",18),L(35,jI,2,1,"p",6,oe),h(37,"fieldset",19)(38,"legend"),u(39,"Voice-over"),m(),h(40,"div",3)(41,"label",20),u(42,"Voice"),m(),h(43,"select",21),k("change",function(i){I(n);let r=p();return S(r.onVoice(i))}),h(44,"option",13),u(45),m(),L(46,BI,3,1,"optgroup",22,TI),T(48,HI,2,2,"option",23),m(),L(49,UI,2,1,"p",6,oe),T(51,GI,2,1,"p",24),T(52,WI,8,0,"p",25),m(),h(53,"div",3)(54,"label",26),u(55,"Voice processing"),m(),h(56,"select",27),k("change",function(i){I(n);let r=p();return S(r.onVoiceFx(i))}),h(57,"option",13),u(58),m(),L(59,zI,2,3,"option",14,pe),m(),h(61,"p",28),u(62," Raw (the default): the engine's voice, trimmed only. Studio: high-pass, de-esser, light compression and a short room. Changing it re-speaks the lines: their clips show as stale until speech is generated again. "),m(),L(63,qI,2,1,"p",6,oe),m(),T(65,KI,6,4,"div",3),h(66,"div",29)(67,"button",30),k("click",function(){I(n);let i=p();return S(i.speech.generate())}),u(68),m(),T(69,ZI,2,4,"p",31),m()(),lt(70,"app-look-settings"),h(71,"fieldset",7)(72,"legend"),u(73,"Poster frame"),m(),h(74,"p",24),u(75,"Thumbnail and frame 0 of the MP4. Default: last beat of the first scene."),m(),h(76,"div",32)(77,"div",3)(78,"label",33),u(79,"Scene"),m(),h(80,"select",34),k("change",function(i){I(n);let r=p();return S(r.onPosterScene(i))}),h(81,"option",13),u(82,"Default"),m(),L(83,QI,2,3,"option",14,Ls),m()(),h(85,"div",3)(86,"label",35),u(87,"Beat"),m(),h(88,"select",36),k("change",function(i){I(n);let r=p();return S(r.onPosterBeat(i))}),h(89,"option",13),u(90,"Last beat"),m(),L(91,YI,2,3,"option",14,Ls),m()(),h(93,"div",3)(94,"label",37),u(95,"Offset (s)"),m(),h(96,"input",38),k("input",function(i){I(n);let r=p();return S(r.onPosterOffset(i))}),m()()(),L(97,JI,2,1,"p",6,oe),m()(),T(99,tS,7,1,"section",39)}if(t&2){let n,o,i,r,s=e,a=p();l(10),N("value",s.title),l(),F(a.issues.at(Te(24,EI))),l(6),F(a.formatIds),l(2),F(a.issues.at(Te(25,xI))),l(7),D(a.music().noMusic?26:-1),l(),F(a.music().tracks),l(5),N("disabled",!s.music)("value",s.music?.gain??1),l(),D((n=a.beatGrid.bpm())?33:-1,n),l(),D(a.mixParts().length?34:-1),l(),F(a.issues.under(Te(26,CI))),l(9),N("selected",s.voice===void 0),l(),M(a.projectVoice()?"Project default ("+a.projectVoice()+")":"No voice"),l(),F(a.voiceGroups()),l(2),D((o=a.unlistedVoice())?48:-1,o),l(),F(a.issues.at(Te(27,II))),l(2),D((i=a.speech.statusError())?51:-1,i),l(),D(a.noEngine()?52:-1),l(5),N("selected",s.voiceFx===void 0),l(),B("Project default (",a.fxLabels[a.projectVoiceFx()],")"),l(),F(a.voiceFxs),l(4),F(a.issues.at(Te(28,SI))),l(2),D(s.music?65:-1),l(2),N("disabled",!a.canGenerateAll())("title",a.generateAllTitle()),l(),B(" Generate speech for all scenes",a.speech.toSpeak()?" ("+a.linesLabel(a.speech.toSpeak())+")":""," "),l(),D((r=a.speech.currentJob())?69:-1,r),l(12),N("selected",!s.poster),l(2),F(s.scenes),l(5),N("disabled",!s.poster),l(),N("selected",!s.poster?.beat),l(2),F(a.posterBeats()),l(5),N("disabled",!s.poster)("value",s.poster?.offset??.4),l(),F(a.issues.under(Te(29,wI))),l(2),D(a.issues.all().length||a.issues.silenced().count?99:-1)}}function oS(t){return t===0?"muted":`\xD7${t.toFixed(2)}`}function iS(t,e,n){return t.filter(o=>!o.hosted||e?.includes(o.id)).map(o=>{let i=e?.includes(o.id)??!1,r=i?n[o.id]??[]:[],s=r.length?r.map(a=>({value:`${o.id}:${a.id}`,label:`${a.title} \xB7 ${a.id} \xB7 ${a.language}`,disabled:!1})):[{value:`${o.id}:`,label:i?`${o.title}: no voices`:`${o.title}: not installed`,disabled:!0}];return{engine:o.id,label:o.title,options:s}})}var Fs=class t{store=w(J);issues=w(et);bridge=w(le);beatGrid=w(Wt);speech=w(Xe);formatIds=Object.keys(zt);sizes=Object.fromEntries(this.formatIds.map(e=>[e,`${zt[e].width}\xD7${zt[e].height}`]));music=_(()=>{let e=this.bridge.project();return wg(e?.theme.music??[],e?.rules,this.store.doc()?.music?.track)});partMax=ri;mixParts=_(()=>{let e=this.store.doc()?.music;return e?this.trackParts(e.track).map(o=>{let i=zm(e.mix,o.id);return x(y({},o),{level:i,label:oS(i)})}):[]});offBeatCount=_(()=>this.beatGrid.offBeat().size);posterBeats=_(()=>{let e=this.store.doc()?.poster?.scene;return e?this.bridge.timeline()?.scenes.find(n=>n.id===e)?.beats??[]:[]});duckMax=ds;duckDefault=ls;jobLabel=hi;projectVoice=_(()=>this.bridge.project()?.voice??null);voiceGroups=_(()=>{let e=this.speech.status();return iS(this.speech.engines(),this.speech.available(),e?.voices??{})});unlistedVoice=_(()=>{let e=this.store.doc()?.voice;return e===void 0||this.voiceGroups().some(n=>n.options.some(o=>o.value===e&&!o.disabled))?null:e});noEngine=_(()=>this.speech.available()?.length===0);canGenerateAll=_(()=>!this.speech.running()&&this.speech.toSpeak()>0&&!this.speech.engineMissing());generateAllTitle=_(()=>this.speech.running()?"Speech is being generated":this.speech.toSpeak()?this.speech.engineMissing()?`The ${this.speech.engine()} engine is not installed`:"Saves, then speaks every narrated scene without a clip on the server (the engine loads first: about 15 s)":"Every narrated scene has its clip");linesLabel(e){return e===1?"1 line":`${e} lines`}voiceFxs=Vl;fxLabels={raw:"Raw",studio:"Studio"};projectVoiceFx=_(()=>this.bridge.project()?.voiceFx??us);onVoiceFx(e){let n=e.target.value;this.store.apply(o=>Eh(o,n||void 0))}onVoice(e){let n=e.target.value;this.store.apply(o=>vh(o,n||void 0))}onDuck(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.store.apply(o=>bh(o,n),"music-duck")}onTitle(e){let n=e.target.value;this.store.apply(o=>fh(o,n),"title")}onFormat(e,n){let o=n.target;this.store.apply(i=>ph(i,e,o.checked)),o.checked=this.store.doc()?.formats.includes(e)??o.checked}onMusic(e){let n=e.target.value,o=this.trackParts(n).map(i=>i.id);this.store.apply(i=>mh(i,n||null,o))}onPartLevel(e,n){let o=n.target.valueAsNumber;Number.isFinite(o)&&this.store.apply(i=>hh(i,e,o),`music-mix:${e}`)}onResetMix(){this.store.apply(gh)}trackParts(e){let n=this.bridge.project()?.theme.music.find(o=>o.id===e);return n?.kind==="generated"?n.parts??[]:[]}onGain(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.store.apply(o=>yh(o,n),"music-gain")}onSnapAll(){let e=this.beatGrid.beat();e!==void 0&&(this.store.endCoalescing(),this.store.apply(n=>xh(n,e)),this.store.endCoalescing())}changesLabel(e){return e===1?"lengthens 1 scene":`lengthens ${e} scenes`}onPosterScene(e){let n=e.target.value;this.store.apply(o=>vs(o,n?{scene:n}:void 0))}onPosterBeat(e){let n=e.target.value;this.store.apply(o=>o.poster?vs(o,x(y({},o.poster),{beat:n||void 0})):o)}onPosterOffset(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.store.apply(o=>o.poster?vs(o,x(y({},o.poster),{offset:n})):o,"poster-offset")}goTo(e){if(e[0]==="scenes"&&e.length>1){let n=this.store.doc()?.scenes[Number(e[1])]?.id;n&&this.store.select(n)}}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-video-settings"]],decls:1,vars:1,consts:[[1,"insp-head"],[1,"muted","small"],[1,"insp-section",3,"focusout"],[1,"sf-field"],["for","video-title"],["id","video-title","type","text",3,"input","value"],["role","alert",1,"sf-issue"],[1,"sf-group"],[1,"format-checks"],[1,"sf-inline"],[1,"grid-2"],["for","music-track"],["id","music-track",3,"change"],["value","",3,"selected"],[3,"value","selected"],["for","music-gain"],["id","music-gain","type","number","min","0","max","2","step","0.05",3,"input","disabled","value"],[1,"beat-grid-row"],[1,"sf-group","music-mix"],[1,"sf-group","voice-over"],["for","video-voice"],["id","video-voice",3,"change"],[3,"label"],["selected","",3,"value"],[1,"sf-hint"],[1,"sf-hint","voice-install"],["for","video-voice-fx"],["id","video-voice-fx",3,"change"],[1,"sf-hint","voice-fx-hint"],[1,"speech-all"],["type","button",1,"ghost","speech-generate-all",3,"click","disabled","title"],[1,"sf-hint","speech-job",3,"error"],[1,"grid-3"],["for","poster-scene"],["id","poster-scene",3,"change"],["for","poster-beat"],["id","poster-beat",3,"change","disabled"],["for","poster-offset"],["id","poster-offset","type","number","step","0.05",3,"input","disabled","value"],["aria-labelledby","problems-h",1,"insp-section"],["type","checkbox",3,"change","id","checked"],[3,"for"],[1,"beat-grid-off"],["type","button","title","Lengthens each scene that ends off the beat to the next beat, as one undo step; never shortens a scene",1,"ghost","snap-all",3,"click","disabled"],[1,"sf-inline","mix-part"],["type","button",1,"link","small","mix-reset",3,"click","disabled"],["type","range","min","0","step","0.05",3,"input","change","id","max","value"],[1,"mono","small","mix-readout"],[3,"value","disabled","selected"],["for","music-duck"],["id","music-duck","type","number","min","0","step","1",3,"input","max","value"],[1,"sf-hint","speech-job"],["id","problems-h"],[1,"problem-list"],[3,"warning"],[1,"sf-hint","problems-silenced"],["type","button",1,"link",3,"click"],[1,"mono","small"]],template:function(n,o){if(n&1&&T(0,nS,100,30),n&2){let i;D((i=o.store.doc())?0:-1,i)}},dependencies:[Os],encapsulation:2})};function rS(t,e){if(t&1){let n=j();h(0,"button",0),k("click",function(){I(n);let i=p();return S(i.store.select(null))}),u(1,"\u2190 Video settings"),m(),lt(2,"app-scene-inspector")}}function sS(t,e){t&1&<(0,"app-video-settings")}var Vs=class t{store=w(J);static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-inspector"]],hostAttrs:["role","region","aria-label","Inspector",1,"inspector"],decls:2,vars:1,consts:[["type","button",1,"link","back",3,"click"]],template:function(n,o){n&1&&T(0,rS,3,0)(1,sS,1,0,"app-video-settings"),n&2&&D(o.store.selectedScene()?0:o.store.doc()?1:-1)},dependencies:[Ps,Fs],encapsulation:2})};var aS=["dialog"],cS=["frame"];function lS(t,e){t&1&&(b(0,"span",7),u(1),v()),t&2&&(l(),M(e))}var js=class t{picker=w(bt);store=w(J);dialog=Ue.required("dialog");frame=Ue.required("frame");notice=A(null);target=_(()=>tg(this.store.doc(),this.store.selectedSceneId()));started=!1;returnFocus=null;constructor(){let e=n=>this.onMessage(n);globalThis.addEventListener?.("message",e),w(ge).onDestroy(()=>globalThis.removeEventListener?.("message",e)),Cm(()=>{let n=this.picker.isOpen();Ye(()=>n?this.show():this.hide())})}show(){let e=this.dialog().nativeElement,n=this.frame().nativeElement;this.notice.set(null);let o=document.activeElement;this.returnFocus=o instanceof HTMLElement&&!e.contains(o)?o:null,e.open||(typeof e.showModal=="function"?e.showModal():e.setAttribute("open",""));let i=this.store.format();this.started?n.contentWindow?.postMessage(Qh(i),globalThis.location?.origin??"/"):(this.started=!0,n.src=Zh(i)),n.focus()}hide(){let e=this.dialog().nativeElement;if(this.started&&this.frame().nativeElement.contentWindow?.postMessage(Yh,globalThis.location?.origin??"/"),!e.open&&!e.hasAttribute("open"))return;typeof e.close=="function"&&e.close(),e.removeAttribute("open");let n=this.returnFocus;this.returnFocus=null,n?.isConnected&&n.focus()}onCancel(e){e.preventDefault(),e.stopPropagation(),this.picker.close()}onBackdrop(e){if(e.target!==this.dialog().nativeElement)return;let n=this.dialog().nativeElement.getBoundingClientRect();e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom||this.picker.close()}onMessage(e){if(!this.picker.isOpen()||e.source!==this.frame().nativeElement.contentWindow||e.origin!==globalThis.location?.origin)return;let n=Jh(e.data);if(!n)return;if(n.type==="pick-close"){this.picker.close();return}let o=this.picker.add(n);if(o){this.notice.set(o);return}this.picker.close()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-scene-picker"]],viewQuery:function(n,o){n&1&&Qe(o.dialog,aS,5)(o.frame,cS,5),n&2&&dt(2)},decls:15,vars:2,consts:[["dialog",""],["frame",""],["aria-labelledby","picker-h","aria-describedby","picker-where",1,"picker",3,"cancel","keydown.escape","click"],[1,"picker-head"],["id","picker-h"],["id","picker-where",1,"muted","small"],[1,"spacer"],["role","alert",1,"picker-notice"],[1,"muted","small","picker-keys"],["type","button","aria-label","Close the scene picker","title","Close (Esc)",1,"icon","picker-close",3,"click"],["title","Scene types: search, preview and pick one to add",1,"picker-frame"]],template:function(n,o){if(n&1&&(b(0,"dialog",2,0),P("cancel",function(r){return o.onCancel(r)})("keydown.escape",function(r){return o.onCancel(r)})("click",function(r){return o.onBackdrop(r)}),b(2,"header",3)(3,"h2",4),u(4,"Add scene"),v(),b(5,"span",5),u(6),v(),ie(7,"span",6),T(8,lS,2,1,"span",7),b(9,"span",8),u(10,"Enter or double-click adds \xB7 / search \xB7 Esc closes"),v(),b(11,"button",9),P("click",function(){return o.picker.close()}),u(12,"\xD7"),v()(),ie(13,"iframe",10,1),v()),n&2){let i;l(6),B("Goes in ",o.target()),l(2),D((i=o.notice())?8:-1,i)}},encapsulation:2})};var dS=["stage"],uS=["playerFrame"];function fS(t,e){t&1&&(b(0,"div",5),u(1,"Waiting for the player\u2026"),v())}function pS(t,e){t&1&&(b(0,"div",6),u(1),v()),t&2&&(l(),M(e))}var $s=class t{bridge=w(le);store=w(J);stageRef=Ue.required("stage");frameRef=Ue.required("playerFrame");box=A({width:0,height:0});size=_(()=>zt[this.store.format()]??zt["16:9"]);scale=_(()=>{let{width:e,height:n}=this.box(),o=this.size();return!e||!n?1e-4:Math.min(e/o.width,n/o.height)});fps=_(()=>this.bridge.timeline()?.fps??this.store.doc()?.fps??30);duration=_(()=>this.bridge.timeline()?.duration??0);timecode=_(()=>cd(this.bridge.time(),this.fps()));total=_(()=>cd(this.duration(),this.fps()));frameCount=_(()=>this.bridge.timeline()?.frameCount??1);frame=_(()=>ad(this.bridge.time(),this.fps(),this.frameCount()));lastFrame=_(()=>Math.max(0,this.frameCount()-1));currentScene=_(()=>{let e=this.bridge.time(),n=this.bridge.timeline()?.scenes??[],o=n.find(i=>e>=i.start&&e<i.end)??n.at(-1);return o?`${o.index+1}/${n.length} \xB7 ${o.id}`:""});constructor(){let e=w(ge);Bt(()=>{let n=this.frameRef().nativeElement,o=n.contentWindow;o&&this.bridge.attach(o,globalThis.location?.origin??"*");let i=Ye(()=>this.store.format());n.src=`/player/?mode=studio&format=${encodeURIComponent(i)}`;let r=this.stageRef().nativeElement,s=()=>this.box.set({width:r.clientWidth,height:r.clientHeight});s();let a=typeof ResizeObserver>"u"?null:new ResizeObserver(s);a?.observe(r),e.onDestroy(()=>{a?.disconnect(),this.bridge.detach()})})}step(e){this.bridge.playing()&&this.bridge.pause(),this.bridge.seek(Ns(this.bridge.time(),this.fps(),e,this.duration()))}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-preview"]],viewQuery:function(n,o){n&1&&Qe(o.stageRef,dS,5)(o.frameRef,uS,5),n&2&&dt(2)},hostAttrs:[1,"preview"],decls:23,vars:19,consts:[["stage",""],["playerFrame",""],[1,"stage"],[1,"stage-frame"],["title","Video preview","allow","autoplay","tabindex","-1"],["role","status",1,"stage-msg"],["role","alert",1,"stage-error"],["role","group","aria-label","Playback",1,"transport"],["type","button","aria-label","Previous frame","title","Previous frame (\u2190)",1,"icon",3,"click"],["type","button","title","Play/pause (Space)",1,"play",3,"click"],["type","button","aria-label","Next frame","title","Next frame (\u2192)",1,"icon",3,"click"],["aria-live","off",1,"timecode","mono"],[1,"muted"],[1,"frame-no","mono","muted"],[1,"spacer"],[1,"muted","small"]],template:function(n,o){if(n&1&&(b(0,"div",2,0)(2,"div",3),ie(3,"iframe",4,1),v(),T(5,fS,2,0,"div",5),T(6,pS,2,1,"div",6),v(),b(7,"div",7)(8,"button",8),P("click",function(){return o.step(-1)}),u(9,"\u23EE"),v(),b(10,"button",9),P("click",function(){return o.bridge.togglePlay()}),u(11),v(),b(12,"button",10),P("click",function(){return o.step(1)}),u(13,"\u23ED"),v(),b(14,"span",11),u(15),b(16,"span",12),u(17),v()(),b(18,"span",13),u(19),v(),ie(20,"span",14),b(21,"span",15),u(22),v()()),n&2){let i;l(2),ae("width",o.size().width*o.scale(),"px")("height",o.size().height*o.scale(),"px"),l(),ae("width",o.size().width,"px")("height",o.size().height,"px")("transform","scale("+o.scale()+")"),l(2),D(o.bridge.ready()?-1:5),l(),D((i=o.bridge.error())?6:-1,i),l(4),z("aria-label",o.bridge.playing()?"Pause":"Play"),l(),B(" ",o.bridge.playing()?"\u275A\u275A":"\u25B6"," "),l(4),B(" ",o.timecode()," "),l(2),B("/ ",o.total()),l(2),ke("frame ",o.frame()," / ",o.lastFrame()),l(3),M(o.currentScene())}},encapsulation:2})};var co={small:{title:"Small",fps:12,width:800},medium:{title:"Medium",fps:15,width:1080},large:{title:"Large",fps:20,width:1280}},yi=["small","medium","large"],Cd={fps:{min:5,max:30},width:{min:240,max:1920}},mS={fps:12,width:800,range:{kind:"all"},loop:"forever"};function Bg(t,e={}){let n=y(y({},mS),$g(t??{}));if(e.preset){let o=co[e.preset];o&&Object.assign(n,{fps:o.fps,width:o.width})}return y(y({},n),$g({fps:e.fps,width:e.width,range:e.range,loop:e.loop}))}function Hg(t){return yi.find(e=>co[e].fps===t.fps&&co[e].width===t.width)??null}function hS(t,e){let n=Math.min(Math.round(e),t.width);return{width:n,height:Math.max(1,Math.round(n*t.height/t.width))}}function Ug(t){let e=0,n=t.scenes.map(o=>{let i=e;return e+=o.duration,{id:o.id,start:i,end:e}});return{duration:e,scenes:n}}function Gg(t,e){let n=Kg(t,e);if(n)throw new Error(n);if(t.kind==="scene"){let o=e.scenes.find(i=>i.id===t.scene);return{from:o.start,to:o.end}}return t.kind==="time"?{from:t.from,to:Math.min(t.to,e.duration)}:{from:0,to:e.duration}}function Wg(t,e){let n=[];t.preset!==void 0&&!yi.includes(t.preset)&&n.push({field:"preset",message:`unknown GIF preset "${String(t.preset)}" (known: ${yi.join(", ")})`});for(let o of["fps","width"]){let i=t[o],{min:r,max:s}=Cd[o];i!==void 0&&!(Number.isInteger(i)&&i>=r&&i<=s)&&n.push({field:o,message:`GIF ${o} must be a whole number from ${r} to ${s}, got ${String(i)}`})}if(t.loop!==void 0&&t.loop!=="forever"&&t.loop!=="once"&&n.push({field:"loop",message:`GIF loop must be "forever" or "once", got "${String(t.loop)}"`}),t.range!==void 0){let o=qg(t.range)??(e?Kg(t.range,e):null);o&&n.push({field:"range",message:o})}return n}function zg(t,e,n){let{width:o,height:i}=hS(t,e.width);return Math.round(Math.max(1,Math.round(n*e.fps))*Math.sqrt(o*i)*gS)}var gS=3.5;function qg(t){if(typeof t!="object"||t===null)return'GIF range must be an object with kind "all", "scene" or "time"';let e=t;return e.kind==="all"?null:e.kind==="scene"?typeof e.scene=="string"&&e.scene?null:'GIF range "scene" needs a scene id':e.kind==="time"?typeof e.from!="number"||typeof e.to!="number"||!Number.isFinite(e.from)||!Number.isFinite(e.to)?'GIF range "time" needs numbers from and to (seconds)':e.from<0?`GIF range starts before the video (from ${e.from}s)`:e.from>=e.to?`GIF range must end after it starts (from ${e.from}s, to ${e.to}s)`:null:'GIF range kind must be "all", "scene" or "time"'}var yS=.005;function Kg(t,e){let n=qg(t);return n||(t.kind==="scene"&&!e.scenes.some(o=>o.id===t.scene)?`GIF range scene "${t.scene}" does not exist (scenes: ${e.scenes.map(o=>o.id).join(", ")||"none"})`:t.kind==="time"&&t.to>e.duration+yS?`GIF range ends after the video (to ${t.to}s, the video is ${vS(e.duration)}s)`:null)}function vS(t){return Math.round(t*100)/100}function $g(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function Qg(t,e){if(e.type==="error")return t;let n="format"in e?e.format:void 0;if(!n)return t;let o=t.find(r=>r.format===n)??{format:n,phase:"queued",media:"mp4",frame:0,total:0},i;switch(e.type){case"phase":{let r=e.phase==="done"?o.media:e.media??"mp4",s=r!==o.media;i=y(x(y({},o),{phase:e.phase,media:r}),s?{frame:0,total:0}:{});break}case"progress":i=x(y({},o),{phase:"frames",media:e.media??"mp4",frame:e.frame,total:e.total});break;case"output":i=y(x(y({},o),{video:e.video,poster:e.poster}),e.bytes!==void 0?{videoBytes:e.bytes}:{});break;case"gif-output":i=x(y({},o),{gif:{path:e.gif,bytes:e.bytes,width:e.width,height:e.height,frames:e.frames}});break}return t.some(r=>r.format===n)?t.map(r=>r.format===n?i:r):[...t,i]}var xt=class t{api=w(Gt);store=w(J);jobs=A({});all=this.jobs.asReadonly();streams=new Map;current=_(()=>{let e=this.store.file();return e?this.jobs()[e]??null:null});jobFor(e){return this.jobs()[e]??null}async start(e,n){let o=this.store.file();if(!o||this.jobFor(o)?.status==="running")return;let i=n?[...n.mp4?["mp4"]:[],...n.gif?["gif"]:[]]:["mp4"];if(this.set(o,{file:o,jobId:null,formats:e,media:i,status:"running",progress:[],phase:"Saving\u2026",error:null,notice:null}),!await this.store.save()){this.patch(o,{status:"error",phase:null,error:`Save failed: ${this.store.saveError()??"unknown error"}. Fix the problems and try again.`});return}try{let{jobId:r,existing:s}=await this.api.startRender(o,e,n);if(s){let a=(await this.api.listRenderJobs().catch(()=>[])).find(c=>c.jobId===r);this.patch(o,{jobId:r,formats:a?.formats??e,media:a?.media??i,phase:"Already rendering",notice:"A render of this video was already running, so no second one was started. Showing its progress."})}else this.patch(o,{jobId:r,phase:"Started"});this.listen(o,r)}catch(r){this.patch(o,{status:"error",phase:null,error:`Could not start the render: ${bS(r)}`})}}async sync(e){if(!e||this.streams.has(e)||this.jobFor(e)?.status==="running")return;let n;try{n=(await this.api.listRenderJobs()).find(o=>o.file===e&&o.state==="running")}catch{return}!n||this.streams.has(e)||this.jobFor(e)?.status==="running"||(this.set(e,{file:e,jobId:n.jobId,formats:n.formats,media:n.media??["mp4"],status:"running",progress:[],phase:"Rendering",error:null,notice:"A render of this video is running; following its progress."}),this.listen(e,n.jobId))}disconnectAll(){for(let e of this.streams.values())e.close();this.streams.clear()}listen(e,n){this.streams.get(e)?.close();let o=this.api.renderEvents(n,i=>this.onEvent(e,n,i),()=>{this.onClosed(e,n)});this.streams.set(e,{jobId:n,close:o})}stopListening(e){this.streams.get(e)?.close(),this.streams.delete(e)}onEvent(e,n,o){let i=this.jobFor(e);if(!i||i.jobId!==n)return;let r=Qg(i.progress,o);if(o.type==="error")this.patch(e,{progress:r,status:"error",error:o.message}),this.stopListening(e);else if(o.type==="phase"){let s=o.phase==="done"&&(!o.format||Zg(i.formats,r));this.patch(e,{progress:r,phase:s?"Done":o.format?`${o.format}: ${o.phase}`:o.phase,status:s?"done":i.status}),s&&this.stopListening(e)}else this.patch(e,{progress:r})}async onClosed(e,n){this.streams.get(e)?.jobId===n&&this.streams.delete(e);let o=this.jobFor(e);if(!o||o.jobId!==n||o.status!=="running")return;if(Zg(o.formats,o.progress)){this.patch(e,{status:"done",phase:"Done"});return}let i=await this.api.listRenderJobs().then(r=>r.find(s=>s.jobId===n)?.state).catch(()=>{});this.jobFor(e)?.jobId!==n||this.jobFor(e)?.status!=="running"||(i==="done"?this.patch(e,{status:"done",phase:"Done"}):i==="running"?this.patch(e,{status:"error",error:"Lost the progress stream; the render is still running. Reopen this dialog to follow it again."}):this.patch(e,{status:"error",error:"The progress stream closed before the render finished."}))}set(e,n){this.jobs.update(o=>x(y({},o),{[e]:n}))}patch(e,n){this.jobs.update(o=>o[e]?x(y({},o),{[e]:y(y({},o[e]),n)}):o)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};function Zg(t,e){return t.length>0&&t.every(n=>e.some(o=>o.format===n&&o.phase==="done"))}function bS(t){return t instanceof Error?t.message:String(t)}var _S=["dialog"],ES=(t,e)=>e.field,xS=(t,e)=>e.format;function CS(t,e){if(t&1){let n=j();b(0,"label",5)(1,"input",16),P("change",function(i){let r=I(n).$implicit,s=p();return S(s.toggle(r,i))}),v(),b(2,"span"),u(3),v()()}if(t&2){let n=e.$implicit,o=p();l(),R("value",n)("checked",o.shownFormats().includes(n)),l(2),M(n)}}function IS(t,e){if(t&1&&(b(0,"option",20),u(1),v()),t&2){let n=e.$implicit,o=p(2);R("value",n)("selected",o.preset()===n),l(),Jn("",o.presets[n].title," \xB7 ",o.presets[n].fps," fps \xB7 ",o.presets[n].width," px")}}function SS(t,e){t&1&&(b(0,"option",31),u(1,"Choose a scene"),v())}function wS(t,e){if(t&1&&(b(0,"option",20),u(1),v()),t&2){let n=e.$implicit,o=p(2);R("value",n)("selected",o.rangeScene()===n),l(),M(n)}}function TS(t,e){t&1&&(b(0,"p",35),u(1),v()),t&2&&(l(),M(e))}function DS(t,e){if(t&1&&(b(0,"p",12),u(1),v()),t&2){let n=e.$implicit;l(),M(n.message)}}function MS(t,e){t&1&&(b(0,"p",37),u(1),v()),t&2&&(l(),M(e))}function NS(t,e){if(t&1){let n=j();b(0,"fieldset",8)(1,"legend"),u(2,"GIF (no sound)"),v(),b(3,"div",17)(4,"label",18),u(5,"Preset"),v(),b(6,"select",19),P("change",function(i){I(n);let r=p();return S(r.setPreset(r.value(i)))}),L(7,IS,2,5,"option",20,pe),b(9,"option",21),u(10,"Custom"),v()()(),b(11,"div",22)(12,"div",17)(13,"label",23),u(14,"Frame rate (fps)"),v(),b(15,"input",24),P("change",function(i){I(n);let r=p();return S(r.setNumber("fps",i))}),v()(),b(16,"div",17)(17,"label",25),u(18,"Width (px)"),v(),b(19,"input",26),P("change",function(i){I(n);let r=p();return S(r.setNumber("width",i))}),v()()(),b(20,"div",27)(21,"label",5)(22,"input",28),P("change",function(){I(n);let i=p();return S(i.setRangeKind("all"))}),v(),b(23,"span"),u(24,"Whole video"),v()(),b(25,"label",5)(26,"input",29),P("change",function(){I(n);let i=p();return S(i.setRangeKind("scene"))}),v(),b(27,"span"),u(28,"Scene"),v(),b(29,"select",30),P("change",function(i){I(n);let r=p();return S(r.setScene(r.value(i)))}),T(30,SS,2,0,"option",31),L(31,wS,2,3,"option",20,pe),v()(),b(33,"label",5)(34,"input",32),P("change",function(){I(n);let i=p();return S(i.setRangeKind("time"))}),v(),b(35,"span"),u(36,"From"),v(),b(37,"input",33),P("change",function(i){I(n);let r=p();return S(r.setTime("from",i))}),v(),b(38,"span"),u(39,"to"),v(),b(40,"input",34),P("change",function(i){I(n);let r=p();return S(r.setTime("to",i))}),v(),b(41,"span"),u(42,"s"),v()(),T(43,TS,2,1,"p",35),v(),b(44,"label",5)(45,"input",36),P("change",function(i){I(n);let r=p();return S(r.setLoop(r.checked(i)))}),v(),b(46,"span"),u(47,"Loop forever"),v()(),L(48,DS,2,1,"p",12,ES),T(50,MS,2,1,"p",37),v()}if(t&2){let n,o,i=p();R("disabled",i.status()==="running"),l(7),F(i.presetIds),l(2),R("selected",i.preset()==="custom"),l(3),q("has-error",i.issueFor("fps")),l(3),R("min",i.limits.fps.min)("max",i.limits.fps.max)("value",i.gif().fps),l(),q("has-error",i.issueFor("width")),l(3),R("min",i.limits.width.min)("max",i.limits.width.max)("value",i.gif().width),l(),q("has-error",i.issueFor("range")),l(2),R("checked",i.gif().range.kind==="all"),l(4),R("checked",i.gif().range.kind==="scene"),l(3),R("disabled",i.gif().range.kind!=="scene"),l(),D(i.rangeScene()!==null&&!i.sceneIds().includes(i.rangeScene())?30:-1),l(),F(i.sceneIds()),l(3),R("checked",i.gif().range.kind==="time"),l(3),R("disabled",i.gif().range.kind!=="time")("value",i.rangeTime().from),l(3),R("disabled",i.gif().range.kind!=="time")("value",i.rangeTime().to),l(3),D((n=i.rangeNote())?43:-1,n),l(2),R("checked",i.gif().loop==="forever"),l(3),F(i.gifIssues()),l(2),D((o=i.sizeHint())?50:-1,o)}}function kS(t,e){t&1&&u(0,"GIF ")}function RS(t,e){if(t&1&&u(0),t&2){let n=p().$implicit;ke(" \xB7 ",n.frame,"/",n.total)}}function AS(t,e){if(t&1&&u(0),t&2){let n=p(2).$implicit,o=p(2);B(" \xB7 ",o.size(n.videoBytes))}}function OS(t,e){if(t&1&&(b(0,"p",40),u(1),T(2,AS,1,1),v(),b(3,"p",41),u(4),v()),t&2){let n=p().$implicit;l(),M(n.video),l(),D(n.videoBytes!==void 0?2:-1),l(2),M(n.poster)}}function PS(t,e){if(t&1&&(b(0,"p",40),u(1),v()),t&2){let n=e,o=p(3);l(),Kr("",n.path," \xB7 ",o.size(n.bytes)," \xB7 ",n.width,"x",n.height," \xB7 ",n.frames," frames")}}function LS(t,e){if(t&1&&(b(0,"li")(1,"div",38)(2,"strong"),u(3),v(),b(4,"span",10),T(5,kS,1,0),u(6),T(7,RS,1,2),v()(),ie(8,"progress",39),T(9,OS,5,3),T(10,PS,2,5,"p",40),v()),t&2){let n,o=e.$implicit;l(3),M(o.format),l(2),D(o.media==="gif"&&o.phase!=="done"?5:-1),l(),M(o.phase),l(),D(o.total?7:-1),l(),R("value",o.total?o.frame:0)("max",o.total||1),z("aria-label","Progress "+o.format),l(),D(o.video?9:-1),l(),D((n=o.gif)?10:-1,n)}}function FS(t,e){if(t&1&&(b(0,"ul",9),L(1,LS,11,9,"li",null,xS),v()),t&2){let n=p();l(),F(n.progress())}}function VS(t,e){t&1&&(b(0,"p",10),u(1),v()),t&2&&(l(),M(e))}function jS(t,e){if(t&1&&(b(0,"p",11),u(1),v()),t&2){let n=p();l(),M(n.phase())}}function $S(t,e){if(t&1&&(b(0,"p",12),u(1),v()),t&2){let n=p();l(),M(n.error())}}var Bs=class t{jobs=w(xt);store=w(J);dialogRef=Ue.required("dialog");closed=eo();job=this.jobs.current;available=this.store.doc()?.formats.length?this.store.doc().formats:["16:9"];chosen=A(this.initialChoice());shownFormats=_(()=>{let e=this.job();return e?.status==="running"?e.formats:this.chosen()});status=_(()=>this.job()?.status??"idle");presets=co;presetIds=yi;limits=Cd;mp4=A(this.store.doc()?.export?.mp4!==!1);gifOn=A(this.store.doc()?.export?.gif!==void 0);stored=this.storedGif();gif=A(this.stored.settings);rangeNote=A(this.stored.note);preset=_(()=>Hg(this.gif())??"custom");shownMp4=_(()=>{let e=this.job();return e?.status==="running"?e.media.includes("mp4"):this.mp4()});shownGif=_(()=>{let e=this.job();return e?.status==="running"?e.media.includes("gif"):this.gifOn()});sceneIds=_(()=>this.store.doc()?.scenes.map(e=>e.id)??[]);rangeScene=_(()=>{let e=this.gif().range;return e.kind==="scene"?e.scene:null});rangeTime=_(()=>{let e=this.gif().range;return e.kind==="time"?{from:e.from,to:e.to}:{from:0,to:BS(this.spans().duration)}});gifIssues=_(()=>this.gifOn()?Wg(this.gif(),this.spans()):[]);sizeHint=_(()=>{if(this.gifIssues().length)return null;let{from:e,to:n}=Gg(this.gif().range,this.spans()),o=this.available.filter(i=>this.chosen().includes(i)).map(i=>`${Yg(zg(jg(i),this.gif(),n-e))} (${i})`);return o.length?`\u2248 ${o.join(" \xB7 ")}, a rough estimate`:null});canStart=_(()=>this.chosen().length>0&&(this.mp4()||this.gifOn())&&this.gifIssues().length===0);spans=_(()=>Ug(this.store.doc()??{scenes:[]}));progress=_(()=>this.job()?.progress??[]);phase=_(()=>this.job()?.phase??null);error=_(()=>this.job()?.error??null);constructor(){Bt(()=>this.dialogRef().nativeElement.focus()),this.jobs.sync(this.store.file())}storedGif(){let e=this.store.doc(),n=Bg(e?.export?.gif),o=n.range;return o.kind!=="scene"||e?.scenes.some(i=>i.id===o.scene)?{settings:n,note:null}:{settings:x(y({},n),{range:{kind:"all"}}),note:`The saved GIF scene \u201C${o.scene}\u201D is no longer in the video: whole video instead.`}}initialChoice(){let e=this.jobs.current(),n=e?.status==="running"?this.available.filter(o=>e.formats.includes(o)):[];return n.length?n:[...this.available]}toggle(e,n){let o=n.target.checked;this.chosen.update(i=>o?[...i.filter(r=>r!==e),e]:i.filter(r=>r!==e))}start(){let e=this.available.filter(i=>this.chosen().includes(i)),n={mp4:this.mp4()},o=this.gifOn()?structuredClone(this.gif()):null;return o&&(n.gif=o),this.store.setExport(jh(this.store.doc()?.export,o,this.mp4())),this.jobs.start(e,n)}checked(e){return e.target.checked}value(e){return e.target.value}issueFor(e){return this.gifIssues().some(n=>n.field===e)}setPreset(e){let n=co[e];n&&this.gif.update(o=>x(y({},o),{fps:n.fps,width:n.width}))}setNumber(e,n){let o=Number(this.value(n));this.gif.update(i=>x(y({},i),{[e]:o}))}setRangeKind(e){let n=this.sceneIds(),o=[this.rangeScene(),this.store.selectedSceneId(),n[0]].find(r=>r!=null&&n.includes(r))??"";this.rangeNote.set(null);let i=e==="scene"?{kind:e,scene:o}:e==="time"?y({kind:e},this.rangeTime()):{kind:e};this.gif.update(r=>x(y({},r),{range:i}))}setScene(e){this.gif.update(n=>x(y({},n),{range:{kind:"scene",scene:e}}))}setTime(e,n){let o=Number(this.value(n));this.gif.update(i=>x(y({},i),{range:x(y({kind:"time"},this.rangeTime()),{[e]:o})}))}setLoop(e){this.gif.update(n=>x(y({},n),{loop:e?"forever":"once"}))}size(e){return Yg(e)}onBackdrop(e){e.target===e.currentTarget&&this.status()!=="running"&&this.close()}close(){this.closed.emit()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-render-dialog"]],viewQuery:function(n,o){n&1&&Qe(o.dialogRef,_S,5),n&2&&dt()},hostAttrs:[1,"modal-backdrop"],hostBindings:function(n,o){n&1&&k("click",function(r){return o.onBackdrop(r)})("keydown.escape",function(){return o.close()})},outputs:{closed:"closed"},decls:32,vars:12,consts:[["dialog",""],["role","dialog","aria-modal","true","aria-labelledby","render-h","tabindex","-1",1,"modal"],["id","render-h"],[1,"sf-group",3,"disabled"],[1,"format-checks"],[1,"sf-inline"],["type","checkbox","name","render-media","value","mp4",3,"change","checked"],["type","checkbox","name","render-media","value","gif",3,"change","checked"],[1,"sf-group","gif-settings",3,"disabled"],[1,"render-progress"],[1,"muted","small"],["role","status",1,"muted","small"],["role","alert",1,"sf-issue"],[1,"modal-actions"],["type","button",3,"click"],["type","button",1,"primary",3,"click","disabled"],["type","checkbox","name","render-format",3,"change","value","checked"],[1,"sf-field"],["for","gif-preset"],["id","gif-preset",3,"change"],[3,"value","selected"],["value","custom","disabled","",3,"selected"],[1,"grid-2"],["for","gif-fps"],["id","gif-fps","type","number","step","1",3,"change","min","max","value"],["for","gif-width"],["id","gif-width","type","number","step","10",3,"change","min","max","value"],["role","radiogroup","aria-label","GIF range",1,"sf-field"],["type","radio","name","gif-range","value","all",3,"change","checked"],["type","radio","name","gif-range","value","scene",3,"change","checked"],["aria-label","GIF scene",3,"change","disabled"],["value","","disabled","","selected",""],["type","radio","name","gif-range","value","time",3,"change","checked"],["type","number","aria-label","GIF from (s)","min","0","step","0.1",3,"change","disabled","value"],["type","number","aria-label","GIF to (s)","min","0","step","0.1",3,"change","disabled","value"],["role","status",1,"sf-hint","gif-range-note"],["type","checkbox","name","gif-loop",3,"change","checked"],[1,"sf-hint"],[1,"row"],[3,"value","max"],[1,"mono","small","out-path"],[1,"mono","small","out-path","muted"]],template:function(n,o){if(n&1&&(b(0,"div",1,0)(2,"h2",2),u(3,"Render"),v(),b(4,"fieldset",3)(5,"legend"),u(6,"Formats"),v(),b(7,"div",4),L(8,CS,4,3,"label",5,pe),v()(),b(10,"fieldset",3)(11,"legend"),u(12,"Outputs"),v(),b(13,"div",4)(14,"label",5)(15,"input",6),P("change",function(r){return o.mp4.set(o.checked(r))}),v(),b(16,"span"),u(17,"MP4"),v()(),b(18,"label",5)(19,"input",7),P("change",function(r){return o.gifOn.set(o.checked(r))}),v(),b(20,"span"),u(21,"GIF"),v()()()(),T(22,NS,51,26,"fieldset",8),T(23,FS,3,0,"ul",9),T(24,VS,2,1,"p",10),T(25,jS,2,1,"p",11),T(26,$S,2,1,"p",12),b(27,"div",13)(28,"button",14),P("click",function(){return o.close()}),u(29),v(),b(30,"button",15),P("click",function(){return o.start()}),u(31),v()()()),n&2){let i;l(4),R("disabled",o.status()==="running"),l(4),F(o.available),l(2),R("disabled",o.status()==="running"),l(5),R("checked",o.shownMp4()),l(4),R("checked",o.shownGif()),l(3),D(o.shownGif()?22:-1),l(),D(o.progress().length?23:-1),l(),D((i=o.job()?.notice)?24:-1,i),l(),D(o.phase()?25:-1),l(),D(o.error()?26:-1),l(3),M(o.status()==="running"?"Hide":"Close"),l(),R("disabled",o.status()==="running"||!o.canStart()),l(),B(" ",o.status()==="done"?"Render again":o.status()==="running"?"Rendering\u2026":"Start render"," ")}},encapsulation:2})};function BS(t){return Math.floor(t*100+1e-6)/100}function Yg(t){return t<1024?`${t} B`:t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}var HS=["scroll"],US=["content"],GS=(t,e)=>e.t,Id=(t,e)=>e.id,Jg=(t,e)=>e.sceneId;function WS(t,e){t&1&&(b(0,"span",9),u(1),v()),t&2&&(l(),B("\u2669 ",e," bpm"))}function zS(t,e){if(t&1&&(b(0,"span"),u(1),v()),t&2){let n=p().$implicit;l(),M(n.label)}}function qS(t,e){if(t&1&&(b(0,"div",29),T(1,zS,2,1,"span"),v()),t&2){let n=e.$implicit;ae("left",n.x,"px"),q("major",n.major),l(),D(n.label?1:-1)}}function KS(t,e){if(t&1&&ie(0,"div",32),t&2){let n=e.$implicit;ae("left",n,"px")}}function ZS(t,e){if(t&1&&ie(0,"div",33),t&2){let n=e.$implicit;ae("left",n,"px")}}function QS(t,e){if(t&1&&(b(0,"div",17),L(1,KS,1,2,"div",30,pe),L(3,ZS,1,2,"div",31,oe),v()),t&2){let n=e;l(),F(n.beats),l(2),F(n.bars)}}function YS(t,e){if(t&1&&ie(0,"div",43),t&2){let n=e.$implicit,o=p().$implicit,i=p();ae("left",n.offset*i.zoom(),"px"),q("late",n.offset>o.duration)}}function JS(t,e){if(t&1&&(b(0,"span",39),u(1,"\u26A0"),v()),t&2){p();let n=we(0);R("title",n.join(`
|
|
15
|
-
`)),z("aria-label",n.length+" warnings")}}function XS(t,e){if(t&1&&(b(0,"span",40),u(1),v()),t&2){let n=e;R("title",n.message),z("aria-label","Too short to read: "+n.issue.missing.toFixed(1)+" s missing"),l(),B("+",n.issue.missing.toFixed(1)," s")}}function ew(t,e){if(t&1){let n=j();b(0,"button",44),P("pointerdown",function(i){return i.stopPropagation()})("click",function(){I(n);let i=p().$implicit,r=p();return S(r.snapToBeat(i.id))}),u(1,"\u2669"),v()}if(t&2){let n=e,o=p().$implicit,i=p();R("title","Ends "+i.offBy(n.off)+" s off the beat. Click: snap to the beat ("+i.fmt(n.suggested)+")"),z("aria-label","Snap "+o.id+" to the beat: "+i.fmt(n.suggested))}}function tw(t,e){if(t&1){let n=j();Xn(0),b(1,"div",34),P("pointerdown",function(i){let r=I(n).$implicit,s=p();return S(s.startMove(i,r))})("keydown.enter",function(){let i=I(n).$implicit,r=p();return S(r.store.select(i.id))}),L(2,YS,1,4,"div",35,Id),b(4,"div",36)(5,"span",37),u(6),v(),b(7,"span",38),u(8),v()(),T(9,JS,2,2,"span",39),T(10,XS,2,3,"span",40),T(11,ew,2,2,"button",41),b(12,"div",42),P("pointerdown",function(i){let r=I(n).$implicit,s=p();return S(s.startResize(i,r))}),v()()}if(t&2){let n,o,i=e.$implicit,r=p(),s=Qo(r.issues.sceneWarnings(i));l(),ae("left",i.start*r.zoom(),"px")("width",i.duration*r.zoom(),"px")("transform",r.movingId()===i.id?"translateX("+r.moveDx()+"px)":null),q("selected",i.id===r.selectedId())("has-warning",s.length>0)("short-read",r.readTimeById().has(i.id))("off-beat",r.offBeat().has(i.id))("dragging",r.movingId()===i.id),z("aria-label","Scene "+(i.index+1)+": "+i.id+", "+r.fmt(i.duration))("aria-pressed",i.id===r.selectedId()),l(),F(i.beats),l(4),M(i.id),l(2),ke("",i.type," \xB7 ",r.fmt(i.duration)),l(),D(s.length?9:-1),l(),D((n=r.readTimeById().get(i.id))?10:-1,n),l(),D((o=r.offBeat().get(i.id))?11:-1,o),l(),R("title",r.bpm()?"Drag to change the duration: the end snaps to the beat, bar lines first (Alt: no snap)":"Drag to change the duration (Alt: no snap)"),z("aria-label","Drag to change the duration of "+i.id)}}function nw(t,e){if(t&1&&ie(0,"div",45),t&2){let n=e.$implicit;ae("left",n.left,"px")("width",n.width,"px"),q("reveal",n.reveal),R("title",n.title),z("data-kind",n.kind)("data-scene",n.sceneId)}}function ow(t,e){if(t&1&&(b(0,"div",46)(1,"span",47),u(2),v()()),t&2){let n=e,o=p();ae("left",n.start*o.zoom(),"px")("width",n.duration*o.zoom(),"px"),l(2),M(o.fmt(n.duration))}}function iw(t,e){if(t&1&&ie(0,"div",48),t&2){let n=p();ae("left",n.dropX(),"px")}}function rw(t,e){if(t&1&&(b(0,"div",22),u(1),v()),t&2){let n=p();l(),M(n.bridge.ready()?"No timeline yet.":"Waiting for the player\u2019s timeline\u2026")}}function sw(t,e){if(t&1&&ie(0,"div",52),t&2){let n=e;ae("left",n.x,"px")("width",n.width,"px")}}function aw(t,e){if(t&1){let n=j();b(0,"div",50),P("pointerdown",function(i){return i.stopPropagation()})("click",function(){let i=I(n).$implicit,r=p(2);return S(r.store.select(i.sceneId))}),T(1,sw,1,4,"div",51),v()}if(t&2){let n,o=e.$implicit,i=p(2);ae("left",o.x,"px")("width",o.width,"px"),q("estimate",o.estimate)("stale",o.state==="stale")("selected",o.sceneId===i.selectedId()),R("title",o.title),l(),D((n=o.over)?1:-1,n)}}function cw(t,e){if(t&1&&(b(0,"div",23),L(1,aw,2,12,"div",49,Jg),v()),t&2){let n=p();l(),F(n.speechBars())}}function lw(t,e){if(t&1){let n=j();b(0,"div",56),P("pointerdown",function(i){let r=I(n),s=r.$implicit,a=r.$index,c=p(),d=p();return S(d.startBeat(i,c,s,a))})("keydown",function(i){let r=I(n).$implicit,s=p(),a=p();return S(a.onBeatKey(i,s,r))})("keyup",function(){I(n);let i=p(2);return S(i.store.endCoalescing())})("blur",function(){I(n);let i=p(2);return S(i.store.endCoalescing())}),b(1,"span",57),u(2),v()()}if(t&2){let n=e.$implicit,o=e.$index,i=p(),r=p();ae("left",n.at*r.zoom(),"px"),q("overridden",n.overridden)("late",n.offset>i.duration)("active",r.beatDragId()===n.id),R("title",(n.label||n.id)+" \xB7 gap "+r.fmt(n.gap)+" \xB7 at "+r.fmt(n.offset)+(n.overridden?" (changed)":"")+(n.offset>i.duration?" \xB7 after the scene end":"")),z("aria-label","Beat "+(n.label||n.id)+", gap "+r.fmt(n.gap))("aria-valuenow",n.gap)("aria-valuemin",0),l(),ae("top",2+(r.beatRows()[o]??0)*13,"px"),q("collapsed",r.beatRows()[o]===null),l(),M(n.label||n.id)}}function dw(t,e){if(t&1&&(b(0,"div",58)(1,"span",47),u(2),v()()),t&2){let n=e,o=p(2);ae("left",n.at*o.zoom(),"px"),l(2),B("+",o.fmt(n.gap))}}function uw(t,e){if(t&1&&(ie(0,"div",53),L(1,lw,3,17,"div",54,Id),T(3,dw,3,3,"div",55)),t&2){let n,o=e,i=p();ae("left",o.start*i.zoom(),"px")("width",o.duration*i.zoom(),"px"),l(),F(o.beats),l(2),D((n=i.beatGhost())?3:-1,n)}}function fw(t,e){if(t&1&&(b(0,"span",59),u(1,"Select a scene to see and drag its beats"),v()),t&2){let n=p();ae("left",n.scrollLeft()+8,"px")}}function pw(t,e){if(t&1&&ie(0,"div",60),t&2){let n=e.$implicit,o=p();ae("left",n.at*o.zoom(),"px"),q("doc",n.source==="doc"),R("title",n.sound+" \xB7 "+n.sceneId+" \xB7 "+o.fmt(n.at)+(n.source==="doc"?"":" (built-in)"))}}var Hs=class t{store=w(J);bridge=w(le);issues=w(et);beatGrid=w(Wt);speech=w(Xe);picker=w(bt);injector=w(Ce);readTimeById=_(()=>new Map(this.issues.readTime().map(e=>[e.sceneId,e])));scrollRef=Ue.required("scroll");contentRef=Ue.required("content");minZoom=id;maxZoom=rd;zoom=A(cg);scrollLeft=A(0);drag=A(null);scenes=_(()=>this.bridge.timeline()?.scenes??[]);transitionMarkers=_(()=>this.scenes().flatMap(e=>{let n=mg(e,this.zoom());return n?[x(y({},n),{sceneId:e.id})]:[]}));duration=_(()=>this.bridge.timeline()?.duration??0);sfx=_(()=>this.bridge.timeline()?.sfx??[]);sceneTypes=_(()=>this.bridge.project()?.sceneTypes??[]);selectedId=this.store.selectedSceneId;selected=_(()=>this.scenes().find(e=>e.id===this.selectedId())??null);ticks=_(()=>dg(this.duration(),this.zoom()));bpm=_(()=>this.beatGrid.bpm()??null);offBeat=this.beatGrid.offBeat;grid=_(()=>{let e=this.beatGrid.beat();return e===void 0?null:vg(this.scenes(),this.duration(),e,this.zoom())});speechBars=_(()=>{let e=this.speech.scenes(),n=this.zoom();return e.size?this.scenes().flatMap(o=>{let i=e.get(o.id),r=i?Cg(o.start,o.end,i,n):null;return r?[r]:[]}):[]});contentWidth=_(()=>{let e=this.resizeGhost();return Math.max(this.duration(),e?e.start+e.duration:0)*this.zoom()+240});resizeGhost=_(()=>{let e=this.drag();return e?.kind==="resize"?e:null});beatGhost=_(()=>{let e=this.drag();return e?.kind==="beat"?e:null});beatDragId=_(()=>this.beatGhost()?.beatId??null);beatRows=_(()=>{let e=this.zoom();return pg((this.selected()?.beats??[]).map(n=>({x:n.at*e,width:fg(n.label||n.id)})))});movingId=_(()=>{let e=this.drag();return e?.kind==="move"?e.sceneId:null});moveDx=_(()=>{let e=this.drag();return e?.kind==="move"?e.dx:0});dropX=_(()=>{let e=this.drag();if(e?.kind!=="move"||e.to===e.from)return null;let n=this.scenes().filter((i,r)=>r!==e.from);return n.length?(e.to<n.length?n[e.to].start:n.at(-1)?.end??0)*this.zoom():null});constructor(){He(()=>{let e=this.bridge.time()*this.zoom();if(!this.bridge.playing())return;let n=Ye(()=>this.scrollRef().nativeElement);(e<n.scrollLeft||e>n.scrollLeft+n.clientWidth-40)&&(n.scrollLeft=Math.max(0,e-40))}),Bt(()=>{let e=this.scrollRef().nativeElement;e.addEventListener("scroll",()=>this.scrollLeft.set(e.scrollLeft),{passive:!0})})}fmt(e){return mi(e)}offBy(e){return String(Math.max(.01,Math.round(Math.abs(e)*100)/100))}snapToBeat(e){let n=this.beatGrid.beat();n!==void 0&&(this.store.endCoalescing(),this.store.apply(o=>_s(o,e,n)),this.store.endCoalescing())}setZoom(e){this.zoom.set(Ms(e.target.valueAsNumber))}zoomBy(e,n){let o=this.scrollRef().nativeElement,i=o.getBoundingClientRect(),r=n!==void 0?n-i.left:o.clientWidth/2,s=fi(o.scrollLeft+r,this.zoom()),a=Ms(this.zoom()*e);this.zoom.set(a),Bt(()=>o.scrollLeft=Math.max(0,s*a-r),{injector:this.injector})}fit(){let e=this.duration();e<=0||(this.zoom.set(Ms((this.scrollRef().nativeElement.clientWidth-48)/e)),this.scrollRef().nativeElement.scrollLeft=0)}onWheel(e){!e.ctrlKey&&!e.metaKey||(e.preventDefault(),this.zoomBy(Math.exp(-e.deltaY*.002),e.clientX))}timeAt(e){let n=this.contentRef().nativeElement.getBoundingClientRect();return Math.max(0,fi(e-n.left,this.zoom()))}track(e,n,o){e.preventDefault();let i=s=>n(s),r=s=>{globalThis.removeEventListener("pointermove",i),globalThis.removeEventListener("pointerup",r),globalThis.removeEventListener("pointercancel",r),o(s)};globalThis.addEventListener("pointermove",i),globalThis.addEventListener("pointerup",r),globalThis.addEventListener("pointercancel",r)}startScrub(e){e.button===0&&(this.bridge.playing()&&this.bridge.pause(),this.seekAt(e.clientX),this.track(e,n=>this.seekAt(n.clientX),()=>{}))}seekAt(e){let n=this.bridge.timeline(),o=n?.fps??30,i=Ds(this.timeAt(e),0,pi(n?.duration??0,o));this.bridge.seek(lg(i,o))}onLanePointer(e){e.target===e.currentTarget&&this.store.select(null)}startResize(e,n){if(e.button!==0)return;e.stopPropagation(),this.store.select(n.id);let o=this.store.doc(),i=o&&In(o,n.id)?.duration||n.duration,r=o?bs(o,n.id):-1,s=r>=0?r:n.start,a=e.clientX;this.drag.set({kind:"resize",sceneId:n.id,start:n.start,duration:i}),this.track(e,c=>{let d=i+fi(c.clientX-a,this.zoom()),f=yg(d,{start:s,beat:this.beatGrid.beat(),pxPerSecond:this.zoom(),enabled:!c.altKey});this.drag.set({kind:"resize",sceneId:n.id,start:n.start,duration:f}),this.store.apply(g=>so(g,n.id,f),`duration:${n.id}`)},()=>{this.drag.set(null),this.store.endCoalescing()})}startBeat(e,n,o,i){if(e.button!==0)return;e.stopPropagation();let r=i>0?n.beats[i-1].offset:0,s=e.clientX;this.drag.set({kind:"beat",sceneId:n.id,beatId:o.id,at:o.at,gap:o.gap}),this.track(e,a=>{let c=Math.max(0,Ts(o.gap+fi(a.clientX-s,this.zoom()),!a.altKey));this.drag.set({kind:"beat",sceneId:n.id,beatId:o.id,at:n.start+r+c,gap:c}),this.store.apply(d=>ai(d,n.id,o.id,c),`beat:${n.id}:${o.id}`)},()=>{this.drag.set(null),this.store.endCoalescing()})}onBeatKey(e,n,o){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight")return;e.preventDefault(),e.stopPropagation();let i=(e.shiftKey?.5:.05)*(e.key==="ArrowLeft"?-1:1);this.store.apply(r=>ai(r,n.id,o.id,Math.max(0,o.gap+i)),`beat:${n.id}:${o.id}`)}startMove(e,n){if(e.button!==0)return;this.store.select(n.id);let o=e.clientX,i=!1;this.track(e,r=>{let s=r.clientX-o;if(!i&&Math.abs(s)<4)return;i=!0;let a=ug(this.scenes(),n.index,this.timeAt(r.clientX));this.drag.set({kind:"move",sceneId:n.id,from:n.index,to:a,dx:s})},()=>{let r=this.drag();this.drag.set(null),i&&r?.kind==="move"&&r.to!==r.from&&this.store.apply(s=>Es(s,De(s,n.id),r.to))})}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-timeline"]],viewQuery:function(n,o){n&1&&Qe(o.scrollRef,HS,5)(o.contentRef,US,5),n&2&&dt(2)},hostAttrs:["role","region","aria-label","Timeline",1,"timeline"],decls:40,vars:22,consts:[["scroll",""],["content",""],[1,"tl-toolbar"],["type","button","aria-label","Zoom out","title","Zoom out (Ctrl/Cmd + wheel)",1,"icon",3,"click"],["type","range","aria-label","Zoom",1,"tl-zoom",3,"input","min","max","value"],["type","button","aria-label","Zoom in","title","Zoom in",1,"icon",3,"click"],["type","button",1,"ghost",3,"click"],[1,"muted","small"],[1,"spacer"],["title","Scene ends snap to the music's beat; bar lines first",1,"muted","small","tl-bpm"],[1,"muted","small","tl-help"],["type","button","id","add-scene","aria-haspopup","dialog","title","Pick a scene type from the gallery; it goes after the selected scene",1,"add-scene",3,"click","disabled"],[1,"tl-scroll",3,"wheel"],[1,"tl-content"],["role","slider","tabindex","0","aria-label","Playhead: click or drag to scrub",1,"tl-ruler",3,"pointerdown"],[1,"tl-tick",3,"major","left"],[1,"tl-scenes",3,"pointerdown"],["aria-hidden","true",1,"tl-grid"],["role","button","tabindex","0",1,"tl-block",3,"selected","has-warning","short-read","off-beat","dragging","left","width","transform"],[1,"tl-transition",3,"reveal","left","width","title"],[1,"tl-ghost",3,"left","width"],[1,"tl-drop",3,"left"],[1,"tl-empty","muted"],["aria-label","Narration",1,"tl-speech"],[1,"tl-beats"],[1,"tl-hint","muted","small",3,"left"],["aria-label","Sounds",1,"tl-sfx"],[1,"tl-sfx-dot",3,"doc","left","title"],[1,"tl-playhead"],[1,"tl-tick"],[1,"tl-grid-beat",3,"left"],[1,"tl-grid-bar",3,"left"],[1,"tl-grid-beat"],[1,"tl-grid-bar"],["role","button","tabindex","0",1,"tl-block",3,"pointerdown","keydown.enter"],[1,"tl-beat-tick",3,"late","left"],[1,"tl-block-text"],[1,"tl-block-id"],[1,"tl-block-meta"],["role","img",1,"tl-warn-icon",3,"title"],["role","img",1,"tl-read-icon",3,"title"],["type","button",1,"tl-offbeat",3,"title"],[1,"tl-resize",3,"pointerdown","title"],[1,"tl-beat-tick"],["type","button",1,"tl-offbeat",3,"pointerdown","click","title"],[1,"tl-transition",3,"title"],[1,"tl-ghost"],[1,"mono"],[1,"tl-drop"],[1,"tl-speech-bar",3,"estimate","stale","selected","left","width","title"],[1,"tl-speech-bar",3,"pointerdown","click","title"],[1,"tl-speech-over",3,"left","width"],[1,"tl-speech-over"],[1,"tl-scene-range"],["role","slider","tabindex","0",1,"tl-beat",3,"overridden","late","active","left","title"],[1,"tl-beat-ghost",3,"left"],["role","slider","tabindex","0",1,"tl-beat",3,"pointerdown","keydown","keyup","blur","title"],[1,"tl-beat-label"],[1,"tl-beat-ghost"],[1,"tl-hint","muted","small"],[1,"tl-sfx-dot",3,"title"]],template:function(n,o){if(n&1&&(b(0,"div",2)(1,"button",3),P("click",function(){return o.zoomBy(1/1.25)}),u(2,"\u2212"),v(),b(3,"input",4),P("input",function(r){return o.setZoom(r)}),v(),b(4,"button",5),P("click",function(){return o.zoomBy(1.25)}),u(5,"+"),v(),b(6,"button",6),P("click",function(){return o.fit()}),u(7,"Fit"),v(),b(8,"span",7),u(9),v(),ie(10,"span",8),T(11,WS,2,1,"span",9),b(12,"span",10),u(13),v(),b(14,"button",11),P("click",function(){return o.picker.open()}),u(15," + Add scene\u2026 "),v()(),b(16,"div",12,0),P("wheel",function(r){return o.onWheel(r)}),b(18,"div",13,1)(20,"div",14),P("pointerdown",function(r){return o.startScrub(r)}),L(21,qS,2,5,"div",15,GS),v(),b(23,"div",16),P("pointerdown",function(r){return o.onLanePointer(r)}),T(24,QS,5,0,"div",17),L(25,tw,13,27,"div",18,Id),L(27,nw,1,9,"div",19,Jg),T(29,ow,3,5,"div",20),T(30,iw,1,2,"div",21),T(31,rw,2,1,"div",22),v(),T(32,cw,3,0,"div",23),b(33,"div",24),T(34,uw,4,5)(35,fw,2,2,"span",25),v(),b(36,"div",26),L(37,pw,1,5,"div",27,oe),v(),ie(39,"div",28),v()()),n&2){let i,r,s,a;l(3),R("min",o.minZoom)("max",o.maxZoom)("value",o.zoom()),l(6),ke("",o.scenes().length," scenes \xB7 ",o.fmt(o.duration())),l(2),D((i=o.bpm())?11:-1,i),l(2),B("Drag a block's right edge to retime",o.bpm()?" (snaps to the beat)":""," \xB7 drag a block to reorder \xB7 Alt disables snapping"),l(),R("disabled",!o.sceneTypes().length||!o.store.doc()),l(4),ae("width",o.contentWidth(),"px"),l(2),z("aria-valuemin",0)("aria-valuemax",o.duration())("aria-valuenow",o.bridge.time())("aria-valuetext",o.fmt(o.bridge.time())),l(),F(o.ticks()),l(3),D((r=o.grid())?24:-1,r),l(),F(o.scenes()),l(2),F(o.transitionMarkers()),l(2),D((s=o.resizeGhost())?29:-1,s),l(),D(o.dropX()!==null?30:-1),l(),D(o.scenes().length?-1:31),l(),D(o.speechBars().length?32:-1),l(2),D((a=o.selected())?34:35,a),l(3),F(o.sfx()),l(2),ae("left",o.bridge.time()*o.zoom(),"px")}},encapsulation:2})};function Xg(t){return Object.values(t).filter(e=>e.status==="running").length}function ey(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.status]))}var mw=(t,e=140)=>t.length>e?`${t.slice(0,e-1)}\u2026`:t;function ty(t,e){let n=[];for(let o of Object.values(e)){if(t[o.file]!=="running"||o.status==="running")continue;let i=o.file.replace(/\.video\.json$/,"");o.status==="done"?n.push({title:"Render finished",body:`${i} \xB7 ${o.formats.join(", ")}`,file:o.file,tag:`render:${o.file}`}):o.status==="error"&&n.push({title:"Render failed",body:mw(`${i}: ${o.error??"unknown error"}`),file:o.file,tag:`render:${o.file}`})}return n}var oy="beatsheet:notify";function hw(){try{return localStorage.getItem(oy)==="1"}catch{return!1}}function ny(t){try{localStorage.setItem(oy,t?"1":"0")}catch{}}var lo=class t{jobs=w(xt);store=w(J);view=w(_t);doc=w(Ne);injector=w(Ce);supported=typeof Notification<"u";on=A(this.supported&&hw()&&Notification.permission==="granted");blocked=A(this.supported&&Notification.permission==="denied");started=!1;before={};start(){this.started||(this.started=!0,He(()=>{let e=this.jobs.all();this.paintBadge(Xg(e));let n=ty(this.before,e);if(this.before=ey(e),this.on()&&!this.doc.hasFocus())for(let o of n)this.show(o)},{injector:this.injector}),navigator.serviceWorker?.addEventListener("message",e=>{let n=e.data;n?.type==="open-video"&&n.file&&this.openVideo(n.file)}))}async toggle(){if(!this.supported)return;if(this.on()){this.on.set(!1),ny(!1);return}let e=Notification.permission==="default"?await Notification.requestPermission():Notification.permission;this.blocked.set(e==="denied"),this.on.set(e==="granted"),ny(e==="granted")}paintBadge(e){"setAppBadge"in navigator&&(e>0?navigator.setAppBadge(e):navigator.clearAppBadge()).catch(()=>{})}async openVideo(e){this.view.show("editor"),this.store.file()!==e&&await this.store.open(e)}async show(e){let n={body:e.body,tag:e.tag,icon:"/icons/icon-192.png",data:{file:e.file}};try{let o=await navigator.serviceWorker?.getRegistration();if(o){await o.showNotification(e.title,n);return}let i=new Notification(e.title,n);i.onclick=()=>{this.doc.defaultView?.focus(),this.openVideo(e.file),i.close()}}catch{}}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};var gw=(t,e)=>e.file;function yw(t,e){if(t&1&&(b(0,"option",6),u(1),v()),t&2){let n=e.$implicit,o=p();R("value",n.file)("selected",n.file===o.store.file()),l(),M(n.title||n.file)}}function vw(t,e){if(t&1){let n=j();b(0,"button",19),P("click",function(){let i=I(n).$implicit,r=p(2);return S(r.store.setFormat(i))}),u(1),v()}if(t&2){let n=e.$implicit,o=p(2);q("on",o.store.format()===n),z("aria-pressed",o.store.format()===n),l(),B(" ",n," ")}}function bw(t,e){if(t&1&&(b(0,"div",9),L(1,vw,2,4,"button",18,pe),v()),t&2){let n=p();l(),F(n.formats())}}function _w(t,e){if(t&1){let n=j();b(0,"button",20),P("click",function(){I(n);let i=p();return S(i.notify.toggle())}),u(1),v()}if(t&2){let n=p();R("title",n.notify.blocked()?"Notifications are blocked for this site in the browser settings":"Notify me when a render finishes or fails while the studio is in the background"),z("aria-pressed",n.notify.on()),l(),B(" ",n.notify.blocked()?"Notifications blocked":n.notify.on()?"Notifications on":"Notifications off"," ")}}function Ew(t,e){if(t&1&&(b(0,"span",15),u(1),v()),t&2){let n=p();l(),ke("",n.issues.errorCount()," ",n.issues.errorCount()===1?"problem":"problems")}}function xw(t,e){if(t&1&&(b(0,"span",16),u(1),v()),t&2){let n=p();R("title",n.issues.silencedNote()),l(),ke("",n.issues.errorCount()?"\xB7 ":"","",n.issues.silencedLabel())}}var iy=["16:9","4:5"],Us=class t{store=w(J);issues=w(et);renderJobs=w(xt);view=w(_t);notify=w(lo);render=eo();videos=_(()=>this.store.project()?.videos??[]);formats=_(()=>{let e=(this.store.doc()?.formats??[]).filter(n=>!iy.includes(n));return[...iy,...e]});saveLabel=_(()=>{let e=this.store.saveState();return e==="saving"?"Saving\u2026":e==="error"?"Save failed":e==="conflict"?"Changed on disk":this.store.dirty()?"Unsaved":e==="saved"?"Saved":"Up to date"});async onPick(e){let n=e.target;await this.store.open(n.value)||(n.value=this.store.file()??"")}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-top-bar"]],hostAttrs:["role","banner",1,"top-bar"],outputs:{render:"render"},decls:28,vars:23,consts:[[1,"brand"],["role","group","aria-label","Workspace",1,"segmented","view-switch"],["type","button","data-view-switch","editor",3,"click"],["type","button","data-view-switch","gallery","title","Scene types with live previews, sounds and music of this project",3,"click"],["for","video-picker",1,"sr-only"],["id","video-picker",1,"video-picker",3,"change","disabled"],[3,"value","selected"],[1,"doc-title",3,"title"],[1,"spacer"],["role","group","aria-label","Preview format",1,"segmented"],["type","button",1,"ghost",3,"title"],["role","group","aria-label","History",1,"btn-group"],["type","button","aria-label","Undo","title","Undo (Cmd/Ctrl+Z)",1,"icon",3,"click","disabled"],["type","button","aria-label","Redo","title","Redo (Shift+Cmd/Ctrl+Z)",1,"icon",3,"click","disabled"],["type","button","aria-live","polite",1,"save-state",3,"click","title"],["role","status",1,"issue-badge"],["role","status",1,"issue-silenced",3,"title"],["type","button",1,"primary",3,"click","disabled"],["type","button",3,"on"],["type","button",3,"click"],["type","button",1,"ghost",3,"click","title"]],template:function(n,o){n&1&&(b(0,"span",0),u(1,"beatsheet"),v(),b(2,"div",1)(3,"button",2),P("click",function(){return o.view.show("editor")}),u(4," Editor "),v(),b(5,"button",3),P("click",function(){return o.view.show("gallery")}),u(6," Gallery "),v()(),b(7,"label",4),u(8,"Video"),v(),b(9,"select",5),P("change",function(r){return o.onPick(r)}),L(10,yw,2,3,"option",6,gw),v(),b(12,"span",7),u(13),v(),ie(14,"span",8),T(15,bw,3,0,"div",9),T(16,_w,2,3,"button",10),b(17,"div",11)(18,"button",12),P("click",function(){return o.store.undo()}),u(19,"\u21B6"),v(),b(20,"button",13),P("click",function(){return o.store.redo()}),u(21,"\u21B7"),v()(),b(22,"button",14),P("click",function(){return o.store.save()}),u(23),v(),T(24,Ew,2,2,"span",15),T(25,xw,2,3,"span",16),b(26,"button",17),P("click",function(){return o.render.emit()}),u(27),v()),n&2&&(l(3),q("on",o.view.view()==="editor"),z("aria-pressed",o.view.view()==="editor"),l(2),q("on",o.view.view()==="gallery"),z("aria-pressed",o.view.view()==="gallery"),l(4),R("disabled",!o.videos().length),l(),F(o.videos()),l(2),R("title",o.store.file()??""),l(),M(o.store.doc()?.title),l(2),D(o.view.view()==="editor"?15:-1),l(),D(o.notify.supported?16:-1),l(2),R("disabled",!o.store.canUndo()),l(2),R("disabled",!o.store.canRedo()),l(2),q("dirty",o.store.dirty())("error",o.store.saveState()==="error"||o.store.saveState()==="conflict"),R("title",o.store.saveError()??"Save (Cmd/Ctrl+S)"),l(),B(" ",o.saveLabel()," "),l(),D(o.issues.errorCount()?24:-1),l(),D(o.issues.silenced().count?25:-1),l(),R("disabled",!o.store.doc()),l(),B(" ",o.renderJobs.current()?.status==="running"?"Rendering\u2026":"Render\u2026"," "))},encapsulation:2})};function Cw(t,e){t&1&&(h(0,"div",1),u(1),h(2,"code"),u(3,"beatsheet studio"),m(),u(4," running?"),m()),t&2&&(l(),B("",e," \u2014 is "))}function Iw(t,e){if(t&1){let n=j();h(0,"div",2)(1,"p")(2,"strong"),u(3,"This video changed on disk."),m(),u(4," Autosave is paused. "),h(5,"em"),u(6,"Reload from disk"),m(),u(7," drops your unsaved edits and undo history; "),h(8,"em"),u(9,"Keep mine"),m(),u(10," overwrites the file with your version. "),m(),h(11,"button",8),k("click",function(){I(n);let i=p();return S(i.store.reloadFromDisk())}),u(12,"Reload from disk"),m(),h(13,"button",9),k("click",function(){I(n);let i=p();return S(i.store.keepMine())}),u(14,"Keep mine"),m()()}}function Sw(t,e){t&1&&(h(0,"div",1),u(1),m()),t&2&&(l(),M(e))}function ww(t,e){t&1&&(h(0,"div",1),u(1),m()),t&2&&(l(),M(e))}function Tw(t,e){if(t&1&<(0,"app-gallery",7),t&2){let n=p();N("hidden",n.view.view()!=="gallery")}}function Dw(t,e){if(t&1){let n=j();h(0,"app-render-dialog",10),k("closed",function(){I(n);let i=p();return S(i.renderOpen.set(!1))}),m()}}function Mw(t,e){t&1&<(0,"app-scene-picker")}function ry(t){return t instanceof HTMLElement?t.isContentEditable||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?!0:t instanceof HTMLInputElement?!["checkbox","radio","button","submit","reset","color","file"].includes(t.type):!1:!1}var Gs=class t{store=w(J);bridge=w(le);renderJobs=w(xt);speech=w(Xe);view=w(_t);picker=w(bt);renderOpen=A(!1);constructor(){this.store.init(),He(()=>{let e=this.store.file();e&&Ye(()=>{this.renderJobs.sync(e)})}),He(()=>{let e=this.store.file();Ye(()=>this.speech.open(e))}),He(()=>{this.store.saves()>0&&Ye(()=>this.speech.scheduleRefresh())}),He(()=>{let e=this.store.doc(),n=this.store.format();e&&Ye(()=>this.bridge.requestLoad(e,n))})}onKeydown(e){if(e.defaultPrevented)return;let n=e.metaKey||e.ctrlKey,o=e.key.toLowerCase();if(n&&o==="s"){e.preventDefault(),this.store.save();return}if(this.picker.isOpen())return;if(n&&(o==="z"||o==="y")){if(ry(e.target))return;e.preventDefault(),o==="y"||e.shiftKey?this.store.redo():this.store.undo();return}if(n||e.altKey||ry(e.target)||this.renderOpen()||this.view.view()==="gallery")return;let i=this.bridge.timeline(),r=i?.fps??this.store.doc()?.fps??30,s=i?.duration??0;switch(e.key){case" ":if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement)return;e.preventDefault(),this.bridge.togglePlay();break;case"ArrowLeft":case"ArrowRight":{e.preventDefault(),this.bridge.playing()&&this.bridge.pause();let a=(e.shiftKey?Math.round(r):1)*(e.key==="ArrowLeft"?-1:1);this.bridge.seek(Ns(this.bridge.time(),r,a,s));break}case"Home":e.preventDefault(),this.bridge.seek(0);break;case"End":e.preventDefault(),this.bridge.seek(pi(s,r));break;case"Delete":case"Backspace":{let a=this.store.selectedSceneId();a&&(e.preventDefault(),this.store.deleteScene(a));break}case"Escape":this.store.select(null);break}}onBeforeUnload(e){this.store.dirty()&&(this.store.save(),e.preventDefault())}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=se({type:t,selectors:[["app-root"]],hostBindings:function(n,o){n&1&&k("keydown",function(r){return o.onKeydown(r)},Vr)("beforeunload",function(r){return o.onBeforeUnload(r)},Kc)("focusout",function(){return o.store.endCoalescing()},Vr)},decls:12,vars:8,consts:[[3,"render"],["role","alert",1,"load-error"],["role","alert",1,"conflict-banner"],[1,"workspace",3,"hidden"],[1,"pane","pane-preview"],[1,"pane","pane-inspector"],[1,"pane","pane-timeline"],[3,"hidden"],["type","button",3,"click"],["type","button",1,"primary",3,"click"],[3,"closed"]],template:function(n,o){if(n&1&&(h(0,"app-top-bar",0),k("render",function(){return o.renderOpen.set(!0)}),m(),T(1,Cw,5,1,"div",1),T(2,Iw,15,0,"div",2),T(3,Sw,2,1,"div",1),T(4,ww,2,1,"div",1),h(5,"main",3),lt(6,"app-preview",4)(7,"app-inspector",5)(8,"app-timeline",6),m(),T(9,Tw,1,1,"app-gallery",7),T(10,Dw,1,0,"app-render-dialog"),T(11,Mw,1,0,"app-scene-picker")),n&2){let i,r,s;l(),D((i=o.store.loadError())?1:-1,i),l(),D(o.store.conflict()?2:-1),l(),D((r=o.store.bugError())?3:-1,r),l(),D((s=o.store.openError())?4:-1,s),l(),N("hidden",o.view.view()==="gallery"),l(4),D(o.view.galleryLoaded()?9:-1),l(),D(o.renderOpen()?10:-1),l(),D(o.picker.loaded()?11:-1)}},dependencies:[Us,$s,Vs,Hs,Bs,Is,js],encapsulation:2})};kl(Gs,Om).then(t=>t.injector.get(lo).start()).catch(t=>console.error(t));!Im()&&"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});
|
|
12
|
+
`;function ss(t){return 60/t}function oo(t,e){return Math.max(0,Math.ceil((t-.005)/e))*e}function Um(t,e){return t-Math.round(t/e)*e}function as(t,e){return Math.abs(Um(t,e))<=.005}function Ll(t,e,n="nearest"){return n==="up"?oo(t,e):Math.max(0,Math.round(t/e))*e}var WE=t=>Math.round(t*1e3)/1e3;function xn(t,e,n,o="nearest"){let i=Ll(t+e,n,o);return i<=t+.005&&(i=oo(t+2*.005,n)),WE(i-t)}function Fl(t,e,n="up",o){let i=0;return t.map((r,s)=>{let a=r;if(!as(i+r,e)){a=xn(i,r,e,n);let c=o?.[s];c!==void 0&&Number.isFinite(c)&&a<c-.005&&(a=xn(i,c,e,"up"))}return i+=a,a})}function Gm(t,e){let n=ss(e),o=[],i=0;return t.forEach((r,s)=>{let a=i+r;as(a,n)||o.push({index:s,off:Um(a,n),suggested:xn(i,r,n,"up")}),i=a}),o}function Wm(t,e){let n=t.map(i=>oo(i.start,e)),o=t.length;if(o>0){let i=t[o-1];n[o-1]>=i.end-.005&&(n[o-1]=i.start)}return n.map((i,r)=>r+1<o&&i>=n[r+1]-.005?void 0:i)}var Vl=.5;function zm(t){return typeof t=="number"&&Number.isFinite(t)&&t>0?Math.min(t,Vl):0}var ri=1.5;var zE=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function qm(t,e){let n=t&&zE(t,e)?t[e]:void 0;return typeof n=="number"&&Number.isFinite(n)?Math.min(ri,Math.max(0,n)):1}var qE=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function KE(t){let e=[];for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);if(o>=55296&&o<=56319){let i=n+1<t.length?t.charCodeAt(n+1):0;i>=56320&&i<=57343?(o=65536+(o-55296<<10)+(i-56320),n++):o=65533}else o>=56320&&o<=57343&&(o=65533);o<128?e.push(o):o<2048?e.push(192|o>>6,128|o&63):o<65536?e.push(224|o>>12,128|o>>6&63,128|o&63):e.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|o&63)}return Uint8Array.from(e)}function Km(t){let e=typeof t=="string"?KE(t):t,n=Math.ceil((e.length+9)/64)*64,o=new Uint8Array(n);o.set(e),o[e.length]=128;let i=new DataView(o.buffer),r=e.length*8;i.setUint32(n-8,Math.floor(r/4294967296)),i.setUint32(n-4,r>>>0);let s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64),c=(f,g)=>f>>>g|f<<32-g;for(let f=0;f<n;f+=64){for(let he=0;he<16;he++)a[he]=i.getUint32(f+he*4);for(let he=16;he<64;he++){let uo=a[he-15],fo=a[he-2],vi=c(uo,7)^c(uo,18)^uo>>>3,qs=c(fo,17)^c(fo,19)^fo>>>10;a[he]=a[he-16]+vi+a[he-7]+qs>>>0}let g=s[0],C=s[1],E=s[2],P=s[3],Z=s[4],Y=s[5],ve=s[6],se=s[7];for(let he=0;he<64;he++){let uo=c(Z,6)^c(Z,11)^c(Z,25),fo=Z&Y^~Z&ve,vi=se+uo+fo+qE[he]+a[he]>>>0,qs=c(g,2)^c(g,13)^c(g,22),ay=g&C^g&E^C&E,cy=qs+ay>>>0;se=ve,ve=Y,Y=Z,Z=P+vi>>>0,P=E,E=C,C=g,g=vi+cy>>>0}s[0]=s[0]+g>>>0,s[1]=s[1]+C>>>0,s[2]=s[2]+E>>>0,s[3]=s[3]+P>>>0,s[4]=s[4]+Z>>>0,s[5]=s[5]+Y>>>0,s[6]=s[6]+ve>>>0,s[7]=s[7]+se>>>0}let d="";for(let f of s)d+=f.toString(16).padStart(8,"0");return d}var Zm={kokoro:{title:"Kokoro",model:"kokoro-82m-v1.0-onnx-fp32/kokoro-js-1.2.1",hosted:!1,languages:["en"]}},cs=.3,Ht={min:.5,max:2,default:1},io=.3,ZE={in:.3,out:.8},Qm=Math.max(io,ZE.out),ls=8,ds=24,QE=2,YE=1,JE=3,XE=2,$l=["raw","studio"],us="raw";function jl(t){return typeof t=="string"&&$l.includes(t)}function Ym(t,e){return jl(t.voiceFx)?t.voiceFx:jl(e?.voiceFx)?e.voiceFx:us}var ex=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),tx=t=>typeof t=="number"&&Number.isFinite(t);function Jm(t){if(!ex(Zm,t))return;let e=Zm[t];return{id:t,title:e.title,model:e.model,hosted:e.hosted,languages:[...e.languages]}}var nx=/^([a-z][a-z0-9-]*):([A-Za-z0-9][A-Za-z0-9_.-]*)$/;function fs(t){if(typeof t!="string")return null;let e=nx.exec(t);return e?{engine:e[1],voice:e[2]}:null}function Xm(t,e){return typeof t.voice=="string"?t.voice:typeof e?.voice=="string"?e.voice:void 0}function si(t){return t.normalize("NFC").trim().replace(/\s+/g," ")}function eh(t){let e=tx(t.speed)?t.speed:Ht.default,n=jl(t.fx)?t.fx:us,o={engine:t.engine,model:t.model,voice:t.voice,text:si(t.text),speed:e},i=JSON.stringify(n==="raw"?x(v({v:QE},o),{processing:YE}):x(v({v:JE},o),{processing:XE,fx:n}));return Km(i).slice(0,16)}var ox=["4:5","1:1","9:16"],th={"bs-text-display-xl":{base:"150px",narrow:"96px","1:1":"84px"},"bs-text-display-l":{base:"104px",narrow:"84px","1:1":"76px"},"bs-text-display-m":{base:"88px",narrow:"84px","1:1":"68px"},"bs-text-heading":{base:"72px",narrow:"64px","1:1":"54px"},"bs-text-title":{base:"40px",narrow:"38px","1:1":"34px"},"bs-text-body":"30px","bs-text-caption":"26px","bs-text-mono":{base:"30px",narrow:"26px"}},nh={"bs-weight-display":"600","bs-weight-heading":"600","bs-weight-strong":"600","bs-weight-bold":"700","bs-weight-medium":"500","bs-weight-body":"400"},oh={"bs-tracking-display":"-0.04em","bs-tracking-heading":"-0.035em","bs-tracking-title":"-0.02em","bs-tracking-tight":"-0.01em","bs-tracking-wide":"0.01em"},ih={"bs-leading-display":"0.98","bs-leading-heading":"1.02","bs-leading-title":"1.12","bs-leading-snug":"1.2","bs-leading-body":"1.3"},rh={"bs-frame-x":{base:"160px",narrow:"72px"},"bs-space-scale":"1"},sh={"bs-radius-pill":"999px","bs-shadow-color":"var(--bs-fg)","bs-shadow-sm":"0 6px 18px -6px color-mix(in srgb,var(--bs-shadow-color) 50%,transparent)","bs-shadow-md":"0 24px 60px -28px color-mix(in srgb,var(--bs-shadow-color) 45%,transparent)","bs-shadow-lg":"0 40px 90px -30px color-mix(in srgb,var(--bs-shadow-color) 30%,transparent)"},ah={"bs-captions-size":{base:"44px",narrow:"42px","9:16":"46px"},"bs-captions-fg":"var(--bs-dark-fg)","bs-captions-bg":"color-mix(in srgb,var(--bs-dark-bg) 80%,transparent)","bs-captions-edge":"color-mix(in srgb,var(--bs-dark-fg) 32%,transparent)","bs-captions-inset":{base:"56px",narrow:"64px","9:16":"300px"}},Bl=v(v(v(v(v(v(v({},th),nh),oh),ih),rh),sh),ah),ix=["bs-bg","bs-fg","bs-muted","bs-accent","bs-accent-fg","bs-warn","bs-error","bs-ok","bs-panel-bg","bs-panel-fg","bs-panel-muted","bs-dark-bg","bs-dark-fg","bs-font-display","bs-font-body","bs-font-mono","bs-radius","bs-rule"];function rx(t){return t.startsWith("--")?t.slice(2):t}function Hl(t){return new Set([...ix,...Object.keys(Bl),...Object.keys(t.tokens??{}).map(rx)])}var o2=[{id:"type",title:"Type scale",tokens:Object.keys(th)},{id:"weight",title:"Weights",tokens:Object.keys(nh)},{id:"tracking",title:"Tracking",tokens:Object.keys(oh)},{id:"leading",title:"Line heights",tokens:Object.keys(ih)},{id:"space",title:"Spacing",tokens:Object.keys(rh)},{id:"shape",title:"Radii and shadows",tokens:Object.keys(sh)},{id:"captions",title:"Captions",tokens:Object.keys(ah)}];function Ul(t,e){if(typeof t=="string"||typeof t=="number")return String(t);let n=t[e],o=n!==void 0?n:t.narrow!==void 0&&ox.includes(e)?t.narrow:t.base;return String(o)}var sx=Object.keys(Ol),Gl=["fade","reveal","punch","blur","words"],Ut=.1,ax={easeIn:"outCubic",easeMove:"inOutCubic",easePop:"outBack",easeSettle:"outQuart",enter:.5,exit:.25,stagger:.07,rise:26,entrance:"fade",push:0};function ch(t){let e=t?.motion??{},n=v({},ax);for(let i of["easeIn","easeMove","easePop","easeSettle"]){let r=e[i];typeof r=="string"&&sx.includes(r)&&(n[i]=r)}for(let i of["enter","exit","stagger","rise"]){let r=e[i];typeof r=="number"&&Number.isFinite(r)&&r>=0&&(n[i]=r)}typeof e.entrance=="string"&&Gl.includes(e.entrance)&&(n.entrance=e.entrance);let o=e.push;return typeof o=="number"&&Number.isFinite(o)&&o>=0&&o<=Ut&&(n.push=o),n}function ms(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(String(t[n])!==String(e[n]))return!1;return!0}function lh(t,e){if(e.length>t.length)return!1;for(let n=0;n<e.length;n++)if(String(t[n])!==String(e[n]))return!1;return!0}function dh(t){return t.map(String).join(".")}function ps(t,e,n){if(e.length===0)return n;let[o,...i]=e,r=t;if(Array.isArray(r)){let f=Number(o),g=r.slice(),C=ps(g[f],i,n);return C===void 0&&i.length===0?g.splice(f,1):g[f]=C,g}let s=r!==null&&typeof r=="object"?v({},r):{},a=s[String(o)],c=a===void 0&&i.length>0&&typeof i[0]=="number"?[]:a,d=ps(c,i,n);return d===void 0?delete s[String(o)]:s[String(o)]=d,s}var Cn=.1;function be(t){return Math.round(t*1e3)/1e3}function De(t,e){return t.scenes.findIndex(n=>n.id===e)}function In(t,e){return t.scenes.find(n=>n.id===e)}function Re(t,e,n){let o=De(t,e);if(o<0)return t;let i=t.scenes[o],r=n(i);if(r===i)return t;let s=t.scenes.slice();return s[o]=r,x(v({},t),{scenes:s})}function _e(t,e){if(!(e in t))return t;let n=v({},t);return delete n[e],n}function ph(t,e){return t.title===e?t:x(v({},t),{title:e})}function mh(t,e,n){let o=t.formats.includes(e);if(n===o||!n&&t.formats.length<=1)return t;let i=n?[...t.formats,e]:t.formats.filter(r=>r!==e);return x(v({},t),{formats:i})}function hh(t,e,n=[]){if(e===null)return t.music===null?t:x(v({},t),{music:null});if(t.music?.track===e)return t;let o=x(v({},t.music),{track:e});if(o.mix){let i=Object.fromEntries(Object.entries(o.mix).filter(([r])=>n.includes(r)));Object.keys(i).length?o.mix=i:delete o.mix}return x(v({},t),{music:o})}function gh(t,e,n){if(!t.music||!Number.isFinite(n))return t;let o=be(Math.min(ri,Math.max(0,n))),i=t.music.mix??{},r=Object.hasOwn(i,e);if(o===1?!r:r&&i[e]===o)return t;let s=v({},i);return o===1?delete s[e]:s[e]=o,Object.keys(s).length?x(v({},t),{music:x(v({},t.music),{mix:s})}):x(v({},t),{music:_e(t.music,"mix")})}function yh(t){return t.music?.mix?x(v({},t),{music:_e(t.music,"mix")}):t}function vh(t,e){if(!t.music)return t;let n=Ah(e);return t.music.gain===n?t:x(v({},t),{music:x(v({},t.music),{gain:n})})}function bh(t,e){return e===void 0||e===""?_e(t,"voice"):t.voice===e?t:x(v({},t),{voice:e})}function _h(t,e){if(!t.music||!Number.isFinite(e))return t;let n=Math.round(Math.min(ds,Math.max(0,e)));return n===ls?t.music.duck===void 0?t:x(v({},t),{music:_e(t.music,"duck")}):t.music.duck===n?t:x(v({},t),{music:x(v({},t.music),{duck:n})})}function cx(t,e){if(t===e)return!0;if(!t||!e||typeof t!="object"||typeof e!="object")return!1;let n=Object.keys(t);return n.length===Object.keys(e).length&&n.every(o=>t[o]===e[o])}function Eh(t,e,n,o){let i=t[e]??{},r=Object.hasOwn(i,n);if(o===void 0){if(!r)return t;let s=v({},i);return delete s[n],Object.keys(s).length?x(v({},t),{[e]:s}):_e(t,e)}return r&&cx(i[n],o)?t:x(v({},t),{[e]:x(v({},i),{[n]:o})})}function ro(t,e,n){let o=e.trim();return o?Eh(t,"tokens",o,n===""?void 0:n):t}function hs(t,e,n){let o=n;if(typeof o=="number"){if(!Number.isFinite(o))return t;o=be(Math.max(0,e==="push"?Math.min(Ut,o):o))}return Eh(t,"motion",e,o)}function zl(t,e){if(e===void 0)return _e(t,"grain");if(!Number.isFinite(e))return t;let n=be(Math.min(Vl,Math.max(0,e)));return t.grain===n?t:x(v({},t),{grain:n})}function gs(t,e){if(e===void 0)return _e(t,"backdrop");if(!no.includes(e.kind))return t;let n=e.strength;if(n!==void 0&&!Number.isFinite(n))return t;let o=v({kind:e.kind},n!==void 0&&e.kind!=="none"?{strength:be(Math.min(1,Math.max(0,n)))}:{});return t.backdrop&&t.backdrop.kind===o.kind&&t.backdrop.strength===o.strength?t:x(v({},t),{backdrop:o})}function ys(t,e){if(!e)return _e(t,"captions");let n=e===!0?{}:e,o=v(v({},n.style&&n.style!=="bar"?{style:n.style}:{}),n.position&&n.position!=="bottom"?{position:n.position}:{}),i=Object.keys(o).length?o:!0,r=t.captions;return r===i||r&&JSON.stringify(uh(r))===JSON.stringify(uh(i))?t:x(v({},t),{captions:i})}function uh(t){return t===!0?["bar","bottom"]:[t.style??"bar",t.position??"bottom"]}function xh(t,e){return e===void 0?_e(t,"voiceFx"):t.voiceFx===e?t:x(v({},t),{voiceFx:e})}function vs(t,e){if(e===void 0)return _e(t,"poster");let n={scene:e.scene};return e.beat!==void 0&&e.beat!==""&&(n.beat=e.beat),e.offset!==void 0&&Number.isFinite(e.offset)&&(n.offset=be(e.offset)),x(v({},t),{poster:n})}function so(t,e,n){if(!Number.isFinite(n))return t;let o=be(Math.max(Cn,n));return Re(t,e,i=>i.duration===o?i:x(v({},i),{duration:o}))}function bs(t,e){let n=De(t,e);return n<0?-1:t.scenes.slice(0,n).reduce((o,i)=>o+i.duration,0)}function lx(t,e,n,o){let i=In(t,e);if(!i||!Number.isFinite(n)||n<=0)return t;let r=i.duration+n;return so(t,e,o&&o>0?xn(bs(t,e),r,o,"up"):r)}function ql(t,e,n,o){let i=In(t,e);if(!i)return t;let r=n.readMissing!==void 0&&n.readMissing>0?n.readMissing:0,s=n.speech!==void 0&&n.speech>i.duration+1e-6?n.speech-i.duration:0;return s>0&&!(o&&o>0)&&(s=Math.ceil((i.duration+s)*10-1e-6)/10-i.duration),lx(t,e,Math.max(r,s),o)}function _s(t,e,n){let o=In(t,e);if(!o||!(n>0))return t;let i=bs(t,e);return as(i+o.duration,n)?t:so(t,e,xn(i,o.duration,n,"up"))}function Ch(t,e){if(!(e>0))return t;let n=Fl(t.scenes.map(o=>o.duration),e,"up");return n.every((o,i)=>o===t.scenes[i].duration)?t:x(v({},t),{scenes:t.scenes.map((o,i)=>n[i]===o.duration?o:x(v({},o),{duration:n[i]}))})}function Ih(t,e){return e>0?Fl(t.scenes.map(o=>o.duration),e,"up").filter((o,i)=>o!==t.scenes[i].duration).length:0}function ai(t,e,n,o){if(!Number.isFinite(o))return t;let i=be(Math.max(0,o));return Re(t,e,r=>r.beats?.[n]===i?r:x(v({},r),{beats:x(v({},r.beats),{[n]:i})}))}function Sh(t,e,n){return Re(t,e,o=>{if(!o.beats||!(n in o.beats))return o;let i=v({},o.beats);return delete i[n],Object.keys(i).length?x(v({},o),{beats:i}):_e(o,"beats")})}function ci(t,e,n){return Re(t,e,o=>{if(n===void 0)return _e(o,"transitionIn");let i={kind:n.kind,duration:be(Math.max(0,n.duration))};n.direction!==void 0&&rs(i.kind)&&(i.direction=n.direction);let r=o.transitionIn;return r?.kind===i.kind&&r.duration===i.duration&&r.direction===i.direction?o:x(v({},o),{transitionIn:i})})}function Kl(t,e,n){return Re(t,e,o=>{if(n===void 0)return _e(o,"push");if(!Number.isFinite(n))return o;let i=be(Math.min(Ut,Math.max(0,n)));return o.push===i?o:x(v({},o),{push:i})})}function wh(t,e,n){return Re(t,e,o=>n?o.captions===!1?o:x(v({},o),{captions:!1}):_e(o,"captions"))}function Th(t,e,n,o){return Re(t,e,i=>x(v({},i),{props:ps(i.props,n,o)}))}function Dh(t,e,n){return Re(t,e,o=>n?o.muteDefaultSfx?o:x(v({},o),{muteDefaultSfx:!0}):_e(o,"muteDefaultSfx"))}function Mh(t,e,n){return Re(t,e,o=>x(v({},o),{sfx:[...o.sfx??[],Oh(n)]}))}function Zl(t,e,n,o){return Re(t,e,i=>{let r=i.sfx??[];if(n<0||n>=r.length)return i;let s=v({},r[n]);for(let[c,d]of Object.entries(o))d===void 0?delete s[c]:s[c]=d;let a=r.slice();return a[n]=Oh(s),x(v({},i),{sfx:a})})}function Nh(t,e,n){return Re(t,e,o=>{let i=o.sfx??[];if(n<0||n>=i.length)return o;let r=i.filter((s,a)=>a!==n);return r.length?x(v({},o),{sfx:r}):_e(o,"sfx")})}function kh(t,e,n=""){return Re(t,e,o=>o.narration?o:x(v({},o),{narration:{text:n}}))}function li(t,e,n){return Re(t,e,o=>{let i=o.narration;if(!i)return o;let r=v({},i);return"text"in n&&typeof n.text=="string"&&(r.text=n.text),"offset"in n&&(n.offset===void 0?delete r.offset:Number.isFinite(n.offset)&&(r.offset=be(Math.max(0,n.offset)))),"speed"in n&&(n.speed===void 0?delete r.speed:Number.isFinite(n.speed)&&(r.speed=Math.round(Math.min(Ht.max,Math.max(Ht.min,n.speed))*100)/100)),"caption"in n&&(n.caption===void 0||n.caption===""?delete r.caption:typeof n.caption=="string"&&(r.caption=n.caption)),JSON.stringify(r)===JSON.stringify(i)?o:x(v({},o),{narration:r})})}function Rh(t,e){return Re(t,e,n=>_e(n,"narration"))}function Ah(t){return be(Math.min(2,Math.max(0,t)))}function Oh(t){let r=t,{offset:e,gain:n}=r,o=qt(r,["offset","gain"]),i=x(v({},o),{at:typeof t.at=="number"?be(Math.max(0,t.at)):t.at});return t.offset!==void 0&&Number.isFinite(t.offset)&&t.offset!==0&&(i.offset=be(t.offset)),t.gain!==void 0&&Number.isFinite(t.gain)&&(i.gain=Ah(t.gain)),i}function Es(t,e,n){let o=t.scenes.length;if(e<0||e>=o)return t;let i=Math.max(0,Math.min(o-1,n));if(i===e)return t;let r=t.scenes.slice(),[s]=r.splice(e,1);return r.splice(i,0,s),x(v({},t),{scenes:r})}function Ph(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"scene"}function Ql(t,e){let n=new Set(t.scenes.map(i=>i.id)),o=Ph(e).replace(/-\d+$/,"")||"scene";if(!n.has(o))return o;for(let i=2;;i++){let r=`${o}-${i}`;if(!n.has(r))return r}}function Lh(t,e){let n=De(t,e);if(n<0)return{doc:t,id:e};let o=x(v({},structuredClone(t.scenes[n])),{id:Ql(t,e)}),i=t.scenes.slice();return i.splice(n+1,0,o),{doc:x(v({},t),{scenes:i}),id:o.id}}function Fh(t,e){if(De(t,e)<0||t.scenes.length<=1)return t;let o=x(v({},t),{scenes:t.scenes.filter(s=>s.id!==e)}),i=o.export?.gif,r=o.poster?.scene===e?_e(o,"poster"):o;return i?.range?.kind==="scene"&&i.range.scene===e?jh(r,_e(i,"range")):r}function Vh(t,e,n){let o=Ph(n);if(o===e||t.scenes.some(a=>a.id===o))return t;let i=Re(t,e,a=>x(v({},a),{id:o}));if(i===t)return t;let r=i.poster?.scene===e?x(v({},i),{poster:x(v({},i.poster),{scene:o})}):i,s=r.export?.gif;return s?.range?.kind==="scene"&&s.range.scene===e?jh(r,x(v({},s),{range:{kind:"scene",scene:o}})):r}function jh(t,e){return t.export?.gif&&Wl(t.export.gif)===Wl(e)?t:x(v({},t),{export:x(v({},t.export),{gif:structuredClone(e)})})}function Yl(t,e){let n=e&&(e.gif!==void 0||e.mp4===!1)?e:void 0;if(fh(t.export)===fh(n))return t;let r=t,{export:o}=r,i=qt(r,["export"]);return n?x(v({},i),{export:structuredClone(n)}):i}function $h(t,e,n){let o=e??t?.gif,i=v(v({},o?{gif:o}:{}),n?{}:{mp4:!1});return i.gif||i.mp4===!1?i:void 0}function fh(t){return JSON.stringify([t?.gif?Wl(t.gif):null,t?.mp4===!1])}function Wl(t){let e=t.range;return JSON.stringify([t.fps,t.width,t.loop,e?.kind,e?.kind==="scene"?e.scene:null,e?.kind==="time"?[e.from,e.to]:null])}var di=class{past=[];future=[];current;lastKey=null;limit;constructor(e,n={}){this.current=e,this.limit=n.limit??200}get present(){return this.current}get canUndo(){return this.past.length>0}get canRedo(){return this.future.length>0}push(e,n){return e===this.current?!1:(n!==void 0&&n===this.lastKey&&this.past.length>0||(this.past.push(this.current),this.past.length>this.limit&&this.past.shift()),this.current=e,this.future=[],this.lastKey=n??null,!0)}breakCoalescing(){this.lastKey=null}undo(){let e=this.past.pop();return e===void 0?null:(this.future.push(this.current),this.current=e,this.lastKey=null,e)}redo(){let e=this.future.pop();return e===void 0?null:(this.past.push(this.current),this.current=e,this.lastKey=null,e)}mapAll(e){this.past=this.past.map(e),this.future=this.future.map(e),this.current=e(this.current)}reset(e){this.past=[],this.future=[],this.current=e,this.lastKey=null}};var Gt=class t{base="";async getProject(){return this.json(await fetch(`${this.base}/api/project`))}async getVideo(e){let n=await fetch(`${this.base}/api/videos/${encodeURIComponent(e)}`),o=n.headers.get("etag");if(n.status===422){let i=await n.json().catch(()=>null);if(i?.doc)return{doc:i.doc,issues:i.issues??[],etag:o};throw new Error(`422: ${(i?.issues??[]).map(r=>r.message).join("; ")||"invalid file"}`)}return{doc:await this.json(n),issues:[],etag:o}}async putVideo(e,n,o){let i={"content-type":"application/json"};o&&(i["if-match"]=o);let r=await fetch(`${this.base}/api/videos/${encodeURIComponent(e)}`,{method:"PUT",headers:i,body:JSON.stringify(n)}),s=await r.json().catch(()=>null);if(r.ok)return{ok:!0,etag:s?.etag??r.headers.get("etag")};if(r.status===409&&s?.doc&&s.etag)return{ok:!1,reason:"stale",etag:s.etag,doc:s.doc};if(r.status===428)return{ok:!1,reason:"precondition-required",message:"Bug: the studio sent the save without the file version (If-Match), so the server refused it. Reload the page and report this."};let a=s?.message??s?.error??(r.status===404?"The file does not exist on disk any more":Bh(r,s));return{ok:!1,issues:s?.issues??[],message:a}}async openLibraryTour(){let e=await fetch(`${this.base}/api/library-tour`,{method:"POST",headers:{"content-type":"application/json"},body:"{}"});return this.json(e)}async startRender(e,n,o){let i=v({file:e,formats:n},o?v({mp4:o.mp4},o.gif?{gif:o.gif}:{}):{}),r=await fetch(`${this.base}/api/render`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i)}),s=await this.json(r);return{jobId:s.jobId,existing:s.existing===!0}}async listRenderJobs(){return this.json(await fetch(`${this.base}/api/render/jobs`))}renderEvents(e,n,o){let i=new EventSource(`${this.base}/api/render/${encodeURIComponent(e)}/events`);return i.onmessage=r=>{try{n(JSON.parse(r.data))}catch{}},i.onerror=()=>{i.close(),o()},()=>i.close()}async getSpeechStatus(e){return this.json(await fetch(`${this.base}/api/speech/${encodeURIComponent(e)}`))}async startSpeech(e,n={}){let o=await fetch(`${this.base}/api/speech/${encodeURIComponent(e)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)}),i=await this.json(o);return{jobId:i.jobId,existing:i.existing===!0}}speechEvents(e,n,o){let i=new EventSource(`${this.base}/api/speech/jobs/${encodeURIComponent(e)}/events`);return i.onmessage=r=>{try{n(JSON.parse(r.data))}catch{}},i.onerror=()=>{i.close(),o()},()=>i.close()}speechClipUrl(e){return`${this.base}/speech/${encodeURIComponent(e)}.wav`}async json(e){if(!e.ok){let n=await e.text().catch(()=>""),o=null;try{o=JSON.parse(n)}catch{o=null}throw new Error(o?.issues?.length?Bh(e,o):`${e.status} ${e.statusText}${n?`: ${n.slice(0,200)}`:""}`)}return await e.json()}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};function Bh(t,e){let n=(e?.issues??[]).map(o=>o.message).filter(o=>typeof o=="string"&&o!=="");return n.length>0?n.join("; "):`${t.status} ${t.statusText}`}var Q=class t{api=w(Gt);saveDelayMs=800;docState=A(null);savedDoc=A(null);historyVersion=A(0);history=new di(null);saveTimer=null;saveChain=Promise.resolve(!0);etag=null;doc=this.docState.asReadonly();file=A(null);project=A(null);loadError=A(null);saveState=A("idle");saveError=A(null);serverIssues=A([]);conflict=A(null);bugError=A(null);openError=A(null);selectedSceneId=A(null);format=A("16:9");saves=A(0);dirty=_(()=>this.docState()!==this.savedDoc());empty=_(()=>this.project()?.videos.length===0&&!this.file());canUndo=_(()=>(this.historyVersion(),this.history.canUndo));canRedo=_(()=>(this.historyVersion(),this.history.canRedo));selectedScene=_(()=>{let e=this.selectedSceneId();return e?this.docState()?.scenes.find(n=>n.id===e)??null:null});async init(){try{let e=await this.api.getProject();this.project.set(e);let n=new URLSearchParams(globalThis.location?.search??"").get("video"),o=e.videos.find(i=>i.file===n)?.file??e.videos[0]?.file;o&&await this.open(o)}catch(e){this.loadError.set(`Could not load the project: ${xs(e)}`)}}async openLibraryTour(){try{let{file:e}=await this.api.openLibraryTour();this.project.set(await this.api.getProject()),await this.open(e)}catch(e){this.openError.set(`Could not open the library tour: ${xs(e)}`)}}watchForFirstVideo(){let e=!1,n=setInterval(()=>{if(this.file())return o();e||(e=!0,this.api.getProject().then(async i=>{this.file()||!i.videos.length||(o(),this.project.set(i),await this.open(i.videos[0].file))}).catch(()=>{}).finally(()=>e=!1))},2e3),o=()=>clearInterval(n);return o}async open(e){this.openError.set(null);let n=this.file();if(this.dirty()&&!await this.save()){let o=this.conflict()?"it changed on disk":this.saveError()??"unknown error";return this.openError.set(`Did not switch to ${e}: saving ${n??"the current video"} failed (${o}). Your edits are still here; resolve the problem, then switch again.`),!1}try{let{doc:o,issues:i,etag:r}=await this.api.getVideo(e);if(this.loadDoc(e,o,r),this.serverIssues.set(i),this.loadError.set(null),globalThis.history&&globalThis.location){let s=new URL(globalThis.location.href);s.searchParams.set("video",e),globalThis.history.replaceState(null,"",s)}}catch(o){return this.loadError.set(`Could not open ${e}: ${xs(o)}`),!1}return!0}loadDoc(e,n,o=null){this.clearTimer(),this.file.set(e),this.etag=o,this.conflict.set(null),this.bugError.set(null),this.openError.set(null),this.history=new di(n),this.docState.set(n),this.savedDoc.set(n),this.historyVersion.update(i=>i+1),this.selectedSceneId.set(null),this.serverIssues.set([]),this.saveState.set("idle"),this.saveError.set(null),!n.formats.includes(this.format())&&n.formats.length&&this.format.set(n.formats[0])}apply(e,n){let o=this.docState();if(!o)return;let i=e(o);i!==o&&(this.history.push(i,n),this.commit(i))}setExport(e){let n=this.docState();if(!n)return;let o=Yl(n,e);o!==n&&(this.history.mapAll(i=>i===n?o:i&&Yl(i,e)),this.commit(o))}endCoalescing(){this.history.breakCoalescing()}undo(){let e=this.history.undo();e&&this.commit(e)}redo(){let e=this.history.redo();e&&this.commit(e)}deleteScene(e){let n=this.docState();if(!n)return;let o=De(n,e),i=Fh(n,e);i!==n&&(this.apply(()=>i),this.select(i.scenes[Math.min(o,i.scenes.length-1)]?.id??null))}select(e){this.selectedSceneId.set(e)}setFormat(e){this.format.set(e)}reloadFromDisk(){let e=this.conflict(),n=this.file();e&&n&&this.loadDoc(n,e.doc,e.etag)}keepMine(){let e=this.conflict();return e?(this.etag=e.etag,this.savedDoc.set(e.doc),this.conflict.set(null),this.saveError.set(null),this.saveState.set("idle"),this.save()):Promise.resolve(!1)}save(){return this.clearTimer(),this.saveChain=this.saveChain.then(()=>this.saveNow()),this.saveChain}async saveNow(){let e=this.file(),n=this.docState();if(!e||!n)return!0;if(this.conflict())return!1;if(n===this.savedDoc())return!0;this.saveState.set("saving");try{let o=await this.api.putVideo(e,n,this.etag);return this.file()!==e?!0:o.ok?(o.etag&&(this.etag=o.etag),this.savedDoc.set(n),this.serverIssues.set([]),this.saveError.set(null),this.bugError.set(null),this.saveState.set("saved"),this.saves.update(i=>i+1),!0):o.reason==="stale"?(this.clearTimer(),this.conflict.set({doc:o.doc,etag:o.etag}),this.saveError.set("This video changed on disk"),this.saveState.set("conflict"),!1):o.reason==="precondition-required"?(this.bugError.set(o.message),this.saveError.set(o.message),this.saveState.set("error"),!1):(this.serverIssues.set(o.issues),this.saveError.set(o.message??"The server refused the file"),this.saveState.set("error"),!1)}catch(o){return this.saveError.set(xs(o)),this.saveState.set("error"),!1}}commit(e){this.docState.set(e),this.historyVersion.update(o=>o+1);let n=this.selectedSceneId();n&&!e.scenes.some(o=>o.id===n)&&this.selectedSceneId.set(null),this.scheduleSave()}scheduleSave(){this.clearTimer(),!this.conflict()&&(this.saveTimer=setTimeout(()=>{this.saveTimer=null,this.save()},this.saveDelayMs))}clearTimer(){this.saveTimer!==null&&(clearTimeout(this.saveTimer),this.saveTimer=null)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};function xs(t){return t instanceof Error?t.message:String(t)}var Cs=["dark","light"];var Hh={"duplicate-format":"a format is listed twice","no-scenes":"the video has no scenes","off-beat":"a scene ends off the music track's beat","captions-no-narration":"captions are on, but no scene has narration","gif-range":"the stored GIF range names a scene or a time the video no longer has","beats-error":"a scene type's beats() failed","sounds-error":"a scene type's sounds() failed","beat-after-end":"a beat is after the end of its scene","unknown-sfx-beat":"a scene type's sound is placed on a beat the scene does not have","invalid-sfx-at":"a scene type's sound has no valid time","unknown-sound":"a scene type's sound is not in the theme","sfx-after-end":"a sound starts after the end of the video","transition-overlap":"the transitions into and out of a scene take longer than the scene","transition-empty":"a slide or zoom moves a scene in before its first beat: an empty page arrives","read-time":"a scene is too short to read","speech-fit":"a narration line runs past the end of its scene","speech-overlap":"a narration line runs into the next scene's line","speech-missing":"a narration line is not spoken yet","speech-fade-in":"a narration line starts inside the video's fade-in","captions-brief":"a caption shows too briefly to read","captions-covers":"a caption covers a text of its scene","svg-text":"an SVG image has live text that can render a few pixels differently","layout-overlap":"two labels of a scene cover each other, or a label covers a point","code-wrap":"code lines are too long for their panel in a format and wrap"},R2=Object.keys(Hh);function dx(t){return typeof t=="string"&&Object.prototype.hasOwnProperty.call(Hh,t)}function Uh(t,e){return new Set([...e?.ignoreWarnings??[],...t?.ignoreWarnings??[]].filter(dx))}function Gh(t){return t.severity==="warning"?t.code:void 0}function ui(t,e,n){let o={kept:[],silenced:[],ids:[]};for(let i of t){let r=e(i);if(r===void 0||!n.has(r)){o.kept.push(i);continue}o.silenced.push(i),o.ids.includes(r)||o.ids.push(r)}return o}function Wh(t,e){return!t?.scenes||t.scenes.includes(e)}function Jl(t,e){return!t?.music?.allowed||t.music.allowed.includes(e)}function Xl(t,e){return!t?.variants||!Cs.includes(e)?!0:t.variants.includes(e)}function ed(t,e){return!t?.transition||t.transition===e}function zh(t,e){if(!t||typeof t!="object"||Array.isArray(t))return t;let n=t.variant,o=e?.variants?.find(i=>Cs.includes(i));return o===void 0||Xl(e,n)?t:x(v({},t),{variant:o})}function qh(t,e){let n=e.filter(i=>Jl(t,i)),o=t?.music?.default;return o!==void 0&&n.includes(o)?[o,...n.filter(i=>i!==o)]:n}var Kh={source:"beatsheet-studio",type:"pause"};function Is(t){if(!t||typeof t!="object")return null;let e=t;if(e.source!=="beatsheet-gallery"||e.type!=="add-scene")return null;let n=e.scene;if(!n||typeof n!="object"||typeof n.id!="string"||typeof n.type!="string"||typeof n.duration!="number"||!Number.isFinite(n.duration)||n.duration<=0||!n.props||typeof n.props!="object"||Array.isArray(n.props))return null;let o={id:n.id,type:n.type,duration:n.duration,props:n.props};return e.sampleId===void 0?{source:"beatsheet-gallery",type:"add-scene",scene:o}:typeof e.sampleId!="string"||!e.sampleId?null:{source:"beatsheet-gallery",type:"add-scene",scene:o,sampleId:e.sampleId}}function kt(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function ux(t,e){switch(t){case"object":return kt(e);case"array":return Array.isArray(e);case"string":return typeof e=="string";case"number":return typeof e=="number"&&Number.isFinite(e);case"integer":return typeof e=="number"&&Number.isInteger(e);case"boolean":return typeof e=="boolean";case"null":return e===null;default:return!0}}function Zh(t,e){return JSON.stringify(t)===JSON.stringify(e)}function fx(t,e){if(!e.startsWith("#/"))return null;let n=t;for(let o of e.slice(2).split("/")){let i=o.replace(/~1/g,"/").replace(/~0/g,"~");if(!kt(n)||!Object.hasOwn(n,i))return null;n=n[i]}return kt(n)?n:null}function Sn(t,e,n,o,i,r){if(!kt(e)||i.length>=8)return;if(r>40){i.push(`${o}: nested too deeply`);return}let s=e;if(typeof s.$ref=="string"){let c=fx(t,s.$ref);c&&Sn(t,c,n,o,i,r+1)}let a=s.type;if(typeof a=="string"||Array.isArray(a)){let c=(Array.isArray(a)?a:[a]).filter(d=>typeof d=="string");if(c.length&&!c.some(d=>ux(d,n))){i.push(`${o}: expected ${c.join(" or ")}`);return}}Array.isArray(s.enum)&&!s.enum.some(c=>Zh(c,n))&&i.push(`${o}: not one of the allowed values`),"const"in s&&!Zh(s.const,n)&&i.push(`${o}: not the allowed value`);for(let c of["anyOf","oneOf"]){let d=s[c];if(!Array.isArray(d)||!d.length)continue;d.some(g=>{let C=[];return Sn(t,g,n,o,C,r+1),C.length===0})||i.push(`${o}: fits none of the allowed shapes`)}if(Array.isArray(s.allOf))for(let c of s.allOf)Sn(t,c,n,o,i,r+1);if(typeof n=="number"){let c=E=>typeof s[E]=="number"?s[E]:null,d=c("minimum"),f=c("maximum"),g=c("exclusiveMinimum"),C=c("exclusiveMaximum");d!==null&&n<d&&i.push(`${o}: below ${d}`),f!==null&&n>f&&i.push(`${o}: above ${f}`),g!==null&&n<=g&&i.push(`${o}: must be above ${g}`),C!==null&&n>=C&&i.push(`${o}: must be below ${C}`)}if(typeof n=="string"&&(typeof s.minLength=="number"&&[...n].length<s.minLength&&i.push(`${o}: shorter than ${s.minLength}`),typeof s.maxLength=="number"&&[...n].length>s.maxLength&&i.push(`${o}: longer than ${s.maxLength}`),typeof s.pattern=="string"))try{new RegExp(s.pattern,"u").test(n)||i.push(`${o}: does not match the pattern`)}catch{}if(Array.isArray(n)&&(typeof s.minItems=="number"&&n.length<s.minItems&&i.push(`${o}: fewer than ${s.minItems} items`),typeof s.maxItems=="number"&&n.length>s.maxItems&&i.push(`${o}: more than ${s.maxItems} items`),kt(s.items)&&n.forEach((c,d)=>Sn(t,s.items,c,`${o}[${d}]`,i,r+1))),kt(n)){let c=kt(s.properties)?s.properties:{};if(Array.isArray(s.required))for(let d of s.required)typeof d=="string"&&!Object.hasOwn(n,d)&&i.push(`${o}.${d}: missing`);for(let[d,f]of Object.entries(n))Object.hasOwn(c,d)?Sn(t,c[d],f,`${o}.${d}`,i,r+1):s.additionalProperties===!1?i.push(`${o}.${d}: not a field of this scene type`):kt(s.additionalProperties)&&Sn(t,s.additionalProperties,f,`${o}.${d}`,i,r+1)}}function td(t,e,n="props"){let o=[];return kt(t)&&Sn(t,t,e,n,o,0),o}function Qh(t){return`/player/?mode=gallery&pick=1#${new URLSearchParams({format:t}).toString()}`}function Yh(t){return{source:"beatsheet-studio",type:"pick-open",format:t}}var Jh={source:"beatsheet-studio",type:"pause"};function Xh(t){if(t&&typeof t=="object"){let e=t;if(e.source==="beatsheet-gallery"&&e.type==="pick-close")return{source:"beatsheet-gallery",type:"pick-close"}}return Is(t)}function eg(t,e){if(!e)return{ok:!1,error:"The project is still loading: try again in a moment."};let n=e.sceneTypes.find(d=>d.id===t.scene.type);if(!n)return{ok:!1,error:`Scene type "${t.scene.type}" is not in this project.`};if(!Wh(e.rules,n.id))return{ok:!1,error:`${n.title} is not allowed by the project's rules.`};let o=t.sampleId??"default",i=n.samples?.find(d=>d.id===o);if(n.samples&&!i)return{ok:!1,error:`${n.title} has no sample "${o}".`};let r=td(n.jsonSchema,t.scene.props);if(r.length)return{ok:!1,error:`The ${n.title} sample doesn't fit its schema (${r.slice(0,3).join("; ")}).`};let s=i?.duration??n.defaultDuration,a=zh(t.scene.props,e.rules),c=a===t.scene.props||td(n.jsonSchema,a).length?t.scene.props:a;return{ok:!0,pick:{type:n,sampleId:o,props:c,duration:s}}}function px(t,e){let n=e?De(t,e):-1;return n<0?t.scenes.length:n+1}function tg(t,e,n){let o=Ql(t,e.sampleId==="default"?e.type.id:`${e.type.id}-${e.sampleId}`),i={id:o,type:e.type.id,duration:be(Math.max(Cn,e.duration||e.type.defaultDuration||3)),props:structuredClone(e.props)},r=t.scenes.slice();return r.splice(px(t,n),0,i),{doc:x(v({},t),{scenes:r}),id:o}}function ng(t,e){return!t||!e||De(t,e)<0?"at the end":`after \u201C${e}\u201D`}var bt=class t{bridge=w(le);store=w(Q);isOpen=A(!1);loaded=A(!1);open(){this.isOpen()||!this.store.doc()||(this.bridge.playing()&&this.bridge.pause(),this.loaded.set(!0),this.isOpen.set(!0))}close(){this.isOpen.set(!1)}add(e){let n=this.store.doc();if(!n)return"Open a video first: the scene goes into the open video.";let o=eg(e,this.bridge.project());if(!o.ok)return o.error;let i=tg(n,o.pick,this.store.selectedSceneId());return this.store.endCoalescing(),this.store.apply(()=>i.doc),this.store.select(i.id),null}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};var og="beatsheet-studio-view";function mx(){try{return globalThis.sessionStorage?.getItem(og)==="gallery"?"gallery":"editor"}catch{return"editor"}}var _t=class t{bridge=w(le);view=A(mx());galleryLoaded=A(this.view()==="gallery");show(e){e==="gallery"&&this.bridge.playing()&&this.bridge.pause(),this.view.set(e),e==="gallery"&&this.galleryLoaded.set(!0);try{globalThis.sessionStorage?.setItem(og,e)}catch{}}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};var hx=["frame"];function gx(t,e){t&1&&(b(0,"div",2),u(1),y()),t&2&&(l(),M(e))}var Ss=class t{picker=w(bt);view=w(_t);frame=Ge.required("frame");notice=A(null);constructor(){let e=n=>this.onMessage(n);globalThis.addEventListener?.("message",e),w(ue).onDestroy(()=>globalThis.removeEventListener?.("message",e)),He(()=>{this.view.view()!=="gallery"&&this.pauseGallery()})}pauseGallery(){this.frame().nativeElement.contentWindow?.postMessage(Kh,globalThis.location?.origin??"/")}onMessage(e){if(e.source!==this.frame().nativeElement.contentWindow||e.origin!==globalThis.location?.origin)return;let n=Is(e.data);if(!n)return;let o=this.picker.add(n);if(o){this.notice.set(o);return}this.notice.set(null),this.view.show("editor")}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-gallery"]],viewQuery:function(n,o){n&1&&Je(o.frame,hx,5),n&2&&dt()},hostAttrs:["role","region","aria-label","Gallery",1,"gallery-pane"],decls:3,vars:1,consts:[["frame",""],["title","Gallery: scene types, sounds and music","src",Zc`/player/?mode=gallery`,1,"gallery-frame"],["role","status",1,"gallery-notice"]],template:function(n,o){if(n&1&&(re(0,"iframe",1,0),T(2,gx,2,1,"div",2)),n&2){let i;l(2),D((i=o.notice())?2:-1,i)}},encapsulation:2})};var ws=class t{store=w(Q);constructor(){w(ue).onDestroy(this.store.watchForFirstVideo())}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-empty-project"]],hostAttrs:["role","region","aria-label","No videos",1,"empty-project"],decls:19,vars:0,consts:[[1,"empty-card"],["type","button",1,"primary",3,"click"],[1,"sf-hint"]],template:function(n,o){n&1&&(b(0,"section",0)(1,"h2"),u(2,"No videos here yet"),y(),b(3,"p"),u(4,"Videos live in "),b(5,"code"),u(6,"videos/"),y(),u(7," in this folder. Tell your agent:"),y(),b(8,"blockquote"),u(9,"I've got an idea for a new beatsheet video - here it is: \u2026"),y(),b(10,"p"),u(11,"Or start from the library tour: a finished video with every kind of scene."),y(),b(12,"button",1),O("click",function(){return o.store.openLibraryTour()}),u(13,"Open the library tour"),y(),b(14,"p",2),u(15,"No agent skill yet? Run "),b(16,"code"),u(17,"npx beatsheet skill install"),y(),u(18,"."),y()())},encapsulation:2})};var yx=/rich[\s-]?text|markup/i,vx=/\[\/?(accent|warn|error|ok|dim|strong|highlight)\]/;function Et(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function bx(t){let e=t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return e?e[0].toUpperCase()+e.slice(1):t}function sg(t){return typeof t=="string"&&vx.test(t)}function Ts(t,e,n=0){let o=t.$ref;if(typeof o!="string"||!o.startsWith("#")||n>20)return t;let i=e;for(let c of o.slice(1).split("/").filter(Boolean))i=Et(i)?i[decodeURIComponent(c.replace(/~1/g,"/").replace(/~0/g,"~"))]:void 0;if(!Et(i))return t;let a=t,{$ref:r}=a,s=qt(a,["$ref"]);return Ts(v(v({},i),s),e,n+1)}function ig(t){return Et(t)&&(t.type==="null"||t.const===null&&t.type===void 0)}function _x(t,e){let n=Ts(t,e),o=n.type;if(Array.isArray(o)&&o.includes("null")){let s=o.filter(a=>a!=="null");return{schema:x(v({},n),{type:s.length===1?s[0]:s}),nullable:!0}}let i=n.anyOf??n.oneOf;if(Array.isArray(i)&&i.some(ig)){let s=i.filter(f=>!ig(f)),r=n,{anyOf:a,oneOf:c}=r,d=qt(r,["anyOf","oneOf"]);return s.length===1&&Et(s[0])?{schema:v(v({},Ts(s[0],e)),d),nullable:!0}:{schema:x(v({},d),{anyOf:s}),nullable:!0}}return{schema:n,nullable:!1}}function Ex(t,e){let n=[];for(let o of t){if(!Et(o))return null;let i=Ts(o,e);if("const"in i)n.push(i.const);else if(Array.isArray(i.enum))n.push(...i.enum);else return null}return n}function xx(t,e,n){return e&&e.length<=40&&!e.includes(`
|
|
13
|
+
`)?{label:e}:{label:t!==null?bx(t):n,hint:e}}function nd(t,e,n,o=Et(t)?t:{},i="Value"){let{schema:r,nullable:s}=_x(Et(t)?t:{},o),a=typeof r.description=="string"?r.description:void 0,{label:c,hint:d}=xx(e,a,i),f={key:e,kind:"json",label:c,hint:d,required:n,nullable:s,richText:typeof r.richText=="boolean"?r.richText:a!==void 0&&yx.test(a),integer:!1,defaultValue:r.default};if(Array.isArray(r.enum))return x(v({},f),{kind:"enum",options:r.enum});if("const"in r)return x(v({},f),{kind:"enum",options:[r.const]});let g=r.anyOf??r.oneOf;if(Array.isArray(g)){let E=Ex(g,o);return E?x(v({},f),{kind:"enum",options:E}):f}let C=r.type;switch(C){case"string":return x(v({},f),{kind:"string"});case"number":case"integer":return x(v({},f),{kind:"number",integer:C==="integer",min:rg(r.minimum??r.exclusiveMinimum),max:rg(r.maximum??r.exclusiveMaximum)});case"boolean":return x(v({},f),{kind:"boolean"});case"object":{let E=r.properties;if(!Et(E))return f;let P=new Set(Array.isArray(r.required)?r.required:[]),Z=Object.entries(E).map(([Y,ve])=>nd(ve,Y,P.has(Y),o));return x(v({},f),{kind:"object",fields:Z})}case"array":{let E=r.items;if(!Et(E))return f;let P=nd(E,null,!0,o,Cx(c));return x(v({},f),{kind:"array",item:P})}default:return f}}function ag(t){let e=Et(t)?t:{};return nd(e,null,!0,e,"Props")}function rg(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function Cx(t){return t.endsWith("s")&&t.length>3?t.slice(0,-1):"Item"}function od(t){if(t.defaultValue!==void 0)return structuredClone(t.defaultValue);switch(t.kind){case"string":return"";case"number":return t.min!==void 0&&t.min>0?t.min:0;case"boolean":return!1;case"enum":return t.options?.[0]??null;case"array":return[];case"object":{let e={};for(let n of t.fields??[])n.required&&n.key!==null&&(e[n.key]=od(n));return e}default:return t.nullable?null:""}}function cg(t,e,n,o){let i=Math.max(0,Math.min(e,n,t.length)),r=Math.min(t.length,Math.max(e,n)),s=`[${o}]`,a=`[/${o}]`,c=t.slice(i,r);return{value:t.slice(0,i)+s+c+a+t.slice(r),start:i+s.length,end:i+s.length+c.length}}var Ix=.05,rd=10,sd=600,lg=80;function Sx(t,e){return t*e}function fi(t,e){return e>0?t/e:0}function Ms(t,e=!0,n=Ix){let o=e?Math.round(t/n)*n:t;return Math.round(o*1e3)/1e3}function Ns(t,e,n){return Math.min(n,Math.max(e,t))}function ks(t){return Ns(t,rd,sd)}function ad(t,e){return Math.max(0,Math.floor(t*e+1e-4))}function pi(t,e){let n=Math.round(t*e);return n>0?(n-1)/e:0}function cd(t,e,n){return Math.min(ad(t,e),Math.max(0,n-1))}function Rs(t,e,n,o){let i=cd(t,e,Math.round(o*e));return Ns((i+n)/e,0,pi(o,e))}function dg(t,e){return ad(t,e)/e}function Ds(t){return String(t).padStart(2,"0")}function ld(t,e){let n=ad(t,e),o=Math.max(1,Math.round(e)),i=Math.floor(n/o);return`${Ds(Math.floor(i/60))}:${Ds(i%60)}.${Ds(n%o)}`}function wx(t){let e=Math.round(t*100)/100;if(e>=60){let n=Math.floor(e/60),o=e-n*60;return`${n}:${Ds(Math.round(o))}`}return`${e}s`}function mi(t){return`${(Math.round(t*100)/100).toFixed(2)}s`}var id=[.05,.1,.25,.5,1,2,5,10,15,30,60];function ug(t,e,n=64){let o=id.find(a=>a*e>=n)??id[id.length-1],i=o/(o*e>=120?5:2),r=[],s=Math.floor(t/i+1e-6);for(let a=0;a<=s;a++){let c=Math.round(a*i*1e3)/1e3,d=Math.abs(c/o-Math.round(c/o))<1e-6;r.push({t:c,x:Sx(c,e),major:d,label:d?wx(c):void 0})}return r}function fg(t,e,n){let o=0;return t.forEach((i,r)=>{r!==e&&(i.start+i.end)/2<n&&o++}),o}function pg(t){return Math.min(160,Math.ceil(t.length*6.2)+3)}function mg(t,e=3,n=4){let o=new Array(e).fill(Number.NEGATIVE_INFINITY);return t.map(({x:i,width:r})=>{let s=o.findIndex(a=>a+n<=i);return s===-1?null:(o[s]=i+r,s)})}function hg(t,e){let n=t.index>0?Fm(t.transitionIn,t.start):null;if(!n)return null;let o=t.transitionIn.kind;return{kind:o,reveal:ii(o)==="reveal",left:n.from*e,width:(n.to-n.from)*e,title:`${o.charAt(0).toUpperCase()}${o.slice(1)} transition (${mi(t.transitionIn.duration)})`}}function ud(t,e){let n=e?.music?.track;if(!n)return;let o=t?.theme.music.find(i=>i.id===n)?.bpm;return typeof o=="number"&&Number.isFinite(o)&&o>0?o:void 0}function yg(t,e){let n=ud(t,e);return n===void 0?void 0:ss(n)}var Tx=12;function vg(t,e){let n=e.beat;if(!e.enabled||n===void 0||!(n>0))return Math.max(Cn,Ms(t,e.enabled));let o=e.start+t,i=oo(e.start,n),r=n*4,s=i+Math.max(1,Math.round((o-i)/r))*r,a=e.pxPerSecond>0?Tx/e.pxPerSecond:0,c=Math.abs(s-o)<=a?s:Ll(o,n,"nearest"),d=oo(e.start+Cn+.005,n);return Math.max(Cn,be(Math.max(c,d)-e.start))}var Dx=6;function bg(t,e,n,o){if(!(n>0)||!(e>0))return{beats:[],bars:[]};let i=[],r=n*4;Wm(t,n).forEach((c,d)=>{if(c===void 0)return;let f=t[d].end;for(let g=c;g<f-.005;g+=r)i.push(g)});let s=c=>i.some(d=>Math.abs(d-c)<=.005),a=[];if(n*o>=Dx){let c=Math.floor(e/n+1e-6);for(let d=1;d<=c;d++){let f=d*n;s(f)||a.push(be(f*o))}}return{beats:a,bars:i.map(c=>be(c*o))}}var Wt=class t{bridge=w(le);store=w(Q);bpm=_(()=>ud(this.bridge.project(),this.store.doc()));beat=_(()=>yg(this.bridge.project(),this.store.doc()));offBeat=_(()=>{let e=this.bpm(),n=this.store.doc();if(e===void 0||!n)return new Map;let o=Gm(n.scenes.map(i=>i.duration),e);return new Map(o.map(i=>[n.scenes[i.index].id,x(v({},i),{sceneId:n.scenes[i.index].id})]))});snapAllChanges=_(()=>{let e=this.beat(),n=this.store.doc();return e===void 0||!n?0:Ih(n,e)});static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};var Mx=2.5;function _g(t){return typeof t.offset=="number"&&Number.isFinite(t.offset)?Math.max(0,t.offset):cs}function Nx(t){return typeof t.speed=="number"&&Number.isFinite(t.speed)?t.speed:Ht.default}function pd(t){let e=si(t);return e?e.split(" ").length:0}function kx(t){return pd(t.text)/Mx/Nx(t)}function Rx(t,e,n){if(!t||typeof t.text!="string")return null;let o=si(t.text),i=fs(e),r=i?Jm(i.engine):void 0;return!o||!i||!r?null:eh(v({engine:r.id,model:r.model,voice:i.voice,text:o,speed:t.speed},n?{fx:n}:{}))}function Eg(t=!1){return t?Qm:io}function Ax(t,e,n=!1){return _g(t)+e+Eg(n)}function xg(t,e){return t?.state==="ready"&&t.need!==void 0&&t.need>e+1e-6}function Cg(t,e,n,o,i=!1,r){let s=t.narration;if(!s)return null;let a={sceneId:t.id,estimate:kx(s),offset:_g(s)};if(!si(s.text??""))return x(v({},a),{key:null,state:"empty"});let c=Rx(s,e,r);if(c===null)return x(v({},a),{key:null,state:"unvoiced"});let d=n.get(c);return d!==void 0?x(v({},a),{key:c,state:"ready",duration:d,need:Ax(s,d,i),tail:Eg(i)}):x(v({},a),{key:c,state:o.has(t.id)?"stale":"missing"})}var fd=t=>`${(Math.round(t*100)/100).toFixed(2)} s`;function Ig(t,e,n,o){let i=n.state==="ready"?n.duration??0:n.estimate;if(!(i>0))return null;let r=t+n.offset,s=r+i,a=As(r*o),c=As(i*o),d=Math.max(r,e),f=s>e+1e-6?{x:As((d-r)*o),width:As((s-d)*o)}:null,g=n.state==="ready"?`clip ${fd(i)}`:`about ${fd(i)} (${Ox[n.state]})`,C=f?` \xB7 runs ${fd(s-e)} past the scene end`:"";return{sceneId:n.sceneId,x:a,width:c,estimate:n.state!=="ready",state:n.state,over:f,title:`${n.sceneId}: ${g}${C}`}}var Ox={ready:"ready",stale:"stale: the line changed since it was spoken",missing:"not spoken yet",empty:"no text",unvoiced:"no voice"};function As(t){return Math.round(t*100)/100}function Px(t,e){switch(e.type){case"loading":return x(v({},t),{phase:"loading"});case"progress":return x(v({},t),{phase:"speaking",sceneId:e.sceneId,done:e.done,total:e.total});case"clip":return t.phase==="speaking"?t:x(v({},t),{phase:"speaking"});case"done":return x(v({},t),{phase:"done",sceneId:null});case"error":return x(v({},t),{phase:"error",sceneId:null,error:e.message})}}function hi(t){switch(t.phase){case"saving":return"Saving\u2026";case"starting":return"Starting\u2026";case"loading":return"Loading the voice engine\u2026";case"speaking":return`Speaking${t.sceneId?` \u201C${t.sceneId}\u201D`:""}${t.total>0?` (${Math.min(t.done+1,t.total)} of ${t.total})`:""}\u2026`;case"done":return"Speech generated";case"error":return t.error??"Speech failed"}}var et=class t{api=w(Gt);store=w(Q);bridge=w(le);refreshDelayMs=300;createAudio=e=>new Audio(e);status=A(null);statusError=A(null);job=A(null);playingKey=A(null);playError=A(null);ready=A(new Map);spoken=A(new Set);refreshTimer=null;stream=null;audio=null;voice=_(()=>{let e=this.store.doc();return e?Xm(e,this.bridge.project()??void 0):void 0});voiceFx=_(()=>{let e=this.store.doc();return e?Ym(e,this.bridge.project()??void 0):void 0});engine=_(()=>fs(this.voice())?.engine??null);engines=_(()=>this.status()?.engines??this.bridge.project()?.speechEngines??[]);available=_(()=>this.status()?.available??null);engineMissing=_(()=>{let e=this.available(),n=this.engine();return e!==null&&n!==null&&!e.includes(n)});scenes=_(()=>{let e=this.store.doc(),n=this.voice(),o=this.voiceFx(),i=this.ready(),r=this.spoken(),s=new Map,a=e?.scenes??[];for(let[c,d]of a.entries()){let f=Cg(d,n,i,r,c===a.length-1,o);f&&s.set(d.id,f)}return s});toSpeak=_(()=>[...this.scenes().values()].filter(e=>e.state==="missing"||e.state==="stale").length);running=_(()=>{let e=this.job();return e!==null&&e.file===this.store.file()&&e.phase!=="done"&&e.phase!=="error"});currentJob=_(()=>{let e=this.job();return e&&e.file===this.store.file()?e:null});of(e){return this.scenes().get(e)??null}open(e){this.stop(),this.clearTimer(),this.status.set(null),this.statusError.set(null),this.setReady(new Map),this.spoken.set(new Set),e&&this.refresh()}scheduleRefresh(){this.clearTimer(),this.refreshTimer=setTimeout(()=>{this.refreshTimer=null,this.refresh()},this.refreshDelayMs)}async refresh(e=!1){let n=this.store.file();if(!n)return;try{let i=await this.api.getSpeechStatus(n);if(this.store.file()!==n)return;this.applyStatus(i),this.statusError.set(null)}catch(i){this.store.file()===n&&this.statusError.set(`Could not load the speech status: ${md(i)}`)}if(this.store.file()!==n)return;let o=this.ready();(e||this.bridge.missingSpeech().some(i=>o.has(i.key)))&&this.bridge.reload()}async generate(e){let n=this.store.file();if(!(!n||this.running())){if(this.job.set({file:n,jobId:null,scenes:e??null,phase:"saving",done:0,total:0,sceneId:null,error:null,notice:null}),!await this.store.save()){this.patch(n,{phase:"error",error:`Save failed: ${this.store.saveError()??"unknown error"}. The server speaks the saved file: fix the problems and try again.`});return}this.patch(n,{phase:"starting"});try{let{jobId:o,existing:i}=await this.api.startSpeech(n,e?{scenes:e}:{});this.patch(n,i?{jobId:o,scenes:null,notice:"Speech for this video was already being generated: following that job."}:{jobId:o}),this.listen(n,o)}catch(o){this.patch(n,{phase:"error",error:`Could not start speaking: ${md(o)}`})}}}play(e){this.stop(),this.bridge.playing()&&this.bridge.pause();let n=this.createAudio(this.api.speechClipUrl(e));this.audio=n,this.playingKey.set(e),this.playError.set(null);let o=()=>{this.audio===n&&(this.audio=null,this.playingKey.set(null))};n.onended=o,n.play().catch(i=>{this.audio===n&&(o(),this.playError.set(`Could not play the clip: ${md(i)}`))})}stop(){this.audio?.pause(),this.audio=null,this.playingKey.set(null)}toggle(e){this.playingKey()===e?this.stop():this.play(e)}applyStatus(e){this.status.set(e);let n=new Map(this.ready()),o=new Set(this.spoken());for(let i of e.scenes)i.state==="ready"?(n.set(i.key,i.duration??0),o.add(i.sceneId)):n.delete(i.key);this.setReady(n),this.spoken.set(o)}setReady(e){this.ready.set(e),this.bridge.speechDurations=Object.fromEntries([...e].filter(([,n])=>n>0))}listen(e,n){this.stream?.close();let o=!1,i=this.api.speechEvents(n,r=>{let s=this.job();!s||s.jobId!==n||(r.type==="clip"&&this.store.file()===e&&(this.setReady(new Map(this.ready()).set(r.key,r.duration)),this.spoken.update(a=>new Set(a).add(r.sceneId))),this.job.set(Px(s,r)),(r.type==="done"||r.type==="error")&&(o=!0,this.stopListening(n),this.finish(e)))},()=>{if(this.stream?.jobId===n&&(this.stream=null),o)return;let r=this.job();r?.jobId===n&&r.phase!=="done"&&r.phase!=="error"&&this.job.set(x(v({},r),{phase:"error",sceneId:null,error:"The progress stream closed before the speech was done; the clips made so far are kept."})),this.finish(e)});this.stream={jobId:n,close:i}}stopListening(e){this.stream?.jobId===e&&(this.stream.close(),this.stream=null)}async finish(e){this.store.file()===e&&await this.refresh(!0)}patch(e,n){this.job.update(o=>o&&o.file===e?v(v({},o),n):o)}clearTimer(){this.refreshTimer!==null&&(clearTimeout(this.refreshTimer),this.refreshTimer=null)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};function md(t){return t instanceof Error?t.message:String(t)}var ao=t=>String(Math.round(t*100)/100);function Lx(t){let e=`${ao(t.words)} words`;if(t.leaves!==void 0){let o=t.kind==="scene"?`${e} gone by then`:`${e} in \u201C${t.text??t.element??""}\u201D`;return`Gone too early to read (${t.format}): needs ${ao(t.need)} s, has ${ao(t.has)} s until ${ao(t.leaves)} s \xB7 ${o} \xB7 slow it down or move its beats`}let n=t.kind==="scene"?`all ${e}`:`${e} in \u201C${t.text??t.element??""}\u201D`;return`Too short to read (${t.format}): needs ${ao(t.duration+t.missing)} s, has ${ao(t.duration)} s \xB7 ${n}`}function Fx(t,e,n){let o=new Set(n.filter(i=>i.path[0]==="scenes"&&i.path[1]===t).map(i=>i.message));return e.filter(i=>!o.has(i))}var tt=class t{bridge=w(le);store=w(Q);speech=w(et);ignored=_(()=>Uh(this.store.doc()??void 0,this.bridge.project()?.rules));validationSplit=_(()=>{let e=new Set,n=[];for(let o of[...this.bridge.validation()?.issues??[],...this.store.serverIssues()]){let i=`${o.path.join(".")}|${o.message}`;e.has(i)||(e.add(i),n.push(o))}return ui(n,Gh,this.ignored())});validationIssues=_(()=>this.validationSplit().kept);readTimeSplit=_(()=>{let e=this.bridge.readTime(),n=this.store.doc();if(!e||!n||e.format!==this.store.format())return ui([],()=>"read-time",this.ignored());let o=e.issues.flatMap(i=>{let r=De(n,i.sceneId);if(r<0||n.scenes[r].duration!==i.duration)return[];let s=Lx(i);return[{sceneId:i.sceneId,index:r,issue:i,message:s,validation:{path:["scenes",r,"duration"],message:s,severity:"warning"}}]});return ui(o,()=>"read-time",this.ignored())});readTime=_(()=>this.readTimeSplit().kept);speechFitSplit=_(()=>{let n=(this.store.doc()?.scenes??[]).filter(o=>xg(this.speech.of(o.id),o.duration)).map(o=>o.id);return ui(n,()=>"speech-fit",this.ignored())});silenced=_(()=>{let e=[this.validationSplit(),this.readTimeSplit(),this.speechFitSplit()];return{count:e.reduce((n,o)=>n+o.silenced.length,0),ids:[...new Set(e.flatMap(n=>n.ids))]}});silencedLabel=_(()=>this.silenced().count?`${this.silenced().count} silenced`:"");silencedNote=_(()=>this.silenced().count?`${this.silencedLabel()} (${this.silenced().ids.join(", ")}) by ignoreWarnings`:"");all=_(()=>[...this.validationIssues(),...this.readTime().map(e=>e.validation)]);errorCount=_(()=>this.all().filter(e=>e.severity==="error").length);readTimeOf(e){return this.readTime().find(n=>n.sceneId===e)??null}speechFitShown(e){return this.speechFitSplit().kept.includes(e)}sceneWarnings(e){return Fx(e.index,e.warnings,this.validationSplit().silenced)}isReadTime(e){return this.readTime().some(n=>n.validation===e)}at(e){return this.all().filter(n=>ms(n.path,e))}under(e){return this.all().filter(n=>lh(n.path,e)).map(n=>x(v({},n),{path:n.path.slice(e.length)}))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};var hd=()=>[],Sg=(t,e)=>e.key;function Vx(t,e){if(t&1){let n=j();h(0,"app-schema-field",5),k("edit",function(i){I(n);let r=p(3);return S(r.edit.emit(i))}),m()}if(t&2){let n=e.$implicit,o=p(3);N("field",n)("value",o.childValue(n))("path",o.childPath(n.key))("issues",o.issues())("depth",o.depth()+1)}}function jx(t,e){if(t&1&&L(0,Vx,1,5,"app-schema-field",4,Sg),t&2){p(2);let n=we(0);F(n.fields??Te(0,hd))}}function $x(t,e){t&1&&(h(0,"span",6),u(1," optional"),m())}function Bx(t,e){if(t&1&&(h(0,"p",7),u(1),m()),t&2){p(3);let n=we(0);l(),M(n.hint)}}function Hx(t,e){if(t&1){let n=j();h(0,"app-schema-field",5),k("edit",function(i){I(n);let r=p(3);return S(r.edit.emit(i))}),m()}if(t&2){let n=e.$implicit,o=p(3);N("field",n)("value",o.childValue(n))("path",o.childPath(n.key))("issues",o.issues())("depth",o.depth()+1)}}function Ux(t,e){if(t&1&&(h(0,"fieldset",3)(1,"legend"),u(2),T(3,$x,2,0,"span",6),m(),T(4,Bx,2,1,"p",7),L(5,Hx,1,5,"app-schema-field",4,Sg),m()),t&2){p(2);let n=we(0);l(2),M(n.label),l(),D(n.required?-1:3),l(),D(n.hint?4:-1),l(),F(n.fields??Te(3,hd))}}function Gx(t,e){if(t&1&&T(0,jx,2,1)(1,Ux,7,4,"fieldset",3),t&2){let n=p();D(n.depth()===0?0:1)}}function Wx(t,e){if(t&1&&(h(0,"p",7),u(1),m()),t&2){p(2);let n=we(0);l(),M(n.hint)}}function zx(t,e){if(t&1){let n=j();h(0,"app-schema-field",5),k("edit",function(i){I(n);let r=p(3);return S(r.edit.emit(i))}),m()}if(t&2){let n=e,o=p(),i=o.$implicit,r=o.$index,s=p(2);N("field",n)("value",i)("path",s.childPath(r))("issues",s.issues())("depth",n.kind==="object"?0:s.depth()+1)}}function qx(t,e){if(t&1){let n=j();h(0,"div",9)(1,"div",11)(2,"span",12),u(3),m(),h(4,"span",13),u(5),m(),h(6,"button",14),k("click",function(){let i=I(n).$index,r=p(2);return S(r.moveItem(i,-1))}),u(7,"\u2191"),m(),h(8,"button",15),k("click",function(){let i=I(n).$index,r=p(2);return S(r.moveItem(i,1))}),u(9,"\u2193"),m(),h(10,"button",16),k("click",function(){let i=I(n).$index,r=p(2);return S(r.removeItem(i))}),u(11,"\u2715"),m()(),T(12,zx,1,5,"app-schema-field",4),m()}if(t&2){let n,o=e.$implicit,i=e.$index,r=e.$count,s=p(2),a=we(0);l(3),M(i+1),l(2),M(s.itemTitle(o)),l(),N("disabled",i===0),z("aria-label","Move "+a.label+" item "+(i+1)+" up"),l(2),N("disabled",i===r-1),z("aria-label","Move "+a.label+" item "+(i+1)+" down"),l(2),z("aria-label","Remove "+a.label+" item "+(i+1)),l(2),D((n=a.item)?12:-1,n)}}function Kx(t,e){if(t&1){let n=j();h(0,"fieldset",1)(1,"legend"),u(2),h(3,"span",8),u(4),m()(),T(5,Wx,2,1,"p",7),L(6,qx,13,8,"div",9,oe),h(8,"button",10),k("click",function(){I(n);let i=p();return S(i.addItem())}),u(9),m()()}if(t&2){let n=p(),o=we(0);l(2),B("",o.label," "),l(2),M(n.items().length),l(),D(o.hint?5:-1),l(),F(n.items()),l(3),B("+ Add ",n.itemLabel())}}function Zx(t,e){if(t&1){let n=j();h(0,"input",22),k("change",function(i){I(n);let r=p(2);return S(r.emitValue(r.checked(i),!1))}),m(),h(1,"label",18),u(2),m()}if(t&2){let n=p(2),o=we(0);N("id",n.id)("checked",n.value()===!0),l(),N("for",n.id),l(),M(o.label)}}function Qx(t,e){t&1&&(h(0,"span",6),u(1," optional"),m())}function Yx(t,e){if(t&1&&(h(0,"label",18),u(1),T(2,Qx,2,0,"span",6),m()),t&2){let n=p(2),o=we(0);N("for",n.id),l(),B(" ",o.label),l(),D(o.required?-1:2)}}function Jx(t,e){if(t&1){let n=j();h(0,"button",27),k("mousedown",function(i){return i.preventDefault()})("click",function(){let i=I(n).$implicit;p();let r=yl(4),s=p(3);return S(s.wrap(r,i))}),u(1),m()}if(t&2){let n=e.$implicit;vl(bl("rt-tag rt-",n)),z("aria-label","Wrap selection in "+n),l(),M(n)}}function Xx(t,e){if(t&1){let n=j();h(0,"div",24),L(1,Jx,2,5,"button",25,me),m(),h(3,"textarea",26,0),k("input",function(i){I(n);let r=p(3);return S(r.onText(i))}),m()}if(t&2){let n=p(3),o=we(0);z("aria-label","Markup for "+o.label),l(),F(n.richTags),l(2),N("id",n.id)("value",n.stringValue())}}function eC(t,e){if(t&1){let n=j();h(0,"input",28),k("input",function(i){I(n);let r=p(3);return S(r.onText(i))}),m()}if(t&2){let n=p(3);N("id",n.id)("value",n.stringValue())}}function tC(t,e){if(t&1&&T(0,Xx,5,3)(1,eC,1,2,"input",23),t&2){let n=p(2);D(n.multiline()?0:1)}}function nC(t,e){if(t&1){let n=j();h(0,"input",29),k("input",function(i){I(n);let r=p(2);return S(r.onNumber(i))}),m()}if(t&2){let n=p(2),o=we(0);N("id",n.id)("value",n.value()??"")("step",o.integer?1:.05),z("min",o.min??null)("max",o.max??null)}}function oC(t,e){if(t&1&&(h(0,"option",31),u(1,"\u2014"),m()),t&2){let n=p(3);N("selected",n.value()===void 0)}}function iC(t,e){if(t&1&&(h(0,"option",32),u(1),m()),t&2){let n=e.$implicit,o=e.$index,i=p(3);N("value",o)("selected",n===i.value()),l(),M(i.optionLabel(n))}}function rC(t,e){if(t&1){let n=j();h(0,"select",30),k("change",function(i){I(n);let r=p(2);return S(r.onEnum(i))}),T(1,oC,2,1,"option",31),L(2,iC,2,3,"option",32,oe),m()}if(t&2){let n=p(2),o=we(0);N("id",n.id),l(),D(!o.required||n.value()===void 0?1:-1),l(),F(o.options??Te(2,hd))}}function sC(t,e){if(t&1&&(h(0,"p",34),u(1),m()),t&2){let n=p(3);l(),M(n.jsonError())}}function aC(t,e){if(t&1){let n=j();h(0,"textarea",33),k("change",function(i){I(n);let r=p(2);return S(r.onJson(i))}),m(),T(1,sC,2,1,"p",34)}if(t&2){let n=p(2);N("id",n.id)("value",n.jsonText()),l(),D(n.jsonError()?1:-1)}}function cC(t,e){if(t&1&&(h(0,"p",7),u(1),m()),t&2){p(2);let n=we(0);l(),M(n.hint)}}function lC(t,e){if(t&1&&(h(0,"p",34),u(1),m()),t&2){let n=e.$implicit;q("warning",n.severity==="warning"),l(),M(n.message)}}function dC(t,e){if(t&1&&(h(0,"div",17),T(1,Zx,3,4)(2,Yx,3,3,"label",18),T(3,tC,2,1)(4,nC,1,5,"input",19)(5,rC,4,3,"select",20)(6,aC,2,3),T(7,cC,2,1,"p",7),L(8,lC,2,3,"p",21,oe),m()),t&2){let n,o=p(),i=we(0);q("sf-inline",i.kind==="boolean")("has-error",o.myIssues().length>0),l(),D(i.kind==="boolean"?1:2),l(2),D((n=i.kind)==="string"?3:n==="number"?4:n==="enum"?5:n==="json"?6:-1),l(4),D(i.hint?7:-1),l(),F(o.myIssues())}}var uC=["accent","warn","error","ok","dim","strong","highlight"],fC=0,Os=class t{field=to.required();value=to();path=to([]);issues=to([]);depth=to(0);edit=eo();id=`sf-${fC++}`;richTags=uC;jsonError=A(null);myIssues=_(()=>this.issues().filter(e=>ms(e.path,this.path())));items=_(()=>{let e=this.value();return Array.isArray(e)?e:[]});stringValue=_(()=>{let e=this.value();return typeof e=="string"?e:e==null?"":String(e)});multiline=_(()=>{let e=this.stringValue();return this.field().richText||sg(e)||e.includes(`
|
|
14
|
+
`)});jsonText=_(()=>JSON.stringify(this.value()??null,null,2));itemLabel=_(()=>(this.field().item?.label??"item").toLowerCase());childValue(e){let n=this.value();return n!==null&&typeof n=="object"&&e.key!==null?n[e.key]:void 0}childPath(e){return e===null?this.path():[...this.path(),e]}itemTitle(e){if(e===null||typeof e!="object")return"";let n=e,o=["label","kind","title","text","src"].map(r=>n[r]).find(r=>typeof r=="string"&&r),i=typeof o=="string"?o.replace(/\[\/?[a-z]+\]/g,""):"";return i.length>32?`${i.slice(0,32)}\u2026`:i}optionLabel(e){return e===null?"none":String(e)}checked(e){return e.target.checked}emitValue(e,n){this.edit.emit({path:this.path(),value:e,coalesce:n})}onText(e){let n=e.target.value,o=this.field();n===""&&!o.required?this.emitValue(o.nullable?null:void 0,!0):this.emitValue(n,!0)}onNumber(e){let n=e.target;if(n.value===""){this.field().required||this.emitValue(void 0,!0);return}let o=n.valueAsNumber;Number.isFinite(o)&&this.emitValue(o,!0)}onEnum(e){let n=e.target.value;if(n===""){this.emitValue(void 0,!1);return}this.emitValue(this.field().options?.[Number(n)],!1)}onJson(e){let n=e.target.value;try{this.emitValue(JSON.parse(n),!1),this.jsonError.set(null)}catch(o){this.jsonError.set(`Invalid JSON: ${o instanceof Error?o.message:String(o)}`)}}wrap(e,n){let o=cg(e.value,e.selectionStart,e.selectionEnd,n);e.value=o.value,e.focus(),e.setSelectionRange(o.start,o.end),this.emitValue(o.value,!1)}addItem(){let e=this.field().item;e&&this.emitValue([...this.items(),od(e)],!1)}removeItem(e){this.emitValue(this.items().filter((n,o)=>o!==e),!1)}moveItem(e,n){let o=this.items().slice(),i=e+n;i<0||i>=o.length||([o[e],o[i]]=[o[i],o[e]],this.emitValue(o,!1))}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-schema-field"]],inputs:{field:[1,"field"],value:[1,"value"],path:[1,"path"],issues:[1,"issues"],depth:[1,"depth"]},outputs:{edit:"edit"},decls:4,vars:2,consts:[["ta",""],[1,"sf-group","sf-array"],[1,"sf-field",3,"sf-inline","has-error"],[1,"sf-group"],[3,"field","value","path","issues","depth"],[3,"edit","field","value","path","issues","depth"],[1,"sf-optional"],[1,"sf-hint"],[1,"sf-count"],[1,"sf-item"],["type","button",1,"ghost","sf-add",3,"click"],[1,"sf-item-head"],[1,"sf-item-no"],[1,"sf-item-title"],["type","button","title","Move up",1,"icon",3,"click","disabled"],["type","button","title","Move down",1,"icon",3,"click","disabled"],["type","button","title","Remove",1,"icon","danger",3,"click"],[1,"sf-field"],[3,"for"],["type","number",3,"id","value","step"],[3,"id"],["role","alert",1,"sf-issue",3,"warning"],["type","checkbox",3,"change","id","checked"],["type","text",3,"id","value"],["role","toolbar",1,"rt-toolbar"],["type","button",3,"class"],["rows","3",3,"input","id","value"],["type","button",3,"mousedown","click"],["type","text",3,"input","id","value"],["type","number",3,"input","id","value","step"],[3,"change","id"],["value","",3,"selected"],[3,"value","selected"],["rows","4",1,"mono",3,"change","id","value"],["role","alert",1,"sf-issue"]],template:function(n,o){if(n&1&&(Xn(0),T(1,Gx,2,1)(2,Kx,10,4,"fieldset",1)(3,dC,10,7,"div",2)),n&2){let i,r=Qo(o.field());l(),D((i=r.kind)==="object"?1:i==="array"?2:3)}},dependencies:[t],encapsulation:2})};var pC=.5,mC=.6;function wg(t,e,n){if(!e?.variants||t.kind!=="object"||!t.fields)return t;let o=n&&typeof n=="object"?n.variant:void 0,i=t.fields.map(r=>r.key!=="variant"||r.kind!=="enum"||!r.options?.some(s=>Cs.includes(s))?r:x(v({},r),{options:r.options.filter(s=>Xl(e,s)||s===o)}));return x(v({},t),{fields:i})}function Tg(t,e,n){let o=new Map(t.map(s=>[s.id,s])),i=e?.music?.default,r=qh(e,t.map(s=>s.id)).map(s=>{let a=o.get(s);return s===i?{id:s,title:`${a.title} (default)`}:a});return n!==void 0&&o.has(n)&&!Jl(e,n)&&r.push({id:n,title:`${o.get(n).title} (not allowed)`}),{tracks:r,noMusic:!e?.music?.required||n===void 0}}function Dg(t,e,n){return{themeDefault:ed(t,e)||n===void 0,kinds:os.filter(o=>ed(t,o)||n===o)}}function gd(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Mg(t){let e=ii(t);return e==="cut"?0:e==="reveal"?mC:pC}var Ng=["300","400","500","600","700","800"],yd=["bs-weight-display","bs-accent"];function kg(t){return t.startsWith("--")?t.slice(2):t}function vd(t,e,n){let i=Object.entries(t?.tokens??{}).find(([r])=>kg(r)===e)?.[1]??Bl[e];return i===void 0?null:Ul(i,n)}function Rg(t){return[...Hl({tokens:t?.tokens??{}})].sort()}function Ag(t,e){return Hl({tokens:t?.tokens??{}}).has(kg(e.trim()))}function Ps(t){return ch({motion:t?.motion})}function Og(t){return zm(t?.grain)}function Pg(t){let e=t&&no.includes(t.kind)?t.kind:"none",n=t?.strength;return{kind:e,strength:typeof n=="number"&&Number.isFinite(n)?Math.min(1,Math.max(0,n)):.5}}function Lg(t){return Pg(t?.backdrop)}function Fg(t,e){return Pg(t?.backdrop??e?.backdrop)}function Vg(t){return typeof t=="string"||typeof t=="number"?String(t):JSON.stringify(t)}function bd(t){let e=t.trim();if(e.startsWith("{"))try{let n=JSON.parse(e);if(n&&typeof n=="object"&&!Array.isArray(n)&&"base"in n&&Object.values(n).every(o=>typeof o=="string"))return n}catch{}return e}function _d(t){let e=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t?.trim()??"");if(!e)return null;let n=e[1].toLowerCase();return`#${n.length===3?[...n].map(o=>o+o).join(""):n}`}function Ed(t,e,n){let o=t.tokens?.[e];return o===void 0?null:Ul(o,n)}var gC=()=>["captions"],yC=(t,e)=>e.key;function vC(t,e){if(t&1&&(b(0,"option",7),u(1),y()),t&2){let n=e.$implicit,o=p(2);R("value",n)("selected",o.weight()===n),l(),M(n)}}function bC(t,e){if(t&1&&(b(0,"option",53),u(1),y()),t&2){let n=p();R("value",n),l(),M(n)}}function _C(t,e){if(t&1&&T(0,bC,2,2,"option",53),t&2){let n=p(2);D(n.weights.includes(e)?-1:0)}}function EC(t,e){if(t&1&&(b(0,"option",7),u(1),y()),t&2){let n=e.$implicit,o=p(),i=p();R("value",n)("selected",o.motion?.entrance===n),l(),M(i.entranceLabels[n])}}function xC(t,e){t&1&&(b(0,"p",22),u(1,"Grain makes the MP4 about 1 MB larger per second of video. GIFs leave it out."),y())}function CC(t,e){if(t&1&&(b(0,"option",7),u(1),y()),t&2){let n=e.$implicit,o=p(),i=p();R("value",n)("selected",o.backdrop?.kind===n),l(),M(i.backdropLabels[n])}}function IC(t,e){t&1&&(b(0,"p",28),u(1,"A slow background behind light scenes, running through cuts and transitions. Dark and accent scenes cover it."),y())}function SC(t,e){if(t&1){let n=j();b(0,"div",31)(1,"label",54),u(2),y(),b(3,"input",55),O("change",function(i){let r=I(n).$implicit,s=p(2);return S(s.onTokenValue(r.key,i))}),y(),b(4,"button",56),O("click",function(){let i=I(n).$implicit,r=p(2);return S(r.resetToken(i.key))}),u(5,"\u2715"),y()()}if(t&2){let n=e.$implicit;l(),R("htmlFor","look-token-"+n.key)("title",n.key),l(),M(n.key),l(),R("id","look-token-"+n.key)("value",n.text),l(),z("aria-label","Remove "+n.key+" (theme default)")}}function wC(t,e){if(t&1&&(b(0,"p",32),u(1),y()),t&2){let n=e.$implicit;l(),M(n.message)}}function TC(t,e){if(t&1&&re(0,"option",38),t&2){let n=e.$implicit;R("value",n)}}function DC(t,e){t&1&&(b(0,"p",39),u(1),y()),t&2&&(l(),M(e))}function MC(t,e){if(t&1&&(b(0,"p",32),u(1),y()),t&2){let n=e.$implicit;l(),M(n.message)}}function NC(t,e){if(t&1){let n=j();b(0,"fieldset",0)(1,"legend"),u(2,"Look"),y(),b(3,"p",1),u(4,"Overrides of the theme for this video. \u201CTheme default\u201D removes the override."),y(),b(5,"div",2)(6,"div",3)(7,"label",4),u(8,"Display weight"),y(),b(9,"select",5),O("change",function(i){I(n);let r=p();return S(r.onWeight(i))}),b(10,"option",6),u(11),y(),L(12,vC,2,3,"option",7,me),T(14,_C,1,1),y()(),b(15,"div",3)(16,"label",8),u(17,"Entrance style"),y(),b(18,"select",9),O("change",function(i){I(n);let r=p();return S(r.onEntrance(i))}),b(19,"option",6),u(20),y(),L(21,EC,2,3,"option",7,me),y()()(),b(23,"div",3)(24,"label",10),u(25,"Accent colour"),y(),b(26,"span",11)(27,"input",12),O("input",function(i){I(n);let r=p();return S(r.onAccent(i))})("change",function(){I(n);let i=p();return S(i.store.endCoalescing())}),y(),b(28,"output",13),u(29),y(),b(30,"button",14),O("click",function(){I(n);let i=p();return S(i.resetToken("bs-accent"))}),u(31,"Theme default"),y()()(),b(32,"div",3)(33,"label",15),u(34,"Camera push"),y(),b(35,"span",16)(36,"input",17),O("input",function(i){I(n);let r=p();return S(r.onPush(i))})("change",function(){I(n);let i=p();return S(i.store.endCoalescing())}),y(),b(37,"output",18),u(38),y(),b(39,"button",14),O("click",function(){I(n);let i=p();return S(i.onResetPush())}),u(40,"Theme default"),y()()(),b(41,"div",3)(42,"label",19),u(43,"Film grain"),y(),b(44,"span",16)(45,"input",20),O("input",function(i){I(n);let r=p();return S(r.onGrain(i))})("change",function(){I(n);let i=p();return S(i.store.endCoalescing())}),y(),b(46,"output",21),u(47),y(),b(48,"button",14),O("click",function(){I(n);let i=p();return S(i.onResetGrain())}),u(49,"Theme default"),y()(),T(50,xC,2,0,"p",22),y(),b(51,"div",3)(52,"label",23),u(53,"Backdrop"),y(),b(54,"select",24),O("change",function(i){I(n);let r=p();return S(r.onBackdropKind(i))}),b(55,"option",6),u(56),y(),L(57,CC,2,3,"option",7,me),y()(),b(59,"div",3)(60,"label",25),u(61,"Backdrop strength"),y(),b(62,"span",16)(63,"input",26),O("input",function(i){I(n);let r=p();return S(r.onBackdropStrength(i))})("change",function(){I(n);let i=p();return S(i.store.endCoalescing())}),y(),b(64,"output",27),u(65),y(),b(66,"button",14),O("click",function(){I(n);let i=p();return S(i.onResetBackdropStrength())}),u(67,"Default"),y()(),T(68,IC,2,0,"p",28),y(),b(69,"details",29)(70,"summary",30),u(71),y(),L(72,SC,6,6,"div",31,yC),L(74,wC,2,1,"p",32,oe),b(76,"div",33)(77,"input",34),O("input",function(i){I(n);let r=p();return S(r.newKey.set(r.text(i)))}),y(),b(78,"input",35),O("input",function(i){I(n);let r=p();return S(r.newValue.set(r.text(i)))})("keydown.enter",function(){I(n);let i=p();return S(i.onAddToken())}),y(),b(79,"button",36),O("click",function(){I(n);let i=p();return S(i.onAddToken())}),u(80,"Add"),y()(),b(81,"datalist",37),L(82,TC,1,1,"option",38,me),y(),T(84,DC,2,1,"p",39),b(85,"p",40),u(86,"Any token the theme knows (the rule "),b(87,"code"),u(88,"check"),y(),u(89),y()()(),b(90,"fieldset",41)(91,"legend"),u(92,"Captions"),y(),b(93,"div",42)(94,"input",43),O("change",function(i){I(n);let r=p();return S(r.onCaptionsOn(i))}),y(),b(95,"label",44),u(96,"Burn in captions of the narration"),y()(),b(97,"div",2)(98,"div",3)(99,"label",45),u(100,"Style"),y(),b(101,"select",46),O("change",function(i){I(n);let r=p();return S(r.onCaptionStyle(i))}),b(102,"option",47),u(103,"Bar"),y(),b(104,"option",48),u(105,"Plain (shadow, no bar)"),y()()(),b(106,"div",3)(107,"label",49),u(108,"Position"),y(),b(109,"select",50),O("change",function(i){I(n);let r=p();return S(r.onCaptionPosition(i))}),b(110,"option",51),u(111,"Bottom"),y(),b(112,"option",52),u(113,"Top"),y()()()(),b(114,"p",40),u(115,"The narration, written, while it is spoken. A scene hides its own, or shows a written form, in its narration."),y(),L(116,MC,2,1,"p",32,oe),y()}if(t&2){let n,o,i=e,r=p();l(10),R("selected",r.weight()===null),l(),B("Theme default (",r.themeWeight(),")"),l(),F(r.weights),l(2),D((n=r.weight())?14:-1,n),l(5),R("selected",i.motion?.entrance===void 0),l(),B("Theme default (",r.themeMotion().entrance,")"),l(),F(r.entrances),l(6),R("value",r.accentHex()),l(),q("muted",r.accent()===null),l(),M(r.accent()??r.themeAccent()??"theme"),l(),R("disabled",r.accent()===null),l(6),R("max",r.pushMax)("value",r.push()),l(),q("muted",i.motion?.push===void 0),l(),M(r.label(r.push())),l(),R("disabled",i.motion?.push===void 0),l(6),R("max",r.grainMax)("value",r.grain()),l(),q("muted",i.grain===void 0),l(),M(r.label(r.grain())),l(),R("disabled",i.grain===void 0),l(2),D(r.grain()>0?50:-1),l(5),R("selected",i.backdrop===void 0),l(),B("Theme default (",r.backdropLabels[r.themeBackdrop().kind],")"),l(),F(r.backdrops),l(6),R("step",r.backdropStep)("value",r.backdrop().strength)("disabled",r.backdrop().kind==="none"),l(),q("muted",i.backdrop?.strength===void 0),l(),M(r.backdrop().kind==="none"?"off":r.label(r.backdrop().strength)),l(),R("disabled",i.backdrop?.strength===void 0),l(2),D(r.backdrop().kind!=="none"?68:-1),l(),R("open",r.advanced().length>0||r.tokenIssues().length>0),l(2),B("Advanced tokens",r.advanced().length?" ("+r.advanced().length+")":""),l(),F(r.advanced()),l(2),F(r.tokenIssues()),l(3),R("value",r.newKey()),l(),R("value",r.newValue()),l(),R("disabled",!r.canAdd()),l(3),F(r.tokenKeys()),l(2),D((o=r.newKeyError())?84:-1,o),l(5),B(" applies); a value, or per format as JSON: ",r.formatExample,"."),l(5),R("checked",!!i.captions),l(7),R("disabled",!i.captions),l(),R("selected",r.captionSettings().style==="bar"),l(2),R("selected",r.captionSettings().style==="plain"),l(5),R("disabled",!i.captions),l(),R("selected",r.captionSettings().position==="bottom"),l(2),R("selected",r.captionSettings().position==="top"),l(4),F(r.issues.under(Te(47,gC)))}}var kC=.1,RC=.05;function xd(t){return t===0?"off":t.toFixed(2)}var Ls=class t{store=w(Q);issues=w(tt);bridge=w(le);weights=Ng;entrances=Gl;entranceLabels={fade:"Fade",reveal:"Reveal",punch:"Punch",blur:"Blur",words:"Word by word"};pushMax=Ut;grainMax=kC;backdrops=no;backdropLabels={none:"None",aurora:"Aurora",grid:"Grid",dots:"Dots"};backdropStep=RC;label=xd;formatExample='{"base": "600", "narrow": "500"}';theme=_(()=>this.bridge.project()?.theme);themeMotion=_(()=>Ps(this.theme()));themeWeight=_(()=>vd(this.theme(),"bs-weight-display",this.store.format())??"600");themeAccent=_(()=>vd(this.theme(),"bs-accent",this.store.format()));weight=_(()=>{let e=this.store.doc();return e?Ed(e,"bs-weight-display",this.store.format()):null});accent=_(()=>{let e=this.store.doc();return e?Ed(e,"bs-accent",this.store.format()):null});accentHex=_(()=>_d(this.accent())??_d(this.themeAccent())??"#000000");push=_(()=>this.store.doc()?.motion?.push??this.themeMotion().push);grain=_(()=>this.store.doc()?.grain??Og(this.theme()));themeBackdrop=_(()=>Lg(this.theme()));backdrop=_(()=>Fg(this.store.doc(),this.theme()));advanced=_(()=>Object.entries(this.store.doc()?.tokens??{}).filter(([e])=>!yd.includes(e)).map(([e,n])=>({key:e,text:Vg(n)})));tokenKeys=_(()=>Rg(this.theme()).filter(e=>!yd.includes(e)));tokenIssues=_(()=>this.issues.under(["tokens"]));newKey=A("");newValue=A("");newKeyError=_(()=>{let e=this.newKey().trim();return!e||Ag(this.theme(),e)?null:`Unknown token \u201C${e}\u201D: the theme has no such key (check would report it).`});canAdd=_(()=>this.newKey().trim()!==""&&this.newValue().trim()!==""&&this.newKeyError()===null);captionSettings=_(()=>{let e=this.store.doc()?.captions,n=e&&e!==!0?e:{};return{style:n.style??"bar",position:n.position??"bottom"}});edit(e,n){this.store.apply(e,n)}text(e){return e.target.value}onWeight(e){let n=e.target.value;this.edit(o=>ro(o,"bs-weight-display",n||void 0))}onAccent(e){let n=e.target.value;this.edit(o=>ro(o,"bs-accent",n),"look-accent")}resetToken(e){this.store.endCoalescing(),this.edit(n=>ro(n,e,void 0))}onEntrance(e){let n=e.target.value;this.edit(o=>hs(o,"entrance",n||void 0))}onPush(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.edit(o=>hs(o,"push",n),"look-push")}onResetPush(){this.store.endCoalescing(),this.edit(e=>hs(e,"push",void 0))}onGrain(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.edit(o=>zl(o,n),"look-grain")}onResetGrain(){this.store.endCoalescing(),this.edit(e=>zl(e,void 0))}onBackdropKind(e){let n=e.target.value;this.edit(o=>gs(o,n?{kind:n,strength:o.backdrop?.strength}:void 0))}onBackdropStrength(e){let n=e.target.valueAsNumber,o=this.backdrop().kind;Number.isFinite(n)&&o!=="none"&&this.edit(i=>gs(i,{kind:o,strength:n}),"look-backdrop-strength")}onResetBackdropStrength(){this.store.endCoalescing(),this.edit(e=>e.backdrop?gs(e,{kind:e.backdrop.kind}):e)}onTokenValue(e,n){let o=bd(this.text(n));this.edit(i=>ro(i,e,o))}onAddToken(){if(!this.canAdd())return;let e=this.newKey().trim(),n=bd(this.newValue());this.edit(o=>ro(o,e,n)),this.newKey.set(""),this.newValue.set("")}onCaptionsOn(e){let n=e.target.checked;this.edit(o=>ys(o,n?this.captionSettings():!1))}onCaptionStyle(e){let n=e.target.value;this.edit(o=>ys(o,x(v({},this.captionSettings()),{style:n})))}onCaptionPosition(e){let n=e.target.value;this.edit(o=>ys(o,x(v({},this.captionSettings()),{position:n})))}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-look-settings"]],decls:1,vars:1,consts:[[1,"sf-group","look"],[1,"sf-hint","look-intro"],[1,"grid-2"],[1,"sf-field"],["for","look-weight"],["id","look-weight",3,"change"],["value","",3,"selected"],[3,"value","selected"],["for","look-entrance"],["id","look-entrance",3,"change"],["for","look-accent"],[1,"sf-inline","look-row","look-accent"],["id","look-accent","type","color",3,"input","change","value"],["for","look-accent",1,"mono","small"],["type","button",1,"link","small","look-reset",3,"click","disabled"],["for","look-push"],[1,"sf-inline","look-row"],["id","look-push","type","range","min","0","step","0.01","title","Every scene's content scales from 1 to 1 + push over the scene; 0 is off",3,"input","change","max","value"],["for","look-push",1,"mono","small","look-readout"],["for","look-grain"],["id","look-grain","type","range","min","0","step","0.01",3,"input","change","max","value"],["for","look-grain",1,"mono","small","look-readout"],[1,"sf-hint","grain-note"],["for","look-backdrop"],["id","look-backdrop",3,"change"],["for","look-backdrop-strength"],["id","look-backdrop-strength","type","range","min","0","max","1",3,"input","change","step","value","disabled"],["for","look-backdrop-strength",1,"mono","small","look-readout"],[1,"sf-hint","backdrop-note"],[1,"look-advanced",3,"open"],[1,"small"],[1,"sf-inline","look-token"],["role","alert",1,"sf-issue"],[1,"sf-inline","look-token","look-token-add"],["id","look-token-new-key","type","text","list","look-token-keys","placeholder","bs-text-body","aria-label","Token",1,"mono",3,"input","value"],["id","look-token-new-value","type","text","placeholder","value","aria-label","Value",1,"mono",3,"input","keydown.enter","value"],["type","button",1,"ghost","look-token-add-btn",3,"click","disabled"],["id","look-token-keys"],[3,"value"],["role","alert",1,"sf-issue","look-token-error"],[1,"sf-hint"],[1,"sf-group","captions"],[1,"sf-field","sf-inline"],["id","captions-on","type","checkbox",3,"change","checked"],["for","captions-on"],["for","captions-style"],["id","captions-style",3,"change","disabled"],["value","bar",3,"selected"],["value","plain",3,"selected"],["for","captions-position"],["id","captions-position",3,"change","disabled"],["value","bottom",3,"selected"],["value","top",3,"selected"],["selected","",3,"value"],[1,"mono","small","look-token-key",3,"for","title"],["type","text",1,"mono",3,"change","id","value"],["type","button","title","Theme default",1,"icon","danger",3,"click"]],template:function(n,o){if(n&1&&T(0,NC,118,48),n&2){let i;D((i=o.store.doc())?0:-1,i)}},encapsulation:2})};var jg=()=>[],Cd=(t,e)=>e.id;function AC(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;q("warning",n.severity==="warning"),l(),M(n.message)}}function OC(t,e){if(t&1&&(h(0,"p",8),u(1),m()),t&2){let n=e.$implicit;l(),M(n)}}function PC(t,e){t&1&&(h(0,"p",49),u(1),m()),t&2&&(l(),M(e.message))}function LC(t,e){t&1&&(h(0,"p",50),u(1),m()),t&2&&(l(),M(e))}function FC(t,e){if(t&1){let n=j();h(0,"button",52),k("click",function(){I(n);let i=p(3);return S(i.lengthenToFit())}),u(1),m()}if(t&2){let n=e,o=p(2),i=p();N("title","Duration "+i.fmt(o.duration)+" \u2192 "+i.fmt(n)+", beats unchanged"+(i.bpm()?", the end on the next beat":"")+(i.readTimeNeed()?" (read time measured in "+i.readTimeNeed().issue.format+" only)":"")),l(),Jn(" Lengthen to fit (+",(n-o.duration).toFixed(1)," s",i.readTimeNeed()?" in "+i.readTimeNeed().issue.format:"","",i.bpm()?", on the beat":"",") ")}}function VC(t,e){if(t&1&&(h(0,"div",9),T(1,PC,2,1,"p",49),T(2,LC,2,1,"p",50),T(3,FC,2,4,"button",51),m()),t&2){let n,o,i,r=p(2);l(),D((n=r.readTime())?1:-1,n),l(),D((o=r.speechFit())?2:-1,o),l(),D((i=r.lengthenTo())?3:-1,i)}}function jC(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;q("warning",n.severity==="warning"),l(),M(n.message)}}function $C(t,e){if(t&1){let n=j();h(0,"button",53),k("click",function(){I(n);let i=p(2);return S(i.snapToBeat())}),u(1),m()}if(t&2){let n=e,o=p(),i=p();N("title","Ends "+i.offBy(n.off)+" s off the beat ("+i.bpm()+" bpm): duration "+i.fmt(o.duration)+" \u2192 "+i.fmt(n.suggested)+", the cut on the next beat"),l(),B(" \u2669 Snap to the beat (",i.fmt(n.suggested),") ")}}function BC(t,e){if(t&1&&(h(0,"option",20),u(1),m()),t&2){let n=p(),o=p();N("selected",!n.transitionIn),l(),M(o.defaultTransitionLabel())}}function HC(t,e){if(t&1&&(h(0,"option",21),u(1),m()),t&2){let n=e.$implicit,o=p(),i=p();N("value",n)("selected",o.transitionIn?.kind===n),l(),M(i.transitionLabel(n))}}function UC(t,e){if(t&1&&(h(0,"option",21),u(1),m()),t&2){let n=e.$implicit,o=p(2),i=p(2);N("value",n)("selected",i.transitionDirection(o)===n),l(),M(n)}}function GC(t,e){if(t&1){let n=j();h(0,"div",12)(1,"label",54),u(2,"Direction"),m(),h(3,"select",55),k("change",function(i){I(n);let r=p(3);return S(r.setTransitionDirection(i))}),L(4,UC,2,3,"option",21,me),m()()}if(t&2){let n=p(3);l(3),N("disabled",n.index()===0),l(),F(n.directions)}}function WC(t,e){if(t&1&&T(0,GC,6,1,"div",12),t&2){let n=p(2);D(n.usesDirection(e.kind)?0:-1)}}function zC(t,e){t&1&&(h(0,"p",33),u(1,"The first scene always starts with a cut."),m())}function qC(t,e){if(t&1){let n=j();h(0,"div",56),k("focusout",function(){I(n);let i=p(2);return S(i.store.endCoalescing())}),h(1,"app-schema-field",57),k("edit",function(i){I(n);let r=p(2);return S(r.onPropEdit(i))}),m()()}if(t&2){let n=p(),o=p();l(),N("field",e)("value",n.props)("path",Te(4,jg))("issues",o.propIssues())}}function KC(t,e){if(t&1&&(h(0,"p",1),u(1),m()),t&2){let n=p();l(),B("Waiting for the player to describe the scene type \u201C",n.type,"\u201D.")}}function ZC(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function QC(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function YC(t,e){t&1&&(h(0,"p",64),u(1,"Captions are off for this video (video settings \u2192 Captions)."),m())}function JC(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function XC(t,e){if(t&1){let n=j();h(0,"button",78),k("click",function(){I(n);let i=p(),r=p(3);return S(r.speech.toggle(i.key))}),u(1),m()}if(t&2){let n=p(),o=p(3);N("title",o.speech.playingKey()===n.key?"Stop":"Play the clip alone"),z("aria-label",o.speech.playingKey()===n.key?"Stop the clip":"Play the clip alone"),l(),M(o.speech.playingKey()===n.key?"\u25A0":"\u25B6")}}function eI(t,e){if(t&1){let n=j();h(0,"button",79),k("click",function(){I(n);let i=p(4);return S(i.generate())}),u(1,"Generate speech"),m()}if(t&2){let n=p(4);N("disabled",!n.canGenerate())("title",n.generateTitle())}}function tI(t,e){if(t&1){let n=j();h(0,"button",80),k("click",function(){I(n);let i=p(4);return S(i.store.select(null))}),u(1,"Pick a voice"),m()}}function nI(t,e){if(t&1&&T(0,XC,2,3,"button",75)(1,eI,2,2,"button",76)(2,tI,2,0,"button",77),t&2){let n=e;D(n.state==="ready"&&n.key?0:n.state==="missing"||n.state==="stale"?1:n.state==="unvoiced"?2:-1)}}function oI(t,e){if(t&1&&(h(0,"p",81),u(1),m()),t&2){let n=p(3);q("error",n.speech.currentJob()?.phase==="error"),l(),M(e)}}function iI(t,e){t&1&&(h(0,"p",48),u(1),m()),t&2&&(l(),M(e))}function rI(t,e){t&1&&(h(0,"p",33),u(1),m()),t&2&&(l(),M(e))}function sI(t,e){if(t&1){let n=j();h(0,"div",12)(1,"label",58),u(2,"Line"),m(),h(3,"textarea",59),k("input",function(i){I(n);let r=p(2);return S(r.setNarrationText(i))}),m(),h(4,"p",33),u(5),m(),L(6,ZC,2,1,"p",48,oe),m(),h(8,"div",12)(9,"label",60),u(10,"Caption (written form)"),m(),h(11,"input",61),k("input",function(i){I(n);let r=p(2);return S(r.setNarrationCaption(i))}),m(),h(12,"p",33),u(13,"Shown in the captions instead of the line, e.g. \u201CACME, since 1998\u201D for \u201CA C M E, since nineteen ninety-eight\u201D. Not spoken."),m(),L(14,QC,2,1,"p",48,oe),m(),h(16,"div",43)(17,"input",62),k("change",function(i){I(n);let r=p(2);return S(r.setCaptionHidden(i))}),m(),h(18,"label",63),u(19,"Hide caption for this scene"),m()(),T(20,YC,2,0,"p",64),h(21,"div",11)(22,"div",12)(23,"label",65),u(24,"Starts after (s)"),m(),h(25,"input",66),k("input",function(i){I(n);let r=p(2);return S(r.setNarrationOffset(i))}),m()(),h(26,"div",12)(27,"label",67),u(28,"Speed"),m(),h(29,"span",68)(30,"input",69),k("input",function(i){I(n);let r=p(2);return S(r.setNarrationSpeed(i))})("change",function(){I(n);let i=p(2);return S(i.store.endCoalescing())}),m(),h(31,"output",70),u(32),m()()()(),L(33,JC,2,1,"p",48,oe),h(35,"div",71)(36,"span",72),u(37),m(),T(38,nI,3,1),m(),T(39,oI,2,3,"p",73),T(40,iI,2,1,"p",48),T(41,rI,2,1,"p",33),h(42,"button",74),k("click",function(){I(n);let i=p(2);return S(i.onRemoveNarration())}),u(43,"Remove narration"),m()}if(t&2){let n,o,i,r,s=e,a=p(),c=p();l(3),N("value",s.text),l(2),M(c.wordsLabel(s.text)),l(),F(c.issuesAt("narration","text")),l(5),N("placeholder",s.text||"The line as the captions show it")("value",s.caption??""),l(3),F(c.issuesAt("narration","caption")),l(3),N("checked",a.captions===!1),l(3),D(c.captionsOn()?-1:20),l(5),N("value",s.offset??c.narrationOffset),l(5),N("min",c.speed.min)("max",c.speed.max)("value",s.speed??c.speed.default),l(2),B("\xD7",(s.speed??c.speed.default).toFixed(2)),l(),F(c.issuesAt("narration")),l(2),z("data-state",c.clip()?.state),l(2),M(c.clipLabel()),l(),D((n=c.clip())?38:-1,n),l(),D((o=c.jobLine())?39:-1,o),l(),D((i=c.speech.playError())?40:-1,i),l(),D((r=c.installHint())?41:-1,r)}}function aI(t,e){if(t&1){let n=j();h(0,"p",1),u(1,"A spoken line over this scene, in the video's voice."),m(),h(2,"button",82),k("click",function(){I(n);let i=p(2);return S(i.onAddNarration())}),u(3,"+ Add narration"),m()}}function cI(t,e){if(t&1){let n=j();h(0,"button",90),k("click",function(){I(n);let i=p().$implicit,r=p(3);return S(r.reset(i))}),u(1,"\u21BA"),m()}if(t&2){let n=p().$implicit;z("aria-label","Reset gap of "+(n.label||n.id)+" to the default")}}function lI(t,e){if(t&1){let n=j();h(0,"tr")(1,"td")(2,"span",86),u(3),m()(),h(4,"td")(5,"input",87),k("input",function(i){let r=I(n).$implicit,s=p(3);return S(s.setGap(r,i))})("blur",function(){I(n);let i=p(3);return S(i.store.endCoalescing())}),m()(),h(6,"td",88),u(7),m(),h(8,"td"),T(9,cI,2,1,"button",89),m()()}if(t&2){let n=e.$implicit,o=p(2),i=p();q("overridden",n.overridden)("late",n.offset>o.duration),l(2),N("title",n.id),l(),M(n.label||n.id),l(2),N("value",n.gap),z("aria-label","Gap before "+(n.label||n.id)+" in seconds"),l(2),M(i.fmt(n.offset)),l(2),D(n.overridden?9:-1)}}function dI(t,e){if(t&1&&(h(0,"table",40)(1,"thead")(2,"tr")(3,"th",83),u(4,"Beat"),m(),h(5,"th",83),u(6,"Gap (s)"),m(),h(7,"th",83),u(8,"At"),m(),h(9,"th",83)(10,"span",84),u(11,"Reset"),m()()()(),h(12,"tbody"),L(13,lI,10,10,"tr",85,Cd),m()()),t&2){let n=p(2);l(13),F(n.beats())}}function uI(t,e){t&1&&(h(0,"p",1),u(1,"This scene has no beats."),m())}function fI(t,e){if(t&1&&(h(0,"option",21),u(1),m()),t&2){let n=e.$implicit,o=p().$implicit;N("value",n.id)("selected",n.id===o.sound),l(),M(n.title)}}function pI(t,e){if(t&1&&(h(0,"option",93),u(1),m()),t&2){let n=p().$implicit;N("value",n.sound),l(),B("",n.sound," (unknown)")}}function mI(t,e){if(t&1&&(h(0,"option",21),u(1),m()),t&2){let n=e.$implicit,o=p().$implicit;N("value","beat:"+n.id)("selected",o.at===n.id),l(),M(n.label||n.id)}}function hI(t,e){if(t&1&&(h(0,"option",94),u(1,"Scene end"),m()),t&2){let n=p().$implicit;N("selected",n.at==="end")}}function gI(t,e){if(t&1){let n=j();h(0,"div",12)(1,"label",91),u(2,"Seconds"),m(),h(3,"input",99),k("input",function(i){I(n);let r=p().$index,s=p(2);return S(s.patchNumber(r,"at",i))}),m()()}if(t&2){let n=p(),o=n.$implicit,i=n.$index;l(),N("for","sfx-sec-"+i),l(2),N("id","sfx-sec-"+i)("value",o.at)}}function yI(t,e){if(t&1&&(h(0,"p",48),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function vI(t,e){if(t&1){let n=j();h(0,"div",46)(1,"div",12)(2,"label",91),u(3,"Sound"),m(),h(4,"select",92),k("change",function(i){let r=I(n).$index,s=p(2);return S(s.patchCue(r,{sound:s.selectValue(i)}))}),L(5,fI,2,3,"option",21,Cd),T(7,pI,2,2,"option",93),m()(),h(8,"div",12)(9,"label",91),u(10,"At"),m(),h(11,"select",92),k("change",function(i){let r=I(n),s=r.$implicit,a=r.$index,c=p(2);return S(c.setCueAt(a,s,i))}),L(12,mI,2,3,"option",21,Cd),T(14,hI,2,1,"option",94),h(15,"option",95),u(16,"Seconds\u2026"),m()()(),T(17,gI,4,3,"div",12),h(18,"div",12)(19,"label",91),u(20,"Offset (s)"),m(),h(21,"input",96),k("input",function(i){let r=I(n).$index,s=p(2);return S(s.patchNumber(r,"offset",i))}),m()(),h(22,"div",12)(23,"label",91),u(24,"Gain"),m(),h(25,"input",97),k("input",function(i){let r=I(n).$index,s=p(2);return S(s.patchNumber(r,"gain",i))}),m()(),h(26,"button",98),k("click",function(){let i=I(n).$index,r=p(2);return S(r.removeCue(i))}),u(27,"\u2715"),m(),L(28,yI,2,1,"p",48,oe),m()}if(t&2){let n=e.$implicit,o=e.$index,i=p(2);l(2),N("for","sfx-sound-"+o),l(2),N("id","sfx-sound-"+o),l(),F(i.sounds()),l(2),D(i.hasSound(n.sound)?-1:7),l(2),N("for","sfx-at-"+o),l(2),N("id","sfx-at-"+o),l(),F(i.beats()),l(2),D(i.hasEndBeat()?-1:14),l(),N("selected",typeof n.at=="number"),l(2),D(typeof n.at=="number"?17:-1),l(2),N("for","sfx-off-"+o),l(2),N("id","sfx-off-"+o)("value",n.offset??0),l(2),N("for","sfx-gain-"+o),l(2),N("id","sfx-gain-"+o)("value",n.gain??1),l(),z("aria-label","Remove sound "+(o+1)),l(2),F(i.issuesAt("sfx",o))}}function bI(t,e){if(t&1){let n=j();h(0,"header",0)(1,"div")(2,"h2"),u(3),m(),h(4,"p",1),u(5),m()(),h(6,"div",2)(7,"button",3),k("click",function(){I(n);let i=p();return S(i.move(-1))}),u(8,"\u2190"),m(),h(9,"button",4),k("click",function(){I(n);let i=p();return S(i.move(1))}),u(10,"\u2192"),m(),h(11,"button",5),k("click",function(){I(n);let i=p();return S(i.duplicate())}),u(12,"Duplicate"),m(),h(13,"button",6),k("click",function(){I(n);let i=p();return S(i.remove())}),u(14,"Delete"),m()()(),L(15,AC,2,3,"p",7,oe),L(17,OC,2,1,"p",8,oe),T(19,VC,4,3,"div",9),h(20,"section",10),k("focusout",function(){I(n);let i=p();return S(i.store.endCoalescing())}),h(21,"div",11)(22,"div",12)(23,"label",13),u(24,"Scene id"),m(),h(25,"input",14),k("change",function(i){I(n);let r=p();return S(r.rename(i))}),m()(),h(26,"div",12)(27,"label",15),u(28,"Duration (s)"),m(),h(29,"input",16),k("input",function(i){I(n);let r=p();return S(r.setDuration(i))}),m(),L(30,jC,2,3,"p",7,oe),T(32,$C,2,2,"button",17),m(),h(33,"div",12)(34,"label",18),u(35,"Transition in"),m(),h(36,"select",19),k("change",function(i){I(n);let r=p();return S(r.setTransitionKind(i))}),T(37,BC,2,2,"option",20),L(38,HC,2,3,"option",21,me),m()(),T(40,WC,1,1),h(41,"div",12)(42,"label",22),u(43,"Transition (s)"),m(),h(44,"input",23),k("input",function(i){I(n);let r=p();return S(r.setTransitionDuration(i))}),m()(),h(45,"div",12)(46,"label",24),u(47,"Camera push"),m(),h(48,"select",25),k("change",function(i){I(n);let r=p();return S(r.setPushMode(i))}),h(49,"option",26),u(50),m(),h(51,"option",27),u(52,"Off"),m(),h(53,"option",28),u(54,"Custom"),m()()(),h(55,"div",12)(56,"label",29),u(57,"Push amount"),m(),h(58,"span",30)(59,"input",31),k("input",function(i){I(n);let r=p();return S(r.setPush(i))})("change",function(){I(n);let i=p();return S(i.store.endCoalescing())}),m(),h(60,"output",32),u(61),m()()()(),T(62,zC,2,0,"p",33),m(),h(63,"section",34)(64,"h3",35),u(65,"Content"),m(),T(66,qC,2,5,"div")(67,KC,2,1,"p",1),m(),h(68,"section",36),k("focusout",function(){I(n);let i=p();return S(i.store.endCoalescing())}),h(69,"h3",37),u(70,"Narration"),m(),T(71,sI,44,17)(72,aI,4,0),m(),h(73,"section",38)(74,"h3",39),u(75,"Beats"),m(),T(76,dI,15,0,"table",40)(77,uI,2,0,"p",1),m(),h(78,"section",41)(79,"h3",42),u(80,"Sounds"),m(),h(81,"div",43)(82,"input",44),k("change",function(i){I(n);let r=p();return S(r.setMute(i))}),m(),h(83,"label",45),u(84,"Mute the scene type's built-in sounds"),m()(),L(85,vI,30,15,"div",46,oe),h(87,"button",47),k("click",function(){I(n);let i=p();return S(i.addCue())}),u(88,"+ Add sound"),m()()}if(t&2){let n,o,i,r,s=e,a=p();l(3),M(a.typeInfo()?.title??s.type),l(2),M(a.typeInfo()?.description),l(2),N("disabled",a.index()===0),l(2),N("disabled",a.index()===a.sceneCount()-1),l(4),N("disabled",a.sceneCount()<=1),l(2),F(a.sceneIssues()),l(2),F(a.timelineWarnings()),l(2),D(a.readTime()||a.speechFit()?19:-1),l(6),N("value",s.id),l(4),N("value",s.duration),l(),F(a.durationIssues()),l(2),D((n=a.offBeat())?32:-1,n),l(4),N("disabled",a.index()===0),l(),D(a.transitions().themeDefault?37:-1),l(),F(a.transitions().kinds),l(2),D((o=s.transitionIn)?40:-1,o),l(4),N("disabled",!s.transitionIn||a.index()===0)("value",s.transitionIn?.duration??a.resolved()?.transitionIn?.duration??""),l(5),N("selected",s.push===void 0),l(),B("Video default (",a.pushLabel(a.inheritedPush()),")"),l(),N("selected",s.push===0),l(2),N("selected",!!s.push),l(6),N("max",a.pushMax)("disabled",!s.push)("value",s.push||a.customPush()),l(),q("muted",!s.push),l(),M(a.pushLabel(s.push??a.inheritedPush())),l(),D(a.index()===0?62:-1),l(4),D((i=a.form())?66:67,i),l(5),D((r=s.narration)?71:72,r),l(5),D(a.beats().length?76:77),l(6),N("checked",!!s.muteDefaultSfx),l(3),F(s.sfx??Te(30,jg)),l(2),N("disabled",!a.sounds().length)}}function _I(t){return is.includes(t)}var Fs=class t{store=w(Q);bridge=w(le);issues=w(tt);beatGrid=w(Wt);speech=w(et);scene=this.store.selectedScene;narrationOffset=cs;speed=Ht;bpm=this.beatGrid.bpm;offBeat=_(()=>{let e=this.scene();return e?this.beatGrid.offBeat().get(e.id)??null:null});index=_(()=>{let e=this.store.doc(),n=this.scene();return e&&n?De(e,n.id):-1});sceneCount=_(()=>this.store.doc()?.scenes.length??0);typeInfo=_(()=>{let e=this.scene();return e?this.bridge.project()?.sceneTypes.find(n=>n.id===e.type)??null:null});variant=_(()=>this.scene()?.props?.variant);form=_(()=>{let e=this.typeInfo();return e?wg(ag(e.jsonSchema),this.bridge.project()?.rules,{variant:this.variant()}):null});resolved=_(()=>{let e=this.scene();return e?this.bridge.timeline()?.scenes.find(n=>n.id===e.id)??null:null});timelineWarnings=_(()=>{let e=this.resolved();return e?this.issues.sceneWarnings(e):[]});beats=_(()=>this.resolved()?.beats??[]);hasEndBeat=_(()=>this.beats().some(e=>e.id==="end"));sounds=_(()=>this.bridge.project()?.theme.sounds??[]);defaultTransitionLabel=_(()=>{let e=this.bridge.project()?.theme.defaultTransition;return e?`Default: ${gd(e.kind)}${e.kind==="cut"&&!e.duration?"":` ${EI(e.duration)} s`}`:"Theme default"});directions=is;transitionLabel=gd;transitionDirection=Lm;usesDirection=rs;transitions=_(()=>{let e=this.bridge.project();return Dg(e?.rules,e?.theme.defaultTransition?.kind??"dip",this.scene()?.transitionIn?.kind)});scenePrefix=_(()=>["scenes",this.index()]);propIssues=_(()=>this.issues.under([...this.scenePrefix(),"props"]));sceneIssues=_(()=>this.issues.under(this.scenePrefix()).filter(e=>e.path.length===0||!["props","duration","sfx"].includes(String(e.path[0]))));readTime=_(()=>{let e=this.scene();return e?this.issues.readTimeOf(e.id):null});readTimeNeed=_(()=>{let e=this.readTime();return e&&e.issue.leaves===void 0?e:null});clip=_(()=>{let e=this.scene();return e?this.speech.of(e.id):null});speechFit=_(()=>{let e=this.clip(),n=this.scene();if(!n||e?.state!=="ready"||e.need===void 0||!this.issues.speechFitShown(n.id))return null;let o=e.tail??io,i=o>io?`the ${o} s tail: the video fades out over its last ${o} s`:`the ${o} s tail`;return`Narration runs to ${gi(e.need-o)} s, the scene ends at ${gi(n.duration)} s (it needs ${gi(e.need)} s with ${i})`});lengthenTo=_(()=>{let e=this.scene(),n=this.store.doc();if(!e||!n)return null;let o=ql(n,e.id,this.fitNeed(),this.beatGrid.beat());return o===n?null:In(o,e.id)?.duration??null});durationIssues=_(()=>this.issues.at([...this.scenePrefix(),"duration"]).filter(e=>!this.issues.isReadTime(e)));lengthenToFit(){let e=this.scene();if(!e)return;let n=this.fitNeed(),o=this.beatGrid.beat();this.store.endCoalescing(),this.store.apply(i=>ql(i,e.id,n,o)),this.store.endCoalescing()}fitNeed(){let e=this.readTimeNeed(),n=this.clip();return v(v({},e?{readMissing:e.issue.missing}:{}),n?.state==="ready"&&n.need!==void 0?{speech:n.need}:{})}clipLabel=_(()=>{let e=this.clip();if(!e)return"";switch(e.state){case"ready":return`Clip ready \xB7 ${gi(e.duration??0)} s`;case"stale":return"Stale: the line, voice, speed or voice processing changed since its clip was spoken";case"missing":return this.speech.status()===null&&!this.speech.statusError()?"Checking the clip\u2026":"Not spoken yet";case"empty":return"Write the line, then generate its speech";case"unvoiced":return"No voice for the narration"}});jobLine=_(()=>{let e=this.speech.currentJob(),n=this.scene();return!e||!n||e.scenes!==null&&!e.scenes.includes(n.id)?null:e.notice&&e.phase!=="error"?`${hi(e)} ${e.notice}`:hi(e)});canGenerate=_(()=>!this.speech.running()&&!this.speech.engineMissing());generateTitle=_(()=>this.speech.running()?"Speech is being generated":this.speech.engineMissing()?`The ${this.speech.engine()} engine is not installed`:"Saves, then speaks this line on the server (the first one loads the engine: about 15 s)");installHint=_(()=>{let e=this.speech.engine();return this.speech.engineMissing()&&e?`The ${e} engine is not installed: npm install @beatsheet/voice-${e} in the project, then restart beatsheet studio.`:null});wordsLabel(e){let n=pd(e),o=this.clip();return n?`${n===1?"1 word":`${n} words`}${o&&o.state!=="ready"?` \xB7 about ${gi(o.estimate)} s spoken`:""}`:"Short spoken sentences, one idea per scene; about 2.5 words per second."}onAddNarration(){this.store.endCoalescing(),this.apply(e=>n=>kh(n,e.id))}onRemoveNarration(){this.speech.stop(),this.store.endCoalescing(),this.apply(e=>n=>Rh(n,e.id))}setNarrationText(e){let n=e.target.value;this.apply(o=>i=>li(i,o.id,{text:n}),`narration-text:${this.scene()?.id}`)}setNarrationOffset(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&n>=0&&this.apply(o=>i=>li(i,o.id,{offset:n}),`narration-offset:${this.scene()?.id}`)}setNarrationCaption(e){let n=e.target.value;this.apply(o=>i=>li(i,o.id,{caption:n}),`narration-caption:${this.scene()?.id}`)}setCaptionHidden(e){let n=e.target.checked;this.apply(o=>i=>wh(i,o.id,n))}pushMax=Ut;inheritedPush=_(()=>this.store.doc()?.motion?.push??Ps(this.bridge.project()?.theme).push);customPush=_(()=>this.inheritedPush()||.04);captionsOn=_(()=>!!this.store.doc()?.captions);pushLabel=xd;setPushMode(e){let n=e.target.value,o=n==="off"?0:n==="custom"?this.customPush():void 0;this.store.endCoalescing(),this.apply(i=>r=>Kl(r,i.id,o))}setPush(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.apply(o=>i=>Kl(i,o.id,n),`push:${this.scene()?.id}`)}setNarrationSpeed(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.apply(o=>i=>li(i,o.id,{speed:n}),`narration-speed:${this.scene()?.id}`)}generate(){let e=this.scene();e&&this.speech.generate([e.id])}snapToBeat(){let e=this.scene(),n=this.beatGrid.beat();!e||n===void 0||(this.store.endCoalescing(),this.store.apply(o=>_s(o,e.id,n)),this.store.endCoalescing())}offBy(e){return String(Math.max(.01,Math.round(Math.abs(e)*100)/100))}issuesAt(...e){return this.issues.at([...this.scenePrefix(),...e])}fmt(e){return mi(e)}apply(e,n){let o=this.scene();o&&this.store.apply(e(o),n)}onPropEdit(e){this.apply(n=>o=>Th(o,n.id,e.path,e.value),e.coalesce?`prop:${this.scene()?.id}:${dh(e.path)}`:void 0)}rename(e){let n=e.target,o=this.scene(),i=this.store.doc();if(!o||!i)return;let r=Vh(i,o.id,n.value);if(r===i){n.value=o.id;return}let s=De(i,o.id);this.store.apply(()=>r),this.store.select(r.scenes[s].id)}setDuration(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&n>0&&this.apply(o=>i=>so(i,o.id,n),`duration:${this.scene()?.id}`)}setTransitionKind(e){let n=e.target.value;this.apply(o=>i=>{if(!Pl(n))return ci(i,o.id,void 0);let r=o.transitionIn?.duration??this.resolved()?.transitionIn.duration??this.bridge.project()?.theme.defaultTransition?.duration,s=r===void 0||r<=0&&n!=="cut"?Mg(n):r;return ci(i,o.id,{kind:n,duration:s,direction:o.transitionIn?.direction})})}setTransitionDuration(e){let n=e.target.valueAsNumber,o=this.scene()?.transitionIn;!o||!Number.isFinite(n)||this.apply(i=>r=>ci(r,i.id,x(v({},o),{duration:n})),`transition:${this.scene()?.id}`)}setTransitionDirection(e){let n=e.target.value,o=this.scene()?.transitionIn;!o||!_I(n)||this.apply(i=>r=>ci(r,i.id,x(v({},o),{direction:n})))}setGap(e,n){let o=n.target.valueAsNumber;Number.isFinite(o)&&this.apply(i=>r=>ai(r,i.id,e.id,o),`beat:${this.scene()?.id}:${e.id}`)}reset(e){this.apply(n=>o=>Sh(o,n.id,e.id))}setMute(e){let n=e.target.checked;this.apply(o=>i=>Dh(i,o.id,n))}hasSound(e){return this.sounds().some(n=>n.id===e)}selectValue(e){return e.target.value}patchCue(e,n){this.apply(o=>i=>Zl(i,o.id,e,n))}setCueAt(e,n,o){let i=this.selectValue(o);if(i==="sec"){let r=this.beats().find(a=>a.id===n.at),s=n.at==="end"?this.scene()?.duration??0:0;this.patchCue(e,{at:r?r.offset:s})}else i==="end"?this.patchCue(e,{at:"end"}):this.patchCue(e,{at:i.slice(5)})}patchNumber(e,n,o){let i=o.target.valueAsNumber;Number.isFinite(i)&&this.apply(r=>s=>Zl(s,r.id,e,{[n]:i}),`sfx:${this.scene()?.id}:${e}:${n}`)}addCue(){let e=this.sounds()[0]?.id;if(!e)return;let n=this.beats()[0]?.id;this.apply(o=>i=>Mh(i,o.id,{sound:e,at:n??0}))}removeCue(e){this.apply(n=>o=>Nh(o,n.id,e))}move(e){let n=this.index();this.store.apply(o=>Es(o,n,n+e))}duplicate(){let e=this.scene();if(!e)return;let n=null;this.store.apply(o=>{let i=Lh(o,e.id);return n=i.id,i.doc}),n&&this.store.select(n)}remove(){let e=this.scene();e&&this.store.deleteScene(e.id)}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-scene-inspector"]],decls:1,vars:1,consts:[[1,"insp-head"],[1,"muted","small"],[1,"insp-actions"],["type","button","aria-label","Move scene earlier","title","Move earlier",1,"icon",3,"click","disabled"],["type","button","aria-label","Move scene later","title","Move later",1,"icon",3,"click","disabled"],["type","button",3,"click"],["type","button",1,"danger",3,"click","disabled"],["role","alert",1,"sf-issue",3,"warning"],["role","status",1,"sf-issue","warning"],["role","status",1,"read-time"],["aria-label","Scene timing",1,"insp-section",3,"focusout"],[1,"grid-2"],[1,"sf-field"],["for","scene-id"],["id","scene-id","type","text",3,"change","value"],["for","scene-duration"],["id","scene-duration","type","number","min","0.1","step","0.05",3,"input","value"],["type","button",1,"link","small","snap-beat",3,"title"],["for","scene-transition"],["id","scene-transition",3,"change","disabled"],["value","",3,"selected"],[3,"value","selected"],["for","scene-transition-d"],["id","scene-transition-d","type","number","min","0","step","0.05",3,"input","disabled","value"],["for","scene-push-mode"],["id","scene-push-mode",3,"change"],["value","inherit",3,"selected"],["value","off",3,"selected"],["value","custom",3,"selected"],["for","scene-push"],[1,"sf-inline","scene-push"],["id","scene-push","type","range","min","0.01","step","0.01",3,"input","change","max","disabled","value"],["for","scene-push",1,"mono","small"],[1,"sf-hint"],["aria-labelledby","content-h",1,"insp-section"],["id","content-h"],["aria-labelledby","narration-h",1,"insp-section","narration",3,"focusout"],["id","narration-h"],["aria-labelledby","beats-h",1,"insp-section"],["id","beats-h"],[1,"beat-table"],["aria-labelledby","sfx-h",1,"insp-section"],["id","sfx-h"],[1,"sf-field","sf-inline"],["id","mute-default","type","checkbox",3,"change","checked"],["for","mute-default"],[1,"sfx-row"],["type","button",1,"ghost",3,"click","disabled"],["role","alert",1,"sf-issue"],[1,"sf-issue","warning"],[1,"sf-issue","warning","speech-fit"],["type","button",1,"read-time-fix",3,"title"],["type","button",1,"read-time-fix",3,"click","title"],["type","button",1,"link","small","snap-beat",3,"click","title"],["for","scene-transition-dir"],["id","scene-transition-dir",3,"change","disabled"],[3,"focusout"],[3,"edit","field","value","path","issues"],["for","narration-text"],["id","narration-text","rows","3","placeholder","What the voice says over this scene",3,"input","value"],["for","narration-caption"],["id","narration-caption","type","text",3,"input","placeholder","value"],["id","narration-caption-hidden","type","checkbox",3,"change","checked"],["for","narration-caption-hidden"],[1,"sf-hint","captions-off"],["for","narration-offset"],["id","narration-offset","type","number","min","0","step","0.05",3,"input","value"],["for","narration-speed"],[1,"sf-inline","narration-speed"],["id","narration-speed","type","range","step","0.05",3,"input","change","min","max","value"],["for","narration-speed",1,"mono","small"],["role","status",1,"speech-status"],[1,"speech-state"],[1,"sf-hint","speech-job",3,"error"],["type","button",1,"link","small","danger","narration-remove",3,"click"],["type","button",1,"icon","speech-play",3,"title"],["type","button",1,"speech-generate",3,"disabled","title"],["type","button",1,"link","small"],["type","button",1,"icon","speech-play",3,"click","title"],["type","button",1,"speech-generate",3,"click","disabled","title"],["type","button",1,"link","small",3,"click"],[1,"sf-hint","speech-job"],["type","button",1,"ghost","narration-add",3,"click"],["scope","col"],[1,"sr-only"],[3,"overridden","late"],[1,"beat-label",3,"title"],["type","number","min","0","step","0.05",3,"input","blur","value"],[1,"mono","small"],["type","button","title","Reset to default",1,"icon"],["type","button","title","Reset to default",1,"icon",3,"click"],[3,"for"],[3,"change","id"],["selected","",3,"value"],["value","end",3,"selected"],["value","sec",3,"selected"],["type","number","step","0.05",3,"input","id","value"],["type","number","min","0","max","2","step","0.05",3,"input","id","value"],["type","button","title","Remove",1,"icon","danger",3,"click"],["type","number","min","0","step","0.05",3,"input","id","value"]],template:function(n,o){if(n&1&&T(0,bI,89,31),n&2){let i;D((i=o.scene())?0:-1,i)}},dependencies:[Os],encapsulation:2})};function gi(t){return String(Math.round(t*100)/100)}function EI(t){return String(Math.round(t*100)/100)}var zt={"16:9":{id:"16:9",width:1920,height:1080,slug:"16x9"},"4:5":{id:"4:5",width:1080,height:1350,slug:"4x5"},"1:1":{id:"1:1",width:1080,height:1080,slug:"1x1"},"9:16":{id:"9:16",width:1080,height:1920,slug:"9x16"}};function $g(t){let e=zt[t];if(!e)throw new Error(`Unknown format "${t}"`);return e}var xI=()=>["title"],CI=()=>["formats"],II=()=>["music"],SI=()=>["voice"],wI=()=>["voiceFx"],TI=()=>["poster"],Vs=(t,e)=>e.id,DI=(t,e)=>e.engine,MI=(t,e)=>e.value;function NI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function kI(t,e){if(t&1){let n=j();h(0,"span",9)(1,"input",40),k("change",function(i){let r=I(n).$implicit,s=p(2);return S(s.onFormat(r,i))}),m(),h(2,"label",41),u(3),h(4,"span",1),u(5),m()()()}if(t&2){let n=e.$implicit,o=p(),i=p();l(),N("id","fmt-"+n)("checked",o.formats.includes(n)),l(),N("for","fmt-"+n),l(),B("",n," "),l(2),M(i.sizes[n])}}function RI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function AI(t,e){if(t&1&&(h(0,"option",13),u(1,"No music"),m()),t&2){let n=p();N("selected",!n.music)}}function OI(t,e){if(t&1&&(h(0,"option",14),u(1),m()),t&2){let n=e.$implicit,o=p();N("value",n.id)("selected",o.music?.track===n.id),l(),M(n.title)}}function PI(t,e){if(t&1&&(h(0,"span",42),u(1),m()),t&2){let n=e;l(),B("",n===1?"1 scene ends":n+" scenes end"," off the beat.")}}function LI(t,e){t&1&&u(0," Every cut is on the beat. ")}function FI(t,e){if(t&1){let n=j();h(0,"div",17)(1,"p",24),u(2),T(3,PI,2,1,"span",42)(4,LI,1,0),m(),h(5,"button",43),k("click",function(){I(n);let i=p(2);return S(i.onSnapAll())}),u(6),m()()}if(t&2){let n,o=p(2);l(2),B(" \u2669 ",e," bpm: scene ends snap to the beat. "),l(),D((n=o.offBeatCount())?3:4,n),l(2),N("disabled",!o.beatGrid.snapAllChanges()),l(),B(" Snap all scenes to the beat",o.beatGrid.snapAllChanges()?" ("+o.changesLabel(o.beatGrid.snapAllChanges())+")":""," ")}}function VI(t,e){if(t&1){let n=j();h(0,"div",44)(1,"label",41),u(2),m(),h(3,"input",46),k("input",function(i){let r=I(n).$implicit,s=p(3);return S(s.onPartLevel(r.id,i))})("change",function(){I(n);let i=p(3);return S(i.store.endCoalescing())}),m(),h(4,"output",47),u(5),m()()}if(t&2){let n=e.$implicit,o=p(3);l(),N("for","mix-"+n.id),z("title",n.description??null),l(),M(n.title),l(),N("id","mix-"+n.id)("max",o.partMax)("value",n.level),z("title",n.description??null),l(),q("muted",n.level===1),z("for","mix-"+n.id),l(),M(n.label)}}function jI(t,e){if(t&1){let n=j();h(0,"fieldset",18)(1,"legend"),u(2,"Mix"),m(),L(3,VI,6,11,"div",44,Vs),h(5,"button",45),k("click",function(){I(n);let i=p(2);return S(i.onResetMix())}),u(6,"Reset mix"),m()()}if(t&2){let n=p(),o=p();l(3),F(o.mixParts()),l(2),N("disabled",!n.music?.mix)}}function $I(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function BI(t,e){if(t&1&&(h(0,"option",48),u(1),m()),t&2){let n=e.$implicit,o=p(2);N("value",n.value)("disabled",n.disabled)("selected",o.voice===n.value),l(),M(n.label)}}function HI(t,e){if(t&1&&(h(0,"optgroup",22),L(1,BI,2,4,"option",48,MI),m()),t&2){let n=e.$implicit;N("label",n.label),l(),F(n.options)}}function UI(t,e){if(t&1&&(h(0,"option",23),u(1),m()),t&2){let n=e;N("value",n),l(),B("",n," (not available)")}}function GI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function WI(t,e){t&1&&(h(0,"p",24),u(1),m()),t&2&&(l(),M(e))}function zI(t,e){t&1&&(h(0,"p",25),u(1," No speech engine is installed. Kokoro ("),h(2,"code"),u(3,"@beatsheet/voice-kokoro"),m(),u(4,") is not on npm yet: it comes with a beatsheet checkout ("),h(5,"code"),u(6,"packages/voice-kokoro"),m(),u(7,"). Restart beatsheet studio after installing it. "),m())}function qI(t,e){if(t&1&&(h(0,"option",14),u(1),m()),t&2){let n=e.$implicit,o=p(),i=p();N("value",n)("selected",o.voiceFx===n),l(),M(i.fxLabels[n])}}function KI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function ZI(t,e){if(t&1){let n=j();h(0,"div",3)(1,"label",49),u(2,"Music under speech (dB down)"),m(),h(3,"input",50),k("input",function(i){I(n);let r=p(2);return S(r.onDuck(i))}),m(),h(4,"p",24),u(5),m()()}if(t&2){let n=p(),o=p();l(3),N("max",o.duckMax)("value",n.music.duck??o.duckDefault),l(2),ke("How far the music drops while the narration speaks: 0 to ",o.duckMax," dB, default ",o.duckDefault,".")}}function QI(t,e){if(t&1&&(h(0,"p",51),u(1),m()),t&2){let n=e,o=p(2);q("error",n.phase==="error"),l(),ke("",o.jobLabel(n),"",n.notice&&n.phase!=="error"?" "+n.notice:"")}}function YI(t,e){if(t&1&&(h(0,"option",14),u(1),m()),t&2){let n=e.$implicit,o=p();N("value",n.id)("selected",o.poster?.scene===n.id),l(),M(n.id)}}function JI(t,e){if(t&1&&(h(0,"option",14),u(1),m()),t&2){let n=e.$implicit,o=p();N("value",n.id)("selected",o.poster?.beat===n.id),l(),M(n.label||n.id)}}function XI(t,e){if(t&1&&(h(0,"p",6),u(1),m()),t&2){let n=e.$implicit;l(),M(n.message)}}function eS(t,e){if(t&1){let n=j();h(0,"li")(1,"button",56),k("click",function(){let i=I(n).$implicit,r=p(3);return S(r.goTo(i.path))}),h(2,"span",57),u(3),m(),u(4),m()()}if(t&2){let n=e.$implicit;q("warning",n.severity==="warning"),l(3),M(n.path.join(".")||"video"),l(),B(" ",n.message," ")}}function tS(t,e){if(t&1&&(h(0,"p",55),u(1),m()),t&2){let n=p(3);l(),M(n.issues.silencedNote())}}function nS(t,e){if(t&1&&(h(0,"section",39)(1,"h3",52),u(2,"Problems"),m(),h(3,"ul",53),L(4,eS,5,4,"li",54,oe),m(),T(6,tS,2,1,"p",55),m()),t&2){let n=p(2);l(4),F(n.issues.all()),l(2),D(n.issues.silenced().count?6:-1)}}function oS(t,e){if(t&1){let n=j();h(0,"header",0)(1,"div")(2,"h2"),u(3,"Video settings"),m(),h(4,"p",1),u(5,"Select a scene in the timeline to edit it."),m()()(),h(6,"section",2),k("focusout",function(){I(n);let i=p();return S(i.store.endCoalescing())}),h(7,"div",3)(8,"label",4),u(9,"Title"),m(),h(10,"input",5),k("input",function(i){I(n);let r=p();return S(r.onTitle(i))}),m(),L(11,NI,2,1,"p",6,oe),m(),h(13,"fieldset",7)(14,"legend"),u(15,"Formats to render"),m(),h(16,"div",8),L(17,kI,6,5,"span",9,me),m(),L(19,RI,2,1,"p",6,oe),m(),h(21,"div",10)(22,"div",3)(23,"label",11),u(24,"Music"),m(),h(25,"select",12),k("change",function(i){I(n);let r=p();return S(r.onMusic(i))}),T(26,AI,2,1,"option",13),L(27,OI,2,3,"option",14,Vs),m()(),h(29,"div",3)(30,"label",15),u(31,"Music gain"),m(),h(32,"input",16),k("input",function(i){I(n);let r=p();return S(r.onGain(i))}),m()()(),T(33,FI,7,4,"div",17),T(34,jI,7,1,"fieldset",18),L(35,$I,2,1,"p",6,oe),h(37,"fieldset",19)(38,"legend"),u(39,"Voice-over"),m(),h(40,"div",3)(41,"label",20),u(42,"Voice"),m(),h(43,"select",21),k("change",function(i){I(n);let r=p();return S(r.onVoice(i))}),h(44,"option",13),u(45),m(),L(46,HI,3,1,"optgroup",22,DI),T(48,UI,2,2,"option",23),m(),L(49,GI,2,1,"p",6,oe),T(51,WI,2,1,"p",24),T(52,zI,8,0,"p",25),m(),h(53,"div",3)(54,"label",26),u(55,"Voice processing"),m(),h(56,"select",27),k("change",function(i){I(n);let r=p();return S(r.onVoiceFx(i))}),h(57,"option",13),u(58),m(),L(59,qI,2,3,"option",14,me),m(),h(61,"p",28),u(62," Raw (the default): the engine's voice, trimmed only. Studio: high-pass, de-esser, light compression and a short room. Changing it re-speaks the lines: their clips show as stale until speech is generated again. "),m(),L(63,KI,2,1,"p",6,oe),m(),T(65,ZI,6,4,"div",3),h(66,"div",29)(67,"button",30),k("click",function(){I(n);let i=p();return S(i.speech.generate())}),u(68),m(),T(69,QI,2,4,"p",31),m()(),Ye(70,"app-look-settings"),h(71,"fieldset",7)(72,"legend"),u(73,"Poster frame"),m(),h(74,"p",24),u(75,"Thumbnail and frame 0 of the MP4. Default: last beat of the first scene."),m(),h(76,"div",32)(77,"div",3)(78,"label",33),u(79,"Scene"),m(),h(80,"select",34),k("change",function(i){I(n);let r=p();return S(r.onPosterScene(i))}),h(81,"option",13),u(82,"Default"),m(),L(83,YI,2,3,"option",14,Vs),m()(),h(85,"div",3)(86,"label",35),u(87,"Beat"),m(),h(88,"select",36),k("change",function(i){I(n);let r=p();return S(r.onPosterBeat(i))}),h(89,"option",13),u(90,"Last beat"),m(),L(91,JI,2,3,"option",14,Vs),m()(),h(93,"div",3)(94,"label",37),u(95,"Offset (s)"),m(),h(96,"input",38),k("input",function(i){I(n);let r=p();return S(r.onPosterOffset(i))}),m()()(),L(97,XI,2,1,"p",6,oe),m()(),T(99,nS,7,1,"section",39)}if(t&2){let n,o,i,r,s=e,a=p();l(10),N("value",s.title),l(),F(a.issues.at(Te(24,xI))),l(6),F(a.formatIds),l(2),F(a.issues.at(Te(25,CI))),l(7),D(a.music().noMusic?26:-1),l(),F(a.music().tracks),l(5),N("disabled",!s.music)("value",s.music?.gain??1),l(),D((n=a.beatGrid.bpm())?33:-1,n),l(),D(a.mixParts().length?34:-1),l(),F(a.issues.under(Te(26,II))),l(9),N("selected",s.voice===void 0),l(),M(a.projectVoice()?"Project default ("+a.projectVoice()+")":"No voice"),l(),F(a.voiceGroups()),l(2),D((o=a.unlistedVoice())?48:-1,o),l(),F(a.issues.at(Te(27,SI))),l(2),D((i=a.speech.statusError())?51:-1,i),l(),D(a.noEngine()?52:-1),l(5),N("selected",s.voiceFx===void 0),l(),B("Project default (",a.fxLabels[a.projectVoiceFx()],")"),l(),F(a.voiceFxs),l(4),F(a.issues.at(Te(28,wI))),l(2),D(s.music?65:-1),l(2),N("disabled",!a.canGenerateAll())("title",a.generateAllTitle()),l(),B(" Generate speech for all scenes",a.speech.toSpeak()?" ("+a.linesLabel(a.speech.toSpeak())+")":""," "),l(),D((r=a.speech.currentJob())?69:-1,r),l(12),N("selected",!s.poster),l(2),F(s.scenes),l(5),N("disabled",!s.poster),l(),N("selected",!s.poster?.beat),l(2),F(a.posterBeats()),l(5),N("disabled",!s.poster)("value",s.poster?.offset??.4),l(),F(a.issues.under(Te(29,TI))),l(2),D(a.issues.all().length||a.issues.silenced().count?99:-1)}}function iS(t){return t===0?"muted":`\xD7${t.toFixed(2)}`}function rS(t,e,n){return t.filter(o=>!o.hosted||e?.includes(o.id)).map(o=>{let i=e?.includes(o.id)??!1,r=i?n[o.id]??[]:[],s=r.length?r.map(a=>({value:`${o.id}:${a.id}`,label:`${a.title} \xB7 ${a.id} \xB7 ${a.language}`,disabled:!1})):[{value:`${o.id}:`,label:i?`${o.title}: no voices`:`${o.title}: not installed`,disabled:!0}];return{engine:o.id,label:o.title,options:s}})}var js=class t{store=w(Q);issues=w(tt);bridge=w(le);beatGrid=w(Wt);speech=w(et);formatIds=Object.keys(zt);sizes=Object.fromEntries(this.formatIds.map(e=>[e,`${zt[e].width}\xD7${zt[e].height}`]));music=_(()=>{let e=this.bridge.project();return Tg(e?.theme.music??[],e?.rules,this.store.doc()?.music?.track)});partMax=ri;mixParts=_(()=>{let e=this.store.doc()?.music;return e?this.trackParts(e.track).map(o=>{let i=qm(e.mix,o.id);return x(v({},o),{level:i,label:iS(i)})}):[]});offBeatCount=_(()=>this.beatGrid.offBeat().size);posterBeats=_(()=>{let e=this.store.doc()?.poster?.scene;return e?this.bridge.timeline()?.scenes.find(n=>n.id===e)?.beats??[]:[]});duckMax=ds;duckDefault=ls;jobLabel=hi;projectVoice=_(()=>this.bridge.project()?.voice??null);voiceGroups=_(()=>{let e=this.speech.status();return rS(this.speech.engines(),this.speech.available(),e?.voices??{})});unlistedVoice=_(()=>{let e=this.store.doc()?.voice;return e===void 0||this.voiceGroups().some(n=>n.options.some(o=>o.value===e&&!o.disabled))?null:e});noEngine=_(()=>this.speech.available()?.length===0);canGenerateAll=_(()=>!this.speech.running()&&this.speech.toSpeak()>0&&!this.speech.engineMissing());generateAllTitle=_(()=>this.speech.running()?"Speech is being generated":this.speech.toSpeak()?this.speech.engineMissing()?`The ${this.speech.engine()} engine is not installed`:"Saves, then speaks every narrated scene without a clip on the server (the engine loads first: about 15 s)":"Every narrated scene has its clip");linesLabel(e){return e===1?"1 line":`${e} lines`}voiceFxs=$l;fxLabels={raw:"Raw",studio:"Studio"};projectVoiceFx=_(()=>this.bridge.project()?.voiceFx??us);onVoiceFx(e){let n=e.target.value;this.store.apply(o=>xh(o,n||void 0))}onVoice(e){let n=e.target.value;this.store.apply(o=>bh(o,n||void 0))}onDuck(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.store.apply(o=>_h(o,n),"music-duck")}onTitle(e){let n=e.target.value;this.store.apply(o=>ph(o,n),"title")}onFormat(e,n){let o=n.target;this.store.apply(i=>mh(i,e,o.checked)),o.checked=this.store.doc()?.formats.includes(e)??o.checked}onMusic(e){let n=e.target.value,o=this.trackParts(n).map(i=>i.id);this.store.apply(i=>hh(i,n||null,o))}onPartLevel(e,n){let o=n.target.valueAsNumber;Number.isFinite(o)&&this.store.apply(i=>gh(i,e,o),`music-mix:${e}`)}onResetMix(){this.store.apply(yh)}trackParts(e){let n=this.bridge.project()?.theme.music.find(o=>o.id===e);return n?.kind==="generated"?n.parts??[]:[]}onGain(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.store.apply(o=>vh(o,n),"music-gain")}onSnapAll(){let e=this.beatGrid.beat();e!==void 0&&(this.store.endCoalescing(),this.store.apply(n=>Ch(n,e)),this.store.endCoalescing())}changesLabel(e){return e===1?"lengthens 1 scene":`lengthens ${e} scenes`}onPosterScene(e){let n=e.target.value;this.store.apply(o=>vs(o,n?{scene:n}:void 0))}onPosterBeat(e){let n=e.target.value;this.store.apply(o=>o.poster?vs(o,x(v({},o.poster),{beat:n||void 0})):o)}onPosterOffset(e){let n=e.target.valueAsNumber;Number.isFinite(n)&&this.store.apply(o=>o.poster?vs(o,x(v({},o.poster),{offset:n})):o,"poster-offset")}goTo(e){if(e[0]==="scenes"&&e.length>1){let n=this.store.doc()?.scenes[Number(e[1])]?.id;n&&this.store.select(n)}}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-video-settings"]],decls:1,vars:1,consts:[[1,"insp-head"],[1,"muted","small"],[1,"insp-section",3,"focusout"],[1,"sf-field"],["for","video-title"],["id","video-title","type","text",3,"input","value"],["role","alert",1,"sf-issue"],[1,"sf-group"],[1,"format-checks"],[1,"sf-inline"],[1,"grid-2"],["for","music-track"],["id","music-track",3,"change"],["value","",3,"selected"],[3,"value","selected"],["for","music-gain"],["id","music-gain","type","number","min","0","max","2","step","0.05",3,"input","disabled","value"],[1,"beat-grid-row"],[1,"sf-group","music-mix"],[1,"sf-group","voice-over"],["for","video-voice"],["id","video-voice",3,"change"],[3,"label"],["selected","",3,"value"],[1,"sf-hint"],[1,"sf-hint","voice-install"],["for","video-voice-fx"],["id","video-voice-fx",3,"change"],[1,"sf-hint","voice-fx-hint"],[1,"speech-all"],["type","button",1,"ghost","speech-generate-all",3,"click","disabled","title"],[1,"sf-hint","speech-job",3,"error"],[1,"grid-3"],["for","poster-scene"],["id","poster-scene",3,"change"],["for","poster-beat"],["id","poster-beat",3,"change","disabled"],["for","poster-offset"],["id","poster-offset","type","number","step","0.05",3,"input","disabled","value"],["aria-labelledby","problems-h",1,"insp-section"],["type","checkbox",3,"change","id","checked"],[3,"for"],[1,"beat-grid-off"],["type","button","title","Lengthens each scene that ends off the beat to the next beat, as one undo step; never shortens a scene",1,"ghost","snap-all",3,"click","disabled"],[1,"sf-inline","mix-part"],["type","button",1,"link","small","mix-reset",3,"click","disabled"],["type","range","min","0","step","0.05",3,"input","change","id","max","value"],[1,"mono","small","mix-readout"],[3,"value","disabled","selected"],["for","music-duck"],["id","music-duck","type","number","min","0","step","1",3,"input","max","value"],[1,"sf-hint","speech-job"],["id","problems-h"],[1,"problem-list"],[3,"warning"],[1,"sf-hint","problems-silenced"],["type","button",1,"link",3,"click"],[1,"mono","small"]],template:function(n,o){if(n&1&&T(0,oS,100,30),n&2){let i;D((i=o.store.doc())?0:-1,i)}},dependencies:[Ls],encapsulation:2})};function sS(t,e){if(t&1){let n=j();h(0,"button",0),k("click",function(){I(n);let i=p();return S(i.store.select(null))}),u(1,"\u2190 Video settings"),m(),Ye(2,"app-scene-inspector")}}function aS(t,e){t&1&&Ye(0,"app-video-settings")}var $s=class t{store=w(Q);static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-inspector"]],hostAttrs:["role","region","aria-label","Inspector",1,"inspector"],decls:2,vars:1,consts:[["type","button",1,"link","back",3,"click"]],template:function(n,o){n&1&&T(0,sS,3,0)(1,aS,1,0,"app-video-settings"),n&2&&D(o.store.selectedScene()?0:o.store.doc()?1:-1)},dependencies:[Fs,js],encapsulation:2})};var cS=["dialog"],lS=["frame"];function dS(t,e){t&1&&(b(0,"span",7),u(1),y()),t&2&&(l(),M(e))}var Bs=class t{picker=w(bt);store=w(Q);dialog=Ge.required("dialog");frame=Ge.required("frame");notice=A(null);target=_(()=>ng(this.store.doc(),this.store.selectedSceneId()));started=!1;returnFocus=null;constructor(){let e=n=>this.onMessage(n);globalThis.addEventListener?.("message",e),w(ue).onDestroy(()=>globalThis.removeEventListener?.("message",e)),Im(()=>{let n=this.picker.isOpen();Xe(()=>n?this.show():this.hide())})}show(){let e=this.dialog().nativeElement,n=this.frame().nativeElement;this.notice.set(null);let o=document.activeElement;this.returnFocus=o instanceof HTMLElement&&!e.contains(o)?o:null,e.open||(typeof e.showModal=="function"?e.showModal():e.setAttribute("open",""));let i=this.store.format();this.started?n.contentWindow?.postMessage(Yh(i),globalThis.location?.origin??"/"):(this.started=!0,n.src=Qh(i)),n.focus()}hide(){let e=this.dialog().nativeElement;if(this.started&&this.frame().nativeElement.contentWindow?.postMessage(Jh,globalThis.location?.origin??"/"),!e.open&&!e.hasAttribute("open"))return;typeof e.close=="function"&&e.close(),e.removeAttribute("open");let n=this.returnFocus;this.returnFocus=null,n?.isConnected&&n.focus()}onCancel(e){e.preventDefault(),e.stopPropagation(),this.picker.close()}onBackdrop(e){if(e.target!==this.dialog().nativeElement)return;let n=this.dialog().nativeElement.getBoundingClientRect();e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom||this.picker.close()}onMessage(e){if(!this.picker.isOpen()||e.source!==this.frame().nativeElement.contentWindow||e.origin!==globalThis.location?.origin)return;let n=Xh(e.data);if(!n)return;if(n.type==="pick-close"){this.picker.close();return}let o=this.picker.add(n);if(o){this.notice.set(o);return}this.picker.close()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-scene-picker"]],viewQuery:function(n,o){n&1&&Je(o.dialog,cS,5)(o.frame,lS,5),n&2&&dt(2)},decls:15,vars:2,consts:[["dialog",""],["frame",""],["aria-labelledby","picker-h","aria-describedby","picker-where",1,"picker",3,"cancel","keydown.escape","click"],[1,"picker-head"],["id","picker-h"],["id","picker-where",1,"muted","small"],[1,"spacer"],["role","alert",1,"picker-notice"],[1,"muted","small","picker-keys"],["type","button","aria-label","Close the scene picker","title","Close (Esc)",1,"icon","picker-close",3,"click"],["title","Scene types: search, preview and pick one to add",1,"picker-frame"]],template:function(n,o){if(n&1&&(b(0,"dialog",2,0),O("cancel",function(r){return o.onCancel(r)})("keydown.escape",function(r){return o.onCancel(r)})("click",function(r){return o.onBackdrop(r)}),b(2,"header",3)(3,"h2",4),u(4,"Add scene"),y(),b(5,"span",5),u(6),y(),re(7,"span",6),T(8,dS,2,1,"span",7),b(9,"span",8),u(10,"Enter or double-click adds \xB7 / search \xB7 Esc closes"),y(),b(11,"button",9),O("click",function(){return o.picker.close()}),u(12,"\xD7"),y()(),re(13,"iframe",10,1),y()),n&2){let i;l(6),B("Goes in ",o.target()),l(2),D((i=o.notice())?8:-1,i)}},encapsulation:2})};var uS=["stage"],fS=["playerFrame"];function pS(t,e){t&1&&(b(0,"div",5),u(1,"Waiting for the player\u2026"),y())}function mS(t,e){t&1&&(b(0,"div",6),u(1),y()),t&2&&(l(),M(e))}var Hs=class t{bridge=w(le);store=w(Q);stageRef=Ge.required("stage");frameRef=Ge.required("playerFrame");box=A({width:0,height:0});size=_(()=>zt[this.store.format()]??zt["16:9"]);scale=_(()=>{let{width:e,height:n}=this.box(),o=this.size();return!e||!n?1e-4:Math.min(e/o.width,n/o.height)});fps=_(()=>this.bridge.timeline()?.fps??this.store.doc()?.fps??30);duration=_(()=>this.bridge.timeline()?.duration??0);timecode=_(()=>ld(this.bridge.time(),this.fps()));total=_(()=>ld(this.duration(),this.fps()));frameCount=_(()=>this.bridge.timeline()?.frameCount??1);frame=_(()=>cd(this.bridge.time(),this.fps(),this.frameCount()));lastFrame=_(()=>Math.max(0,this.frameCount()-1));currentScene=_(()=>{let e=this.bridge.time(),n=this.bridge.timeline()?.scenes??[],o=n.find(i=>e>=i.start&&e<i.end)??n.at(-1);return o?`${o.index+1}/${n.length} \xB7 ${o.id}`:""});constructor(){let e=w(ue);Bt(()=>{let n=this.frameRef().nativeElement,o=n.contentWindow;o&&this.bridge.attach(o,globalThis.location?.origin??"*");let i=Xe(()=>this.store.format());n.src=`/player/?mode=studio&format=${encodeURIComponent(i)}`;let r=this.stageRef().nativeElement,s=()=>this.box.set({width:r.clientWidth,height:r.clientHeight});s();let a=typeof ResizeObserver>"u"?null:new ResizeObserver(s);a?.observe(r),e.onDestroy(()=>{a?.disconnect(),this.bridge.detach()})})}step(e){this.bridge.playing()&&this.bridge.pause(),this.bridge.seek(Rs(this.bridge.time(),this.fps(),e,this.duration()))}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-preview"]],viewQuery:function(n,o){n&1&&Je(o.stageRef,uS,5)(o.frameRef,fS,5),n&2&&dt(2)},hostAttrs:[1,"preview"],decls:23,vars:19,consts:[["stage",""],["playerFrame",""],[1,"stage"],[1,"stage-frame"],["title","Video preview","allow","autoplay","tabindex","-1"],["role","status",1,"stage-msg"],["role","alert",1,"stage-error"],["role","group","aria-label","Playback",1,"transport"],["type","button","aria-label","Previous frame","title","Previous frame (\u2190)",1,"icon",3,"click"],["type","button","title","Play/pause (Space)",1,"play",3,"click"],["type","button","aria-label","Next frame","title","Next frame (\u2192)",1,"icon",3,"click"],["aria-live","off",1,"timecode","mono"],[1,"muted"],[1,"frame-no","mono","muted"],[1,"spacer"],[1,"muted","small"]],template:function(n,o){if(n&1&&(b(0,"div",2,0)(2,"div",3),re(3,"iframe",4,1),y(),T(5,pS,2,0,"div",5),T(6,mS,2,1,"div",6),y(),b(7,"div",7)(8,"button",8),O("click",function(){return o.step(-1)}),u(9,"\u23EE"),y(),b(10,"button",9),O("click",function(){return o.bridge.togglePlay()}),u(11),y(),b(12,"button",10),O("click",function(){return o.step(1)}),u(13,"\u23ED"),y(),b(14,"span",11),u(15),b(16,"span",12),u(17),y()(),b(18,"span",13),u(19),y(),re(20,"span",14),b(21,"span",15),u(22),y()()),n&2){let i;l(2),ce("width",o.size().width*o.scale(),"px")("height",o.size().height*o.scale(),"px"),l(),ce("width",o.size().width,"px")("height",o.size().height,"px")("transform","scale("+o.scale()+")"),l(2),D(o.bridge.ready()?-1:5),l(),D((i=o.bridge.error())?6:-1,i),l(4),z("aria-label",o.bridge.playing()?"Pause":"Play"),l(),B(" ",o.bridge.playing()?"\u275A\u275A":"\u25B6"," "),l(4),B(" ",o.timecode()," "),l(2),B("/ ",o.total()),l(2),ke("frame ",o.frame()," / ",o.lastFrame()),l(3),M(o.currentScene())}},encapsulation:2})};var co={small:{title:"Small",fps:12,width:800},medium:{title:"Medium",fps:15,width:1080},large:{title:"Large",fps:20,width:1280}},yi=["small","medium","large"],Id={fps:{min:5,max:30},width:{min:240,max:1920}},hS={fps:12,width:800,range:{kind:"all"},loop:"forever"};function Hg(t,e={}){let n=v(v({},hS),Bg(t??{}));if(e.preset){let o=co[e.preset];o&&Object.assign(n,{fps:o.fps,width:o.width})}return v(v({},n),Bg({fps:e.fps,width:e.width,range:e.range,loop:e.loop}))}function Ug(t){return yi.find(e=>co[e].fps===t.fps&&co[e].width===t.width)??null}function gS(t,e){let n=Math.min(Math.round(e),t.width);return{width:n,height:Math.max(1,Math.round(n*t.height/t.width))}}function Gg(t){let e=0,n=t.scenes.map(o=>{let i=e;return e+=o.duration,{id:o.id,start:i,end:e}});return{duration:e,scenes:n}}function Wg(t,e){let n=Zg(t,e);if(n)throw new Error(n);if(t.kind==="scene"){let o=e.scenes.find(i=>i.id===t.scene);return{from:o.start,to:o.end}}return t.kind==="time"?{from:t.from,to:Math.min(t.to,e.duration)}:{from:0,to:e.duration}}function zg(t,e){let n=[];t.preset!==void 0&&!yi.includes(t.preset)&&n.push({field:"preset",message:`unknown GIF preset "${String(t.preset)}" (known: ${yi.join(", ")})`});for(let o of["fps","width"]){let i=t[o],{min:r,max:s}=Id[o];i!==void 0&&!(Number.isInteger(i)&&i>=r&&i<=s)&&n.push({field:o,message:`GIF ${o} must be a whole number from ${r} to ${s}, got ${String(i)}`})}if(t.loop!==void 0&&t.loop!=="forever"&&t.loop!=="once"&&n.push({field:"loop",message:`GIF loop must be "forever" or "once", got "${String(t.loop)}"`}),t.range!==void 0){let o=Kg(t.range)??(e?Zg(t.range,e):null);o&&n.push({field:"range",message:o})}return n}function qg(t,e,n){let{width:o,height:i}=gS(t,e.width);return Math.round(Math.max(1,Math.round(n*e.fps))*Math.sqrt(o*i)*yS)}var yS=3.5;function Kg(t){if(typeof t!="object"||t===null)return'GIF range must be an object with kind "all", "scene" or "time"';let e=t;return e.kind==="all"?null:e.kind==="scene"?typeof e.scene=="string"&&e.scene?null:'GIF range "scene" needs a scene id':e.kind==="time"?typeof e.from!="number"||typeof e.to!="number"||!Number.isFinite(e.from)||!Number.isFinite(e.to)?'GIF range "time" needs numbers from and to (seconds)':e.from<0?`GIF range starts before the video (from ${e.from}s)`:e.from>=e.to?`GIF range must end after it starts (from ${e.from}s, to ${e.to}s)`:null:'GIF range kind must be "all", "scene" or "time"'}var vS=.005;function Zg(t,e){let n=Kg(t);return n||(t.kind==="scene"&&!e.scenes.some(o=>o.id===t.scene)?`GIF range scene "${t.scene}" does not exist (scenes: ${e.scenes.map(o=>o.id).join(", ")||"none"})`:t.kind==="time"&&t.to>e.duration+vS?`GIF range ends after the video (to ${t.to}s, the video is ${bS(e.duration)}s)`:null)}function bS(t){return Math.round(t*100)/100}function Bg(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function Yg(t,e){if(e.type==="error")return t;let n="format"in e?e.format:void 0;if(!n)return t;let o=t.find(r=>r.format===n)??{format:n,phase:"queued",media:"mp4",frame:0,total:0},i;switch(e.type){case"phase":{let r=e.phase==="done"?o.media:e.media??"mp4",s=r!==o.media;i=v(x(v({},o),{phase:e.phase,media:r}),s?{frame:0,total:0}:{});break}case"progress":i=x(v({},o),{phase:"frames",media:e.media??"mp4",frame:e.frame,total:e.total});break;case"output":i=v(x(v({},o),{video:e.video,poster:e.poster}),e.bytes!==void 0?{videoBytes:e.bytes}:{});break;case"gif-output":i=x(v({},o),{gif:{path:e.gif,bytes:e.bytes,width:e.width,height:e.height,frames:e.frames}});break}return t.some(r=>r.format===n)?t.map(r=>r.format===n?i:r):[...t,i]}var xt=class t{api=w(Gt);store=w(Q);jobs=A({});all=this.jobs.asReadonly();streams=new Map;current=_(()=>{let e=this.store.file();return e?this.jobs()[e]??null:null});jobFor(e){return this.jobs()[e]??null}async start(e,n){let o=this.store.file();if(!o||this.jobFor(o)?.status==="running")return;let i=n?[...n.mp4?["mp4"]:[],...n.gif?["gif"]:[]]:["mp4"];if(this.set(o,{file:o,jobId:null,formats:e,media:i,status:"running",progress:[],phase:"Saving\u2026",error:null,notice:null}),!await this.store.save()){this.patch(o,{status:"error",phase:null,error:`Save failed: ${this.store.saveError()??"unknown error"}. Fix the problems and try again.`});return}try{let{jobId:r,existing:s}=await this.api.startRender(o,e,n);if(s){let a=(await this.api.listRenderJobs().catch(()=>[])).find(c=>c.jobId===r);this.patch(o,{jobId:r,formats:a?.formats??e,media:a?.media??i,phase:"Already rendering",notice:"A render of this video was already running, so no second one was started. Showing its progress."})}else this.patch(o,{jobId:r,phase:"Started"});this.listen(o,r)}catch(r){this.patch(o,{status:"error",phase:null,error:`Could not start the render: ${_S(r)}`})}}async sync(e){if(!e||this.streams.has(e)||this.jobFor(e)?.status==="running")return;let n;try{n=(await this.api.listRenderJobs()).find(o=>o.file===e&&o.state==="running")}catch{return}!n||this.streams.has(e)||this.jobFor(e)?.status==="running"||(this.set(e,{file:e,jobId:n.jobId,formats:n.formats,media:n.media??["mp4"],status:"running",progress:[],phase:"Rendering",error:null,notice:"A render of this video is running; following its progress."}),this.listen(e,n.jobId))}disconnectAll(){for(let e of this.streams.values())e.close();this.streams.clear()}listen(e,n){this.streams.get(e)?.close();let o=this.api.renderEvents(n,i=>this.onEvent(e,n,i),()=>{this.onClosed(e,n)});this.streams.set(e,{jobId:n,close:o})}stopListening(e){this.streams.get(e)?.close(),this.streams.delete(e)}onEvent(e,n,o){let i=this.jobFor(e);if(!i||i.jobId!==n)return;let r=Yg(i.progress,o);if(o.type==="error")this.patch(e,{progress:r,status:"error",error:o.message}),this.stopListening(e);else if(o.type==="phase"){let s=o.phase==="done"&&(!o.format||Qg(i.formats,r));this.patch(e,{progress:r,phase:s?"Done":o.format?`${o.format}: ${o.phase}`:o.phase,status:s?"done":i.status}),s&&this.stopListening(e)}else this.patch(e,{progress:r})}async onClosed(e,n){this.streams.get(e)?.jobId===n&&this.streams.delete(e);let o=this.jobFor(e);if(!o||o.jobId!==n||o.status!=="running")return;if(Qg(o.formats,o.progress)){this.patch(e,{status:"done",phase:"Done"});return}let i=await this.api.listRenderJobs().then(r=>r.find(s=>s.jobId===n)?.state).catch(()=>{});this.jobFor(e)?.jobId!==n||this.jobFor(e)?.status!=="running"||(i==="done"?this.patch(e,{status:"done",phase:"Done"}):i==="running"?this.patch(e,{status:"error",error:"Lost the progress stream; the render is still running. Reopen this dialog to follow it again."}):this.patch(e,{status:"error",error:"The progress stream closed before the render finished."}))}set(e,n){this.jobs.update(o=>x(v({},o),{[e]:n}))}patch(e,n){this.jobs.update(o=>o[e]?x(v({},o),{[e]:v(v({},o[e]),n)}):o)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};function Qg(t,e){return t.length>0&&t.every(n=>e.some(o=>o.format===n&&o.phase==="done"))}function _S(t){return t instanceof Error?t.message:String(t)}var ES=["dialog"],xS=(t,e)=>e.field,CS=(t,e)=>e.format;function IS(t,e){if(t&1){let n=j();b(0,"label",5)(1,"input",16),O("change",function(i){let r=I(n).$implicit,s=p();return S(s.toggle(r,i))}),y(),b(2,"span"),u(3),y()()}if(t&2){let n=e.$implicit,o=p();l(),R("value",n)("checked",o.shownFormats().includes(n)),l(2),M(n)}}function SS(t,e){if(t&1&&(b(0,"option",20),u(1),y()),t&2){let n=e.$implicit,o=p(2);R("value",n)("selected",o.preset()===n),l(),Jn("",o.presets[n].title," \xB7 ",o.presets[n].fps," fps \xB7 ",o.presets[n].width," px")}}function wS(t,e){t&1&&(b(0,"option",31),u(1,"Choose a scene"),y())}function TS(t,e){if(t&1&&(b(0,"option",20),u(1),y()),t&2){let n=e.$implicit,o=p(2);R("value",n)("selected",o.rangeScene()===n),l(),M(n)}}function DS(t,e){t&1&&(b(0,"p",35),u(1),y()),t&2&&(l(),M(e))}function MS(t,e){if(t&1&&(b(0,"p",12),u(1),y()),t&2){let n=e.$implicit;l(),M(n.message)}}function NS(t,e){t&1&&(b(0,"p",37),u(1),y()),t&2&&(l(),M(e))}function kS(t,e){if(t&1){let n=j();b(0,"fieldset",8)(1,"legend"),u(2,"GIF (no sound)"),y(),b(3,"div",17)(4,"label",18),u(5,"Preset"),y(),b(6,"select",19),O("change",function(i){I(n);let r=p();return S(r.setPreset(r.value(i)))}),L(7,SS,2,5,"option",20,me),b(9,"option",21),u(10,"Custom"),y()()(),b(11,"div",22)(12,"div",17)(13,"label",23),u(14,"Frame rate (fps)"),y(),b(15,"input",24),O("change",function(i){I(n);let r=p();return S(r.setNumber("fps",i))}),y()(),b(16,"div",17)(17,"label",25),u(18,"Width (px)"),y(),b(19,"input",26),O("change",function(i){I(n);let r=p();return S(r.setNumber("width",i))}),y()()(),b(20,"div",27)(21,"label",5)(22,"input",28),O("change",function(){I(n);let i=p();return S(i.setRangeKind("all"))}),y(),b(23,"span"),u(24,"Whole video"),y()(),b(25,"label",5)(26,"input",29),O("change",function(){I(n);let i=p();return S(i.setRangeKind("scene"))}),y(),b(27,"span"),u(28,"Scene"),y(),b(29,"select",30),O("change",function(i){I(n);let r=p();return S(r.setScene(r.value(i)))}),T(30,wS,2,0,"option",31),L(31,TS,2,3,"option",20,me),y()(),b(33,"label",5)(34,"input",32),O("change",function(){I(n);let i=p();return S(i.setRangeKind("time"))}),y(),b(35,"span"),u(36,"From"),y(),b(37,"input",33),O("change",function(i){I(n);let r=p();return S(r.setTime("from",i))}),y(),b(38,"span"),u(39,"to"),y(),b(40,"input",34),O("change",function(i){I(n);let r=p();return S(r.setTime("to",i))}),y(),b(41,"span"),u(42,"s"),y()(),T(43,DS,2,1,"p",35),y(),b(44,"label",5)(45,"input",36),O("change",function(i){I(n);let r=p();return S(r.setLoop(r.checked(i)))}),y(),b(46,"span"),u(47,"Loop forever"),y()(),L(48,MS,2,1,"p",12,xS),T(50,NS,2,1,"p",37),y()}if(t&2){let n,o,i=p();R("disabled",i.status()==="running"),l(7),F(i.presetIds),l(2),R("selected",i.preset()==="custom"),l(3),q("has-error",i.issueFor("fps")),l(3),R("min",i.limits.fps.min)("max",i.limits.fps.max)("value",i.gif().fps),l(),q("has-error",i.issueFor("width")),l(3),R("min",i.limits.width.min)("max",i.limits.width.max)("value",i.gif().width),l(),q("has-error",i.issueFor("range")),l(2),R("checked",i.gif().range.kind==="all"),l(4),R("checked",i.gif().range.kind==="scene"),l(3),R("disabled",i.gif().range.kind!=="scene"),l(),D(i.rangeScene()!==null&&!i.sceneIds().includes(i.rangeScene())?30:-1),l(),F(i.sceneIds()),l(3),R("checked",i.gif().range.kind==="time"),l(3),R("disabled",i.gif().range.kind!=="time")("value",i.rangeTime().from),l(3),R("disabled",i.gif().range.kind!=="time")("value",i.rangeTime().to),l(3),D((n=i.rangeNote())?43:-1,n),l(2),R("checked",i.gif().loop==="forever"),l(3),F(i.gifIssues()),l(2),D((o=i.sizeHint())?50:-1,o)}}function RS(t,e){t&1&&u(0,"GIF ")}function AS(t,e){if(t&1&&u(0),t&2){let n=p().$implicit;ke(" \xB7 ",n.frame,"/",n.total)}}function OS(t,e){if(t&1&&u(0),t&2){let n=p(2).$implicit,o=p(2);B(" \xB7 ",o.size(n.videoBytes))}}function PS(t,e){if(t&1&&(b(0,"p",40),u(1),T(2,OS,1,1),y(),b(3,"p",41),u(4),y()),t&2){let n=p().$implicit;l(),M(n.video),l(),D(n.videoBytes!==void 0?2:-1),l(2),M(n.poster)}}function LS(t,e){if(t&1&&(b(0,"p",40),u(1),y()),t&2){let n=e,o=p(3);l(),Kr("",n.path," \xB7 ",o.size(n.bytes)," \xB7 ",n.width,"x",n.height," \xB7 ",n.frames," frames")}}function FS(t,e){if(t&1&&(b(0,"li")(1,"div",38)(2,"strong"),u(3),y(),b(4,"span",10),T(5,RS,1,0),u(6),T(7,AS,1,2),y()(),re(8,"progress",39),T(9,PS,5,3),T(10,LS,2,5,"p",40),y()),t&2){let n,o=e.$implicit;l(3),M(o.format),l(2),D(o.media==="gif"&&o.phase!=="done"?5:-1),l(),M(o.phase),l(),D(o.total?7:-1),l(),R("value",o.total?o.frame:0)("max",o.total||1),z("aria-label","Progress "+o.format),l(),D(o.video?9:-1),l(),D((n=o.gif)?10:-1,n)}}function VS(t,e){if(t&1&&(b(0,"ul",9),L(1,FS,11,9,"li",null,CS),y()),t&2){let n=p();l(),F(n.progress())}}function jS(t,e){t&1&&(b(0,"p",10),u(1),y()),t&2&&(l(),M(e))}function $S(t,e){if(t&1&&(b(0,"p",11),u(1),y()),t&2){let n=p();l(),M(n.phase())}}function BS(t,e){if(t&1&&(b(0,"p",12),u(1),y()),t&2){let n=p();l(),M(n.error())}}var Us=class t{jobs=w(xt);store=w(Q);dialogRef=Ge.required("dialog");closed=eo();job=this.jobs.current;available=this.store.doc()?.formats.length?this.store.doc().formats:["16:9"];chosen=A(this.initialChoice());shownFormats=_(()=>{let e=this.job();return e?.status==="running"?e.formats:this.chosen()});status=_(()=>this.job()?.status??"idle");presets=co;presetIds=yi;limits=Id;mp4=A(this.store.doc()?.export?.mp4!==!1);gifOn=A(this.store.doc()?.export?.gif!==void 0);stored=this.storedGif();gif=A(this.stored.settings);rangeNote=A(this.stored.note);preset=_(()=>Ug(this.gif())??"custom");shownMp4=_(()=>{let e=this.job();return e?.status==="running"?e.media.includes("mp4"):this.mp4()});shownGif=_(()=>{let e=this.job();return e?.status==="running"?e.media.includes("gif"):this.gifOn()});sceneIds=_(()=>this.store.doc()?.scenes.map(e=>e.id)??[]);rangeScene=_(()=>{let e=this.gif().range;return e.kind==="scene"?e.scene:null});rangeTime=_(()=>{let e=this.gif().range;return e.kind==="time"?{from:e.from,to:e.to}:{from:0,to:HS(this.spans().duration)}});gifIssues=_(()=>this.gifOn()?zg(this.gif(),this.spans()):[]);sizeHint=_(()=>{if(this.gifIssues().length)return null;let{from:e,to:n}=Wg(this.gif().range,this.spans()),o=this.available.filter(i=>this.chosen().includes(i)).map(i=>`${Jg(qg($g(i),this.gif(),n-e))} (${i})`);return o.length?`\u2248 ${o.join(" \xB7 ")}, a rough estimate`:null});canStart=_(()=>this.chosen().length>0&&(this.mp4()||this.gifOn())&&this.gifIssues().length===0);spans=_(()=>Gg(this.store.doc()??{scenes:[]}));progress=_(()=>this.job()?.progress??[]);phase=_(()=>this.job()?.phase??null);error=_(()=>this.job()?.error??null);constructor(){Bt(()=>this.dialogRef().nativeElement.focus()),this.jobs.sync(this.store.file())}storedGif(){let e=this.store.doc(),n=Hg(e?.export?.gif),o=n.range;return o.kind!=="scene"||e?.scenes.some(i=>i.id===o.scene)?{settings:n,note:null}:{settings:x(v({},n),{range:{kind:"all"}}),note:`The saved GIF scene \u201C${o.scene}\u201D is no longer in the video: whole video instead.`}}initialChoice(){let e=this.jobs.current(),n=e?.status==="running"?this.available.filter(o=>e.formats.includes(o)):[];return n.length?n:[...this.available]}toggle(e,n){let o=n.target.checked;this.chosen.update(i=>o?[...i.filter(r=>r!==e),e]:i.filter(r=>r!==e))}start(){let e=this.available.filter(i=>this.chosen().includes(i)),n={mp4:this.mp4()},o=this.gifOn()?structuredClone(this.gif()):null;return o&&(n.gif=o),this.store.setExport($h(this.store.doc()?.export,o,this.mp4())),this.jobs.start(e,n)}checked(e){return e.target.checked}value(e){return e.target.value}issueFor(e){return this.gifIssues().some(n=>n.field===e)}setPreset(e){let n=co[e];n&&this.gif.update(o=>x(v({},o),{fps:n.fps,width:n.width}))}setNumber(e,n){let o=Number(this.value(n));this.gif.update(i=>x(v({},i),{[e]:o}))}setRangeKind(e){let n=this.sceneIds(),o=[this.rangeScene(),this.store.selectedSceneId(),n[0]].find(r=>r!=null&&n.includes(r))??"";this.rangeNote.set(null);let i=e==="scene"?{kind:e,scene:o}:e==="time"?v({kind:e},this.rangeTime()):{kind:e};this.gif.update(r=>x(v({},r),{range:i}))}setScene(e){this.gif.update(n=>x(v({},n),{range:{kind:"scene",scene:e}}))}setTime(e,n){let o=Number(this.value(n));this.gif.update(i=>x(v({},i),{range:x(v({kind:"time"},this.rangeTime()),{[e]:o})}))}setLoop(e){this.gif.update(n=>x(v({},n),{loop:e?"forever":"once"}))}size(e){return Jg(e)}onBackdrop(e){e.target===e.currentTarget&&this.status()!=="running"&&this.close()}close(){this.closed.emit()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-render-dialog"]],viewQuery:function(n,o){n&1&&Je(o.dialogRef,ES,5),n&2&&dt()},hostAttrs:[1,"modal-backdrop"],hostBindings:function(n,o){n&1&&k("click",function(r){return o.onBackdrop(r)})("keydown.escape",function(){return o.close()})},outputs:{closed:"closed"},decls:32,vars:12,consts:[["dialog",""],["role","dialog","aria-modal","true","aria-labelledby","render-h","tabindex","-1",1,"modal"],["id","render-h"],[1,"sf-group",3,"disabled"],[1,"format-checks"],[1,"sf-inline"],["type","checkbox","name","render-media","value","mp4",3,"change","checked"],["type","checkbox","name","render-media","value","gif",3,"change","checked"],[1,"sf-group","gif-settings",3,"disabled"],[1,"render-progress"],[1,"muted","small"],["role","status",1,"muted","small"],["role","alert",1,"sf-issue"],[1,"modal-actions"],["type","button",3,"click"],["type","button",1,"primary",3,"click","disabled"],["type","checkbox","name","render-format",3,"change","value","checked"],[1,"sf-field"],["for","gif-preset"],["id","gif-preset",3,"change"],[3,"value","selected"],["value","custom","disabled","",3,"selected"],[1,"grid-2"],["for","gif-fps"],["id","gif-fps","type","number","step","1",3,"change","min","max","value"],["for","gif-width"],["id","gif-width","type","number","step","10",3,"change","min","max","value"],["role","radiogroup","aria-label","GIF range",1,"sf-field"],["type","radio","name","gif-range","value","all",3,"change","checked"],["type","radio","name","gif-range","value","scene",3,"change","checked"],["aria-label","GIF scene",3,"change","disabled"],["value","","disabled","","selected",""],["type","radio","name","gif-range","value","time",3,"change","checked"],["type","number","aria-label","GIF from (s)","min","0","step","0.1",3,"change","disabled","value"],["type","number","aria-label","GIF to (s)","min","0","step","0.1",3,"change","disabled","value"],["role","status",1,"sf-hint","gif-range-note"],["type","checkbox","name","gif-loop",3,"change","checked"],[1,"sf-hint"],[1,"row"],[3,"value","max"],[1,"mono","small","out-path"],[1,"mono","small","out-path","muted"]],template:function(n,o){if(n&1&&(b(0,"div",1,0)(2,"h2",2),u(3,"Render"),y(),b(4,"fieldset",3)(5,"legend"),u(6,"Formats"),y(),b(7,"div",4),L(8,IS,4,3,"label",5,me),y()(),b(10,"fieldset",3)(11,"legend"),u(12,"Outputs"),y(),b(13,"div",4)(14,"label",5)(15,"input",6),O("change",function(r){return o.mp4.set(o.checked(r))}),y(),b(16,"span"),u(17,"MP4"),y()(),b(18,"label",5)(19,"input",7),O("change",function(r){return o.gifOn.set(o.checked(r))}),y(),b(20,"span"),u(21,"GIF"),y()()()(),T(22,kS,51,26,"fieldset",8),T(23,VS,3,0,"ul",9),T(24,jS,2,1,"p",10),T(25,$S,2,1,"p",11),T(26,BS,2,1,"p",12),b(27,"div",13)(28,"button",14),O("click",function(){return o.close()}),u(29),y(),b(30,"button",15),O("click",function(){return o.start()}),u(31),y()()()),n&2){let i;l(4),R("disabled",o.status()==="running"),l(4),F(o.available),l(2),R("disabled",o.status()==="running"),l(5),R("checked",o.shownMp4()),l(4),R("checked",o.shownGif()),l(3),D(o.shownGif()?22:-1),l(),D(o.progress().length?23:-1),l(),D((i=o.job()?.notice)?24:-1,i),l(),D(o.phase()?25:-1),l(),D(o.error()?26:-1),l(3),M(o.status()==="running"?"Hide":"Close"),l(),R("disabled",o.status()==="running"||!o.canStart()),l(),B(" ",o.status()==="done"?"Render again":o.status()==="running"?"Rendering\u2026":"Start render"," ")}},encapsulation:2})};function HS(t){return Math.floor(t*100+1e-6)/100}function Jg(t){return t<1024?`${t} B`:t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}var US=["scroll"],GS=["content"],WS=(t,e)=>e.t,Sd=(t,e)=>e.id,Xg=(t,e)=>e.sceneId;function zS(t,e){t&1&&(b(0,"span",9),u(1),y()),t&2&&(l(),B("\u2669 ",e," bpm"))}function qS(t,e){if(t&1&&(b(0,"span"),u(1),y()),t&2){let n=p().$implicit;l(),M(n.label)}}function KS(t,e){if(t&1&&(b(0,"div",29),T(1,qS,2,1,"span"),y()),t&2){let n=e.$implicit;ce("left",n.x,"px"),q("major",n.major),l(),D(n.label?1:-1)}}function ZS(t,e){if(t&1&&re(0,"div",32),t&2){let n=e.$implicit;ce("left",n,"px")}}function QS(t,e){if(t&1&&re(0,"div",33),t&2){let n=e.$implicit;ce("left",n,"px")}}function YS(t,e){if(t&1&&(b(0,"div",17),L(1,ZS,1,2,"div",30,me),L(3,QS,1,2,"div",31,oe),y()),t&2){let n=e;l(),F(n.beats),l(2),F(n.bars)}}function JS(t,e){if(t&1&&re(0,"div",43),t&2){let n=e.$implicit,o=p().$implicit,i=p();ce("left",n.offset*i.zoom(),"px"),q("late",n.offset>o.duration)}}function XS(t,e){if(t&1&&(b(0,"span",39),u(1,"\u26A0"),y()),t&2){p();let n=we(0);R("title",n.join(`
|
|
15
|
+
`)),z("aria-label",n.length+" warnings")}}function ew(t,e){if(t&1&&(b(0,"span",40),u(1),y()),t&2){let n=e;R("title",n.message),z("aria-label","Too short to read: "+n.issue.missing.toFixed(1)+" s missing"),l(),B("+",n.issue.missing.toFixed(1)," s")}}function tw(t,e){if(t&1){let n=j();b(0,"button",44),O("pointerdown",function(i){return i.stopPropagation()})("click",function(){I(n);let i=p().$implicit,r=p();return S(r.snapToBeat(i.id))}),u(1,"\u2669"),y()}if(t&2){let n=e,o=p().$implicit,i=p();R("title","Ends "+i.offBy(n.off)+" s off the beat. Click: snap to the beat ("+i.fmt(n.suggested)+")"),z("aria-label","Snap "+o.id+" to the beat: "+i.fmt(n.suggested))}}function nw(t,e){if(t&1){let n=j();Xn(0),b(1,"div",34),O("pointerdown",function(i){let r=I(n).$implicit,s=p();return S(s.startMove(i,r))})("keydown.enter",function(){let i=I(n).$implicit,r=p();return S(r.store.select(i.id))}),L(2,JS,1,4,"div",35,Sd),b(4,"div",36)(5,"span",37),u(6),y(),b(7,"span",38),u(8),y()(),T(9,XS,2,2,"span",39),T(10,ew,2,3,"span",40),T(11,tw,2,2,"button",41),b(12,"div",42),O("pointerdown",function(i){let r=I(n).$implicit,s=p();return S(s.startResize(i,r))}),y()()}if(t&2){let n,o,i=e.$implicit,r=p(),s=Qo(r.issues.sceneWarnings(i));l(),ce("left",i.start*r.zoom(),"px")("width",i.duration*r.zoom(),"px")("transform",r.movingId()===i.id?"translateX("+r.moveDx()+"px)":null),q("selected",i.id===r.selectedId())("has-warning",s.length>0)("short-read",r.readTimeById().has(i.id))("off-beat",r.offBeat().has(i.id))("dragging",r.movingId()===i.id),z("aria-label","Scene "+(i.index+1)+": "+i.id+", "+r.fmt(i.duration))("aria-pressed",i.id===r.selectedId()),l(),F(i.beats),l(4),M(i.id),l(2),ke("",i.type," \xB7 ",r.fmt(i.duration)),l(),D(s.length?9:-1),l(),D((n=r.readTimeById().get(i.id))?10:-1,n),l(),D((o=r.offBeat().get(i.id))?11:-1,o),l(),R("title",r.bpm()?"Drag to change the duration: the end snaps to the beat, bar lines first (Alt: no snap)":"Drag to change the duration (Alt: no snap)"),z("aria-label","Drag to change the duration of "+i.id)}}function ow(t,e){if(t&1&&re(0,"div",45),t&2){let n=e.$implicit;ce("left",n.left,"px")("width",n.width,"px"),q("reveal",n.reveal),R("title",n.title),z("data-kind",n.kind)("data-scene",n.sceneId)}}function iw(t,e){if(t&1&&(b(0,"div",46)(1,"span",47),u(2),y()()),t&2){let n=e,o=p();ce("left",n.start*o.zoom(),"px")("width",n.duration*o.zoom(),"px"),l(2),M(o.fmt(n.duration))}}function rw(t,e){if(t&1&&re(0,"div",48),t&2){let n=p();ce("left",n.dropX(),"px")}}function sw(t,e){if(t&1&&(b(0,"div",22),u(1),y()),t&2){let n=p();l(),M(n.bridge.ready()?"No timeline yet.":"Waiting for the player\u2019s timeline\u2026")}}function aw(t,e){if(t&1&&re(0,"div",52),t&2){let n=e;ce("left",n.x,"px")("width",n.width,"px")}}function cw(t,e){if(t&1){let n=j();b(0,"div",50),O("pointerdown",function(i){return i.stopPropagation()})("click",function(){let i=I(n).$implicit,r=p(2);return S(r.store.select(i.sceneId))}),T(1,aw,1,4,"div",51),y()}if(t&2){let n,o=e.$implicit,i=p(2);ce("left",o.x,"px")("width",o.width,"px"),q("estimate",o.estimate)("stale",o.state==="stale")("selected",o.sceneId===i.selectedId()),R("title",o.title),l(),D((n=o.over)?1:-1,n)}}function lw(t,e){if(t&1&&(b(0,"div",23),L(1,cw,2,12,"div",49,Xg),y()),t&2){let n=p();l(),F(n.speechBars())}}function dw(t,e){if(t&1){let n=j();b(0,"div",56),O("pointerdown",function(i){let r=I(n),s=r.$implicit,a=r.$index,c=p(),d=p();return S(d.startBeat(i,c,s,a))})("keydown",function(i){let r=I(n).$implicit,s=p(),a=p();return S(a.onBeatKey(i,s,r))})("keyup",function(){I(n);let i=p(2);return S(i.store.endCoalescing())})("blur",function(){I(n);let i=p(2);return S(i.store.endCoalescing())}),b(1,"span",57),u(2),y()()}if(t&2){let n=e.$implicit,o=e.$index,i=p(),r=p();ce("left",n.at*r.zoom(),"px"),q("overridden",n.overridden)("late",n.offset>i.duration)("active",r.beatDragId()===n.id),R("title",(n.label||n.id)+" \xB7 gap "+r.fmt(n.gap)+" \xB7 at "+r.fmt(n.offset)+(n.overridden?" (changed)":"")+(n.offset>i.duration?" \xB7 after the scene end":"")),z("aria-label","Beat "+(n.label||n.id)+", gap "+r.fmt(n.gap))("aria-valuenow",n.gap)("aria-valuemin",0),l(),ce("top",2+(r.beatRows()[o]??0)*13,"px"),q("collapsed",r.beatRows()[o]===null),l(),M(n.label||n.id)}}function uw(t,e){if(t&1&&(b(0,"div",58)(1,"span",47),u(2),y()()),t&2){let n=e,o=p(2);ce("left",n.at*o.zoom(),"px"),l(2),B("+",o.fmt(n.gap))}}function fw(t,e){if(t&1&&(re(0,"div",53),L(1,dw,3,17,"div",54,Sd),T(3,uw,3,3,"div",55)),t&2){let n,o=e,i=p();ce("left",o.start*i.zoom(),"px")("width",o.duration*i.zoom(),"px"),l(),F(o.beats),l(2),D((n=i.beatGhost())?3:-1,n)}}function pw(t,e){if(t&1&&(b(0,"span",59),u(1,"Select a scene to see and drag its beats"),y()),t&2){let n=p();ce("left",n.scrollLeft()+8,"px")}}function mw(t,e){if(t&1&&re(0,"div",60),t&2){let n=e.$implicit,o=p();ce("left",n.at*o.zoom(),"px"),q("doc",n.source==="doc"),R("title",n.sound+" \xB7 "+n.sceneId+" \xB7 "+o.fmt(n.at)+(n.source==="doc"?"":" (built-in)"))}}var Gs=class t{store=w(Q);bridge=w(le);issues=w(tt);beatGrid=w(Wt);speech=w(et);picker=w(bt);injector=w(Ce);readTimeById=_(()=>new Map(this.issues.readTime().map(e=>[e.sceneId,e])));scrollRef=Ge.required("scroll");contentRef=Ge.required("content");minZoom=rd;maxZoom=sd;zoom=A(lg);scrollLeft=A(0);drag=A(null);scenes=_(()=>this.bridge.timeline()?.scenes??[]);transitionMarkers=_(()=>this.scenes().flatMap(e=>{let n=hg(e,this.zoom());return n?[x(v({},n),{sceneId:e.id})]:[]}));duration=_(()=>this.bridge.timeline()?.duration??0);sfx=_(()=>this.bridge.timeline()?.sfx??[]);sceneTypes=_(()=>this.bridge.project()?.sceneTypes??[]);selectedId=this.store.selectedSceneId;selected=_(()=>this.scenes().find(e=>e.id===this.selectedId())??null);ticks=_(()=>ug(this.duration(),this.zoom()));bpm=_(()=>this.beatGrid.bpm()??null);offBeat=this.beatGrid.offBeat;grid=_(()=>{let e=this.beatGrid.beat();return e===void 0?null:bg(this.scenes(),this.duration(),e,this.zoom())});speechBars=_(()=>{let e=this.speech.scenes(),n=this.zoom();return e.size?this.scenes().flatMap(o=>{let i=e.get(o.id),r=i?Ig(o.start,o.end,i,n):null;return r?[r]:[]}):[]});contentWidth=_(()=>{let e=this.resizeGhost();return Math.max(this.duration(),e?e.start+e.duration:0)*this.zoom()+240});resizeGhost=_(()=>{let e=this.drag();return e?.kind==="resize"?e:null});beatGhost=_(()=>{let e=this.drag();return e?.kind==="beat"?e:null});beatDragId=_(()=>this.beatGhost()?.beatId??null);beatRows=_(()=>{let e=this.zoom();return mg((this.selected()?.beats??[]).map(n=>({x:n.at*e,width:pg(n.label||n.id)})))});movingId=_(()=>{let e=this.drag();return e?.kind==="move"?e.sceneId:null});moveDx=_(()=>{let e=this.drag();return e?.kind==="move"?e.dx:0});dropX=_(()=>{let e=this.drag();if(e?.kind!=="move"||e.to===e.from)return null;let n=this.scenes().filter((i,r)=>r!==e.from);return n.length?(e.to<n.length?n[e.to].start:n.at(-1)?.end??0)*this.zoom():null});constructor(){He(()=>{let e=this.bridge.time()*this.zoom();if(!this.bridge.playing())return;let n=Xe(()=>this.scrollRef().nativeElement);(e<n.scrollLeft||e>n.scrollLeft+n.clientWidth-40)&&(n.scrollLeft=Math.max(0,e-40))}),Bt(()=>{let e=this.scrollRef().nativeElement;e.addEventListener("scroll",()=>this.scrollLeft.set(e.scrollLeft),{passive:!0})})}fmt(e){return mi(e)}offBy(e){return String(Math.max(.01,Math.round(Math.abs(e)*100)/100))}snapToBeat(e){let n=this.beatGrid.beat();n!==void 0&&(this.store.endCoalescing(),this.store.apply(o=>_s(o,e,n)),this.store.endCoalescing())}setZoom(e){this.zoom.set(ks(e.target.valueAsNumber))}zoomBy(e,n){let o=this.scrollRef().nativeElement,i=o.getBoundingClientRect(),r=n!==void 0?n-i.left:o.clientWidth/2,s=fi(o.scrollLeft+r,this.zoom()),a=ks(this.zoom()*e);this.zoom.set(a),Bt(()=>o.scrollLeft=Math.max(0,s*a-r),{injector:this.injector})}fit(){let e=this.duration();e<=0||(this.zoom.set(ks((this.scrollRef().nativeElement.clientWidth-48)/e)),this.scrollRef().nativeElement.scrollLeft=0)}onWheel(e){!e.ctrlKey&&!e.metaKey||(e.preventDefault(),this.zoomBy(Math.exp(-e.deltaY*.002),e.clientX))}timeAt(e){let n=this.contentRef().nativeElement.getBoundingClientRect();return Math.max(0,fi(e-n.left,this.zoom()))}track(e,n,o){e.preventDefault();let i=s=>n(s),r=s=>{globalThis.removeEventListener("pointermove",i),globalThis.removeEventListener("pointerup",r),globalThis.removeEventListener("pointercancel",r),o(s)};globalThis.addEventListener("pointermove",i),globalThis.addEventListener("pointerup",r),globalThis.addEventListener("pointercancel",r)}startScrub(e){e.button===0&&(this.bridge.playing()&&this.bridge.pause(),this.seekAt(e.clientX),this.track(e,n=>this.seekAt(n.clientX),()=>{}))}seekAt(e){let n=this.bridge.timeline(),o=n?.fps??30,i=Ns(this.timeAt(e),0,pi(n?.duration??0,o));this.bridge.seek(dg(i,o))}onLanePointer(e){e.target===e.currentTarget&&this.store.select(null)}startResize(e,n){if(e.button!==0)return;e.stopPropagation(),this.store.select(n.id);let o=this.store.doc(),i=o&&In(o,n.id)?.duration||n.duration,r=o?bs(o,n.id):-1,s=r>=0?r:n.start,a=e.clientX;this.drag.set({kind:"resize",sceneId:n.id,start:n.start,duration:i}),this.track(e,c=>{let d=i+fi(c.clientX-a,this.zoom()),f=vg(d,{start:s,beat:this.beatGrid.beat(),pxPerSecond:this.zoom(),enabled:!c.altKey});this.drag.set({kind:"resize",sceneId:n.id,start:n.start,duration:f}),this.store.apply(g=>so(g,n.id,f),`duration:${n.id}`)},()=>{this.drag.set(null),this.store.endCoalescing()})}startBeat(e,n,o,i){if(e.button!==0)return;e.stopPropagation();let r=i>0?n.beats[i-1].offset:0,s=e.clientX;this.drag.set({kind:"beat",sceneId:n.id,beatId:o.id,at:o.at,gap:o.gap}),this.track(e,a=>{let c=Math.max(0,Ms(o.gap+fi(a.clientX-s,this.zoom()),!a.altKey));this.drag.set({kind:"beat",sceneId:n.id,beatId:o.id,at:n.start+r+c,gap:c}),this.store.apply(d=>ai(d,n.id,o.id,c),`beat:${n.id}:${o.id}`)},()=>{this.drag.set(null),this.store.endCoalescing()})}onBeatKey(e,n,o){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight")return;e.preventDefault(),e.stopPropagation();let i=(e.shiftKey?.5:.05)*(e.key==="ArrowLeft"?-1:1);this.store.apply(r=>ai(r,n.id,o.id,Math.max(0,o.gap+i)),`beat:${n.id}:${o.id}`)}startMove(e,n){if(e.button!==0)return;this.store.select(n.id);let o=e.clientX,i=!1;this.track(e,r=>{let s=r.clientX-o;if(!i&&Math.abs(s)<4)return;i=!0;let a=fg(this.scenes(),n.index,this.timeAt(r.clientX));this.drag.set({kind:"move",sceneId:n.id,from:n.index,to:a,dx:s})},()=>{let r=this.drag();this.drag.set(null),i&&r?.kind==="move"&&r.to!==r.from&&this.store.apply(s=>Es(s,De(s,n.id),r.to))})}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-timeline"]],viewQuery:function(n,o){n&1&&Je(o.scrollRef,US,5)(o.contentRef,GS,5),n&2&&dt(2)},hostAttrs:["role","region","aria-label","Timeline",1,"timeline"],decls:40,vars:22,consts:[["scroll",""],["content",""],[1,"tl-toolbar"],["type","button","aria-label","Zoom out","title","Zoom out (Ctrl/Cmd + wheel)",1,"icon",3,"click"],["type","range","aria-label","Zoom",1,"tl-zoom",3,"input","min","max","value"],["type","button","aria-label","Zoom in","title","Zoom in",1,"icon",3,"click"],["type","button",1,"ghost",3,"click"],[1,"muted","small"],[1,"spacer"],["title","Scene ends snap to the music's beat; bar lines first",1,"muted","small","tl-bpm"],[1,"muted","small","tl-help"],["type","button","id","add-scene","aria-haspopup","dialog","title","Pick a scene type from the gallery; it goes after the selected scene",1,"add-scene",3,"click","disabled"],[1,"tl-scroll",3,"wheel"],[1,"tl-content"],["role","slider","tabindex","0","aria-label","Playhead: click or drag to scrub",1,"tl-ruler",3,"pointerdown"],[1,"tl-tick",3,"major","left"],[1,"tl-scenes",3,"pointerdown"],["aria-hidden","true",1,"tl-grid"],["role","button","tabindex","0",1,"tl-block",3,"selected","has-warning","short-read","off-beat","dragging","left","width","transform"],[1,"tl-transition",3,"reveal","left","width","title"],[1,"tl-ghost",3,"left","width"],[1,"tl-drop",3,"left"],[1,"tl-empty","muted"],["aria-label","Narration",1,"tl-speech"],[1,"tl-beats"],[1,"tl-hint","muted","small",3,"left"],["aria-label","Sounds",1,"tl-sfx"],[1,"tl-sfx-dot",3,"doc","left","title"],[1,"tl-playhead"],[1,"tl-tick"],[1,"tl-grid-beat",3,"left"],[1,"tl-grid-bar",3,"left"],[1,"tl-grid-beat"],[1,"tl-grid-bar"],["role","button","tabindex","0",1,"tl-block",3,"pointerdown","keydown.enter"],[1,"tl-beat-tick",3,"late","left"],[1,"tl-block-text"],[1,"tl-block-id"],[1,"tl-block-meta"],["role","img",1,"tl-warn-icon",3,"title"],["role","img",1,"tl-read-icon",3,"title"],["type","button",1,"tl-offbeat",3,"title"],[1,"tl-resize",3,"pointerdown","title"],[1,"tl-beat-tick"],["type","button",1,"tl-offbeat",3,"pointerdown","click","title"],[1,"tl-transition",3,"title"],[1,"tl-ghost"],[1,"mono"],[1,"tl-drop"],[1,"tl-speech-bar",3,"estimate","stale","selected","left","width","title"],[1,"tl-speech-bar",3,"pointerdown","click","title"],[1,"tl-speech-over",3,"left","width"],[1,"tl-speech-over"],[1,"tl-scene-range"],["role","slider","tabindex","0",1,"tl-beat",3,"overridden","late","active","left","title"],[1,"tl-beat-ghost",3,"left"],["role","slider","tabindex","0",1,"tl-beat",3,"pointerdown","keydown","keyup","blur","title"],[1,"tl-beat-label"],[1,"tl-beat-ghost"],[1,"tl-hint","muted","small"],[1,"tl-sfx-dot",3,"title"]],template:function(n,o){if(n&1&&(b(0,"div",2)(1,"button",3),O("click",function(){return o.zoomBy(1/1.25)}),u(2,"\u2212"),y(),b(3,"input",4),O("input",function(r){return o.setZoom(r)}),y(),b(4,"button",5),O("click",function(){return o.zoomBy(1.25)}),u(5,"+"),y(),b(6,"button",6),O("click",function(){return o.fit()}),u(7,"Fit"),y(),b(8,"span",7),u(9),y(),re(10,"span",8),T(11,zS,2,1,"span",9),b(12,"span",10),u(13),y(),b(14,"button",11),O("click",function(){return o.picker.open()}),u(15," + Add scene\u2026 "),y()(),b(16,"div",12,0),O("wheel",function(r){return o.onWheel(r)}),b(18,"div",13,1)(20,"div",14),O("pointerdown",function(r){return o.startScrub(r)}),L(21,KS,2,5,"div",15,WS),y(),b(23,"div",16),O("pointerdown",function(r){return o.onLanePointer(r)}),T(24,YS,5,0,"div",17),L(25,nw,13,27,"div",18,Sd),L(27,ow,1,9,"div",19,Xg),T(29,iw,3,5,"div",20),T(30,rw,1,2,"div",21),T(31,sw,2,1,"div",22),y(),T(32,lw,3,0,"div",23),b(33,"div",24),T(34,fw,4,5)(35,pw,2,2,"span",25),y(),b(36,"div",26),L(37,mw,1,5,"div",27,oe),y(),re(39,"div",28),y()()),n&2){let i,r,s,a;l(3),R("min",o.minZoom)("max",o.maxZoom)("value",o.zoom()),l(6),ke("",o.scenes().length," scenes \xB7 ",o.fmt(o.duration())),l(2),D((i=o.bpm())?11:-1,i),l(2),B("Drag a block's right edge to retime",o.bpm()?" (snaps to the beat)":""," \xB7 drag a block to reorder \xB7 Alt disables snapping"),l(),R("disabled",!o.sceneTypes().length||!o.store.doc()),l(4),ce("width",o.contentWidth(),"px"),l(2),z("aria-valuemin",0)("aria-valuemax",o.duration())("aria-valuenow",o.bridge.time())("aria-valuetext",o.fmt(o.bridge.time())),l(),F(o.ticks()),l(3),D((r=o.grid())?24:-1,r),l(),F(o.scenes()),l(2),F(o.transitionMarkers()),l(2),D((s=o.resizeGhost())?29:-1,s),l(),D(o.dropX()!==null?30:-1),l(),D(o.scenes().length?-1:31),l(),D(o.speechBars().length?32:-1),l(2),D((a=o.selected())?34:35,a),l(3),F(o.sfx()),l(2),ce("left",o.bridge.time()*o.zoom(),"px")}},encapsulation:2})};function ey(t){return Object.values(t).filter(e=>e.status==="running").length}function ty(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.status]))}var hw=(t,e=140)=>t.length>e?`${t.slice(0,e-1)}\u2026`:t;function ny(t,e){let n=[];for(let o of Object.values(e)){if(t[o.file]!=="running"||o.status==="running")continue;let i=o.file.replace(/\.video\.json$/,"");o.status==="done"?n.push({title:"Render finished",body:`${i} \xB7 ${o.formats.join(", ")}`,file:o.file,tag:`render:${o.file}`}):o.status==="error"&&n.push({title:"Render failed",body:hw(`${i}: ${o.error??"unknown error"}`),file:o.file,tag:`render:${o.file}`})}return n}var iy="beatsheet:notify";function gw(){try{return localStorage.getItem(iy)==="1"}catch{return!1}}function oy(t){try{localStorage.setItem(iy,t?"1":"0")}catch{}}var lo=class t{jobs=w(xt);store=w(Q);view=w(_t);doc=w(Ne);injector=w(Ce);supported=typeof Notification<"u";on=A(this.supported&&gw()&&Notification.permission==="granted");blocked=A(this.supported&&Notification.permission==="denied");started=!1;before={};start(){this.started||(this.started=!0,He(()=>{let e=this.jobs.all();this.paintBadge(ey(e));let n=ny(this.before,e);if(this.before=ty(e),this.on()&&!this.doc.hasFocus())for(let o of n)this.show(o)},{injector:this.injector}),navigator.serviceWorker?.addEventListener("message",e=>{let n=e.data;n?.type==="open-video"&&n.file&&this.openVideo(n.file)}))}async toggle(){if(!this.supported)return;if(this.on()){this.on.set(!1),oy(!1);return}let e=Notification.permission==="default"?await Notification.requestPermission():Notification.permission;this.blocked.set(e==="denied"),this.on.set(e==="granted"),oy(e==="granted")}paintBadge(e){"setAppBadge"in navigator&&(e>0?navigator.setAppBadge(e):navigator.clearAppBadge()).catch(()=>{})}async openVideo(e){this.view.show("editor"),this.store.file()!==e&&await this.store.open(e)}async show(e){let n={body:e.body,tag:e.tag,icon:"/icons/icon-192.png",data:{file:e.file}};try{let o=await navigator.serviceWorker?.getRegistration();if(o){await o.showNotification(e.title,n);return}let i=new Notification(e.title,n);i.onclick=()=>{this.doc.defaultView?.focus(),this.openVideo(e.file),i.close()}}catch{}}static \u0275fac=function(n){return new(n||t)};static \u0275prov=K({token:t,factory:t.\u0275fac,providedIn:"root"})};var yw=(t,e)=>e.file;function vw(t,e){if(t&1&&(b(0,"option",6),u(1),y()),t&2){let n=e.$implicit,o=p();R("value",n.file)("selected",n.file===o.store.file()),l(),M(n.title||n.file)}}function bw(t,e){if(t&1){let n=j();b(0,"button",19),O("click",function(){let i=I(n).$implicit,r=p(2);return S(r.store.setFormat(i))}),u(1),y()}if(t&2){let n=e.$implicit,o=p(2);q("on",o.store.format()===n),z("aria-pressed",o.store.format()===n),l(),B(" ",n," ")}}function _w(t,e){if(t&1&&(b(0,"div",9),L(1,bw,2,4,"button",18,me),y()),t&2){let n=p();l(),F(n.formats())}}function Ew(t,e){if(t&1){let n=j();b(0,"button",20),O("click",function(){I(n);let i=p();return S(i.notify.toggle())}),u(1),y()}if(t&2){let n=p();R("title",n.notify.blocked()?"Notifications are blocked for this site in the browser settings":"Notify me when a render finishes or fails while the studio is in the background"),z("aria-pressed",n.notify.on()),l(),B(" ",n.notify.blocked()?"Notifications blocked":n.notify.on()?"Notifications on":"Notifications off"," ")}}function xw(t,e){if(t&1&&(b(0,"span",15),u(1),y()),t&2){let n=p();l(),ke("",n.issues.errorCount()," ",n.issues.errorCount()===1?"problem":"problems")}}function Cw(t,e){if(t&1&&(b(0,"span",16),u(1),y()),t&2){let n=p();R("title",n.issues.silencedNote()),l(),ke("",n.issues.errorCount()?"\xB7 ":"","",n.issues.silencedLabel())}}var ry=["16:9","4:5"],Ws=class t{store=w(Q);issues=w(tt);renderJobs=w(xt);view=w(_t);notify=w(lo);render=eo();videos=_(()=>this.store.project()?.videos??[]);formats=_(()=>{let e=(this.store.doc()?.formats??[]).filter(n=>!ry.includes(n));return[...ry,...e]});saveLabel=_(()=>{let e=this.store.saveState();return e==="saving"?"Saving\u2026":e==="error"?"Save failed":e==="conflict"?"Changed on disk":this.store.dirty()?"Unsaved":e==="saved"?"Saved":"Up to date"});async onPick(e){let n=e.target;await this.store.open(n.value)||(n.value=this.store.file()??"")}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-top-bar"]],hostAttrs:["role","banner",1,"top-bar"],outputs:{render:"render"},decls:28,vars:23,consts:[[1,"brand"],["role","group","aria-label","Workspace",1,"segmented","view-switch"],["type","button","data-view-switch","editor",3,"click"],["type","button","data-view-switch","gallery","title","Scene types with live previews, sounds and music of this project",3,"click"],["for","video-picker",1,"sr-only"],["id","video-picker",1,"video-picker",3,"change","disabled"],[3,"value","selected"],[1,"doc-title",3,"title"],[1,"spacer"],["role","group","aria-label","Preview format",1,"segmented"],["type","button",1,"ghost",3,"title"],["role","group","aria-label","History",1,"btn-group"],["type","button","aria-label","Undo","title","Undo (Cmd/Ctrl+Z)",1,"icon",3,"click","disabled"],["type","button","aria-label","Redo","title","Redo (Shift+Cmd/Ctrl+Z)",1,"icon",3,"click","disabled"],["type","button","aria-live","polite",1,"save-state",3,"click","title"],["role","status",1,"issue-badge"],["role","status",1,"issue-silenced",3,"title"],["type","button",1,"primary",3,"click","disabled"],["type","button",3,"on"],["type","button",3,"click"],["type","button",1,"ghost",3,"click","title"]],template:function(n,o){n&1&&(b(0,"span",0),u(1,"beatsheet"),y(),b(2,"div",1)(3,"button",2),O("click",function(){return o.view.show("editor")}),u(4," Editor "),y(),b(5,"button",3),O("click",function(){return o.view.show("gallery")}),u(6," Gallery "),y()(),b(7,"label",4),u(8,"Video"),y(),b(9,"select",5),O("change",function(r){return o.onPick(r)}),L(10,vw,2,3,"option",6,yw),y(),b(12,"span",7),u(13),y(),re(14,"span",8),T(15,_w,3,0,"div",9),T(16,Ew,2,3,"button",10),b(17,"div",11)(18,"button",12),O("click",function(){return o.store.undo()}),u(19,"\u21B6"),y(),b(20,"button",13),O("click",function(){return o.store.redo()}),u(21,"\u21B7"),y()(),b(22,"button",14),O("click",function(){return o.store.save()}),u(23),y(),T(24,xw,2,2,"span",15),T(25,Cw,2,3,"span",16),b(26,"button",17),O("click",function(){return o.render.emit()}),u(27),y()),n&2&&(l(3),q("on",o.view.view()==="editor"),z("aria-pressed",o.view.view()==="editor"),l(2),q("on",o.view.view()==="gallery"),z("aria-pressed",o.view.view()==="gallery"),l(4),R("disabled",!o.videos().length),l(),F(o.videos()),l(2),R("title",o.store.file()??""),l(),M(o.store.doc()?.title),l(2),D(o.view.view()==="editor"?15:-1),l(),D(o.notify.supported?16:-1),l(2),R("disabled",!o.store.canUndo()),l(2),R("disabled",!o.store.canRedo()),l(2),q("dirty",o.store.dirty())("error",o.store.saveState()==="error"||o.store.saveState()==="conflict"),R("title",o.store.saveError()??"Save (Cmd/Ctrl+S)"),l(),B(" ",o.saveLabel()," "),l(),D(o.issues.errorCount()?24:-1),l(),D(o.issues.silenced().count?25:-1),l(),R("disabled",!o.store.doc()),l(),B(" ",o.renderJobs.current()?.status==="running"?"Rendering\u2026":"Render\u2026"," "))},encapsulation:2})};function Iw(t,e){t&1&&(h(0,"div",1),u(1),h(2,"code"),u(3,"beatsheet studio"),m(),u(4," running?"),m()),t&2&&(l(),B("",e," \u2014 is "))}function Sw(t,e){if(t&1){let n=j();h(0,"div",2)(1,"p")(2,"strong"),u(3,"This video changed on disk."),m(),u(4," Autosave is paused. "),h(5,"em"),u(6,"Reload from disk"),m(),u(7," drops your unsaved edits and undo history; "),h(8,"em"),u(9,"Keep mine"),m(),u(10," overwrites the file with your version. "),m(),h(11,"button",5),k("click",function(){I(n);let i=p();return S(i.store.reloadFromDisk())}),u(12,"Reload from disk"),m(),h(13,"button",6),k("click",function(){I(n);let i=p();return S(i.store.keepMine())}),u(14,"Keep mine"),m()()}}function ww(t,e){t&1&&(h(0,"div",1),u(1),m()),t&2&&(l(),M(e))}function Tw(t,e){t&1&&(h(0,"div",1),u(1),m()),t&2&&(l(),M(e))}function Dw(t,e){if(t&1&&Ye(0,"app-empty-project",3),t&2){let n=p();N("hidden",n.view.view()==="gallery")}}function Mw(t,e){if(t&1&&(h(0,"main",4),Ye(1,"app-preview",7)(2,"app-inspector",8)(3,"app-timeline",9),m()),t&2){let n=p();N("hidden",n.view.view()==="gallery")}}function Nw(t,e){if(t&1&&Ye(0,"app-gallery",3),t&2){let n=p();N("hidden",n.view.view()!=="gallery")}}function kw(t,e){if(t&1){let n=j();h(0,"app-render-dialog",10),k("closed",function(){I(n);let i=p();return S(i.renderOpen.set(!1))}),m()}}function Rw(t,e){t&1&&Ye(0,"app-scene-picker")}function sy(t){return t instanceof HTMLElement?t.isContentEditable||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?!0:t instanceof HTMLInputElement?!["checkbox","radio","button","submit","reset","color","file"].includes(t.type):!1:!1}var zs=class t{store=w(Q);bridge=w(le);renderJobs=w(xt);speech=w(et);view=w(_t);picker=w(bt);renderOpen=A(!1);constructor(){this.store.init(),He(()=>{let e=this.store.file();e&&Xe(()=>{this.renderJobs.sync(e)})}),He(()=>{let e=this.store.file();Xe(()=>this.speech.open(e))}),He(()=>{this.store.saves()>0&&Xe(()=>this.speech.scheduleRefresh())}),He(()=>{let e=this.store.doc(),n=this.store.format();e&&Xe(()=>this.bridge.requestLoad(e,n))})}onKeydown(e){if(e.defaultPrevented)return;let n=e.metaKey||e.ctrlKey,o=e.key.toLowerCase();if(n&&o==="s"){e.preventDefault(),this.store.save();return}if(this.picker.isOpen())return;if(n&&(o==="z"||o==="y")){if(sy(e.target))return;e.preventDefault(),o==="y"||e.shiftKey?this.store.redo():this.store.undo();return}if(n||e.altKey||sy(e.target)||this.renderOpen()||this.view.view()==="gallery")return;let i=this.bridge.timeline(),r=i?.fps??this.store.doc()?.fps??30,s=i?.duration??0;switch(e.key){case" ":if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement)return;e.preventDefault(),this.bridge.togglePlay();break;case"ArrowLeft":case"ArrowRight":{e.preventDefault(),this.bridge.playing()&&this.bridge.pause();let a=(e.shiftKey?Math.round(r):1)*(e.key==="ArrowLeft"?-1:1);this.bridge.seek(Rs(this.bridge.time(),r,a,s));break}case"Home":e.preventDefault(),this.bridge.seek(0);break;case"End":e.preventDefault(),this.bridge.seek(pi(s,r));break;case"Delete":case"Backspace":{let a=this.store.selectedSceneId();a&&(e.preventDefault(),this.store.deleteScene(a));break}case"Escape":this.store.select(null);break}}onBeforeUnload(e){this.store.dirty()&&(this.store.save(),e.preventDefault())}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=ie({type:t,selectors:[["app-root"]],hostBindings:function(n,o){n&1&&k("keydown",function(r){return o.onKeydown(r)},Vr)("beforeunload",function(r){return o.onBeforeUnload(r)},Qc)("focusout",function(){return o.store.endCoalescing()},Vr)},decls:10,vars:8,consts:[[3,"render"],["role","alert",1,"load-error"],["role","alert",1,"conflict-banner"],[3,"hidden"],[1,"workspace",3,"hidden"],["type","button",3,"click"],["type","button",1,"primary",3,"click"],[1,"pane","pane-preview"],[1,"pane","pane-inspector"],[1,"pane","pane-timeline"],[3,"closed"]],template:function(n,o){if(n&1&&(h(0,"app-top-bar",0),k("render",function(){return o.renderOpen.set(!0)}),m(),T(1,Iw,5,1,"div",1),T(2,Sw,15,0,"div",2),T(3,ww,2,1,"div",1),T(4,Tw,2,1,"div",1),T(5,Dw,1,1,"app-empty-project",3)(6,Mw,4,1,"main",4),T(7,Nw,1,1,"app-gallery",3),T(8,kw,1,0,"app-render-dialog"),T(9,Rw,1,0,"app-scene-picker")),n&2){let i,r,s;l(),D((i=o.store.loadError())?1:-1,i),l(),D(o.store.conflict()?2:-1),l(),D((r=o.store.bugError())?3:-1,r),l(),D((s=o.store.openError())?4:-1,s),l(),D(o.store.empty()?5:6),l(2),D(o.view.galleryLoaded()?7:-1),l(),D(o.renderOpen()?8:-1),l(),D(o.picker.loaded()?9:-1)}},dependencies:[Ws,ws,Hs,$s,Gs,Us,Ss,Bs],encapsulation:2})};Al(zs,Pm).then(t=>t.injector.get(lo).start()).catch(t=>console.error(t));!Sm()&&"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});
|